ChangeLog-2017-03-23   [plain text]


2017-03-23  Andreas Kling  <akling@apple.com>

        Let the UI process do memory kills and replace crashes with diagnostic logging.
        <https://webkit.org/b/170016>
        <rdar://problem/31091292>

        Reviewed by Chris Dumez.

        Remove the memory kill code from WebCore that just crashes in favor of controlled
        teardown from UI process side in WebKit2.

        * page/DiagnosticLoggingKeys.cpp:
        (WebCore::DiagnosticLoggingKeys::simulatedProcessCrashKey):
        (WebCore::DiagnosticLoggingKeys::exceededActiveMemoryLimitKey):
        (WebCore::DiagnosticLoggingKeys::exceededInactiveMemoryLimitKey):
        (WebCore::DiagnosticLoggingKeys::exceededBackgroundCPULimitKey):
        * page/DiagnosticLoggingKeys.h:
        * page/MemoryRelease.cpp:
        (WebCore::didExceedMemoryLimitAndFailedToRecover): Deleted.
        * page/MemoryRelease.h:

2017-03-23  Youenn Fablet  <youenn@apple.com>

        Clean RTCPeerConnection.idl after bug 169978
        https://bugs.webkit.org/show_bug.cgi?id=169989

        Reviewed by Eric Carlson.

        No change of behavior.
        Moving addTransceiver to overloaded method to union type to match spec.
        Refactoring RTCRtpSender to take a String&&.

        * Modules/mediastream/MediaEndpointPeerConnection.cpp:
        (WebCore::MediaEndpointPeerConnection::setRemoteDescriptionTask):
        * Modules/mediastream/RTCPeerConnection.cpp:
        (WebCore::RTCPeerConnection::addTransceiver):
        (WebCore::RTCPeerConnection::completeAddTransceiver):
        * Modules/mediastream/RTCPeerConnection.h:
        * Modules/mediastream/RTCPeerConnection.idl: Cosmetic changes except for addTransceiver.
        * Modules/mediastream/RTCRtpSender.cpp:
        (WebCore::RTCRtpSender::create):
        (WebCore::RTCRtpSender::RTCRtpSender):
        * Modules/mediastream/RTCRtpSender.h:

2017-03-23  Youenn Fablet  <youenn@apple.com>

        Add logging in case libwebrtc.dylib cannot be opened
        https://bugs.webkit.org/show_bug.cgi?id=170017

        Reviewed by Geoffrey Garen.

        No change of behavior.

        * platform/mediastream/libwebrtc/LibWebRTCProvider.cpp:
        (WebCore::LibWebRTCProvider::webRTCAvailable):

2017-03-23  Jiewen Tan  <jiewen_tan@apple.com>

        Unreviewed, a speculative build fix
        <rdar://problem/31225378>

        * crypto/CommonCryptoUtilities.h:

2017-03-23  Brady Eidson  <beidson@apple.com>

        WebSQL databases should not openable in private browsing.
        <rdar://problem/30383335> and https://bugs.webkit.org/show_bug.cgi?id=170013

        Reviewed by Alex Christensen.

        Test: storage/websql/private-browsing-open-disabled.html

        * Modules/webdatabase/DatabaseManager.cpp:
        (WebCore::DatabaseManager::openDatabaseBackend):
        (WebCore::DatabaseManager::tryToOpenDatabaseBackend): Throw an exception if in private browsing.
        * Modules/webdatabase/DatabaseManager.h:

2017-03-22  Dean Jackson  <dino@apple.com>

        NeverDestroyed<MediaQueryEvaluator> must explicitly construct with a String
        https://bugs.webkit.org/show_bug.cgi?id=169987
        <rdar://problem/31211087>

        Reviewed by Alex Christensen.

        CSSDefaultStyleSheets creates a static MediaQueryEvaluator, but thanks
        to the template magic of NeverDestroyed, it was converting the char*
        argument into a bool, and calling the wrong constructor.

        Unfortunately this is difficult to test because it only affects
        the default UA style sheets, and they currently don't have
        and @media rules (which would always evaluate to true given
        the bug). I don't want to put in a useless rule just to check
        if the bug is fixed. When one is added for bug 168447, this change
        will be exercised.

        * css/CSSDefaultStyleSheets.cpp: Explicitly construct with a String
        rather than a char*.
        (WebCore::screenEval):
        (WebCore::printEval):

2017-03-23  Eric Carlson  <eric.carlson@apple.com>

        [MediaStream] Make mock video source work on iOS
        https://bugs.webkit.org/show_bug.cgi?id=169923

        Reviewed by Youenn Fablet.
        
        Generate IOSurface-backed CVPixelBuffers. Allocate them from a 
        CVPixelBufferPool for efficiency.

        No new tests, no functional change.

        * platform/cocoa/CoreVideoSoftLink.cpp:
        * platform/cocoa/CoreVideoSoftLink.h:
        * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm:
        (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::videoTransformationMatrix):
        * platform/mediastream/mac/MockRealtimeVideoSourceMac.h:
        * platform/mediastream/mac/MockRealtimeVideoSourceMac.mm:
        (WebCore::MockRealtimeVideoSourceMac::pixelBufferFromCGImage):
        (WebCore::MockRealtimeVideoSourceMac::applySize):
        * platform/mock/MockRealtimeVideoSource.h:

2017-03-22  Andreas Kling  <akling@apple.com>

        Let MemoryPressureHandler track whether the process is active or inactive.
        <https://webkit.org/b/169990>

        Reviewed by Antti Koivisto.

        Have PerformanceMonitor inform MemoryPressureHandler about relevant
        changes to the page activity states.

        Also change the "1 hour after last page load" policy to "1 hour after
        last being visible in an active window."

        * page/MainFrame.cpp:
        (WebCore::MainFrame::didCompleteLoad):
        * page/MainFrame.h:
        * page/MemoryRelease.cpp:
        (WebCore::processIsEligibleForMemoryKill): Deleted.
        * page/MemoryRelease.h:
        * page/Page.h:
        (WebCore::Page::performanceMonitor):
        * page/PerformanceMonitor.cpp:
        (WebCore::PerformanceMonitor::PerformanceMonitor):
        (WebCore::PerformanceMonitor::activityStateChanged):
        (WebCore::PerformanceMonitor::processMayBecomeInactiveTimerFired):
        (WebCore::PerformanceMonitor::updateProcessStateForMemoryPressure):
        * page/PerformanceMonitor.h:

2017-03-22  Youenn Fablet  <youenn@apple.com>

        Support RTCPeerConnectionState
        https://bugs.webkit.org/show_bug.cgi?id=169978

        Reviewed by Jon Lee.

        Test: webrtc/connection-state.html

        Implementing https://www.w3.org/TR/webrtc/#rtcpeerconnectionstate-enum.
        Its state and event is based on changes made to ice gathering state and ice connection state.

        * CMakeLists.txt: Adding RTCPeerConnectionState idl.
        * DerivedSources.make: Ditto.
        * Modules/mediastream/RTCPeerConnection.cpp: Splitting close in doClose/doStop so that we can send closed event
        in case close is called, but not if stopped.
        (WebCore::RTCPeerConnection::doClose):
        (WebCore::RTCPeerConnection::close):
        (WebCore::RTCPeerConnection::stop):
        (WebCore::RTCPeerConnection::doStop):
        (WebCore::RTCPeerConnection::updateIceGatheringState):
        (WebCore::RTCPeerConnection::updateIceConnectionState):
        (WebCore::RTCPeerConnection::updateConnectionState):
        * Modules/mediastream/RTCPeerConnection.h:
        * Modules/mediastream/RTCPeerConnection.idl: Fixing IDL and minor cosmetic changes
        * Modules/mediastream/RTCPeerConnection.js:
        (setLocalDescription): Cosmetic change.
        (setRemoteDescription):
        * Modules/mediastream/RTCPeerConnectionState.idl: Added.
        * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp:
        (WebCore::LibWebRTCMediaEndpoint::OnIceGatheringChange): Adding 'gathering' state
        * WebCore.xcodeproj/project.pbxproj:
        * dom/EventNames.h:
        * platform/mediastream/RTCPeerConnectionState.h: Added.

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-22  Antti Koivisto  <antti@apple.com>

        Dynamically applied :empty pseudo class with display:none does not get unapplied
        https://bugs.webkit.org/show_bug.cgi?id=169907

        Reviewed by Ryosuke Niwa.

        We improperly reset the styleAffectedByEmpty bit when removing the renderer when :empty starts
        applying. We then fail to invalidate the style when the element becomes non-empty again.

        Fix by resetting the style relation bits only when computing the style.

        Test: fast/css/empty-display-none-invalidation.html

        * dom/Element.cpp:
        (WebCore::Element::resetStyleRelations):

            Expose this separately.

        (WebCore::Element::clearStyleDerivedDataBeforeDetachingRenderer):

            Don't reset style relation bits when removing renderers.

        * dom/Element.h:
        * dom/ElementRareData.h:
        (WebCore::ElementRareData::resetComputedStyle):
        (WebCore::ElementRareData::resetStyleRelations):

            Reset all these bits in one function.

        (WebCore::ElementRareData::resetDynamicRestyleObservations): Deleted.
        * style/StyleTreeResolver.cpp:
        (WebCore::Style::resetStyleForNonRenderedDescendants):
        (WebCore::Style::TreeResolver::resolveComposedTree):

            Call the explicit style relation reset function when recomputing style.

2017-03-22  Michael Catanzaro  <mcatanzaro@igalia.com>

        [GTK] Honor GTK+ font settings
        https://bugs.webkit.org/show_bug.cgi?id=82889

        Reviewed by Carlos Garcia Campos.

        After much discussion with Behdad and Martin (who is still not completely convinced I think
        :) I want to merge cairo font options into the Fontconfig pattern used for rendering using
        cairo_ft_font_options_substitute(). This is how the API was designed to be used anyway.
        Fontconfig will still have final say over whether to actually respect the desktop settings
        or not, so it can still choose to ignore the desktop's settings, but I don't think it makes
        sense to have desktop-wide font settings and not tell Fontconfig about them, especially when
        the whole point of WebKitGTK+ is desktop integration. This should also reduce complaints
        that we're not following desktop settings and that we're drawing fonts differently than
        Firefox.

        * PlatformGTK.cmake:
        * platform/graphics/cairo/CairoUtilities.cpp:
        (WebCore::getDefaultCairoFontOptions):
        * platform/graphics/cairo/CairoUtilities.h:
        * platform/graphics/freetype/FontCacheFreeType.cpp:
        (WebCore::createFontConfigPatternForCharacters):
        (WebCore::strongAliasesForFamily):
        (WebCore::FontCache::createFontPlatformData):
        * platform/graphics/freetype/FontPlatformDataFreeType.cpp:
        (WebCore::getDefaultFontconfigOptions):
        (WebCore::getDefaultCairoFontOptions): Deleted.
        * platform/graphics/gtk/GdkCairoUtilities.cpp:
        (getDefaultCairoFontOptions):

2017-03-22  Antoine Quint  <graouts@apple.com>

        [Modern Media Controls] Controls size lags behind media size
        https://bugs.webkit.org/show_bug.cgi?id=169962
        <rdar://problem/30340293>

        Reviewed by Dean Jackson.

        We used to dispatch the "resize" event to the shadow root on a timer and commit changes to the DOM
        when handling it inside of a requestAnimationFrame() callback. We now dispatch the "resize" event
        as a post-layout task and commit to the DOM right away which ensures immediate size changes of the
        controls.

        * Modules/modern-media-controls/controls/ios-inline-media-controls.js:
        (IOSInlineMediaControls.prototype.layout):
        * Modules/modern-media-controls/controls/macos-fullscreen-media-controls.js:
        (MacOSFullscreenMediaControls.prototype.layout):
        * Modules/modern-media-controls/controls/macos-inline-media-controls.js:
        (MacOSInlineMediaControls.prototype.layout):
        Making some layout() safer by returning early in case they're called during the object construction
        phase, due to the LayoutNode "width" setter now calling that method.

        * Modules/modern-media-controls/controls/media-controls.js:
        (MediaControls.prototype.get width):
        (MediaControls.prototype.set width):
        Calling layout() in the "width" setter to ensure that the inline controls layout is invalidated as
        soon as the controls width changes instead of waiting on the next rAF to update the layout.

        * Modules/modern-media-controls/controls/scheduler.js:
        (const.scheduler.new.prototype.flushScheduledLayoutCallbacks):
        Add a new method to immediately call queued layouts.

        * Modules/modern-media-controls/media/media-controller.js:
        (MediaController.prototype.handleEvent):
        Flush all queued layouts when handling a "resize" event.

        * html/HTMLMediaElement.cpp:
        (WebCore::HTMLMediaElement::layoutSizeChanged):
        Queue the "resize" event as a post-layout task.

        (WebCore::HTMLMediaElement::contextDestroyed):
        * html/HTMLMediaElement.h:
        Remove the queue we no longer use.

2017-03-22  Andy Estes  <aestes@apple.com>

        Try to fix the Mac CMake build after r214266.

        * PlatformMac.cmake:

2017-03-22  Chris Dumez  <cdumez@apple.com>

        WebKit should disallow beforeunload alerts from web pages users have never interacted with
        https://bugs.webkit.org/show_bug.cgi?id=169936
        <rdar://problem/23798897>

        Reviewed by Brent Fulgham.

        WebKit should disallow beforeunload alerts from web pages users have never interacted with.
        This reduces the risk of annoyance to the user and is allowed by the specification:
        - https://html.spec.whatwg.org/multipage/browsers.html#prompt-to-unload-a-document (Step 8):
        which says:
        """
        The user agent is encouraged to avoid asking the user for confirmation if it judges that doing
        so would be annoying, deceptive, or pointless. A simple heuristic might be that if the user
        has not interacted with the document, the user agent would not ask for confirmation before
        unloading it.
        """

        Firefox already implements this, Chrome does not.

        Tests: fast/events/beforeunload-alert-no-user-interaction.html
               fast/events/beforeunload-alert-user-interaction.html
               fast/events/beforeunload-alert-user-interaction2.html

        * loader/FrameLoader.cpp:
        (WebCore::shouldAskForNavigationConfirmation):
        (WebCore::FrameLoader::dispatchBeforeUnloadEvent):

2017-03-22  Brent Fulgham  <bfulgham@apple.com>

        ASan violation in IconLoader::stopLoading
        https://bugs.webkit.org/show_bug.cgi?id=169960
        <rdar://problem/30577691>

        Reviewed by David Kilzer.

        DocumentLoader::finishLoadingIcon handles the life cycle of the IconLoader. Once this method is called,
        we should return immediately rather than attempt to make further modifications to the IconLoader.

        No new tests due to lack of test features (see https://bugs.webkit.org/show_bug.cgi?id=164895). Easily
        tested in MiniBrowser under ASan visiting websites with icons.

        * loader/icon/IconLoader.cpp:
        (WebCore::IconLoader::notifyFinished):

2017-03-22  Nan Wang  <n_wang@apple.com>

        AX: WebKit is returning the wrong rangeForLine
        https://bugs.webkit.org/show_bug.cgi?id=169940

        Reviewed by Chris Fleizach.

        The AXRangeForLine is being calculated using VisiblePostition, so 
        when we try to use the index we should validate it using VisiblePosition.

        Changes are covered in the modified test.

        * accessibility/AXObjectCache.cpp:
        (WebCore::AXObjectCache::traverseToOffsetInRange):
        (WebCore::AXObjectCache::characterOffsetForIndex):

2017-03-22  John Wilander  <wilander@apple.com>

        Resource Load Statistics: Fix partitioning bug for client-side cookie access
        https://bugs.webkit.org/show_bug.cgi?id=169906
        <rdar://problem/31164456>

        Reviewed by Alex Christensen.

        The existing test case was expanded to cover this change.

        * platform/network/NetworkStorageSession.h:
            Moved the two cookieStoragePartition() functions into the class.
            Also declared them const.
        * platform/network/cf/NetworkStorageSessionCFNet.cpp:
        (WebCore::NetworkStorageSession::cookieStoragePartition):
            Now checks whether it should partition or not.
        (WebCore::getPartitioningDomain):
            Inline convenience function.
        (WebCore::NetworkStorageSession::shouldPartitionCookies):
            Renamed since it now receives a top privately controlled domain
            instead of a host.
        (WebCore::cookieStoragePartition): Deleted.
            This moved into NetworkStorageSession.
        (WebCore::hostIsInDomain): Deleted.
            No longer needed since we generate the top privately controlled
            domain for both the resource and the partition.
        (WebCore::NetworkStorageSession::shouldPartitionCookiesForHost): Deleted.
            Renamed WebCore::NetworkStorageSession::shouldPartitionCookies().
        * platform/network/mac/CookieJarMac.mm:
        (WebCore::cookiesInPartitionForURL):
            Now calls WebCore::NetworkStorageSession::cookieStoragePartition().
        (WebCore::setCookiesFromDOM):
            Now calls WebCore::NetworkStorageSession::cookieStoragePartition().
        * platform/network/mac/ResourceHandleMac.mm:
        (WebCore::ResourceHandle::createNSURLConnection):
            Now calls WebCore::NetworkStorageSession::cookieStoragePartition().

2017-03-22  Jer Noble  <jer.noble@apple.com>

        Media files served without an extension will not load in <video> tag.
        https://bugs.webkit.org/show_bug.cgi?id=169895

        Reviewed by Eric Carlson.

        Test: http/tests/media/video-served-as-text-with-type.html

        Media files served without an extension will commonly have no MIME type (or incorrect MIME type) information
        delivered in the HTTP header. In situations like these, if media referenced by a <source> tag with a type=
        attribute containing MIME type (and optionally, codec) information, that type should be used preferentially.

        * platform/graphics/MediaPlayer.h:
        (WebCore::MediaPlayer::contentMIMEType):
        (WebCore::MediaPlayer::contentTypeCodecs):
        (WebCore::MediaPlayer::contentMIMETypeWasInferredFromExtension):
        * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
        (WebCore::MediaPlayerPrivateAVFoundationObjC::createAVAssetForURL):

2017-03-22  Andy Estes  <aestes@apple.com>

        [QuickLook] Move QuickLook.{h,mm} to platform/ios/
        https://bugs.webkit.org/show_bug.cgi?id=169963

        Reviewed by Andreas Kling.

        * WebCore.xcodeproj/project.pbxproj:
        * platform/ios/QuickLook.h: Renamed from Source/WebCore/loader/ios/QuickLook.h.
        * platform/ios/QuickLook.mm: Renamed from Source/WebCore/loader/ios/QuickLook.mm.

2017-03-22  Andy Estes  <aestes@apple.com>

        [QuickLook] Rename QuickLookHandle to PreviewLoader
        https://bugs.webkit.org/show_bug.cgi?id=169961

        Reviewed by Andreas Kling.

        * WebCore.xcodeproj/project.pbxproj:
        * loader/EmptyClients.cpp:
        * loader/FrameLoaderClient.h:
        * loader/ResourceLoader.cpp:
        (WebCore::ResourceLoader::isQuickLookResource):
        * loader/ResourceLoader.h:
        * loader/SubresourceLoader.cpp:
        (WebCore::SubresourceLoader::shouldCreatePreviewLoaderForResponse):
        (WebCore::SubresourceLoader::didReceiveResponse):
        (WebCore::SubresourceLoader::didReceiveData):
        (WebCore::SubresourceLoader::didReceiveBuffer):
        (WebCore::SubresourceLoader::didFinishLoading):
        (WebCore::SubresourceLoader::didFail):
        (WebCore::SubresourceLoader::shouldCreateQuickLookHandleForResponse): Deleted.
        * loader/SubresourceLoader.h:
        * loader/ios/PreviewLoader.h: Copied from Source/WebCore/loader/ios/QuickLook.h.
        * loader/ios/PreviewLoader.mm: Added.
        (testingClient):
        (emptyClient):
        (-[WebPreviewLoader initWithResourceLoader:resourceResponse:]):
        (-[WebPreviewLoader appendDataArray:]):
        (-[WebPreviewLoader finishedAppending]):
        (-[WebPreviewLoader failed]):
        (-[WebPreviewLoader _sendDidReceiveResponseIfNecessary]):
        (-[WebPreviewLoader connection:didReceiveData:lengthReceived:]):
        (-[WebPreviewLoader connectionDidFinishLoading:]):
        (isQuickLookPasswordError):
        (-[WebPreviewLoader connection:didFailWithError:]):
        (WebCore::PreviewLoader::PreviewLoader):
        (WebCore::PreviewLoader::~PreviewLoader):
        (WebCore::PreviewLoader::shouldCreateForMIMEType):
        (WebCore::PreviewLoader::create):
        (WebCore::PreviewLoader::didReceiveData):
        (WebCore::PreviewLoader::didReceiveBuffer):
        (WebCore::PreviewLoader::didFinishLoading):
        (WebCore::PreviewLoader::didFail):
        (WebCore::PreviewLoader::setClientForTesting):
        * loader/ios/QuickLook.h:
        (): Deleted.
        * loader/ios/QuickLook.mm:
        (WebCore::QLPreviewGetSupportedMIMETypesSet):
        (WebCore::removeQLPreviewConverterForURL):
        (WebCore::registerQLPreviewConverterIfNeeded):
        (WebCore::QLPreviewProtocol):
        (WebCore::isQuickLookPreviewURL):
        (qlPreviewConverterDictionaryMutex): Deleted.
        (QLPreviewConverterDictionary): Deleted.
        (QLContentDictionary): Deleted.
        (addQLPreviewConverterWithFileForURL): Deleted.
        (createQLPreviewProtocol): Deleted.
        (testingClient): Deleted.
        (emptyClient): Deleted.
        (-[WebPreviewLoader initWithResourceLoader:resourceResponse:quickLookHandle:]): Deleted.
        (-[WebPreviewLoader appendDataArray:]): Deleted.
        (-[WebPreviewLoader finishedAppending]): Deleted.
        (-[WebPreviewLoader failed]): Deleted.
        (-[WebPreviewLoader _sendDidReceiveResponseIfNecessary]): Deleted.
        (-[WebPreviewLoader connection:didReceiveData:lengthReceived:]): Deleted.
        (-[WebPreviewLoader connectionDidFinishLoading:]): Deleted.
        (isQuickLookPasswordError): Deleted.
        (-[WebPreviewLoader connection:didFailWithError:]): Deleted.
        (WebCore::QuickLookHandle::QuickLookHandle): Deleted.
        (WebCore::QuickLookHandle::~QuickLookHandle): Deleted.
        (WebCore::QuickLookHandle::shouldCreateForMIMEType): Deleted.
        (WebCore::QuickLookHandle::create): Deleted.
        (WebCore::QuickLookHandle::didReceiveData): Deleted.
        (WebCore::QuickLookHandle::didReceiveBuffer): Deleted.
        (WebCore::QuickLookHandle::didFinishLoading): Deleted.
        (WebCore::QuickLookHandle::didFail): Deleted.
        (WebCore::QuickLookHandle::setClientForTesting): Deleted.
        * platform/network/ResourceHandle.h:
        * platform/network/ios/PreviewLoaderClient.h: Renamed from Source/WebCore/platform/network/ios/QuickLookHandleClient.h.
        (WebCore::PreviewLoaderClient::~PreviewLoaderClient):
        * testing/Internals.cpp:
        (WebCore::Internals::resetToConsistentState):
        (WebCore::Internals::setQuickLookPassword):
        * testing/MockPreviewLoaderClient.cpp: Renamed from Source/WebCore/testing/MockQuickLookHandleClient.cpp.
        (WebCore::MockPreviewLoaderClient::singleton):
        (WebCore::MockPreviewLoaderClient::didRequestPassword):
        * testing/MockPreviewLoaderClient.h: Renamed from Source/WebCore/testing/MockQuickLookHandleClient.h.

2017-03-22  Romain Bellessort  <romain.bellessort@crf.canon.fr>

        [Readable Streams API] Implement ReadableStreamBYOBRequest respond() (readable stream state)
        https://bugs.webkit.org/show_bug.cgi?id=169759

        Reviewed by Youenn Fablet.

        Implemented readable state part of respond() function. Parts of code cannot
        currently be reached as they require ReadableStreamBYOBReader to be implemented.

        Added new tests and updated expectations.

        * Modules/streams/ReadableByteStreamInternals.js:
        (readableByteStreamControllerEnqueue): Name shortened.
        (readableByteStreamControllerRespondInternal): Updated with readable state case.
        (cloneArrayBuffer): Added.
        (readableByteStreamControllerRespondInReadableState): Added.
        (readableByteStreamControllerRespondInClosedState): Updated.
        (readableByteStreamControllerProcessPullDescriptors): Added.
        (readableByteStreamControllerFillDescriptorFromQueue): Added.
        (readableByteStreamControllerShiftPendingDescriptor): Name shortened.
        (readableByteStreamControllerCommitDescriptor): Name shortened.
        (readableByteStreamControllerConvertDescriptor): Name shortened.

2017-03-22  Youenn Fablet  <youenn@apple.com>

        RTCPeerConnection is crashing if no backend is created
        https://bugs.webkit.org/show_bug.cgi?id=169938

        Reviewed by Geoffrey Garen.

        RTCPeerConnection should not be visible if it is not able to create a backend.
        In case when this happens anyway, it should be able to be stopped and destroyed without crashing.
        To do so, we need to set its state to closed.

        * Modules/mediastream/RTCPeerConnection.cpp:
        (WebCore::RTCPeerConnection::RTCPeerConnection):
        (WebCore::RTCPeerConnection::close): Cosmetic change, just in case stop becomes reentrant at some point.

2017-03-22  Antoine Quint  <graouts@webkit.org>

        [Modern Media Controls] Rendering glitches for fullscreen controls while dragging
        https://bugs.webkit.org/show_bug.cgi?id=169949
        <rdar://problem/30687803>

        Reviewed by Eric Carlson.

        Clipping the controls bar has some unwelcome side effects and isn't necessary, so
        we simply remove it. An existing test was amended to check that there is no clipping
        applied to the controls bar.

        * Modules/modern-media-controls/controls/macos-fullscreen-media-controls.css:
        (.media-controls.mac.fullscreen > .controls-bar):

2017-03-22  John Wilander  <wilander@apple.com>

        Add back the null check in TextureCacheCV::textureFromImage()
        https://bugs.webkit.org/show_bug.cgi?id=169931
        <rdar://problem/27139820>

        Reviewed by Alex Christensen.

        No new tests. Just adding back a check that was previously there.

        * platform/graphics/cv/TextureCacheCV.mm:
        (WebCore::TextureCacheCV::textureFromImage):

2017-03-21  Antti Koivisto  <antti@apple.com>

        Use AtomicString in RuleSet and RuleFeature
        https://bugs.webkit.org/show_bug.cgi?id=119310
        <rdar://problem/28214658>

        Reviewed by Andreas Kling.

        ..instead of the plain AtomicStringImpl*. This introduces some ref churn but not too much.

        * css/DocumentRuleSets.cpp:
        (WebCore::DocumentRuleSets::ancestorClassRules):
        (WebCore::DocumentRuleSets::ancestorAttributeRulesForHTML):
        * css/DocumentRuleSets.h:
        * css/ElementRuleCollector.cpp:
        (WebCore::ElementRuleCollector::collectMatchingRules):
        (WebCore::ElementRuleCollector::collectMatchingShadowPseudoElementRules):
        * css/RuleFeature.cpp:
        (WebCore::RuleFeatureSet::recursivelyCollectFeaturesFromSelector):
        (WebCore::makeAttributeSelectorKey):
        (WebCore::RuleFeatureSet::collectFeatures):
        * css/RuleFeature.h:
        * css/RuleSet.cpp:
        (WebCore::RuleSet::addToRuleSet):
        (WebCore::rulesCountForName):
        (WebCore::RuleSet::addRule):
        * css/RuleSet.h:
        (WebCore::RuleSet::idRules):
        (WebCore::RuleSet::classRules):
        (WebCore::RuleSet::shadowPseudoElementRules):
        (WebCore::RuleSet::tagRules):
        * css/StyleResolver.h:
        (WebCore::StyleResolver::hasSelectorForAttribute):
        (WebCore::StyleResolver::hasSelectorForClass):
        (WebCore::StyleResolver::hasSelectorForId):
        * style/AttributeChangeInvalidation.cpp:
        (WebCore::Style::mayBeAffectedByAttributeChange):
        (WebCore::Style::AttributeChangeInvalidation::invalidateStyle):
        * style/IdChangeInvalidation.cpp:
        (WebCore::Style::mayBeAffectedByHostRules):
        (WebCore::Style::mayBeAffectedBySlottedRules):
        (WebCore::Style::IdChangeInvalidation::invalidateStyle):
        * style/StyleSharingResolver.cpp:
        (WebCore::Style::SharingResolver::resolve):
        (WebCore::Style::SharingResolver::canShareStyleWithElement):
        (WebCore::Style::SharingResolver::classNamesAffectedByRules):

2017-03-22  Youenn Fablet  <youenn@apple.com>

        Safari sends empty "Access-Control-Request-Headers" in preflight request
        https://bugs.webkit.org/show_bug.cgi?id=169851

        Reviewed by Chris Dumez.

        Covered by updated test.

        * loader/CrossOriginAccessControl.cpp:
        (WebCore::createAccessControlPreflightRequest): Not adding "Access-Control-Request-Headers" to
        request header if value is empty.

2017-03-22  Youenn Fablet  <youenn@apple.com>

        XMLHttpRequest: getAllResponseHeaders() should lowercase header names before sorting
        https://bugs.webkit.org/show_bug.cgi?id=169286

        Reviewed by Chris Dumez.

        Covered by rebased tests.

        https://xhr.spec.whatwg.org/#the-getallresponseheaders()-method now mandates to lowercase the header names and
        sort them before appending them. This ensures that differences in the way headers are processed by browsers are
        not visible to web pages. This also moves towards lowercased/case-insensitive header processing which should be
        the norm.

        * xml/XMLHttpRequest.cpp:
        (WebCore::XMLHttpRequest::getAllResponseHeaders): Lower-casing, then sorting, then serializing headers.
        * xml/XMLHttpRequest.h: Storing getAllResponseHeaders result if case needed again.

2017-03-22  Chris Dumez  <cdumez@apple.com>

        Implement the "noopener" feature for window.open()
        https://bugs.webkit.org/show_bug.cgi?id=163960
        <rdar://problem/28941679>

        Reviewed by Sam Weinig.

        Implement the "noopener" feature for window.open(). If 'noopener' is passed to window.open()
        then the new Window's opener property will be null.

        Tests: imported/w3c/web-platform-tests/html/browsers/windows/auxiliary-browsing-contexts/opener-closed.html
               imported/w3c/web-platform-tests/html/browsers/windows/auxiliary-browsing-contexts/opener-multiple.html
               imported/w3c/web-platform-tests/html/browsers/windows/auxiliary-browsing-contexts/opener-noopener.html
               imported/w3c/web-platform-tests/html/browsers/windows/auxiliary-browsing-contexts/opener-noreferrer.html
               imported/w3c/web-platform-tests/html/browsers/windows/auxiliary-browsing-contexts/opener.html

        * page/DOMWindow.cpp:
        (WebCore::DOMWindow::createWindow):
        * page/WindowFeatures.cpp:
        (WebCore::parseWindowFeatures):
        (WebCore::setWindowFeature):
        * page/WindowFeatures.h:

2017-03-21  Sergio Villar Senin  <svillar@igalia.com>

        [Soup] "Only from websites I visit" cookie policy is broken
        https://bugs.webkit.org/show_bug.cgi?id=168912

        Reviewed by Carlos Garcia Campos.

        Do not reset the first party for cookies on redirects. That's properly done for the main
        resource in DocumentLoader::willSendRequest and, in the case of subresources, is absolutely
        wrong (which is what we were doing since r143931).

        The most notable effect was that subresources loaded via redirects were effectively
        bypassing the "no third party" policy for cookies.

        Test: http/tests/security/cookies/third-party-cookie-blocking-redirect.html

        * platform/network/soup/ResourceHandleSoup.cpp:
        (WebCore::doRedirect):

2017-03-22  Carlos Garcia Campos  <cgarcia@igalia.com>

        Make it possible to use WEB_UI_STRING macros to mark translatable strings in glib based ports
        https://bugs.webkit.org/show_bug.cgi?id=169672

        Reviewed by Michael Catanzaro.

        WEB_UI_STRING macros are currently used by Cocoa based ports and Windows port. For other ports it simply returns
        the given string, but it's not translated. In the GTK+ port we have all translatable strings from
        LocalizedStrings.cpp copied in LocalizedStringsGtk.cpp to use the glib macros to mark them as translatable. In
        most of the cases the strings are exactly in the same, in some others (the context menu ones) the string only
        differs in the mnemonics used by GTK, and only in a few cases the strings are different. We could remove most of
        that duplication if strings used by WEB_UI_STRING were marked as translatable in glib based ports too.

        This patch makes that possible with the following changes:

          - Add WEB_UI_STRING_WITH_MNEMONIC() to handle the cases where the strings only differ in the mnemonics. It
            receives the string with mnemonics that is ignored in all ports except GTK+.
          - All platform specific strings have been moved to the platform files, to ensure scanners don't include
            strings from other ports.
          - For the same reason a new macro WEB_UI_CFSTRING has been also added, just to make sure that CF strings are
            only used by CF based ports. The implementation is the same as WEB_UI_STRING, it only changes the name to
            not confuse the scanners.
          - And again for the same reason, for non-CF and non-Glib cases WEB_UI_STRING is not used, since in those cases
            strings are not really translated and String::fromUTF8() is actually used. So, now we use String::fromUTF8()
            directly instead of WEB_UI_STRING to not confuse the scanners.

        * CMakeLists.txt: Add LocalizedStrings.cpp to the compilation.
        * PlatformGTK.cmake: Move LocalizedStringsGtk.cpp to the list of sources not depending on GTK+, since it no
        longer uses GTK+.
        * extract-localizable-strings.pl: Update it to handle the new macros.
        * platform/LocalizedStrings.cpp:
        (WebCore::formatLocalizedString):
        (WebCore::contextMenuItemTagOpenLinkInNewWindow):
        (WebCore::contextMenuItemTagDownloadLinkToDisk):
        (WebCore::contextMenuItemTagOpenImageInNewWindow):
        (WebCore::contextMenuItemTagCopyImageToClipboard):
        (WebCore::contextMenuItemTagOpenFrameInNewWindow):
        (WebCore::contextMenuItemTagCopy):
        (WebCore::contextMenuItemTagGoBack):
        (WebCore::contextMenuItemTagGoForward):
        (WebCore::contextMenuItemTagStop):
        (WebCore::contextMenuItemTagReload):
        (WebCore::contextMenuItemTagCut):
        (WebCore::contextMenuItemTagPaste):
        (WebCore::contextMenuItemTagIgnoreSpelling):
        (WebCore::contextMenuItemTagLearnSpelling):
        (WebCore::contextMenuItemTagLookUpInDictionary):
        (WebCore::contextMenuItemTagOpenLink):
        (WebCore::contextMenuItemTagIgnoreGrammar):
        (WebCore::contextMenuItemTagSpellingMenu):
        (WebCore::contextMenuItemTagShowSpellingPanel):
        (WebCore::contextMenuItemTagCheckSpelling):
        (WebCore::contextMenuItemTagCheckSpellingWhileTyping):
        (WebCore::contextMenuItemTagCheckGrammarWithSpelling):
        (WebCore::contextMenuItemTagFontMenu):
        (WebCore::contextMenuItemTagBold):
        (WebCore::contextMenuItemTagItalic):
        (WebCore::contextMenuItemTagUnderline):
        (WebCore::contextMenuItemTagOutline):
        (WebCore::contextMenuItemTagOpenVideoInNewWindow):
        (WebCore::contextMenuItemTagOpenAudioInNewWindow):
        (WebCore::contextMenuItemTagDownloadVideoToDisk):
        (WebCore::contextMenuItemTagDownloadAudioToDisk):
        (WebCore::contextMenuItemTagExitVideoFullscreen):
        (WebCore::contextMenuItemTagMediaPlay):
        (WebCore::contextMenuItemTagMediaPause):
        (WebCore::contextMenuItemTagMediaMute):
        (WebCore::contextMenuItemTagInspectElement):
        (WebCore::AXAutoFillContactsLabel):
        (WebCore::imageTitle):
        (WebCore::validationMessageRangeUnderflowText):
        (WebCore::validationMessageRangeOverflowText):
        (WebCore::textTrackCountryAndLanguageMenuItemText):
        (WebCore::textTrackLanguageMenuItemText):
        (WebCore::closedCaptionTrackMenuItemText):
        (WebCore::sdhTrackMenuItemText):
        (WebCore::easyReaderTrackMenuItemText):
        (WebCore::forcedTrackMenuItemText):
        (WebCore::audioDescriptionTrackSuffixText):
        (WebCore::webCryptoMasterKeyKeychainLabel):
        * platform/LocalizedStrings.h:
        * platform/cocoa/LocalizedStringsCocoa.mm:
        (WebCore::copyImageUnknownFileLabel):
        (WebCore::contextMenuItemTagSearchInSpotlight):
        (WebCore::contextMenuItemTagSearchWeb):
        (WebCore::contextMenuItemTagShowFonts):
        (WebCore::contextMenuItemTagStyles):
        (WebCore::contextMenuItemTagShowColors):
        (WebCore::contextMenuItemTagSpeechMenu):
        (WebCore::contextMenuItemTagStartSpeaking):
        (WebCore::contextMenuItemTagStopSpeaking):
        (WebCore::contextMenuItemTagCorrectSpellingAutomatically):
        (WebCore::contextMenuItemTagSubstitutionsMenu):
        (WebCore::contextMenuItemTagShowSubstitutions):
        (WebCore::contextMenuItemTagSmartCopyPaste):
        (WebCore::contextMenuItemTagSmartQuotes):
        (WebCore::contextMenuItemTagSmartDashes):
        (WebCore::contextMenuItemTagSmartLinks):
        (WebCore::contextMenuItemTagTextReplacement):
        (WebCore::contextMenuItemTagTransformationsMenu):
        (WebCore::contextMenuItemTagMakeUpperCase):
        (WebCore::contextMenuItemTagMakeLowerCase):
        (WebCore::contextMenuItemTagCapitalize):
        (WebCore::contextMenuItemTagChangeBack):
        (WebCore::contextMenuItemTagEnterVideoEnhancedFullscreen):
        (WebCore::contextMenuItemTagExitVideoEnhancedFullscreen):
        (WebCore::AXARIAContentGroupText):
        (WebCore::AXHorizontalRuleDescriptionText):
        (WebCore::AXMarkText):
        (WebCore::AXMeterGaugeRegionOptimumText):
        (WebCore::AXMeterGaugeRegionSuboptimalText):
        (WebCore::AXMeterGaugeRegionLessGoodText):
        (WebCore::builtInPDFPluginName):
        (WebCore::pdfDocumentTypeDescription):
        (WebCore::postScriptDocumentTypeDescription):
        (WebCore::keygenMenuItem2048):
        (WebCore::keygenKeychainItemName):
        (WebCore::htmlSelectMultipleItems):
        (WebCore::fileButtonChooseMediaFileLabel):
        (WebCore::fileButtonChooseMultipleMediaFilesLabel):
        (WebCore::fileButtonNoMediaFileSelectedLabel):
        (WebCore::fileButtonNoMediaFilesSelectedLabel):
        (WebCore::insertListTypeNone):
        (WebCore::insertListTypeBulleted):
        (WebCore::insertListTypeBulletedAccessibilityTitle):
        (WebCore::insertListTypeNumbered):
        (WebCore::insertListTypeNumberedAccessibilityTitle):
        (WebCore::exitFullScreenButtonAccessibilityTitle):
        * platform/gtk/LocalizedStringsGtk.cpp:
        (WebCore::contextMenuItemTagDelete):
        (WebCore::contextMenuItemTagSelectAll):
        * platform/win/LocalizedStringsWin.cpp:
        (WebCore::contextMenuItemTagSearchWeb):
        (WebCore::uploadFileText):
        (WebCore::allFilesText):

2017-03-21  Myles C. Maxfield  <mmaxfield@apple.com>

        [iOS] Migrate off of CTFontCreateForCSS
        https://bugs.webkit.org/show_bug.cgi?id=168894

        Reviewed by Antti Koivisto.

        Use the new font selection algorithm introduced in r213163 on iOS.

        Test: fast/text/font-weights.html

        * platform/graphics/cocoa/FontCacheCoreText.cpp:
        * platform/graphics/cocoa/FontCocoa.mm: On iOS only, CTFontCreateForCSS()
        will return a 0-sized font if the passed size parameter is 0. However, all
        other CT APIs will create a 12-px-sized font if the passed size parameter is
        0. Most of our code knows and understands this (because this is how it works
        on the Mac). However, this one place needs to be updated to understand this.

2017-03-21  Simon Fraser  <simon.fraser@apple.com>

        Make non-decoded image flashing less intrusive
        https://bugs.webkit.org/show_bug.cgi?id=169942

        Reviewed by Said Abou-Hallawa.

        When compositing borders are enabled, we paint yellow for images that paint but don't yet have a decoded
        frame. Give this yellow 50% alpha to make it less intrusive

        Also log to the images log channel when we destroy decoded data.

        * platform/graphics/BitmapImage.cpp:
        (WebCore::BitmapImage::destroyDecodedData):
        (WebCore::BitmapImage::draw):

2017-03-20  Matt Rajca  <mrajca@apple.com>

        Loosen audio playback restrictions when the volume is 0.
        https://bugs.webkit.org/show_bug.cgi?id=169897

        Reviewed by Eric Carlson.

        Added API tests.

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

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-21  Anders Carlsson  <andersca@apple.com>

        Remove bogus availability annotations from DOM SPI headers.
        rdar://problem/31015675

        Rubber-stamped by Dan Bernstein.

        * platform/cocoa/WebKitAvailability.h:
        Remove __NSi_9876_5 #define.

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-19  Wenson Hsieh  <wenson_hsieh@apple.com>

        Teach TextIndicator to estimate the background color of the given Range
        https://bugs.webkit.org/show_bug.cgi?id=169869
        <rdar://problem/31127272>

        Reviewed by Anders Carlsson and Simon Fraser.

        Introduces a simple heuristic to compute a background color that is appropriate to use as a border surrounding
        the snapshot of the given Range. This work is only carried out if TextIndicatorOptionComputeEstimatedBackgroundColor
        is specified. The details of how this background color is estimated (as well as when to fall back) can be improved
        in several ways (one idea is to sample colors along the edge of the snapshot). For the time being, this patch
        naively walks up the render tree in search of enclosing parent renderers that have background colors. If any
        renderers have a style that is deemed too complex to capture in a single background color, then fall back to the
        base document background color; otherwise, the estimated background color is the result of blending these
        background colors together.

        * page/TextIndicator.cpp:
        (WebCore::styleContainsComplexBackground):

        Bail out of the background color codepath if the renderer has backdrop filters, has a background image, or uses
        a non-normal blend mode.

        (WebCore::fallbackBackgroundColorForTextSelection):
        (WebCore::estimatedBackgroundColorForRange):
        (WebCore::initializeIndicator):
        * page/TextIndicator.h:

2017-03-20  Jer Noble  <jer.noble@apple.com>

        Crash in WebCore: WebCore::CARingBuffer::getCurrentFrameBounds + 28
        https://bugs.webkit.org/show_bug.cgi?id=169887
        <rdar://problem/23648082>

        Reviewed by Eric Carlson.

        Because AudioSourceProviderAVFObjC::prepareCallback() can concievably be called after the AudioSourceProviderAVFObjC
        it refers to has been destroyed, add an extra layer of indirection between the tap and the provider, and invalidate
        that level of indirection before the AudioSourceProviderAVFObjC is destroyed.

        * platform/graphics/avfoundation/AudioSourceProviderAVFObjC.h:
        * platform/graphics/avfoundation/AudioSourceProviderAVFObjC.mm:
        (WebCore::AudioSourceProviderAVFObjC::initCallback):
        (WebCore::AudioSourceProviderAVFObjC::finalizeCallback):
        (WebCore::AudioSourceProviderAVFObjC::prepareCallback):
        (WebCore::AudioSourceProviderAVFObjC::unprepareCallback):
        (WebCore::AudioSourceProviderAVFObjC::processCallback):

2017-03-21  Simon Fraser  <simon.fraser@apple.com>

        Remove logging left in by mistake.

        * rendering/RenderNamedFlowThread.cpp:
        (WebCore::RenderNamedFlowThread::willBeDestroyed):

2017-03-21  Jon Lee  <jonlee@apple.com>

        Clean up RTCSdpType, RTC enums and headers
        https://bugs.webkit.org/show_bug.cgi?id=169741

        Reviewed by Youenn Fablet.

        Convert to RTCSdpType.
        * Modules/mediastream/MediaEndpointPeerConnection.cpp:
        * Modules/mediastream/MediaEndpointPeerConnection.h:
        * Modules/mediastream/MediaEndpointSessionDescription.cpp:
        * Modules/mediastream/MediaEndpointSessionDescription.h:
        * Modules/mediastream/PeerConnectionBackend.cpp:
        * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp:

        Convert SDP argument to lvalue.
        * Modules/mediastream/RTCSessionDescription.cpp:
        * Modules/mediastream/RTCSessionDescription.h:
        * Modules/mediastream/RTCSessionDescription.idl:

        Keep RTC enum IDLs above platform. Move the C++ enum headers into platform.
        * Modules/mediastream/RTCEnums.h: Removed.
        * Modules/mediastream/RTCIceConnectionState.h: Removed.
        * Modules/mediastream/RTCIceGatheringState.h: Removed.
        * Modules/mediastream/RTCIceTransportState.h: Removed.
        * Modules/mediastream/RTCSignalingState.h: Removed.
        * platform/mediastream/PeerConnectionStates.h: Remove from .xcodeproj. Move enums to separate headers.
        * platform/mediastream/RTCBundlePolicy.h:
        * platform/mediastream/RTCIceConnectionState.h:
        * platform/mediastream/RTCIceGatheringState.h:
        * platform/mediastream/RTCIceTransportPolicy.h:
        * platform/mediastream/RTCIceTransportState.h:
        * platform/mediastream/RTCRtpTransceiverDirection.h: Renamed from Source/WebCore/Modules/mediastream/RTCRtpTransceiverDirection.h.
        * platform/mediastream/RTCSdpType.h:
        * platform/mediastream/RTCSignalingState.h:

        Move RtpTransceiverDirection out to a separate IDL.
        * Modules/mediastream/RTCPeerConnection.idl:
        * Modules/mediastream/RTCRtpTransceiver.cpp:
        * Modules/mediastream/RTCRtpTransceiver.h:
        * WebCore.xcodeproj/project.pbxproj:

        Replace RTCEnums include with specific headers per enum.
        * Modules/mediastream/PeerConnectionBackend.h:
        * Modules/mediastream/RTCConfiguration.h:
        * Modules/mediastream/RTCIceTransport.h:
        * Modules/mediastream/RTCPeerConnection.cpp:
        (WebCore::RTCPeerConnection::completeAddTransceiver): Remove unneeded static_cast.
        * Modules/mediastream/RTCPeerConnection.h:
        * Modules/mediastream/RTCRtpTransceiver.h:
        * platform/mediastream/MediaEndpoint.h:
        * platform/mediastream/MediaEndpointConfiguration.h:
        * platform/mock/MockMediaEndpoint.h:

        Clean up license.
        * Modules/mediastream/libwebrtc/LibWebRTCDataChannelHandler.h:
        * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.h:
        * Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.h:

        Modernize header to use #pragma once.
        * platform/mediastream/RTCDTMFSenderHandler.h:
        * platform/mediastream/RTCDTMFSenderHandlerClient.h:
        * platform/mediastream/RTCIceCandidateDescriptor.h:
        * platform/mediastream/RTCPeerConnectionHandlerClient.h:
        * platform/mediastream/RTCSessionDescriptionDescriptor.h:
        * platform/mediastream/RTCSessionDescriptionRequest.h:
        * platform/mediastream/RTCVoidRequest.h:
        * platform/mock/RTCNotifiersMock.h:

2017-03-20  Jon Lee  <jonlee@apple.com>

        Add iceCandidatePoolSize to RTCConfiguration
        https://bugs.webkit.org/show_bug.cgi?id=169866

        Reviewed by Youenn Fablet.

        Test: webrtc/rtcconfiguration-icecandidatepoolsize.html

        * Modules/mediastream/RTCConfiguration.h:
        * Modules/mediastream/RTCConfiguration.idl: Add iceCandidatePoolSize.
        * Modules/mediastream/RTCPeerConnection.cpp:
        (WebCore::RTCPeerConnection::setConfiguration):
        * Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.cpp:
        (WebCore::configurationFromMediaEndpointConfiguration): Set the size in libwebrtc.
        * platform/mediastream/MediaEndpointConfiguration.cpp:
        (WebCore::MediaEndpointConfiguration::MediaEndpointConfiguration):
        * platform/mediastream/MediaEndpointConfiguration.h:

2017-03-20  Jon Lee  <jonlee@apple.com>

        Follow-up on comments for bug 169664
        https://bugs.webkit.org/show_bug.cgi?id=169709

        Reviewed by Youenn Fablet.

        * Modules/mediastream/MediaEndpointPeerConnection.cpp:
        (WebCore::deriveAggregatedIceConnectionState): Update deriveAggregatedIceConnectionState.
        (WebCore::MediaEndpointPeerConnection::iceTransportStateChanged): Set a capacity and used
        uncheckedAppend.

2017-03-20  Simon Fraser  <simon.fraser@apple.com>

        Add a system trace point for memory warning handling
        https://bugs.webkit.org/show_bug.cgi?id=169893

        Reviewed by Zalan Bujtas.

        Add a TraceScope for low memory handling, which logs 'critical' and 'synchronous'.

        * page/MemoryRelease.cpp:
        (WebCore::releaseMemory):

2017-03-20  Simon Fraser  <simon.fraser@apple.com>

        Optimize packing of Document and superclass data members
        https://bugs.webkit.org/show_bug.cgi?id=169880

        Reviewed by Antti Koivisto.

        Move data members around to optimize packing in SecurityContext, SuspendableTimer and Document.
        This saves as few hundred bytes on Document.
        
        Padding detected via Tools/Scripts/dump-class-layout

        * dom/Document.cpp:
        (WebCore::Document::Document):
        * dom/Document.h:
        * dom/ScriptExecutionContext.h:
        * dom/SecurityContext.cpp:
        (WebCore::SecurityContext::SecurityContext):
        * dom/SecurityContext.h:
        * page/SuspendableTimer.cpp:
        (WebCore::SuspendableTimer::SuspendableTimer):
        * page/SuspendableTimer.h:

2017-03-20  Chris Dumez  <cdumez@apple.com>

        Suspend media playback in background tabs
        https://bugs.webkit.org/show_bug.cgi?id=169883
        <rdar://problem/28056151>

        Reviewed by Eric Carlson.

        Suspend media playback in background tabs to save battery
        except in cases where we cannot (e.g. PiP, AirPlay).

        Test: media/media-playback-page-visibility.html

        * html/HTMLMediaElement.cpp:
        (WebCore::HTMLMediaElement::visibilityStateChanged):
        When page visibility state changes, begin / end media session
        interruption with reason PlatformMediaSession::EnteringBackground.
        This reason was already used on iOS when the application enters
        or exist background. HTMLMediaElement::shouldOverrideBackgroundPlaybackRestriction()
        takes care of preventing interruption in case of AirPlay or PiP.

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-20  Alex Christensen  <achristensen@webkit.org>

        Prepare SocketStreamHandle for being created from WK2
        https://bugs.webkit.org/show_bug.cgi?id=169885

        Reviewed by Andy Estes.

        No change in behavior.

        * Modules/websockets/WebSocketChannel.cpp:
        (WebCore::WebSocketChannel::didOpenSocketStream):
        (WebCore::WebSocketChannel::sendFrame):
        Rename send to sendData to prevent name collisions with IPC::MessageSender::send.
        * platform/network/SocketStreamHandle.cpp:
        (WebCore::SocketStreamHandle::sendData):
        (WebCore::SocketStreamHandle::send): Deleted.
        * platform/network/SocketStreamHandle.h:
        * platform/network/cf/SocketStreamHandleImpl.h:
        * platform/network/curl/SocketStreamHandleImpl.h:
        * platform/network/soup/SocketStreamHandleImpl.h:
        Make platformSend and platformClose public so I can call them from IPC proxies.

2017-03-20  Andy Estes  <aestes@apple.com>

        [QuickLook] Subresources should be in the same origin as the main document
        https://bugs.webkit.org/show_bug.cgi?id=169868
        <rdar://problem/29898214>

        Reviewed by Daniel Bates.

        Prior to this change, QuickLook documents were placed in a unique origin, which meant all
        subresources were loaded as cross-origin requests. This prevented XMLHttpRequests to the
        QuickLook custom protocol, since cross-origin XHRs must be made to a protocol that
        understands CORS.

        Instead of a unique origin, we now create an origin for QuickLook documents from the preview
        response URL (an x-apple-ql-id: URL), which will allow QuickLook to make same-origin XHRs by
        using a URL with the same scheme and host as the preview response URL.

        Test: http/tests/quicklook/same-origin-xmlhttprequest-allowed.html

        * dom/Document.cpp:
        (WebCore::Document::applyQuickLookSandbox):

2017-03-17  Jiewen Tan  <jiewen_tan@apple.com>

        window.crypto.getRandomValues() uses the insecure RC4 RNG
        https://bugs.webkit.org/show_bug.cgi?id=169623
        <rdar://problem/31044229>

        Reviewed by Brent Fulgham.

        This patch replaces the RC4 RNG with one based on AES-CTR.

        No change of behavior.

        * page/Crypto.cpp:
        (WebCore::Crypto::getRandomValues):

2017-03-20  Eric Carlson  <eric.carlson@apple.com>

        [MediaStream] Respect constraints passed to getUserMedia
        https://bugs.webkit.org/show_bug.cgi?id=169870
        <rdar://problem/31138936>

        Reviewed by Youenn Fablet and Jer Noble.
        
        Remember the fitness score calculated when evaluating constraints passed to getUserMedia, so
        the best device is chosen when more than one device supports the constraints. Register two
        mock video and two mock audio devices with different capabilities so these changes can 
        be tested.

        No new tests, existing tests updated.

        * platform/mediastream/RealtimeMediaSource.cpp:
        (WebCore::RealtimeMediaSource::selectSettings): Store fitness score in m_fitnessScore.
        * platform/mediastream/RealtimeMediaSource.h:

        * platform/mediastream/mac/MockRealtimeAudioSourceMac.h:
        * platform/mediastream/mac/MockRealtimeAudioSourceMac.mm:
        (WebCore::MockRealtimeAudioSource::create): Don't assume sampleRate is 44.1K
        (WebCore::MockRealtimeAudioSourceMac::emitSampleBuffers): Use sampleRate() instead of m_sampleRate.
        (WebCore::MockRealtimeAudioSourceMac::reconfigure): Ditto.
        (WebCore::MockRealtimeAudioSourceMac::render): Ditto.
        (WebCore::MockRealtimeAudioSourceMac::applySampleRate): Ditto.

        * platform/mock/MockRealtimeAudioSource.cpp:
        (WebCore::MockRealtimeAudioSource::updateSettings): Don't assume sampleRate is 44.1K
        (WebCore::MockRealtimeAudioSource::initializeCapabilities): Support a range of sample rates.
        (WebCore::MockRealtimeAudioSource::startProducingData): Initialize sampleRate if it hasn't
        already been set.

        * platform/mock/MockRealtimeMediaSource.cpp:
        (WebCore::MockRealtimeMediaSource::audioDevices): Return an array of devices.
        (WebCore::MockRealtimeMediaSource::videoDevices): Ditto.
        (WebCore::MockRealtimeMediaSource::MockRealtimeMediaSource):
        (WebCore::MockRealtimeMediaSource::mockAudioSourcePersistentID): Deleted.
        (WebCore::MockRealtimeMediaSource::mockVideoSourcePersistentID): Deleted.
        (WebCore::MockRealtimeMediaSource::mockAudioSourceName): Deleted.
        (WebCore::MockRealtimeMediaSource::mockVideoSourceName): Deleted.
        (WebCore::MockRealtimeMediaSource::audioDeviceInfo): Deleted.
        (WebCore::MockRealtimeMediaSource::videoDeviceInfo): Deleted.
        * platform/mock/MockRealtimeMediaSource.h:

        * platform/mock/MockRealtimeMediaSourceCenter.cpp:
        (WebCore::MockRealtimeMediaSourceCenter::validateRequestConstraints):
        (WebCore::MockRealtimeMediaSourceCenter::createMediaStream):
        (WebCore::MockRealtimeMediaSourceCenter::getMediaStreamDevices):
        * platform/mock/MockRealtimeVideoSource.cpp:
        (WebCore::MockRealtimeVideoSource::MockRealtimeVideoSource):

2017-03-20  Wenson Hsieh  <wenson_hsieh@apple.com>

        TextIndicator should support a mode where selection rects are used to size the snapshot
        https://bugs.webkit.org/show_bug.cgi?id=169845
        <rdar://problem/31127818>

        Reviewed by Beth Dakin.

        Adds TextIndicator support in iOS for using the would-be selection rects of a given range to determine
        snapshotting bounds. See below changes for more details.

        * dom/Range.cpp:
        (WebCore::Range::collectSelectionRectsWithoutUnionInteriorLines):
        (WebCore::Range::collectSelectionRects):

        Mark these helper methods as const.

        * dom/Range.h:
        * page/TextIndicator.cpp:
        (WebCore::getSelectionRectsForRange):
        (WebCore::initializeIndicator):

        If TextIndicatorOptionUseSelectionRectForSizing is enabled, then compute selection rects and set the text rects
        to be the resulting selection rects. These are in document coordinates.

        * page/TextIndicator.h:

2017-03-20  Simon Fraser  <simon.fraser@apple.com>

        Move code out of renderer destructors into willBeDestroyed()
        https://bugs.webkit.org/show_bug.cgi?id=169650

        Reviewed by Antti Koivisto.

        This is done for four reasons. First, code in willBeDestroyed() is able to call
        virtual functions on derived classes. Second, this code will run before we've destroyed
        the renderer's rareData, so can safely access it. Third, RenderWidget is special, and can have
        its lifetime extended via manual ref-counting, and we want all cleanup to complete
        before it goes into this weird zombie state. Fourth, in a shiny future where we have
        ref-counted RenderObjects, we want cleanup code to be run explicitly and not tied
        to object lifetime, and this is a step in that direction.

        For all classes that derive from RenderObject, move code from the destructor into
        willBeDestroyed(). New willBeDestroyed() implementations must call the base class.

        RenderBlock and RenderBlockFlow are special; RenderBlockFlow::willBeDestroyed()
        skips over RenderBlock::willBeDestroyed(), but they both need to run some code, which
        I moved into RenderBlock::blockWillBeDestroyed().

        * rendering/RenderBlock.cpp:
        (WebCore::RenderBlock::~RenderBlock):
        (WebCore::RenderBlock::willBeDestroyed):
        (WebCore::RenderBlock::blockWillBeDestroyed):
        * rendering/RenderBlock.h:
        * rendering/RenderBlockFlow.cpp:
        (WebCore::RenderBlockFlow::~RenderBlockFlow):
        (WebCore::RenderBlockFlow::willBeDestroyed):
        * rendering/RenderBox.cpp:
        (WebCore::RenderBox::~RenderBox):
        (WebCore::RenderBox::willBeDestroyed):
        * rendering/RenderBox.h:
        * rendering/RenderBoxModelObject.cpp:
        (WebCore::RenderBoxModelObject::~RenderBoxModelObject):
        * rendering/RenderCounter.cpp:
        (WebCore::RenderCounter::~RenderCounter):
        (WebCore::RenderCounter::willBeDestroyed):
        * rendering/RenderCounter.h:
        * rendering/RenderElement.cpp:
        (WebCore::RenderElement::~RenderElement):
        (WebCore::RenderElement::willBeDestroyed):
        * rendering/RenderEmbeddedObject.cpp:
        (WebCore::RenderEmbeddedObject::~RenderEmbeddedObject):
        (WebCore::RenderEmbeddedObject::willBeDestroyed):
        * rendering/RenderEmbeddedObject.h:
        * rendering/RenderImage.cpp:
        (WebCore::RenderImage::~RenderImage):
        (WebCore::RenderImage::willBeDestroyed):
        * rendering/RenderImage.h:
        * rendering/RenderLayerModelObject.cpp:
        (WebCore::RenderLayerModelObject::~RenderLayerModelObject):
        (WebCore::RenderLayerModelObject::willBeDestroyed):
        * rendering/RenderLayerModelObject.h:
        * rendering/RenderLineBreak.cpp:
        (WebCore::RenderLineBreak::~RenderLineBreak):
        (WebCore::RenderLineBreak::willBeDestroyed):
        * rendering/RenderLineBreak.h:
        * rendering/RenderListBox.cpp:
        (WebCore::RenderListBox::~RenderListBox):
        (WebCore::RenderListBox::willBeDestroyed):
        * rendering/RenderListBox.h:
        * rendering/RenderListItem.cpp:
        (WebCore::RenderListItem::~RenderListItem):
        (WebCore::RenderListItem::willBeDestroyed):
        * rendering/RenderListItem.h:
        * rendering/RenderListMarker.cpp:
        (WebCore::RenderListMarker::~RenderListMarker):
        (WebCore::RenderListMarker::willBeDestroyed):
        * rendering/RenderListMarker.h:
        * rendering/RenderMenuList.cpp:
        (WebCore::RenderMenuList::~RenderMenuList):
        (WebCore::RenderMenuList::willBeDestroyed):
        * rendering/RenderMenuList.h:
        * rendering/RenderNamedFlowThread.cpp:
        (WebCore::RenderNamedFlowThread::~RenderNamedFlowThread):
        (WebCore::RenderNamedFlowThread::willBeDestroyed):
        * rendering/RenderNamedFlowThread.h:
        * rendering/RenderObject.cpp:
        (WebCore::RenderObject::willBeDestroyed):
        * rendering/RenderQuote.cpp:
        (WebCore::RenderQuote::~RenderQuote):
        (WebCore::RenderQuote::willBeDestroyed):
        * rendering/RenderQuote.h:
        * rendering/RenderSearchField.cpp:
        (WebCore::RenderSearchField::~RenderSearchField):
        (WebCore::RenderSearchField::willBeDestroyed):
        * rendering/RenderSearchField.h:
        * rendering/RenderSnapshottedPlugIn.cpp:
        (WebCore::RenderSnapshottedPlugIn::~RenderSnapshottedPlugIn):
        (WebCore::RenderSnapshottedPlugIn::willBeDestroyed):
        * rendering/RenderSnapshottedPlugIn.h:
        * rendering/RenderText.cpp:
        (WebCore::RenderText::~RenderText):
        (WebCore::RenderText::willBeDestroyed):
        * rendering/RenderTextControlMultiLine.cpp:
        (WebCore::RenderTextControlMultiLine::~RenderTextControlMultiLine):
        (WebCore::RenderTextControlMultiLine::willBeDestroyed):
        * rendering/RenderTextControlMultiLine.h:
        * rendering/RenderVideo.cpp:
        (WebCore::RenderVideo::~RenderVideo):
        (WebCore::RenderVideo::willBeDestroyed):
        * rendering/RenderVideo.h:
        * rendering/RenderWidget.h:
        * rendering/svg/RenderSVGImage.cpp:
        (WebCore::RenderSVGImage::~RenderSVGImage):
        (WebCore::RenderSVGImage::willBeDestroyed):
        * rendering/svg/RenderSVGImage.h:
        * rendering/svg/RenderSVGResourceContainer.cpp:
        (WebCore::RenderSVGResourceContainer::~RenderSVGResourceContainer):
        (WebCore::RenderSVGResourceContainer::willBeDestroyed):

2017-03-20  Jon Lee  <jonlee@apple.com>

        Mark differences in media stream implementation
        https://bugs.webkit.org/show_bug.cgi?id=169873

        Reviewed by Eric Carlson.

        Rearrange IDL and add comments based on 05 February 2017 Editor's Draft of Media
        Capture and Streams spec.
        * Modules/mediastream/DOMURLMediaStream.idl:
        * Modules/mediastream/MediaDeviceInfo.idl:
        * Modules/mediastream/MediaDevices.idl:
        * Modules/mediastream/MediaStream.idl:
        * Modules/mediastream/MediaStreamEvent.idl:
        * Modules/mediastream/MediaStreamTrack.idl:
        * Modules/mediastream/MediaStreamTrackEvent.idl:
        * Modules/mediastream/MediaTrackConstraints.idl:
        * Modules/mediastream/MediaTrackSupportedConstraints.idl:
        * Modules/mediastream/NavigatorMediaDevices.idl:
        * Modules/mediastream/NavigatorUserMedia.idl:

2017-03-20  Per Arne Vollan  <pvollan@apple.com>

        Use CopyFontDescriptorWithStrokeForStyle to get correct stroke width for captions.
        https://bugs.webkit.org/show_bug.cgi?id=169674

        Reviewed by Eric Carlson.

        Use the MediaAccessibility function MACopyFontDescriptorWithStrokeForStyle to get
        correct video captions stroke width from a given font size.

        * html/shadow/MediaControlElements.cpp:
        (WebCore::MediaControlTextTrackContainerElement::updateTextStrokeStyle):
        (WebCore::MediaControlTextTrackContainerElement::updateTimerFired):
        * html/shadow/MediaControlElements.h:
        * page/CaptionUserPreferences.h:
        (WebCore::CaptionUserPreferences::captionStrokeWidth):
        * page/CaptionUserPreferencesMediaAF.cpp:
        (WebCore::CaptionUserPreferencesMediaAF::captionStrokeWidth):
        (WebCore::CaptionUserPreferencesMediaAF::captionsTextEdgeCSS):
        (WebCore::CaptionUserPreferencesMediaAF::strokeWidth): Deleted.
        * page/CaptionUserPreferencesMediaAF.h:
        * platform/cf/MediaAccessibilitySoftLink.cpp:
        * platform/cf/MediaAccessibilitySoftLink.h:

2017-03-20  Emanuele Aina  <emanuele.aina@collabora.com>

        [Cairo] Ensure depth and stencil renderbuffers are created on GLESv2
        https://bugs.webkit.org/show_bug.cgi?id=166643

        Reviewed by Darin Adler.

        If the gfx device doesn't support GL_OES_packed_depth_stencil, the
        separate depth and stencil buffers are not generated.

        Copy what GraphicsContext3DEfl used to do and apply it in
        GraphicsContext3DCairo.

        The Intel gfx driver seem to tolerate unbound renderbuffers, but
        enabling debugging in Mesa yields an error:

        $ MESA_DEBUG=1 \
          MESA_EXTENSION_OVERRIDE=-GL_OES_packed_depth_stencil
          ./bin/MiniBrowser http://webglsamples.org/aquarium/aquarium.html
        Mesa: User error: GL_INVALID_OPERATION in glRenderbufferStorage(no renderbuffer bound)

        * platform/graphics/GraphicsContext3D.h:
        * platform/graphics/cairo/GraphicsContext3DCairo.cpp:
        (WebCore::GraphicsContext3D::GraphicsContext3D):
        Ensure separate depth and stencil renderbuffers are created.
        (WebCore::GraphicsContext3D::~GraphicsContext3D):
        Ensure separate depth and stencil renderbuffers are released.

2017-03-19  Chris Dumez  <cdumez@apple.com>

        Implement self.origin
        https://bugs.webkit.org/show_bug.cgi?id=168023

        Reviewed by Sam Weinig.

        Implement self.origin:
        - https://html.spec.whatwg.org/multipage/webappapis.html#windoworworkerglobalscope

        Firefox and Chrome already support this.

        Test: imported/w3c/web-platform-tests/html/webappapis/the-windoworworkerglobalscope-mixin/Worker_Self_Origin.html

        * page/DOMWindow.cpp:
        (WebCore::DOMWindow::origin):
        * page/DOMWindow.h:
        * page/WindowOrWorkerGlobalScope.idl:
        * workers/WorkerGlobalScope.cpp:
        (WebCore::WorkerGlobalScope::origin):
        * workers/WorkerGlobalScope.h:

2017-03-18  Jon Lee  <jonlee@apple.com>

        Add support for ImplementedAs, Clamp, EnforceRange, TreatNullAs for dictionary members
        https://bugs.webkit.org/show_bug.cgi?id=169731

        Reviewed by Alex Christensen.

        * bindings/scripts/CodeGeneratorJS.pm:
        (GenerateDictionaryImplementationContent): Create a new $implementationAsKey. Look for
        ImplementedAs, and if it exists, override the value with the alias. Set the parameters of
        convert<>() using JSValueToNative.
        (IsValidContextForJSValueToNative): Update to include IDLDictionaryMembers.
        (JSValueToNative): Bypass parseEnumeration serialization for enums if the context is an
        IDLDictionaryMember. Dictionary members need convert<IDLEnumeration> which throw a TypeError
        or return the enum (and utilizes parseEnumeration). parseEnumeration, in contrast, returns
        an optional.

        * bindings/scripts/test/TestObj.idl: Add test cases in TestDictionary.

        Update test results.
        * bindings/scripts/test/JS/JSTestEventConstructor.cpp:
        * bindings/scripts/test/JS/JSTestObj.cpp:
        * bindings/scripts/test/JS/JSTestStandaloneDictionary.cpp:

2017-03-18  Simon Fraser  <simon.fraser@apple.com>

        Use initializers for Document member variables
        https://bugs.webkit.org/show_bug.cgi?id=169848

        Reviewed by Chris Dumez.

        Move Document to use C++11 brace initializers.

        No behavior change.

        * dom/Document.cpp:
        (WebCore::Document::Document):
        * dom/Document.h:
        (WebCore::Document::xmlStandaloneStatus):
        (WebCore::Document::setHasXMLDeclaration):

2017-03-18  Chris Dumez  <cdumez@apple.com>

        innerText setter inserts empty text node if value starts with newline
        https://bugs.webkit.org/show_bug.cgi?id=169600

        Reviewed by Ryosuke Niwa.

        innerText setter should not create empty text nodes as per:
        - https://html.spec.whatwg.org/multipage/dom.html#the-innertext-idl-attribute (step 6.2)

        No new tests, updated existing test.

        * html/HTMLElement.cpp:
        (WebCore::textToFragment):

2017-03-18  Chris Dumez  <cdumez@apple.com>

        Allow setting the prototype of cross-origin objects, as long as they don't change
        https://bugs.webkit.org/show_bug.cgi?id=169787

        Reviewed by Mark Lam.

        Allow setting the prototype of cross-origin objects, as long as they don't change:
        - https://html.spec.whatwg.org/multipage/browsers.html#windowproxy-setprototypeof
        - https://html.spec.whatwg.org/multipage/browsers.html#location-setprototypeof
        - https://tc39.github.io/ecma262/#sec-set-immutable-prototype

        Tests: imported/w3c/web-platform-tests/common/domain-setter.sub.html
               imported/w3c/web-platform-tests/html/browsers/history/the-location-interface/location-prototype-setting-cross-origin-domain.sub.html
               imported/w3c/web-platform-tests/html/browsers/history/the-location-interface/location-prototype-setting-goes-cross-origin-domain.sub.html
               imported/w3c/web-platform-tests/html/browsers/history/the-location-interface/location-prototype-setting-same-origin-domain.sub.html
               imported/w3c/web-platform-tests/html/browsers/history/the-location-interface/location-prototype-setting-same-origin.html
               imported/w3c/web-platform-tests/html/browsers/the-windowproxy-exotic-object/windowproxy-prototype-setting-cross-origin-domain.sub.html
               imported/w3c/web-platform-tests/html/browsers/the-windowproxy-exotic-object/windowproxy-prototype-setting-goes-cross-origin-domain.sub.html
               imported/w3c/web-platform-tests/html/browsers/the-windowproxy-exotic-object/windowproxy-prototype-setting-same-origin-domain.sub.html
               imported/w3c/web-platform-tests/html/browsers/the-windowproxy-exotic-object/windowproxy-prototype-setting-same-origin.html

        * bindings/js/JSLocationCustom.cpp:
        * page/Location.idl:
        Drop custom setPrototype() implementation for Location and mark Location as an immutable
        prototype exotic object now that JSC does the right thing for those.

2017-03-17  Youenn Fablet  <youenn@apple.com>

        Stop sending media data as soon as peer connection is closed
        https://bugs.webkit.org/show_bug.cgi?id=169813

        Reviewed by Eric Carlson.

        Stopping sending of media data as soon as the peer connection is closed.
        By stopping sending at source level, this may stop by a few frames/chunks earlier than before.
        Making sure RealtimeOutgoingVideoSource is stopping observing the media source when being stopped and deleted.

        * Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.cpp:
        (WebCore::LibWebRTCPeerConnectionBackend::doStop):
        * platform/mediastream/mac/RealtimeOutgoingAudioSource.cpp:
        (WebCore::RealtimeOutgoingAudioSource::stop):
        * platform/mediastream/mac/RealtimeOutgoingAudioSource.h:
        * platform/mediastream/mac/RealtimeOutgoingVideoSource.cpp:
        (WebCore::RealtimeOutgoingVideoSource::stop):
        * platform/mediastream/mac/RealtimeOutgoingVideoSource.h:

2017-03-17  Youenn Fablet  <youenn@apple.com>

        Implement incoming webrtc data based on tracksCurr
        https://bugs.webkit.org/show_bug.cgi?id=169836

        Reviewed by Eric Carlson.

        Test: webrtc/video-with-receiver.html

        Constructing incoming tracks based on libwebrtc OnAddTrack.
        Constructing incoming media streams based on libwebrtc OnAddStream.
        Firing only addstream if legacy API flag is on.

        Ensuring that media stream and media stream tracks relationship is still correctly implemented.
        For that, we keep a map that relates libwebrtc media streams with WebCore media streams.
        Adding the ability to get a receiver related to the track on the track event.

        Implementing the possibility to create a transceiver ahead of track arrival time.
        Created transceivers that are not related to any real source are kept in the peer connection back end.
        When a libwebrtc track is appearing, it is associated with the track source of the corresponding transceiver based on track type.

        Added the ability to create empty real time sources and set their data libwebrtc track when being available.

        * Modules/mediastream/MediaStream.cpp:
        (WebCore::MediaStream::addTrackFromPlatform):
        * Modules/mediastream/MediaStream.h:
        * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp:
        (WebCore::LibWebRTCMediaEndpoint::mediaStreamFromRTCStream):
        (WebCore::LibWebRTCMediaEndpoint::addRemoteStream):
        (WebCore::LibWebRTCMediaEndpoint::addRemoteTrack):
        (WebCore::LibWebRTCMediaEndpoint::removeRemoteStream):
        (WebCore::LibWebRTCMediaEndpoint::OnAddStream):
        (WebCore::LibWebRTCMediaEndpoint::OnRemoveStream):
        (WebCore::LibWebRTCMediaEndpoint::OnAddTrack):
        (WebCore::LibWebRTCMediaEndpoint::stop):
        (WebCore::createMediaStreamTrack): Deleted.
        (WebCore::LibWebRTCMediaEndpoint::addStream): Deleted.
        * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.h:
        * Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.cpp:
        (WebCore::LibWebRTCPeerConnectionBackend::doStop):
        (WebCore::createReceiverForSource):
        (WebCore::createEmptySource):
        (WebCore::LibWebRTCPeerConnectionBackend::createReceiver):
        (WebCore::LibWebRTCPeerConnectionBackend::videoReceiver):
        (WebCore::LibWebRTCPeerConnectionBackend::audioReceiver):
        (WebCore::LibWebRTCPeerConnectionBackend::removeRemoteStream):
        (WebCore::LibWebRTCPeerConnectionBackend::addRemoteStream):
        * Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.h:
        * platform/mediastream/mac/RealtimeIncomingAudioSource.cpp:
        (WebCore::RealtimeIncomingAudioSource::setSourceTrack):
        * platform/mediastream/mac/RealtimeIncomingAudioSource.h:
        * platform/mediastream/mac/RealtimeIncomingVideoSource.cpp:
        (WebCore::RealtimeIncomingVideoSource::setSourceTrack):
        * platform/mediastream/mac/RealtimeIncomingVideoSource.h:

2017-03-17  Eric Carlson  <eric.carlson@apple.com>

        [MediaStream] Compensate for video capture orientation
        https://bugs.webkit.org/show_bug.cgi?id=169313
        <rdar://problem/30994785>

        Unreviewed, fix a crash in r214120 found by the bots.

        * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm:
        (-[WebAVSampleBufferStatusChangeListener invalidate]): Drive-by removal of unnecessary code.
        (-[WebAVSampleBufferStatusChangeListener observeValueForKeyPath:ofObject:change:context:]):
        Actually retain self before callOnMainThread.
        (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::~MediaPlayerPrivateMediaStreamAVFObjC): 
        Invalidate the change listener first.

2017-03-17  Dean Jackson  <dino@apple.com>

        MediaQueryList instances do not update for `prefers-reduced-motion`
        https://bugs.webkit.org/show_bug.cgi?id=169835
        <rdar://problem/30339378>

        Reviewed by Anders Carlsson.

        Tell the document it needs to evaluate the MediaQueryLists
        if accessibility settings change.

        Test: fast/media/mq-prefers-reduced-motion-matchMedia.html

        * page/Page.cpp:
        (WebCore::Page::accessibilitySettingsDidChange):

2017-03-17  Brady Eidson  <beidson@apple.com>

        Make HTTPCookieStorage operate in the UIProcess in absence of a WebProcessPool.
        <rdar://problem/31102330> and https://bugs.webkit.org/show_bug.cgi?id=169797

        Reviewed by Alex Christensen.

        No new tests (No behavior change).

        * platform/network/NetworkStorageSession.h:
        * platform/network/cocoa/NetworkStorageSessionCocoa.mm:
        (WebCore::NetworkStorageSession::flushCookieStore):

        * platform/network/soup/NetworkStorageSessionSoup.cpp:
        (WebCore::NetworkStorageSession::flushCookieStore):

2017-03-17  Dave Hyatt  <hyatt@apple.com>

        Disable per-region boxes for multicolumn
        https://bugs.webkit.org/show_bug.cgi?id=169830

        Reviewed by Zalan Bujtas.

        Test: fast/multicol/float-adjacent-to-overflow-block.html

        * rendering/RenderBlockFlow.cpp:
        (WebCore::RenderBlockFlow::determineLogicalLeftPositionForChild):
        * rendering/RenderBox.cpp:
        (WebCore::RenderBox::borderBoxRectInRegion):
        (WebCore::RenderBox::renderBoxRegionInfo):
        Limit all of the per-region box code to RenderNamedFlowThreads.
        This code should never be used by multicolumn layout.

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-17  Jer Noble  <jer.noble@apple.com>

        Explicitly resize the audio buffer in RealtimeOutgoingAudioSource.
        https://bugs.webkit.org/show_bug.cgi?id=169814
        <rdar://problem/30975496>

        Reviewed by Eric Carlson.

        Rather than just reserving sufficient capacity, actually change the buffer's underlying size to match.

        * platform/mediastream/mac/RealtimeOutgoingAudioSource.cpp:
        (WebCore::RealtimeOutgoingAudioSource::pullAudioData):

2017-03-17  Jiewen Tan  <jiewen_tan@apple.com>

        [WebCrypto] Make sure all CryptoKey classes are structured clonable
        https://bugs.webkit.org/show_bug.cgi?id=169232
        <rdar://problem/31106660>

        Reviewed by Brent Fulgham.

        This patch does the following few things: 1) It makes CryptoKeyEC and CryptoKeyRaw
        structured clonable; 2) It makes CryptoKeyAES and CryptoKeyHMAC to use a move importer
        during deserialization; 3) It adds some tests to make sure CryptoKeyAES, CryptoKeyHMAC
        and CryptoKeyRSA won't lose their internal data during serialization/deserialization.

        Tests: crypto/workers/subtle/ec-postMessage-worker.html
               crypto/workers/subtle/raw-postMessage-worker.html

        * bindings/js/SerializedScriptValue.cpp:
        (WebCore::CloneSerializer::write):
        (WebCore::CloneDeserializer::readHMACKey):
        (WebCore::CloneDeserializer::readAESKey):
        (WebCore::CloneDeserializer::readECKey):
        (WebCore::CloneDeserializer::readRawKey):
        (WebCore::CloneDeserializer::readCryptoKey):
        * crypto/keys/CryptoKeyEC.cpp:
        (WebCore::CryptoKeyEC::namedCurveString):
        (WebCore::CryptoKeyEC::isValidECAlgorithm):
        * crypto/keys/CryptoKeyEC.h:

2017-03-17  Michael Saboff  <msaboff@apple.com>

        Use USE_INTERNAL_SDK to compute ENABLE_FAST_JIT_PERMISSIONS instead of HAVE_INTERNAL_SDK
        https://bugs.webkit.org/show_bug.cgi?id=169817

        Reviewed by Filip Pizlo.

        * Configurations/FeatureDefines.xcconfig:

2017-03-17  Eric Carlson  <eric.carlson@apple.com>

        [MediaStream] Compensate for video capture orientation
        https://bugs.webkit.org/show_bug.cgi?id=169313
        <rdar://problem/30994785>

        Reviewed by Jer Noble.

        No new tests, the mock video source doesn't support rotation. Test will be added when this
        is fixed in https://bugs.webkit.org/show_bug.cgi?id=169822.

        Add 'orientation' and 'mirrored' attributes to MediaSample
        * platform/MediaSample.h:
        (WebCore::MediaSample::videoOrientation):
        (WebCore::MediaSample::videoMirrored):
        * platform/graphics/avfoundation/MediaSampleAVFObjC.h:

        A video sample can be rotated and/or mirrored, so the video layer may need to be rotated
        and resized for display. We don't want expose this information to the renderer, so allocate
        return a generic CALayer as the player's platforLayer, and add the video layer as a sublayer
        so we can adjust it to display correctly. Add an enum for playback state as well as display
        mode so we correctly display a black frame when video frames are available but playback has
        not yet started.

        * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.h:
        * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm:
        (-[WebAVSampleBufferStatusChangeListener initWithParent:]):
        (-[WebAVSampleBufferStatusChangeListener invalidate]):
        (-[WebAVSampleBufferStatusChangeListener beginObservingLayers]):
        (-[WebAVSampleBufferStatusChangeListener stopObservingLayers]): Ditto.
        (-[WebAVSampleBufferStatusChangeListener observeValueForKeyPath:ofObject:change:context:]):
        (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::videoTransformationMatrix):
        (WebCore::runWithoutAnimations):
        (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::enqueueVideoSample):
        (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::layerErrorDidChange):
        (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::ensureLayers):
        (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::destroyLayers):
        (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::cancelLoad):
        (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::platformLayer):
        (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::displayLayer):
        (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::backgroundLayer):
        (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::currentDisplayMode):
        (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::updateDisplayMode):
        (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::play):
        (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::pause):
        (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::currentMediaTime):
        (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::activeStatusChanged):
        (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::updateRenderingMode):
        (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::checkSelectedVideoTrack):
        (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::paintCurrentFrameInContext):
        (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::acceleratedRenderingStateChanged):
        (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::setShouldBufferData):
        (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::backgroundLayerBoundsChanged):
        (-[WebAVSampleBufferStatusChangeListener beginObservingLayer:]): Deleted.
        (-[WebAVSampleBufferStatusChangeListener stopObservingLayer:]): Deleted.
        (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::ensureLayer): Deleted.
        (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::destroyLayer): Deleted.
        (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::paused): Deleted.
        (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::shouldBePlaying): Deleted.

        * platform/mediastream/mac/AVVideoCaptureSource.h:
        * platform/mediastream/mac/AVVideoCaptureSource.mm:
        (WebCore::AVVideoCaptureSource::processNewFrame): Add connection parameter so we can get the
        video orientation.
        (WebCore::AVVideoCaptureSource::captureOutputDidOutputSampleBufferFromConnection):

        Pass sample orientation to libwebrtc.
        * platform/mediastream/mac/RealtimeOutgoingVideoSource.cpp:
        (WebCore::RealtimeOutgoingVideoSource::sendFrame):
        (WebCore::RealtimeOutgoingVideoSource::videoSampleAvailable):
        * platform/mediastream/mac/RealtimeOutgoingVideoSource.h:

2017-03-17  Zalan Bujtas  <zalan@apple.com>

        Fix the flow thread state on the descendants of out of flow positioned replaced elements.
        https://bugs.webkit.org/show_bug.cgi?id=169821
        <rdar://problem/30964017>

        Reviewed by Simon Fraser.

        Descendants of a replaced out of flow elmement should inherit the flowthread state
        from the replaced element and not from the replaced element's parent.

        Test: fast/multicol/fix-inherit-when-container-is-replaced.html

        * rendering/RenderObject.cpp:
        (WebCore::RenderObject::computedFlowThreadState):

2017-03-17  Jon Davis  <jond@apple.com>

        Update feature status for outdated entries: CSS Shapes, Force Click Events
        https://bugs.webkit.org/show_bug.cgi?id=169829

        Reviewed by Matt Baker.

        * features.json:

2017-03-17  Alex Christensen  <achristensen@webkit.org>

        Make SocketStreamError a private header.
        https://bugs.webkit.org/show_bug.cgi?id=169831

        * WebCore.xcodeproj/project.pbxproj:
        I'll need this from WebKit2.

2017-03-17  Alex Christensen  <achristensen@webkit.org>

        Add encoder for SocketStreamError
        https://bugs.webkit.org/show_bug.cgi?id=169831

        Reviewed by Andy Estes.

        This isn't used yet, but we'll soon need to send these across IPC.

        * platform/network/SocketStreamError.h:
        (WebCore::SocketStreamError::encode):
        (WebCore::SocketStreamError::decode):

2017-03-17  Alex Christensen  <achristensen@webkit.org>

        Make SocketStreamHandle virtual functions asynchronous
        https://bugs.webkit.org/show_bug.cgi?id=169818

        Reviewed by Andy Estes.

        No change in behavior.  Instead of returning immediately, call a completion handler.
        This is in preparation for making them truly asynchronous.

        I still need to be able to synchronously get the number of buffered bytes, but the
        buffer itself will soon be in the NetworkProcess with a new subclass of SocketStreamHandle
        that messages across IPC.  The number of buffered bytes will still be stored in the WebProcess,
        and when it updates, the message from SocketStreamHandleClient::didUpdateBufferedAmount will update it.

        * CMakeLists.txt:
        * WebCore.xcodeproj/project.pbxproj:
        * platform/network/SocketStreamHandle.cpp:
        (WebCore::SocketStreamHandle::send):
        (WebCore::SocketStreamHandle::close):
        (WebCore::SocketStreamHandle::sendPendingData): Deleted.
        * platform/network/SocketStreamHandle.h:
        (WebCore::SocketStreamHandle::bufferedAmount): Deleted.
        * platform/network/SocketStreamHandleImpl.cpp: Added.
        (WebCore::SocketStreamHandleImpl::platformSend):
        (WebCore::SocketStreamHandleImpl::sendPendingData):
        (WebCore::SocketStreamHandleImpl::bufferedAmount):
        m_buffer was moved from SocketStreamHandle to SocketStreamHandleImpl, so some of the logic must move with it.
        I moved as much logic that was shared in the superclass to a new shared location for code shared among the subclass implementations.
        * platform/network/cf/SocketStreamHandleImpl.h:
        * platform/network/cf/SocketStreamHandleImplCFNet.cpp:
        (WebCore::SocketStreamHandleImpl::platformSendInternal):
        (WebCore::SocketStreamHandleImpl::platformSend): Deleted.
        * platform/network/curl/SocketStreamHandleImpl.h:
        * platform/network/curl/SocketStreamHandleImplCurl.cpp:
        (WebCore::SocketStreamHandleImpl::platformSendInternal):
        (WebCore::SocketStreamHandleImpl::platformSend): Deleted.
        * platform/network/soup/SocketStreamHandleImpl.h:
        * platform/network/soup/SocketStreamHandleImplSoup.cpp:
        (WebCore::SocketStreamHandleImpl::platformSendInternal):
        (WebCore::SocketStreamHandleImpl::platformSend): Deleted.

2017-03-17  Antti Koivisto  <antti@apple.com>

        Add a reload policy where only expired subresources are revalidated
        https://bugs.webkit.org/show_bug.cgi?id=169756

        Reviewed by Andreas Kling.

        Test: http/tests/cache/reload-expired-only.html

        The default reload behavior revalidates all resources on the page. This patch adds
        a new policy that revalidates expired (and uncacheable) resources only. Using this
        policy can speed up reloads significantly and also reduce network traffic and server
        load.

        * history/PageCache.cpp:
        (WebCore::canCachePage):
        * inspector/InspectorPageAgent.cpp:
        (WebCore::InspectorPageAgent::reload):
        * loader/FrameLoader.cpp:
        (WebCore::isBackForwardLoadType):
        (WebCore::isReload):

            Add a helper function.

        (WebCore::FrameLoader::loadURL):
        (WebCore::logNavigation):
        (WebCore::FrameLoader::reload):

            Replace bool arguments with OptionSet<ReloadOption>. Most of the patch is about adapting to this.

        (WebCore::FrameLoader::transitionToCommitted):
        (WebCore::FrameLoader::subresourceCachePolicy):

            Return CachePolicyVerify for 'ReloadExpiredOnly' frame load type. This is the substantive
            change that causes the behavior difference.

        (WebCore::FrameLoader::checkLoadCompleteForThisFrame):
        (WebCore::FrameLoader::defaultRequestCachingPolicy):

            Flip the isMainResource condition for better readability.

        (WebCore::FrameLoader::shouldPerformFragmentNavigation):
        (WebCore::FrameLoader::loadDifferentDocumentItem):
        * loader/FrameLoader.h:
        (WebCore::FrameLoader::reload):
        * loader/FrameLoaderTypes.h:
        * loader/HistoryController.cpp:
        (WebCore::HistoryController::restoreDocumentState):
        * page/DiagnosticLoggingKeys.cpp:
        (WebCore::DiagnosticLoggingKeys::reloadRevalidatingExpiredKey):
        * page/DiagnosticLoggingKeys.h:
        * replay/UserInputBridge.cpp:
        (WebCore::UserInputBridge::reloadFrame):
        * replay/UserInputBridge.h:
        * testing/Internals.cpp:
        (WebCore::Internals::forceReload):
        (WebCore::Internals::reloadExpiredOnly):

            Testing support.

        * testing/Internals.h:
        * testing/Internals.idl:

2017-03-17  Nan Wang  <n_wang@apple.com>

        AX: VoiceOver no longer works corectly with editable text in the web
        https://bugs.webkit.org/show_bug.cgi?id=169801

        Reviewed by Chris Fleizach.

        The issue is that since we are entering text controls when getting the text marker,
        the end text marker of the input tag might associate to the placeholder div instead of 
        the input tag itself. 
        Fixed the issue by checking the shadow elements using shadowHost() instead of isShadowRoot().
        Also, only enter text controls when navigating by characters/indexes, so that both Mac and
        iOS will get the correct text marker ranges for shadow host elements.

        Tests: accessibility/ios-simulator/element-text-range-for-text-control.html
               accessibility/mac/text-markers-for-input-with-placeholder.html

        * accessibility/AXObjectCache.cpp:
        (WebCore::AXObjectCache::traverseToOffsetInRange):
        (WebCore::AXObjectCache::startOrEndCharacterOffsetForRange):
        (WebCore::AXObjectCache::characterOffsetForIndex):
        * accessibility/AXObjectCache.h:

2017-03-17  Wenson Hsieh  <wenson_hsieh@apple.com>

        [WK1] Support animated transitions when performing a data interaction operation
        https://bugs.webkit.org/show_bug.cgi?id=169805
        <rdar://problem/31045767>

        Reviewed by Beth Dakin and Megan Gardner.

        When performing a snapshot excluding the current selection, use ScrollableArea::visibleContentRect to compute
        the visible content rect rather than FrameView::visualViewportRect. In WebKit1, the latter will return the
        entire content view's bounds.

        * page/TextIndicator.cpp:
        (WebCore::takeSnapshots):

2017-03-17  Dave Hyatt  <hyatt@apple.com>

        Initial letter does not paginate properly.
        https://bugs.webkit.org/show_bug.cgi?id=169795
        <rdar://problem/23715770>

        Reviewed by Zalan Bujtas.

        Tests: fast/css-generated-content/initial-letter-pagination-raised.html
               fast/css-generated-content/initial-letter-pagination-raised-rl.html
               fast/css-generated-content/initial-letter-pagination-sunken.html
               fast/css-generated-content/initial-letter-pagination-sunken-rl.html

        * rendering/FloatingObjects.cpp:
        (WebCore::FloatingObject::FloatingObject):
        (WebCore::FloatingObject::copyToNewContainer):
        (WebCore::FloatingObject::cloneForNewParent):
        (WebCore::FloatingObject::translationOffsetToAncestor):
        * rendering/FloatingObjects.h:
        (WebCore::FloatingObject::setMarginOffset):
        (WebCore::FloatingObject::locationOffsetOfBorderBox):
        (WebCore::FloatingObject::marginOffset):
        Add the margin offset to the FloatingObject so that we can control the
        placement of the border box relative to the margin box without relying
        on only the CSS-specified margins. This allows for sunken initial letter
        FloatingObjects to be created and propagated out to ancestor blocks for painting
        without altering the CSS margins of the sunken letter.

        * rendering/RenderBlockFlow.cpp:
        (WebCore::RenderBlockFlow::adjustForUnsplittableChild):
        Update the logical height for initial letter containers after the initial
        letter shifts to the next page, since the lines that follow need to lay out
        relative to the initial letter, i.e., they shift down if it shifts down.

        (WebCore::RenderBlockFlow::addOverflowFromFloats):
        (WebCore::RenderBlockFlow::paintFloats):
        (WebCore::RenderBlockFlow::clipOutFloatingObjects):
        Patched to use the new helpers on FloatingObject rather than
        xPositionForFloatIncludingMargins and yPositionForFloatIncludingMargins.

        (WebCore::RenderBlockFlow::computeLogicalLocationForFloat):
        Updated to set the placement and margins of the floating object before
        returning. The initial letter adjustments have been factored out into their
        own function.

        (WebCore::RenderBlockFlow::adjustInitialLetterPosition):
        A helper function called by computeLogicalLocationForFloat that handles
        the placement and margin adjustments for initial letters. Note that sunken
        letters no longer "hack" the top margin of the child but instead rely on
        the fact that the FloatingObject has its own independent margin offset now
        that can be set to a value that is distinct from the CSS supplied margin.

        (WebCore::RenderBlockFlow::positionNewFloats):
        Revised to no longer do the placement, but to let computeLogicalLocationForFloat
        do it. The height is still set here however, since we don't know that until after
        the child has received a layout.

        (WebCore::RenderBlockFlow::addOverhangingFloats):
        (WebCore::RenderBlockFlow::flipFloatForWritingModeForChild):
        (WebCore::RenderBlockFlow::hitTestFloats):
        (WebCore::RenderBlockFlow::adjustForBorderFit):
        Patched to use the new FloatingObject helpers rather than
        xPositionForFloatIncludingMargins and yPositionForFloatIncludingMargins.

        * rendering/RenderBlockFlow.h:
        (WebCore::RenderBlockFlow::setLogicalMarginsForFloat):
        New helper function for setting the margin offsets on a FloatingObject.

        (WebCore::RenderBlockFlow::xPositionForFloatIncludingMargin): Deleted.
        (WebCore::RenderBlockFlow::yPositionForFloatIncludingMargin): Deleted.
        Deleted in favor of new FloatingObject helpers.

        * rendering/RenderBox.cpp:
        (WebCore::RenderBox::isUnsplittableForPagination):
        Make initial letter unsplittable as far as pagination is concerned.

        * rendering/RootInlineBox.cpp:
        (WebCore::RootInlineBox::ascentAndDescentForBox):
        (WebCore::RootInlineBox::includeFontForBox):
        (WebCore::RootInlineBox::includeGlyphsForBox):
        (WebCore::RootInlineBox::fitsToGlyphs):
        Turn off the restriction that you can't fit to vertical glyphs. The numbers returned
        are fine now. This allows vertical initial letters to work.

2017-03-17  Youenn Fablet  <youenn@apple.com>

        RealtimeIncomingAudioSource is not stopping properly
        https://bugs.webkit.org/show_bug.cgi?id=169807

        Reviewed by Eric Carlson.

        Test: webrtc/release-after-getting-track.html

        * platform/mediastream/mac/RealtimeIncomingAudioSource.cpp:
        (WebCore::RealtimeIncomingAudioSource::~RealtimeIncomingAudioSource):
        (WebCore::RealtimeIncomingAudioSource::stopProducingData):

2017-03-16  Alex Christensen  <achristensen@webkit.org>

        Use completion handlers instead of return values for sending websocket data
        https://bugs.webkit.org/show_bug.cgi?id=169802

        Reviewed by Carlos Garcia Campos.

        No change in behavior, but this is a baby step towards making things more asynchronous.

        * Modules/websockets/WebSocketChannel.cpp:
        (WebCore::WebSocketChannel::didOpenSocketStream):
        (WebCore::WebSocketChannel::processOutgoingFrameQueue):
        (WebCore::WebSocketChannel::sendFrame):
        * Modules/websockets/WebSocketChannel.h:
        * platform/network/SocketStreamHandle.cpp:
        (WebCore::SocketStreamHandle::send):
        * platform/network/SocketStreamHandle.h:
        * platform/network/cf/SocketStreamHandleImpl.h:

2017-03-17  Zan Dobersek  <zdobersek@igalia.com>

        WebGPU: build fixes for non-Cocoa platforms
        https://bugs.webkit.org/show_bug.cgi?id=169781

        Reviewed by Alex Christensen.

        Enable building WebGPU code for other ports and fix various build
        failures. This still leaves the GPUDevice::platformLayer() method
        missing for other ports, as well as the general implementation of
        the WebGPU platform abstractions under platform/graphics/gpu/.

        * CMakeLists.txt: Move the WebGPU build targets here.
        * PlatformMac.cmake:
        * html/canvas/WebGPULibrary.h: Explicitly include the WTFString.h
        header to suppress missing WTF::String definition errors.
        * platform/graphics/gpu/GPUBuffer.cpp:
        (WebCore::GPUBuffer::contents): Avoid ambiguous calls to
        ArrayBuffer::create() by passing nullptr as the first argument.
        * platform/graphics/gpu/GPUDevice.h: Include the Forward.h header
        to forward-declare the WTF::String class. Also remove the unused
        PlatformGPUDevice typedef for non-Cocoa platforms.
        (WebCore::GPUDevice::layer): Move this and the related m_layer
        member variable under the PLATFORM(COCOA) guard.
        * platform/graphics/gpu/GPUFunction.cpp:
        (WebCore::GPUFunction::GPUFunction): Remove the GPULibrary
        parameter checks in this no-op constructor that's used on
        non-Cocoa platforms.

2017-03-17  Miguel Gomez  <magomez@igalia.com>

        Follow-up (r213833): write a layout test for 169199
        https://bugs.webkit.org/show_bug.cgi?id=169576
        <rdar://problem/31024766>

        Reviewed by Said Abou-Hallawa.

        Add a function to Internals to force the deletion of the ImageDecoder just after
        requesting the async decoding of a frame, and implement that behaviour in BitmapImage.

        Test: fast/images/clear-animation-decoder.html

        * platform/graphics/BitmapImage.cpp:
        (WebCore::BitmapImage::internalStartAnimation):
        * platform/graphics/BitmapImage.h:
        * testing/Internals.cpp:
        (WebCore::Internals::setClearDecoderAfterAsyncFrameRequestForTesting):
        * testing/Internals.h:
        * testing/Internals.idl:

2017-03-17  Carlos Garcia Campos  <cgarcia@igalia.com>

        [Cairo] Handle the blend mode in GraphicsContext::drawPattern
        https://bugs.webkit.org/show_bug.cgi?id=169746

        Reviewed by Žan Doberšek.

        We are not taking into account the blend mode when passing the cairo operator to drawPatternToCairoContext().
        This is based on patch by Žan Doberšek, just adding the toCairoOperator changes to make it easier to handle
        it. Instead of checking everywhere if blend mode is Normal to decide whether to use toCairoOperator with
        CompositeOperator or BlendMode, there's no a single toCairoOperator that receives both parameters, but BlendMode
        is optional and defaults to Normal.

        * platform/graphics/cairo/CairoUtilities.cpp:
        (WebCore::toCairoCompositeOperator):
        (WebCore::toCairoOperator):
        * platform/graphics/cairo/CairoUtilities.h:
        * platform/graphics/cairo/GraphicsContextCairo.cpp:
        (WebCore::GraphicsContext::setPlatformCompositeOperation):
        (WebCore::GraphicsContext::drawPattern):

2017-03-16  Alex Christensen  <achristensen@webkit.org>

        Fix GTK build.

        * platform/network/soup/SocketStreamHandleImplSoup.cpp:
        (WebCore::SocketStreamHandleImpl::readBytes):
        Changing RefPtr to Ref broke something.
        For the record, EWS was orange so I couldn't see these build failures.

2017-03-16  Alex Christensen  <achristensen@webkit.org>

        Fix GTK build.

        * platform/network/soup/SocketStreamHandleImplSoup.cpp:
        (WebCore::SocketStreamHandleImpl::readBytes):
        didFailToReceiveSocketStreamData needs a parameter.

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-16  Simon Fraser  <simon.fraser@apple.com>

        Improve the system tracing points
        https://bugs.webkit.org/show_bug.cgi?id=169790

        Reviewed by Zalan Bujtas.

        Use a more cohesive set of system trace points that give a good overview of what
        WebKit is doing. Added points for resource loading, render tree building, sync messages
        to the web process, async image decode, WASM and fetching cookies.

        * loader/CookieJar.cpp:
        (WebCore::cookies):
        * loader/FrameLoader.cpp:
        (WebCore::FrameLoader::provisionalLoadStarted):
        (WebCore::FrameLoader::checkLoadCompleteForThisFrame):
        * loader/SubresourceLoader.cpp:
        (WebCore::SubresourceLoader::willSendRequestInternal):
        (WebCore::logResourceLoaded):
        (WebCore::SubresourceLoader::didFinishLoading):
        (WebCore::SubresourceLoader::didFail):
        (WebCore::SubresourceLoader::didCancel):
        * page/FrameView.cpp:
        (WebCore::FrameView::paintContents):
        * platform/graphics/ImageFrameCache.cpp:
        (WebCore::ImageFrameCache::startAsyncDecodingQueue):
        * platform/graphics/ios/DisplayRefreshMonitorIOS.mm:
        (WebCore::DisplayRefreshMonitorIOS::requestRefreshCallback):
        (WebCore::DisplayRefreshMonitorIOS::displayLinkFired):
        * style/RenderTreeUpdater.cpp:
        (WebCore::RenderTreeUpdater::commit):

2017-03-16  Simon Fraser  <simon.fraser@apple.com>

        RenderView::documentBeingDestroyed() needs a new name.
        https://bugs.webkit.org/show_bug.cgi?id=166727

        Reviewed by Andreas Kling.

        Now that we destroy the render tree for documents going into the page cache, RenderView::documentBeingDestroyed()
        is misleadingly named. Rename it to renderTreeBeingDestroyed() and fix all callers.

        * page/FrameView.cpp:
        (WebCore::FrameView::scheduleRelayoutOfSubtree):
        * page/scrolling/ScrollingCoordinator.cpp:
        (WebCore::ScrollingCoordinator::absoluteEventTrackingRegionsForFrame):
        * rendering/CounterNode.cpp:
        (WebCore::CounterNode::resetRenderers):
        * rendering/ImageQualityController.cpp:
        (WebCore::ImageQualityController::highQualityRepaintTimerFired):
        * rendering/RenderBlock.cpp:
        (WebCore::RenderBlock::willBeDestroyed):
        (WebCore::canMergeContiguousAnonymousBlocks):
        (WebCore::RenderBlock::removeChild):
        * rendering/RenderBlockFlow.cpp:
        (WebCore::RenderBlockFlow::willBeDestroyed):
        (WebCore::RenderBlockFlow::removeChild):
        * rendering/RenderBox.cpp:
        (WebCore::RenderBox::removeFloatingOrPositionedChildFromBlockLists):
        (WebCore::RenderBox::deleteLineBoxWrapper):
        * rendering/RenderBoxModelObject.cpp:
        (WebCore::RenderBoxModelObject::willBeDestroyed):
        * rendering/RenderElement.cpp:
        (WebCore::RenderElement::insertChildInternal):
        (WebCore::RenderElement::removeChildInternal):
        (WebCore::RenderElement::clearLayoutRootIfNeeded):
        (WebCore::RenderElement::willBeDestroyed):
        * rendering/RenderImage.cpp:
        (WebCore::RenderImage::imageChanged):
        (WebCore::RenderImage::notifyFinished):
        * rendering/RenderInline.cpp:
        (WebCore::RenderInline::willBeDestroyed):
        * rendering/RenderLayer.cpp:
        (WebCore::RenderLayer::removeChild):
        (WebCore::RenderLayer::calculateClipRects):
        * rendering/RenderLayerBacking.cpp:
        (WebCore::RenderLayerBacking::notifyFlushRequired):
        * rendering/RenderLayerCompositor.cpp:
        (WebCore::RenderLayerCompositor::layerWillBeRemoved):
        (WebCore::RenderLayerCompositor::fixedRootBackgroundLayerChanged):
        * rendering/RenderLineBreak.cpp:
        (WebCore::RenderLineBreak::deleteInlineBoxWrapper):
        * rendering/RenderNamedFlowFragment.cpp:
        (WebCore::RenderNamedFlowFragment::attachRegion):
        * rendering/RenderObject.cpp:
        (WebCore::RenderObject::resetFlowThreadStateOnRemoval):
        (WebCore::RenderObject::willBeDestroyed):
        (WebCore::RenderObject::destroyAndCleanupAnonymousWrappers):
        * rendering/RenderObject.h:
        (WebCore::RenderObject::renderTreeBeingDestroyed):
        (WebCore::RenderObject::documentBeingDestroyed): Deleted.
        * rendering/RenderQuote.cpp:
        (WebCore::RenderQuote::detachQuote):
        * rendering/RenderRegion.cpp:
        (WebCore::RenderRegion::attachRegion):
        * rendering/RenderReplaced.cpp:
        (WebCore::RenderReplaced::willBeDestroyed):
        * rendering/RenderRubyRun.cpp:
        (WebCore::RenderRubyRun::removeChild):
        * rendering/RenderTable.h:
        (WebCore::RenderTable::setNeedsSectionRecalc):
        * rendering/RenderText.cpp:
        (WebCore::RenderText::removeAndDestroyTextBoxes):
        * rendering/RenderVideo.cpp:
        (WebCore::RenderVideo::updatePlayer):
        * rendering/svg/RenderSVGResource.cpp:
        (WebCore::RenderSVGResource::markForLayoutAndParentResourceInvalidation):
        * rendering/svg/RenderSVGResourceContainer.cpp:
        (WebCore::RenderSVGResourceContainer::markClientForInvalidation):
        * rendering/svg/RenderSVGText.cpp:
        (WebCore::RenderSVGText::subtreeChildWasAdded):
        (WebCore::RenderSVGText::subtreeChildWillBeRemoved):
        (WebCore::RenderSVGText::subtreeChildWasRemoved):
        (WebCore::RenderSVGText::subtreeStyleDidChange):

2017-03-16  Youenn Fablet  <youenn@apple.com>

        Wrap legacy WebRTC API in runtime flag
        https://bugs.webkit.org/show_bug.cgi?id=169646

        Reviewed by Alex Christensen.

        Test: webrtc/legacy-api.html

        Adding a runtime flag for legacy API.
        Making some WebIDL peer connection members runtime-enabled.
        Adding a JS private getter on this flag so that overloaded operations behave as promise-based only if flag is turned off.

        * Modules/mediastream/RTCPeerConnection.idl:
        * Modules/mediastream/RTCPeerConnectionInternals.js:
        * bindings/js/JSDOMGlobalObject.cpp:
        (WebCore::isWebRTCLegacyAPIEnabled):
        (WebCore::JSDOMGlobalObject::addBuiltinGlobals):
        * bindings/js/WebCoreBuiltinNames.h:
        * page/RuntimeEnabledFeatures.h:
        (WebCore::RuntimeEnabledFeatures::webRTCLegacyAPIEnabled):
        (WebCore::RuntimeEnabledFeatures::setWebRTCLegacyAPIEnabled):

2017-03-16  Jiewen Tan  <jiewen_tan@apple.com>

        [WebCrypto] Support SPKI/PKCS8 for Elliptic Curve
        https://bugs.webkit.org/show_bug.cgi?id=169318
        <rdar://problem/31081956>

        Reviewed by Brent Fulgham.

        This patch adds SPKI/PKCS8 support for Elliptic Curve cryptos. We can now import/export
        SPKI/PKCS8 Elliptic Curve keys after this change. Few things to note: 1) This patch
        implements a loose DER encoder/decoder for hacking the underlying CommonCrypto library.
        2) It only permits id-ecPublicKey as the AlgorithmIdentifier following OpenSSL/Chrome(BoringSSL).
        3) It follows OpenSSL/Chrome(BoringSSL) to replace ECParameters in ECPrivateKey with custom
        tags. Hence, we should fully comply with OpenSSL/Chrome(BoringSSL).

        Tests: crypto/subtle/ec-import-jwk-key-export-pkcs8-key.html
               crypto/subtle/ec-import-jwk-key-export-spki-key.html
               crypto/subtle/ec-import-pkcs8-key-export-jwk-key.html
               crypto/subtle/ec-import-pkcs8-key-export-pkcs8-key-p256.html
               crypto/subtle/ec-import-pkcs8-key-export-pkcs8-key-p384.html
               crypto/subtle/ec-import-raw-key-export-spki-key.html
               crypto/subtle/ec-import-spki-key-export-jwk-key.html
               crypto/subtle/ec-import-spki-key-export-raw-key.html
               crypto/subtle/ec-import-spki-key-export-spki-key-p256.html
               crypto/subtle/ec-import-spki-key-export-spki-key-p384.html
               crypto/subtle/ecdh-generate-export-key-spki-p256.html
               crypto/subtle/ecdh-generate-export-key-spki-p384.html
               crypto/subtle/ecdh-generate-export-pkcs8-p256.html
               crypto/subtle/ecdh-generate-export-pkcs8-p384.html
               crypto/subtle/ecdh-import-pkcs8-key-p256.html
               crypto/subtle/ecdh-import-pkcs8-key-p384.html
               crypto/subtle/ecdh-import-spki-key-p256.html
               crypto/subtle/ecdh-import-spki-key-p384.html
               crypto/workers/subtle/ec-generate-export-pkcs8-key.html
               crypto/workers/subtle/ec-generate-export-spki-key.html
               crypto/workers/subtle/ec-import-pkcs8-key.html
               crypto/workers/subtle/ec-import-spki-key.html

        * WebCore.xcodeproj/project.pbxproj:
        * crypto/algorithms/CryptoAlgorithmECDH.cpp:
        (WebCore::CryptoAlgorithmECDH::importKey):
        (WebCore::CryptoAlgorithmECDH::exportKey):
        * crypto/gnutls/CryptoKeyECGnuTLS.cpp:
        (WebCore::CryptoKeyEC::platformExportRaw):
        (WebCore::CryptoKeyEC::platformImportSpki):
        (WebCore::CryptoKeyEC::platformExportSpki):
        (WebCore::CryptoKeyEC::platformImportPkcs8):
        (WebCore::CryptoKeyEC::platformExportPkcs8):
        (WebCore::CryptoKeyEC::exportRaw): Deleted.
        * crypto/keys/CryptoKeyEC.cpp:
        (WebCore::CryptoKeyEC::importSpki):
        (WebCore::CryptoKeyEC::importPkcs8):
        (WebCore::CryptoKeyEC::exportRaw):
        (WebCore::CryptoKeyEC::exportSpki):
        (WebCore::CryptoKeyEC::exportPkcs8):
        * crypto/keys/CryptoKeyEC.h:
        * crypto/mac/CommonCryptoDERUtilities.h: Added.
        (WebCore::bytesUsedToEncodedLength):
        (WebCore::extraBytesNeededForEncodedLength):
        (WebCore::addEncodedASN1Length):
        (WebCore::bytesNeededForEncodedLength):
        * crypto/mac/CryptoKeyECMac.cpp:
        (WebCore::compareBytes):
        (WebCore::CryptoKeyEC::platformExportRaw):
        (WebCore::CryptoKeyEC::platformImportJWKPrivate):
        (WebCore::getOID):
        (WebCore::CryptoKeyEC::platformImportSpki):
        (WebCore::CryptoKeyEC::platformExportSpki):
        (WebCore::CryptoKeyEC::platformImportPkcs8):
        (WebCore::CryptoKeyEC::platformExportPkcs8):
        (WebCore::CryptoKeyEC::exportRaw): Deleted.
        Enlarge the robust of exportRaw.
        * crypto/mac/CryptoKeyRSAMac.cpp:
        (WebCore::CryptoKeyRSA::exportSpki):
        (WebCore::CryptoKeyRSA::exportPkcs8):
        Enhance the implementation.
        (WebCore::bytesUsedToEncodedLength): Deleted.
        (WebCore::bytesNeededForEncodedLength): Deleted.
        (WebCore::addEncodedASN1Length): Deleted.
        Moved to CommonCryptoDERUtilities.h.

2017-03-16  Alex Christensen  <achristensen@webkit.org>

        Don't use an optional for didReceiveSocketStreamData's length
        https://bugs.webkit.org/show_bug.cgi?id=169699

        Reviewed by Brady Eidson.

        Rather than sending a message with an optional length, send a message with a length
        and send a different message if the receiving of bytes failed.

        No new tests (no behavior change).

        * Modules/websockets/WebSocketChannel.cpp:
        (WebCore::WebSocketChannel::didReceiveSocketStreamData):
        * Modules/websockets/WebSocketChannel.h:
        * platform/network/SocketStreamHandleClient.h:
        * platform/network/cf/SocketStreamHandleImplCFNet.cpp:
        (WebCore::SocketStreamHandleImpl::readStreamCallback):
        * platform/network/soup/SocketStreamHandleImplSoup.cpp:
        (WebCore::SocketStreamHandleImpl::readBytes):

2017-03-16  Zalan Bujtas  <zalan@apple.com>

        Simple line layout: Extend webkit-hyphenate-limit-lines to cover subsequent words.
        https://bugs.webkit.org/show_bug.cgi?id=169631

        Reviewed by Antti Koivisto.

        This patch extends webkit-hyphenate-limit-lines to cover separate words across multiple lines.
        Example:
          webkit-hyphenate-limit-lines: 1;
          "if this line wraps at foo-
          bar, the next line should
          not hyphenate at all. How-
          ever the line after that
          could."

        Test: fast/text/simple-line-layout-hyphenation-limit-lines-accross-words.html

        * rendering/SimpleLineLayout.cpp:
        (WebCore::SimpleLineLayout::LineState::setHyphenationDisabled):
        (WebCore::SimpleLineLayout::LineState::isHyphenationDisabled):
        (WebCore::SimpleLineLayout::updateLineConstrains):
        (WebCore::SimpleLineLayout::hyphenPositionForFragment):
        (WebCore::SimpleLineLayout::splitFragmentToFitLine):
        (WebCore::SimpleLineLayout::createLineRuns):
        (WebCore::SimpleLineLayout::createTextRuns):
        * rendering/SimpleLineLayoutTextFragmentIterator.h:
        (WebCore::SimpleLineLayout::TextFragmentIterator::TextFragment::hasHyphen):
        (WebCore::SimpleLineLayout::TextFragmentIterator::TextFragment::splitWithHyphen):
        (WebCore::SimpleLineLayout::TextFragmentIterator::TextFragment::wrappingWithHyphenCounter): Deleted.

2017-03-16  Zan Dobersek  <zdobersek@igalia.com>

        [GLib] Add SSLKeyGeneratorGLib.cpp
        https://bugs.webkit.org/show_bug.cgi?id=169740

        Reviewed by Sergio Villar Senin.

        Move the getSupportedKeySizes() and signedPublicKeyAndChallengeString()
        functions from TemporaryLinkStubs.cpp to SSLKeyGeneratorGLib.cpp. The
        userIdleTime() function can be removed in this process since it's not
        used anywhere anymore.

        * PlatformGTK.cmake:
        * platform/glib/SSLKeyGeneratorGLib.cpp: Renamed from Source/WebCore/platform/gtk/TemporaryLinkStubs.cpp.
        (WebCore::getSupportedKeySizes):
        (WebCore::signedPublicKeyAndChallengeString):

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  Jon Lee  <jonlee@apple.com>

        Add FIXMEs to update WebRTC
        https://bugs.webkit.org/show_bug.cgi?id=169735

        Reviewed by Youenn Fablet.

        Rearrange order of methods and properties based on the 13 March 2017
        version of the WebRTC spec.

        * CMakeLists.txt: Add RTCIceTransport and RTCIceTransportState.
        * DerivedSources.make:
        * Modules/mediastream/RTCDTMFSender.idl:
        * Modules/mediastream/RTCDTMFToneChangeEvent.idl:
        * Modules/mediastream/RTCDataChannelEvent.idl:
        * Modules/mediastream/RTCIceCandidate.idl:
        * Modules/mediastream/RTCIceCandidateEvent.idl:
        * Modules/mediastream/RTCIceServer.idl:
        * Modules/mediastream/RTCIceTransport.cpp: Added.
        * Modules/mediastream/RTCIceTransport.idl: Added.
        * Modules/mediastream/RTCIceTransport.h: Minor update to rename state to transportState.
        (WebCore::RTCIceTransport::state):
        (WebCore::RTCIceTransport::setState):
        (WebCore::RTCIceTransport::transportState): Deleted.
        (WebCore::RTCIceTransport::setTransportState): Deleted.
        * Modules/mediastream/RTCIceTransportState.h: Added.
        * Modules/mediastream/RTCIceTransportState.idl: Added.
        * Modules/mediastream/RTCPeerConnection.h:
        * Modules/mediastream/RTCPeerConnection.idl:
        * Modules/mediastream/RTCRtpReceiver.idl:
        * Modules/mediastream/RTCRtpSender.idl:
        * Modules/mediastream/RTCRtpTransceiver.idl:
        * Modules/mediastream/RTCStatsReport.idl:
        * WebCore.xcodeproj/project.pbxproj:
        * Modules/mediastream/MediaEndpointPeerConnection.cpp:
        (WebCore::MediaEndpointPeerConnection::iceTransportStateChanged): Refactor.

2017-03-16  Youenn Fablet  <youenn@apple.com>

        Improve WebRTC track enabled support
        https://bugs.webkit.org/show_bug.cgi?id=169727

        Reviewed by Alex Christensen.

        Tests: webrtc/peer-connection-audio-mute2.html
               webrtc/peer-connection-remote-audio-mute.html
               webrtc/video-remote-mute.html

        Making sure muted/disabled sources produce silence/black frames.
        For outgoing audio/video sources, this should be done by the actual a/v providers.
        We keep this filtering here until we are sure they implement that.

        * platform/audio/mac/AudioSampleDataSource.mm:
        (WebCore::AudioSampleDataSource::pullAvalaibleSamplesAsChunks): Ensuring disabled audio tracks send silence.
        Used for outgoing webrtc tracks.
        * platform/mediastream/mac/MockRealtimeAudioSourceMac.mm:
        (WebCore::MockRealtimeAudioSourceMac::render): Ditto.
        * platform/mediastream/mac/RealtimeIncomingAudioSource.cpp:
        (WebCore::RealtimeIncomingAudioSource::OnData): Ditto.
        * platform/mediastream/mac/RealtimeIncomingVideoSource.cpp:
        (WebCore::RealtimeIncomingVideoSource::pixelBufferFromVideoFrame): Generating black frames if muted.
        (WebCore::RealtimeIncomingVideoSource::OnFrame):
        * platform/mediastream/mac/RealtimeIncomingVideoSource.h:
        * platform/mediastream/mac/RealtimeOutgoingVideoSource.cpp:
        (WebCore::RealtimeOutgoingVideoSource::videoSampleAvailable): Ensuring we quit after sending black frame.

2017-03-16  Youenn Fablet  <youenn@apple.com>

        LibWebRTC outgoing source should be thread safe refcounted
        https://bugs.webkit.org/show_bug.cgi?id=169726

        Reviewed by Alex Christensen.

        Preventive fix.
        Also fixing the size of the buffer for the audio source as its reserved size is byte count.

        * platform/mediastream/mac/RealtimeOutgoingAudioSource.h:
        * platform/mediastream/mac/RealtimeOutgoingVideoSource.h:

2017-03-16  Youenn Fablet  <youenn@apple.com>

        MediaStreamTrack remote() no longer exists
        https://bugs.webkit.org/show_bug.cgi?id=169734

        Reviewed by Alex Christensen.

        Removing MediaStreamTrack remote.
        Removing RealtimeMediaSource::remote as isCaptureSource which is closer to its use in MediaStreamPrivate to
        detect whether sources are capture sources or not.

        * Modules/mediastream/MediaStream.cpp:
        (WebCore::MediaStream::mediaState):
        * platform/mediastream/MediaStreamPrivate.cpp:
        (WebCore::MediaStreamPrivate::hasCaptureVideoSource):
        (WebCore::MediaStreamPrivate::hasCaptureAudioSource):
        (WebCore::MediaStreamPrivate::hasLocalVideoSource): Deleted.
        (WebCore::MediaStreamPrivate::hasLocalAudioSource): Deleted.
        * platform/mediastream/MediaStreamPrivate.h:
        * Modules/mediastream/MediaStreamTrack.cpp:
        (WebCore::MediaStreamTrack::stopProducingData):
        (WebCore::MediaStreamTrack::remote): Deleted.
        * Modules/mediastream/MediaStreamTrack.h:
        * Modules/mediastream/MediaStreamTrack.idl:
        * Modules/webaudio/MediaStreamAudioSource.h:
        * platform/mediastream/MediaStreamPrivate.cpp:
        (WebCore::MediaStreamPrivate::hasLocalVideoSource):
        (WebCore::MediaStreamPrivate::hasLocalAudioSource):
        * platform/mediastream/MediaStreamTrackPrivate.cpp:
        (WebCore::MediaStreamTrackPrivate::isCaptureTrack):
        (WebCore::MediaStreamTrackPrivate::remote): Deleted.
        * platform/mediastream/MediaStreamTrackPrivate.h:
        * platform/mediastream/RealtimeMediaSource.cpp:
        (WebCore::RealtimeMediaSource::reset):
        * platform/mediastream/RealtimeMediaSource.h:
        (WebCore::RealtimeMediaSource::isCaptureSource):
        (WebCore::RealtimeMediaSource::remote): Deleted.
        (WebCore::RealtimeMediaSource::setRemote): Deleted.
        * platform/mediastream/mac/AVMediaCaptureSource.h:
        * platform/mock/MockRealtimeAudioSource.h:
        * platform/mock/MockRealtimeVideoSource.h:

2017-03-16  Manuel Rego Casasnovas  <rego@igalia.com>

        [css-grid] Crash on debug removing a positioned child
        https://bugs.webkit.org/show_bug.cgi?id=169739

        Reviewed by Sergio Villar Senin.

        When we add or remove a positioned item we don't need to mark
        the grid as dirty, because positioned items do not affect the layout
        of the grid at all.

        This was causing a crash when a positioned item was removed
        after a layout. As after the positioned item was removed,
        the method RenderGrid::layoutBlock() was not called,
        so when the grid was repainted we got a crash.

        Test: fast/css-grid-layout/grid-crash-remove-positioned-item.html

        * rendering/RenderGrid.cpp:
        (WebCore::RenderGrid::addChild): Add early return to avoid marking
        the grid as dirty for positioned grid items.
        (WebCore::RenderGrid::removeChild): Ditto.

2017-03-16  Carlos Alberto Lopez Perez  <clopez@igalia.com>

        [WebRTC] SDP sess-id in the "o=" line should be a value between 0 and LLONG_MAX.
        https://bugs.webkit.org/show_bug.cgi?id=169681

        Reviewed by Alejandro G. Castro.

        Use an int64_t type for storing sess-id and ensure that the value generated is always between 0 and LLONG_MAX (2^63-1).
        To the JS world (sdp.js) we pass and read this value as a string type.

        The JS world (sdp.js) was already using a string type for sess-id.
        This caused a bug when reading the sess-id value at configurationFromJSON(): no value was obtained because a numeric type was expected.

        So, after this patch, sess-id is passed and read as a string from sdp.js, and converted to an int64_t type for internal use.
        This way we also avoid a rounding problem that happens with values near LLONG_MAX when converting from int64_t to double when passed to the JS world,
        and that could cause that we end passing a number bigger than LLONG_MAX to sdp.js.

        * Modules/mediastream/SDPProcessor.cpp:
        (WebCore::configurationFromJSON):
        (WebCore::configurationToJSON):
        * platform/mediastream/MediaEndpointSessionConfiguration.h:
        (WebCore::MediaEndpointSessionConfiguration::sessionId):
        (WebCore::MediaEndpointSessionConfiguration::setSessionId):
        (WebCore::MediaEndpointSessionConfiguration::MediaEndpointSessionConfiguration):

2017-03-15  Jon Lee  <jonlee@apple.com>

        Flatten RTC enum naming
        https://bugs.webkit.org/show_bug.cgi?id=169664

        Reviewed by Youenn Fablet.

        Use consistent names of RTC enums throughout WebCore. This means surfacing
        ICE enums out of PeerConnectionState. Keep the old names around for other
        ports.

        Add RTCIceConnectionState, RTCIceGatheringState, and RTCSignalingState enums.
        * CMakeLists.txt:
        * DerivedSources.make:
        * Modules/mediastream/RTCIceConnectionState.h: Added. The enum is defined in
        PeerConnectionStates.h, so just include that file.
        * Modules/mediastream/RTCIceConnectionState.idl: Added.
        * Modules/mediastream/RTCIceGatheringState.h: Added.
        * Modules/mediastream/RTCIceGatheringState.idl: Added.
        * Modules/mediastream/RTCSignalingState.h: Added.
        * Modules/mediastream/RTCSignalingState.idl: Added.
        * WebCore.xcodeproj/project.pbxproj:

        * platform/mediastream/PeerConnectionStates.h: Move the existing enums into
        WebCore, but keep aliases to the old names within the PeerConnectionStates
        namespace.

        Refactor to use the new enum names.
        * Modules/mediastream/MediaEndpointPeerConnection.cpp: Refactor.
        * Modules/mediastream/MediaEndpointPeerConnection.h:
        * Modules/mediastream/PeerConnectionBackend.cpp:
        * Modules/mediastream/PeerConnectionBackend.h:
        * Modules/mediastream/RTCConfiguration.h:
        * Modules/mediastream/RTCConfiguration.idl: Add FIXMEs for bringing this up
        to spec.
        * Modules/mediastream/RTCIceTransport.h:
        * Modules/mediastream/RTCPeerConnection.cpp: Refactor the three functions
        below to using the enum instead of returning strings. This allows remove of
        the internal* versions of these functions.
        (WebCore::RTCPeerConnection::signalingState): Deleted.
        (WebCore::RTCPeerConnection::iceGatheringState): Deleted.
        (WebCore::RTCPeerConnection::iceConnectionState): Deleted.
        * Modules/mediastream/RTCPeerConnection.h: Replace internalSignalingState,
        internalIceGatheringState, and internalIceConnectionState.
        * Modules/mediastream/RTCPeerConnection.idl:
        * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp:
        * Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.cpp:
        * platform/mediastream/MediaEndpoint.h:
        * platform/mediastream/MediaEndpointConfiguration.cpp:
        * platform/mediastream/MediaEndpointConfiguration.h:
        * platform/mock/MockMediaEndpoint.cpp:
        * platform/mock/MockMediaEndpoint.h:
        * platform/mediastream/openwebrtc/MediaEndpointOwr.cpp:
        (WebCore::MediaEndpointOwr::processIceTransportStateChange):

2017-03-15  Jer Noble  <jer.noble@apple.com>

        Optionally capture audio in the UIProcess
        https://bugs.webkit.org/show_bug.cgi?id=169609

        Reviewed by Alex Christensen.

        Export some previously un-exported symbols from WebCore for use in WebKit2.

        * WebCore.xcodeproj/project.pbxproj:
        * platform/audio/WebAudioBufferList.h:
        * platform/mediastream/RealtimeMediaSource.h:

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-15  Dean Jackson  <dino@apple.com>

        Make a base class for WebGL and WebGPU contexts
        https://bugs.webkit.org/show_bug.cgi?id=169651
        <rdar://problem/31053489>

        Reviewed by Simon Fraser.

        Add a new pure virtual base class, GPUBasedCanvasRenderingContext, that
        will be used by WebGL and WebGPU rendering contexts. This allows us
        to avoid some code duplication, since many places treat the two
        as the same.

        Also rename is3d() -> isWebGL() and isGPU() -> isWebGPU().

        * WebCore.xcodeproj/project.pbxproj: New file.
        * html/HTMLCanvasElement.cpp:
        (WebCore::HTMLCanvasElement::getContextWebGL):
        (WebCore::HTMLCanvasElement::getContextWebGPU):
        (WebCore::HTMLCanvasElement::reset):
        (WebCore::HTMLCanvasElement::paint):
        (WebCore::HTMLCanvasElement::isGPUBased):
        (WebCore::HTMLCanvasElement::getImageData):
        (WebCore::HTMLCanvasElement::isGPU): Deleted.
        (WebCore::HTMLCanvasElement::is3D): Deleted.
        * html/HTMLCanvasElement.h:
        * html/canvas/CanvasRenderingContext.h:
        (WebCore::CanvasRenderingContext::isWebGL):
        (WebCore::CanvasRenderingContext::isWebGPU):
        (WebCore::CanvasRenderingContext::isGPUBased):
        (WebCore::CanvasRenderingContext::is3d): Deleted.
        (WebCore::CanvasRenderingContext::isGPU): Deleted.
        * html/canvas/GPUBasedCanvasRenderingContext.h: Added.
        (WebCore::GPUBasedCanvasRenderingContext::GPUBasedCanvasRenderingContext):
        * html/canvas/WebGLRenderingContextBase.cpp:
        (WebCore::WebGLRenderingContextBase::WebGLRenderingContextBase):
        * html/canvas/WebGLRenderingContextBase.h:
        * html/canvas/WebGPURenderingContext.cpp:
        (WebCore::WebGPURenderingContext::WebGPURenderingContext):
        * html/canvas/WebGPURenderingContext.h:
        * rendering/RenderLayerBacking.cpp:
        (WebCore::canvasCompositingStrategy):

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-15  Dave Hyatt  <hyatt@apple.com>

        Positioned SVG not sized correctly
        https://bugs.webkit.org/show_bug.cgi?id=169693
        <rdar://problem/30996893>

        Reviewed by Zalan Bujtas.

        Test: svg/in-html/rect-positioned.html

        Change computeReplacedLogicalHeight to take an estimatedUsedWidth. This
        value is used instead of the available logical width to resolve replaced
        elements without intrinsic sizes but with aspect ratios set.

        * rendering/RenderBox.cpp:
        (WebCore::RenderBox::computeReplacedLogicalHeight):
        * rendering/RenderBox.h:
        * rendering/RenderReplaced.cpp:
        (WebCore::RenderReplaced::computeConstrainedLogicalWidth):
        (WebCore::RenderReplaced::computeReplacedLogicalWidth):
        (WebCore::RenderReplaced::computeReplacedLogicalHeight):
        * rendering/RenderReplaced.h:
        * rendering/RenderVideo.cpp:
        (WebCore::RenderVideo::computeReplacedLogicalHeight): Deleted.
        * rendering/RenderVideo.h:
        * rendering/svg/RenderSVGRoot.cpp:
        (WebCore::RenderSVGRoot::computeReplacedLogicalWidth):
        (WebCore::RenderSVGRoot::computeReplacedLogicalHeight):
        * rendering/svg/RenderSVGRoot.h:

2017-03-15  Antoine Quint  <graouts@apple.com>

        [Modern Media Controls] Using the arrow keys to navigate in the tracks menu also scrolls the page
        https://bugs.webkit.org/show_bug.cgi?id=169671
        <rdar://problem/31060091>

        Reviewed by Eric Carlson.

        We need to call preventDefault() when handling a "keydown" event that we recognize.

        Test: media/modern-media-controls/tracks-panel/tracks-panel-prevent-default-on-keydown.html

        * Modules/modern-media-controls/controls/tracks-panel.js:
        (TracksPanel.prototype._handleKeydown):

2017-03-15  Antoine Quint  <graouts@apple.com>

        [Modern Media Controls] Tracks menu overlaps controls bar in fullscreen
        https://bugs.webkit.org/show_bug.cgi?id=169670
        <rdar://problem/31060086>
        
        Reviewed by Eric Carlson.

        It used to be that the top of the tracks button was the same as the top of the controls
        bar, but that changed when we fixed https://bugs.webkit.org/show_bug.cgi?id=169412. We
        now use the top of the controls bar to computed the y-position for the tracks panel.

        We are not adding a new test, instead we're unflaking a test that started failing
        reliably once we fixed https://bugs.webkit.org/show_bug.cgi?id=169412.

        * Modules/modern-media-controls/controls/macos-media-controls.js:
        (MacOSMediaControls.prototype.showTracksPanel):

2017-03-14  Jon Lee  <jonlee@apple.com>

        Clean up RTCPeerConnection IDL
        https://bugs.webkit.org/show_bug.cgi?id=169660

        Reviewed by Youenn Fablet.

        * Modules/mediastream/RTCPeerConnection.cpp:
        (WebCore::RTCPeerConnection::addTransceiver): Refactor to use RTCRtpTransceiverInit.
        (WebCore::RTCPeerConnection::completeAddTransceiver):
        * Modules/mediastream/RTCPeerConnection.h: Remove redundant definitions.
        * Modules/mediastream/RTCPeerConnection.idl: Using 13 March 2017 Editor's Draft of
        WebRTC spec. Move RTCOfferAnswerOptions out to separate IDLs. Keep RTCDataChannelInit and
        RTCRtpTransceiverInit since they appear to be used only in RTCPeerConnection.
            Reorder the properties, functions, and events based on their appearance in the spec.
        Legacy MediaStream calls are placed at the end. I tried to use "partial interface" in the
        same file, but in the end nothing was generated, so everything is contained in one interface
        block.

        * Modules/mediastream/RTCEnums.h: Added. This will be an all-in-one header to hold the
        enums.

        Move RTCAnswerOptions, RTCOfferAnswerOptions, RTCOfferOptions, RTCRtpTransceiverDirection
        out to their own IDL's.
        * CMakeLists.txt:
        * DerivedSources.make:
        * Modules/mediastream/RTCAnswerOptions.h: Added.
        * Modules/mediastream/RTCAnswerOptions.idl: Added.
        * Modules/mediastream/RTCOfferAnswerOptions.h:
        * Modules/mediastream/RTCOfferAnswerOptions.idl: Added.
        * Modules/mediastream/RTCOfferOptions.h: Added. Remove |offerToReceiveVideo| and
        |offerToReceiveAudio|, which are not used.
        * Modules/mediastream/RTCOfferOptions.idl: Added.
        * Modules/mediastream/RTCRtpTransceiverDirection.h: Added.
        * Modules/mediastream/RTCRtpTransceiverDirection.idl: Added. Use a typedef for
        RTCRtpTransceiverDirection to prevent the code generator from prefixing RTCRtpTransceiver.
        * Modules/mediastream/RTCRtpTransceiver.idl: Move RTCRtpTransceiverDirection.
        * WebCore.xcodeproj/project.pbxproj: Add IDLs and derived sources. Remove unused
        HTMLMediaElementMediaStream.h. Reorder.

        Refactor.
        * Modules/mediastream/RTCRtpTransceiver.h: Use RTCRtpTransceiverDirection.
        * Modules/mediastream/MediaEndpointPeerConnection.cpp:

2017-03-15  Zan Dobersek  <zdobersek@igalia.com>

        [GTK] Initialize m_button, m_clickCount members in PlatformMouseEvent constructors
        https://bugs.webkit.org/show_bug.cgi?id=169666

        Reviewed by Michael Catanzaro.

        Initialize the m_button and m_clickCount class members in the GTK+-specific
        implementation of PlatformMouseEvent constructors to NoButton and 0,
        respectively. The constructors expect to operate on passed-in GTK+ events
        that will be able to initialize those two members to some valid values, but
        this is not guaranteed.

        * platform/gtk/PlatformMouseEventGtk.cpp:
        (WebCore::PlatformMouseEvent::PlatformMouseEvent):

2017-03-15  Zan Dobersek  <zdobersek@igalia.com>

        [TexMap] Add missing class member initializations
        https://bugs.webkit.org/show_bug.cgi?id=169665

        Reviewed by Michael Catanzaro.

        Zero-initialize the members in various TextureMapper classes
        that are missing the proper initialization, as reported by
        the Coverity tool.

        * platform/graphics/texmap/BitmapTexturePool.h:
        * platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.h:
        * platform/graphics/texmap/coordinated/CoordinatedGraphicsState.h:
        (WebCore::CoordinatedGraphicsLayerState::CoordinatedGraphicsLayerState):
        * platform/graphics/texmap/coordinated/SurfaceUpdateInfo.h:

2017-03-15  Alex Christensen  <achristensen@webkit.org>

        Compiled content extensions should include the JSON source
        https://bugs.webkit.org/show_bug.cgi?id=169643

        Reviewed by Geoffrey Garen.

        Serializing the JSON string from which a content extension was compiled
        to disk with the compiled content extension will allow us to validate content
        extensions and automatically migrate older content extensions to new versions.
        It less than doubles the size of the compiled content extension on disk, and when
        interpreting the bytecode that memory is never read, so it doesn't increase our
        dirty memory usage.

        Covered by new API tests.

        * contentextensions/ContentExtensionCompiler.cpp:
        (WebCore::ContentExtensions::compileRuleList):
        * contentextensions/ContentExtensionCompiler.h:

2017-03-15  Antoine Quint  <graouts@apple.com>

        [Modern Media Controls] Captions do not default to Auto when language is changed
        https://bugs.webkit.org/show_bug.cgi?id=169675
        <rdar://problem/30423369>

        Reviewed by Eric Carlson.

        Ensure we correctly mark the Off and Auto items as selected when we are using the
        Off and Auto tracks.

        Tests: media/modern-media-controls/tracks-support/tracks-support-auto-text-track.html
               media/modern-media-controls/tracks-support/tracks-support-off-text-track.html

        * Modules/modern-media-controls/media/tracks-support.js:
        (TracksSupport.prototype.tracksPanelIsTrackInSectionSelected):
        (TracksSupport.prototype.tracksPanelSelectionDidChange):

2017-03-15  Ryan Haddad  <ryanhaddad@apple.com>

        Unreviewed, rolling out r213977.

        This change broke the Windows build.

        Reverted changeset:

        "Make a base class for WebGL and WebGPU contexts"
        https://bugs.webkit.org/show_bug.cgi?id=169651
        http://trac.webkit.org/changeset/213977

2017-03-15  Youenn Fablet  <youenn@apple.com>

        run-webkit-tests is always creating mock libwebrtc tracks
        https://bugs.webkit.org/show_bug.cgi?id=169658

        Reviewed by Alex Christensen.

        Tests: webrtc/peer-connection-audio-mute.html
               webrtc/video-mute.html

        Creating real libwebrtc av tracks in case of RealTwoPeerConnections mock factory.

        * testing/MockLibWebRTCPeerConnection.cpp:
        (WebCore::MockLibWebRTCPeerConnectionFactory::CreateVideoTrack):
        (WebCore::MockLibWebRTCPeerConnectionFactory::CreateAudioTrack):
        * testing/MockLibWebRTCPeerConnection.h:

2017-03-15  Youenn Fablet  <youenn@apple.com>

        Preventive clean-up: ensure RTCPeerConnection stays valid when calling postTask
        https://bugs.webkit.org/show_bug.cgi?id=169661

        Reviewed by Alex Christensen.

        Protecting the RTCPeerConnection object when calling postTask since it might get collected between the task post
        and task run. Also do not send negotiationNeeded event if RTCPeerConnection is closed (covered by added test).

        * Modules/mediastream/RTCPeerConnection.cpp:
        (WebCore::RTCPeerConnection::updateIceGatheringState):
        (WebCore::RTCPeerConnection::updateIceConnectionState):
        (WebCore::RTCPeerConnection::scheduleNegotiationNeededEvent):

2017-03-15  Antoine Quint  <graouts@apple.com>

        [Modern Media Controls] Always use six digits to display time when overall media duration is an hour or more
        https://bugs.webkit.org/show_bug.cgi?id=169668
        <rdar://problem/31059699>

        Reviewed by Dean Jackson.

        Always use six digits to display times when the overall media duration is an hour or more. This
        ensures that we don't display too much white space around labels when we know we will eventually
        need six digits to display the full time, but the current time to display is under an hour.

        Test: media/modern-media-controls/time-control/time-control-use-six-digits-for-time-labels.html

        * Modules/modern-media-controls/controls/time-control.js:
        (TimeControl.prototype.get useSixDigitsForTimeLabels):
        (TimeControl.prototype.set useSixDigitsForTimeLabels):
        (TimeControl.prototype.set width):
        (TimeControl.prototype.get isSufficientlyWide):
        (TimeControl.prototype._availableWidthHasChanged):
        (TimeControl.prototype.get labelsMayDisplayTimesOverAnHour): Deleted.
        (TimeControl.prototype.set labelsMayDisplayTimesOverAnHour): Deleted.
        * Modules/modern-media-controls/controls/time-label.js:
        (TimeLabel.prototype._formattedTime):
        * Modules/modern-media-controls/media/time-labels-support.js:
        (TimeLabelsSupport.prototype.syncControl):
        (TimeLabelsSupport):

2017-03-15  Dean Jackson  <dino@apple.com>

        Sort Xcode project files
        https://bugs.webkit.org/show_bug.cgi?id=169669

        Reviewed by Antoine Quint.

        * WebCore.xcodeproj/project.pbxproj:

2017-03-14  Dean Jackson  <dino@apple.com>

        Make a base class for WebGL and WebGPU contexts
        https://bugs.webkit.org/show_bug.cgi?id=169651
        <rdar://problem/31053489>

        Reviewed by Simon Fraser.

        Add a new pure virtual base class, GPUBasedCanvasRenderingContext, that
        will be used by WebGL and WebGPU rendering contexts. This allows us
        to avoid some code duplication, since many places treat the two
        as the same.

        Also rename is3d() -> isWebGL() and isGPU() -> isWebGPU().

        * WebCore.xcodeproj/project.pbxproj: New file.
        * html/HTMLCanvasElement.cpp:
        (WebCore::HTMLCanvasElement::getContextWebGL):
        (WebCore::HTMLCanvasElement::getContextWebGPU):
        (WebCore::HTMLCanvasElement::reset):
        (WebCore::HTMLCanvasElement::paint):
        (WebCore::HTMLCanvasElement::isGPUBased):
        (WebCore::HTMLCanvasElement::getImageData):
        (WebCore::HTMLCanvasElement::isGPU): Deleted.
        (WebCore::HTMLCanvasElement::is3D): Deleted.
        * html/HTMLCanvasElement.h:
        * html/canvas/CanvasRenderingContext.h:
        (WebCore::CanvasRenderingContext::isWebGL):
        (WebCore::CanvasRenderingContext::isWebGPU):
        (WebCore::CanvasRenderingContext::isGPUBased):
        (WebCore::CanvasRenderingContext::is3d): Deleted.
        (WebCore::CanvasRenderingContext::isGPU): Deleted.
        * html/canvas/GPUBasedCanvasRenderingContext.h: Added.
        (WebCore::GPUBasedCanvasRenderingContext::GPUBasedCanvasRenderingContext):
        * html/canvas/WebGLRenderingContextBase.cpp:
        (WebCore::WebGLRenderingContextBase::WebGLRenderingContextBase):
        * html/canvas/WebGLRenderingContextBase.h:
        * html/canvas/WebGPURenderingContext.cpp:
        (WebCore::WebGPURenderingContext::WebGPURenderingContext):
        * html/canvas/WebGPURenderingContext.h:
        * rendering/RenderLayerBacking.cpp:
        (WebCore::canvasCompositingStrategy):

2017-03-15  Zan Dobersek  <zdobersek@igalia.com>

        Unreviewed GTK+ build fix. Sprinkle ENABLE(MEDIA_STREAM) build guards
        in the Internals class to avoid compilation failures when building
        with this feature disabled.

        * testing/Internals.cpp:
        (WebCore::Internals::~Internals):
        * testing/Internals.h:
        * testing/Internals.idl:

2017-03-14  Youenn Fablet  <youenn@apple.com>

        CanvasCapture should not generate a frame per each canvas draw command
        https://bugs.webkit.org/show_bug.cgi?id=169498

        Reviewed by Simon Fraser & Eric Carlson.

        Test: fast/mediastream/captureStream/canvas2d-heavy-drawing.html

        Making Canvas capture be asynchronous.
        This ensures that one frame will be created for a set of synchronous draw commands.
        In the future, we should find a better approach, like aligning with requestAnimationFrame.
        Adding internals observer API for media stream tracks.

        * Modules/mediastream/CanvasCaptureMediaStreamTrack.cpp:
        (WebCore::CanvasCaptureMediaStreamTrack::Source::Source):
        (WebCore::CanvasCaptureMediaStreamTrack::Source::canvasChanged):
        * Modules/mediastream/CanvasCaptureMediaStreamTrack.h:
        * Modules/mediastream/MediaStreamTrack.idl:
        * platform/mediastream/RealtimeMediaSource.h:
        * testing/Internals.cpp:
        (WebCore::Internals::~Internals):
        (WebCore::Internals::observeMediaStreamTrack):
        * testing/Internals.h:
        * testing/Internals.idl:

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-14  Dean Jackson  <dino@apple.com>

        Rename LayerTypeWebGLLayer and use it for both WebGL and WebGPU
        https://bugs.webkit.org/show_bug.cgi?id=169628
        <rdar://problems/31047025>

        Fix Windows build.

        * platform/graphics/ca/win/PlatformCALayerWin.cpp:
        (printLayer):

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-14  Anders Carlsson  <andersca@apple.com>

        Propagate PassKit errors
        https://bugs.webkit.org/show_bug.cgi?id=169633
        rdar://problem/31043392

        Reviewed by Dean Jackson.

        * Modules/applepay/ApplePayError.idl:
        * Modules/applepay/ApplePaySession.cpp:
        (WebCore::convert):
        (WebCore::convertAndValidate):
        * Modules/applepay/PaymentRequest.h:

2017-03-14  Alan Kinsley  <zalan@apple.com>

        Simple line layout: Adjust hyphenation constrains based on the normal line layout line-breaking logic.
        https://bugs.webkit.org/show_bug.cgi?id=169617

        Reviewed by Antti Koivisto.

        This patch ensures that simple line layout ends up with the same hyphenation context as normal line layout. 

        Test: fast/text/simple-line-layout-hyphenation-constrains.html

        * rendering/SimpleLineLayout.cpp:
        (WebCore::SimpleLineLayout::hyphenPositionForFragment): see webkit.org/b/169613
        (WebCore::SimpleLineLayout::splitFragmentToFitLine):
        * rendering/line/BreakingContext.h: Integral -> fractional.
        (WebCore::tryHyphenating):

2017-03-06  Jer Noble  <jer.noble@apple.com>

        Refactor: Allow WebKit2 to override the creation of RealtimeMediaSources
        https://bugs.webkit.org/show_bug.cgi?id=169227

        Reviewed by Eric Carlson.

        Allow clients of RealtimeMediaSourceCenter to specify a factory for creating
        RealtimeMediaSources, to be used by subclasess of RealtimeMediaSourceCenter. Add virtual
        methods to retrieve the "default" factories for the RealtimeMediaSourceCenter subclass. The
        requires moving the creation of sources up from CaptureDeviceManager into
        RealtimeMediaSourceCenterMac, and the addition of factory methods to AVAudioCaptureSource
        and AVVideoCaptureSource.

        * platform/mediastream/CaptureDeviceManager.cpp:
        (CaptureDeviceManager::deviceWithUID):
        (CaptureDeviceManager::bestSourcesForTypeAndConstraints): Deleted.
        (CaptureDeviceManager::sourceWithUID): Deleted.
        * platform/mediastream/CaptureDeviceManager.h:
        * platform/mediastream/RealtimeMediaSource.h:
        * platform/mediastream/RealtimeMediaSourceCenter.cpp:
        (WebCore::RealtimeMediaSourceCenter::setAudioFactory):
        (WebCore::RealtimeMediaSourceCenter::unsetAudioFactory):
        (WebCore::RealtimeMediaSourceCenter::setVideoFactory):
        (WebCore::RealtimeMediaSourceCenter::unsetVideoFactory):
        * platform/mediastream/RealtimeMediaSourceCenter.h:
        (WebCore::RealtimeMediaSourceCenter::audioFactory):
        (WebCore::RealtimeMediaSourceCenter::videoFactory):
        * platform/mediastream/mac/AVAudioCaptureSource.h:
        * platform/mediastream/mac/AVAudioCaptureSource.mm:
        (WebCore::AVAudioCaptureSource::factory):
        * platform/mediastream/mac/AVCaptureDeviceManager.h:
        * platform/mediastream/mac/AVCaptureDeviceManager.mm:
        (WebCore::AVCaptureDeviceManager::createMediaSourceForCaptureDeviceWithConstraints): Deleted.
        * platform/mediastream/mac/AVMediaCaptureSource.h:
        * platform/mediastream/mac/AVVideoCaptureSource.h:
        * platform/mediastream/mac/AVVideoCaptureSource.mm:
        (WebCore::AVVideoCaptureSource::factory):
        * platform/mediastream/mac/RealtimeMediaSourceCenterMac.cpp:
        (WebCore::RealtimeMediaSourceCenterMac::RealtimeMediaSourceCenterMac):
        (WebCore::RealtimeMediaSourceCenterMac::validateRequestConstraints):
        (WebCore::RealtimeMediaSourceCenterMac::createMediaStream):
        (WebCore::RealtimeMediaSourceCenterMac::bestSourcesForTypeAndConstraints):
        (WebCore::RealtimeMediaSourceCenterMac::defaultAudioFactory):
        (WebCore::RealtimeMediaSourceCenterMac::defaultVideoFactory):
        * platform/mediastream/mac/RealtimeMediaSourceCenterMac.h:
        * platform/mock/MockRealtimeAudioSource.cpp:
        (WebCore::MockRealtimeAudioSource::factory):
        * platform/mock/MockRealtimeAudioSource.h:
        * platform/mock/MockRealtimeMediaSourceCenter.cpp:
        (WebCore::MockRealtimeMediaSourceCenter::defaultAudioFactory):
        (WebCore::MockRealtimeMediaSourceCenter::defaultVideoFactory):
        * platform/mock/MockRealtimeMediaSourceCenter.h:
        * platform/mock/MockRealtimeVideoSource.cpp:
        (WebCore::MockRealtimeVideoSource::factory):
        * platform/mock/MockRealtimeVideoSource.h:

2017-03-14  Dean Jackson  <dino@apple.com>

        Rename LayerTypeWebGLLayer and use it for both WebGL and WebGPU
        https://bugs.webkit.org/show_bug.cgi?id=169628
        <rdar://problems/31047025>

        Reviewed by Simon Fraser.

        Rename LayerTypeWebGLLayer to LayerTypeContentsProvidedLayer
        and use it for both WebGLLayer and WebGPULayer, to avoid
        code duplication.

        * platform/graphics/ca/PlatformCALayer.cpp:
        (WebCore::operator<<):
        * platform/graphics/ca/PlatformCALayer.h:
        * platform/graphics/ca/cocoa/PlatformCALayerCocoa.mm:
        (PlatformCALayerCocoa::layerTypeForPlatformLayer):
        (PlatformCALayerCocoa::PlatformCALayerCocoa):
        (PlatformCALayerCocoa::commonInit):

2017-03-13  Jer Noble  <jer.noble@apple.com>

        Make classes used by Media Stream encode/decode friendly
        https://bugs.webkit.org/show_bug.cgi?id=169567

        Reviewed by Eric Carlson.

        Add encode() and decode() methods and implementations to a variety of media stream related classes.

        * platform/audio/mac/CAAudioStreamDescription.h:
        (WebCore::CAAudioStreamDescription::encode):
        (WebCore::CAAudioStreamDescription::decode):
        * platform/mediastream/RealtimeMediaSourceSettings.h:
        (WebCore::RealtimeMediaSourceSettings::width):
        (WebCore::RealtimeMediaSourceSettings::setWidth):
        (WebCore::RealtimeMediaSourceSettings::height):
        (WebCore::RealtimeMediaSourceSettings::setHeight):
        (WebCore::RealtimeMediaSourceSettings::sampleRate):
        (WebCore::RealtimeMediaSourceSettings::setSampleRate):
        (WebCore::RealtimeMediaSourceSettings::sampleSize):
        (WebCore::RealtimeMediaSourceSettings::setSampleSize):
        (WebCore::RealtimeMediaSourceSettings::encode):
        (WebCore::RealtimeMediaSourceSettings::decode):
        * platform/mediastream/RealtimeMediaSourceSupportedConstraints.h:
        (WebCore::RealtimeMediaSourceSupportedConstraints::encode):
        (WebCore::RealtimeMediaSourceSupportedConstraints::decode):

2017-03-14  Jer Noble  <jer.noble@apple.com>

        Adapt CARingBuffer to be usable across processes
        https://bugs.webkit.org/show_bug.cgi?id=169591

        Reviewed by Alex Christensen.

        When used with a SharedMemory backing store, storing the pointers to channel data at the beginning
        of the channel data itself is problematic: when the SharedMemory is mapped on the far side of the
        process boundary, it will not exist at the same memory location as it did on the near side. Instead
        of storing these pointers inside the channel data, store them in a small (usually 1 or 2 entry) vector
        recreated when the backing store is (re-)allocated.

        * platform/audio/mac/CARingBuffer.cpp:
        (WebCore::CARingBuffer::CARingBuffer):
        (WebCore::CARingBuffer::allocate):
        (WebCore::CARingBuffer::deallocate):
        (WebCore::ZeroRange):
        (WebCore::StoreABL):
        (WebCore::FetchABL):
        (WebCore::CARingBuffer::store):
        (WebCore::CARingBuffer::getCurrentFrameBounds):
        (WebCore::CARingBuffer::fetch):
        * platform/audio/mac/CARingBuffer.h:

2017-03-14  Jer Noble  <jer.noble@apple.com>

        Pulling more frames from AudioSampleDataSource than the last push added will always fail.
        https://bugs.webkit.org/show_bug.cgi?id=168644

        Reviewed by Eric Carlson.

        Rather than use the delta between the ring buffer's end time and the last pushed timestamp
        (or what is effectively the number of samples in the last push operation) to determine if
        there is enough buffered data to satisfy a pull operation, use the ring buffer's actual
        buffered duration.

        Then, instead of saving the last pushed timestamp, explicitly save the last push count, and
        use that data to inform how much to offset the output timestamps (or what is effectively how
        much to allow the source to pre-buffer).

        * platform/audio/mac/AudioSampleDataSource.cpp:
        (WebCore::AudioSampleDataSource::pushSamplesInternal):
        (WebCore::AudioSampleDataSource::pullSamplesInternal):
        * platform/audio/mac/AudioSampleDataSource.h:

2017-03-14  Megan Gardner  <megan_gardner@apple.com>

        Correctly export WebItemProviderPasteboard
        https://bugs.webkit.org/show_bug.cgi?id=169578

        Reviewed by Tim Horton.

        * platform/ios/WebItemProviderPasteboard.h:

2017-03-14  Adrian Perez de Castro  <aperez@igalia.com>

        Remove redundant check for "firstLine" in RenderBlock::lineHeight()
        https://bugs.webkit.org/show_bug.cgi?id=169610

        Reviewed by Michael Catanzaro.

        * rendering/RenderBlock.cpp:
        (WebCore::RenderBlock::lineHeight): Remove test of "firstLine" that
        was already checked in the condition for the enclosing if-clause.

2017-03-14  Antoine Quint  <graouts@apple.com>

        [Modern Media Controls] Fullscreen controls during Live Broadcast is completely broken
        https://bugs.webkit.org/show_bug.cgi?id=169354
        <rdar://problem/30636370>

        Reviewed by Dean Jackson.

        When playing a Live Broadcast video in fullscreen, we should not show any scrubbing-related
        piece of UI and ensure that we show the status label.

        Test: http/tests/media/modern-media-controls/macos-fullscreen-media-controls/macos-fullscreen-media-controls-live-broadcast.html

        * Modules/modern-media-controls/controls/macos-fullscreen-media-controls.css:
        (.media-controls.mac.fullscreen > .controls-bar .status-label):
        * Modules/modern-media-controls/controls/macos-fullscreen-media-controls.js:
        (MacOSFullscreenMediaControls.prototype.layout):
        * Modules/modern-media-controls/media/seek-support.js:
        (SeekSupport.prototype.get mediaEvents):
        (SeekSupport.prototype.syncControl):

2017-03-14  Joseph Pecoraro  <pecoraro@apple.com>

        Web Inspector: More accurate Resource Timing data in Web Inspector
        https://bugs.webkit.org/show_bug.cgi?id=169577

        Reviewed by Youenn Fablet.

        * inspector/InspectorNetworkAgent.h:
        * inspector/InspectorNetworkAgent.cpp:
        (WebCore::InspectorNetworkAgent::didFinishLoading):
        Use the ResourceLoader to get the start time that responseEnd is relative to
        so we can send the more accurate responseEnd when available.

        * inspector/InspectorInstrumentation.cpp:
        (WebCore::InspectorInstrumentation::didFinishLoadingImpl):
        * inspector/InspectorInstrumentation.h:
        (WebCore::InspectorInstrumentation::didFinishLoading):
        * loader/CrossOriginPreflightChecker.cpp:
        (WebCore::CrossOriginPreflightChecker::validatePreflightResponse):
        * loader/DocumentLoader.cpp:
        (WebCore::DocumentLoader::finishedLoading):
        * loader/ResourceLoadNotifier.cpp:
        (WebCore::ResourceLoadNotifier::didFinishLoad):
        (WebCore::ResourceLoadNotifier::dispatchDidFinishLoading):
        (WebCore::ResourceLoadNotifier::sendRemainingDelegateMessages):
        * loader/ResourceLoadNotifier.h:
        * loader/appcache/ApplicationCacheGroup.cpp:
        (WebCore::ApplicationCacheGroup::didFinishLoading):
        Pass ResourceLoader through to Web Inspector in didFinishLoading.

        * platform/network/cocoa/NetworkLoadMetrics.mm:
        (WebCore::copyTimingData):
        The differences from the reference start are in Seconds, not milliseconds.

2017-03-14  Wenson Hsieh  <wenson_hsieh@apple.com>

        [WK2] Data interaction tests occasionally hit assertions in debug builds
        https://bugs.webkit.org/show_bug.cgi?id=169002
        <rdar://problem/30994806>

        Reviewed by Tim Horton.

        Data interaction unit tests occasionally fail due to the UI process expecting the latest received EditorState to
        contain post layout data, but finding that it does not in -[WKContentView selectedTextRange]. The incomplete
        EditorStates in question are sent while performing a data interaction operation, due to transient changes in the
        frame selection. The UI process does not need to (and should not) be informed of these selection changes at all.

        We can fix this by preventing the editor client from responding to selection changes during data interaction
        operation. This patch also renames setIgnoreCompositionSelectionChange to setIgnoreSelectionChanges to better
        reflect the fact that it is used outside of the context of holding selection change updates during IME. We
        already use this affordance in various places, such as TextIndicator (while taking a snapshot on iOS), in
        FindController on iOS, and when replacing selected or dictated text. Additionally, there is no logic in
        setIgnoreCompositionSelectionChange that limits its use to composition.

        * editing/Editor.cpp:
        (WebCore::Editor::cancelCompositionIfSelectionIsInvalid):
        (WebCore::Editor::setComposition):
        (WebCore::Editor::revealSelectionAfterEditingOperation):
        (WebCore::Editor::setIgnoreSelectionChanges):
        (WebCore::Editor::changeSelectionAfterCommand):
        (WebCore::Editor::respondToChangedSelection):
        (WebCore::Editor::setIgnoreCompositionSelectionChange): Deleted.
        * editing/Editor.h:
        (WebCore::Editor::ignoreSelectionChanges):
        (WebCore::Editor::ignoreCompositionSelectionChange): Deleted.
        * editing/mac/EditorMac.mm:
        (WebCore::Editor::selectionWillChange):
        * page/TextIndicator.cpp:
        (WebCore::TextIndicator::createWithRange):

2017-03-14  Antoine Quint  <graouts@apple.com>

        [Modern Media Controls] iOS may attempt to load fullscreen icon variants
        https://bugs.webkit.org/show_bug.cgi?id=169608
        <rdar://problem/31037369>

        Reviewed by Eric Carlson.

        Only return fullscreen or compact variants for macOS.

        * Modules/modern-media-controls/controls/icon-service.js:
        (const.iconService.new.IconService.prototype._fileNameAndPlatformForIconNameAndLayoutTraits):
        (const.iconService.new.IconService):

2017-03-14  Antoine Quint  <graouts@apple.com>

        [Modern Media Controls] Controls are laid out incorrectly with RTL languages
        https://bugs.webkit.org/show_bug.cgi?id=169605
        <rdar://problem/30975709>

        Reviewed by Eric Carlson.

        Encorce "direction: ltr" on the controls since the controls layout should not be changed
        by the host page's direction.

        Test: media/modern-media-controls/media-controls/media-controls-controls-bar-always-ltr.html

        * Modules/modern-media-controls/controls/controls-bar.css:
        (.controls-bar):

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-14  Zan Dobersek  <zdobersek@igalia.com>

        [GLib] Use USE(GLIB) guards in WebCore/workers/
        https://bugs.webkit.org/show_bug.cgi?id=169595

        Reviewed by Carlos Garcia Campos.

        Utilize the USE(GLIB) build guards in the WorkerRunLoop and WorkerThread
        class implementations to guard GLib-specific header inclusions and GLib
        API invocations, instead of the more specific PLATFORM(GTK) guards.

        * workers/WorkerRunLoop.cpp:
        (WebCore::WorkerRunLoop::runInMode):
        * workers/WorkerThread.cpp:
        (WebCore::WorkerThread::workerThread):

2017-03-14  Zan Dobersek  <zdobersek@igalia.com>

        [Soup] Suppress compiler warnings in NetworkStorageSession
        https://bugs.webkit.org/show_bug.cgi?id=169593

        Reviewed by Carlos Garcia Campos.

        Return default-constructed Vector objects in the NetworkStorageSession's
        getAllCookies() and getCookies() methods, avoiding compiler warnings.

        * platform/network/soup/NetworkStorageSessionSoup.cpp:
        (WebCore::NetworkStorageSession::getAllCookies):
        (WebCore::NetworkStorageSession::getCookies):

2017-03-13  Joseph Pecoraro  <pecoraro@apple.com>

        Remove unused methods of ResourceRequestBase
        https://bugs.webkit.org/show_bug.cgi?id=169579

        Reviewed by Youenn Fablet.

        * platform/network/ResourceRequestBase.h:
        (WebCore::ResourceRequestBase::reportUploadProgress): Deleted.
        (WebCore::ResourceRequestBase::setReportUploadProgress): Deleted.
        (WebCore::ResourceRequestBase::reportLoadTiming): Deleted.
        (WebCore::ResourceRequestBase::setReportLoadTiming): Deleted.
        (WebCore::ResourceRequestBase::reportRawHeaders): Deleted.
        (WebCore::ResourceRequestBase::setReportRawHeaders): Deleted.
        Remove unused code.

        * inspector/InspectorNetworkAgent.cpp:
        (WebCore::InspectorNetworkAgent::willSendRequest):
        * loader/ResourceLoadNotifier.cpp:
        (WebCore::ResourceLoadNotifier::dispatchWillSendRequest):
        * xml/XMLHttpRequest.cpp:
        (WebCore::XMLHttpRequest::createRequest):
        Remove callers of setters that did nothing.

2017-03-13  Youenn Fablet  <youenn@apple.com>

        Make RealtimeMediaSource::type an enum class
        https://bugs.webkit.org/show_bug.cgi?id=169491

        Reviewed by Sam Weinig.

        No change of behavior.

        * Modules/mediastream/CanvasCaptureMediaStreamTrack.cpp:
        (WebCore::CanvasCaptureMediaStreamTrack::Source::Source):
        * Modules/mediastream/MediaStream.cpp:
        (WebCore::MediaStream::getAudioTracks):
        (WebCore::MediaStream::getVideoTracks):
        * Modules/mediastream/MediaStreamTrack.cpp:
        (WebCore::MediaStreamTrack::kind):
        * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp:
        (WebCore::LibWebRTCMediaEndpoint::addTrack):
        * Modules/webaudio/MediaStreamAudioSource.cpp:
        (WebCore::MediaStreamAudioSource::MediaStreamAudioSource):
        * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm:
        (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::sampleBufferUpdated):
        (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::updateTracks):
        * platform/mediastream/CaptureDeviceManager.cpp:
        (CaptureDeviceManager::bestSourcesForTypeAndConstraints):
        (CaptureDeviceManager::sourceWithUID):
        * platform/mediastream/MediaEndpoint.cpp:
        * platform/mediastream/RealtimeMediaSource.h:
        * platform/mediastream/mac/AVAudioCaptureSource.mm:
        (WebCore::AVAudioCaptureSource::AVAudioCaptureSource):
        * platform/mediastream/mac/AVVideoCaptureSource.mm:
        (WebCore::AVVideoCaptureSource::AVVideoCaptureSource):
        * platform/mediastream/mac/RealtimeMediaSourceCenterMac.cpp:
        (WebCore::RealtimeMediaSourceCenterMac::createMediaStream):
        * platform/mock/MockMediaEndpoint.cpp:
        (WebCore::MockMediaEndpoint::createMutedRemoteSource):
        * platform/mock/MockRealtimeAudioSource.cpp:
        (WebCore::MockRealtimeAudioSource::MockRealtimeAudioSource):
        * platform/mock/MockRealtimeMediaSource.cpp:
        (WebCore::MockRealtimeMediaSource::MockRealtimeMediaSource):
        * platform/mock/MockRealtimeVideoSource.cpp:
        (WebCore::MockRealtimeVideoSource::MockRealtimeVideoSource):

2017-03-13  Eric Carlson  <eric.carlson@apple.com>

        [MediaStream] Move paintCurrentFrameInContext from RealtimeMediaSources to MediaPlayer
        https://bugs.webkit.org/show_bug.cgi?id=169474
        <rdar://problem/30976747>

        Reviewed by Youenn Fablet.

        Every video capture source has extremely similar code to render the current frame to
        a graphics context. Because the media player gets every video sample buffer, have it
        hang onto the most recent frame so it can implement paintCurrentFrameInContext directly.
        Fix an existing race condition that occasionally caused the readyState to advance to 
        "have enough data" before a video was ready to paint by defining a MediaStreamTrackPrivate
        readyState and observing that.

        No new tests, covered by existing tests. These changes uncovered a bug in 
        fast/mediastream/MediaStream-video-element-video-tracks-disabled-then-enabled.html, which 
        was updated.

        * Modules/mediastream/CanvasCaptureMediaStreamTrack.cpp:
        (WebCore::CanvasCaptureMediaStreamTrack::Source::captureCanvas):
        (WebCore::CanvasCaptureMediaStreamTrack::Source::paintCurrentFrameInContext): Deleted.
        (WebCore::CanvasCaptureMediaStreamTrack::Source::currentFrameImage): Deleted.
        * Modules/mediastream/CanvasCaptureMediaStreamTrack.h:

        * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.h:
        * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm:
        (-[WebAVSampleBufferStatusChangeListener observeValueForKeyPath:ofObject:change:context:]):
        Drive-by change - don't pass status to parent callback, it is a property of the layer.
        (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::isAvailable): Drive-by cleanup - we don't
        use AVSampleBufferRenderSynchronizer so don't fail if it isn't available.
        (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::enqueueVideoSample): Hang onto new frame,
        invalidate cached image, update readyState.
        (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::layerStatusDidChange): No more "updatePausedImage".
        (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::ensureLayer): Drive-by cleanup - Add an early
         return if there is no need for a layer.
        (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::destroyLayer): renderingModeChanged -> updateRenderingMode.
        (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::currentDisplayMode): Minor cleanup.
        (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::updateDisplayMode): Renamed from renderingModeChanged,
        add a bool return to signal when the mode changes.
        (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::play): No more m_haveEverPlayed. Update display
        mode immediately.
        (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::pause): No more paused image.
        (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::currentReadyState): Only return HaveNothing, HaveMetadata,
        or HaveEnoughData. Don't return HaveEnoughData until all enabled tracks are providing data and never
        drop back to HaveMetadata.
        (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::updateRenderingMode): Renamed from renderingModeChanged.
        (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::characteristicsChanged): Update intrinsic
        size directly.
        (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::sampleBufferUpdated): No more m_hasReceivedMedia.
        (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::readyStateChanged): Ditto.
        (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::checkSelectedVideoTrack): Reset imagePainter
        when active video track changes.
        (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::updateCurrentFrameImage): Deleted.
        (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::paintCurrentFrameInContext): Paint current
        frame image.
        (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::CurrentFramePainter::reset): New.
        (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::shouldEnqueueVideoSampleBuffer): Deleted.
        (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::updatePausedImage): Deleted.
        (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::updateIntrinsicSize): Deleted.
        (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::renderingModeChanged): Deleted.
        (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::audioSamplesAvailable): Deleted.

        * platform/mediastream/MediaStreamPrivate.cpp:
        (WebCore::MediaStreamPrivate::paintCurrentFrameInContext): Deleted.
        (WebCore::MediaStreamPrivate::currentFrameImage): Deleted.
        * platform/mediastream/MediaStreamPrivate.h:

        * platform/mediastream/MediaStreamTrackPrivate.cpp:
        (WebCore::MediaStreamTrackPrivate::MediaStreamTrackPrivate):
        (WebCore::MediaStreamTrackPrivate::endTrack): Update readyState.
        (WebCore::MediaStreamTrackPrivate::clone): Clone readyState.
        (WebCore::MediaStreamTrackPrivate::sourceStopped): Update readyState.
        (WebCore::MediaStreamTrackPrivate::videoSampleAvailable): Ditto.
        (WebCore::MediaStreamTrackPrivate::audioSamplesAvailable): Ditto.
        (WebCore::MediaStreamTrackPrivate::updateReadyState): New, update readyState and notify observers.
        (WebCore::MediaStreamTrackPrivate::paintCurrentFrameInContext): Deleted.
        * platform/mediastream/MediaStreamTrackPrivate.h:

        * platform/mediastream/MediaStreamTrackPrivate.cpp:
        (WebCore::MediaStreamTrackPrivate::paintCurrentFrameInContext): Deleted.
        * platform/mediastream/RealtimeMediaSource.h:
        (WebCore::RealtimeMediaSource::currentFrameImage): Deleted.
        (WebCore::RealtimeMediaSource::paintCurrentFrameInContext): Deleted.

        * platform/mediastream/mac/AVMediaCaptureSource.mm:
        (-[WebCoreAVMediaCaptureSourceObserver disconnect]): Drive-by fix - clear m_callback
        after calling removeNotificationObservers.
        (-[WebCoreAVMediaCaptureSourceObserver removeNotificationObservers]): Drive-by fix - remove 
        the correct listener.
        (-[WebCoreAVMediaCaptureSourceObserver endSessionInterrupted:]):

        * platform/mediastream/mac/AVVideoCaptureSource.h:
        * platform/mediastream/mac/AVVideoCaptureSource.mm:
        (WebCore::AVVideoCaptureSource::currentFrameImage): Deleted.
        (WebCore::AVVideoCaptureSource::currentFrameCGImage): Deleted.
        (WebCore::AVVideoCaptureSource::paintCurrentFrameInContext): Deleted.

        * platform/mediastream/mac/RealtimeIncomingVideoSource.cpp:
        (WebCore::drawImage): Deleted.
        (WebCore::RealtimeIncomingVideoSource::currentFrameImage): Deleted.
        (WebCore::RealtimeIncomingVideoSource::paintCurrentFrameInContext): Deleted.
        * platform/mediastream/mac/RealtimeIncomingVideoSource.h:

        * platform/mock/MockRealtimeVideoSource.cpp:
        (WebCore::MockRealtimeVideoSource::paintCurrentFrameInContext): Deleted.
        (WebCore::MockRealtimeVideoSource::currentFrameImage): Deleted.
        * platform/mock/MockRealtimeVideoSource.h:

2017-03-13  Carlos Alberto Lopez Perez  <clopez@igalia.com>

        [GTK][SOUP] Fix build after r213877
        https://bugs.webkit.org/show_bug.cgi?id=140191

        Unreviewed build fix.

        * platform/network/soup/NetworkStorageSessionSoup.cpp:
        (WebCore::NetworkStorageSession::setCookie): Add missing setCookie() declaration.

2017-03-13  Brady Eidson  <beidson@apple.com>

        WKWebView provides no access to cookies.
        https://bugs.webkit.org/show_bug.cgi?id=140191

        Reviewed by Tim Horton.

        Covered by API tests.

        * platform/Cookie.h:

        * platform/network/NetworkStorageSession.h:
        * platform/network/cocoa/NetworkStorageSessionCocoa.mm:
        (WebCore::NetworkStorageSession::setCookie):
        (WebCore::NetworkStorageSession::deleteCookie):
        (WebCore::nsCookiesToCookieVector):
        (WebCore::NetworkStorageSession::getAllCookies):
        (WebCore::NetworkStorageSession::getCookies):

        * platform/network/soup/NetworkStorageSessionSoup.cpp:
        (WebCore::NetworkStorageSession::deleteCookie):
        (WebCore::NetworkStorageSession::getAllCookies):
        (WebCore::NetworkStorageSession::getCookies):

2017-03-13  Devin Rousso  <webkit@devinrousso.com>

        Web Inspector: Event Listeners section is missing 'once', 'passive' event listener flags
        https://bugs.webkit.org/show_bug.cgi?id=167080

        Reviewed by Joseph Pecoraro.

        Test: inspector/dom/getEventListenersForNode.html

        * inspector/InspectorDOMAgent.cpp:
        (WebCore::InspectorDOMAgent::buildObjectForEventListener):
        Add "passive" and "once" values to the EventListener protocol object when applicable.

2017-03-13  John Wilander  <wilander@apple.com>

        Resource Load Statistics: More efficient network process messaging + Fix bug in user interaction reporting
        https://bugs.webkit.org/show_bug.cgi?id=169506

        Reviewed by Alex Christensen.

        Covered by previous test which now follows the code path more closely to when reporting
        happens in the web process.

        * loader/ResourceLoadObserver.cpp:
        (WebCore::ResourceLoadObserver::logUserInteractionWithReducedTimeResolution):
            No longer explicitly calls ResourceLoadStatisticsStore::fireShouldPartitionCookiesHandler().
            Instead just calls ResourceLoadStatisticsStore::fireDataModificationHandler().
        (WebCore::ResourceLoadObserver::logUserInteraction):
            Updated to call the new ResourceLoadStatisticsStore::fireShouldPartitionCookiesHandler().
        (WebCore::ResourceLoadObserver::fireShouldPartitionCookiesHandler):
            Now takes two vectors – domainsToRemove and domainsToAdd.
        * loader/ResourceLoadObserver.h:
        * loader/ResourceLoadStatistics.cpp:
        (WebCore::ResourceLoadStatistics::toString):
            Added boolean field isMarkedForCookiePartitioning.
        (WebCore::ResourceLoadStatistics::merge):
            Added boolean field isMarkedForCookiePartitioning.
        * loader/ResourceLoadStatistics.h:
            Added boolean field isMarkedForCookiePartitioning.
        * loader/ResourceLoadStatisticsStore.cpp:
        (WebCore::ResourceLoadStatisticsStore::readDataFromDecoder):
            Now marks statistics with isMarkedForCookiePartitioning before sending them off to
            ResourceLoadStatisticsStore::fireShouldPartitionCookiesHandler().
        (WebCore::ResourceLoadStatisticsStore::setShouldPartitionCookiesCallback):
            Now accepts a handler with two vectors.
        (WebCore::ResourceLoadStatisticsStore::fireShouldPartitionCookiesHandler):
            Now the only exported version of this function is the one without arguments.
            The one internal to WebCore accepts two vectors – domainsToRemove and domainsToAdd.
            The exported one generates the two vectors and then calls the internal one.
        (WebCore::ResourceLoadStatisticsStore::hasHadRecentUserInteraction):
            No longer explicitly calls ResourceLoadStatisticsStore::fireShouldPartitionCookiesHandler().
        * loader/ResourceLoadStatisticsStore.h:
        * platform/network/NetworkStorageSession.h:
        * platform/network/cf/NetworkStorageSessionCFNet.cpp:
        (WebCore::NetworkStorageSession::setShouldPartitionCookiesForHosts):
            Now takes two vectors – domainsToRemove and domainsToAdd.

2017-03-13  Dean Jackson  <dino@apple.com>

        Respect the runtime flag for WebGPU, default feature to off.
        https://bugs.webkit.org/show_bug.cgi?id=169564
        <rdar://problems/31018864>

        Reviewed by Tim Horton.

        Make sure WebGPU respects its runtime feature flag. Also, since
        this implementation doesn't validate content, it should default
        to being disabled.

        Test: fast/canvas/webgpu/webgpu-runtime-flag.html

        * html/HTMLCanvasElement.cpp:
        (WebCore::HTMLCanvasElement::getContext):
        (WebCore::HTMLCanvasElement::getContextWebGPU):

2017-03-13  Alex Christensen  <achristensen@webkit.org>

        Fix CMake build.

        * PlatformMac.cmake:
        Add new files.

2017-03-13  Chris Dumez  <cdumez@apple.com>

        Allow termination of background WebProcesses that go over a given CPU usage threshold
        https://bugs.webkit.org/show_bug.cgi?id=169456
        <rdar://problem/30960968>

        Reviewed by Andreas Kling.

        Add CPUMonitor utility class to monitor CPU usage and call a provided lambda
        whenever the process exceeds the provided CPU limit over a given period of
        time.

        * WebCore.xcodeproj/project.pbxproj:
        * platform/CPUMonitor.cpp: Added.
        (WebCore::CPUMonitor::CPUMonitor):
        (WebCore::CPUMonitor::setCPULimit):
        (WebCore::CPUMonitor::timerFired):
        * platform/CPUMonitor.h: Added.

2017-03-13  Antoine Quint  <graouts@apple.com>

        [Modern Media Controls] Volume icon doesn't turn to mute when the knob is set to 0
        https://bugs.webkit.org/show_bug.cgi?id=169553
        <rdar://problem/30754543>

        Reviewed by Eric Carlson.

        When we start changing the volume using the mouse, we record the volume at that point
        and as we drag the volume slider, we set the mute button to show that the media is
        muted if the volume is 0, and set the actual media volume to be the initial volume
        prior to dragging. This way, when we toggle the "muted" property by pressing the
        mute button, the original volume is restored.

        To function correctly, this required some changed to Slider. The volume slider would
        fail to update if the value set was the same as the initial value since we would use
        only the "change" event to identify the end of a slider drag interaction. This was
        incorrect since if the initial value and the final value while dragging the slider
        were the same, no "change" event would be fired. So we now use mouse events to
        identify when the slider is being dragged.

        Test: media/modern-media-controls/volume-support/volume-support-drag-to-mute.html

        * Modules/modern-media-controls/controls/slider.js:
        (Slider.prototype.set value):
        (Slider.prototype.handleEvent):
        (Slider.prototype._handleMousedownEvent):
        (Slider.prototype._handleInputEvent):
        (Slider.prototype._handleMouseupEvent):
        (Slider.prototype._handleChangeEvent): Deleted.
        * Modules/modern-media-controls/controls/volume-slider.js:
        (VolumeSlider):
        (VolumeSlider.prototype.draw):
        (VolumeSlider.prototype.handleEvent): Deleted.
        * Modules/modern-media-controls/media/volume-support.js:
        (VolumeSupport.prototype.controlValueWillStartChanging):
        (VolumeSupport.prototype.controlValueDidChange):

2017-03-13  Per Arne Vollan  <pvollan@apple.com>

        [Win] Compile error.
        https://bugs.webkit.org/show_bug.cgi?id=169546

        Reviewed by Brent Fulgham.

        There is no matching constructor in the Cookie class.

        * platform/network/cf/CookieJarCFNet.cpp:
        (WebCore::getRawCookies):

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-13  Manuel Rego Casasnovas  <rego@igalia.com>

        Unprefix -webkit-min-content, -webkit-max-content and -webkit-fit-content
        https://bugs.webkit.org/show_bug.cgi?id=169195

        Reviewed by Sergio Villar Senin.

        Based on Blink r200846 by <cbiesinger@chromium.org>.
        https://src.chromium.org/viewvc/blink?revision=200846&view=revision

        This patch adds support for the unprefixed version of these properties,
        while it keeps the prefixed ones working too.
        -webkit-fill-available is left out of this change, as the CSS WG
        is still defining the final keyword and behavior.

        With this patch WebKit will be in the same situation than Blink
        regarding these intrinsic sizing keywords (see http://crbug.com/245157).

        Test: fast/css-intrinsic-dimensions/height-property-value.html
              fast/css-intrinsic-dimensions/width-property-value.html

        * css/CSSPrimitiveValue.cpp:
        (WebCore::CSSPrimitiveValue::init):
        * css/CSSValueKeywords.in:
        * css/StyleBuilderConverter.h:
        (WebCore::StyleBuilderConverter::convertLengthSizing):
        (WebCore::StyleBuilderConverter::createGridTrackBreadth):
        * css/html.css:
        (fieldset):
        * css/parser/CSSPropertyParser.cpp:
        (WebCore::validWidthOrHeightKeyword):
        (WebCore::isGridTrackFixedSized):
        (WebCore::consumeGridBreadth):
        * html/track/TextTrackCueGeneric.cpp:
        (WebCore::TextTrackCueGenericBoxElement::applyCSSProperties):
        * html/track/VTTCue.cpp:
        (WebCore::VTTCueBox::applyCSSProperties):

2017-03-13  Dean Jackson  <dino@apple.com>

        WebGPU remote layer hosting
        https://bugs.webkit.org/show_bug.cgi?id=169539
        <rdar://problem/31005380>

        Reviewed by Jon Lee.

        Implement the WebProcess side of WebGPULayer hosting,
        via LayerTypeWebGPULayer.

        * platform/graphics/ca/PlatformCALayer.cpp:
        (WebCore::operator<<): Provide nice pretty printing.
        * platform/graphics/ca/PlatformCALayer.h: Add LayerTypeWebGPULayer.
        * platform/graphics/ca/cocoa/PlatformCALayerCocoa.mm: Support LayerTypeWebGPULayer.
        (PlatformCALayerCocoa::layerTypeForPlatformLayer):
        (PlatformCALayerCocoa::PlatformCALayerCocoa):
        (PlatformCALayerCocoa::commonInit):

2017-03-13  Zan Dobersek  <zdobersek@igalia.com>

        Unreviewed GTK+ build fix. Adjust the Cookie constructor
        invocation in CookieJarSoup, using empty values for the
        newly-added parameters. This should probably be revised
        to determine whether meaningful values can be passed in.

        * platform/network/soup/CookieJarSoup.cpp:
        (WebCore::getRawCookies):

2017-03-13  Jon Lee  <jonlee@apple.com>

        WebGPU: Backend - hosting WebGPU layers
        https://bugs.webkit.org/show_bug.cgi?id=169366
        <rdar://problem/30928735>

        Reviewed by Dean Jackson.

        * html/canvas/WebGPURenderingContext.cpp:
        (WebCore::WebGPURenderingContext::create): Create the device and the
        rendering context.
        * platform/graphics/cocoa/GPUCommandBufferMetal.mm:
        (WebCore::GPUCommandBuffer::commit):
        * platform/graphics/cocoa/GPUDrawableMetal.mm:
        (WebCore::GPUDrawable::release): Fix a log message
        * platform/graphics/gpu/GPUCommandBuffer.cpp:
        (WebCore::GPUCommandBuffer::commit): Deleted. Moved to GPUCommandBufferMetal.
        * rendering/RenderLayerBacking.cpp:
        (WebCore::canvasCompositingStrategy): WebGPU canvas should return CanvasAsLayerContents.

2017-03-12  Jon Lee  <jonlee@apple.com>

        Remove stubs from WebGPU front end
        https://bugs.webkit.org/show_bug.cgi?id=169375

        Reviewed by Dean Jackson.

        Remove stubs and use the back end.
        * html/canvas/WebGPUCommandBuffer.cpp:
        * html/canvas/WebGPUCommandBuffer.h:
        * html/canvas/WebGPUCommandQueue.cpp:
        * html/canvas/WebGPUCommandQueue.h:
        * html/canvas/WebGPUDepthStencilDescriptor.cpp:
        (WebCore::WebGPUDepthStencilDescriptor::setDepthCompareFunction): Remove redundant clause.
        * html/canvas/WebGPUDepthStencilDescriptor.h:
        * html/canvas/WebGPUDepthStencilDescriptor.idl: Remove label property. Not needed yet.
        * html/canvas/WebGPUDepthStencilState.cpp:
        * html/canvas/WebGPUDepthStencilState.h:
        * html/canvas/WebGPUEnums.cpp:
        * html/canvas/WebGPUEnums.h:
        * html/canvas/WebGPURenderCommandEncoder.cpp:
        * html/canvas/WebGPURenderCommandEncoder.h:
        * html/canvas/WebGPURenderPassAttachmentDescriptor.cpp:
        * html/canvas/WebGPURenderPassAttachmentDescriptor.h:
        * html/canvas/WebGPURenderPassColorAttachmentDescriptor.cpp:
        * html/canvas/WebGPURenderPassColorAttachmentDescriptor.h:
        * html/canvas/WebGPURenderPassDepthAttachmentDescriptor.cpp:
        * html/canvas/WebGPURenderPassDepthAttachmentDescriptor.h:
        * html/canvas/WebGPURenderPassDescriptor.cpp:
        (WebCore::WebGPURenderPassDescriptor::colorAttachments): Uncomment code with GPURenderPassColorAttachmentDescriptor available.
        * html/canvas/WebGPURenderPassDescriptor.h:
        * html/canvas/WebGPURenderPipelineColorAttachmentDescriptor.cpp:
        * html/canvas/WebGPURenderPipelineColorAttachmentDescriptor.h:
        * html/canvas/WebGPURenderPipelineDescriptor.cpp:
        * html/canvas/WebGPURenderPipelineDescriptor.h:
        * html/canvas/WebGPURenderPipelineDescriptor.idl: Remove label property. Not needed yet.
        * html/canvas/WebGPURenderPipelineState.cpp:
        * html/canvas/WebGPURenderPipelineState.h:

2017-03-12  Dean Jackson  <dino@apple.com>

        WebGPU Backend
        https://bugs.webkit.org/show_bug.cgi?id=169535
        <rdar://problem/31002364>

        Reviewed by Jon Lee.

        Fill in the remainder of the WebGPU backend. This is effectively
        a C++ representation of the Metal API.

        * WebCore.xcodeproj/project.pbxproj:
        * html/canvas/WebGPUDrawable.cpp:
        (WebCore::WebGPUDrawable::WebGPUDrawable):
        * html/canvas/WebGPUDrawable.h:
        (WebCore::GPUDrawable::texture): Deleted.
        * platform/graphics/cocoa/GPUBufferMetal.mm:
        (WebCore::GPUBuffer::GPUBuffer):
        (WebCore::GPUBuffer::platformBuffer):
        * platform/graphics/cocoa/GPUCommandBufferMetal.mm: Copied from Source/WebCore/platform/graphics/cocoa/GPUFunctionMetal.mm.
        (WebCore::GPUCommandBuffer::GPUCommandBuffer):
        (WebCore::GPUCommandBuffer::platformCommandBuffer):
        (WebCore::GPUCommandBuffer::presentDrawable):
        * platform/graphics/cocoa/GPUCommandQueueMetal.mm: Copied from Source/WebCore/platform/graphics/cocoa/GPUFunctionMetal.mm.
        (WebCore::GPUCommandQueue::GPUCommandQueue):
        (WebCore::GPUCommandQueue::label):
        (WebCore::GPUCommandQueue::setLabel):
        (WebCore::GPUCommandQueue::platformCommandQueue):
        * platform/graphics/cocoa/GPUDepthStencilDescriptorMetal.mm: Copied from Source/WebCore/platform/graphics/cocoa/GPUTextureMetal.mm.
        (WebCore::GPUDepthStencilDescriptor::GPUDepthStencilDescriptor):
        (WebCore::GPUDepthStencilDescriptor::depthWriteEnabled):
        (WebCore::GPUDepthStencilDescriptor::setDepthWriteEnabled):
        (WebCore::GPUDepthStencilDescriptor::depthCompareFunction):
        (WebCore::GPUDepthStencilDescriptor::setDepthCompareFunction):
        (WebCore::GPUDepthStencilDescriptor::platformDepthStencilDescriptor):
        * platform/graphics/cocoa/GPUDepthStencilStateMetal.mm: Copied from Source/WebCore/platform/graphics/cocoa/GPUFunctionMetal.mm.
        (WebCore::GPUDepthStencilState::GPUDepthStencilState):
        (WebCore::GPUDepthStencilState::label):
        (WebCore::GPUDepthStencilState::setLabel):
        (WebCore::GPUDepthStencilState::platformDepthStencilState):
        * platform/graphics/cocoa/GPUDrawableMetal.mm: Copied from Source/WebCore/platform/graphics/cocoa/GPUFunctionMetal.mm.
        (WebCore::GPUDrawable::GPUDrawable):
        (WebCore::GPUDrawable::release):
        (WebCore::GPUDrawable::platformDrawable):
        (WebCore::GPUDrawable::platformTexture):
        * platform/graphics/cocoa/GPUFunctionMetal.mm:
        (WebCore::GPUFunction::GPUFunction):
        (WebCore::GPUFunction::platformFunction):
        * platform/graphics/cocoa/GPULibraryMetal.mm:
        (WebCore::GPULibrary::GPULibrary):
        (WebCore::GPULibrary::setLabel):
        (WebCore::GPULibrary::platformLibrary):
        * platform/graphics/cocoa/GPURenderCommandEncoderMetal.mm: Added.
        (WebCore::GPURenderCommandEncoder::GPURenderCommandEncoder):
        (WebCore::GPURenderCommandEncoder::setRenderPipelineState):
        (WebCore::GPURenderCommandEncoder::setDepthStencilState):
        (WebCore::GPURenderCommandEncoder::setVertexBuffer):
        (WebCore::GPURenderCommandEncoder::setFragmentBuffer):
        (WebCore::GPURenderCommandEncoder::drawPrimitives):
        (WebCore::GPURenderCommandEncoder::endEncoding):
        (WebCore::GPURenderCommandEncoder::platformRenderCommandEncoder):
        * platform/graphics/cocoa/GPURenderPassAttachmentDescriptorMetal.mm: Added.
        (WebCore::GPURenderPassAttachmentDescriptor::GPURenderPassAttachmentDescriptor):
        (WebCore::GPURenderPassAttachmentDescriptor::loadAction):
        (WebCore::GPURenderPassAttachmentDescriptor::setLoadAction):
        (WebCore::GPURenderPassAttachmentDescriptor::storeAction):
        (WebCore::GPURenderPassAttachmentDescriptor::setStoreAction):
        (WebCore::GPURenderPassAttachmentDescriptor::setTexture):
        (WebCore::GPURenderPassAttachmentDescriptor::platformRenderPassAttachmentDescriptor):
        * platform/graphics/cocoa/GPURenderPassColorAttachmentDescriptorMetal.mm: Added.
        (WebCore::GPURenderPassColorAttachmentDescriptor::create):
        (WebCore::GPURenderPassColorAttachmentDescriptor::GPURenderPassColorAttachmentDescriptor):
        (WebCore::GPURenderPassColorAttachmentDescriptor::clearColor):
        (WebCore::GPURenderPassColorAttachmentDescriptor::setClearColor):
        (WebCore::GPURenderPassColorAttachmentDescriptor::platformRenderPassColorAttachmentDescriptor):
        * platform/graphics/cocoa/GPURenderPassDepthAttachmentDescriptorMetal.mm: Added.
        (WebCore::GPURenderPassDepthAttachmentDescriptor::create):
        (WebCore::GPURenderPassDepthAttachmentDescriptor::GPURenderPassDepthAttachmentDescriptor):
        (WebCore::GPURenderPassDepthAttachmentDescriptor::clearDepth):
        (WebCore::GPURenderPassDepthAttachmentDescriptor::setClearDepth):
        (WebCore::GPURenderPassDepthAttachmentDescriptor::platformRenderPassDepthAttachmentDescriptor):
        * platform/graphics/cocoa/GPURenderPassDescriptorMetal.mm: Copied from Source/WebCore/platform/graphics/cocoa/GPUBufferMetal.mm.
        (WebCore::GPURenderPassDescriptor::GPURenderPassDescriptor):
        (WebCore::GPURenderPassDescriptor::colorAttachments):
        (WebCore::GPURenderPassDescriptor::depthAttachment):
        (WebCore::GPURenderPassDescriptor::platformRenderPassDescriptor):
        * platform/graphics/cocoa/GPURenderPipelineColorAttachmentDescriptorMetal.mm: Copied from Source/WebCore/platform/graphics/cocoa/GPULibraryMetal.mm.
        (WebCore::GPURenderPipelineColorAttachmentDescriptor::create):
        (WebCore::GPURenderPipelineColorAttachmentDescriptor::GPURenderPipelineColorAttachmentDescriptor):
        (WebCore::GPURenderPipelineColorAttachmentDescriptor::pixelFormat):
        (WebCore::GPURenderPipelineColorAttachmentDescriptor::setPixelFormat):
        (WebCore::GPURenderPipelineColorAttachmentDescriptor::platformRenderPipelineColorAttachmentDescriptor):
        * platform/graphics/cocoa/GPURenderPipelineDescriptorMetal.mm: Added.
        (WebCore::GPURenderPipelineDescriptor::GPURenderPipelineDescriptor):
        (WebCore::GPURenderPipelineDescriptor::depthAttachmentPixelFormat):
        (WebCore::GPURenderPipelineDescriptor::setDepthAttachmentPixelFormat):
        (WebCore::GPURenderPipelineDescriptor::setVertexFunction):
        (WebCore::GPURenderPipelineDescriptor::setFragmentFunction):
        (WebCore::GPURenderPipelineDescriptor::colorAttachments):
        (WebCore::GPURenderPipelineDescriptor::reset):
        (WebCore::GPURenderPipelineDescriptor::platformRenderPipelineDescriptor):
        * platform/graphics/cocoa/GPURenderPipelineStateMetal.mm: Copied from Source/WebCore/platform/graphics/cocoa/GPUTextureMetal.mm.
        (WebCore::GPURenderPipelineState::GPURenderPipelineState):
        (WebCore::GPURenderPipelineState::label):
        (WebCore::GPURenderPipelineState::setLabel):
        (WebCore::GPURenderPipelineState::platformRenderPipelineState):
        * platform/graphics/cocoa/GPUTextureDescriptorMetal.mm:
        (WebCore::GPUTextureDescriptor::GPUTextureDescriptor):
        (WebCore::GPUTextureDescriptor::platformTextureDescriptor):
        * platform/graphics/cocoa/GPUTextureMetal.mm:
        (WebCore::GPUTexture::GPUTexture):
        (WebCore::GPUTexture::platformTexture):
        * platform/graphics/gpu/GPUBuffer.cpp:
        * platform/graphics/gpu/GPUBuffer.h:
        * platform/graphics/gpu/GPUCommandBuffer.cpp: Copied from Source/WebCore/platform/graphics/gpu/GPUBuffer.cpp.
        (WebCore::GPUCommandBuffer::create):
        (WebCore::GPUCommandBuffer::~GPUCommandBuffer):
        (WebCore::GPUCommandBuffer::commit):
        (WebCore::GPUCommandBuffer::createRenderCommandEncoder):
        (WebCore::GPUCommandBuffer::presentDrawable):
        * platform/graphics/gpu/GPUCommandBuffer.h: Copied from Source/WebCore/platform/graphics/gpu/GPUTexture.h.
        * platform/graphics/gpu/GPUCommandQueue.cpp: Copied from Source/WebCore/platform/graphics/gpu/GPUBuffer.cpp.
        (WebCore::GPUCommandQueue::create):
        (WebCore::GPUCommandQueue::~GPUCommandQueue):
        (WebCore::GPUCommandQueue::createCommandBuffer):
        (WebCore::GPUCommandQueue::label):
        (WebCore::GPUCommandQueue::setLabel):
        * platform/graphics/gpu/GPUCommandQueue.h: Copied from Source/WebCore/platform/graphics/gpu/GPULibrary.h.
        * platform/graphics/gpu/GPUDepthStencilDescriptor.cpp: Copied from Source/WebCore/platform/graphics/gpu/GPUTexture.cpp.
        (WebCore::GPUDepthStencilDescriptor::create):
        (WebCore::GPUDepthStencilDescriptor::~GPUDepthStencilDescriptor):
        (WebCore::GPUDepthStencilDescriptor::depthWriteEnabled):
        (WebCore::GPUDepthStencilDescriptor::setDepthWriteEnabled):
        (WebCore::GPUDepthStencilDescriptor::depthCompareFunction):
        (WebCore::GPUDepthStencilDescriptor::setDepthCompareFunction):
        * platform/graphics/gpu/GPUDepthStencilDescriptor.h: Copied from Source/WebCore/platform/graphics/gpu/GPUTexture.h.
        * platform/graphics/gpu/GPUDepthStencilState.cpp: Copied from Source/WebCore/platform/graphics/gpu/GPUBuffer.cpp.
        (WebCore::GPUDepthStencilState::create):
        (WebCore::GPUDepthStencilState::~GPUDepthStencilState):
        (WebCore::GPUDepthStencilState::label):
        (WebCore::GPUDepthStencilState::setLabel):
        * platform/graphics/gpu/GPUDepthStencilState.h: Copied from Source/WebCore/platform/graphics/gpu/GPULibrary.h.
        * platform/graphics/gpu/GPUDevice.cpp:
        (WebCore::GPUDevice::createCommandQueue):
        (WebCore::GPUDevice::getFramebuffer):
        * platform/graphics/gpu/GPUDevice.h:
        (WebCore::GPUDevice::markLayerComposited):
        (WebCore::GPUDevice::createCommandQueue): Deleted.
        (WebCore::GPUDevice::getFramebuffer): Deleted.
        * platform/graphics/gpu/GPUDrawable.cpp: Copied from Source/WebCore/platform/graphics/gpu/GPUBuffer.cpp.
        (WebCore::GPUDrawable::create):
        (WebCore::GPUDrawable::~GPUDrawable):
        (WebCore::GPUDrawable::release):
        * platform/graphics/gpu/GPUDrawable.h: Copied from Source/WebCore/platform/graphics/gpu/GPUTexture.h.
        * platform/graphics/gpu/GPUEnums.h: Copied from Source/WebCore/platform/graphics/cocoa/GPUFunctionMetal.mm.
        * platform/graphics/gpu/GPUFunction.h:
        * platform/graphics/gpu/GPULibrary.cpp:
        * platform/graphics/gpu/GPULibrary.h:
        * platform/graphics/gpu/GPURenderCommandEncoder.cpp: Copied from Source/WebCore/platform/graphics/gpu/GPULibrary.cpp.
        (WebCore::GPURenderCommandEncoder::create):
        (WebCore::GPURenderCommandEncoder::~GPURenderCommandEncoder):
        (WebCore::GPURenderCommandEncoder::setRenderPipelineState):
        (WebCore::GPURenderCommandEncoder::setDepthStencilState):
        (WebCore::GPURenderCommandEncoder::setVertexBuffer):
        (WebCore::GPURenderCommandEncoder::setFragmentBuffer):
        (WebCore::GPURenderCommandEncoder::drawPrimitives):
        (WebCore::GPURenderCommandEncoder::endEncoding):
        * platform/graphics/gpu/GPURenderCommandEncoder.h: Copied from Source/WebCore/platform/graphics/gpu/GPUTexture.h.
        * platform/graphics/gpu/GPURenderPassAttachmentDescriptor.cpp: Copied from Source/WebCore/platform/graphics/gpu/GPUTexture.cpp.
        (WebCore::GPURenderPassAttachmentDescriptor::~GPURenderPassAttachmentDescriptor):
        (WebCore::GPURenderPassAttachmentDescriptor::GPURenderPassAttachmentDescriptor):
        (WebCore::GPURenderPassAttachmentDescriptor::loadAction):
        (WebCore::GPURenderPassAttachmentDescriptor::setLoadAction):
        (WebCore::GPURenderPassAttachmentDescriptor::storeAction):
        (WebCore::GPURenderPassAttachmentDescriptor::setStoreAction):
        (WebCore::GPURenderPassAttachmentDescriptor::setTexture):
        * platform/graphics/gpu/GPURenderPassAttachmentDescriptor.h: Copied from Source/WebCore/platform/graphics/gpu/GPUTexture.h.
        * platform/graphics/gpu/GPURenderPassColorAttachmentDescriptor.cpp: Copied from Source/WebCore/platform/graphics/gpu/GPUDevice.cpp.
        (WebCore::GPURenderPassColorAttachmentDescriptor::create):
        (WebCore::GPURenderPassColorAttachmentDescriptor::GPURenderPassColorAttachmentDescriptor):
        (WebCore::GPURenderPassColorAttachmentDescriptor::~GPURenderPassColorAttachmentDescriptor):
        (WebCore::GPURenderPassColorAttachmentDescriptor::clearColor):
        (WebCore::GPURenderPassColorAttachmentDescriptor::setClearColor):
        * platform/graphics/gpu/GPURenderPassColorAttachmentDescriptor.h: Copied from Source/WebCore/platform/graphics/gpu/GPUTexture.h.
        * platform/graphics/gpu/GPURenderPassDepthAttachmentDescriptor.cpp: Copied from Source/WebCore/platform/graphics/gpu/GPUTexture.cpp.
        (WebCore::GPURenderPassDepthAttachmentDescriptor::create):
        (WebCore::GPURenderPassDepthAttachmentDescriptor::GPURenderPassDepthAttachmentDescriptor):
        (WebCore::GPURenderPassDepthAttachmentDescriptor::~GPURenderPassDepthAttachmentDescriptor):
        (WebCore::GPURenderPassDepthAttachmentDescriptor::clearDepth):
        (WebCore::GPURenderPassDepthAttachmentDescriptor::setClearDepth):
        * platform/graphics/gpu/GPURenderPassDepthAttachmentDescriptor.h: Copied from Source/WebCore/platform/graphics/gpu/GPUTexture.h.
        * platform/graphics/gpu/GPURenderPassDescriptor.cpp: Copied from Source/WebCore/platform/graphics/gpu/GPUBuffer.cpp.
        (WebCore::GPURenderPassDescriptor::create):
        (WebCore::GPURenderPassDescriptor::~GPURenderPassDescriptor):
        (WebCore::GPURenderPassDescriptor::depthAttachment):
        * platform/graphics/gpu/GPURenderPassDescriptor.h: Copied from Source/WebCore/platform/graphics/gpu/GPUTexture.h.
        * platform/graphics/gpu/GPURenderPipelineColorAttachmentDescriptor.cpp: Copied from Source/WebCore/platform/graphics/gpu/GPUTexture.cpp.
        (WebCore::GPURenderPipelineColorAttachmentDescriptor::~GPURenderPipelineColorAttachmentDescriptor):
        (WebCore::GPURenderPipelineColorAttachmentDescriptor::GPURenderPipelineColorAttachmentDescriptor):
        (WebCore::GPURenderPipelineColorAttachmentDescriptor::pixelFormat):
        (WebCore::GPURenderPipelineColorAttachmentDescriptor::setPixelFormat):
        * platform/graphics/gpu/GPURenderPipelineColorAttachmentDescriptor.h: Copied from Source/WebCore/platform/graphics/gpu/GPUTexture.h.
        * platform/graphics/gpu/GPURenderPipelineDescriptor.cpp: Copied from Source/WebCore/platform/graphics/gpu/GPUDevice.cpp.
        (WebCore::GPURenderPipelineDescriptor::create):
        (WebCore::GPURenderPipelineDescriptor::~GPURenderPipelineDescriptor):
        (WebCore::GPURenderPipelineDescriptor::depthAttachmentPixelFormat):
        (WebCore::GPURenderPipelineDescriptor::setDepthAttachmentPixelFormat):
        (WebCore::GPURenderPipelineDescriptor::setVertexFunction):
        (WebCore::GPURenderPipelineDescriptor::setFragmentFunction):
        (WebCore::GPURenderPipelineDescriptor::colorAttachments):
        * platform/graphics/gpu/GPURenderPipelineDescriptor.h: Copied from Source/WebCore/platform/graphics/gpu/GPULibrary.h.
        * platform/graphics/gpu/GPURenderPipelineState.cpp: Copied from Source/WebCore/platform/graphics/gpu/GPULibrary.cpp.
        (WebCore::GPURenderPipelineState::create):
        (WebCore::GPURenderPipelineState::~GPURenderPipelineState):
        (WebCore::GPURenderPipelineState::label):
        (WebCore::GPURenderPipelineState::setLabel):
        * platform/graphics/gpu/GPURenderPipelineState.h: Copied from Source/WebCore/platform/graphics/gpu/GPULibrary.h.
        * platform/graphics/gpu/GPUTexture.cpp:
        (WebCore::GPUTexture::createFromDrawable):
        (WebCore::GPUTexture::createFromExistingTexture): Deleted.
        * platform/graphics/gpu/GPUTexture.h:
        * platform/graphics/gpu/GPUTextureDescriptor.cpp:
        * platform/graphics/gpu/GPUTextureDescriptor.h:

2017-03-12  Zalan Bujtas  <zalan@apple.com>

        Simple line layout: Paginated content is not painted properly when font overflows line height.
        https://bugs.webkit.org/show_bug.cgi?id=169516

        Reviewed by Antti Koivisto.

        adjustLineIndexForStruts should take the IndexType::First/Last into account
        when searching for the line index in a paginated context.
        This also changes the the computed offset height from m_lineHeight to m_ascent + m_descent
        so that we can find lines with large fonts (but small line height).

        Test: fast/multicol/simple-line-layout-line-index-after-strut.html

        * rendering/SimpleLineLayoutResolver.cpp:
        (WebCore::SimpleLineLayout::RunResolver::adjustLineIndexForStruts):
        (WebCore::SimpleLineLayout::RunResolver::lineIndexForHeight):
        (WebCore::SimpleLineLayout::RunResolver::rangeForRect):
        * rendering/SimpleLineLayoutResolver.h:

2017-03-12  Brady Eidson  <beidson@apple.com>

        Add full NSHTTPCookie fidelity to WebCore::Cookie.
        https://bugs.webkit.org/show_bug.cgi?id=169514

        Reviewed by Dean Jackson.

        No new tests (Refactor, no testable behavior change for now).

        * platform/Cookie.h:
        (WebCore::Cookie::Cookie):
        (WebCore::Cookie::encode):
        (WebCore::Cookie::decode):
        
        * platform/network/cocoa/CookieCocoa.mm:
        (WebCore::portVectorFromList):
        (WebCore::portStringFromVector):
        (WebCore::Cookie::Cookie):
        (WebCore::Cookie::operator NSHTTPCookie *):
        
        * platform/network/mac/CookieJarMac.mm:
        (WebCore::getRawCookies):

2017-03-12  Said Abou-Hallawa  <sabouhallawa@apple.com>

        REGRESSION (r213764): Async image decoding is disabled for animated images
        https://bugs.webkit.org/show_bug.cgi?id=169529

        Reviewed by Jon Lee.
        
        The change r213764 causes the animated images to be decoded synchronously
        because we were calling frameImageAtIndex() with an empty sizeForDrawing
        but with a valid subsamplingLevel. This call is translated to be synchronous
        image decoding. The fix is get the current image frame without any decoding.
        This is because are sure that in the case of animated image, the current
        image frame can not be deleted.

        * platform/graphics/BitmapImage.cpp:
        (WebCore::BitmapImage::draw):

2017-03-12  Romain Bellessort  <romain.bellessort@crf.canon.fr>

        [Readable Streams API] Implement ReadableStreamBYOBRequest respond() (closed stream state)
        https://bugs.webkit.org/show_bug.cgi?id=168781

        Reviewed by Youenn Fablet.

        Implemented ReadableStreamBYOBRequest respond() method in the case of a closed stream.

        Added tests related to respond() method and updated WPT imported tests expectations.

        * Modules/streams/ReadableByteStreamInternals.js:
        (readableByteStreamControllerRespond): Added.
        (readableByteStreamControllerRespondInternal): Added.
        (readableByteStreamControllerRespondInClosedState): Added.
        (readableByteStreamControllerShiftPendingPullInto): Added.
        (readableByteStreamControllerInvalidateBYOBRequest): Added.
        (readableByteStreamControllerCommitPullIntoDescriptor): Added.
        (readableByteStreamControllerConvertPullIntoDescriptor): Added.
        (readableStreamFulfillReadIntoRequest): Added.
        * Modules/streams/ReadableStreamBYOBRequest.js:
        (respond): Implemented.

2017-03-11  Simon Fraser  <simon.fraser@apple.com>

        Fix memory estimate for layers supporting subpixel-antialised text
        https://bugs.webkit.org/show_bug.cgi?id=169507
        rdar://problem/30979337

        Reviewed by Alexey Proskuryakov.

        Deep color layers on iOS use 5 bytes per pixel, layers supporting subpixel-antialiaed 
        text on Mac use 8 bytes per pixel.

        * platform/graphics/ca/cocoa/PlatformCALayerCocoa.h:
        * platform/graphics/ca/cocoa/PlatformCALayerCocoa.mm:
        (PlatformCALayerCocoa::backingStoreBytesPerPixel):

2017-03-11  Youenn Fablet  <youenn@apple.com>

        XMLHttpRequest: make setRequestHeader() use `, ` as separator (including a space)
        https://bugs.webkit.org/show_bug.cgi?id=169285

        Reviewed by Sam Weinig.

        Covered by updated tests.

        * platform/network/HTTPHeaderMap.cpp:
        (WebCore::HTTPHeaderMap::add): Reverting back to ', '.

2017-03-11  Said Abou-Hallawa  <sabouhallawa@apple.com>

        Enable async image decoding for large images
        https://bugs.webkit.org/show_bug.cgi?id=165039

        Reviewed by Simon Fraser.

        When BitmapImage::draw() is called for a large image, we are going to request async
        image decoding for the native image instead of drawing it. If a lower resolution 
        native image is available for this, it is going to be drawn. Otherwise nothing will
        be drawn. In both cases, a repaint will be scheduled for the image observer. This
        should improve the image first time paint and the scrolling scenarios. It also makes
        the scrolling more responsive by removing the decoding step from the main thread. 
        
        For now we are going to disable the asynchronous image decoding for the webkit test
        runner because drawing the image does not block the page rendering anymore. An image
        can be repainted later when its frame is ready for painting. This can cause a test
        to fail because the webkit test runner may capture an image for the page before painting
        all the images. The asynchronous image decoding can to be explicitly enabled from
        the test page. Once the specs of the image 'async' attribute and 'ready' event is
        approved, this should be revisited. It is important to test what we ship and eventually
        async image decoding should be enabled in the webkit test runner.

        * loader/cache/CachedImage.h: Change the default of LargeImageAsyncDecoding and AnimatedImageAsyncDecoding
        to be false. This change fixes a layout test which creates an CachedImage inside an ImageDocument. The
        CachedImage in this case does not have a loader so getting the values of these options from the settings
        which is false for the DRT/WTR did not happen.
        * platform/graphics/BitmapImage.cpp:
        (WebCore::BitmapImage::destroyDecodedData): ImageSource::hasDecodingQueue() is renamed to ImageSource::hasAsyncDecodingQueue().
        (WebCore::BitmapImage::frameImageAtIndex): Use String::utf8().data() instead of String::characters8().
        (WebCore::BitmapImage::draw): If drawing the current frame is called while it is being
        decoded, draw the current native image if the current frame was decoded but for a 
        different size  and and will not invoke decoding while painting. If the frame is being
        decoded and there isn't a decoded frame, return without drawing but set a flag that
        that this image needs a repaint.
        (WebCore::BitmapImage::shouldUseAsyncDecodingForLargeImage): Renaming a function.
        (WebCore::BitmapImage::shouldUseAsyncDecodingForAnimatedImage): Ditto.
        (WebCore::BitmapImage::internalStartAnimation): Use String::utf8().data() instead of String::characters8().
        (WebCore::BitmapImage::advanceAnimation): Ditto.
        (WebCore::BitmapImage::internalAdvanceAnimation): Ditto.
        (WebCore::BitmapImage::newFrameNativeImageAvailableAtIndex): Now this callback can be
        called form the ImageFrameCache when finishing a frame of an animated image or the
        frame of a large image. For large images, we need to call CachedImage::changedInRect()
        if this image needs a repaint. If the decoding queue is idle, we should close it.
        (WebCore::BitmapImage::isLargeImageAsyncDecodingRequired): Deleted. Function was renamed.
        (WebCore::BitmapImage::isAnimatedImageAsyncDecodingRequired): Deleted. Ditto.
        * platform/graphics/BitmapImage.h:

        * platform/graphics/ImageFrameCache.cpp:
        (WebCore::ImageFrameCache::~ImageFrameCache): hasDecodingQueue() was renamed to hasAsyncDecodingQueue().
        (WebCore::ImageFrameCache::decodingQueue): Change the QNS of the decoding thread to be WorkQueue::QOS::Default.
        WorkQueue::QOS::UserInteractive causes the scrolling thread to preempted  which can make the scrolling choppy.
        (WebCore::ImageFrameCache::startAsyncDecodingQueue): hasDecodingQueue() was renamed to hasAsyncDecodingQueue().
        (WebCore::ImageFrameCache::requestFrameAsyncDecodingAtIndex): Ditto.
        (WebCore::ImageFrameCache::isAsyncDecodingQueueIdle): A helper function to tell whether the decoding thread is idle.
        (WebCore::ImageFrameCache::stopAsyncDecodingQueue): hasDecodingQueue() was renamed to hasAsyncDecodingQueue().
        * platform/graphics/ImageFrameCache.h:
        (WebCore::ImageFrameCache::hasAsyncDecodingQueue): Rename this function to be consistent with the rest of the functions.
        (WebCore::ImageFrameCache::hasDecodingQueue): Deleted.

        * platform/graphics/ImageSource.cpp:
        (WebCore::ImageSource::shouldUseAsyncDecoding): Renaming a function. Change the heuristic for large images be
        a little bigger than the heuristic for animated images.
        (WebCore::ImageSource::isAsyncDecodingRequired): Deleted.
        * platform/graphics/ImageSource.h:
        (WebCore::ImageSource::hasAsyncDecodingQueue): hasDecodingQueue() was renamed to hasAsyncDecodingQueue().
        (WebCore::ImageSource::isAsyncDecodingQueueIdle): A wrapper for ImageFrameCache::isAsyncDecodingQueueIdle().
        (WebCore::ImageSource::hasDecodingQueue): Deleted.
        
        * platform/graphics/cg/ImageDecoderCG.cpp:
        (WebCore::ImageDecoder::createFrameImageAtIndex): CGImageSourceCreateThumbnailAtIndex() returns a CGImage with
        the image native size regardless of the subsamplingLevel unless kCGImageSourceSubsampleFactor is passed. Here
        we are trying to see which size is smaller: the image native size or the sizeForDrawing. If we want a CGImage
        with the image native size, sizeForDrawing will not passed. So we need to get the image native size with the
        default subsampling and then compare it with sizeForDrawing.

2017-03-11  Jon Lee  <jonlee@apple.com>

        WebGPU prototype - Front-End
        https://bugs.webkit.org/show_bug.cgi?id=167952

        Reviewed by Dean Jackson.

        This patch adds all of the relevant front-end files, and builds successfully when
        ENABLE(WEBGPU) is off. For the back-end components that are not yet
        implemented, a stub was added with a FIXME.

        * DerivedSources.make: Add all the new IDL files.
        * WebCore.xcodeproj/project.pbxproj: New IDL, front-end and generated files.

        JS custom bindings.
        * bindings/js/JSDocumentCustom.cpp: Add WebGPU clause for getCSSCanvasContext.
        * bindings/js/JSHTMLCanvasElementCustom.cpp:
        (WebCore::JSHTMLCanvasElement::getContext):
        * bindings/js/JSWebGPURenderPassAttachmentDescriptorCustom.cpp: Added.
        * bindings/js/JSWebGPURenderingContextCustom.cpp: Added.
        * html/HTMLCanvasElement.cpp:
        (WebCore::HTMLCanvasElement::getContext):
        (WebCore::HTMLCanvasElement::isWebGPUType):
        (WebCore::HTMLCanvasElement::getContextWebGPU):
        (WebCore::HTMLCanvasElement::reset):
        (WebCore::HTMLCanvasElement::paint):
        (WebCore::HTMLCanvasElement::isGPU):
        (WebCore::HTMLCanvasElement::getContextWebGPU): For release builds, switch to ASSERT_UNUSED.
        * html/HTMLCanvasElement.h:
        * html/canvas/CanvasRenderingContext.h:
        (WebCore::CanvasRenderingContext::isGPU):

        .cpp, .h, .idl files, wrapped in WEBGPU conditional, and enabled at runtime.
        * html/canvas/WebGPUBuffer:
        * html/canvas/WebGPUCommandBuffer:
        * html/canvas/WebGPUCommandQueue:
        * html/canvas/WebGPUDepthStencilDescriptor:
        * html/canvas/WebGPUDepthStencilState:
        * html/canvas/WebGPUDrawable:
        * html/canvas/WebGPUEnums:
        * html/canvas/WebGPUFunction:
        * html/canvas/WebGPULibrary:
        * html/canvas/WebGPUObject (no IDL):
        * html/canvas/WebGPURenderCommandEncoder:
        * html/canvas/WebGPURenderPassAttachmentDescriptor:
        * html/canvas/WebGPURenderPassColorAttachmentDescriptor:
        * html/canvas/WebGPURenderPassDepthAttachmentDescriptor:
        * html/canvas/WebGPURenderPassDescriptor:
        * html/canvas/WebGPURenderPipelineColorAttachmentDescriptor:
        * html/canvas/WebGPURenderPipelineDescriptor:
        * html/canvas/WebGPURenderPipelineState:
        * html/canvas/WebGPURenderingContext:
        * html/canvas/WebGPUTexture:
        * html/canvas/WebGPUTextureDescriptor:  Add stubs.

2017-03-11  Brady Eidson  <beidson@apple.com>

        Cleanup "addCookie" and its sole user.
        https://bugs.webkit.org/show_bug.cgi?id=169486

        Reviewed by Brian Burg.

        No new tests (Refactor, no behavior change)

        * WebCore.xcodeproj/project.pbxproj:

        * loader/CookieJar.cpp:
        (WebCore::addCookie): Deleted.
        * loader/CookieJar.h:

        * platform/Cookie.h:
        (WebCore::Cookie::Cookie):
        (WebCore::CookieHash::hash):
        (WebCore::CookieHash::equal):
        (WebCore::Cookie::encode):
        (WebCore::Cookie::decode):

        * platform/CookiesStrategy.h:

        * platform/network/NetworkStorageSession.h:

        * platform/network/PlatformCookieJar.h:

        * platform/network/cf/CookieJarCFNet.cpp:
        (WebCore::addCookie): Deleted.

        * platform/network/cocoa/CookieCocoa.mm: Copied from Source/WebCore/loader/CookieJar.h.
        (WebCore::Cookie::operator NSHTTPCookie *):

        * platform/network/cocoa/NetworkStorageSessionCocoa.mm: Copied from Source/WebCore/loader/CookieJar.h.
        (WebCore::NetworkStorageSession::setCookies):
        (WebCore::NetworkStorageSession::nsCookieStorage):

        * platform/network/curl/CookieJarCurl.cpp:
        (WebCore::addCookie): Deleted.

        * platform/network/mac/CookieJarMac.mm:
        (WebCore::deleteCookiesForHostnames):
        (WebCore::deleteAllCookiesModifiedSince):
        (WebCore::addCookie): Deleted.
        (WebCore::cookieStorage): Deleted.

        * platform/network/soup/CookieJarSoup.cpp:
        (WebCore::toSoupCookie): Deleted.
        (WebCore::addCookie): Deleted.

        * platform/network/soup/NetworkStorageSessionSoup.cpp:
        (WebCore::toSoupCookie):
        (WebCore::NetworkStorageSession::setCookies):

2017-03-10  Alex Christensen  <achristensen@webkit.org>

        Fix watch and tv builds after r213294
        https://bugs.webkit.org/show_bug.cgi?id=169508

        Reviewed by Dan Bernstein.

        * Configurations/FeatureDefines.xcconfig:

2017-03-10  Dave Hyatt  <hyatt@apple.com>

        Percentage constrained images shrinking inside blocks inside nested flex boxes
        https://bugs.webkit.org/show_bug.cgi?id=169438

        Reviewed by Dean Jackson.

        Added new test in fast/hidpi.

        * rendering/RenderBlock.cpp:
        (WebCore::RenderBlock::computeChildPreferredLogicalWidths):
        Make sure to clear out flexbox override sizes when computing preferred logical widths,
        since they should not ever influence the preferred size.

2017-03-10  Youenn Fablet  <youenn@apple.com>

        Move libwebrtc backend to using tracks
        https://bugs.webkit.org/show_bug.cgi?id=169472

        Reviewed by Alex Christensen.

        Covered by current test sets.

        This change allows to move away from streams and use more tracks.
        This allows future better alignment with the spec and better implementation of sender/receover/transceiver.

        Small refactoring to use more Ref<> in WebRTC track-based code.
        Added a notifyAddedTrack to notify the backend that a track was added.
        For libwebrtc, this allows calling AddTrack before making the offer.
        Updated mock libwebrtc backend accordingly.

        * Modules/mediastream/MediaEndpointPeerConnection.cpp:
        (WebCore::MediaEndpointPeerConnection::replaceTrack):
        (WebCore::MediaEndpointPeerConnection::replaceTrackTask):
        * Modules/mediastream/MediaEndpointPeerConnection.h:
        * Modules/mediastream/PeerConnectionBackend.h:
        (WebCore::PeerConnectionBackend::notifyAddedTrack):
        * Modules/mediastream/RTCPeerConnection.cpp:
        (WebCore::RTCPeerConnection::addTrack):
        (WebCore::RTCPeerConnection::replaceTrack):
        * Modules/mediastream/RTCPeerConnection.h:
        * Modules/mediastream/RTCRtpSender.cpp:
        (WebCore::RTCRtpSender::create):
        (WebCore::RTCRtpSender::RTCRtpSender):
        (WebCore::RTCRtpSender::setTrack):
        * Modules/mediastream/RTCRtpSender.h:
        * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp:
        (WebCore::LibWebRTCMediaEndpoint::addTrack):
        (WebCore::LibWebRTCMediaEndpoint::doCreateOffer):
        (WebCore::LibWebRTCMediaEndpoint::doCreateAnswer):
        (WebCore::LibWebRTCMediaEndpoint::getStats):
        * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.h:
        * Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.cpp:
        (WebCore::LibWebRTCPeerConnectionBackend::doAddIceCandidate):
        (WebCore::LibWebRTCPeerConnectionBackend::notifyAddedTrack):
        * Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.h:
        * testing/MockLibWebRTCPeerConnection.cpp:
        (WebCore::MockLibWebRTCPeerConnection::AddTrack):
        (WebCore::MockLibWebRTCPeerConnection::RemoveTrack):
        (WebCore::MockLibWebRTCPeerConnection::CreateOffer):
        (WebCore::MockLibWebRTCPeerConnection::CreateAnswer):
        * testing/MockLibWebRTCPeerConnection.h:
        (WebCore::MockRtpSender::MockRtpSender):
        (WebCore::MockRtpSender::ssrc):
        (WebCore::MockRtpSender::media_type):
        (WebCore::MockRtpSender::id):
        (WebCore::MockRtpSender::stream_ids):
        (WebCore::MockRtpSender::GetParameters):
        (WebCore::MockRtpSender::SetParameters):
        (WebCore::MockRtpSender::GetDtmfSender):

2017-03-10  Zalan Bujtas  <zalan@apple.com>

        Simple line layout: Check how many orphans needed on the current page before breaking.
        https://bugs.webkit.org/show_bug.cgi?id=169477

        Reviewed by Antti Koivisto.

        Before breaking for the widows we actually need to check for orphans first.

        Test: fast/multicol/simple-line-layout-orphans-and-widows.html

        * rendering/SimpleLineLayoutPagination.cpp:
        (WebCore::SimpleLineLayout::computeLineBreakIndex):
        (WebCore::SimpleLineLayout::adjustLinePositionsForPagination):

2017-03-10  Dean Jackson  <dino@apple.com>

        WebGPU: Backend - Textures and TextureDescriptors
        https://bugs.webkit.org/show_bug.cgi?id=169365
        <rdar://problem/30928716>

        Reviewed by Jon Lee with help from Anders Carlsson.

        Backend implementation of textures for WebGPU, which adds
        the GPUTexture and GPUTextureDescriptor classes, as well
        as a creation method on GPUDevice.

        * PlatformMac.cmake:
        * WebCore.xcodeproj/project.pbxproj:
        * platform/graphics/cocoa/GPUTextureDescriptorMetal.mm: Added.
        (WebCore::GPUTextureDescriptor::GPUTextureDescriptor):
        (WebCore::GPUTextureDescriptor::width):
        (WebCore::GPUTextureDescriptor::setWidth):
        (WebCore::GPUTextureDescriptor::height):
        (WebCore::GPUTextureDescriptor::setHeight):
        (WebCore::GPUTextureDescriptor::sampleCount):
        (WebCore::GPUTextureDescriptor::setSampleCount):
        (WebCore::GPUTextureDescriptor::textureType):
        (WebCore::GPUTextureDescriptor::setTextureType):
        (WebCore::GPUTextureDescriptor::storageMode):
        (WebCore::GPUTextureDescriptor::setStorageMode):
        (WebCore::GPUTextureDescriptor::usage):
        (WebCore::GPUTextureDescriptor::setUsage):
        (WebCore::GPUTextureDescriptor::platformTextureDescriptor):
        * platform/graphics/cocoa/GPUTextureMetal.mm:
        (WebCore::GPUTexture::GPUTexture):
        (WebCore::GPUTexture::width):
        (WebCore::GPUTexture::height):
        (WebCore::GPUTexture::platformTexture):
        * platform/graphics/gpu/GPUDevice.cpp:
        (WebCore::GPUDevice::createTexture):
        * platform/graphics/gpu/GPUDevice.h:
        * platform/graphics/gpu/GPUTexture.cpp:
        (WebCore::GPUTexture::create):
        (WebCore::GPUTexture::createFromExistingTexture):
        (WebCore::GPUTexture::~GPUTexture):
        (WebCore::GPUTexture::width):
        (WebCore::GPUTexture::height):
        * platform/graphics/gpu/GPUTexture.h:
        * platform/graphics/gpu/GPUTextureDescriptor.cpp:
        (WebCore::GPUTextureDescriptor::create):
        (WebCore::GPUTextureDescriptor::~GPUTextureDescriptor):
        (WebCore::GPUTextureDescriptor::width):
        (WebCore::GPUTextureDescriptor::setWidth):
        (WebCore::GPUTextureDescriptor::height):
        (WebCore::GPUTextureDescriptor::setHeight):
        (WebCore::GPUTextureDescriptor::sampleCount):
        (WebCore::GPUTextureDescriptor::setSampleCount):
        (WebCore::GPUTextureDescriptor::textureType):
        (WebCore::GPUTextureDescriptor::setTextureType):
        (WebCore::GPUTextureDescriptor::storageMode):
        (WebCore::GPUTextureDescriptor::setStorageMode):
        (WebCore::GPUTextureDescriptor::usage):
        (WebCore::GPUTextureDescriptor::setUsage):
        * platform/graphics/gpu/GPUTextureDescriptor.h:

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-03-10  Zalan Bujtas  <zalan@apple.com>

        Simple line layout: Oprhan lines with visual overflow does not work properly.
        https://bugs.webkit.org/show_bug.cgi?id=169409

        Reviewed by Antti Koivisto.

        Add visual overflow checking for block strut. This logic is copied from RenderBlockFlow::adjustLinePositionForPagination.

        Covered by existing test.

        * rendering/SimpleLineLayoutFunctions.cpp:
        (WebCore::SimpleLineLayout::computeOverflow):
        * rendering/SimpleLineLayoutFunctions.h:
        * rendering/SimpleLineLayoutPagination.cpp:
        (WebCore::SimpleLineLayout::setPageBreakForLine):

2017-03-09  Simon Fraser  <simon.fraser@apple.com>

        [iOS WK2] Layer content blurry with nested perspective and transforms
        https://bugs.webkit.org/show_bug.cgi?id=169457
        rdar://problem/29879484

        Reviewed by Tim Horton.

        We set rasterizationScale on CALayers to the same values as contentsScale, to
        avoid blurry layers when CA rasterizes, which often happens with nested perspective
        transforms.
        
        However, in UI-side compositing, if the page is not zoomed, we never applied the
        rasterizationScale in the UI process. This happened because the PlatformCALayerRemote
        constructor set m_properties.contentsScale, but did not set the dirty bit that
        triggers the application of contentsScale and rasterizationScale in RemoteLayerTreePropertyApplier.
        The fix is to set this dirty bit.
        
        The rest of the changes are for testing. Internals now exposes layerIDForElement()
        for returns an internal (non-stable-across-loads) layerID, which can be passed
        to UIScriptController.propertiesOfLayerWithID() in the UI process, which inspects
        the built layer (UIView) hierarchy. propertiesOfLayerWithID() returns a dictionary
        which the test can dump as JSON, or pull values out of.

        A few #pragma once cleanups also.

        Tests: compositing/ios/basic-layer-properties.html
               compositing/ios/rasterization-scale.html

        * testing/Internals.cpp:
        (WebCore::Internals::layerIDForElement):
        * testing/Internals.h:
        * testing/Internals.idl:

2017-03-10  Commit Queue  <commit-queue@webkit.org>

        Unreviewed, rolling out r213618.
        https://bugs.webkit.org/show_bug.cgi?id=169475

        Suspect this is the cause of a large memory regression
        (Requested by jonlee_ on #webkit).

        Reverted changeset:

        "Enable async image decoding for large images"
        https://bugs.webkit.org/show_bug.cgi?id=165039
        http://trac.webkit.org/changeset/213618

2017-03-10  Antti Koivisto  <antti@apple.com>

        Allow the page to render before <link> stylesheet tags in body
        https://bugs.webkit.org/show_bug.cgi?id=149157
        <rdar://problem/24658830>

        Reviewed by Simon Fraser.

        Currently we block style and renderer building completely if document has any loading
        stylesheets. In case a script queries something layout dependent we construct the render
        tree with whatever style we have but block painting in it.

        This patch changes behavior so that a loading stylesheet in body only blocks rendering for elements
        that are after it. The expectation is that such stylesheets rarely affect elements before them
        and the elements can be rendered without causing ugly visible styling changes.

        The patch replaces the old flash-of-unstyled-content (FOUC) preventation mechanism with a more
        fine-grained one. Paint blocking is now done on per-renderer basis with based on isNonFinal flag in
        RenderStyle.

        For stylesheets in head the behavior should be largely unchanged.

        Test: http/tests/incremental/stylesheet-body-incremental-rendering.html

        * css/StyleResolver.cpp:
        (WebCore::StyleResolver::pseudoStyleRulesForElement):
        * dom/Document.cpp:
        (WebCore::Document::Document):
        (WebCore::Document::resolveStyle):
        (WebCore::Document::updateLayoutIgnorePendingStylesheets):

            Remove the old FOUC preventation state tracking.

        (WebCore::Document::shouldScheduleLayout):
        (WebCore::Document::didRemoveAllPendingStylesheet):

            Repaints will now get triggered by the normal style mechanism.

        * dom/Document.h:
        (WebCore::Document::hasNodesWithNonFinalStyle):
        (WebCore::Document::setHasNodesWithNonFinalStyle):

            Track if we need to recompute the style later because non-final or unstyled elements.

        (WebCore::Document::didLayoutWithPendingStylesheets): Deleted.
        (WebCore::Document::hasNodesWithPlaceholderStyle): Deleted.
        (WebCore::Document::setHasNodesWithPlaceholderStyle): Deleted.
        * html/HTMLFrameSetElement.cpp:
        (WebCore::HTMLFrameSetElement::rendererIsNeeded):
        * page/FrameView.cpp:
        (WebCore::FrameView::qualifiesAsVisuallyNonEmpty):

            Don't qualify as visually non-empty if we have loading stylesheets in head (even if there is
            a fouc-prevented render tree).

        (WebCore::FrameView::fireLayoutRelatedMilestonesIfNeeded):
        * rendering/RenderBlock.cpp:
        (WebCore::RenderBlock::paintContents):

            Instead of a global test, block painting if isNonFinal is set in the renderer's style.

        * rendering/RenderLayer.cpp:
        (WebCore::shouldSuppressPaintingLayer):
        * rendering/style/RenderStyle.cpp:
        (WebCore::RenderStyle::changeRequiresRepaint):

            The isNonFinal flag prevents painting so we need to trigger repaint when it gets cleared.

        * rendering/style/RenderStyle.h:
        (WebCore::RenderStyle::isNotFinal):
        (WebCore::RenderStyle::setIsNotFinal):
        (WebCore::RenderStyle::isPlaceholderStyle): Deleted.
        (WebCore::RenderStyle::setIsPlaceholderStyle): Deleted.

            There is no need for placeholder styles anymore. Reuse the bit for isNotFinal.

        * rendering/style/StyleRareNonInheritedData.cpp:
        (WebCore::StyleRareNonInheritedData::StyleRareNonInheritedData):
        (WebCore::StyleRareNonInheritedData::operator==):
        * rendering/style/StyleRareNonInheritedData.h:
        * style/StyleScope.cpp:
        (WebCore::Style::Scope::analyzeStyleSheetChange):
        (WebCore::Style::Scope::updateActiveStyleSheets):
        * style/StyleTreeResolver.cpp:
        (WebCore::Style::TreeResolver::styleForElement):
        (WebCore::Style::TreeResolver::resolveElement):

            If we have seens a loading stylesheet and don't have a renderer yet don't style the element.
            In case there is a renderer or we are ignoring pending sheets, resolve the style normally
            but mark it as non-final.

        (WebCore::Style::makePlaceholderStyle): Deleted.

2017-03-10  Antti Koivisto  <antti@apple.com>

        imported/w3c/web-platform-tests/html/semantics/embedded-content/the-img-element/sizes/parse-a-sizes-attribute.html is unreliable
        https://bugs.webkit.org/show_bug.cgi?id=169465

        Reviewed by Zalan Bujtas.

        It shows all subtests passing but that is a bug. We don't even support all the unit types.
        The test occasionally fails when reloading, that failing results are actually the correct ones.

        * css/parser/SizesAttributeParser.cpp:
        (WebCore::SizesAttributeParser::SizesAttributeParser):

            Ensure we have correct size for the iframe before parsing 'sizes' attribute values. The interpretation of
            these may depend on the iframe dimensions.

2017-03-10  Antoine Quint  <graouts@apple.com>

        [mac-wk1] LayoutTest media/modern-media-controls/airplay-button/airplay-button.html is a flaky timeout
        https://bugs.webkit.org/show_bug.cgi?id=168409

        Unreviewed.

        Add some debugging in the hope of understanding why airplay-button.html fails once a day on bots.

        * Modules/modern-media-controls/controls/scheduler.js:
        (const.scheduler.new.prototype.scheduleLayout):
        (const.scheduler.new.prototype.unscheduleLayout):
        (const.scheduler.new.prototype._requestFrameIfNeeded):
        (const.scheduler.new.prototype._frameDidFire):
        (const.scheduler.new.prototype._layout):

2017-03-09  Ryan Haddad  <ryanhaddad@apple.com>

        Unreviewed, rolling out r213633.

        This change caused LayoutTest imported/w3c/web-platform-
        tests/html/semantics/embedded-content/the-img-
        element/sizes/parse-a-sizes-attribute.html to become a flaky
        failure.

        Reverted changeset:

        "Loading in-body stylesheets should not block rendering of
        elements before them"
        https://bugs.webkit.org/show_bug.cgi?id=169345
        http://trac.webkit.org/changeset/213633

2017-03-09  Alex Christensen  <achristensen@webkit.org>

        Fix CMake build

        * PlatformMac.cmake:

2017-03-09  Alex Christensen  <achristensen@webkit.org>

        Fix GTK build after r213696

        * PlatformMac.cmake:

2017-03-09  Brian Nicholson  <bnicholson@mozilla.com> and Alex Christensen  <achristensen@webkit.org>

        Expose public APIs for content filters
        https://bugs.webkit.org/show_bug.cgi?id=150479

        Reviewed by Brady Eidson and Geoff Garen.

        * English.lproj/Localizable.strings:

2017-03-09  Matt Baker  <mattbaker@apple.com>

        Web Inspector: Add XHR breakpoints UI
        https://bugs.webkit.org/show_bug.cgi?id=168763
        <rdar://problem/30952439>

        Reviewed by Joseph Pecoraro.

        Test: inspector/dom-debugger/xhr-breakpoints.html

        * inspector/InspectorDOMDebuggerAgent.cpp:
        (WebCore::InspectorDOMDebuggerAgent::discardBindings):
        (WebCore::InspectorDOMDebuggerAgent::willSendXMLHttpRequest):
        Don't break for XHRs when breakpoints are disabled.

2017-03-09  Michael Saboff  <msaboff@apple.com>

        Add plumbing to WebProcess to enable JavaScriptCore configuration and logging
        https://bugs.webkit.org/show_bug.cgi?id=169387

        Reviewed by Filip Pizlo.

        Added a forwarding header file for JavScriptCore/runtime/ConfigFile.h.

        * ForwardingHeaders/runtime/ConfigFile.h: Added.

2017-03-09  John Wilander  <wilander@apple.com>

        Resource Load Statistics: Remove statistics data as part of full website data removal
        https://bugs.webkit.org/show_bug.cgi?id=169448

        Reviewed by Alex Christensen.

        Test: http/tests/loading/resourceLoadStatistics/clear-in-memory-and-persistent-store.html

        * loader/ResourceLoadObserver.cpp:
        (WebCore::ResourceLoadObserver::clearInMemoryAndPersistentStore):
            The version of this function that takes a modifiedSince parameter
            checks if it is equal to or less than the start of the Unix epoch.
            If so, it clears the store. This is to support clear all website
            data.
        * loader/ResourceLoadObserver.h:
        * loader/ResourceLoadStatisticsStore.cpp:
        (WebCore::ResourceLoadStatisticsStore::clearInMemoryAndPersistent):
        (WebCore::ResourceLoadStatisticsStore::setWritePersistentStoreCallback):
        * loader/ResourceLoadStatisticsStore.h:
            Added m_writePersistentStoreHandler, a setter for it, and
            ResourceLoadStatisticsStore::clearInMemoryAndPersistent().

2017-03-09  Matt Rajca  <mrajca@apple.com>

        Only consider autoplay interference in the first 10 seconds of playback.
        https://bugs.webkit.org/show_bug.cgi?id=169455

        Reviewed by Alex Christensen.

        If the media duration is relatively long, say, 10 minutes, and you pause 5 minutes in, that's
        probably not a strong indication users may not want auto-play. This patch limits interference
        events to the first 10 seconds of automatic playback.

        * html/HTMLMediaElement.cpp:
        (WebCore::HTMLMediaElement::setReadyState):
        (WebCore::HTMLMediaElement::play):
        (WebCore::HTMLMediaElement::playInternal):
        (WebCore::HTMLMediaElement::pauseInternal):
        (WebCore::HTMLMediaElement::setMuted):
        (WebCore::HTMLMediaElement::mediaPlayerTimeChanged):
        (WebCore::HTMLMediaElement::stopWithoutDestroyingMediaPlayer):
        (WebCore::HTMLMediaElement::userDidInterfereWithAutoplay):
        (WebCore::HTMLMediaElement::setPlaybackWithoutUserGesture):
        (WebCore::HTMLMediaElement::pageMutedStateDidChange):
        * html/HTMLMediaElement.h:

2017-03-09  Brady Eidson  <beidson@apple.com>

        Add WKURLSchemeHandler API for handling custom protocols.
        https://bugs.webkit.org/show_bug.cgi?id=169422

        Reviewed by Tim Horton.

        * platform/URLParser.cpp:
        (WebCore::URLParser::maybeCanonicalizeScheme):
        (WebCore::URLParser::isSpecialScheme):
        * platform/URLParser.h:

2017-03-09  Dean Jackson  <dino@apple.com>

        WebGPU: Backend - Buffers
        https://bugs.webkit.org/show_bug.cgi?id=169451
        <rdar://problem/30959168>

        Reviewed by Tim Horton.

        Implement the backend for GPUBuffer, which
        represents a chunk of memory that can be used
        by the GPU. You create one using an ArrayBufferView.

        WebKit API Test: GPUBuffer.mm

        * PlatformMac.cmake:
        * WebCore.xcodeproj/project.pbxproj:
        * platform/graphics/cocoa/GPUBufferMetal.mm:
        (WebCore::GPUBuffer::GPUBuffer):
        (WebCore::GPUBuffer::length):
        (WebCore::GPUBuffer::contents):
        (WebCore::GPUBuffer::platformBuffer):
        * platform/graphics/gpu/GPUBuffer.cpp:
        (WebCore::GPUBuffer::create):
        (WebCore::GPUBuffer::~GPUBuffer):
        (WebCore::GPUBuffer::length):
        (WebCore::GPUBuffer::contents):
        * platform/graphics/gpu/GPUBuffer.h:
        * platform/graphics/gpu/GPUDevice.cpp:
        (WebCore::GPUDevice::createBufferFromData):
        * platform/graphics/gpu/GPUDevice.h:

2017-03-09  Joseph Pecoraro  <pecoraro@apple.com>

        Web Inspector: Show HTTP protocol version and other Network Load Metrics (IP Address, Priority, Connection ID)
        https://bugs.webkit.org/show_bug.cgi?id=29687
        <rdar://problem/19281586>

        Reviewed by Matt Baker and Brian Burg.

        Test: http/tests/inspector/network/resource-metrics.html

        * inspector/InspectorNetworkAgent.cpp:
        (WebCore::toProtocol):
        (WebCore::InspectorNetworkAgent::buildObjectForMetrics):
        (WebCore::InspectorNetworkAgent::didFinishLoading):
        Send metrics at didFinishLoading time, we do not have all of
        these at didReceiveResponse time.

        * inspector/InspectorInstrumentation.cpp:
        (WebCore::InspectorInstrumentation::didFinishLoadingImpl):
        * inspector/InspectorInstrumentation.h:
        (WebCore::InspectorInstrumentation::didFinishLoading):
        * inspector/InspectorNetworkAgent.h:
        * loader/CrossOriginPreflightChecker.cpp:
        (WebCore::CrossOriginPreflightChecker::validatePreflightResponse):
        * loader/DocumentLoader.cpp:
        (WebCore::DocumentLoader::finishedLoading):
        * loader/ResourceLoadNotifier.cpp:
        (WebCore::ResourceLoadNotifier::didFinishLoad):
        (WebCore::ResourceLoadNotifier::dispatchDidFinishLoading):
        (WebCore::ResourceLoadNotifier::sendRemainingDelegateMessages):
        * loader/ResourceLoadNotifier.h:
        * loader/SubresourceLoader.cpp:
        (WebCore::SubresourceLoader::didFinishLoading):
        * loader/appcache/ApplicationCacheGroup.cpp:
        (WebCore::ApplicationCacheGroup::didFinishLoading):
        Include or pass on NetworkLoadMetrics to Web Inspector.

        * platform/network/NetworkLoadMetrics.h:
        (WebCore::NetworkLoadMetrics::isolatedCopy):
        (WebCore::NetworkLoadMetrics::reset):
        (WebCore::NetworkLoadMetrics::operator==):
        (WebCore::NetworkLoadMetrics::encode):
        (WebCore::NetworkLoadMetrics::decode):
        Add new optional metrics properties.

        (WTF::Persistence::Coder<std::optional<WebCore::NetworkLoadPriority>>::encode):
        (WTF::Persistence::Coder<std::optional<WebCore::NetworkLoadPriority>>::decode):
        We never encode this but this is needed for the compiler.

        * platform/spi/cocoa/NSURLConnectionSPI.h:
        New SPI for NSURLSessionTaskTransactionMetrics details.

2017-03-09  Anders Carlsson  <andersca@apple.com>

        Use the right conditional.

        * Modules/applepay/ApplePayError.idl:

2017-03-09  Daniel Bates  <dabates@apple.com>

        Guard Credential Management implementation behind a runtime enabled feature flag
        https://bugs.webkit.org/show_bug.cgi?id=169364
        <rdar://problem/30957425>

        Reviewed by Brent Fulgham.

        Add a runtime enabled feature flag for Credential Management (disabled by default).
        Once we are happy with this feature we can enable the feature by default or remove the
        the runtime enabled feature flag so as to enable it by default.

        * Modules/credentials/BasicCredential.idl: Enable only if the runtime enabled feature flag is
         enabled.
        * Modules/credentials/PasswordCredential.idl: Ditto.
        * Modules/credentials/SiteBoundCredential.idl: Ditto.
        * page/RuntimeEnabledFeatures.h:
        (WebCore::RuntimeEnabledFeatures::setCredentialManagementEnabled): Added.
        (WebCore::RuntimeEnabledFeatures::credentialManagementEnabled): Added.

2017-03-09  Anders Carlsson  <andersca@apple.com>

        Add delegate support to WebCore
        https://bugs.webkit.org/show_bug.cgi?id=169427
        Part of rdar://problem/28880714.

        Reviewed by Geoffrey Garen.

        * Configurations/FeatureDefines.xcconfig:
        Add feature define.

        * DerivedSources.make:
        Add idl files.

        * Modules/applepay/ApplePayError.cpp:
        (WebCore::ApplePayError::create):
        (WebCore::ApplePayError::ApplePayError):
        (WebCore::ApplePayError::~ApplePayError):
        * Modules/applepay/ApplePayError.h:
        * Modules/applepay/ApplePayError.idl:
        * Modules/applepay/ApplePayPaymentAuthorizationResult.h:
        * Modules/applepay/ApplePayPaymentAuthorizationResult.idl:
        * Modules/applepay/ApplePayPaymentMethodUpdate.h:
        * Modules/applepay/ApplePayPaymentMethodUpdate.idl:
        * Modules/applepay/ApplePayShippingContactUpdate.h:
        * Modules/applepay/ApplePayShippingContactUpdate.idl:
        * Modules/applepay/ApplePayShippingMethodUpdate.h:
        * Modules/applepay/ApplePayShippingMethodUpdate.idl:
        Add new files.

        * Modules/applepay/ApplePaySession.cpp:
        (WebCore::toPaymentAuthorizationStatus):
        Move this function to the top.

        (WebCore::convertAndValidate):
        Add new convertAndValidate functions.

        (WebCore::ApplePaySession::completeShippingMethodSelection):
        (WebCore::ApplePaySession::completeShippingContactSelection):
        (WebCore::ApplePaySession::completePaymentMethodSelection):
        (WebCore::ApplePaySession::completePayment):
        * Modules/applepay/ApplePaySession.h:
        * Modules/applepay/ApplePaySession.idl:
        Implement the old functions in terms of the new functions.

        * Modules/applepay/PaymentCoordinator.cpp:
        * WebCore.xcodeproj/project.pbxproj:
        Add new files.

2017-03-09  Yoav Weiss  <yoav@yoav.ws>

        [link preload] Double downloads of preloaded CSS
        https://bugs.webkit.org/show_bug.cgi?id=169274

        Reviewed by Antti Koivisto.

        Avoid reloading link preloads in case of a charset mismatch.

        Charset mismatch can happen for header based preloads, as they are requested before
        the HTML's `<meta charset>` tag is processed. This change makes sure that in those
        cases, we modify the resource's encoding setting instead of reloading it.

        Test: http/tests/preload/single_download_preload_headers.php

        * loader/cache/CachedResource.cpp:
        (WebCore::CachedResource::CachedResource): Initialize m_unknownCharset to be the same as the preload flag.
        * loader/cache/CachedResource.h:
        (WebCore::CachedResource::hasUnknownEncoding):
        (WebCore::CachedResource::setHasUnknownEncoding):
        * loader/cache/CachedResourceLoader.cpp:
        (WebCore::CachedResourceLoader::determineRevalidationPolicy): In case of a charset
        mismatch, set the encoding of the Resource instead of reloading it if the charset is unknown.

2017-03-09  Jiewen Tan  <jiewen_tan@apple.com>

        Implement PBKDF2 in WebCrypto
        https://bugs.webkit.org/show_bug.cgi?id=143458
        <rdar://problem/27311703>

        Reviewed by Brent Fulgham.

        This patch implements PBKDF2 according to the spec:
        https://www.w3.org/TR/WebCryptoAPI/#pbkdf2. Supported
        operations include deriveKey, deriveBits, importKey and
        getKeyLength.

        Tests: crypto/subtle/ecdh-import-key-derive-pbkdf2-key.html
               crypto/subtle/pbkdf2-derive-bits-malformed-parametrs.html
               crypto/subtle/pbkdf2-import-key-derive-bits.html
               crypto/subtle/pbkdf2-import-key-derive-hmac-key.html
               crypto/subtle/pbkdf2-import-key-malformed-parameters.html
               crypto/subtle/pbkdf2-import-key.html
               crypto/workers/subtle/pbkdf2-import-key-derive-bits.html
               crypto/workers/subtle/pbkdf2-import-key-derive-hmac-key.html
               crypto/workers/subtle/pbkdf2-import-key.html

        * CMakeLists.txt:
        * DerivedSources.make:
        * PlatformGTK.cmake:
        * PlatformMac.cmake:
        * WebCore.xcodeproj/project.pbxproj:
        * bindings/js/JSCryptoKeyCustom.cpp:
        (WebCore::JSCryptoKey::algorithm):
        Added RawKeyAlgorithm.
        * bindings/js/JSSubtleCryptoCustom.cpp:
        (WebCore::normalizeCryptoAlgorithmParameters):
        A bit of reordering.
        * bindings/js/SerializedScriptValue.cpp:
        (WebCore::CloneSerializer::write):
        Faked implementation.
        * crypto/CryptoAlgorithmParameters.h:
        * crypto/CryptoKey.h:
        * crypto/algorithms/CryptoAlgorithmPBKDF2.cpp: Added.
        (WebCore::CryptoAlgorithmPBKDF2::create):
        (WebCore::CryptoAlgorithmPBKDF2::identifier):
        (WebCore::CryptoAlgorithmPBKDF2::deriveBits):
        (WebCore::CryptoAlgorithmPBKDF2::importKey):
        (WebCore::CryptoAlgorithmPBKDF2::getKeyLength):
        * crypto/algorithms/CryptoAlgorithmPBKDF2.h: Added.
        * crypto/gnutls/CryptoAlgorithmPBKDF2GnuTLS.cpp: Added.
        (WebCore::CryptoAlgorithmPBKDF2::platformDeriveBits):
        * crypto/keys/CryptoKeyRaw.cpp: Added.
        (WebCore::CryptoKeyRaw::CryptoKeyRaw):
        (WebCore::CryptoKeyRaw::buildAlgorithm):
        (WebCore::CryptoKeyRaw::exportData):
        * crypto/keys/CryptoKeyRaw.h: Added.
        (WebCore::RawKeyAlgorithm::RawKeyAlgorithm):
        The CryptoKey class for PBKDF2 and later on HKDF.
        * crypto/mac/CryptoAlgorithmPBKDF2Mac.cpp: Added.
        (WebCore::commonCryptoHMACAlgorithm):
        (WebCore::CryptoAlgorithmPBKDF2::platformDeriveBits):
        * crypto/mac/CryptoAlgorithmRegistryMac.cpp:
        (WebCore::CryptoAlgorithmRegistry::platformRegisterAlgorithms):
        * crypto/parameters/CryptoAlgorithmPbkdf2Params.h: Added.
        * crypto/parameters/Pbkdf2Params.idl: Added.

2017-03-09  Antoine Quint  <graouts@apple.com>

        [Modern Media Controls] iOS: long press on play button shows the Copy menu
        https://bugs.webkit.org/show_bug.cgi?id=169355
        <rdar://problem/30928998>

        Reviewed by Dean Jackson.

        Disable built-in UI behavior that shows a magnifier or a copy callout when pressing
        on an element for a long time. These do not make sense for media controls.

        Test: media/modern-media-controls/audio/audio-controls-styles.html

        * Modules/modern-media-controls/controls/media-controls.css:
        (:host):

2017-03-09  Alex Christensen  <achristensen@webkit.org>

        [Content Extensions] Introduce if-top-url and unless-top-url
        https://bugs.webkit.org/show_bug.cgi?id=169433

        Reviewed by Brady Eidson.

        In r184116 I added if-domain and unless-domain to control whether a rule applies
        based on the domain of the main document URL.  I'm expanding this by adding if-top-url
        and unless-top-url that run regular expressions on the entire main document URL so that
        example.com/user1content can be distinguished from example.com/user2content.
        To not add to the number of passes we make on the URLs for each load and to maintain JSON
        backwards compatibility, I've made it so that if-top-url and unless-top-url can be used
        instead of if-domain and unless-domain (which continue to work) but the two condition types
        cannot be used together since running regular expressions on the entire main document URL
        is strictly more powerful than checking the domain and subdomains.
        As a minor detail, content extension regexes are by default ASCII-case-insensitive, so I've
        done the same with top URL regexes, adding top-url-filter-is-case-sensitive to mirror the existing
        url-filter-is-case-sensitive if the JSON author decides to make regexes case sensitive.

        Covered by new API tests.

        * contentextensions/CompiledContentExtension.h:
        * contentextensions/ContentExtension.cpp:
        (WebCore::ContentExtensions::ContentExtension::populateConditionCacheIfNeeded):
        (WebCore::ContentExtensions::ContentExtension::topURLActions):
        (WebCore::ContentExtensions::ContentExtension::cachedConditionedActions): Deleted.
        * contentextensions/ContentExtension.h:
        * contentextensions/ContentExtensionCompiler.cpp:
        (WebCore::ContentExtensions::addUniversalActionsToDFA):
        (WebCore::ContentExtensions::compileToBytecode):
        We had three copies of compiling to bytecode that were almost the same and would've been made into three copies of the same code.
        I moved them to one helper function that is called three times.
        (WebCore::ContentExtensions::compileRuleList):
        * contentextensions/ContentExtensionCompiler.h:
        * contentextensions/ContentExtensionError.cpp:
        (WebCore::ContentExtensions::contentExtensionErrorCategory):
        Add the new error type for JSON that tries to use if-top-url and unless-top-url with if-domain and unless-domain.
        * contentextensions/ContentExtensionError.h:
        * contentextensions/ContentExtensionParser.cpp:
        (WebCore::ContentExtensions::loadTrigger):
        Parse the new values if-top-url, unless-top-url, and top-url-filter-is-case-sensitive.
        * contentextensions/ContentExtensionRule.h:
        (WebCore::ContentExtensions::Trigger::~Trigger):
        * contentextensions/ContentExtensionsBackend.cpp:
        (WebCore::ContentExtensions::ContentExtensionsBackend::actionsForResourceLoad):
        * contentextensions/DFABytecodeInterpreter.cpp:
        (WebCore::ContentExtensions::DFABytecodeInterpreter::interpretAppendAction):
        (WebCore::ContentExtensions::DFABytecodeInterpreter::interpretTestFlagsAndAppendAction):
        (WebCore::ContentExtensions::DFABytecodeInterpreter::interpretWithConditions):
        * contentextensions/DFABytecodeInterpreter.h:

2017-03-09  Nikita Vasilyev  <nvasilyev@apple.com>

        Web Inspector: Show individual messages in the content pane for a WebSocket
        https://bugs.webkit.org/show_bug.cgi?id=169011

        Reviewed by Joseph Pecoraro.

        Add walltime parameter.

        No new tests. Tests will be added in a follow up patch.

        * inspector/InspectorNetworkAgent.cpp:
        (WebCore::InspectorNetworkAgent::willSendWebSocketHandshakeRequest):

2017-03-09  Brent Fulgham  <bfulgham@apple.com>

        Unreviewed build fix after r213628.

        Use 'size_t' for the function definition to match the header file. If you do not,
        the 32-bit build fails..

        * crypto/gnutls/CryptoAlgorithmECDHGnuTLS.cpp:
        (WebCore::CryptoAlgorithmECDH::platformDeriveBits):

2017-03-09  Wenson Hsieh  <wenson_hsieh@apple.com>

        [WK2] Add a UI delegate hook for custom handling of data interaction operations
        https://bugs.webkit.org/show_bug.cgi?id=169430
        <rdar://problem/30954654>

        Reviewed by Tim Horton.

        Ensure that m_documentUnderMouse is properly cleaned up even in the case where no drag operation was performed
        due to the drop bailing at the client layer.

        * page/DragController.cpp:
        (WebCore::DragController::dragEnded):

2017-03-08  Matt Rajca  <mrajca@apple.com>

        Let clients control autoplay quirks with website policies.
        https://bugs.webkit.org/show_bug.cgi?id=169390

        Reviewed by Wenson Hsieh.

        Added API tests.

        Many sites incorrectly assume media will start off playing and display a pause button from the
        start. We can trick many of these sites into updating their controls by sending a "pause"
        event when we prevent a media element from playing.

        We don't want this to become standard web behavior, however, since ultimately sites should adapt
        to the new behavior. This patch lets clients decide which limited set of sites gets to use auto-play
        quirks.

        * html/HTMLMediaElement.cpp:
        (WebCore::needsAutoplayPlayPauseEventsQuirk):
        * loader/DocumentLoader.h:
        (WebCore::DocumentLoader::allowsAutoplayQuirks):
        (WebCore::DocumentLoader::setAllowsAutoplayQuirks):

2017-03-09  Mark Lam  <mark.lam@apple.com>

        Make the VM Traps mechanism non-polling for the DFG and FTL.
        https://bugs.webkit.org/show_bug.cgi?id=168920
        <rdar://problem/30738588>

        Reviewed by Filip Pizlo.

        No new tests needed.  This is covered by existing tests.

        * bindings/js/WorkerScriptController.cpp:
        (WebCore::WorkerScriptController::WorkerScriptController):
        (WebCore::WorkerScriptController::scheduleExecutionTermination):

2017-03-08  Dean Jackson  <dino@apple.com>

        WebGPU: Backend - Library and Functions
        https://bugs.webkit.org/show_bug.cgi?id=169371
        <rdar://problem/30928792>

        Reviewed by Tim Horton.

        Implement the backends for GPULibrary and GPUFunction.
        A GPULibrary is created from a GPUDevice, given some
        shader source code. You can then extract the GPUFunctions
        from the library.

        WebKitAPITests: GPULibrary and GPUFunction.

        * WebCore.xcodeproj/project.pbxproj:
        * platform/graphics/cocoa/GPUFunctionMetal.mm:
        (WebCore::GPUFunction::GPUFunction):
        (WebCore::GPUFunction::name):
        (WebCore::GPUFunction::platformFunction):
        * platform/graphics/cocoa/GPULibraryMetal.mm:
        (WebCore::GPULibrary::GPULibrary):
        (WebCore::GPULibrary::label):
        (WebCore::GPULibrary::setLabel):
        (WebCore::GPULibrary::functionNames):
        (WebCore::GPULibrary::platformLibrary):
        * platform/graphics/gpu/GPUDevice.cpp:
        (WebCore::GPUDevice::createLibrary):
        * platform/graphics/gpu/GPUDevice.h:
        * platform/graphics/gpu/GPUFunction.cpp:
        (WebCore::GPUFunction::create):
        (WebCore::GPUFunction::~GPUFunction):
        (WebCore::GPUFunction::GPUFunction):
        (WebCore::GPUFunction::name):
        * platform/graphics/gpu/GPUFunction.h:
        * platform/graphics/gpu/GPULibrary.cpp:
        (WebCore::GPULibrary::create):
        (WebCore::GPULibrary::~GPULibrary):
        (WebCore::GPULibrary::label):
        (WebCore::GPULibrary::setLabel):
        (WebCore::GPULibrary::functionNames):
        (WebCore::GPULibrary::functionWithName):
        * platform/graphics/gpu/GPULibrary.h:

2017-03-09  Chris Dumez  <cdumez@apple.com>

        Align Document.elementFromPoint() with the CSSOM specification
        https://bugs.webkit.org/show_bug.cgi?id=169403

        Reviewed by Sam Weinig.

        Align Document.elementFromPoint() with the CSSOM specification:
        - https://drafts.csswg.org/cssom-view/#extensions-to-the-document-interface

        In particular, the parameters should be mandatory and of type double.

        The parameters are mandatory in both Firefox and Chrome already. Parameters
        are finite floating point in Firefox and integers in Chrome.

        Test: fast/dom/elementFromPoint-parameters.html

        * dom/DocumentOrShadowRoot.idl:
        * dom/TreeScope.cpp:
        (WebCore::TreeScope::elementFromPoint):
        * dom/TreeScope.h:

2017-03-09  Antoine Quint  <graouts@apple.com>

        [Modern Media Controls] Fullscreen controls are difficult to drag around
        https://bugs.webkit.org/show_bug.cgi?id=169412
        <rdar://problem/30931892>

        Reviewed by Eric Carlson.

        Up until now, we would simply check that the event target when attempting to
        initiate a drag would be the controls bar and not any of its children. This
        was not so great as this would encompass also a large margin around the left,
        center and right button containers as well as the time labels. We now check
        that the event target is anything but an interactive element (<button> or <input>).

        The existing test at media/modern-media-controls/macos-fullscreen-media-controls/macos-fullscreen-media-controls-drag.html
        has been updated to initiate dragging right between the rewind and play/pause button,
        which would fail prior to this patch since this would have hit-tested within the center
        button container and thus prevent dragging.

        * Modules/modern-media-controls/controls/macos-fullscreen-media-controls.css:
        (.media-controls.mac.fullscreen button.volume-down):
        (.media-controls.mac.fullscreen button.volume-up):
        (.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 button):
        * Modules/modern-media-controls/controls/macos-fullscreen-media-controls.js:
        (MacOSFullscreenMediaControls.prototype._handleMousedown):
        * Modules/modern-media-controls/controls/macos-inline-media-controls.css:
        (.media-controls.mac.inline > .controls-bar button):
        * Modules/modern-media-controls/controls/macos-media-controls.css:
        (.media-controls.mac > .controls-bar button):

2017-03-09  Antoine Quint  <graouts@apple.com>

        [Modern Media Controls] Controls are not visible in fullscreen without the controls attribute
        https://bugs.webkit.org/show_bug.cgi?id=169411
        <rdar://problem/30931724>

        Reviewed by Eric Carlson.

        Ensure we show controls in fullscreen in the absence of the controls attribute.

        Tests: media/modern-media-controls/controls-visibility-support/controls-visibility-support-fullscreen-on-parent-element.html
               media/modern-media-controls/controls-visibility-support/controls-visibility-support-fullscreen-on-video.html

        * Modules/modern-media-controls/media/controls-visibility-support.js:
        (ControlsVisibilitySupport.prototype.get mediaEvents):
        (ControlsVisibilitySupport.prototype._updateControls):
        (ControlsVisibilitySupport):

2017-03-09  Zalan Bujtas  <zalan@apple.com>

        Simple line layout: Add top level pagination support.
        https://bugs.webkit.org/show_bug.cgi?id=169410
        <rdar://problem/28536227>

        Reviewed by Antti Koivisto.

        This patch enables top level pagination for simple line layout.

        Covered by existing tests.

        * rendering/RenderMultiColumnFlowThread.h:
        * rendering/RenderView.cpp:
        (WebCore::RenderView::pushLayoutStateForPagination): Pagination flag needs to be set before calling pushLayoutStateForCurrentFlowThread.
        * rendering/SimpleLineLayout.cpp:
        (WebCore::SimpleLineLayout::canUseForWithReason):
        * rendering/SimpleLineLayoutCoverage.cpp:
        (WebCore::SimpleLineLayout::printReason):
        * rendering/SimpleLineLayoutCoverage.h:
        * rendering/SimpleLineLayoutFunctions.cpp:
        (WebCore::SimpleLineLayout::paintFlow):
        * rendering/SimpleLineLayoutPagination.cpp:
        (WebCore::SimpleLineLayout::computeLineTopAndBottomWithOverflow): Matching normal line layout values.
        (WebCore::SimpleLineLayout::setPageBreakForLine): Logic here matches RenderBlockFlow::adjustLinePositionForPagination

2017-03-09  Tomas Popela  <tpopela@redhat.com>

        [GStreamer][MSE] Fix 'comparison between signed and unsigned integer
        expressions' warning

        Reviewed by Žan Doberšek.

        * platform/graphics/gstreamer/mse/PlaybackPipeline.cpp:
        (WebCore::PlaybackPipeline::flush):

2017-03-08  Per Arne Vollan  <pvollan@apple.com>

        Implement stroke-width CSS property.
        https://bugs.webkit.org/show_bug.cgi?id=169273

        Reviewed by Simon Fraser.

        Support setting text stroke width using the CSS property stroke-width, see https://drafts.fxtf.org/paint/.
        Text stroke width can currently be set with the -webkit-text-stroke-width property. To make sure this still
        works, I added a check to determine if the stroke-width property has been explicitly set. If it has not been
        set, we fall back to the value of the -webkit-text-stroke-width property.

        Tests: fast/css/stroke-width-percent.html
               fast/css/stroke-width.html

        * css/CSSProperties.json:
        * css/StyleBuilderCustom.h:
        (WebCore::StyleBuilderCustom::applyValueStrokeWidth):
        (WebCore::StyleBuilderCustom::applyValueWebkitTextStrokeWidth):
        * rendering/InlineFlowBox.cpp:
        (WebCore::InlineFlowBox::addToLine):
        (WebCore::InlineFlowBox::addTextBoxVisualOverflow):
        * rendering/SimpleLineLayoutFunctions.cpp:
        (WebCore::SimpleLineLayout::computeOverflow):
        * rendering/TextDecorationPainter.cpp:
        (WebCore::decorationColor):
        * rendering/TextPaintStyle.cpp:
        (WebCore::computeTextPaintStyle):
        (WebCore::computeTextSelectionPaintStyle):
        * rendering/style/RenderStyle.cpp:
        (WebCore::RenderStyle::RenderStyle):
        (WebCore::RenderStyle::computedTextStrokeWidth):
        * rendering/style/RenderStyle.h:
        (WebCore::RenderStyle::setHasExplicitlySetStrokeWidth):
        (WebCore::RenderStyle::hasExplicitlySetStrokeWidth):
        (WebCore::RenderStyle::setHasExplicitlySetWebKitTextStrokeWidth):
        (WebCore::RenderStyle::hasExplicitlySetWebKitTextStrokeWidth):
        (WebCore::RenderStyle::InheritedFlags::operator==):

2017-03-09  Antti Koivisto  <antti@apple.com>

        Allow the page to render before <link> stylesheet tags in body
        https://bugs.webkit.org/show_bug.cgi?id=149157
        <rdar://problem/24658830>

        Reviewed by Simon Fraser.

        Currently we block style and renderer building completely if document has any loading
        stylesheets. In case a script queries something layout dependent we construct the render
        tree with whatever style we have but block painting in it.

        This patch changes behavior so that a loading stylesheet in body only blocks rendering for elements
        that are after it. The expectation is that such stylesheets rarely affect elements before them
        and the elements can be rendered without causing ugly visible styling changes.

        The patch replaces the old flash-of-unstyled-content (FOUC) preventation mechanism with a more
        fine-grained one. Paint blocking is now done on per-renderer basis with based on isNonFinal flag in
        RenderStyle.

        For stylesheets in head the behavior should be largely unchanged.

        Test: http/tests/incremental/stylesheet-body-incremental-rendering.html

        * css/StyleResolver.cpp:
        (WebCore::StyleResolver::pseudoStyleRulesForElement):
        * dom/Document.cpp:
        (WebCore::Document::Document):
        (WebCore::Document::resolveStyle):
        (WebCore::Document::updateLayoutIgnorePendingStylesheets):

            Remove the old FOUC preventation state tracking.

        (WebCore::Document::shouldScheduleLayout):
        (WebCore::Document::didRemoveAllPendingStylesheet):

            Repaints will now get triggered by the normal style mechanism.

        * dom/Document.h:
        (WebCore::Document::hasNodesWithNonFinalStyle):
        (WebCore::Document::setHasNodesWithNonFinalStyle):

            Track if we need to recompute the style later because non-final or unstyled elements.

        (WebCore::Document::didLayoutWithPendingStylesheets): Deleted.
        (WebCore::Document::hasNodesWithPlaceholderStyle): Deleted.
        (WebCore::Document::setHasNodesWithPlaceholderStyle): Deleted.
        * html/HTMLFrameSetElement.cpp:
        (WebCore::HTMLFrameSetElement::rendererIsNeeded):
        * page/FrameView.cpp:
        (WebCore::FrameView::qualifiesAsVisuallyNonEmpty):

            Don't qualify as visually non-empty if we have loading stylesheets in head (even if there is
            a fouc-prevented render tree).

        (WebCore::FrameView::fireLayoutRelatedMilestonesIfNeeded):
        * rendering/RenderBlock.cpp:
        (WebCore::RenderBlock::paintContents):

            Instead of a global test, block painting if isNonFinal is set in the renderer's style.

        * rendering/RenderLayer.cpp:
        (WebCore::shouldSuppressPaintingLayer):
        * rendering/style/RenderStyle.cpp:
        (WebCore::RenderStyle::changeRequiresRepaint):

            The isNonFinal flag prevents painting so we need to trigger repaint when it gets cleared.

        * rendering/style/RenderStyle.h:
        (WebCore::RenderStyle::isNotFinal):
        (WebCore::RenderStyle::setIsNotFinal):
        (WebCore::RenderStyle::isPlaceholderStyle): Deleted.
        (WebCore::RenderStyle::setIsPlaceholderStyle): Deleted.

            There is no need for placeholder styles anymore. Reuse the bit for isNotFinal.

        * rendering/style/StyleRareNonInheritedData.cpp:
        (WebCore::StyleRareNonInheritedData::StyleRareNonInheritedData):
        (WebCore::StyleRareNonInheritedData::operator==):
        * rendering/style/StyleRareNonInheritedData.h:
        * style/StyleScope.cpp:
        (WebCore::Style::Scope::analyzeStyleSheetChange):
        (WebCore::Style::Scope::updateActiveStyleSheets):
        * style/StyleTreeResolver.cpp:
        (WebCore::Style::TreeResolver::styleForElement):
        (WebCore::Style::TreeResolver::resolveElement):

            If we have seens a loading stylesheet and don't have a renderer yet don't style the element.
            In case there is a renderer or we are ignoring pending sheets, resolve the style normally
            but mark it as non-final.

        (WebCore::Style::makePlaceholderStyle): Deleted.

2017-03-08  Antoine Quint  <graouts@apple.com>

        [Modern Media Controls] iOS: Live Broadcast video shows scrubber with 00:00 duration until paused
        https://bugs.webkit.org/show_bug.cgi?id=169374
        <rdar://problem/30063273>

        Reviewed by Dean Jackson.

        We need to make sure we update the controls layout when they come back from being hidden, so promote
        that functionality from MacOSInlineMediaControls to MediaControls so that iOS can pick that behavior
        up.

        Test: media/modern-media-controls/ios-inline-media-controls/ios-inline-media-controls-status-label-enabled-hidden-controls-bar.html

        * Modules/modern-media-controls/controls/macos-inline-media-controls.js:
        (MacOSInlineMediaControls.prototype.controlsBarVisibilityDidChange): Deleted.
        * Modules/modern-media-controls/controls/media-controls.js:
        (MediaControls.prototype.controlsBarVisibilityDidChange):

2017-03-08  Jiewen Tan  <jiewen_tan@apple.com>

        [WebCrypto] Implement SubtleCrypto::DeriveKey method
        https://bugs.webkit.org/show_bug.cgi?id=169386
        <rdar://problem/23789585>

        Reviewed by Brent Fulgham.

        This patch does following few things:
        1. It implements SubtleCrypto::DeriveKey method according to the spec:
        https://www.w3.org/TR/WebCryptoAPI/#SubtleCrypto-method-deriveKey.
        2. It implements getKeyLength operations for AES-CBC, AES-KW, AES-CFB,
        AES-GCM, and HMAC, which is needed by the SubtleCrypto::DeriveKey method.
        3. It enables ECDH DeriveKey operation.
        4. It replaces unigned long with size_t in all the crypto codes.

        Tests: crypto/subtle/derive-key-malformed-parameters.html
               crypto/subtle/ecdh-import-key-derive-aes-key.html
               crypto/subtle/ecdh-import-key-derive-hmac-key-custom-length.html
               crypto/subtle/unwrap-key-malformed-parameters.html
               crypto/subtle/wrap-key-malformed-parameters.html
               crypto/workers/subtle/ecdh-import-key-derive-key.html

        * CMakeLists.txt:
        * DerivedSources.make:
        * WebCore.xcodeproj/project.pbxproj:
        * bindings/js/JSSubtleCryptoCustom.cpp:
        (WebCore::normalizeCryptoAlgorithmParameters):
        (WebCore::jsSubtleCryptoFunctionEncryptPromise):
        (WebCore::jsSubtleCryptoFunctionDecryptPromise):
        (WebCore::jsSubtleCryptoFunctionSignPromise):
        (WebCore::jsSubtleCryptoFunctionVerifyPromise):
        (WebCore::jsSubtleCryptoFunctionDigestPromise):
        (WebCore::jsSubtleCryptoFunctionDeriveKeyPromise):
        (WebCore::jsSubtleCryptoFunctionDeriveBitsPromise):
        Remove unnecessary return statement from callbacks.
        * crypto/CryptoAlgorithm.cpp:
        (WebCore::CryptoAlgorithm::deriveBits):
        (WebCore::CryptoAlgorithm::getKeyLength):
        * crypto/CryptoAlgorithm.h:
        * crypto/CryptoAlgorithmParameters.h:
        * crypto/algorithms/CryptoAlgorithmAES_CBC.cpp:
        (WebCore::CryptoAlgorithmAES_CBC::generateKey):
        (WebCore::CryptoAlgorithmAES_CBC::getKeyLength):
        * crypto/algorithms/CryptoAlgorithmAES_CBC.h:
        * crypto/algorithms/CryptoAlgorithmAES_CFB.cpp:
        (WebCore::CryptoAlgorithmAES_CFB::generateKey):
        (WebCore::CryptoAlgorithmAES_CFB::getKeyLength):
        * crypto/algorithms/CryptoAlgorithmAES_CFB.h:
        * crypto/algorithms/CryptoAlgorithmAES_GCM.cpp:
        (WebCore::CryptoAlgorithmAES_GCM::generateKey):
        (WebCore::CryptoAlgorithmAES_GCM::getKeyLength):
        * crypto/algorithms/CryptoAlgorithmAES_GCM.h:
        * crypto/algorithms/CryptoAlgorithmAES_KW.cpp:
        (WebCore::CryptoAlgorithmAES_KW::generateKey):
        (WebCore::CryptoAlgorithmAES_KW::getKeyLength):
        * crypto/algorithms/CryptoAlgorithmAES_KW.h:
        * crypto/algorithms/CryptoAlgorithmECDH.cpp:
        (WebCore::CryptoAlgorithmECDH::deriveBits):
        * crypto/algorithms/CryptoAlgorithmECDH.h:
        * crypto/algorithms/CryptoAlgorithmHMAC.cpp:
        (WebCore::CryptoAlgorithmHMAC::getKeyLength):
        * crypto/algorithms/CryptoAlgorithmHMAC.h:
        * crypto/keys/CryptoKeyAES.cpp:
        (WebCore::CryptoKeyAES::getKeyLength):
        * crypto/keys/CryptoKeyAES.h:
        * crypto/keys/CryptoKeyHMAC.cpp:
        (WebCore::getKeyLengthFromHash):
        (WebCore::CryptoKeyHMAC::generate):
        (WebCore::CryptoKeyHMAC::getKeyLength):
        * crypto/keys/CryptoKeyHMAC.h:
        * crypto/mac/CryptoAlgorithmECDHMac.cpp:
        (WebCore::CryptoAlgorithmECDH::platformDeriveBits):
        * crypto/parameters/AesKeyParams.idl: Renamed from Source/WebCore/crypto/parameters/AesKeyGenParams.idl.
        * crypto/parameters/CryptoAlgorithmAesKeyParams.h: Renamed from Source/WebCore/crypto/parameters/CryptoAlgorithmAesKeyGenParams.h.
        Rename AesKeyGenParams to AesKeyParams to represent a unified dictionary for AesKeyGenParams and AesDerivedKeyParams.
        * crypto/parameters/CryptoAlgorithmHmacKeyParams.h:
        * crypto/parameters/CryptoAlgorithmRsaKeyGenParams.h:

2017-03-08  Wenson Hsieh  <wenson_hsieh@apple.com>

        Add plumbing for WebCore to notify WebKit2 when an edit drag has concluded
        https://bugs.webkit.org/show_bug.cgi?id=169392
        <rdar://problem/30882974>

        Reviewed by Tim Horton.

        Add DragClient::didConcludeEditDrag and invoke it after performing an edit drag in
        DragController::performDragOperation.

        * page/DragClient.h:
        (WebCore::DragClient::didConcludeEditDrag):
        * page/DragController.cpp:
        (WebCore::DragController::performDragOperation):

2017-03-08  Matt Baker  <mattbaker@apple.com>

        Web Inspector: Add DOM breakpoints UI for node/subtree modification events
        https://bugs.webkit.org/show_bug.cgi?id=168101

        Reviewed by Joseph Pecoraro.

        Test: inspector/dom-debugger/dom-breakpoints.html

        * inspector/InspectorDOMAgent.h:
        Removed declarations for undefined member functions.

        * inspector/InspectorDOMDebuggerAgent.cpp:
        (WebCore::InspectorDOMDebuggerAgent::disable):
        (WebCore::InspectorDOMDebuggerAgent::mainFrameDOMContentLoaded):
        (WebCore::InspectorDOMDebuggerAgent::willInsertDOMNode):
        (WebCore::InspectorDOMDebuggerAgent::willRemoveDOMNode):
        (WebCore::InspectorDOMDebuggerAgent::willModifyDOMAttr):
        Check that DebuggerAgent breakpoints are active before breaking.
        (WebCore::InspectorDOMDebuggerAgent::clear): Deleted.
        Replaced by call to discardBindings.
        * inspector/InspectorDOMDebuggerAgent.h:

        * inspector/InspectorInstrumentation.cpp:
        (WebCore::InspectorInstrumentation::domContentLoadedEventFiredImpl):
        DOMDebugger agent needs to discard bindings when the main frame navigates.

2017-03-08  Jiewen Tan  <jiewen_tan@apple.com>

        [WebCrypto] Implement ECDH DeriveBits operation
        https://bugs.webkit.org/show_bug.cgi?id=169319
        <rdar://problem/23789585>

        Reviewed by Brent Fulgham.

        This patch implements DeriveBits operation of ECDH according to the spec:
        https://www.w3.org/TR/WebCryptoAPI/#ecdh-operations.

        Tests: crypto/subtle/derive-bits-malformed-parameters.html
               crypto/subtle/ecdh-derive-bits-malformed-parametrs.html
               crypto/subtle/ecdh-generate-key-derive-bits.html
               crypto/subtle/ecdh-import-key-derive-bits-custom-length.html
               crypto/subtle/ecdh-import-key-derive-bits-null-length.html
               crypto/workers/subtle/ecdh-import-key-derive-bits.html

        * CMakeLists.txt:
        * DerivedSources.make:
        * PlatformGTK.cmake:
        * PlatformMac.cmake:
        * WebCore.xcodeproj/project.pbxproj:
        * bindings/js/JSSubtleCryptoCustom.cpp:
        (WebCore::normalizeCryptoAlgorithmParameters):
        (WebCore::jsSubtleCryptoFunctionDeriveKeyPromise):
        (WebCore::jsSubtleCryptoFunctionDeriveBitsPromise):
        (WebCore::JSSubtleCrypto::generateKey):
        Reorder a bit of the functions.
        * crypto/CommonCryptoUtilities.h:
        * crypto/CryptoAlgorithm.cpp:
        (WebCore::CryptoAlgorithm::deriveBits):
        * crypto/CryptoAlgorithm.h:
        * crypto/CryptoAlgorithmParameters.h:
        * crypto/algorithms/CryptoAlgorithmECDH.cpp:
        (WebCore::CryptoAlgorithmECDH::deriveBits):
        * crypto/algorithms/CryptoAlgorithmECDH.h:
        * crypto/gnutls/CryptoAlgorithmECDHGnuTLS.cpp: Added.
        (WebCore::CryptoAlgorithmECDH::platformDeriveBits):
        * crypto/keys/CryptoKeyEC.h:
        * crypto/mac/CryptoAlgorithmECDHMac.cpp: Added.
        (WebCore::CryptoAlgorithmECDH::platformDeriveBits):
        * crypto/parameters/CryptoAlgorithmEcdhKeyDeriveParams.h: Added.
        * crypto/parameters/EcdhKeyDeriveParams.idl: Added.

2017-03-08  John Wilander  <wilander@apple.com>

        Resource Load Statistics: Communicate to the network process which domains to partition
        https://bugs.webkit.org/show_bug.cgi?id=169322
        <rdar://problem/30768921>

        Reviewed by Alex Christensen.

        Test: http/tests/loading/resourceLoadStatistics/partitioned-cookies-with-and-without-user-interaction.html

        * loader/ResourceLoadObserver.cpp:
        (WebCore::ResourceLoadObserver::logUserInteractionWithReducedTimeResolution):
            Now calls ResourceLoadStatisticsStore::fireShouldPartitionCookiesHandler()
            to tell the network process the domain has got user interaction.
        (WebCore::ResourceLoadObserver::logUserInteraction):
            Now calls ResourceLoadStatisticsStore::fireShouldPartitionCookiesHandler()
            to tell the network process the domain has got user interaction.
        (WebCore::ResourceLoadObserver::fireShouldPartitionCookiesHandler):
            To allow TestRunner to set a domain for which
            partitioning should be applied.
        (WebCore::ResourceLoadObserver::primaryDomain):
            New overloaded convenience function.
        * loader/ResourceLoadObserver.h:
        * loader/ResourceLoadStatisticsStore.cpp:
        (WebCore::ResourceLoadStatisticsStore::readDataFromDecoder):
            Now bootstraps the network process' set of known domains to
            partition cookies for.
        (WebCore::ResourceLoadStatisticsStore::setShouldPartitionCookiesCallback):
        (WebCore::ResourceLoadStatisticsStore::fireShouldPartitionCookiesHandler):
        (WebCore::ResourceLoadStatisticsStore::hasHadRecentUserInteraction):
            Now tells the network process to start partitioning again
            when user interaction ages out.
        * loader/ResourceLoadStatisticsStore.h:
        * platform/network/NetworkStorageSession.h:
        * platform/network/cf/NetworkStorageSessionCFNet.cpp:
        (WebCore::NetworkStorageSession::shouldPartitionCookiesForHost):
        (WebCore::NetworkStorageSession::setShouldPartitionCookiesForHosts):

2017-03-08  Joseph Pecoraro  <pecoraro@apple.com>

        Web Inspector: Should be able to see where Resources came from (Memory Cache, Disk Cache)
        https://bugs.webkit.org/show_bug.cgi?id=164892
        <rdar://problem/29320562>

        Reviewed by Brian Burg.

        Test: http/tests/inspector/network/resource-response-source-disk-cache.html
              http/tests/inspector/network/resource-response-source-memory-cache.html
              http/tests/inspector/network/resource-response-source-network.html

        * platform/network/ResourceResponseBase.cpp:
        (WebCore::ResourceResponseBase::setSource): Deleted.
        * platform/network/ResourceResponseBase.h:
        (WebCore::ResourceResponseBase::setSource):
        Make Source mutable to allow it to be set in const methods.

        * loader/SubresourceLoader.cpp:
        (WebCore::SubresourceLoader::didReceiveResponse):
        Set the Response source after a successful memory cache validation
        as early as possible so that future copies have up to date info.

        * inspector/InspectorNetworkAgent.cpp:
        (WebCore::responseSource):
        (WebCore::InspectorNetworkAgent::buildObjectForResourceResponse):
        (WebCore::InspectorNetworkAgent::didLoadResourceFromMemoryCache):
        (WebCore::InspectorNetworkAgent::markResourceAsCached): Deleted.
        Eliminate this "markResourceAsCached" path.
        Update Response to include required source parameter instead of
        optional fromDiskCache parameter.

        * inspector/InspectorInstrumentation.cpp:
        (WebCore::InspectorInstrumentation::markResourceAsCachedImpl): Deleted.
        * inspector/InspectorInstrumentation.h:
        (WebCore::InspectorInstrumentation::markResourceAsCached): Deleted.
        * inspector/InspectorNetworkAgent.h:
        * loader/FrameLoader.cpp:
        (WebCore::FrameLoader::loadedResourceFromMemoryCache):
        Eliminate this "markResourceAsCached" call because the later delegate
        messages will include this information.

2017-03-08  Chris Dumez  <cdumez@apple.com>

        Drop support for non-standard document.all.tags()
        https://bugs.webkit.org/show_bug.cgi?id=169337

        Reviewed by Sam Weinig.

        Drop support for non-standard document.all.tags(). It is not part of the specification:
        - https://html.spec.whatwg.org/multipage/infrastructure.html#the-htmlallcollection-interface

        It is not supported by Firefox and its support was dropped from Chrome back in early 2014:
        - https://src.chromium.org/viewvc/blink?view=revision&revision=166870

        No new tests, updated existing test.

        * html/HTMLAllCollection.cpp:
        * html/HTMLAllCollection.h:
        * html/HTMLAllCollection.idl:

2017-03-08  Said Abou-Hallawa  <sabouhallawa@apple.com>

        Enable async image decoding for large images
        https://bugs.webkit.org/show_bug.cgi?id=165039

        Reviewed by Simon Fraser.

        Once FrameView finishes flushing compositing, it will request all its
        images, which intersect with the tileCoverageRect (aka the futureRect)
        of the  TileController, to start asynchronously decoding their image frames.
        This should improve the image first time paint and the scrolling scenarios.
        It also makes the scrolling more responsive by removing the decoding step
        from the main thread. 
        
        For now we are going to disable the asynchronous image decoding for the
        webkit test runner because drawing the image does not block the page rendering
        anymore. An image can be repainted later when its frame is ready for painting.
        This can cause a test to fail because the webkit test runner may capture
        an image for the page before painting all the images. The asynchronous image
        decoding can to be explicitly enabled from the test page. Once the specs
        of the image 'async' attribute and 'ready' event is approved, this should
        be revisited. It is important to test what we ship and eventually async
        image decoding should be enabled in the webkit test runner.

        * html/HTMLImageElement.cpp:
        (WebCore::HTMLImageElement::didAttachRenderers):
        (WebCore::HTMLImageElement::willDetachRenderers):
        Register/unregister the renderer of the HTMLImageElement for async image decoding
        from the RenderView. I followed what HTMLMediaElement to registerForVisibleInViewportCallback().
        * html/HTMLImageElement.h:
        
        * page/FrameView.cpp:
        (WebCore::FrameView::flushCompositingStateForThisFrame): For all the images inside
        the  tileCoverageRect of the TileController, request async image decoding.
        (WebCore::FrameView::applyRecursivelyWithAbsoluteRect): Request the async image decoding for the
        the images inside this FrameView and then recursively do the same thing for all sub FrameViews.
        (WebCore::FrameView::requestAsyncDecodingForImagesInAbsoluteRect): Calls the RenderView to
        make the request.
        (WebCore::FrameView::requestAsyncDecodingForImagesInAbsoluteRectIncludingSubframes): Calls
        applyRecursivelyWithAbsoluteRect giving an apply lambda which calls requestAsyncDecodingForImagesInAbsoluteRect.
        * page/FrameView.h:

        * platform/graphics/BitmapImage.cpp:
        (WebCore::BitmapImage::destroyDecodedData): ImageSource::hasDecodingQueue() is renamed to ImageSource::hasAsyncDecodingQueue().
        (WebCore::BitmapImage::dataChanged): Use String::utf8().data() instead of String::characters8().
        (WebCore::BitmapImage::draw): If drawing the current frame is called while it is being
        decoded, draw the the image if the current frame was decoded but for a different size 
        and and will not invoke decoding while painting. If the frame is being decoded and there
        isn't a decoded frame, return without drawing but set a flag that that this image needs
        a repaint.
        (WebCore::BitmapImage::internalStartAnimation): Use String::utf8().data() instead of String::characters8().
        (WebCore::BitmapImage::advanceAnimation): Ditto.
        (WebCore::BitmapImage::internalAdvanceAnimation): Ditto.
        (WebCore::BitmapImage::newFrameNativeImageAvailableAtIndex): Now this callback can be
        called form the ImageFrameCache when finishing a frame of an animated image or the
        frame of a large image. For large images, we need to call CachedImage::changedInRect()
        if this image needs a repaint. If the decoding queue is idle, we should close it.
        (WebCore::BitmapImage::requestAsyncDecoding): This is called form 
        RenderView::requestAsyncDecodingForImagesInRect().
        * platform/graphics/BitmapImage.h:

        * platform/graphics/Image.h:
        (WebCore::Image::requestAsyncDecoding): Add the default implementation of a virtual function.

        * platform/graphics/ImageFrameCache.cpp:
        (WebCore::ImageFrameCache::~ImageFrameCache): hasDecodingQueue() was renamed to hasAsyncDecodingQueue().
        (WebCore::ImageFrameCache::decodingQueue): Change the QNS of the decoding thread to be WorkQueue::QOS::Default.
        WorkQueue::QOS::UserInteractive causes the scrolling thread to preempted  which can make the scrolling choppy.
        (WebCore::ImageFrameCache::startAsyncDecodingQueue): hasDecodingQueue() was renamed to hasAsyncDecodingQueue().
        (WebCore::ImageFrameCache::requestFrameAsyncDecodingAtIndex): Ditto.
        (WebCore::ImageFrameCache::isAsyncDecodingQueueIdle): A helper function to tell whether the decoding thread is idle.
        (WebCore::ImageFrameCache::stopAsyncDecodingQueue): hasDecodingQueue() was renamed to hasAsyncDecodingQueue().
        * platform/graphics/ImageFrameCache.h:
        (WebCore::ImageFrameCache::hasAsyncDecodingQueue): Rename this function to be consistent with the rest of the functions.
        (WebCore::ImageFrameCache::hasDecodingQueue): Deleted.

        * platform/graphics/ImageSource.h:
        (WebCore::ImageSource::hasAsyncDecodingQueue): hasDecodingQueue() was renamed to hasAsyncDecodingQueue().
        (WebCore::ImageSource::isAsyncDecodingQueueIdle): A wrapper for ImageFrameCache::isAsyncDecodingQueueIdle().
        (WebCore::ImageSource::hasDecodingQueue): Deleted.
        
        * platform/graphics/TiledBacking.h: Fix a comment. tileGridExtent() is the only one that is used for testing.

        * rendering/RenderElement.cpp:
        (WebCore::RenderElement::~RenderElement):
        (WebCore::RenderElement::intersectsAbsoluteRect): Make this function does what shouldRepaintForImageAnimation()
        was doing expect the check for document.activeDOMObjectsAreSuspended().
        (WebCore::RenderElement::newImageAnimationFrameAvailable): Replace the call to
        shouldRepaintForImageAnimation() by checking document().activeDOMObjectsAreSuspended() then a call to
        RenderElement::intersectsAbsoluteRect().
        (WebCore::RenderElement::repaintForPausedImageAnimationsIfNeeded): Ditto.
        (WebCore::RenderElement::registerForAsyncImageDecodingCallback): Call the RenderView to register the renderer..
        (WebCore::RenderElement::unregisterForAsyncImageDecodingCallback): Call the RenderView to unregister the renderer..
        (WebCore::shouldRepaintForImageAnimation): Deleted.
        * rendering/RenderElement.h:

        * rendering/RenderObject.cpp:
        (WebCore::RenderObject::setIsRegisteredForAsyncImageDecodingCallback):
        * rendering/RenderObject.h:
        (WebCore::RenderObject::isRegisteredForAsyncImageDecodingCallback):
        (WebCore::RenderObject::RenderObjectRareData::RenderObjectRareData):
        Mark/unmark the renderer for being RegisteredForAsyncImageDecodingCallback.

        * rendering/RenderReplaced.h: Make intrinsicSize() be a public function.

        * rendering/RenderView.cpp:
        (WebCore::RenderView::registerForAsyncImageDecodingCallback): Register a renderer for async image decoding.
        (WebCore::RenderView::unregisterForAsyncImageDecodingCallback): Remove a renderer from the list of async image decoding.
        (WebCore::RenderView::requestAsyncDecodingForImagesInAbsoluteRect):This loops through all the registered RenderImages
        inside this RenderView and if any of them intersects with the rectangle, requestAsyncDecoding for it.
        * rendering/RenderView.h:

2017-03-08  Michael Catanzaro  <mcatanzaro@igalia.com>

        Fix missing return value after r213499
        https://bugs.webkit.org/show_bug.cgi?id=168198

        Reviewed by Myles C. Maxfield.

        * platform/text/CharacterProperties.h:
        (WebCore::isEmojiGroupCandidate):

2017-03-08  Wenson Hsieh  <wenson_hsieh@apple.com>

        Add TextIndicator support for providing a snapshot excluding selected content
        https://bugs.webkit.org/show_bug.cgi?id=169309
        <rdar://problem/30883525>

        Reviewed by Tim Horton.

        Work towards <rdar://problem/30882974>. Adds support in TextIndicator to include a snapshot of all visible
        content, excluding nodes captured in the current selection. This comes in the form of the new
        TextIndicatorOptionIncludeSnapshotOfAllVisibleContentWithoutSelection flag -- see per-method changes for more details.

        No new tests, since there is no change in behavior yet.

        * page/FrameSnapshotting.cpp:
        (WebCore::snapshotFrameRectWithClip):
        * page/FrameSnapshotting.h:

        Introduce a new snapshot option flag, SnapshotOptionsPaintEverythingExcludingSelection.

        (WebCore::snapshotFrameRectWithClip):
        * page/TextIndicator.cpp:

        If TextIndicatorOptionIncludeSnapshotOfAllVisibleContentWithoutSelection is turned on, capture and include a
        snapshot of the visible bounds of the frame.

        (WebCore::takeSnapshot):
        (WebCore::takeSnapshots):
        (WebCore::initializeIndicator):
        * page/TextIndicator.h:

        Introduce TextIndicatorOptionIncludeSnapshotOfAllVisibleContentWithoutSelection.

        * platform/graphics/FontCascade.cpp:
        (WebCore::FontCascade::widthOfTextRange):
        * platform/graphics/FontCascade.h:

        Teach FontCascade to retrieve the width of a range in a TextRun, and also compute the widths of the TextRun
        before and after the range. This is used by InlineTextBox to compute the painting rect to clip out when skipping
        text decorations for the selected region of the TextRun.

        * rendering/InlineTextBox.cpp:

        Teach InlineTextBox to respect PaintBehaviorExcludeSelection. When painting text, if this paint behavior is
        used, we will not paint the portion of the text run that lies inside the range determined by selectionStartEnd().
        Similarly, when painting text decorations, we exclude the rect surrounding the selected content.

        (WebCore::InlineTextBox::paint):
        (WebCore::InlineTextBox::paintDecoration):
        * rendering/InlineTextBox.h:
        * rendering/PaintPhase.h:

        Introduce PaintBehaviorExcludeSelection, used to inform members of the render tree not to paint portions that
        lie within the current selection range.

        * rendering/RenderLayer.cpp:

        Propagate the PaintBehaviorExcludeSelection flag to children when painting.

        (WebCore::RenderLayer::paintLayerContents):
        (WebCore::RenderLayer::paintForegroundForFragments):
        * rendering/RenderReplaced.cpp:
        (WebCore::RenderReplaced::shouldPaint):

        Teach RenderReplaced to respect PaintBehaviorExcludeSelection by bailing from painting if it is selected and the
        paint behavior is enabled.

        * rendering/TextDecorationPainter.h:
        * rendering/TextPaintStyle.cpp:
        (WebCore::computeTextSelectionPaintStyle):
        * rendering/TextPaintStyle.h:
        * rendering/TextPainter.cpp:
        (WebCore::TextPainter::paintText):
        * rendering/TextPainter.h:

2017-03-08  Youenn Fablet  <youenn@apple.com>

        Support PeerConnectionStates::BundlePolicy::MaxBundle when setting rtc configuration
        https://bugs.webkit.org/show_bug.cgi?id=169389

        Reviewed by Eric Carlson.

        Temporary fix to support appr.tc web site.
        A future patch should allow to set MaxBundle.

        * Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.cpp:
        (WebCore::configurationFromMediaEndpointConfiguration):

2017-03-08  Chris Dumez  <cdumez@apple.com>

        Drop select.remove() / options.remove() overloads taking an option element in parameter
        https://bugs.webkit.org/show_bug.cgi?id=169339

        Reviewed by Sam Weinig.

        Drop select.remove() / options.remove() overloads taking an option element in parameter.
        It is non-standard:
        - https://html.spec.whatwg.org/multipage/forms.html#the-select-element
        - https://html.spec.whatwg.org/multipage/infrastructure.html#htmloptionscollection

        It is not supported by Firefox and was removed from Chrome:
        - https://bugs.chromium.org/p/chromium/issues/detail?id=345697
        - https://bugs.chromium.org/p/chromium/issues/detail?id=398627

        Chrome UseCounter data shows consistent 0% usage:
        - https://www.chromestatus.com/metrics/feature/timeline/popularity/398

        Test: fast/dom/HTMLSelectElement/remove-option-element.html

        * html/HTMLOptionsCollection.cpp:
        * html/HTMLOptionsCollection.h:
        * html/HTMLOptionsCollection.idl:
        * html/HTMLSelectElement.cpp:
        * html/HTMLSelectElement.h:
        * html/HTMLSelectElement.idl:

2017-03-08  Chris Dumez  <cdumez@apple.com>

        Parameter to input.setCustomValidity() should not be nullable
        https://bugs.webkit.org/show_bug.cgi?id=169332

        Reviewed by Sam Weinig.

        Parameter to input.setCustomValidity() should not be nullable:
        - https://html.spec.whatwg.org/#htmlinputelement

        Firefox and Chrome agree with the specification so the change
        should be safe.

        Test: fast/forms/setCustomValidity-null-parameter.html

        * html/HTMLButtonElement.idl:
        * html/HTMLFieldSetElement.idl:
        * html/HTMLInputElement.idl:
        * html/HTMLKeygenElement.idl:
        * html/HTMLObjectElement.idl:
        * html/HTMLOutputElement.idl:
        * html/HTMLSelectElement.idl:
        * html/HTMLTextAreaElement.idl:

2017-03-08  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.
        
        Re-landing r206713.
        
        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<<):

2017-03-08  Anders Carlsson  <andersca@apple.com>

        Simplify the PaymentCoordinator interface
        https://bugs.webkit.org/show_bug.cgi?id=169382
        Part of rdar://problem/28880714.

        Reviewed by Tim Horton.

        Add four new structs: PaymentAuthorizationResult, PaymentMethodUpdate, ShippingContactUpdate and ShippingMethodUpdate.
        Change the various PaymentCoordinator and PaymentCoordinatorClient functions to take these new objects instead of multiple parameters.

        * Modules/applepay/ApplePaySession.cpp:
        (WebCore::ApplePaySession::completeShippingMethodSelection):
        (WebCore::ApplePaySession::completeShippingContactSelection):
        (WebCore::ApplePaySession::completePaymentMethodSelection):
        (WebCore::ApplePaySession::completePayment):
        (WebCore::ApplePaySession::didSelectShippingMethod):
        (WebCore::ApplePaySession::didSelectShippingContact):
        * Modules/applepay/PaymentAuthorizationStatus.h:
        * Modules/applepay/PaymentCoordinator.cpp:
        (WebCore::PaymentCoordinator::completeShippingMethodSelection):
        (WebCore::PaymentCoordinator::completeShippingContactSelection):
        (WebCore::PaymentCoordinator::completePaymentMethodSelection):
        (WebCore::PaymentCoordinator::completePaymentSession):
        * Modules/applepay/PaymentCoordinator.h:
        * Modules/applepay/PaymentCoordinatorClient.h:
        * Modules/applepay/PaymentRequest.h:
        * loader/EmptyClients.cpp:

2017-03-08  Simon Fraser  <simon.fraser@apple.com>

        Change determineNonLayerDescendantsPaintedContent to max out based on renderers traversed
        https://bugs.webkit.org/show_bug.cgi?id=169384

        Reviewed by Zalan Bujtas.

        determineNonLayerDescendantsPaintedContent() would bail after depth 3, sibling count 20. However,
        empirical testing shows that it would run to completion more often if the limit was based on the
        number of nodes traversed (in particular, it's common to see fairly deep subtrees with few siblings).
        Running to completion has huge memory advantages, because we can then be sure to have checked all the
        renderers for smoothed text, allowing us, on some pages, to avoid the extra memory cost of using
        layers that support subpixel-antialiased text.

        Performance measurement shows that mean runtime of this function goes up from 0.30us to 0.34us
        with a 200 renderer limit, which seems worthwhile.

        Test: compositing/contents-format/subpixel-antialiased-text-traversal.html

        * rendering/RenderLayer.cpp:
        (WebCore::RenderLayer::calculateClipRects):

2017-03-08  Youenn Fablet  <youenn@apple.com>

        Support canvas captureStream
        https://bugs.webkit.org/show_bug.cgi?id=169192

        Reviewed by Dean Jackson.

        Tests: fast/mediacapturefromelement/CanvasCaptureMediaStream-2d-events.html
               fast/mediacapturefromelement/CanvasCaptureMediaStream-capture-out-of-DOM-element.html
               fast/mediacapturefromelement/CanvasCaptureMediaStream-clone-track.html
               fast/mediacapturefromelement/CanvasCaptureMediaStream-creation.html
               fast/mediacapturefromelement/CanvasCaptureMediaStream-exceptions.html
               fast/mediacapturefromelement/CanvasCaptureMediaStream-framerate-0.html
               fast/mediacapturefromelement/CanvasCaptureMediaStream-imagebitmaprenderingcontext.html
               fast/mediacapturefromelement/CanvasCaptureMediaStream-offscreencanvas.html
               fast/mediacapturefromelement/CanvasCaptureMediaStream-request-frame-events.html
               fast/mediacapturefromelement/CanvasCaptureMediaStream-webgl-events.html

        Adding canvas captureStream as defined in https://w3c.github.io/mediacapture-fromelement/#html-canvas-element-media-capture-extensions
        This allows creating a video MediaStreamTrack fed by canvas taken frames.
        Frames are produced when canvas get changed.

        Tests taken from Chromium.

        * CMakeLists.txt:
        * DerivedSources.make:
        * Modules/mediastream/CanvasCaptureMediaStreamTrack.cpp: Added.
        (WebCore::CanvasCaptureMediaStreamTrack::create):
        (WebCore::CanvasCaptureMediaStreamTrack::CanvasCaptureMediaStreamTrack):
        (WebCore::CanvasCaptureMediaStreamTrack::Source::create):
        (WebCore::CanvasCaptureMediaStreamTrack::Source::Source):
        (WebCore::CanvasCaptureMediaStreamTrack::Source::startProducingData):
        (WebCore::CanvasCaptureMediaStreamTrack::Source::stopProducingData):
        (WebCore::CanvasCaptureMediaStreamTrack::Source::requestFrameTimerFired):
        (WebCore::CanvasCaptureMediaStreamTrack::Source::canvasDestroyed):
        (WebCore::CanvasCaptureMediaStreamTrack::Source::canvasResized):
        (WebCore::CanvasCaptureMediaStreamTrack::Source::canvasChanged):
        (WebCore::CanvasCaptureMediaStreamTrack::Source::captureCanvas):
        (WebCore::CanvasCaptureMediaStreamTrack::Source::paintCurrentFrameInContext):
        (WebCore::CanvasCaptureMediaStreamTrack::Source::currentFrameImage):
        * Modules/mediastream/CanvasCaptureMediaStreamTrack.h: Added.
        (isType):
        * Modules/mediastream/CanvasCaptureMediaStreamTrack.idl: Added.
        * Modules/mediastream/MediaStreamTrack.h:
        (WebCore::MediaStreamTrack::isCanvas):
        * Modules/mediastream/MediaStreamTrack.idl:
        * WebCore.xcodeproj/project.pbxproj:
        * bindings/js/JSMediaStreamTrackCustom.cpp:
        (WebCore::toJSNewlyCreated):
        (WebCore::toJS):
        * html/HTMLCanvasElement.cpp:
        (WebCore::HTMLCanvasElement::toMediaSample):
        (WebCore::HTMLCanvasElement::captureStream):
        * html/HTMLCanvasElement.h:
        * html/HTMLCanvasElement.idl:
        * html/canvas/WebGL2RenderingContext.cpp:
        (WebCore::WebGL2RenderingContext::clear):
        * html/canvas/WebGLRenderingContextBase.cpp:
        (WebCore::WebGLRenderingContextBase::markContextChangedAndNotifyCanvasObserver):
        (WebCore::WebGLRenderingContextBase::drawArrays):
        (WebCore::WebGLRenderingContextBase::drawElements):
        (WebCore::WebGLRenderingContextBase::drawArraysInstanced):
        (WebCore::WebGLRenderingContextBase::drawElementsInstanced):
        * html/canvas/WebGLRenderingContextBase.h:
        * platform/graphics/ImageBuffer.cpp:
        (WebCore::ImageBuffer::toBGRAData):
        * platform/graphics/ImageBuffer.h:
        * platform/graphics/avfoundation/MediaSampleAVFObjC.h:
        * platform/graphics/avfoundation/objc/MediaSampleAVFObjC.mm:
        (WebCore::releaseUint8Vector):
        (WebCore::MediaSampleAVFObjC::createImageSample):
        * platform/graphics/cg/ImageBufferCG.cpp:
        * platform/graphics/cg/ImageBufferDataCG.cpp:
        (WebCore::transferData):
        (WebCore::ImageBufferData::toBGRAData):
        * platform/graphics/cg/ImageBufferDataCG.h:

2017-03-07  Anders Carlsson  <andersca@apple.com>

        Use the new code path when dragging web contents
        https://bugs.webkit.org/show_bug.cgi?id=169298

        Reviewed by Beth Dakin.

        * editing/Editor.h:
        * editing/cocoa/EditorCocoa.mm:
        (WebCore::Editor::writeSelection):
        Add a new function that writes the selection to a writer object.

        * page/DragController.cpp:
        (WebCore::DragController::startDrag):
        Use the new writeSelection if mustUseLegacyDragClient is false.

        * platform/PasteboardWriterData.cpp:
        (WebCore::PasteboardWriterData::WebContent::WebContent):
        (WebCore::PasteboardWriterData::WebContent::~WebContent):
        (WebCore::PasteboardWriterData::setWebContent):
        * platform/PasteboardWriterData.h:
        Add getters and setters.

        * platform/mac/PasteboardWriter.mm:
        (WebCore::toUTIUnlessAlreadyUTI):
        Add a helper.

        (WebCore::createPasteboardWriter):
        Convert web content to pasteboard types.

2017-03-08  Dave Hyatt  <hyatt@apple.com>

        CSS Multicolumn should not clip columns horizontally
        https://bugs.webkit.org/show_bug.cgi?id=169363

        Reviewed by Sam Weinig.

        Revised multiple tests in fast/multicol.

        * rendering/RenderMultiColumnSet.cpp:
        (WebCore::RenderMultiColumnSet::flowThreadPortionOverflowRect):
        Stop clipping horizontally. Section 8.1 of the spec changed from "clip" to "don't clip",
        so we're changing to match the latest draft. Keep iBooks-based pagination clipping though.

2017-03-08  Simon Fraser  <simon.fraser@apple.com>

        Add support for history.scrollRestoration
        https://bugs.webkit.org/show_bug.cgi?id=147782
        rdar://problem/22614568

        Reviewed by Sam Weinig.

        Add support for history.scrollRestoration, per spec:
        <https://html.spec.whatwg.org/multipage/browsers.html#dom-history-scroll-restoration>

        This is a new attribute on the History interface. On setting, sets the "shouldRestoreScrollPosition"
        state on the current history item, and the getter returns that state. pushState() inherits the
        state from the current item.

        HistoryController::restoreScrollPositionAndViewState() consults this state, and if set to "manual"
        ("don't restore) it just uses the current scroll position (we need something to pass to
        setPageScaleFactor() so can't just avoid the restoration).

        FrameLoader::scrollToFragmentWithParentBoundary() also needs to consult the historyItem
        to know if it's OK to scroll to a fragment, on back/forward same-document loads.

        Tests: fast/history/history-scroll-restoration-attribute.html
               fast/history/history-scroll-restoration.html

        * history/HistoryItem.cpp:
        (WebCore::HistoryItem::HistoryItem):
        (WebCore::HistoryItem::shouldRestoreScrollPosition):
        (WebCore::HistoryItem::setShouldRestoreScrollPosition):
        * history/HistoryItem.h:
        * loader/FrameLoader.cpp:
        (WebCore::FrameLoader::loadInSameDocument):
        (WebCore::itemAllowsScrollRestoration):
        (WebCore::isSameDocumentReload):
        (WebCore::FrameLoader::scrollToFragmentWithParentBoundary):
        (WebCore::FrameLoader::continueLoadAfterNavigationPolicy):
        * loader/FrameLoader.h:
        * loader/HistoryController.cpp:
        (WebCore::HistoryController::restoreScrollPositionAndViewState):
        (WebCore::HistoryController::goToItem):
        (WebCore::HistoryController::pushState):
        (WebCore::HistoryController::replaceState):
        * page/History.cpp:
        (WebCore::History::scrollRestoration):
        (WebCore::History::setScrollRestoration):
        * page/History.h:
        * page/History.idl:

2017-03-08  Chris Dumez  <cdumez@apple.com>

        [iOS] Throttle DOM timers to 30fps in low power mode
        https://bugs.webkit.org/show_bug.cgi?id=169213
        <rdar://problem/30876965>

        Reviewed by Simon Fraser.

        Throttle and align DOM timers to ~30fps in low power mode on iOS
        to save battery.

        Test: fast/dom/timer-throttling-lowPowerMode.html

        * page/DOMTimer.h:
        * page/Page.cpp:
        (WebCore::Page::handleLowModePowerChange):
        (WebCore::Page::updateDOMTimerAlignmentInterval):

2017-03-08  Chris Dumez  <cdumez@apple.com>

        Update outdated comment about HTMLElement.dropzone
        https://bugs.webkit.org/show_bug.cgi?id=169338

        Reviewed by Sam Weinig.

        Update outdated comment about HTMLElement.dropzone since it was dropped
        from the HTML specification:
        - https://github.com/whatwg/html/commit/3044a7e8517a4488cea811789d19974a8d5a56ae

        Also add comment about HTMLElement.webkitdropzone since Blink dropped
        it in:
        - https://bugs.chromium.org/p/chromium/issues/detail?id=688943

        * html/HTMLElement.idl:

2017-03-06  Matt Rajca  <mrajca@apple.com>

        Add support for an autoplay play-pause events quirk.
        https://bugs.webkit.org/show_bug.cgi?id=169235

        Reviewed by Jer Noble.

        For sites that assume media starts off playing, send a playing and pause event to trigger
        custom media controls to update.

        * html/HTMLMediaElement.cpp:
        (WebCore::needsAutoplayPlayPauseEventsQuirk):
        (WebCore::HTMLMediaElement::dispatchPlayPauseEventsIfNeedsQuirks):
        (WebCore::HTMLMediaElement::setReadyState):
        (WebCore::HTMLMediaElement::play):
        * html/HTMLMediaElement.h:

2017-03-08  Zan Dobersek  <zdobersek@igalia.com>

        MediaPlayerPrivateGStreamerBase::volume() should override the MediaPlayerPrivate method
        https://bugs.webkit.org/show_bug.cgi?id=169347

        Reviewed by Carlos Garcia Campos.

        Enable the MediaPlayerPrivate::volume() method for the USE(GSTREAMER) configuration
        and override it in the MediaPlayerPrivateGStreamerBase class.

        * platform/graphics/MediaPlayerPrivate.h:
        * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.h:

2017-03-08  Enrique Ocaña González  <eocanha@igalia.com>

        [GStreamer][MSE] Actually implement flush() on playback pipeline
        https://bugs.webkit.org/show_bug.cgi?id=169202

        Reviewed by Žan Doberšek.

        * platform/graphics/gstreamer/GRefPtrGStreamer.cpp: Added GRefPtr support for GstQuery.
        (WTF::adoptGRef):
        (WTF::refGPtr<GstQuery>):
        (WTF::derefGPtr<GstQuery>):
        * platform/graphics/gstreamer/GRefPtrGStreamer.h: Ditto.
        * platform/graphics/gstreamer/GUniquePtrGStreamer.h: Added GUniquePtr support for GstSegment.
        * platform/graphics/gstreamer/mse/MediaSourceClientGStreamerMSE.cpp:
        (WebCore::MediaSourceClientGStreamerMSE::flush): Only actually flush in the non-seek case. For the seek case,
        GStreamer seek will already do the flush.
        * platform/graphics/gstreamer/mse/PlaybackPipeline.cpp:
        (WebCore::PlaybackPipeline::addSourceBuffer): Configure appsrc to be time-based instead of bytes-based to ensure
        that the segments it produces are time-based.
        (WebCore::segmentFixerProbe): This captures the next segment in the stream and "fixes" its base time by setting
        it to the start time. This prevent audio/video desynchronizations.
        (WebCore::PlaybackPipeline::flush): Really implement flushing by sending flush start/stop events, reconfiguring
        appsrc with a new (seamless) segment (so it reconfigures the rest of the elements in that stream), and attached
        a segmentFixerProbe to fix the segment emitted by basesrc (appsrc). The current pipeline position is used as
        start time used for the new segment. This prevents displaying samples already displayed before flushing, while
        allowing the decoder to decode them as a base for future (dependent) p-frame and b-frame samples.

2017-03-07  Simon Fraser  <simon.fraser@apple.com>

        Remove never-implemented CSS3 text decoration-related properties
        https://bugs.webkit.org/show_bug.cgi?id=169009

        Reviewed by Zalan Bujtas.

        The following CSS properties were added many years ago based on an old CSS3 Text
        draft (https://www.w3.org/TR/2003/CR-css3-text-20030514/), but never had any implementations.
        Remove them.

            text-line-through
            text-line-through-color
            text-line-through-mode
            text-line-through-style
            text-line-through-width
            text-overline
            text-overline-color
            text-overline-mode
            text-overline-style
            text-overline-width
            text-underline
            text-underline-color
            text-underline-mode
            text-underline-style
            text-underline-width

        * WebCore.xcodeproj/project.pbxproj:
        * css/CSSComputedStyleDeclaration.cpp:
        (WebCore::ComputedStyleExtractor::propertyValue):
        * css/CSSProperties.json:
        * css/parser/CSSParserFastPaths.cpp:
        (WebCore::CSSParserFastPaths::isKeywordPropertyID):

2017-03-07  Simon Fraser  <simon.fraser@apple.com>

        Have fixedPositionCreatesStackingContext be on by default everywhere
        https://bugs.webkit.org/show_bug.cgi?id=169334

        Reviewed by Zalan Bujtas.

        It makes no sense to have web-exposed CSS functionality be different based on setting,
        and other browser are now aligned with having position:fixed create stacking context.

        So remove the fixedPositionCreatesStackingContext setting and have StyleResolver::adjustRenderStyle()
        always force stacking context for position:fixed.

        * css/StyleResolver.cpp:
        (WebCore::StyleResolver::adjustRenderStyle):
        * page/Settings.cpp:
        * page/Settings.in:

2017-03-07  Said Abou-Hallawa  <sabouhallawa@apple.com>

        Asynchronous image decoding should consider the drawing size if it is smaller than the size of the image
        https://bugs.webkit.org/show_bug.cgi?id=168814

        Reviewed by Simon Fraser.

        If the image destinationRect.size() is smaller than the imageSourceSize
        (e.g. 3000x3000 pixels), CGImageSourceCreateThumbnailAtIndex() is slower
        than CGImageSourceCreateImageAtIndex() in decoding this image. To overcome
        this problem, the entry (kCGImageSourceThumbnailMaxPixelSize,
        max(destinationRect.width, destinationRect.height)) is added to the options
        dictionary when calling CGImageSourceCreateThumbnailAtIndex(). This will
        avoid copying a large block of memory for the unscaled bitmap image.

        An argument named 'sizeForDrawing' of type std::optional<IntSize> will be passed
        all the way from BitmapImage to ImageDecoder. If bool(sizeForDrawing) equals
        true that means we want async image decoding. Otherwise the image will be decoded
        synchronously.

        The subsamplingLevel argument will be passed as std::optional<SubsamplingLevel>.
        to ImageFrame query functions. When combined with sizeForDrawing, the meaning of
        these two arguments will be the following:
        -- !bool(subsamplingLevel): No caching is required. return what is stored in ImageFrameCache.
        -- bool(subsamplingLevel) && !bool(sizeForDrawing): Match subsamplingLevel only. Recache if it's different.
        -- bool(subsamplingLevel) && bool(sizeForDrawing): Match both both. . Recache if one of them is different.

        We are going to allow decoding the same ImageFrame for different sizeForDrawings.
        The rule is a new decoding is allowed only if the maxPixelSize(sizeForDrawing) of
        the last requested image decoding is less than the new request sizeForDrawing.

        * loader/cache/CachedImage.h: Add a helper function which returns the URL of a CachedImage.

        * platform/graphics/BitmapImage.cpp:
        (WebCore::BitmapImage::frameImageAtIndex): Add a new argument for sizeForDrawing.
        (WebCore::BitmapImage::nativeImage): Pass an empty sizeForDrawing to frameImageAtIndex(). We an image with the native size.
        (WebCore::BitmapImage::nativeImageForCurrentFrame): Ditto.
        (WebCore::BitmapImage::nativeImageOfSize): Ditto.
        (WebCore::BitmapImage::draw): Pass the destRect.size() to internalStartAnimation().
        (WebCore::BitmapImage::isAsyncDecodingRequired): A helper function to answer the question
        whether the async image decoding is required. It takes into account the animated images, the
        large image, and the image size.
        (WebCore::BitmapImage::internalStartAnimation):  If async image decoding is requested for this frame m_sizeForDraw
        will be set. If internalStartAnimation() is called from startAnimation(), sizeForDraw will be empty. In this
        case no async image decoding will be requested. This happens only when startAnimation() is called from outside
        BitmapImage::draw().
        (WebCore::BitmapImage::advanceAnimation): Change the log message.
        (WebCore::BitmapImage::newFrameNativeImageAvailableAtIndex): Ditto.
        * platform/graphics/BitmapImage.h:

        * platform/graphics/ImageFrame.cpp:
        (WebCore::ImageFrame::operator=):  Include m_sizeForDraw in the properties of ImageFrame.
        (WebCore::maxPixelSize): Returns the maximum of the width() and the height of an IntSize.
        (WebCore::ImageFrame::isBeingDecoded): Returns true if the ImageFrame is currently being decoded for a specific sizeForDrawing.
        (WebCore::ImageFrame::hasValidNativeImage): Ditto.
        * platform/graphics/ImageFrame.h:
        (WebCore::ImageFrame::enqueueSizeForDecoding): Adds a new sizeForDrawing; this sets the ImageFrame is being decoded for this sizeForDrawing.
        (WebCore::ImageFrame::dequeueSizeForDecoding): Removes the first sizeForDrawing was enqueued; this marks this ImageFrame has finished decoding for this sizeForDrawing.
        (WebCore::ImageFrame::clearSizeForDecoding): Clears the sizeForDecoding queue. Marks the ImageFrame for not being decoded.
        (WebCore::ImageFrame::isEmpty): Replace Decoding::Empty by Decoding::None.
        (WebCore::ImageFrame::sizeForDrawing): Returns the ImageFrame sizeForDraw.
        (WebCore::ImageFrame::hasDecodedNativeImage): Returns true if the ImageFrame doesn't need decoding before drawing.
        (WebCore::ImageFrame::hasValidNativeImage): Deleted. Moved to the source file.

        * platform/graphics/ImageFrameCache.cpp:
        (WebCore::ImageFrameCache::setFrameNativeImageAtIndex): Take a new argument for sizeForDraw.
        (WebCore::ImageFrameCache::setFrameMetadataAtIndex):  When sizeForDraw is set, use the decoder to get the image
        frame size. Otherwise, get the size of the nativeImage.
        (WebCore::ImageFrameCache::replaceFrameNativeImageAtIndex): Take a new argument for sizeForDraw.
        (WebCore::ImageFrameCache::cacheFrameNativeImageAtIndex): Ditto.
        (WebCore::ImageFrameCache::startAsyncDecodingQueue): Pass the sizeForDraw as a new property of the ImageFrame.
        (WebCore::ImageFrameCache::requestFrameAsyncDecodingAtIndex): Store sizeForDraw in ImageFrameRequest. Delete unneeded check.
        This function always receives a valid subsamplingLevel. 
        (WebCore::ImageFrameCache::stopAsyncDecodingQueue): Marks all the queued ImageFrames for not being decoded.
        (WebCore::ImageFrameCache::frameAtIndexCacheIfNeeded): Take a new argument for sizeForDraw. If this function fixes the
        properties of ImageFrame properties, keep the old sizeForDraw and/or subsamplingLevel. If a new frame is 
        decoded, no async image decoding will be done in this code path. So pass an empty std::optional<IntSize> to 
        ImageDecoder::createFrameImageAtIndex() and store std::optional<IntSize> in ImageFrame.
        (WebCore::ImageFrameCache::frameMetadataAtIndex): A new helper function which takes a variable number of arguments which
        will be passed to the (ImageFrame::*functor).
        (WebCore::ImageFrameCache::frameMetadataAtIndexCacheIfNeeded): Make this function takes a variable number of arguments which
        will be passed to the frameAtIndexCacheIfNeeded().
        (WebCore::ImageFrameCache::size): Pass an Metadata, valid SubsamplingLevel and empty sizeForDraw to frameMetadataAtIndexCacheIfNeeded().
        (WebCore::ImageFrameCache::sizeRespectingOrientation): Ditto.
        (WebCore::ImageFrameCache::singlePixelSolidColor): Pass MetadataAndImage, empty SubsamplingLevel and empty sizeForDraw to
        frameMetadataAtIndexCacheIfNeeded(); we can use the current frame image regardless of its size.
        (WebCore::ImageFrameCache::frameIsBeingDecodedAtIndex): Pass the ImageFrame method as a function argument instead of 
        passing it as a template argument.
        (WebCore::ImageFrameCache::frameIsCompleteAtIndex): Ditto.
        (WebCore::ImageFrameCache::frameHasAlphaAtIndex): Ditto.
        (WebCore::ImageFrameCache::frameHasImageAtIndex): Ditto.
        (WebCore::ImageFrameCache::frameHasValidNativeImageAtIndex): Pass subsamplingLevel and sizeForDrawing to frameMetadataAtIndex().
        (WebCore::ImageFrameCache::frameHasDecodedNativeImage): New helper function to answer the question whether an ImageFrame will need
        decoding when drawing or not.
        (WebCore::ImageFrameCache::frameSubsamplingLevelAtIndex):  Pass the ImageFrame method as a function argument instead of 
        passing it as a template argument.
        (WebCore::ImageFrameCache::frameSizeAtIndex): Ditto.
        (WebCore::ImageFrameCache::frameBytesAtIndex): Ditto.
        (WebCore::ImageFrameCache::frameDurationAtIndex): Ditto.
        (WebCore::ImageFrameCache::frameOrientationAtIndex):
        (WebCore::ImageFrameCache::frameImageAtIndex): Ditto.
        (WebCore::ImageFrameCache::frameAtIndex): Deleted. Renamed to frameAtIndexCacheIfNeeded().
        * platform/graphics/ImageFrameCache.h:
        (WebCore::ImageFrameCache::frameAtIndexCacheIfNeeded):

        * platform/graphics/ImageObserver.h: Define a virtual function for image sourceUrl().

        * platform/graphics/ImageSource.cpp:
        (WebCore::ImageSource::frameImageAtIndex): Take a new argument for sizeForDrawing.
        * platform/graphics/ImageSource.h:
        (WebCore::ImageSource::requestFrameAsyncDecodingAtIndex): Take a new argument for sizeForDrawing.
        (WebCore::ImageSource::frameHasValidNativeImageAtIndex): Ditto.
        (WebCore::ImageSource::frameHasDecodedNativeImage): New helper function.
        (WebCore::ImageSource::frameImageAtIndex): Ditto.

        * platform/graphics/cg/ImageDecoderCG.cpp:
        (WebCore::createImageSourceOptions): Create a dictionary with the basic image decoding options.
        (WebCore::createImageSourceAsyncOptions): Create a dictionary with the basic asynchronous image decoding options.
        (WebCore::appendImageSourceOption): Append the SubsamplingLevel or the MaxPixelSize option to an CGImageSource options dictionary.
        (WebCore::appendImageSourceOptions): Append the SubsamplingLevel and the MaxPixelSize option to an CGImageSource options dictionary.
        (WebCore::imageSourceOptions): Creates a dictionary for the synchronous image decoding options.
        (WebCore::imageSourceAsyncOptions): Creates a dictionary for the asynchronous image decoding options.
        (WebCore::ImageDecoder::createFrameImageAtIndex): Replace the DecodingMode argument by an std::optional<IntSize>.
        * platform/graphics/cg/ImageDecoderCG.h: Change a prototype.

        * platform/graphics/win/ImageDecoderDirect2D.cpp: 
        (WebCore::ImageDecoder::createFrameImageAtIndex): Replace the DecodingMode argument by an std::optional<IntSize>.
        * platform/graphics/win/ImageDecoderDirect2D.h: Change a prototype.

        * platform/image-decoders/ImageDecoder.cpp: 
        (WebCore::ImageDecoder::createFrameImageAtIndex): Replace the DecodingMode argument by an std::optional<IntSize>.
        * platform/image-decoders/ImageDecoder.h: Change a prototype.

2017-03-07  Simon Fraser  <simon.fraser@apple.com>

        Parsing -webkit-hyphenate-character uses confusingly named consumeLocale()
        https://bugs.webkit.org/show_bug.cgi?id=168638

        Reviewed by Zalan Bujtas.

        Parsing CSSPropertyWebkitHyphenateCharacter very confusingly called consumeLocale(),
        which is really just "consume the 'auto' ident or a string", so rename that function.

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

2017-03-07  Jiewen Tan  <jiewen_tan@apple.com>

        [WebCrypto] Implement ECDH ImportKey/ExportKey operations
        https://bugs.webkit.org/show_bug.cgi?id=169257
        <rdar://problem/23789585>

        Reviewed by Brent Fulgham.

        This patch implements ECDH ImportKey/ExportKey operations according to:
        https://www.w3.org/TR/WebCryptoAPI/#ecdh-operations. Sad that we can't
        support SPKI/PKCS8 formats at this moment due to lack of necessary
        support in the underlying crypto library. Bug 169318 is tracking the
        issue. Also, this patch fixes minor bugs while importing JWK keys for
        HMAC/RSA.

        Tests: crypto/subtle/ec-export-key-malformed-parameters.html
               crypto/subtle/ec-import-jwk-key-export-jwk-key-private.html
               crypto/subtle/ec-import-jwk-key-export-jwk-key-public.html
               crypto/subtle/ec-import-jwk-key-export-raw-key.html
               crypto/subtle/ec-import-key-malformed-parameters.html
               crypto/subtle/ec-import-raw-key-export-jwk-key.html
               crypto/subtle/ec-import-raw-key-export-raw-key.html
               crypto/subtle/ecdh-generate-export-jwk-key-p256.html
               crypto/subtle/ecdh-generate-export-jwk-key-p384.html
               crypto/subtle/ecdh-generate-export-key-raw-p256.html
               crypto/subtle/ecdh-generate-export-key-raw-p384.html
               crypto/subtle/ecdh-import-jwk-key-minimum.html
               crypto/subtle/ecdh-import-jwk-private-key-p256.html
               crypto/subtle/ecdh-import-jwk-private-key-p384.html
               crypto/subtle/ecdh-import-jwk-public-key-p256.html
               crypto/subtle/ecdh-import-jwk-public-key-p384.html
               crypto/subtle/ecdh-import-raw-key-p256.html
               crypto/subtle/ecdh-import-raw-key-p384.html
               crypto/workers/subtle/ec-generate-export-jwk-key.html
               crypto/workers/subtle/ec-generate-export-raw-key.html
               crypto/workers/subtle/ec-import-jwk-key-private.html
               crypto/workers/subtle/ec-import-jwk-key-public.html
               crypto/workers/subtle/ec-import-raw-key.html

        * bindings/js/JSSubtleCryptoCustom.cpp:
        (WebCore::normalizeCryptoAlgorithmParameters):
        (WebCore::supportExportKeyThrow):
        Added EC family support.
        * crypto/CommonCryptoUtilities.h:
        Added needed CommonCrypto SPIs.
        * crypto/CryptoAlgorithm.h:
        * crypto/algorithms/CryptoAlgorithmECDH.cpp:
        (WebCore::CryptoAlgorithmECDH::importKey):
        (WebCore::CryptoAlgorithmECDH::exportKey):
        * crypto/algorithms/CryptoAlgorithmECDH.h:
        * crypto/gnutls/CryptoKeyECGnuTLS.cpp:
        (WebCore::CryptoKeyEC::keySizeInBits):
        (WebCore::CryptoKeyEC::exportRaw):
        (WebCore::CryptoKeyEC::platformImportRaw):
        (WebCore::CryptoKeyEC::platformImportJWKPublic):
        (WebCore::CryptoKeyEC::platformImportJWKPrivate):
        (WebCore::CryptoKeyEC::platformAddFieldElements):
        Faked implementations for GTK+.
        * crypto/keys/CryptoKeyEC.cpp:
        (WebCore::toNamedCurve):
        (WebCore::CryptoKeyEC::generatePair):
        (WebCore::CryptoKeyEC::importRaw):
        (WebCore::CryptoKeyEC::importJwk):
        (WebCore::CryptoKeyEC::exportJwk):
        * crypto/keys/CryptoKeyEC.h:
        * crypto/keys/CryptoKeyHMAC.cpp:
        (WebCore::CryptoKeyHMAC::importJwk):
        Fixed a bug.
        * crypto/keys/CryptoKeyRSA.cpp:
        (WebCore::CryptoKeyRSA::importJwk):
        Fixed a bug.
        * crypto/mac/CryptoKeyECMac.cpp:
        (WebCore::doesUncompressedPointMatchNamedCurve):
        (WebCore::doesFieldElementMatchNamedCurve):
        (WebCore::getKeySizeFromNamedCurve):
        (WebCore::CryptoKeyEC::~CryptoKeyEC):
        (WebCore::CryptoKeyEC::keySizeInBits):
        (WebCore::CryptoKeyEC::exportRaw):
        (WebCore::CryptoKeyEC::platformGeneratePair):
        (WebCore::CryptoKeyEC::platformImportRaw):
        (WebCore::CryptoKeyEC::platformImportJWKPublic):
        (WebCore::CryptoKeyEC::platformImportJWKPrivate):
        (WebCore::CryptoKeyEC::platformAddFieldElements):

2017-03-07  Youenn Fablet  <youenn@apple.com>

        WebRTC can be used even if getUserMedia is off
        https://bugs.webkit.org/show_bug.cgi?id=169303

        Reviewed by Alex Christensen.

        * page/RuntimeEnabledFeatures.h:
        (WebCore::RuntimeEnabledFeatures::peerConnectionEnabled): No longer tieing peerConnectionEnabled to
        mediaStreamEnabled.

2017-03-07  Dean Jackson  <dino@apple.com>

        Make platformDevice() not inline, to avoid a
        weak external symbol issue on newer compilers/linkers

        * platform/graphics/cocoa/GPUDeviceMetal.mm:
        (WebCore::GPUDevice::platformDevice):
        * platform/graphics/gpu/GPUDevice.h:
        (WebCore::GPUDevice::platformDevice): Deleted.

2017-03-07  Dean Jackson  <dino@apple.com>

        Some platforms won't be able to create a GPUDevice
        https://bugs.webkit.org/show_bug.cgi?id=169314
        <rdar://problems/30907521>

        Reviewed by Jon Lee.

        Protect for the case where the hardware doesn't support Metal. And
        we might as well disable WebGPU completely in the iOS simulator
        for now.

        * Configurations/FeatureDefines.xcconfig:
        * platform/graphics/cocoa/GPUDeviceMetal.mm:
        (WebCore::GPUDevice::GPUDevice):
        * platform/graphics/gpu/GPUDevice.cpp:
        (WebCore::GPUDevice::create):

2017-03-07  Maureen Daum  <mdaum@apple.com>

        Correctly check for an empty database file.
        <rdar://problem/30542242> Removing Website Data not working (WebSQL directories being left behind)
        https://bugs.webkit.org/show_bug.cgi?id=169256

        Reviewed by Brady Eidson.

        Tests: DatabaseTrackerTest.DeleteDatabaseFileIfEmpty verifies that we actually delete an empty file.

        Instead of checking that a database file's size is zero bytes, we should check if it contains
        any tables. Once we open an empty database file and set its journal mode to WAL, it will have a
        valid SQLite header and therefore will no longer be empty. We can know that the database was empty
        if it does not contain any tables.

        * Modules/webdatabase/DatabaseTracker.cpp:
        (WebCore::DatabaseTracker::deleteDatabaseFileIfEmpty):
        Use BEGIN EXCLUSIVE TRANSACTION in order to obtain the exclusive lock. If the database doesn't contain
        any tables, it is empty and can be deleted.

2017-03-07  Alex Christensen  <achristensen@webkit.org>

        [URLParser] Fix file URLs that are just file:// and a Windows drive letter
        https://bugs.webkit.org/show_bug.cgi?id=169242

        Reviewed by Tim Horton.

        This is specified in https://url.spec.whatwg.org/#file-host-state and tested by a newly-passing
        web platform test.  I added the check for the windows drive quirk in the FileHost state of the
        parser but I forgot it when FileHost is the terminal state.

        * platform/URLParser.cpp:
        (WebCore::URLParser::parse):

2017-03-07  Chris Dumez  <cdumez@apple.com>

        Drop non-standard MessageEvent.webkitInitMessageEvent()
        https://bugs.webkit.org/show_bug.cgi?id=169295

        Reviewed by Joseph Pecoraro.

        Drop non-standard MessageEvent.webkitInitMessageEvent().

        Chrome dropped it almost 3 years ago. They had UseCounter data showing
        consistent 0% usage:
        - https://groups.google.com/a/chromium.org/forum/#!topic/blink-dev/H6lsGFqdy3Y
        - https://www.chromestatus.com/metrics/feature/timeline/popularity/223
        - https://src.chromium.org/viewvc/blink?revision=174967&view=revision

        * bindings/js/JSMessageEventCustom.cpp:
        (WebCore::handleInitMessageEvent): Deleted.
        (WebCore::JSMessageEvent::webkitInitMessageEvent): Deleted.
        * dom/MessageEvent.idl:

2017-03-07  Chris Dumez  <cdumez@apple.com>

        Label of an <option> element should not be displayed in quirks mode
        https://bugs.webkit.org/show_bug.cgi?id=169296
        <rdar://problem/30900751>

        Reviewed by Simon Fraser.

        Label of an <option> element should not be displayed in quirks mode, to
        match Chrome and Firefox. However, we should still display the label in
        strict mode, as per the HTML specification:
        - https://html.spec.whatwg.org/multipage/rendering.html#the-select-element-2

        Chrome renders the label in strict mode, same as us. Firefox does not:
        - https://bugzilla.mozilla.org/show_bug.cgi?id=1345242

        Tests: fast/dom/HTMLOptionElement/option-label-quirksmode.html
               fast/dom/HTMLOptionElement/option-label-quirksmode2.html
               fast/dom/HTMLOptionElement/option-label-strictmode.html

        * html/HTMLOptionElement.cpp:
        (WebCore::HTMLOptionElement::displayLabel):
        (WebCore::HTMLOptionElement::textIndentedToRespectGroupLabel):
        * html/HTMLOptionElement.h:

2017-03-07  Dean Jackson  <dino@apple.com>

        Add GPUDevice implementation and WebGPULayer
        https://bugs.webkit.org/show_bug.cgi?id=169219
        <rdar://problem/30879048>

        Reviewed by Sam Weinig.

        Add a basic implementation of a GPUDevice object,
        which references a MTLDevice. Also add a WebGPULayer
        that will ultimately be used to host WebGPU content.

        WebKit API Test: WebCore/mac/GPUDevice.mm

        * Configurations/WebCore.xcconfig: Link to Metal.

        * PlatformMac.cmake: New files.
        * WebCore.xcodeproj/project.pbxproj:

        * platform/Logging.h: Add a WebGPU logging channel.

        * platform/graphics/cocoa/GPUDeviceMetal.mm: Added.
        (WebCore::GPUDevice::GPUDevice): Cocoa implementation.
        (WebCore::GPUDevice::reshape):
        * platform/graphics/cocoa/WebGPULayer.h: Added.
        * platform/graphics/cocoa/WebGPULayer.mm: Added.
        (-[WebGPULayer initWithGPUDevice:]):
        (-[WebGPULayer copyImageSnapshotWithColorSpace:]):
        (-[WebGPULayer display]):
        * platform/graphics/gpu/GPUDevice.cpp: Added.
        (WebCore::GPUDevice::create):
        (WebCore::GPUDevice::~GPUDevice):
        (WebCore::GPUDevice::GPUDevice): Implementation for platforms
        other than Mac and iOS hardware.
        (WebCore::GPUDevice::reshape):
        * platform/graphics/gpu/GPUDevice.h: Added.
        (WebCore::GPUDevice::platformLayer):
        (WebCore::GPUDevice::platformDevice):
        (WebCore::GPUDevice::layer):

2017-03-07  Antoine Quint  <graouts@apple.com>

        [Modern Media Controls] Log an error to the console when an image fails to load
        https://bugs.webkit.org/show_bug.cgi?id=169292

        Reviewed by Dean Jackson.

        In order to help debug flaky tests we now log the image source when an image fails to load.

        * Modules/modern-media-controls/controls/icon-button.js:
        (IconButton.prototype.handleEvent):
        (IconButton.prototype._loadImage):

2017-03-07  Zalan Bujtas  <zalan@apple.com>

        Simple line layout: Do not use invalid m_lastNonWhitespaceFragment while removing trailing whitespace.
        https://bugs.webkit.org/show_bug.cgi?id=169288
        rdar://problem/30576976

        Reviewed by Antti Koivisto.

        When the current line has nothing but whitespace, m_lastNonWhitespaceFragment is invalid so
        we should not use the start/end values to decide how many characters we need to revert.
        This patch makes m_lastNonWhitespaceFragment optional. When it's invalid we just remove
        all the runs from the current line since they are all considered whitespace runs.

        Test: fast/text/simple-line-layout-line-is-all-whitespace.html

        * rendering/SimpleLineLayout.cpp:
        (WebCore::SimpleLineLayout::revertAllRunsOnCurrentLine):
        (WebCore::SimpleLineLayout::LineState::removeTrailingWhitespace):

2017-03-07  Alex Christensen  <achristensen@webkit.org>

        [Content Extensions] Rename "Domain" to "Condition" where appropriate
        https://bugs.webkit.org/show_bug.cgi?id=169297

        Reviewed by Brady Eidson.

        In r184116 I added the ability for a content blocker author to add conditions to the triggers,
        if-domain and unless-domain which look at the domain of the main document URL.
        I plan to add more conditions soon to run regexes on the entire URL, but to make that patch more
        manageable, I took the non-behavior-changing parts and put them in this patch.

        No change in behavior except some error messages were made more generic.

        * contentextensions/CompiledContentExtension.h:
        * contentextensions/ContentExtension.cpp:
        (WebCore::ContentExtensions::ContentExtension::ContentExtension):
        (WebCore::ContentExtensions::ContentExtension::compileGlobalDisplayNoneStyleSheet):
        (WebCore::ContentExtensions::ContentExtension::populateConditionCacheIfNeeded):
        Pass the main document URL instead of just the domain.  No change in behavior yet.
        (WebCore::ContentExtensions::ContentExtension::cachedConditionedActions):
        (WebCore::ContentExtensions::ContentExtension::universalActionsWithConditions):
        (WebCore::ContentExtensions::ContentExtension::populateDomainCacheIfNeeded): Deleted.
        (WebCore::ContentExtensions::ContentExtension::cachedDomainActions): Deleted.
        (WebCore::ContentExtensions::ContentExtension::universalActionsWithDomains): Deleted.
        * contentextensions/ContentExtension.h:
        (WebCore::ContentExtensions::ContentExtension::universalActionsWithoutConditions):
        (WebCore::ContentExtensions::ContentExtension::universalActionsWithoutDomains): Deleted.
        * contentextensions/ContentExtensionCompiler.cpp:
        (WebCore::ContentExtensions::serializeActions):
        (WebCore::ContentExtensions::compileRuleList):
        * contentextensions/ContentExtensionCompiler.h:
        * contentextensions/ContentExtensionError.cpp:
        (WebCore::ContentExtensions::contentExtensionErrorCategory):
        * contentextensions/ContentExtensionError.h:
        * contentextensions/ContentExtensionParser.cpp:
        (WebCore::ContentExtensions::getStringList):
        Don't pass the error type as a parameter.  It's always JSONInvalidConditionList.
        (WebCore::ContentExtensions::getDomainList):
        (WebCore::ContentExtensions::loadTrigger):
        * contentextensions/ContentExtensionRule.h:
        (WebCore::ContentExtensions::Trigger::~Trigger):
        (WebCore::ContentExtensions::Trigger::isEmpty):
        (WebCore::ContentExtensions::Trigger::operator==):
        (WebCore::ContentExtensions::TriggerHash::hash):
        Use bitwise xor instead of bitwise or to have fewer hash collisions.
        Also, before we were accidentally doing the same hash operation here for IfDomain and UnlessDomain.
        This caused unnecessary hash collisions.  This is fixed, but should not change any behavior.
        * contentextensions/ContentExtensionsBackend.cpp:
        (WebCore::ContentExtensions::ContentExtensionsBackend::actionsForResourceLoad):
        * contentextensions/DFABytecode.h:
        (WebCore::ContentExtensions::instructionSizeWithArguments):
        * contentextensions/DFABytecodeCompiler.cpp:
        (WebCore::ContentExtensions::DFABytecodeCompiler::emitAppendAction):
        * contentextensions/DFABytecodeInterpreter.cpp:
        (WebCore::ContentExtensions::matchesCondition):
        (WebCore::ContentExtensions::DFABytecodeInterpreter::interpretAppendAction):
        (WebCore::ContentExtensions::DFABytecodeInterpreter::interpretTestFlagsAndAppendAction):
        (WebCore::ContentExtensions::DFABytecodeInterpreter::actionsMatchingEverything):
        (WebCore::ContentExtensions::DFABytecodeInterpreter::interpretWithConditions):
        (WebCore::ContentExtensions::DFABytecodeInterpreter::interpret):
        (WebCore::ContentExtensions::matchesDomain): Deleted.
        (WebCore::ContentExtensions::DFABytecodeInterpreter::interpretWithDomains): Deleted.
        * contentextensions/DFABytecodeInterpreter.h:
        * loader/ResourceLoadInfo.h:

2017-03-07  Michael Catanzaro  <mcatanzaro@igalia.com>

        [FreeType] FontPlatformData::fallbacks() returns unprepared FcPatterns
        https://bugs.webkit.org/show_bug.cgi?id=164689

        Reviewed by Carlos Garcia Campos.

        From the documentation of FcFontSort():

        """The returned FcFontSet references FcPattern structures which may be shared by the
        return value from multiple FcFontSort calls, applications must not modify these patterns.
        Instead, they should be passed, along with p to FcFontRenderPrepare which combines them into
        a complete pattern."""

        That means each call to FcFontSort() must be followed up by a call to FcFontRenderPrepare(),
        else the patterns will lack information about how to draw the font properly.

        * platform/graphics/freetype/FontPlatformDataFreeType.cpp:
        (WebCore::FontPlatformData::fallbacks):

2017-03-07  Myles C. Maxfield  <mmaxfield@apple.com>

        Parsing font descriptors inside @font-face needs to accept ranges
        https://bugs.webkit.org/show_bug.cgi?id=168893

        Reviewed by Dean Jackson.

        Parse font-weight, font-stretch, and font-style ranges according to
        https://drafts.csswg.org/css-fonts-4/#font-prop-desc. There is one difference, though:
        as documented in https://github.com/w3c/csswg-drafts/issues/783, slashes are a better
        delimiters than hyphens, so this patch implements that instead. I'll update the spec to
        include slashes as soon as possible.

        Because this patch is all about creating FontSelectionValues from fonts, it doesn't
        actually modify the font selection algorithm, and therefore only tests the creation of
        these new values. The font selection algorithm itself is already tested elsewhere.

        This new work is behind the ENABLE(VARIATION_FONTS) flag.

        Test: fast/text/font-selection-font-face-parse.html

        * css/CSSFontFace.cpp:
        (WebCore::calculateWeightRange):
        (WebCore::calculateStretchRange):
        (WebCore::calculateItalicRange):
        * css/parser/CSSPropertyParser.cpp:
        (WebCore::consumeFontWeightRange):
        (WebCore::consumeFontStretchRange):
        (WebCore::consumeFontStyleRange):
        (WebCore::CSSPropertyParser::parseFontFaceDescriptor):
        * platform/graphics/cocoa/FontCacheCoreText.cpp:
        (WebCore::extractVariationBounds):
        (WebCore::variationCapabilitiesForFontDescriptor):
        (WebCore::capabilitiesForFontDescriptor):

2017-03-07  Dave Hyatt  <hyatt@apple.com>

        Animated GIFs fail to play in multi-column layout
        https://bugs.webkit.org/show_bug.cgi?id=167901
        <rdar://problem/30382262>

        Reviewed by Zalan Bujtas.

        * rendering/RenderBox.cpp:
        (WebCore::RenderBox::computeRectForRepaint):
        Make sure to handle the case where we pass in a null repaintContainer and need
        to cross a multicolumn flow thread -> region boundary as a result.

2017-03-07  Fujii Hironori  <Hironori.Fujii@sony.com>

        ShadowBlur::calculateLayerBoundingRect doesn't need to return the enclosingIntRect of layerRect
        https://bugs.webkit.org/show_bug.cgi?id=168650

        Reviewed by Simon Fraser.

        No new tests, no behavior change.

        * platform/graphics/ShadowBlur.h: Change the type of return value
        from IntRect to IntSize.
        * platform/graphics/ShadowBlur.cpp:
        (WebCore::ShadowBlur::calculateLayerBoundingRect): Ditto.
        (WebCore::ShadowBlur::drawRectShadow): Rename a variable layerRect layerSize.
        (WebCore::ShadowBlur::drawInsetShadow): Ditto.
        (WebCore::ShadowBlur::drawRectShadowWithoutTiling): Ditto.
        (WebCore::ShadowBlur::drawInsetShadowWithoutTiling): Ditto.
        (WebCore::ShadowBlur::beginShadowLayer): Ditto.

2017-03-07  Chris Dumez  <cdumez@apple.com>

        Replace debug assertion with release one in Frame::setView()
        https://bugs.webkit.org/show_bug.cgi?id=169189

        Reviewed by Ryosuke Niwa.

        Replace debug assertion with release one in Frame::setView() to make make sure the
        document does not have a living render tree. This will help identify possible
        remaining cases where this can happen.

        * dom/Document.cpp:
        (WebCore::Document::didBecomeCurrentDocumentInView): Deleted.
        * dom/Document.h:
        * page/Frame.cpp:
        (WebCore::Frame::setView):

2017-03-07  Youenn Fablet  <youenn@apple.com>

        Expose WebRTC current/pending description getters
        https://bugs.webkit.org/show_bug.cgi?id=169216

        Reviewed by Alex Christensen.

        Test: webrtc/descriptionGetters.html

        Implement pending and current description getters through libwebrtc.
        These getters do not yet match the spec as can be seen from the test, which is written to match the implemented behavior.

        * Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.cpp:
        (WebCore::LibWebRTCPeerConnectionBackend::currentLocalDescription):
        (WebCore::LibWebRTCPeerConnectionBackend::currentRemoteDescription):
        (WebCore::LibWebRTCPeerConnectionBackend::pendingLocalDescription):
        (WebCore::LibWebRTCPeerConnectionBackend::pendingRemoteDescription):
        * Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.h:

2017-03-07  Chris Dumez  <cdumez@apple.com>

        Port DOMTimer from std::chrono::milliseconds to WTF::Seconds type
        https://bugs.webkit.org/show_bug.cgi?id=169236

        Reviewed by Simon Fraser.

        * dom/Document.cpp:
        (WebCore::Document::minimumDOMTimerInterval):
        (WebCore::Document::timerAlignmentInterval):
        * dom/Document.h:
        * dom/ScriptExecutionContext.cpp:
        (WebCore::ScriptExecutionContext::adjustMinimumDOMTimerInterval):
        (WebCore::ScriptExecutionContext::minimumDOMTimerInterval):
        (WebCore::ScriptExecutionContext::timerAlignmentInterval):
        * dom/ScriptExecutionContext.h:
        * inspector/InspectorInstrumentation.cpp:
        (WebCore::InspectorInstrumentation::didInstallTimerImpl):
        * inspector/InspectorInstrumentation.h:
        (WebCore::InspectorInstrumentation::didInstallTimer):
        * inspector/InspectorTimelineAgent.cpp:
        (WebCore::InspectorTimelineAgent::didInstallTimer):
        * inspector/InspectorTimelineAgent.h:
        * inspector/TimelineRecordFactory.cpp:
        (WebCore::TimelineRecordFactory::createTimerInstallData):
        * inspector/TimelineRecordFactory.h:
        * page/DOMTimer.cpp:
        (WebCore::shouldForwardUserGesture):
        (WebCore::userGestureTokenToForward):
        (WebCore::DOMTimer::DOMTimer):
        (WebCore::DOMTimer::install):
        (WebCore::DOMTimer::intervalClampedToMinimum):
        (WebCore::DOMTimer::alignedFireTime):
        * page/DOMTimer.h:
        * page/DOMWindow.cpp:
        (WebCore::DOMWindow::setTimeout):
        (WebCore::DOMWindow::setInterval):
        * page/Page.cpp:
        (WebCore::Page::setTimerThrottlingState):
        (WebCore::Page::setDOMTimerAlignmentIntervalIncreaseLimit):
        (WebCore::Page::updateDOMTimerAlignmentInterval):
        * page/Page.h:
        (WebCore::Page::domTimerAlignmentInterval):
        * page/Settings.cpp:
        (WebCore::Settings::setMinimumDOMTimerInterval):
        * page/Settings.h:
        (WebCore::Settings::minimumDOMTimerInterval):
        * page/SuspendableTimer.h:
        (WebCore::SuspendableTimer::startRepeating):
        (WebCore::SuspendableTimer::startOneShot):
        (WebCore::SuspendableTimer::augmentFireInterval):
        (WebCore::SuspendableTimer::augmentRepeatInterval):
        * platform/Timer.cpp:
        (WebCore::TimerBase::setNextFireTime):
        * platform/Timer.h:
        (WebCore::TimerBase::alignedFireTime):
        * testing/InternalSettings.cpp:
        (WebCore::InternalSettings::setMinimumTimerInterval):
        * testing/InternalSettings.h:
        * testing/Internals.cpp:
        (WebCore::Internals::isTimerThrottled):
        * workers/WorkerGlobalScope.cpp:
        (WebCore::WorkerGlobalScope::setTimeout):
        (WebCore::WorkerGlobalScope::setInterval):

2017-03-07  Chris Dumez  <cdumez@apple.com>

        Align initEvent / initCustomEvent / initMessageEvent with the latest specification
        https://bugs.webkit.org/show_bug.cgi?id=169176

        Reviewed by Alex Christensen.

        Align initEvent / initCustomEvent / initMessageEvent with the latest specification
        after:
        - https://github.com/whatwg/dom/pull/417
        - https://github.com/whatwg/html/pull/2410

        In particular, the following changes were made:
        - initEvent: The length property now properly returns 1 instead of 3 as only the
          first parameter is mandatory. We were already behaving correcting the the length
          property value was wrong because we forgot to drop a hack from the bindings
          generator.
        - initCustomEvent: Make all parameters except the first optional. Previously, all
          parameters were mandatory so this is safe.
        - initMessageEvent: Drop the custom code and mark the first parameter as mandatory.
          A side effect of dropping the custom code is that null is no longer considered as
          valid input for the last parameter. The parameter is of type sequence<> and the
          new behavior is consistent with the specification and Firefox. If it turns out to
          break existing content, I'll make the parameter nullable in a follow-up.

        No new tests, updated existing tests.

        * bindings/js/JSMessageEventCustom.cpp:
        * bindings/scripts/CodeGeneratorJS.pm:
        (GeneratePropertiesHashTable):
        * dom/CustomEvent.idl:
        * dom/MessageEvent.idl:

2017-03-07  Antti Koivisto  <antti@apple.com>

        Differentiate between pending head and body stylesheets in Style::Scope
        https://bugs.webkit.org/show_bug.cgi?id=169277

        Reviewed by Andreas Kling.

        Split pending stylesheet node set into separate sets for head and body elements and processing instructions.

        This tightens typing and will also be useful later.

        * style/StyleScope.cpp:
        (WebCore::Style::Scope::~Scope):
        (WebCore::Style::Scope::addPendingSheet):
        (WebCore::Style::Scope::removePendingSheet):
        (WebCore::Style::Scope::didRemovePendingStylesheet):
        (WebCore::Style::Scope::hasPendingSheet):
        (WebCore::Style::Scope::hasPendingSheetInBody):
        (WebCore::Style::Scope::hasProcessingInstructionWithPendingSheet): Deleted.
        * style/StyleScope.h:
        (WebCore::Style::Scope::hasPendingSheet): Deleted.
        (WebCore::Style::Scope::hasPendingSheets): Deleted.
        * style/StyleTreeResolver.cpp:
        (WebCore::Style::hasLoadingStylesheet):

            Just test for body stylesheets.

        (WebCore::Style::TreeResolver::resolve):

            Treat all before-body stylesheets uniformly.

2017-03-07  Antoine Quint  <graouts@apple.com>

        [Modern Media Controls] Setting a valid source after an invalid one retains the invalid placard
        https://bugs.webkit.org/show_bug.cgi?id=169280
        <rdar://problem/30876078>

        Reviewed by Jon Lee.

        We need to track when a new load start to see if we might have recovered from an error
        and hide the "invalid" placard.

        Test: media/modern-media-controls/placard-support/placard-support-error-recover.html

        * Modules/modern-media-controls/media/placard-support.js:
        (PlacardSupport.prototype.get mediaEvents):

2017-03-07  Andy Estes  <aestes@apple.com>

        REGRESSION (r213412): JPEG premultiplication tests fail under GuardMalloc
        https://bugs.webkit.org/show_bug.cgi?id=169266

        Reviewed by Tim Horton.

        r213412 added functions to create a CGImageRef from a canvas image buffer, which were used
        to create data: URLs and blobs. If JPEG premultiplication is applied, though,
        WebCore::cgImage() would return an image with a data provider pointing to stack memory.

        I fixed a similar issue in ImageBuffer::toCGImage() by leaking the reference to a
        Uint8ClampedArray then creating a CGDataProviderRef with a releaseData function that adopts
        the leaked reference.

        We could take that approach in cgImage() too by allocating the premultiplied data buffer on
        the heap then freeing it with a releaseData function, but it's simpler to refactor
        toCGImage()/cgImage() to return an encoded image as a CFDataRef instead of a CFImageRef.
        This ensures that a CGDataProviderRef never outlives the data it points to.

        Covered by existing tests.

        * platform/graphics/ImageBuffer.h: Renamed toCGImage() to toCFData().
        * platform/graphics/cg/ImageBufferCG.cpp:
        (WebCore::dataURL): Changed to take a CFDataRef.
        (WebCore::dataVector): Renamed from data(). Changed to take a CFDataRef.
        (WebCore::ImageBuffer::toDataURL): Changed to call toCFData().
        (WebCore::ImageBuffer::toData): Ditto.
        (WebCore::ImageBuffer::toCFData): Changed to return a CFDataRef after encoding the
        CGImageRef that was previously returned.
        (WebCore::cfData): Ditto.
        (WebCore::dataURL): Changed to call cfData().
        (WebCore::data): Ditto.
        (WebCore::ImageBuffer::toCGImage): Renamed to ImageBuffer::toCFData().
        (WebCore::cgImage): Renamed to WebCore::cfData().

2017-03-07  Myles C. Maxfield  <mmaxfield@apple.com>

        Test fix after r213505
        https://bugs.webkit.org/show_bug.cgi?id=169267

        Unreviewed.

        * platform/graphics/cocoa/FontCacheCoreText.cpp:
        (WebCore::preparePlatformFont):

2017-03-06  Myles C. Maxfield  <mmaxfield@apple.com>

        Apply well-known-axis variation values at the right time in preparePlatformFont()
        https://bugs.webkit.org/show_bug.cgi?id=168896

        Reviewed by Jon Lee.

        Simply plumb the FontSelectionRequest to the place where font variations are implemented.

        Test: fast/text/variations/font-selection-properties.html

        * platform/graphics/FontCache.h:
        * platform/graphics/cocoa/FontCacheCoreText.cpp:
        (WebCore::preparePlatformFont):
        (WebCore::fontWithFamily):
        (WebCore::FontCache::createFontPlatformData):
        (WebCore::FontCache::systemFallbackForCharacters):
        * platform/graphics/mac/FontCustomPlatformData.cpp:
        (WebCore::FontCustomPlatformData::fontPlatformData):

2017-03-06  Myles C. Maxfield  <mmaxfield@apple.com>

        Unreviewed post-review fixup after r213464
        https://bugs.webkit.org/show_bug.cgi?id=169255

        * platform/graphics/FontCache.h:
        (WebCore::FontDescriptionKey::FontDescriptionKey):
        (WebCore::FontDescriptionKey::operator==):
        (WebCore::FontDescriptionKey::computeHash):
        (WebCore::FontDescriptionKey::makeFlagsKey):
        * platform/graphics/cocoa/FontCacheCoreText.cpp:
        (WebCore::computeNecessarySynthesis):

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-06  Myles C. Maxfield  <mmaxfield@apple.com>

        Update isEmojiGroupCandidate() to the latest version of Unicode
        https://bugs.webkit.org/show_bug.cgi?id=168198

        Reviewed by Jon Lee.

        In the latest version of Unicode, many more code points are candidates for emoji groups.
        Therefore, isEmojiGroupCandidate() should be made more permissive. This way, the function
        is more future-proof.

        Test: editing/deleting/delete-emoji.html

        * platform/text/CharacterProperties.h:
        (WebCore::icuLibraryUnderstandsSupplementalSymbolsAndPictographs):
        (WebCore::isEmojiGroupCandidate):

2017-03-06  Youenn Fablet  <youenn@apple.com>

        Use default configuration for libwebrtc peerconnection
        https://bugs.webkit.org/show_bug.cgi?id=169239

        Reviewed by Alex Christensen.

        * Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.cpp:
        (WebCore::configurationFromMediaEndpointConfiguration): Using the default configuration instead of the aggressive one.

2017-03-06  Fujii Hironori  <Hironori.Fujii@sony.com>

        [CMake] SN-DBS fails to build: Cannot open include file: 'WebCoreTestSupportPrefix.h'
        https://bugs.webkit.org/show_bug.cgi?id=169244

        Reviewed by Alex Christensen.

        A distributed build system SN-DBS can not find
        WebCoreTestSupportPrefix.h without an include path to it.

        * CMakeLists.txt: Add 'WebCore/testing/js' to include paths.

2017-03-06  Fujii Hironori  <Hironori.Fujii@sony.com>

        [cairo] error C2065: 'quality': undeclared identifier since r213412
        https://bugs.webkit.org/show_bug.cgi?id=169240

        Reviewed by Ryosuke Niwa.

        * platform/graphics/cairo/ImageBufferCairo.cpp:
        (WebCore::ImageBuffer::toDataURL): Name the unnamed second argument 'quality'.

2017-03-06  Jiewen Tan  <jiewen_tan@apple.com>

        [WebCrypto] Implement ECDH GenerateKey operation
        https://bugs.webkit.org/show_bug.cgi?id=169093
        <rdar://problem/23789585>

        Reviewed by Brent Fulgham.

        This patch implements GenerateKey operation of ECDH according to:
        https://www.w3.org/TR/WebCryptoAPI/#ecdh-operations.
        Note: Sad that we are not able to support P-521 at this moment due
        to lack of necessary support in the underlying crypto library.

        Tests: crypto/subtle/ec-generate-key-malformed-parameters.html
               crypto/subtle/ecdh-generate-key-extractable.html
               crypto/subtle/ecdh-generate-key-p256.html
               crypto/subtle/ecdh-generate-key-p384.html
               crypto/subtle/ecdh-generate-key-single-usage.html
               crypto/workers/subtle/ec-generate-key.html

        * CMakeLists.txt:
        * DerivedSources.make:
        * PlatformGTK.cmake:
        * PlatformMac.cmake:
        * WebCore.xcodeproj/project.pbxproj:
        * bindings/js/JSCryptoKeyCustom.cpp:
        (WebCore::JSCryptoKey::algorithm):
        * bindings/js/JSSubtleCryptoCustom.cpp:
        (WebCore::normalizeCryptoAlgorithmParameters):
        (WebCore::jsSubtleCryptoFunctionGenerateKeyPromise):
        Add support for ECDH.
        * bindings/js/SerializedScriptValue.cpp:
        (WebCore::CloneSerializer::write):
        Structured clonable will be added later on.
        * crypto/CommonCryptoUtilities.h:
        Add SPI for EC.
        * crypto/CryptoAlgorithmParameters.h:
        * crypto/CryptoKey.h:
        * crypto/algorithms/CryptoAlgorithmECDH.cpp: Added.
        (WebCore::CryptoAlgorithmECDH::create):
        (WebCore::CryptoAlgorithmECDH::identifier):
        (WebCore::CryptoAlgorithmECDH::generateKey):
        * crypto/algorithms/CryptoAlgorithmECDH.h: Added.
        * crypto/gnutls/CryptoKeyECGnuTLS.cpp: Added.
        (WebCore::CryptoKeyEC::~CryptoKeyEC):
        (WebCore::CryptoKeyEC::platformGeneratePair):
        * crypto/keys/CryptoKeyEC.cpp: Added.
        (WebCore::CryptoKeyEC::CryptoKeyEC):
        (WebCore::CryptoKeyEC::generatePair):
        (WebCore::CryptoKeyEC::buildAlgorithm):
        (WebCore::CryptoKeyEC::exportData):
        * crypto/keys/CryptoKeyEC.h: Added.
        (WebCore::EcKeyAlgorithm::EcKeyAlgorithm):
        (WebCore::EcKeyAlgorithm::namedCurve):
        * crypto/mac/CryptoAlgorithmRegistryMac.cpp:
        (WebCore::CryptoAlgorithmRegistry::platformRegisterAlgorithms):
        Add support for ECDH.
        * crypto/mac/CryptoKeyECMac.cpp: Added.
        (WebCore::CryptoKeyEC::~CryptoKeyEC):
        (WebCore::CryptoKeyEC::platformGeneratePair):
        * crypto/parameters/CryptoAlgorithmEcKeyParams.h: Added.
        * crypto/parameters/EcKeyParams.idl: Added.

2017-03-06  Michael Catanzaro  <mcatanzaro@igalia.com>

        Unreviewed, fix unused parameter warning after r213464

        * platform/graphics/freetype/FontCacheFreeType.cpp:
        (WebCore::FontCache::getFontSelectionCapabilitiesInFamily):

2017-03-06  Michael Saboff  <msaboff@apple.com>

        Take advantage of fast permissions switching of JIT memory for devices that support it
        https://bugs.webkit.org/show_bug.cgi?id=169155

        Reviewed by Saam Barati.

        Updated the Xcode config files to match what is in the JavaScriptCore ones.

        * Configurations/Base.xcconfig:
        * Configurations/FeatureDefines.xcconfig:
        * Configurations/WebCore.xcconfig:

2017-03-06  Aakash Jain  <aakash_jain@apple.com>

        Make WKMenuItemIdentifiersPrivate.h private header
        https://bugs.webkit.org/show_bug.cgi?id=168981

        Reviewed by Tim Horton.

        * platform/spi/mac/NSMenuSPI.h: NSUserInterfaceItemIdentification is in the public header in recent SDKs.

2017-03-06  Dave Hyatt  <hyatt@apple.com>

        REGRESSION: Block no longer shrinks to preferred width in this flex box layout
        https://bugs.webkit.org/show_bug.cgi?id=169203
        <rdar://problem/30873895>

        Reviewed by Simon Fraser.

        Added new test in css3/flexbox.

        * css/StyleResolver.cpp:
        (WebCore::StyleResolver::adjustRenderStyle):
        (WebCore::StyleResolver::adjustStyleForAlignment):
        * html/shadow/TextControlInnerElements.cpp:
        (WebCore::TextControlInnerElement::resolveCustomStyle):
        Resolve auto alignment values by adjusting the render style as needed. Make a helper
        function for adjusting only alignment that can be called from the inner text control
        custom style creation.

        * rendering/GridTrackSizingAlgorithm.cpp:
        (WebCore::GridTrackSizingAlgorithmStrategy::minSizeForChild):
        Replaced items in grids should not stretch by default.

        * rendering/RenderBox.cpp:
        (WebCore::RenderBox::hasStretchedLogicalWidth):
        Patched to properly check the default alignment for the child, making sure
        that if it's a replacd item inside a grid, that the default is start and not
        stretch.

        * rendering/RenderBox.h:
        (WebCore::RenderBox::selfAlignmentNormalBehavior):
        Self-alignment function now takes an optional child argument, since the behavior
        varies in grids depending on the child being replaced or not.

        * rendering/RenderFlexibleBox.cpp:
        (WebCore::RenderFlexibleBox::alignmentForChild):
        Fixed to do the right thing when the child is anonymous.

        (WebCore::RenderFlexibleBox::styleDidChange): Deleted.
        * rendering/RenderFlexibleBox.h:
        Deleted, since alignment changes are handled at the style diff level now.

        * rendering/RenderFullScreen.h:
        Patched the selfAlignmentNormalBehavior method to take an optional child argument.

        * rendering/RenderGrid.cpp:
        (WebCore::RenderGrid::styleDidChange):
        (WebCore::RenderGrid::alignSelfForChild):
        (WebCore::RenderGrid::justifySelfForChild):
        (WebCore::RenderGrid::columnAxisPositionForChild):
        (WebCore::RenderGrid::rowAxisPositionForChild):
        (WebCore::RenderGrid::columnAxisOffsetForChild):
        (WebCore::RenderGrid::rowAxisOffsetForChild):
        (WebCore::defaultAlignmentIsStretch): Deleted.
        (WebCore::defaultAlignmentChangedToStretchInRowAxis): Deleted.
        (WebCore::defaultAlignmentChangedFromStretchInRowAxis): Deleted.
        (WebCore::defaultAlignmentChangedFromStretchInColumnAxis): Deleted.
        (WebCore::selfAlignmentChangedToStretchInRowAxis): Deleted.
        (WebCore::selfAlignmentChangedFromStretchInRowAxis): Deleted.
        (WebCore::selfAlignmentChangedFromStretchInColumnAxis): Deleted.
        * rendering/RenderGrid.h:
        Removed the alignment change logic in styleDidChange for grids, since style diffing handles
        it now. Updated all selfAlignmentForNormalBehavior queries to pass in the child so that
        replaced elements are handled properly.

        * rendering/style/RenderStyle.h:
        (WebCore::RenderStyle::overflowInlineDirection):
        (WebCore::RenderStyle::overflowBlockDirection):
        (WebCore::RenderStyle::setJustifySelfPosition):
        New helpers used by grid and by adjustRenderStyle.

        * style/StyleChange.cpp:
        (WebCore::Style::determineChange):
        If alignment or justification changes occur on a parent that could affect the child (e.g., align-items)
        return Inherit so the child render styles get adjusted properly.

2017-03-06  Youenn Fablet  <youenn@apple.com>

        ASSERTION FAILED: numberOfChannels == 2 in WebCore::RealtimeIncomingAudioSource::OnData
        https://bugs.webkit.org/show_bug.cgi?id=169224
        <rdar://problem/30856811>

        Reviewed by Alex Christensen.

        * platform/mediastream/mac/RealtimeIncomingAudioSource.cpp:
        (WebCore::RealtimeIncomingAudioSource::OnData): Updated assertion to allow 1 channel since we can handle it as well.

2017-03-06  Chris Dumez  <cdumez@apple.com>

        [iOS] Throttle CSS animations to 30fps in low power mode
        https://bugs.webkit.org/show_bug.cgi?id=169138
        <rdar://problem/30837805>

        Reviewed by Said Abou-Hallawa.

        Throttle software CSS animations to 30fps in low power mode on iOS
        to save battery.

        Test: fast/animation/css-animation-throttling-lowPowerMode.html

        * page/Page.cpp:
        (WebCore::Page::handleLowModePowerChange):
        * page/animation/CSSAnimationController.cpp:
        (WebCore::CSSAnimationControllerPrivate::CSSAnimationControllerPrivate):
        (WebCore::CSSAnimationControllerPrivate::updateAnimationTimer):
        (WebCore::CSSAnimationControllerPrivate::updateThrottlingState):
        (WebCore::CSSAnimationControllerPrivate::animationInterval):
        (WebCore::CSSAnimationControllerPrivate::beginAnimationUpdateTime):
        (WebCore::CSSAnimationControllerPrivate::beginAnimationUpdate):
        (WebCore::CSSAnimationController::updateThrottlingState):
        (WebCore::CSSAnimationController::animationInterval):
        * page/animation/CSSAnimationController.h:
        * page/animation/CSSAnimationControllerPrivate.h:
        * testing/Internals.cpp:
        (WebCore::Internals::animationsInterval):
        * testing/Internals.h:
        * testing/Internals.idl:

2017-03-03  Matt Rajca  <mrajca@apple.com>

        Media: notify clients when the user never plays a media element that was prevented from auto-playing
        https://bugs.webkit.org/show_bug.cgi?id=169150

        Reviewed by Alex Christensen.

        Added API tests.

        * html/HTMLMediaElement.cpp:
        (WebCore::HTMLMediaElement::mediaPlayerTimeChanged):
        (WebCore::HTMLMediaElement::stopWithoutDestroyingMediaPlayer):
        * page/AutoplayEvent.h:

2017-03-06  Alex Christensen  <achristensen@webkit.org>

        Refactor ContentExtensionParser
        https://bugs.webkit.org/show_bug.cgi?id=169214

        Reviewed by Brady Eidson.

        No change in behavior, as verified by existing API tests.
        This will make it easier to use getStringList for other things in coming patches.

        * contentextensions/ContentExtensionParser.cpp:
        (WebCore::ContentExtensions::getStringList):
        (WebCore::ContentExtensions::getDomainList):

2017-03-06  Alex Christensen  <achristensen@webkit.org>

        Fix URLs relative to file URLs with paths beginning with Windows drive letters
        https://bugs.webkit.org/show_bug.cgi?id=169178

        Reviewed by Tim Horton.

        Windows drives in file URLs can begin with windows drive letters, such as file:///C:/
        which should not be removed when making other URLs relative to them.
        See https://url.spec.whatwg.org/#file-slash-state

        Covered by new API tests and newly passing web-platform-tests.

        * platform/URLParser.cpp:
        (WebCore::URLParser::copyBaseWindowsDriveLetter):
        (WebCore::URLParser::copyASCIIStringUntil):
        (WebCore::URLParser::parse):
        * platform/URLParser.h:

2017-03-06  Simon Fraser  <simon.fraser@apple.com>

        Only use layer backing store which supports subpixel antialiased text if we know subpixel antialiased will be painted into it
        https://bugs.webkit.org/show_bug.cgi?id=169191

        Reviewed by Zalan Bujtas.

        Instead of unconditionally calling setSupportsSubpixelAntialiasedText() on GraphicsLayers created
        by RenderLayerBacking, only do so when we know (or suspect) that a layer contains smoothed text.
        
        This is done by enhancing RenderLayer::isVisuallyNonEmpty() and RenderLayer::hasNonEmptyChildRenderers()
        to take a PaintedContentRequest parameter, which allows the caller to specify what qualities of
        the layer contents it is interested in. Most of the time, this is just any painted content, but on
        platforms where GraphicsLayer::supportsSubpixelAntialiasedLayerText() returns true, the query also
        asks about whether the layer will contain subpixel-antialiased text. In this case, it can't early
        return as soon as painted content is found; it must keep iterating renderers while all the query 
        requests are unsatisfied, or until it hits depth or sibling limits. If a limit is hit, we take the
        same path of assuming there is subpixel-antialiased text (via the "Undetermined" state).

        RenderLayerBacking also makes use of PaintedContentRequest during its non-composited child layer walk.

        To offset the additional cost of this tree walking, RenderLayerBacking now caches information about its
        painted content for the duration of a single update via PaintedContentsInfo, so we no longer call
        isDirectlyCompositedImage() and isSimpleContainerCompositingLayer() multiple times per backing per update.
        The traversal code here too now has to continue until all necessary states in the request have been computed.
        
        Add some functions to RenderImage so that we know if it's showing the alt text or has a non-bitmap image
        (which may contain text).
        
        Subpixel-antialiased ("smoothed") text is disabled by DRT and WTR by default, so we need Internals API to enable it.
        
        Platforms now express their support for subpixel-antialiased text via GraphicsLayer::supportsSubpixelAntialiasedLayerText()
        which only returns true on Mac.

        Tests: compositing/contents-format/subpixel-antialiased-text-configs-antialiasing-style.html
               compositing/contents-format/subpixel-antialiased-text-configs.html
               compositing/contents-format/subpixel-antialiased-text-images.html
               compositing/contents-format/subpixel-antialiased-text-visibility.html

        * platform/graphics/GraphicsLayer.cpp:
        (WebCore::GraphicsLayer::supportsSubpixelAntialiasedLayerText):
        * platform/graphics/GraphicsLayer.h:
        * platform/graphics/ca/GraphicsLayerCA.cpp:
        (WebCore::GraphicsLayer::supportsSubpixelAntialiasedLayerText):
        (WebCore::GraphicsLayerCA::changeLayerTypeTo):
        * rendering/RenderImage.cpp:
        (WebCore::RenderImage::isShowingMissingOrImageError):
        (WebCore::RenderImage::isShowingAltText):
        (WebCore::RenderImage::hasNonBitmapImage):
        * rendering/RenderImage.h:
        * rendering/RenderLayer.cpp:
        (WebCore::RenderLayer::calculateClipRects):
        * rendering/RenderLayer.h:
        * rendering/RenderLayerBacking.cpp:
        (WebCore::PaintedContentsInfo::PaintedContentsInfo):
        (WebCore::PaintedContentsInfo::setWantsSubpixelAntialiasedTextState):
        (WebCore::PaintedContentsInfo::paintsBoxDecorations):
        (WebCore::PaintedContentsInfo::paintsContent):
        (WebCore::PaintedContentsInfo::paintsSubpixelAntialiasedText):
        (WebCore::PaintedContentsInfo::isSimpleContainer):
        (WebCore::PaintedContentsInfo::isDirectlyCompositedImage):
        (WebCore::PaintedContentsInfo::paintsBoxDecorationsDetermination):
        (WebCore::PaintedContentsInfo::paintsContentDetermination):
        (WebCore::PaintedContentsInfo::paintsSubpixelAntialiasedTextDetermination):
        (WebCore::PaintedContentsInfo::contentsTypeDetermination):
        (WebCore::RenderLayerBacking::createGraphicsLayer):
        (WebCore::RenderLayerBacking::updateConfiguration):
        (WebCore::RenderLayerBacking::computeParentGraphicsLayerRect):
        (WebCore::RenderLayerBacking::updateAfterDescendants):
        (WebCore::RenderLayerBacking::updateDirectlyCompositedBoxDecorations):
        (WebCore::RenderLayerBacking::updateDrawsContent):
        (WebCore::RenderLayerBacking::updateDirectlyCompositedBackgroundColor):
        (WebCore::RenderLayerBacking::updateDirectlyCompositedBackgroundImage):
        (WebCore::RenderLayerBacking::paintsContent):
        (WebCore::RenderLayerBacking::isSimpleContainerCompositingLayer):
        (WebCore::RenderLayerBacking::isPaintDestinationForDescendantLayers):
        (WebCore::RenderLayerBacking::hasVisibleNonCompositedDescendants):
        (WebCore::RenderLayerBacking::containsPaintedContent):
        (WebCore::RenderLayerBacking::contentChanged):
        (WebCore::RenderLayerBacking::updateImageContents):
        (WebCore::RenderLayerBacking::paintsChildRenderers): Deleted.
        * rendering/RenderLayerBacking.h:
        * rendering/RenderLayerCompositor.cpp:
        (WebCore::RenderLayerCompositor::logLayerInfo):
        * testing/Internals.cpp:
        (WebCore::Internals::setFontSmoothingEnabled):
        * testing/Internals.h:
        * testing/Internals.idl:

2017-03-06  Myles C. Maxfield  <mmaxfield@apple.com>

        Expand font-weight and font-stretch to take any number
        https://bugs.webkit.org/show_bug.cgi?id=168889

        Reviewed by Simon Fraser.

        This patch expands parsing support for font-weight and font-stretch so that they can accept
        numbers in addition to the keyword values they accepted previously. Eventually, these numbers
        will be used as inputs to select variation fonts; however, in this patch, the values are just
        parsed and held in our internal data model. This means that this patch doesn't actually change
        the general behavior of WebKit; instead, it parses new values, outputs them (via
        getComputedStyle() and similar functions), and provides them as input to our preexisting font
        selection algorithm. 

        This patch doesn't actually modify anything algorithmically, and therefore, it doesn't include
        any additional tests for the font selection algorithm. Instead, it tests the parsing of the
        newly accepted values (both input and output).

        Because our internal data model needs to hold numbers now, this patch also completely eliminates
        the FontWidth, FontItalic, and FontTraitsMask enum values in favor of FontSelectionValues (which
        can hold numbers instead of individual enum values). Therefore, every place which we were using
        these enum values is migrated in this patch to using FontSelectionValues instead.

        Tests: fast/text/font-selection-font-face-parse.html
               fast/text/font-selection-font-loading-api-parse.html
               fast/text/font-style-parse.html
               fast/text/font-weight-parse.html

        * accessibility/AccessibilityRenderObject.cpp: Migrate off of old enum types.
        (WebCore::AccessibilityRenderObject::hasBoldFont):
        (WebCore::AccessibilityRenderObject::hasItalicFont):
        (WebCore::AccessibilityRenderObject::hasPlainText):
        * accessibility/atk/WebKitAccessibleInterfaceText.cpp: Ditto.
        (getAttributeSetForAccessibilityObject):
        * css/CSSComputedStyleDeclaration.cpp: Output newly parsed values.
        (WebCore::fontWeightFromStyle):
        (WebCore::fontStretchFromStyle):
        (WebCore::fontStyleFromStyle):
        (WebCore::fontShorthandValueForSelectionProperties):
        (WebCore::ComputedStyleExtractor::propertyValue):
        * css/CSSFontFace.cpp: Migrate off old enum types.
        (WebCore::calculateWeightRange):
        (WebCore::CSSFontFace::setWeight):
        (WebCore::calculateStretchRange):
        (WebCore::CSSFontFace::setStretch):
        (WebCore::calculateStyleRange):
        (WebCore::CSSFontFace::setStyle):
        (WebCore::CSSFontFace::calculateStyleMask): Deleted.
        (WebCore::CSSFontFace::calculateWeightMask): Deleted.
        (WebCore::CSSFontFace::calculateStretch): Deleted.
        * css/CSSFontFace.h:
        * css/CSSFontFaceSet.cpp: Migrate off old enum types.
        (WebCore::CSSFontFaceSet::ensureLocalFontFacesForFamilyRegistered):
        (WebCore::calculateWeightValue):
        (WebCore::calculateStretchValue):
        (WebCore::calculateStyleValue):
        (WebCore::computeFontSelectionRequest):
        (WebCore::CSSFontFaceSet::matchingFaces):
        (WebCore::CSSFontFaceSet::fontFace):
        (WebCore::computeFontTraitsMask): Deleted.
        (WebCore::computeFontStretch): Deleted.
        * css/CSSFontFaceSet.h:
        * css/CSSFontSelector.cpp: Migrate off old enum types.
        (WebCore::CSSFontSelector::fontRangesForFamily):
        * css/CSSPrimitiveValueMappings.h: font-weight and font-style are no longer
        keyword properties.
        (WebCore::CSSPrimitiveValue::operator FontWeight): Deleted.
        (WebCore::CSSPrimitiveValue::operator FontItalic): Deleted.
        * css/CSSProperties.json: Use the same infrastructure for all three of the
        font selection properties.
        * css/CSSSegmentedFontFace.cpp: Migrate off old enum types.
        (WebCore::CSSSegmentedFontFace::fontRanges):
        * css/CSSValueKeywords.in: The 100-based font-weight values are now represented
        as real numbers.
        * css/FontFace.cpp: Update the string output functions for the new values.
        (WebCore::rangeIsSingleValue):
        (WebCore::FontFace::style):
        (WebCore::FontFace::weight):
        (WebCore::FontFace::stretch):
        * css/StyleBuilderConverter.h: Use CSSValue conversion functions to convert
        to our new data model.
        (WebCore::StyleBuilderConverter::convertFontWeight):
        (WebCore::StyleBuilderConverter::convertFontStretch):
        (WebCore::StyleBuilderConverter::convertFontStyle):
        * css/StyleBuilderCustom.h: font-weight is no longer a completely custom
        property.
        (WebCore::StyleBuilderCustom::applyInitialFontWeight): Deleted.
        (WebCore::StyleBuilderCustom::applyInheritFontWeight): Deleted.
        (WebCore::StyleBuilderCustom::applyValueFontWeight): Deleted.
        * css/parser/CSSParserFastPaths.cpp: font-style is no longer a keyword property.
        (WebCore::CSSParserFastPaths::isValidKeywordPropertyAndValue):
        (WebCore::CSSParserFastPaths::isKeywordPropertyID):
        * css/parser/CSSPropertyParser.cpp: Parse the new values in the font selection
        properties.
        (WebCore::consumeFontWeightKeywordValue):
        (WebCore::consumeFontWeightCSS21):
        (WebCore::consumeFontWeight):
        (WebCore::consumeFontStyleKeywordValue):
        (WebCore::consumeFontStyle):
        (WebCore::CSSPropertyParser::parseSingleValue):
        (WebCore::CSSPropertyParser::parseFontFaceDescriptor):
        (WebCore::CSSPropertyParser::consumeSystemFont):
        (WebCore::CSSPropertyParser::consumeFont):
        * editing/EditingStyle.cpp: Migrate off old enum types.
        (WebCore::fontWeightIsBold):
        * editing/mac/EditorMac.mm: Ditto.
        (WebCore::Editor::applyFontStyles):
        * platform/graphics/FontCache.h: Unify our font selection values into
        their enclosing struct, FontSelectionCapabilities. Also, clean up utility
        functions.
        * platform/graphics/FontCascade.cpp: Migrate off old enum types.
        (WebCore::FontCascade::FontCascade):
        * platform/graphics/FontCascade.h: Ditto.
        (WebCore::FontCascade::italic):
        (WebCore::FontCascade::weight):
        * platform/graphics/FontDescription.cpp: Ditto.
        (WebCore::FontDescription::FontDescription):
        (WebCore::FontCascadeDescription::lighterWeight):
        (WebCore::FontCascadeDescription::bolderWeight):
        (WebCore::FontDescription::traitsMask): Deleted.
        * platform/graphics/FontDescription.h: Migrate off old enum types.
        (WebCore::FontDescription::italic):
        (WebCore::FontDescription::stretch):
        (WebCore::FontDescription::weight):
        (WebCore::FontDescription::fontSelectionRequest):
        (WebCore::FontDescription::computedPixelSize):
        (WebCore::FontDescription::setItalic):
        (WebCore::FontDescription::setStretch):
        (WebCore::FontDescription::setIsItalic):
        (WebCore::FontDescription::setWeight):
        (WebCore::FontDescription::operator==):
        (WebCore::FontCascadeDescription::lighterWeight):
        (WebCore::FontCascadeDescription::bolderWeight):
        (WebCore::FontCascadeDescription::initialItalic):
        (WebCore::FontCascadeDescription::initialWeight):
        (WebCore::FontCascadeDescription::initialStretch):
        * platform/graphics/FontSelectionAlgorithm.cpp: Delete code which was only
        present to convert from the old enum types to the new FontSelectionRequest
        type.
        (WebCore::fontSelectionRequestForTraitsMask): Deleted.
        (WebCore::initialFontSelectionCapabilitiesForTraitsMask): Deleted.
        (WebCore::fontSelectionCapabilitiesForTraitsMask): Deleted.
        * platform/graphics/FontSelectionAlgorithm.h: Migrate to new named functions
        for special values.
        (WebCore::isItalic):
        (WebCore::boldWeightValue):
        (WebCore::normalWeightValue):
        (WebCore::isFontWeightBold):
        (WebCore::normalStretchValue):
        (WebCore::FontSelectionRequest::FontSelectionRequest):
        * platform/graphics/cocoa/FontCacheCoreText.cpp: Migrate all platforms which
        compile this file to know about FontDatabase. This simplifies the interaction
        between @font-face fonts and installed fonts. Also, migrate off old enum types.
        (WebCore::stretchFromCoreTextTraits):
        (WebCore::fontWeightFromCoreText):
        (WebCore::capabilitiesForFontDescriptor):
        (WebCore::FontCache::getFontSelectionCapabilitiesInFamily):
        (WebCore::platformFontLookupWithFamily):
        (WebCore::invalidateFontCache):
        (WebCore::fontWithFamily):
        (WebCore::FontCache::createFontPlatformData):
        (WebCore::lookupFallbackFont):
        (WebCore::toTraitsMask): Deleted.
        (WebCore::isFontWeightBold): Deleted.
        (WebCore::toCoreTextFontWeight): Deleted.
        (): Deleted.
        (WebCore::FontDatabase::capabilitiesForFontDescriptor): Deleted.
        (WebCore::calculateFontSelectionRequest): Deleted.
        * platform/graphics/freetype/FontCacheFreeType.cpp: Migrate off old enum types.
        (WebCore::FontCache::getFontSelectionCapabilitiesInFamily):
        (WebCore::fontWeightToFontconfigWeight):
        (): Deleted.
        * platform/graphics/freetype/FontPlatformDataFreeType.cpp: Ditto.
        (WebCore::FontPlatformData::FontPlatformData):
        * platform/graphics/ios/FontCacheIOS.mm: Ditto.
        (WebCore::baseSystemFontDescriptor):
        (WebCore::systemFontModificationAttributes):
        (WebCore::systemFontDescriptor):
        (WebCore::platformFontWithFamilySpecialCase):
        (WebCore::FontCache::weightOfCTFont): Deleted.
        * platform/graphics/mac/FontCacheMac.mm: Ditto.
        (WebCore::toNSFontWeight):
        (WebCore::platformFontWithFamilySpecialCase):
        * platform/graphics/win/FontCacheWin.cpp: Ditto.
        (WebCore::toGDIFontWeight):
        (WebCore::traitsInFamilyEnumProc):
        (WebCore::FontCache::getFontSelectionCapabilitiesInFamily):
        (): Deleted.
        * platform/mock/MockRealtimeVideoSource.cpp: Ditto.
        (WebCore::MockRealtimeVideoSource::applySize):
        * platform/text/TextFlags.h: Delete old enum types.
        * platform/win/DragImageWin.cpp: Migrate off old enum types.
        (WebCore::dragLabelFont):
        * rendering/RenderEmbeddedObject.cpp: Ditto.
        (WebCore::RenderEmbeddedObject::getReplacementTextGeometry):
        * rendering/RenderThemeGtk.cpp: Ditto.
        (WebCore::RenderThemeGtk::updateCachedSystemFontDescription):
        * rendering/RenderThemeIOS.mm: Ditto.
        (WebCore::RenderThemeIOS::updateCachedSystemFontDescription):
        * rendering/RenderThemeMac.mm: Ditto.
        (WebCore::toFontWeight):
        * rendering/RenderThemeWin.cpp: Ditto.
        (WebCore::fillFontDescription):

2017-03-06  Chris Dumez  <cdumez@apple.com>

        [iOS] Disable autoplay of silent videos in low power mode
        https://bugs.webkit.org/show_bug.cgi?id=168985
        <rdar://problem/30739051>

        Reviewed by Jer Noble.

        Disable autoplay of silent videos in low power mode on iOS to save battery.
        We force the display of the start button when denying autoplay in low power
        mode to allow the user to start playback.

        Test: media/modern-media-controls/start-support/start-support-lowPowerMode.html

        * Modules/mediacontrols/MediaControlsHost.cpp:
        (WebCore::MediaControlsHost::shouldForceControlsDisplay):
        * Modules/mediacontrols/MediaControlsHost.h:
        * Modules/mediacontrols/MediaControlsHost.idl:
        Add shouldForceControlsDisplay property on MediaControlsHost. This property
        is set to true when we want to force the display for media controls. Currently,
        this only returns true for autoplay videos, while in low power mode.

        * Modules/modern-media-controls/media/controls-visibility-support.js:
        (ControlsVisibilitySupport.prototype._updateControls):
        Take into consideration MediaControlsHost.shouldForceControlsDisplay when
        initializing shouldShowControls variable.

        * Modules/modern-media-controls/media/start-support.js:
        (StartSupport.prototype._shouldShowStartButton):
        Show the start button when MediaControlsHost.shouldForceControlsDisplay
        returns true.

        * html/HTMLMediaElement.cpp:
        (WebCore::HTMLMediaElement::HTMLMediaElement):
        Add MediaElementSession::RequireUserGestureForVideoDueToLowPowerMode restriction
        to the session when low power mode is enabled so we know we need to force a
        gesture to start playback of autoplay videos.

        (WebCore::HTMLMediaElement::shouldForceControlsDisplay):
        Add convenience function to decide if we should force display of media controls.
        This returns true if the media element is a video with autoplay attribute and
        its session has the MediaElementSession::RequireUserGestureForVideoDueToLowPowerMode
        restriction (i.e. we are in low power mode).

        (WebCore::HTMLMediaElement::configureMediaControls):
        Force requireControls variable to true if shouldForceControlsDisplay() returns
        true. We do this here instead of inside HTMLMediaElement::controls() because
        we do not want to change the value of media.controls exposed to JavaScript.

        (WebCore::HTMLMediaElement::removeBehaviorsRestrictionsAfterFirstUserGesture):
        Add MediaElementSession::RequireUserGestureForVideoDueToLowPowerMode to the list
        of restrictions that get removed on user gesture.

        * html/MediaElementSession.cpp:
        (WebCore::MediaElementSession::playbackPermitted):
        Deny playback for videos that have the RequireUserGestureForVideoDueToLowPowerMode
        restriction unless there is a user gesture.

        * html/MediaElementSession.h:
        Add new MediaElementSession::RequireUserGestureForVideoDueToLowPowerMode
        restriction.

2017-03-06  Chris Dumez  <cdumez@apple.com>

        LayoutTest fast/dom/timer-throttling-hidden-page.html is a flaky failure
        https://bugs.webkit.org/show_bug.cgi?id=168927

        Reviewed by Simon Fraser.

        Update internals.isTimerThrottled() to return true for any kind of throttling.
        It used to only account only for specific timers that do not cause changes
        inside the viewport. It now accounts for all kind of throttling, such as
        timer alignment due to the page being hidden.

        * page/DOMTimer.h:
        * testing/Internals.cpp:
        (WebCore::Internals::isTimerThrottled):

2017-03-06  Dave Hyatt  <hyatt@apple.com>

        Enable fieldsets to be flexboxes, grids and multicolumn.
        https://bugs.webkit.org/show_bug.cgi?id=169082

        Reviewed by Simon Fraser .

        Added new tests in fast/forms/fieldset.

        This patch eliminates RenderFieldset and moves the functionality into RenderBlock so that
        derived classes can also be fieldsets.

        * CMakeLists.txt:
        * WebCore.xcodeproj/project.pbxproj:
        Remove RenderFieldset from the project.

        * accessibility/AccessibilityRenderObject.cpp:
        (WebCore::AccessibilityRenderObject::titleUIElement):
        Call in to RenderBlock now instead of RenderFieldset.

        * html/HTMLFieldSetElement.cpp:
        (WebCore::HTMLFieldSetElement::createElementRenderer):
        * html/HTMLFieldSetElement.h:
        The fieldset DOM element now uses RenderElement::createFor to make renderers so that multiple display types
        can be supported. A special flag has been added that indicates only to make flexbox and block-related
        renderers (not table display types).

        * rendering/OrderIterator.cpp:
        (WebCore::OrderIterator::shouldSkipChild):
        (WebCore::OrderIteratorPopulator::collectChild):
        * rendering/OrderIterator.h:
        Streamline child collection for flexboxes and grids to indicate whether the child should be skipped as a return
        value from collectChild. Add a shouldSkipChild method that skips both out of flow positioned objects and
        excluded children like the legends of fieldsets.

        * rendering/RenderBlock.cpp:
        (WebCore::RenderBlockRareData::RenderBlockRareData):
        When the legend is taller than the fieldset's borderBefore(), intrinsic border is added to the CSS border width.
        This intrinsic border being factored in ensures that the padding and content boxes of fieldsets are correct
        across any layout system, since the legend is now just treated as part of the border.

        (WebCore::RenderBlock::computePreferredLogicalWidths):
        (WebCore::RenderBlock::computeBlockPreferredLogicalWidths):
        Call the new computePreferredWidthsForExcludedChildren to ensure that excluded children contribute to
        preferred width in their own way and not as part of a specific layout system.

        (WebCore::RenderBlock::renderName):
        Hacked to still return RenderFieldSet for RenderBlockFlow-backed fieldsets for layout test compatibility.

        (WebCore::RenderBlock::layoutExcludedChildren):
        Renamed from layoutSpecialExcludedChild to more accurately reflect the fact that multiple excluded children
        can be included here (e.g., both a multicolumn flow thread and a legend). The RenderBlock base class handles
        the layout of legends by both placing them and setting the correct intrinsic border before amount on the
        block.

        (WebCore::RenderBlock::findFieldsetLegend):
        Moved from RenderFieldset.

        (WebCore::RenderBlock::adjustBorderBoxRectForPainting):
        (WebCore::RenderBlock::paintRectToClipOutFromBorder):
        These methods are used when painting to shrink the border box as needed to account for the legend and to
        provide the portion of the border that needs to be clipped out. These methods have been enhanced to
        properly support all writing modes.

        (WebCore::RenderBlock::intrinsicBorderForFieldset):
        (WebCore::RenderBlock::setIntrinsicBorderForFieldset):
        (WebCore::RenderBlock::borderTop):
        (WebCore::RenderBlock::borderLeft):
        (WebCore::RenderBlock::borderBottom):
        (WebCore::RenderBlock::borderRight):
        (WebCore::RenderBlock::borderBefore):
        These methods are overridden for border to ensure that the intrinsic border added by a tall legend is
        properly factored in.

        (WebCore::RenderBlock::computePreferredWidthsForExcludedChildren):
        * rendering/RenderBlock.h:
        This method computes the preferred widths for legend children in order to ensure that the legend properly
        grows the width of the fieldset when it is the widest item.

        (WebCore::RenderBlock::adjustBorderBoxLogicalHeightForBoxSizing):
        (WebCore::RenderBlock::adjustContentBoxLogicalHeightForBoxSizing):
        Preserve the behavior of fieldsets in that the available content size includes the space lost accounting
        for the legend. I don't think this makes much sense, but it matches the behavior of other browsers
        (and our old behavior).

        (WebCore::RenderBlock::paintExcludedChildrenInBorder):
        Method for painting the excluded children that might be present in our border. We only do this if the
        paint phase is a box decoration painting phase and if the legend isn't self-painting.

        * rendering/RenderBlockFlow.cpp:
        (WebCore::RenderBlockFlow::willCreateColumns):
        Allow fieldsets to create columns now.

        (WebCore::RenderBlockFlow::layoutBlockChildren):
        (WebCore::RenderBlockFlow::layoutExcludedChildren):
        Renamed this method and change it to call the base class to ensure that legends in multicolumn fieldsets
        get handled properly.

        (WebCore::RenderBlockFlow::addChild):
        Patched to make sure legends don't get put into the multicolumn flow thread, as they need to
        remain outside of it.

        (WebCore::RenderBlockFlow::layoutSpecialExcludedChild): Deleted.
        Renamed to layoutExcludedChildren.

        * rendering/RenderBlockFlow.h:
        * rendering/RenderBox.cpp:
        (WebCore::RenderBox::paintBoxDecorations):
        (WebCore::RenderBox::paintMask):
        Patched to call the new adjustBorderBoxRectForPainting and paintRectToClipOutFromBorder methods in
        order to properly shrink the border box rect for painting and to clip out the portion of the border
        covered by the legend.

        (WebCore::RenderBox::avoidsFloats):
        Add fieldsets as avoiding floats. RenderFieldset used to subclass this method to return true, but with
        its removal, we need to put this in the base class along with legends.

        * rendering/RenderBox.h:
        (WebCore::RenderBox::isGridItem):
        (WebCore::RenderBox::isFlexItem):
        Patched to exclude legends so that they don't try to size like they are really in the grid or flexbox.

        (WebCore::RenderBox::adjustBorderBoxRectForPainting):
        This method is overridden by RenderBLock to handle adjusting fieldset border rects for painting.

        * rendering/RenderBoxModelObject.cpp:
        (WebCore::RenderBoxModelObject::paintBorder):
        * rendering/RenderBoxModelObject.h:
        (WebCore::RenderBoxModelObject::paintRectToClipOutFromBorder):
        Patched to properly paint fieldsets using the new helpers.

        * rendering/RenderDeprecatedFlexibleBox.cpp:
        (WebCore::FlexBoxIterator::next):
        (WebCore::RenderDeprecatedFlexibleBox::layoutBlock):
        (WebCore::RenderDeprecatedFlexibleBox::layoutHorizontalBox):
        Make sure deprecated flexible boxes lay out their legends properly by calling layoutExcludedChildren.

        * rendering/RenderElement.cpp:
        (WebCore::RenderElement::createFor):
        * rendering/RenderElement.h:
        Patched to take a flag that limits what renderers can be created so that fieldsets don't make table
        display types.

        * rendering/RenderFieldset.cpp: Removed.
        * rendering/RenderFieldset.h: Removed.
        Remove RenderFieldset files from the tree.

        * rendering/RenderFlexibleBox.cpp:
        (WebCore::RenderFlexibleBox::computeIntrinsicLogicalWidths):
        (WebCore::RenderFlexibleBox::firstLineBaseline):
        (WebCore::RenderFlexibleBox::layoutBlock):
        (WebCore::RenderFlexibleBox::layoutFlexItems):
        (WebCore::RenderFlexibleBox::prepareOrderIteratorAndMargins):
        Make sure flexible boxes lay out their legends properly by calling layoutExcludedChildren.
        Patch methods to use the OrderIterator's new shouldSkipChild method to ensure legends aren't
        part of the flexible box layout.

        * rendering/RenderGrid.cpp:
        (WebCore::RenderGrid::layoutBlock):
        (WebCore::RenderGrid::computeIntrinsicLogicalWidths):
        (WebCore::RenderGrid::placeItemsOnGrid):
        (WebCore::RenderGrid::populateExplicitGridAndOrderIterator):
        (WebCore::RenderGrid::layoutGridItems):
        Make sure grids lay out their legends properly by calling layoutExcludedChildren.
        Patch methods to use the OrderIterator's new shouldSkipChild method to ensure legends aren't
        part of the grid's layout.

        * rendering/RenderMultiColumnFlowThread.cpp:
        (WebCore::RenderMultiColumnFlowThread::populate):
        Pull legends back up into the block and don't let them be part of the flow thread.

        * rendering/RenderMultiColumnSet.cpp:
        (WebCore::RenderMultiColumnSet::requiresBalancing):
        Fix an assert to allow legends to exist as siblings of multicolumn sets.

        * rendering/RenderObject.cpp:
        (WebCore::RenderObject::isFieldset):
        Changed to examine the HTML element rather than RenderFieldset.

        * rendering/RenderObject.h:
        (WebCore::RenderObject::isExcludedFromNormalLayout):
        (WebCore::RenderObject::setIsExcludedFromNormalLayout):
        (WebCore::RenderObject::RenderObjectBitfields::RenderObjectBitfields):
        RenderObjects now have a new bit that is set for excluded objects like legends, flow threads,
        placeholders, and ruby text. This bit lets code easily detect that an object is excluded from
        the layout system and can be skipped.

        (WebCore::RenderObject::isExcludedAndPlacedInBorder):
        Helper method for asking if an object is painting inside the border. Used to know we
        need to factor it into preferred width calculations outside of any one layout system
        and also to know that we need to paint it when we paint the fieldset's border instead of
        later (after we might have scrolled or clipped the child painting area).

        * rendering/RenderRubyRun.cpp:
        (WebCore::RenderRubyRun::layoutExcludedChildren):
        (WebCore::RenderRubyRun::layoutSpecialExcludedChild): Deleted.
        * rendering/RenderRubyRun.h:
        Rename layoutSpecialExcludedChild to layoutExcludedChildren.

        * rendering/RenderTable.cpp:
        (WebCore::RenderTable::adjustBorderBoxRectForPainting):
        (WebCore::RenderTable::paintBoxDecorations):
        (WebCore::RenderTable::paintMask):
        (WebCore::RenderTable::subtractCaptionRect): Deleted.
        * rendering/RenderTable.h:
        Patched tables to share the same border box rect adjustment used by fieldsets when subtracting
        out captions. This is prep work to allow tables to be fieldsets, but for now I didn't go all the
        way.

        * rendering/RenderTableCell.cpp:
        (WebCore::RenderTableCell::paintBoxDecorations):
        (WebCore::RenderTableCell::paintMask):
        Make sure table cells adjust their border box rects for painting. Again this is prep work for
        cells potentially being fieldsets, but not supported yet.

        * rendering/RenderTextControl.cpp:
        (WebCore::RenderTextControl::layoutExcludedChildren):
        (WebCore::RenderTextControl::layoutSpecialExcludedChild): Deleted.
        * rendering/RenderTextControl.h:
        * rendering/RenderTextControlMultiLine.cpp:
        (WebCore::RenderTextControlMultiLine::layoutExcludedChildren):
        (WebCore::RenderTextControlMultiLine::layoutSpecialExcludedChild): Deleted.
        * rendering/RenderTextControlMultiLine.h:
        Renamed the methods for doing the excluded child layout.

        * rendering/RenderTreeAsText.cpp:
        (WebCore::RenderTreeAsText::writeRenderObject):
        Make sure to dump the original fieldset border and not the border with the extra legend stuff in it.

2017-03-06  Antoine Quint  <graouts@apple.com>

        [Modern Media Controls] Tracks panel should clip and scroll content when numerous tracks are available
        https://bugs.webkit.org/show_bug.cgi?id=169201
        <rdar://problem/30867979>

        Reviewed by Eric Carlson.

        We now position and size the tracks panel dynamically and ensure a max-height is applied
        to the panel so that it allows a margin of 10px above it within the media controls. We also
        apply that same max-height to a new intermediary scrollable container for the track lists,
        so that it scrolls independently of the container and the background tint.

        Test: media/modern-media-controls/tracks-panel/tracks-panel-position-and-size.html

        * Modules/modern-media-controls/controls/macos-fullscreen-media-controls.js:
        (MacOSFullscreenMediaControls.prototype.showTracksPanel): Deleted.
        * Modules/modern-media-controls/controls/macos-inline-media-controls.css:
        (.media-controls.mac.inline .volume.slider):
        (.media-controls.mac.inline .tracks-panel): Deleted.
        * Modules/modern-media-controls/controls/macos-inline-media-controls.js:
        (MacOSInlineMediaControls.prototype.showTracksPanel): Deleted.
        * Modules/modern-media-controls/controls/macos-media-controls.js:
        (MacOSMediaControls.prototype.showTracksPanel):
        * Modules/modern-media-controls/controls/tracks-panel.css:
        (.tracks-panel > .background-tint > div,):
        (.tracks-panel > .scrollable-container):
        (.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):
        (.tracks-panel > .background-tint > div): Deleted.
        (.tracks-panel > section): Deleted.
        (.tracks-panel > section:first-of-type): Deleted.
        (.tracks-panel > section > h3): Deleted.
        (.tracks-panel > section > ul): Deleted.
        (.tracks-panel > section > ul > li): Deleted.
        (.tracks-panel > section > ul > li:focus): Deleted.
        (.tracks-panel > section > ul > li.selected:before): Deleted.
        (.tracks-panel > section > ul > li.animated): Deleted.
        * Modules/modern-media-controls/controls/tracks-panel.js:
        (TracksPanel.prototype.presentInParent):
        (TracksPanel.prototype.get maxHeight):
        (TracksPanel.prototype.set maxHeight):
        (TracksPanel.prototype.commitProperty):
        (TracksPanel.prototype._childrenFromDataSource):

2017-03-06  Manuel Rego Casasnovas  <rego@igalia.com>

        [css-grid] Stretch should grow and shrink items to fit its grid area
        https://bugs.webkit.org/show_bug.cgi?id=163200

        Reviewed by Darin Adler.

        After some discussions the CSS WG agreed that stretch should not only
        grow items, but also shrink them to fit its grid area.
        That way the "min-width|height: auto" is somehow ignored for grid items.
        More info at: https://github.com/w3c/csswg-drafts/issues/283

        The good part is that this allows us to remove some ugly code we've
        in RenderBox that was only used by Grid Layout.

        For images, we'll be stretching on both axis right now, so the aspect
        ratio won't be preserved. The default behavior might change in those
        cases, but that should be implemented in a different patch.

        * rendering/RenderBox.cpp:
        (WebCore::RenderBox::computeLogicalWidthInRegion):
        (WebCore::RenderBox::computeLogicalHeight):

2017-03-06  Miguel Gomez  <magomez@igalia.com>

        [GTK] WebProcess from WebKitGtk+ 2.15.x SIGSEVs in GIFLZWContext::doLZW(unsigned char const*, unsigned long) at Source/WebCore/platform/image-decoders/gif/GIFImageReader.cpp:303
        https://bugs.webkit.org/show_bug.cgi?id=167304

        Reviewed by Carlos Garcia Campos.

        Add a lock to ensure that the GIFImageReader that we are using for decoding is not deleted while
        the decoding thread is using it.

        No new tests.

        * platform/image-decoders/gif/GIFImageDecoder.cpp:
        (WebCore::GIFImageDecoder::clearFrameBufferCache):

2017-03-06  Antti Koivisto  <antti@apple.com>

        Allow render tree building before loading stylesheet elements
        https://bugs.webkit.org/show_bug.cgi?id=169079
        <rdar://problem/30865709>

        Reviewed by Andreas Kling.

        Currently we don't resolve style or construct renderers if there are any pending
        stylesheet loads. This patch enables style and renderer constuction up to the
        first encountered loading style element.

        This is a step toward allowing incremental rendering for in-body stylesheets.

        * dom/Document.cpp:
        (WebCore::Document::needsStyleRecalc):

            Ensure scrolling to anchor eventually happens.

        * dom/Document.h:
        (WebCore::Document::isIgnoringPendingStylesheets):
        * dom/InlineStyleSheetOwner.cpp:
        (WebCore::InlineStyleSheetOwner::createSheet):
        (WebCore::InlineStyleSheetOwner::sheetLoaded):
        (WebCore::InlineStyleSheetOwner::startLoadingDynamicSheet):
        * dom/ProcessingInstruction.cpp:
        (WebCore::ProcessingInstruction::checkStyleSheet):
        (WebCore::ProcessingInstruction::sheetLoaded):
        (WebCore::ProcessingInstruction::removedFrom):
        * html/HTMLLinkElement.cpp:
        (WebCore::HTMLLinkElement::addPendingSheet):
        (WebCore::HTMLLinkElement::removePendingSheet):
        * style/StyleScope.cpp:
        (WebCore::Style::Scope::addPendingSheet):
        (WebCore::Style::Scope::removePendingSheet):

            Track pending sheet nodes in a map so we can test if a given node has a pending sheet.
            This is also more robust in general.

        (WebCore::Style::Scope::hasProcessingInstructionWithPendingSheet):
        (WebCore::Style::Scope::updateActiveStyleSheets):
        * style/StyleScope.h:
        (WebCore::Style::Scope::hasPendingSheet):
        (WebCore::Style::Scope::hasPendingSheets):
        (WebCore::Style::Scope::addPendingSheet): Deleted.
        * style/StyleTreeResolver.cpp:
        (WebCore::Style::TreeResolver::styleForElement):

            Instead of global test for placeholder construction check the status of the pending sheet flag.

        (WebCore::Style::hasLoadingStylesheet):
        (WebCore::Style::TreeResolver::resolveComposedTree):

            Set a flag when encountering a pending top level sheet during DOM traversal.

        (WebCore::Style::TreeResolver::resolve):
        * style/StyleTreeResolver.h:
        * svg/graphics/SVGImage.cpp:
        (WebCore::SVGImage::dataChanged):

            Ensure SVG images have layout before getting the size.

2017-03-06  Vanessa Chipirrás Navalón  <vchipirras@igalia.com>

        [GStreamer] Adopt nullptr
        https://bugs.webkit.org/show_bug.cgi?id=123438

        Reviewed by Xabier Rodriguez-Calvar.

        To adapt the code to the C++11 standard, all NULL or 0 pointers have been changed to nullptr.

        * platform/audio/gstreamer/AudioDestinationGStreamer.cpp:
        (WebCore::AudioDestinationGStreamer::AudioDestinationGStreamer):
        * platform/audio/gstreamer/AudioFileReaderGStreamer.cpp:
        (WebCore::AudioFileReader::handleNewDeinterleavePad):
        (WebCore::AudioFileReader::plugDeinterleave):
        (WebCore::AudioFileReader::decodeAudioForBusCreation):
        * platform/audio/gstreamer/AudioSourceProviderGStreamer.cpp:
        (WebCore::AudioSourceProviderGStreamer::AudioSourceProviderGStreamer):
        (WebCore::AudioSourceProviderGStreamer::configureAudioBin):
        (WebCore::AudioSourceProviderGStreamer::setClient):
        (WebCore::AudioSourceProviderGStreamer::handleNewDeinterleavePad):
        * platform/audio/gstreamer/WebKitWebAudioSourceGStreamer.cpp:
        (webkit_web_audio_src_init):
        (webKitWebAudioSrcLoop):
        (webKitWebAudioSrcChangeState):
        * platform/graphics/gstreamer/AudioTrackPrivateGStreamer.cpp:
        (WebCore::AudioTrackPrivateGStreamer::setEnabled):
        * platform/graphics/gstreamer/GStreamerUtilities.cpp:
        (WebCore::initializeGStreamer):
        * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
        (WebCore::MediaPlayerPrivateGStreamer::setAudioStreamProperties):
        (WebCore::MediaPlayerPrivateGStreamer::registerMediaEngine):
        (WebCore::initializeGStreamerAndRegisterWebKitElements):
        (WebCore::MediaPlayerPrivateGStreamer::MediaPlayerPrivateGStreamer):
        (WebCore::MediaPlayerPrivateGStreamer::~MediaPlayerPrivateGStreamer):
        (WebCore::MediaPlayerPrivateGStreamer::newTextSample):
        (WebCore::MediaPlayerPrivateGStreamer::handleMessage):
        (WebCore::MediaPlayerPrivateGStreamer::processTableOfContents):
        Removed the unused second argument on processTableOfContentsEntry function.
        (WebCore::MediaPlayerPrivateGStreamer::processTableOfContentsEntry):
        Removed the unused second argument on this function.
        (WebCore::MediaPlayerPrivateGStreamer::fillTimerFired):
        (WebCore::MediaPlayerPrivateGStreamer::loadNextLocation):
        (WebCore::MediaPlayerPrivateGStreamer::createAudioSink):
        (WebCore::MediaPlayerPrivateGStreamer::createGSTPlayBin):
        * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h:
        Removed the unused second argument on processTableOfContentsEntry function.
        * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
        (WebCore::MediaPlayerPrivateGStreamerBase::MediaPlayerPrivateGStreamerBase):
        (WebCore::MediaPlayerPrivateGStreamerBase::setMuted):
        (WebCore::MediaPlayerPrivateGStreamerBase::muted):
        (WebCore::MediaPlayerPrivateGStreamerBase::notifyPlayerOfMute):
        (WebCore::MediaPlayerPrivateGStreamerBase::setStreamVolumeElement):
        (WebCore::MediaPlayerPrivateGStreamerBase::decodedFrameCount):
        (WebCore::MediaPlayerPrivateGStreamerBase::droppedFrameCount):
        * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerOwr.cpp:
        (WebCore::MediaPlayerPrivateGStreamerOwr::registerMediaEngine):
        * platform/graphics/gstreamer/TextCombinerGStreamer.cpp:
        (webkit_text_combiner_init):
        (webkitTextCombinerPadEvent):
        (webkitTextCombinerRequestNewPad):
        (webkitTextCombinerNew):
        * platform/graphics/gstreamer/TextSinkGStreamer.cpp:
        (webkitTextSinkNew):
        * platform/graphics/gstreamer/TrackPrivateBaseGStreamer.cpp:
        (WebCore::TrackPrivateBaseGStreamer::tagsChanged):
        (WebCore::TrackPrivateBaseGStreamer::notifyTrackOfActiveChanged):
        * platform/graphics/gstreamer/VideoSinkGStreamer.cpp:
        (webkit_video_sink_init):
        (webkitVideoSinkProposeAllocation):
        (webkitVideoSinkNew):
        * platform/graphics/gstreamer/VideoTrackPrivateGStreamer.cpp:
        (WebCore::VideoTrackPrivateGStreamer::setSelected):
        * platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp:
        (webkit_web_src_init):
        (webKitWebSrcDispose):
        (webKitWebSrcSetProperty):
        (webKitWebSrcStop):
        (webKitWebSrcChangeState):
        (webKitWebSrcQueryWithParent):
        (webKitWebSrcGetProtocols):
        (StreamingClient::handleResponseReceived):
        (StreamingClient::handleDataReceived):
        (ResourceHandleStreamingClient::didFail):
        (ResourceHandleStreamingClient::wasBlocked):
        (ResourceHandleStreamingClient::cannotShowURL):
        * platform/graphics/gstreamer/mse/WebKitMediaSourceGStreamer.cpp:
        (webKitMediaSrcGetProtocols):

2017-03-06  Andreas Kling  <akling@apple.com>

        [iOS] Report domains crashing under memory pressure via enhanced privacy logging.
        <https://webkit.org/b/169133>
        <rdar://problem/29964017>

        Reviewed by Antti Koivisto.

        * page/DiagnosticLoggingKeys.h:

2017-03-05  Simon Fraser  <simon.fraser@apple.com>

        Avoid backing store for layers with empty text nodes in a few more cases
        https://bugs.webkit.org/show_bug.cgi?id=169185

        Reviewed by Dan Bernstein.

        In hasPaintingNonLayerDescendants() we can check whether the RenderText's linesBoundingBox()
        is empty to avoid backing store in a few more cases. Also use containsOnlyWhitespace() rather
        than isAllCollapsibleWhitespace(), because there's no need for backing store for non-selectable
        whitespace text.

        Covered by existing tests.

        * rendering/RenderLayer.cpp:
        (WebCore::RenderLayer::calculateClipRects):

2017-03-05  Chris Dumez  <cdumez@apple.com>

        Drop unnecessary backslash in ResourceResponse::sanitizeSuggestedFilename()
        https://bugs.webkit.org/show_bug.cgi?id=169066

        Reviewed by Sam Weinig.

        Drop unnecessary backslash in ResourceResponse::sanitizeSuggestedFilename().

        * platform/network/ResourceResponseBase.cpp:
        (WebCore::ResourceResponseBase::sanitizeSuggestedFilename):

2017-03-05  Chris Dumez  <cdumez@apple.com>

        Using <form> in <template> causes following <form> to get swallowed
        https://bugs.webkit.org/show_bug.cgi?id=163552

        Reviewed by Sam Weinig.

        As per the HTML specification [1], when finding a "form" tag in the "in body"
        insertion mode, we should insert an HTML element for the token, and, if there
        is no template element on the stack of open elements, set the form element
        pointer to point to the element created.

        We were missing the "if there is no template element on the stack of open
        elements" check and setting the form element pointer unconditionally.
        This patch fixes the issue.

        [1] https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-inbody:form-element-pointer-2

        Test: fast/parser/form-after-template.html

        * html/parser/HTMLConstructionSite.cpp:
        (WebCore::HTMLConstructionSite::insertHTMLFormElement):

2017-03-04  Myles C. Maxfield  <mmaxfield@apple.com>

        Update CSSFontSelector's matching algorithm to understand ranges
        https://bugs.webkit.org/show_bug.cgi?id=168892

        Reviewed by Jon Lee.

        This patch migrates the font selection algorithm out of FontCacheCoreText and into its own file which can be shared
        among all ports. It then migrates our web font selection algorithm to use it.

        This patch doesn't actually change the parsing rules; it just changes the internal machinery for how fonts get
        selected. Therefore, this patch simply makes zero-length ranges from the discrete values the parser emits, and passes
        those zero-length ranges to the range-based font selection routine. This means that this patch doesn't actually
        change the results of the font selection algorithm.

        One of the inputs to the new font selection algorithm is font-stretch, which previously was not parsed inside
        @font-face blocks or the CSS Font Loading API. This patch therefore adds parsing support and modifies the existing
        tests for these pieces to expect parsing to work. Because the font selection algorithm itself is shared between
        installed fonts and webfonts, this patch doesn't add any additional tests for it (because it is already covered under
        existing tests).

        No new tests because there is no behavior change.

        * CMakeLists.txt:
        * WebCore.xcodeproj/project.pbxproj: Add new file for the font selection algorithm.
        * css/CSSFontFace.cpp:
        (WebCore::CSSFontFace::calculateStretch): Used on @font-face blocks and the CSS Font Loading API.
        (WebCore::CSSFontFace::setStretch): Fill out the previously stubbed function.
        * css/CSSFontFace.h: Add the range member variable to CSSFontFaces.
        * css/CSSFontFaceSet.cpp:
        (WebCore::CSSFontFaceSet::ensureLocalFontFacesForFamilyRegistered): Now that we care about font-stretch, we need to
        look it up for local fonts too. This current approach of an extra FontSelectionValue hanging around with a
        FontTraitsMask is very ugly and will be removed soon (https://bugs.webkit.org/show_bug.cgi?id=168889 and
        https://bugs.webkit.org/show_bug.cgi?id=168890).
        (WebCore::computeFontStretch): Used on @font-face blocks and the CSS Font Loading API.
        (WebCore::CSSFontFaceSet::matchingFaces): Educate about font-stretch.
        (WebCore::CSSFontFaceSet::fontFace): Migrate to the new font-selection algorithm.
        (WebCore::fontFaceComparator): Deleted.
        * css/CSSFontFaceSet.h:
        * css/CSSFontSelector.cpp:
        (WebCore::CSSFontSelector::addFontFaceRule): Educate about font-stretch.
        (WebCore::CSSFontSelector::fontRangesForFamily): Ditto.
        * css/FontFace.cpp:
        (WebCore::FontFace::setStretch): Ditto.
        (WebCore::FontFace::stretch): Ditto.
        * css/parser/CSSPropertyParser.cpp:
        (WebCore::CSSPropertyParser::parseFontFaceDescriptor): Ditto.
        * platform/graphics/FontCache.h: Ditto.
        * platform/graphics/FontDescription.h:
        * platform/graphics/FontSelectionAlgorithm.cpp: Added.
        (WebCore::FontSelectionAlgorithm::filterCapability):
        (WebCore::FontSelectionAlgorithm::indexOfBestCapabilities):
        (WebCore::fontSelectionRequestForTraitsMask):
        (WebCore::initialFontSelectionCapabilitiesForTraitsMask):
        (WebCore::fontSelectionCapabilitiesForTraitsMask):
        * platform/graphics/FontSelectionAlgorithm.h: Added. Taken from FontCacheCoreText.cpp.
        (WebCore::FontSelectionValue::FontSelectionValue):
        (WebCore::FontSelectionValue::operator float):
        (WebCore::FontSelectionValue::rawValue):
        (WebCore::FontSelectionValue::maximumValue):
        (WebCore::FontSelectionValue::minimumValue):
        (WebCore::FontSelectionValue::operator+):
        (WebCore::FontSelectionValue::operator-):
        (WebCore::FontSelectionValue::operator*):
        (WebCore::FontSelectionValue::operator/):
        (WebCore::FontSelectionValue::operator==):
        (WebCore::FontSelectionValue::operator!=):
        (WebCore::FontSelectionValue::operator<):
        (WebCore::FontSelectionValue::operator<=):
        (WebCore::FontSelectionValue::operator>):
        (WebCore::FontSelectionValue::operator>=):
        (WebCore::FontSelectionRange::isValid):
        (WebCore::FontSelectionRange::expand):
        (WebCore::FontSelectionRange::includes):
        (WebCore::FontSelectionRequest::operator==):
        (WebCore::FontSelectionRequest::operator!=):
        (WebCore::FontSelectionRequestKey::FontSelectionRequestKey):
        (WebCore::FontSelectionRequestKey::isHashTableDeletedValue):
        (WebCore::FontSelectionRequestKey::operator==):
        (WebCore::FontSelectionRequestKeyHash::hash):
        (WebCore::FontSelectionRequestKeyHash::equal):
        (WebCore::FontSelectionCapabilities::expand):
        (WebCore::FontSelectionAlgorithm::FontSelectionAlgorithm):
        (WebCore::FontSelectionAlgorithm::iterateActiveCapabilitiesWithReturn):
        (WebCore::FontSelectionAlgorithm::iterateActiveCapabilities):
        * platform/graphics/cocoa/FontCacheCoreText.cpp: Moved to FontSelectionAlgorithm.
        (WebCore::stretchFromCoreTextTraits):
        (WebCore::FontDatabase::capabilitiesForFontDescriptor):
        (WebCore::findClosestFont):
        (WebCore::calculateFontSelectionRequest):
        (WebCore::platformFontLookupWithFamily):
        (WebCore::FontCache::getTraitsInFamily): Deleted.
        (WebCore::iterateActiveFontsWithReturn): Deleted.
        (WebCore::iterateActiveFonts): Deleted.
        (WebCore::findClosestStretch): Deleted.
        (WebCore::filterStretch): Deleted.
        (WebCore::findClosestStyle): Deleted.
        (WebCore::filterStyle): Deleted.
        (WebCore::findClosestWeight): Deleted.
        (WebCore::filterWeight): Deleted.
        (WebCore::computeTargetWeight): Deleted.
        * platform/text/TextFlags.h: Moved to FontSelectionAlgorithm.
        (WebCore::FontSelectionValue::FontSelectionValue): Deleted.
        (WebCore::FontSelectionValue::operator float): Deleted.
        (WebCore::FontSelectionValue::operator+): Deleted.
        (WebCore::FontSelectionValue::operator-): Deleted.
        (WebCore::FontSelectionValue::operator*): Deleted.
        (WebCore::FontSelectionValue::operator/): Deleted.
        (WebCore::FontSelectionValue::operator==): Deleted.
        (WebCore::FontSelectionValue::operator!=): Deleted.
        (WebCore::FontSelectionValue::operator<): Deleted.
        (WebCore::FontSelectionValue::operator<=): Deleted.
        (WebCore::FontSelectionValue::operator>): Deleted.
        (WebCore::FontSelectionValue::operator>=): Deleted.
        (WebCore::FontSelectionValue::rawValue): Deleted.
        (WebCore::FontSelectionValue::maximumValue): Deleted.
        (WebCore::FontSelectionValue::minimumValue): Deleted.
        (WebCore::FontSelectionRange::isValid): Deleted.
        (WebCore::FontSelectionRange::expand): Deleted.
        (WebCore::FontSelectionRange::includes): Deleted.
        (WebCore::FontSelectionCapabilities::expand): Deleted.

2017-03-05  Simon Fraser  <simon.fraser@apple.com>

        Make some RenderLayer tree traversal in RenderLayerBacking more generic
        https://bugs.webkit.org/show_bug.cgi?id=169177

        Reviewed by Zalan Bujtas.

        The real goal of this patch is reduce the number of callers of
        RenderLayerBacking::isPaintDestinationForDescendantLayers() to one. To achieve that,
        have the setContentsVisible() logic (which is really just about the CSS 'visibility' property)
        do its own tree traversal which just consults layer.hasVisibleContent(). So
        make descendantLayerPaintsIntoAncestor() a generic traversal function which walks
        descendant layers which may paint into the target layer. The "Visible" in the name
        reflects the fact that it can bypass a subtree for a layer with !hasVisibleDescendant().

        * rendering/RenderLayerBacking.cpp:
        (WebCore::RenderLayerBacking::updateAfterDescendants):
        (WebCore::traverseVisibleNonCompositedDescendantLayers):
        (WebCore::RenderLayerBacking::isPaintDestinationForDescendantLayers):
        (WebCore::RenderLayerBacking::hasVisibleNonCompositedDescendants):
        (WebCore::descendantLayerPaintsIntoAncestor): Deleted.
        * rendering/RenderLayerBacking.h:

2017-03-04  Simon Fraser  <simon.fraser@apple.com>

        Clarify some terminology in RenderLayerBacking
        https://bugs.webkit.org/show_bug.cgi?id=169174

        Reviewed by Zalan Bujtas.

        Rename some functions related to directly-composited background images and
        box decorations for clarify.

        Only behavior change is for canDirectlyCompositeBackgroundBackgroundImage() to check
        GraphicsLayer::supportsContentsTiling(), which means that RenderLayerBacking::contentChanged()
        will no longer trigger a updateGeometry() when it gets BackgroundImageChanged on non-
        CoordinateGraphics platforms.

        * rendering/RenderLayerBacking.cpp:
        (WebCore::RenderLayerBacking::updateConfiguration):
        (WebCore::RenderLayerBacking::updateAfterDescendants):
        (WebCore::RenderLayerBacking::updateDirectlyCompositedBoxDecorations):
        (WebCore::canDirectlyCompositeBackgroundBackgroundImage):
        (WebCore::hasPaintedBoxDecorationsOrBackgroundImage):
        (WebCore::supportsDirectlyCompositedBoxDecorations):
        (WebCore::RenderLayerBacking::paintsBoxDecorations):
        (WebCore::RenderLayerBacking::isSimpleContainerCompositingLayer):
        (WebCore::RenderLayerBacking::contentChanged):
        (WebCore::RenderLayerBacking::updateDirectlyCompositedContents): Deleted.
        (WebCore::canCreateTiledImage): Deleted.
        (WebCore::hasVisibleBoxDecorationsOrBackgroundImage): Deleted.
        (WebCore::supportsDirectBoxDecorationsComposition): Deleted.
        * rendering/RenderLayerBacking.h:

2017-03-04  Alex Christensen  <achristensen@webkit.org>

        Cleanup after r213418
        https://bugs.webkit.org/show_bug.cgi?id=169165

        Reviewed by Youenn Fablet.

        * platform/mediastream/mac/RealtimeIncomingAudioSource.cpp:
        (WebCore::RealtimeIncomingAudioSource::OnData):
        Restore the assertion I removed.

2017-03-04  Commit Queue  <commit-queue@webkit.org>

        Unreviewed, rolling out r213379.
        https://bugs.webkit.org/show_bug.cgi?id=169169

        broke GTK+ and Windows builds (Requested by mcatanzaro on
        #webkit).

        Reverted changeset:

        "Enable fieldsets to be flexboxes, grids and multicolumn."
        https://bugs.webkit.org/show_bug.cgi?id=169082
        http://trac.webkit.org/changeset/213379

2017-03-03  Youenn Fablet  <youenn@apple.com>

        [WebRTC] Update libwebrtc source code
        https://bugs.webkit.org/show_bug.cgi?id=168599

        Reviewed by Alex Christensen.

        * Modules/mediastream/RTCStatsReport.h:
        * Modules/mediastream/RTCStatsReport.idl:
        Update to match the latest spec, which matches the new structures in libwebrtc.
        * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp:
        (WebCore::fillRTCRTPStreamStats):
        (WebCore::fillOutboundRTPStreamStats):
        * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.h:
        * platform/mediastream/libwebrtc/LibWebRTCProvider.cpp:
        * platform/mediastream/mac/RealtimeIncomingAudioSource.cpp:
        (WebCore::RealtimeIncomingAudioSource::OnData):
        Comment out an assertion that was failing.  We should revisit this.
        * testing/MockLibWebRTCPeerConnection.h:

2017-03-03  Commit Queue  <commit-queue@webkit.org>

        Unreviewed, rolling out r213400.
        https://bugs.webkit.org/show_bug.cgi?id=169163

        Caused frequent assertion failures (Requested by ap on
        #webkit).

        Reverted changeset:

        "[Modern Media Controls] Improve media documents across macOS,
        iPhone and iPad"
        https://bugs.webkit.org/show_bug.cgi?id=169145
        http://trac.webkit.org/changeset/213400

2017-03-03  Andy Estes  <aestes@apple.com>

        Add support for canvas.toBlob
        https://bugs.webkit.org/show_bug.cgi?id=148878

        Reviewed by Tim Horton.

        Address additional review feedback received after r213412 landed.

        * html/HTMLCanvasElement.cpp:
        (WebCore::HTMLCanvasElement::toBlob): Passed null to the blob callback if blob conversion
        fails for any reason.
        * platform/graphics/cg/ImageBufferCG.cpp:
        (WebCore::cgImage): Removed an unnecessary local variable.

2017-03-03  Andy Estes  <aestes@apple.com>

        Add support for canvas.toBlob
        https://bugs.webkit.org/show_bug.cgi?id=148878
        <rdar://problem/22590406>

        Reviewed by Tim Horton.

        These tests now pass:
        imported/w3c/web-platform-tests/html/semantics/embedded-content/the-canvas-element/toBlob.jpeg.html
        imported/w3c/web-platform-tests/html/semantics/embedded-content/the-canvas-element/toBlob.png.html

        * CMakeLists.txt:
        * DerivedSources.make:
        * WebCore.xcodeproj/project.pbxproj:
        * fileapi/BlobCallback.cpp: Added.
        (WebCore::BlobCallback::scheduleCallback):
        * fileapi/BlobCallback.h: Added.
        (WebCore::BlobCallback::~BlobCallback):
        * fileapi/BlobCallback.idl: Added.
        * html/HTMLCanvasElement.cpp:
        (WebCore::HTMLCanvasElement::toBlob):
        * html/HTMLCanvasElement.h:
        * html/HTMLCanvasElement.idl:
        * platform/graphics/ImageBuffer.h:
        * platform/graphics/cairo/ImageBufferCairo.cpp:
        (WebCore::writeFunction):
        (WebCore::encodeImage):
        (WebCore::ImageBuffer::toDataURL):
        (WebCore::ImageBuffer::toData):
        * platform/graphics/cg/ImageBufferCG.cpp:
        (WebCore::data):
        (WebCore::ImageBuffer::toDataURL):
        (WebCore::ImageBuffer::toData):
        (WebCore::ImageBuffer::toCGImage):
        (WebCore::cgImage):
        (WebCore::dataURL):
        * platform/graphics/gtk/ImageBufferGtk.cpp:
        (WebCore::ImageBuffer::toDataURL):
        (WebCore::ImageBuffer::toData):
        * platform/graphics/win/ImageBufferDirect2D.cpp:
        (WebCore::ImageBuffer::toData):

2017-03-03  Dean Jackson  <dino@apple.com>

        Add WebGPU compile flag and experimental feature flag
        https://bugs.webkit.org/show_bug.cgi?id=169161
        <rdar://problem/30846689>

        Reviewed by Tim Horton.

        Add ENABLE_WEBGPU, an experimental feature flag, a RuntimeEnabledFeature,
        and an InternalSetting.

        * Configurations/FeatureDefines.xcconfig:
        * page/RuntimeEnabledFeatures.h:
        (WebCore::RuntimeEnabledFeatures::setWebGPUEnabled):
        (WebCore::RuntimeEnabledFeatures::webGPUEnabled):
        * testing/InternalSettings.cpp:
        (WebCore::InternalSettings::Backup::Backup):
        (WebCore::InternalSettings::Backup::restoreTo):
        (WebCore::InternalSettings::setWebGPUEnabled):
        * testing/InternalSettings.h:
        * testing/InternalSettings.idl:

2017-03-03  Simon Fraser  <simon.fraser@apple.com>

        Clean up some RenderLayerBacking code
        https://bugs.webkit.org/show_bug.cgi?id=169160

        Reviewed by Dean Jackson.

        Modern loops in descendantLayerPaintsIntoAncestor().

        Rename RenderLayerBacking::paintsChildren() to RenderLayerBacking::paintsChildRenderers() to clarify that
        it refers to renderers, not RenderLayers.

        Rename RenderLayerBacking::paintsNonDirectCompositedBoxDecoration() to RenderLayerBacking::paintsBoxDecorations().
        "Paints" already implies non-composited.

        No behavior change.

        * rendering/RenderLayerBacking.cpp:
        (WebCore::RenderLayerBacking::updateDrawsContent):
        (WebCore::RenderLayerBacking::paintsBoxDecorations):
        (WebCore::RenderLayerBacking::paintsChildRenderers):
        (WebCore::RenderLayerBacking::isSimpleContainerCompositingLayer):
        (WebCore::descendantLayerPaintsIntoAncestor):
        (WebCore::RenderLayerBacking::paintsNonDirectCompositedBoxDecoration): Deleted.
        (WebCore::RenderLayerBacking::paintsChildren): Deleted.
        * rendering/RenderLayerBacking.h:

2017-03-03  Simon Fraser  <simon.fraser@apple.com>

        Clean up RenderImage and a RenderImageResource function
        https://bugs.webkit.org/show_bug.cgi?id=169153

        Reviewed by Zalan Bujtas.
        
        Change all calls to imageResource().cachedImage() in RenderImage to use the inline
        cachedImage() function.

        In RenderImage::paintReplaced(), early return after the broken image block (and no need
        to test imageResource().hasImage() again in the second condition). Convert height/width to size,
        which also forces us to be explicit about using flooredIntSize() when fetching the image
        (perhaps this should be a roundedIntSize, but I didn't want to change behavior).

        Change RenderImageResource::image() to take an IntSize, rather than int height and width.

        No behavior change.

        * rendering/RenderImage.cpp:
        (WebCore::RenderImage::styleDidChange):
        (WebCore::RenderImage::imageChanged):
        (WebCore::RenderImage::notifyFinished):
        (WebCore::RenderImage::paintReplaced):
        (WebCore::RenderImage::paintIntoRect):
        (WebCore::RenderImage::foregroundIsKnownToBeOpaqueInRect):
        (WebCore::RenderImage::embeddedContentBox):
        * rendering/RenderImageResource.cpp:
        (WebCore::RenderImageResource::image):
        * rendering/RenderImageResource.h:
        (WebCore::RenderImageResource::image):
        * rendering/RenderImageResourceStyleImage.cpp:
        (WebCore::RenderImageResourceStyleImage::image):
        * rendering/RenderImageResourceStyleImage.h:

2017-03-03  Antoine Quint  <graouts@apple.com>

        [Modern Media Controls] Improve media documents across macOS, iPhone and iPad
        https://bugs.webkit.org/show_bug.cgi?id=169145
        <rdar://problem/17048858>

        Reviewed by Dean Jackson.

        There were a variety of issues with media documents, some longstanding, and some specifically
        about modern media controls.

        One issue was that fullscreen and picture-in-picture buttons would show for audio media documents,
        due to using a <video> element to load the audio file. We now have additional logic in MediaController
        to identify if the loaded media is really an audio file, and using this information to hide the
        fullscreen and picture-in-picture buttons.

        Another issue was that we would inject style in MediaDocument.cpp that was specific to modern media
        controls when we could have the modern-media-controls module injected CSS handle this styling. We now
        use the injected style in the shadow root to size media documents based on the device characteristics
        and ensuring that page styles are overridden.

        We also simplify how MediaDocument.cpp sets the source of the media element to simply use the "src"
        attribute and not a <source> element.

        Finally, we introduce a MediaDocumentController class that is instantiated when we're dealing with
        a media document to hide the controls while we determine the type of media we're loading (audio vs.
        video) in order to apply the appropriate styling without flashes.

        As a result of the new styles applied by the modern-media-controls module, media documents have a
        similar behavior on macOS and iPad, where we only enforce a min-width for video allowing them
        to play at their natural size otherwise, and enforcing a fixed width for audio. On iPhone however,
        we want to always play the media at full width, with some padding in the case of audio.

        Tests: media/modern-media-controls/fullscreen-support/fullscreen-support-disabled-video-with-audio-tracks-only.html
               media/modern-media-controls/media-documents/ipad/media-document-audio-ios-sizing.html
               media/modern-media-controls/media-documents/ipad/media-document-video-ios-sizing.html
               media/modern-media-controls/media-documents/media-document-audio-ios-sizing.html
               media/modern-media-controls/media-documents/media-document-audio-mac-sizing.html
               media/modern-media-controls/media-documents/media-document-video-ios-sizing.html
               media/modern-media-controls/media-documents/media-document-video-mac-sizing.html
               media/modern-media-controls/pip-support/pip-support-disabled-video-with-audio-tracks-only.html

        * Modules/modern-media-controls/controls/ios-inline-media-controls.css:
        (:host(audio) .media-controls.ios.inline > .controls-bar:before,):
        (:host(audio) .media-controls.ios.inline > .controls-bar:before): Deleted.
        * Modules/modern-media-controls/controls/macos-media-controls.css:
        (:host(audio) .media-controls.mac.inline > .controls-bar,):
        (:host(audio) .media-controls.mac.inline > .controls-bar > .background-tint,):
        (:host(audio) .media-controls.mac.inline > .controls-bar): Deleted.
        (:host(audio) .media-controls.mac.inline > .controls-bar > .background-tint): Deleted.
        * Modules/modern-media-controls/controls/media-document.css: Added.
        (:host(.media-document)):
        (:host(.media-document.ready)):
        (:host(.media-document.audio.mac)):
        (:host(.media-document.audio.ipad)):
        (:host(.media-document.audio.iphone)):
        (:host(.media-document.video.mac)):
        (:host(.media-document.video.ipad)):
        (:host(.media-document.video.iphone)):
        * Modules/modern-media-controls/js-files:
        * Modules/modern-media-controls/media/fullscreen-support.js:
        (FullscreenSupport.prototype.syncControl):
        (FullscreenSupport):
        * Modules/modern-media-controls/media/media-controller.js:
        (MediaController):
        (MediaController.prototype.get isAudio):
        * Modules/modern-media-controls/media/media-document-controller.js: Added.
        (MediaDocumentController):
        (MediaDocumentController.prototype.handleEvent):
        (MediaDocumentController.prototype._mediaDocumentHasMetadata):
        (MediaDocumentController.prototype._mediaDocumentHasSize):
        * Modules/modern-media-controls/media/pip-support.js:
        (PiPSupport.prototype.syncControl):
        (PiPSupport):
        * html/MediaDocument.cpp:
        (WebCore::MediaDocumentParser::createDocumentStructure):

2017-03-03  Chris Dumez  <cdumez@apple.com>

        [iOS] Throttle SVG SMIL animations to 30fps in low power mode
        https://bugs.webkit.org/show_bug.cgi?id=169137
        <rdar://problem/30833754>

        Reviewed by Simon Fraser.

        Throttle SVG SMIL animations to 30fps in low power mode on iOS to save
        battery.

        Test: svg/animations/animations-lowPowerMode-throttling.html

        * svg/SVGSVGElement.cpp:
        (WebCore::SVGSVGElement::SVGSVGElement):
        * svg/SVGSVGElement.idl:
        * svg/animation/SMILTime.h:
        (WebCore::SMILTime::SMILTime):
        * svg/animation/SMILTimeContainer.cpp:
        (WebCore::SMILTimeContainer::SMILTimeContainer):
        (WebCore::SMILTimeContainer::animationFrameDelay):
        (WebCore::SMILTimeContainer::updateDocumentOrderIndexes):
        (WebCore::SMILTimeContainer::updateAnimations):
        * svg/animation/SMILTimeContainer.h:
        * svg/animation/SVGSMILElement.cpp:
        (WebCore::SVGSMILElement::calculateNextProgressTime):
        * testing/Internals.cpp:
        (WebCore::Internals::svgAnimationsInterval):
        * testing/Internals.h:
        * testing/Internals.idl:

2017-03-03  Joseph Pecoraro  <pecoraro@apple.com>

        [Mac] WebCore.framework is missing a symlink from Frameworks to Versions/Current/Frameworks when the latter exists
        https://bugs.webkit.org/show_bug.cgi?id=169067

        Reviewed by Dan Bernstein.

        * WebCore.xcodeproj/project.pbxproj:

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-03  Alex Christensen  <achristensen@webkit.org>

        [URLParser] Fix file: as a relative file URL
        https://bugs.webkit.org/show_bug.cgi?id=169122

        Reviewed by Tim Horton.

        This is clearly defined in https://url.spec.whatwg.org/#file-state with the EOF code point.
        I got it wrong and didn't test it.  It's been added to the web platform tests since we last updated.

        * platform/URLParser.cpp:
        (WebCore::URLParser::parse):

2017-03-03  Dave Hyatt  <hyatt@apple.com>

        Enable fieldsets to be flexboxes, grids and multicolumn.
        https://bugs.webkit.org/show_bug.cgi?id=169082

        Reviewed by Simon Fraser.

        Added new tests in fast/forms/fieldset.

        This patch eliminates RenderFieldset and moves the functionality into RenderBlock so that
        derived classes can also be fieldsets.

        * CMakeLists.txt:
        * WebCore.xcodeproj/project.pbxproj:
        Remove RenderFieldset from the project.

        * accessibility/AccessibilityRenderObject.cpp:
        (WebCore::AccessibilityRenderObject::titleUIElement):
        Call in to RenderBlock now instead of RenderFieldset.

        * html/HTMLFieldSetElement.cpp:
        (WebCore::HTMLFieldSetElement::createElementRenderer):
        * html/HTMLFieldSetElement.h:
        The fieldset DOM element now uses RenderElement::createFor to make renderers so that multiple display types
        can be supported. A special flag has been added that indicates only to make flexbox and block-related
        renderers (not table display types).

        * rendering/OrderIterator.cpp:
        (WebCore::OrderIterator::shouldSkipChild):
        (WebCore::OrderIteratorPopulator::collectChild):
        * rendering/OrderIterator.h:
        Streamline child collection for flexboxes and grids to indicate whether the child should be skipped as a return
        value from collectChild. Add a shouldSkipChild method that skips both out of flow positioned objects and
        excluded children like the legends of fieldsets.

        * rendering/RenderBlock.cpp:
        (WebCore::RenderBlockRareData::RenderBlockRareData):
        When the legend is taller than the fieldset's borderBefore(), intrinsic border is added to the CSS border width.
        This intrinsic border being factored in ensures that the padding and content boxes of fieldsets are correct
        across any layout system, since the legend is now just treated as part of the border.

        (WebCore::RenderBlock::computeBlockPreferredLogicalWidths):
        Call the new computePreferredWidthsForExcludedChildren to ensure that excluded children contribute to
        preferred width in their own way and not as part of a specific layout system.

        (WebCore::RenderBlock::renderName):
        Hacked to still return RenderFieldSet for RenderBlockFlow-backed fieldsets for layout test compatibility.

        (WebCore::RenderBlock::layoutExcludedChildren):
        Renamed from layoutSpecialExcludedChild to more accurately reflect the fact that multiple excluded children
        can be included here (e.g., both a multicolumn flow thread and a legend). The RenderBlock base class handles
        the layout of legends by both placing them and setting the correct intrinsic border before amount on the
        block.

        (WebCore::RenderBlock::findFieldsetLegend):
        Moved from RenderFieldset.

        (WebCore::RenderBlock::adjustBorderBoxRectForPainting):
        (WebCore::RenderBlock::paintRectToClipOutFromBorder):
        These methods are used when painting to shrink the border box as needed to account for the legend and to
        provide the portion of the border that needs to be clipped out. These methods have been enhanced to
        properly support all writing modes.

        (WebCore::RenderBlock::intrinsicBorderForFieldset):
        (WebCore::RenderBlock::setIntrinsicBorderForFieldset):
        (WebCore::RenderBlock::borderTop):
        (WebCore::RenderBlock::borderLeft):
        (WebCore::RenderBlock::borderBottom):
        (WebCore::RenderBlock::borderRight):
        (WebCore::RenderBlock::borderBefore):
        These methods are overridden for border to ensure that the intrinsic border added by a tall legend is
        properly factored in.

        (WebCore::RenderBlock::computePreferredWidthsForExcludedChildren):
        * rendering/RenderBlock.h:
        This method computes the preferred widths for legend children in order to ensure that the legend properly
        grows the width of the fieldset when it is the widest item.

        (WebCore::RenderBlock::adjustBorderBoxLogicalHeightForBoxSizing):
        (WebCore::RenderBlock::adjustContentBoxLogicalHeightForBoxSizing):
        Preserve the behavior of fieldsets in that the available content size includes the space lost accounting
        for the legend. I don't think this makes much sense, but it matches the behavior of other browsers
        (and our old behavior).

        (WebCore::RenderBlock::paintExcludedChildrenInBorder):
        Method for painting the excluded children that might be present in our border. We only do this if the
        paint phase is a box decoration painting phase and if the legend isn't self-painting.

        * rendering/RenderBlockFlow.cpp:
        (WebCore::RenderBlockFlow::willCreateColumns):
        Allow fieldsets to create columns now.

        (WebCore::RenderBlockFlow::layoutBlockChildren):
        (WebCore::RenderBlockFlow::layoutExcludedChildren):
        Renamed this method and change it to call the base class to ensure that legends in multicolumn fieldsets
        get handled properly.

        (WebCore::RenderBlockFlow::addChild):
        Patched to make sure legends don't get put into the multicolumn flow thread, as they need to
        remain outside of it.

        (WebCore::RenderBlockFlow::layoutSpecialExcludedChild): Deleted.
        Renamed to layoutExcludedChildren.

        * rendering/RenderBlockFlow.h:
        * rendering/RenderBox.cpp:
        (WebCore::RenderBox::paintBoxDecorations):
        (WebCore::RenderBox::paintMask):
        Patched to call the new adjustBorderBoxRectForPainting and paintRectToClipOutFromBorder methods in
        order to properly shrink the border box rect for painting and to clip out the portion of the border
        covered by the legend.

        (WebCore::RenderBox::avoidsFloats):
        Add fieldsets as avoiding floats. RenderFieldset used to subclass this method to return true, but with
        its removal, we need to put this in the base class along with legends.

        * rendering/RenderBox.h:
        (WebCore::RenderBox::isGridItem):
        (WebCore::RenderBox::isFlexItem):
        Patched to exclude legends so that they don't try to size like they are really in the grid or flexbox.

        (WebCore::RenderBox::adjustBorderBoxRectForPainting):
        This method is overridden by RenderBLock to handle adjusting fieldset border rects for painting.

        * rendering/RenderBoxModelObject.cpp:
        (WebCore::RenderBoxModelObject::paintBorder):
        * rendering/RenderBoxModelObject.h:
        (WebCore::RenderBoxModelObject::paintRectToClipOutFromBorder):
        Patched to properly paint fieldsets using the new helpers.

        * rendering/RenderDeprecatedFlexibleBox.cpp:
        (WebCore::FlexBoxIterator::next):
        (WebCore::RenderDeprecatedFlexibleBox::layoutBlock):
        (WebCore::RenderDeprecatedFlexibleBox::layoutHorizontalBox):
        Make sure deprecated flexible boxes lay out their legends properly by calling layoutExcludedChildren.

        * rendering/RenderElement.cpp:
        (WebCore::RenderElement::createFor):
        * rendering/RenderElement.h:
        Patched to take a flag that limits what renderers can be created so that fieldsets don't make table
        display types.

        * rendering/RenderFieldset.cpp: Removed.
        * rendering/RenderFieldset.h: Removed.
        Remove RenderFieldset files from the tree.

        * rendering/RenderFlexibleBox.cpp:
        (WebCore::RenderFlexibleBox::computeIntrinsicLogicalWidths):
        (WebCore::RenderFlexibleBox::firstLineBaseline):
        (WebCore::RenderFlexibleBox::layoutBlock):
        (WebCore::RenderFlexibleBox::layoutFlexItems):
        (WebCore::RenderFlexibleBox::prepareOrderIteratorAndMargins):
        Make sure flexible boxes lay out their legends properly by calling layoutExcludedChildren.
        Patch methods to use the OrderIterator's new shouldSkipChild method to ensure legends aren't
        part of the flexible box layout.

        * rendering/RenderGrid.cpp:
        (WebCore::RenderGrid::layoutBlock):
        (WebCore::RenderGrid::computeIntrinsicLogicalWidths):
        (WebCore::RenderGrid::placeItemsOnGrid):
        (WebCore::RenderGrid::populateExplicitGridAndOrderIterator):
        (WebCore::RenderGrid::layoutGridItems):
        Make sure grids lay out their legends properly by calling layoutExcludedChildren.
        Patch methods to use the OrderIterator's new shouldSkipChild method to ensure legends aren't
        part of the grid's layout.

        * rendering/RenderMultiColumnFlowThread.cpp:
        (WebCore::RenderMultiColumnFlowThread::populate):
        Pull legends back up into the block and don't let them be part of the flow thread.

        * rendering/RenderMultiColumnSet.cpp:
        (WebCore::RenderMultiColumnSet::requiresBalancing):
        Fix an assert to allow legends to exist as siblings of multicolumn sets.

        * rendering/RenderObject.cpp:
        (WebCore::RenderObject::isFieldset):
        Changed to examine the HTML element rather than RenderFieldset.

        * rendering/RenderObject.h:
        (WebCore::RenderObject::isExcludedFromNormalLayout):
        (WebCore::RenderObject::setIsExcludedFromNormalLayout):
        (WebCore::RenderObject::RenderObjectBitfields::RenderObjectBitfields):
        RenderObjects now have a new bit that is set for excluded objects like legends, flow threads,
        placeholders, and ruby text. This bit lets code easily detect that an object is excluded from
        the layout system and can be skipped.

        (WebCore::RenderObject::isExcludedAndPlacedInBorder):
        Helper method for asking if an object is painting inside the border. Used to know we
        need to factor it into preferred width calculations outside of any one layout system
        and also to know that we need to paint it when we paint the fieldset's border instead of
        later (after we might have scrolled or clipped the child painting area).

        * rendering/RenderRubyRun.cpp:
        (WebCore::RenderRubyRun::layoutExcludedChildren):
        (WebCore::RenderRubyRun::layoutSpecialExcludedChild): Deleted.
        * rendering/RenderRubyRun.h:
        Rename layoutSpecialExcludedChild to layoutExcludedChildren.

        * rendering/RenderTable.cpp:
        (WebCore::RenderTable::adjustBorderBoxRectForPainting):
        (WebCore::RenderTable::paintBoxDecorations):
        (WebCore::RenderTable::paintMask):
        (WebCore::RenderTable::subtractCaptionRect): Deleted.
        * rendering/RenderTable.h:
        Patched tables to share the same border box rect adjustment used by fieldsets when subtracting
        out captions. This is prep work to allow tables to be fieldsets, but for now I didn't go all the
        way.

        * rendering/RenderTableCell.cpp:
        (WebCore::RenderTableCell::paintBoxDecorations):
        (WebCore::RenderTableCell::paintMask):
        Make sure table cells adjust their border box rects for painting. Again this is prep work for
        cells potentially being fieldsets, but not supported yet.

        * rendering/RenderTextControl.cpp:
        (WebCore::RenderTextControl::layoutExcludedChildren):
        (WebCore::RenderTextControl::layoutSpecialExcludedChild): Deleted.
        * rendering/RenderTextControl.h:
        * rendering/RenderTextControlMultiLine.cpp:
        (WebCore::RenderTextControlMultiLine::layoutExcludedChildren):
        (WebCore::RenderTextControlMultiLine::layoutSpecialExcludedChild): Deleted.
        * rendering/RenderTextControlMultiLine.h:
        Renamed the methods for doing the excluded child layout.

        * rendering/RenderTreeAsText.cpp:
        (WebCore::RenderTreeAsText::writeRenderObject):
        Make sure to dump the original fieldset border and not the border with the extra legend stuff in it.

2017-03-03  Ryan Haddad  <ryanhaddad@apple.com>

        Unreviewed, rolling out r213344.

        This changed caused LayoutTest crashes under GuardMalloc.

        Reverted changeset:

        "Add support for canvas.toBlob"
        https://bugs.webkit.org/show_bug.cgi?id=148878
        http://trac.webkit.org/changeset/213344

2017-03-03  Konstantin Tokarev  <annulen@yandex.ru>

        Unreviewed typo fix

        * features.json:

2017-03-03  Eric Carlson  <eric.carlson@apple.com>

        [MediaStream] Remove #if USE(VIDEOTOOLBOX) from AVVideoCaptureSource
        https://bugs.webkit.org/show_bug.cgi?id=169131

        Reviewed by Youenn Fablet.

        * platform/mediastream/mac/AVVideoCaptureSource.mm:
        (WebCore::AVVideoCaptureSource::currentFrameCGImage):

2017-03-03  Chris Dumez  <cdumez@apple.com>

        Add assertion in Frame::setView() to make sure associated document has no living render tree
        https://bugs.webkit.org/show_bug.cgi?id=169134

        Reviewed by Brent Fulgham.

        Add assertion in Frame::setView() to make sure associated document has no living render tree.
        This is not supposed to happen and r213311 fixed one case where this could happen. We need
        to find out if it can still happen.

        * page/Frame.cpp:
        (WebCore::Frame::setView):

2017-03-02  Sam Weinig  <sam@webkit.org>

        Rename htmlediting.h/cpp to Editing.h/cpp
        https://bugs.webkit.org/show_bug.cgi?id=169103

        Reviewed by Alex Christensen.

        * CMakeLists.txt:
        * WebCore.xcodeproj/project.pbxproj:
        * accessibility/AXObjectCache.cpp:
        * accessibility/AccessibilityNodeObject.cpp:
        * accessibility/AccessibilityObject.cpp:
        * accessibility/AccessibilityRenderObject.cpp:
        * accessibility/atk/WebKitAccessibleHyperlink.cpp:
        * accessibility/atk/WebKitAccessibleInterfaceText.cpp:
        * accessibility/atk/WebKitAccessibleWrapperAtk.cpp:
        * accessibility/mac/WebAccessibilityObjectWrapperBase.mm:
        * accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
        * dom/Document.cpp:
        * dom/Element.cpp:
        * dom/Node.h:
        * dom/Position.cpp:
        * dom/PositionIterator.cpp:
        * dom/Range.cpp:
        * editing/AlternativeTextController.cpp:
        * editing/AppendNodeCommand.cpp:
        * editing/ApplyBlockElementCommand.cpp:
        * editing/ApplyStyleCommand.cpp:
        * editing/BreakBlockquoteCommand.cpp:
        * editing/CompositeEditCommand.cpp:
        * editing/CreateLinkCommand.cpp:
        (WebCore::CreateLinkCommand::CreateLinkCommand):
        * editing/DeleteFromTextNodeCommand.cpp:
        * editing/DeleteSelectionCommand.cpp:
        * editing/EditCommand.cpp:
        * editing/Editing.cpp: Copied from Source/WebCore/editing/htmlediting.cpp.
        * editing/Editing.h: Copied from Source/WebCore/editing/htmlediting.h.
        * editing/EditingAllInOne.cpp:
        * editing/EditingStyle.cpp:
        * editing/Editor.cpp:
        * editing/EditorCommand.cpp:
        * editing/FormatBlockCommand.cpp:
        * editing/FrameSelection.cpp:
        * editing/HTMLInterchange.cpp:
        * editing/IndentOutdentCommand.cpp:
        * editing/InsertLineBreakCommand.cpp:
        * editing/InsertListCommand.cpp:
        * editing/InsertNodeBeforeCommand.cpp:
        * editing/InsertParagraphSeparatorCommand.cpp:
        * editing/InsertTextCommand.cpp:
        * editing/ModifySelectionListLevel.cpp:
        * editing/RemoveNodeCommand.cpp:
        * editing/ReplaceNodeWithSpanCommand.cpp:
        * editing/ReplaceSelectionCommand.cpp:
        * editing/SpellChecker.cpp:
        * editing/TextIterator.cpp:
        * editing/TypingCommand.cpp:
        * editing/VisiblePosition.cpp:
        * editing/VisibleSelection.cpp:
        * editing/VisibleUnits.cpp:
        * editing/cocoa/DataDetection.mm:
        * editing/cocoa/EditorCocoa.mm:
        * editing/htmlediting.cpp: Removed.
        * editing/htmlediting.h: Removed.
        * editing/ios/EditorIOS.mm:
        * editing/mac/DictionaryLookup.mm:
        * editing/mac/EditorMac.mm:
        * editing/markup.cpp:
        * html/HTMLTextFormControlElement.cpp:
        * inspector/InspectorDOMAgent.cpp:
        * page/DOMSelection.cpp:
        * page/DragController.cpp:
        * page/EventHandler.cpp:
        * page/FocusController.cpp:
        * page/Frame.cpp:
        * platform/ios/PasteboardIOS.mm:
        * platform/mac/PasteboardMac.mm:
        * rendering/RenderBox.cpp:
        * rendering/RenderObject.cpp:

2017-03-02  Matt Baker  <mattbaker@apple.com>

        Web Inspector: Should be able to push nodes in an iframe subtree to the frontend
        https://bugs.webkit.org/show_bug.cgi?id=169086

        Reviewed by Joseph Pecoraro.

        Test: inspector/dom/push-node-by-path-to-frontend.html

        * inspector/InspectorDOMAgent.cpp:
        (WebCore::InspectorDOMAgent::nodeForPath):
        During top-down document traversal, descend into content document nodes
        when visiting an HTMLFrameOwnerElement.

2017-03-02  Ryan Haddad  <ryanhaddad@apple.com>

        Unreviewed, rolling out r213274.

        This change caused flakiness with LayoutTest memory/memory-
        pressure-simulation.html

        Reverted changeset:

        "Don't keep dead resources in MemoryCache while under memory
        pressure."
        https://bugs.webkit.org/show_bug.cgi?id=169070
        http://trac.webkit.org/changeset/213274

2017-03-02  Jiewen Tan  <jiewen_tan@apple.com>

        WebCrypto API support for AES-GCM
        https://bugs.webkit.org/show_bug.cgi?id=157175
        <rdar://problem/27311691>

        Reviewed by Brent Fulgham.

        This patch adds support for AES-GCM. Operations of AES-GCM include: encrypt, decrypt, generateKey,
        importKey, exportKey, wrapKey, and unwrapKey. https://www.w3.org/TR/WebCryptoAPI/#aes-gcm

        Tests: crypto/subtle/aes-gcm-decrypt-malformed-parameters.html
               crypto/subtle/aes-gcm-encrypt-malformed-parameters.html
               crypto/subtle/aes-gcm-generate-export-key-jwk-length-128.html
               crypto/subtle/aes-gcm-generate-export-key-jwk-length-192.html
               crypto/subtle/aes-gcm-generate-export-key-jwk-length-256.html
               crypto/subtle/aes-gcm-generate-export-raw-key.html
               crypto/subtle/aes-gcm-generate-key-encrypt-decrypt.html
               crypto/subtle/aes-gcm-generate-key.html
               crypto/subtle/aes-gcm-import-jwk-key-length-128.html
               crypto/subtle/aes-gcm-import-jwk-key-length-192.html
               crypto/subtle/aes-gcm-import-jwk-key-length-256.html
               crypto/subtle/aes-gcm-import-key-decrypt-additional-data-tag-length-32.html
               crypto/subtle/aes-gcm-import-key-decrypt-additional-data.html
               crypto/subtle/aes-gcm-import-key-decrypt-tagLengths.html
               crypto/subtle/aes-gcm-import-key-decrypt.html
               crypto/subtle/aes-gcm-import-key-encrypt-additional-data-tag-length-32.html
               crypto/subtle/aes-gcm-import-key-encrypt-additional-data.html
               crypto/subtle/aes-gcm-import-key-encrypt-tagLengths.html
               crypto/subtle/aes-gcm-import-key-encrypt.html
               crypto/subtle/aes-gcm-import-key-unwrap-jwk-key.html
               crypto/subtle/aes-gcm-import-key-unwrap-raw-key.html
               crypto/subtle/aes-gcm-import-key-wrap-jwk-key.html
               crypto/subtle/aes-gcm-import-key-wrap-raw-key.html
               crypto/subtle/aes-gcm-import-raw-key.html
               crypto/workers/subtle/aes-gcm-import-key-decrypt.html
               crypto/workers/subtle/aes-gcm-import-key-encrypt.html
               crypto/workers/subtle/aes-gcm-import-key-unwrap-key.html
               crypto/workers/subtle/aes-gcm-import-key-wrap-key.html

        * CMakeLists.txt:
        * DerivedSources.make:
        * PlatformGTK.cmake:
        * PlatformMac.cmake:
        Add CryptoAlgorithmAES_CFBMac.cpp as well.
        * WebCore.xcodeproj/project.pbxproj:
        * bindings/js/JSSubtleCryptoCustom.cpp:
        (WebCore::normalizeCryptoAlgorithmParameters):
        Add support for AES-GCM.
        * crypto/CommonCryptoUtilities.h:
        Include SPI header for AES-GCM support. We have a mismatch SPI between different OS version.
        Therefore, a guardian is placed.
        * crypto/CryptoAlgorithmParameters.h:
        * crypto/algorithms/CryptoAlgorithmAES_GCM.cpp: Added.
        (WebCore::usagesAreInvalidForCryptoAlgorithmAES_GCM):
        (WebCore::tagLengthIsValid):
        (WebCore::CryptoAlgorithmAES_GCM::create):
        (WebCore::CryptoAlgorithmAES_GCM::identifier):
        (WebCore::CryptoAlgorithmAES_GCM::encrypt):
        (WebCore::CryptoAlgorithmAES_GCM::decrypt):
        (WebCore::CryptoAlgorithmAES_GCM::generateKey):
        (WebCore::CryptoAlgorithmAES_GCM::importKey):
        (WebCore::CryptoAlgorithmAES_GCM::exportKey):
        * crypto/algorithms/CryptoAlgorithmAES_GCM.h: Added.
        * crypto/gnutls/CryptoAlgorithmAES_GCMGnuTLS.cpp: Added.
        (WebCore::CryptoAlgorithmAES_GCM::platformEncrypt):
        (WebCore::CryptoAlgorithmAES_GCM::platformDecrypt):
        * crypto/mac/CryptoAlgorithmAES_GCMMac.cpp: Added.
        (WebCore::encryptAES_GCM):
        (WebCore::decyptAES_GCM):
        (WebCore::CryptoAlgorithmAES_GCM::platformEncrypt):
        (WebCore::CryptoAlgorithmAES_GCM::platformDecrypt):
        * crypto/mac/CryptoAlgorithmRegistryMac.cpp:
        (WebCore::CryptoAlgorithmRegistry::platformRegisterAlgorithms):
        * crypto/parameters/AesGcmParams.idl: Added.
        * crypto/parameters/CryptoAlgorithmAesGcmParams.h: Added.

2017-03-02  Andy Estes  <aestes@apple.com>

        Add support for canvas.toBlob
        https://bugs.webkit.org/show_bug.cgi?id=148878
        <rdar://problem/22590406>

        Reviewed by Tim Horton.

        These tests now pass:
        imported/w3c/web-platform-tests/html/semantics/embedded-content/the-canvas-element/toBlob.jpeg.html
        imported/w3c/web-platform-tests/html/semantics/embedded-content/the-canvas-element/toBlob.png.html

        * CMakeLists.txt:
        * DerivedSources.make:
        * WebCore.xcodeproj/project.pbxproj:
        * fileapi/BlobCallback.cpp: Added.
        (WebCore::BlobCallback::scheduleCallback):
        * fileapi/BlobCallback.h: Added.
        (WebCore::BlobCallback::~BlobCallback):
        * fileapi/BlobCallback.idl: Added.
        * html/HTMLCanvasElement.cpp:
        (WebCore::HTMLCanvasElement::toBlob):
        * html/HTMLCanvasElement.h:
        * html/HTMLCanvasElement.idl:
        * platform/graphics/ImageBuffer.h:
        * platform/graphics/cairo/ImageBufferCairo.cpp:
        (WebCore::writeFunction):
        (WebCore::encodeImage):
        (WebCore::ImageBuffer::toDataURL):
        (WebCore::ImageBuffer::toData):
        * platform/graphics/cg/ImageBufferCG.cpp:
        (WebCore::data):
        (WebCore::ImageBuffer::toDataURL):
        (WebCore::ImageBuffer::toData):
        (WebCore::ImageBuffer::toCGImage):
        (WebCore::cgImage):
        (WebCore::dataURL):
        * platform/graphics/gtk/ImageBufferGtk.cpp:
        (WebCore::ImageBuffer::toDataURL):
        (WebCore::ImageBuffer::toData):
        * platform/graphics/win/ImageBufferDirect2D.cpp:
        (WebCore::ImageBuffer::toData):

2017-03-02  Myles C. Maxfield  <mmaxfield@apple.com>

        Migrate font-stretch to use fixed-point values
        https://bugs.webkit.org/show_bug.cgi?id=169107

        Reviewed by Dean Jackson.

        There are a few benefits of using fixed-point values:
        - Not all of the entropy of a float is necessary for font selection. In particular, values are
        expected to stay between around -1000 to 1000, and only need to have a few fractional bits.
        Therefore, the values can be represented by 16-bit fixed point numbers, which includes one sign
        bit and two fractional bits. This is smaller than the 32-bit floating point numbers we were
        using, which means FontDescription can be slimmed down. This becomes even more important when
        the rest of the variation font properties are implemented, since those will use these fixed-
        point values too.
        - Fixed point values have a larger distance between adjacent representable values, which means
        there are more collisions, which means our cache hit rates are higher.

        No new tests because there is no behavior change.

        * css/CSSComputedStyleDeclaration.cpp:
        (WebCore::fontStretchFromStyle):
        * css/StyleBuilderConverter.h:
        (WebCore::StyleBuilderConverter::convertFontStretch):
        * platform/graphics/FontCache.h:
        (WebCore::FontDescriptionKey::FontDescriptionKey):
        * platform/graphics/FontDescription.h:
        (WebCore::FontDescription::stretch):
        (WebCore::FontDescription::setStretch):
        (WebCore::FontCascadeDescription::initialStretch):
        * platform/graphics/cocoa/FontCacheCoreText.cpp:
        (WebCore::defaultFontSelectionValues):
        (WebCore::preparePlatformFont):
        (WebCore::FontDatabase::InstalledFont::InstalledFont):
        (WebCore::FontDatabase::InstalledFontFamily::expand):
        (WebCore::FontDatabase::capabilitiesForFontDescriptor):
        (WebCore::FontDatabase::stretchThreshold):
        (WebCore::FontDatabase::italicThreshold):
        (WebCore::FontDatabase::weightThreshold):
        (WebCore::findClosestStretch):
        (WebCore::filterStretch):
        (WebCore::findClosestStyle):
        (WebCore::filterStyle):
        (WebCore::findClosestWeight):
        (WebCore::filterWeight):
        (WebCore::computeTargetWeight):
        (WebCore::findClosestFont):
        (WebCore::platformFontLookupWithFamily):
        (WebCore::fontWithFamily):
        (WebCore::defaultVariationValues): Deleted.
        (WebCore::FontDatabase::Range::Range): Deleted.
        (WebCore::FontDatabase::Range::isValid): Deleted.
        (WebCore::FontDatabase::Range::expand): Deleted.
        (WebCore::FontDatabase::Range::includes): Deleted.
        (): Deleted.
        * platform/text/TextFlags.h:
        (WebCore::FontSelectionValue::FontSelectionValue):
        (WebCore::FontSelectionValue::operator float):
        (WebCore::FontSelectionValue::operator+):
        (WebCore::FontSelectionValue::operator-):
        (WebCore::FontSelectionValue::operator*):
        (WebCore::FontSelectionValue::operator/):
        (WebCore::FontSelectionValue::operator==):
        (WebCore::FontSelectionValue::operator!=):
        (WebCore::FontSelectionValue::operator<):
        (WebCore::FontSelectionValue::operator<=):
        (WebCore::FontSelectionValue::operator>):
        (WebCore::FontSelectionValue::operator>=):
        (WebCore::FontSelectionValue::rawValue):
        (WebCore::FontSelectionRange::isValid):
        (WebCore::FontSelectionRange::expand):
        (WebCore::FontSelectionRange::includes):
        (WebCore::FontSelectionCapabilities::expand):

2017-03-02  Alex Christensen  <achristensen@webkit.org>

        Modernize ContentExtensionParser
        https://bugs.webkit.org/show_bug.cgi?id=169106

        Reviewed by Andy Estes.

        We were returning std::error_code and passing the return value as a parameter reference.
        because we wrote this code before we had WTF::Expected.

        No change in behavior, verified by many API tests.

        * contentextensions/ContentExtensionCompiler.cpp:
        (WebCore::ContentExtensions::compileRuleList):
        * contentextensions/ContentExtensionParser.cpp:
        (WebCore::ContentExtensions::getDomainList):
        (WebCore::ContentExtensions::loadTrigger):
        (WebCore::ContentExtensions::loadAction):
        (WebCore::ContentExtensions::loadRule):
        (WebCore::ContentExtensions::loadEncodedRules):
        (WebCore::ContentExtensions::parseRuleList):
        * contentextensions/ContentExtensionParser.h:
        * contentextensions/ContentExtensionRule.cpp:
        (WebCore::ContentExtensions::ContentExtensionRule::ContentExtensionRule):
        * contentextensions/ContentExtensionRule.h:

2017-03-02  Ryan Haddad  <ryanhaddad@apple.com>

        Unreviewed, rolling out r213301.

        This change broke internal builds.

        Reverted changeset:

        "WebCrypto API support for AES-GCM"
        https://bugs.webkit.org/show_bug.cgi?id=157175
        http://trac.webkit.org/changeset/213301

2017-03-02  Aakash Jain  <aakash_jain@apple.com>

        Move stringMatchesWildcardString from WebKit2 to WebCore
        https://bugs.webkit.org/show_bug.cgi?id=169065

        Reviewed by Alexey Proskuryakov.

        * WebCore.xcodeproj/project.pbxproj: Added StringUtilities.h and StringUtilities.mm
        * PlatformMac.cmake: Added StringUtilities.mm
        * platform/mac/StringUtilities.h: Added.
        * platform/mac/StringUtilities.mm: Added.
        (WebCore::wildcardRegexPatternString): Added.
        (WebCore::stringMatchesWildcardString): Added.

2017-02-28  Matt Rajca  <mrajca@apple.com>

        Media: send "did interfere with playback" events when the user pauses an autoplaying element
        https://bugs.webkit.org/show_bug.cgi?id=169006

        Reviewed by Alex Christensen.

        Added API tests.

        * html/HTMLMediaElement.cpp:
        (WebCore::HTMLMediaElement::pauseInternal):

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  Dave Hyatt  <hyatt@apple.com>

        flex-basis should be 0% (not 0px) when omitted
        https://bugs.webkit.org/show_bug.cgi?id=169100
        rdar://problem/30429154

        Reviewed by Dean Jackson.

        Covered by existing tests.

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

2017-02-22  Jiewen Tan  <jiewen_tan@apple.com>

        WebCrypto API support for AES-GCM
        https://bugs.webkit.org/show_bug.cgi?id=157175
        <rdar://problem/27311691>

        Reviewed by Brent Fulgham.

        This patch adds support for AES-GCM. Operations of AES-GCM include: encrypt, decrypt, generateKey,
        importKey, exportKey, wrapKey, and unwrapKey. https://www.w3.org/TR/WebCryptoAPI/#aes-gcm

        Tests: crypto/subtle/aes-gcm-decrypt-malformed-parameters.html
               crypto/subtle/aes-gcm-encrypt-malformed-parameters.html
               crypto/subtle/aes-gcm-generate-export-key-jwk-length-128.html
               crypto/subtle/aes-gcm-generate-export-key-jwk-length-192.html
               crypto/subtle/aes-gcm-generate-export-key-jwk-length-256.html
               crypto/subtle/aes-gcm-generate-export-raw-key.html
               crypto/subtle/aes-gcm-generate-key-encrypt-decrypt.html
               crypto/subtle/aes-gcm-generate-key.html
               crypto/subtle/aes-gcm-import-jwk-key-length-128.html
               crypto/subtle/aes-gcm-import-jwk-key-length-192.html
               crypto/subtle/aes-gcm-import-jwk-key-length-256.html
               crypto/subtle/aes-gcm-import-key-decrypt-additional-data-tag-length-32.html
               crypto/subtle/aes-gcm-import-key-decrypt-additional-data.html
               crypto/subtle/aes-gcm-import-key-decrypt-tagLengths.html
               crypto/subtle/aes-gcm-import-key-decrypt.html
               crypto/subtle/aes-gcm-import-key-encrypt-additional-data-tag-length-32.html
               crypto/subtle/aes-gcm-import-key-encrypt-additional-data.html
               crypto/subtle/aes-gcm-import-key-encrypt-tagLengths.html
               crypto/subtle/aes-gcm-import-key-encrypt.html
               crypto/subtle/aes-gcm-import-key-unwrap-jwk-key.html
               crypto/subtle/aes-gcm-import-key-unwrap-raw-key.html
               crypto/subtle/aes-gcm-import-key-wrap-jwk-key.html
               crypto/subtle/aes-gcm-import-key-wrap-raw-key.html
               crypto/subtle/aes-gcm-import-raw-key.html
               crypto/workers/subtle/aes-gcm-import-key-decrypt.html
               crypto/workers/subtle/aes-gcm-import-key-encrypt.html
               crypto/workers/subtle/aes-gcm-import-key-unwrap-key.html
               crypto/workers/subtle/aes-gcm-import-key-wrap-key.html

        * CMakeLists.txt:
        * DerivedSources.make:
        * PlatformGTK.cmake:
        * PlatformMac.cmake:
        Add CryptoAlgorithmAES_CFBMac.cpp as well.
        * WebCore.xcodeproj/project.pbxproj:
        * bindings/js/JSSubtleCryptoCustom.cpp:
        (WebCore::normalizeCryptoAlgorithmParameters):
        Add support for AES-GCM.
        * crypto/CommonCryptoUtilities.h:
        Include SPI header for AES-GCM support.
        * crypto/CryptoAlgorithmParameters.h:
        * crypto/algorithms/CryptoAlgorithmAES_GCM.cpp: Added.
        (WebCore::usagesAreInvalidForCryptoAlgorithmAES_GCM):
        (WebCore::tagLengthIsValid):
        (WebCore::CryptoAlgorithmAES_GCM::create):
        (WebCore::CryptoAlgorithmAES_GCM::identifier):
        (WebCore::CryptoAlgorithmAES_GCM::encrypt):
        (WebCore::CryptoAlgorithmAES_GCM::decrypt):
        (WebCore::CryptoAlgorithmAES_GCM::generateKey):
        (WebCore::CryptoAlgorithmAES_GCM::importKey):
        (WebCore::CryptoAlgorithmAES_GCM::exportKey):
        * crypto/algorithms/CryptoAlgorithmAES_GCM.h: Added.
        * crypto/gnutls/CryptoAlgorithmAES_GCMGnuTLS.cpp: Added.
        (WebCore::CryptoAlgorithmAES_GCM::platformEncrypt):
        (WebCore::CryptoAlgorithmAES_GCM::platformDecrypt):
        * crypto/mac/CryptoAlgorithmAES_GCMMac.cpp: Added.
        (WebCore::encryptAES_GCM):
        (WebCore::decyptAES_GCM):
        (WebCore::CryptoAlgorithmAES_GCM::platformEncrypt):
        (WebCore::CryptoAlgorithmAES_GCM::platformDecrypt):
        * crypto/mac/CryptoAlgorithmRegistryMac.cpp:
        (WebCore::CryptoAlgorithmRegistry::platformRegisterAlgorithms):
        * crypto/parameters/AesGcmParams.idl: Added.
        * crypto/parameters/CryptoAlgorithmAesGcmParams.h: Added.

2017-03-02  Alex Christensen  <achristensen@webkit.org>

        Continue enabling WebRTC
        https://bugs.webkit.org/show_bug.cgi?id=169056

        Reviewed by Jon Lee.

        * Configurations/FeatureDefines.xcconfig:

2017-03-02  Ryan Haddad  <ryanhaddad@apple.com>

        Unreviewed, rolling out r213281.

        This change caused API test WebKit2.UserMediaBasic to time
        out.

        Reverted changeset:

        "[MediaStream] UIClient may not be notified of capture state
        change when leaving a page"
        https://bugs.webkit.org/show_bug.cgi?id=169014
        http://trac.webkit.org/changeset/213281

2017-03-02  Jon Lee  <jonlee@apple.com>

        Improve consistency of captions rendering on Mac
        https://bugs.webkit.org/show_bug.cgi?id=169071

        Reviewed by Eric Carlson.

        * page/CaptionUserPreferencesMediaAF.h:
        (WebCore::CaptionUserPreferencesMediaAF::captionsEdgeColorForTextColor): Deleted.
        (WebCore::CaptionUserPreferencesMediaAF::cssPropertyWithTextEdgeColor): Deleted.

        * page/CaptionUserPreferencesMediaAF.cpp:
        (WebCore::appendCSS): Helper function to add a CSS rule with a provided StringBuilder.
        (WebCore::CaptionUserPreferencesMediaAF::windowRoundedCornerRadiusCSS): Refactor to use
        appendCSS.
        (WebCore::CaptionUserPreferencesMediaAF::colorPropertyCSS): Ditto.
        (WebCore::CaptionUserPreferencesMediaAF::captionsTextEdgeCSS): Update text edge styles.
        - Add a blur to the shadow
        - Drop shadow style includes 1px text border
        - Always use black for the text edge color
        Also convert the stroke rules to using the CSS property and values instead of straight strings.
        (WebCore::CaptionUserPreferencesMediaAF::captionsStyleSheetOverride): Fly-by fix of a typo.

2017-03-02  Chris Dumez  <cdumez@apple.com>

        Download attribute set to "*\" save file with name "example.com"
        https://bugs.webkit.org/show_bug.cgi?id=169066
        <rdar://problem/30740875>

        Reviewed by Alex Christensen.

        The issue is that a backslash in recognized as an escaping character in
        a quoted string as per RFC2616:
        "
        The backslash character ("\") MAY be used as a single-character
        quoting mechanism only within quoted-string and comment constructs.
        "

        We therefore need to escape the backslashes in the filename before
        using it in the Content-Disposition header, inside the quoted string.

        Test: fast/dom/HTMLAnchorElement/anchor-file-blob-download-includes-backslash.html

        * platform/network/ResourceResponseBase.cpp:
        (WebCore::ResourceResponseBase::sanitizeSuggestedFilename):

2017-03-02  Youenn Fablet  <youenn@apple.com>

        [WebRTC] Activate ICE candidate privacy policy
        https://bugs.webkit.org/show_bug.cgi?id=168975

        Reviewed by Alex Christensen.

        Test: webrtc/datachannel/filter-ice-candidate.html

        * testing/Internals.cpp:
        (WebCore::Internals::Internals): Disabling ICE candidate filtering by default for rwt.
        (WebCore::Internals::setICECandidateFiltering):
        * testing/Internals.h:
        * testing/Internals.idl:

2017-03-02  Eric Carlson  <eric.carlson@apple.com>

        [MediaStream] UIClient may not be notified of capture state change when leaving a page
        https://bugs.webkit.org/show_bug.cgi?id=169014
        <rdar://problem/30632267>

        Reviewed by Youenn Fablet.

        Enable and update the WebKit API test WebKit2.UserMedia.

        * dom/Document.cpp:
        (WebCore::Document::prepareForDestruction): Always call page.updateIsPlayingMedia() if there
        is active media in the document because it won't be possible when the state changes later
        because the frame will have been cleared.

2017-03-02  Tomas Popela  <tpopela@redhat.com>

        [WK2] Keyboard menu key should show context menu
        https://bugs.webkit.org/show_bug.cgi?id=72099

        Reviewed by Carlos Garcia Campos.

        Show the context menu when the GtkWidget::popup-menu signal is
        emitted. This signal is triggered by pressing a key (usually
        the Menu key or the Shift + F10 shortcut) or it could be emitted on
        WebKitWebView.

        Test: fast/events/context-activated-by-key-event.html

        Also could be tested by:

        ManualTests/keyboard-menukey-event.html
        ManualTests/win/contextmenu-key.html
        ManualTests/win/contextmenu-key2.html

        * page/EventHandler.cpp:
        (WebCore::EventHandler::sendContextMenuEventForKey):
        Correctly send the mouse event that used for showing the context menu.
        Previously the event was immediately dispatched as it is, but this was
        only the right way if some element was focused on the page. If there
        was no focused element or non-empty text range then the event lacked
        the right node, where it was supposed to be shown. The correct node
        is determined and added to the event in the sendContextMenuEvent() so
        we have to use this function to send the event.

        Also use absoluteBoundingBoxRect() instead of
        pixelSnappedAbsoluteClippedOverflowRect() when determining
        a coordinate where to show the context menu for the currently focus
        element. The latter is not returning a right box (it is bigger) which
        could lead to the situation that no menu will be displayed at all,
        because the HitTest won't contain the right element as the
        determined coordinates could be outside of the element.
        * page/EventHandler.h:

2017-03-02  Carlos Garcia Campos  <cgarcia@igalia.com>

        [GTK] Crash in WebCore::CoordinatedGraphicsLayer::notifyFlushRequired
        https://bugs.webkit.org/show_bug.cgi?id=166420

        Reviewed by Žan Doberšek.

        This is happening when closing a page that is being inspected. When CoordinatedGraphicsLayer::removeFromParent()
        is called, the coordinator has already been invalidated, so all its layers were set a nullptr coordinator. I
        think it's safe to simply handle m_coordinator being nullptr in notifyFlushRequired().

        * platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp:
        (WebCore::CoordinatedGraphicsLayer::notifyFlushRequired): Return early if the coordinator is nullptr.

2017-03-02  Andreas Kling  <akling@apple.com>

        Don't keep dead resources in MemoryCache while under memory pressure.
        <https://webkit.org/b/169070>

        Reviewed by Antti Koivisto.

        Have CachedResource::deleteIfPossible() remove the resource from the MemoryCache
        if we're under memory pressure and that was the only thing keeping it alive.

        This is consistent with the policy where dead resources are evicted from the cache
        as we come under pressure.

        * loader/cache/CachedResource.cpp:
        (WebCore::CachedResource::deleteIfPossible):

2017-03-01  Carlos Garcia Campos  <cgarcia@igalia.com>

        REGRESSION(r213062): [SOUP] UTF-8 filename in Content-Disposition header incorrectly handled since r213062
        https://bugs.webkit.org/show_bug.cgi?id=169024

        Reviewed by Youenn Fablet.

        This made test http/tests/download/literal-utf-8.html to start failing. The problem is that I removed the
        conversion made by String::fromUTF8WithLatin1Fallback that was added in r176930. I removed it because that made
        fast/dom/HTMLAnchorElement/anchor-file-blob-download-includes-unicode.html to timeout. This patch brings back
        the String::fromUTF8WithLatin1Fallback call but only when the header string is 8 bit one.

        Fixes: http/tests/download/literal-utf-8.html

        * platform/network/soup/ResourceResponseSoup.cpp:
        (WebCore::ResourceResponse::platformSuggestedFilename):

2017-03-01  Alex Christensen  <achristensen@webkit.org>

        Actually fix Windows build.

        * platform/graphics/win/MediaPlayerPrivateMediaFoundation.h:
        Win32Handle is now in WTF namespace.

2017-03-01  Alex Christensen  <achristensen@webkit.org>

        Fix WinCairo build after r213214
        https://bugs.webkit.org/show_bug.cgi?id=168908

        * platform/graphics/win/MediaPlayerPrivateMediaFoundation.h:

2017-03-01  Myles C. Maxfield  <mmaxfield@apple.com>

        Implement font-stretch for installed fonts
        https://bugs.webkit.org/show_bug.cgi?id=168888

        Reviewed by Darin Adler and Dave Hyatt.

        This patch implements the font-stretch property. Both parsing and the implementation is
        implemented. Contrary to the name, this property doesn't actually stretch fonts; instead,
        it provides one more input to the font selection routine.

        The mapping from Core Text's [-1, 1] width values to font-stretch's percentage-based
        values is not perfect. For now, I've implemented a piecewise linear curve mapping the
        two. However, I expect to be able to improve this transfer function soon.

        This patch does not implement the font-stretch descriptor in @font-face, and therefore
        does not work with web fonts. I will add this support in
        https://bugs.webkit.org/show_bug.cgi?id=168892. The reason it isn't done in this patch is
        it requires some architectural changes to our CSSFontFace classes which are large enough
        they should be separated into their own patch.

        This patch lays the groundwork for implementing the 'wdth' variation axis. It does this
        by adding a floating-point value to RenderStyle instead of just an enum. The font-stretch
        keywords get converted to these floating-point numbers in accordance with the Fonts spec.
        This patch doesn't actually implement the variations piece of font-stretch, because that
        piece also requires some architectural changes. This patch just implements the installed
        font selection piece.

        This patch also fixes the regression introduced in r213163 with Helvetica Neue. Now that
        our font selection algorithm has a concept of font stretch, weights 800 and 900 of
        Helvetica Neue are rendered as expected. (And this patch updates the tests to make sure.)

        Tests: fast/text/font-stretch-parse.html
               fast/text/font-stretch-shorthand.html
               FontCacheTest.FontLookupFromFamilyName

        * css/CSSComputedStyleDeclaration.cpp:
        (WebCore::fontStretchFromStyle): Map style values to CSS keywords.
        (WebCore::ComputedStyleExtractor::propertyValue): Call the above function.
        * css/CSSFontValue.cpp:
        (WebCore::CSSFontValue::customCSSText): Used in getComputedStyle() for the "font"
        shorthand.
        (WebCore::CSSFontValue::equals):
        * css/CSSFontValue.h:
        * css/CSSProperties.json:
        * css/StyleBuilderConverter.h:
        (WebCore::StyleBuilderConverter::convertFontStretch): Map CSS keywords to style values.
        * css/StyleProperties.cpp:
        (WebCore::StyleProperties::appendFontLonghandValueIfExplicit): Used for
        Element.style.font.
        (WebCore::StyleProperties::fontValue):
        * css/parser/CSSParserFastPaths.cpp:
        (WebCore::CSSParserFastPaths::isKeywordPropertyID): Now that variation fonts are being
        implemented, font-stretch is no longer a keyword property. Instead, it can also take a
        number or percentage.
        * css/parser/CSSPropertyParser.cpp:
        (WebCore::consumeFontStretch): Parse the value.
        (WebCore::CSSPropertyParser::parseSingleValue): Call the above function.
        (WebCore::CSSPropertyParser::consumeFont): Ditto.
        * platform/graphics/FontCache.h:
        (WebCore::FontDescriptionKey::FontDescriptionKey): Caches should be sensitive to this
        new value.
        (WebCore::FontDescriptionKey::operator==):
        (WebCore::FontDescriptionKey::computeHash):
        * platform/graphics/FontDescription.h:
        (WebCore::FontDescription::stretch): The parsed style value.
        (WebCore::FontDescription::setStretch):
        (WebCore::FontDescription::operator==):
        (WebCore::FontCascadeDescription::initialStretch):
        * platform/graphics/cocoa/FontCacheCoreText.cpp:
        (WebCore::FontDatabase::InstalledFont::InstalledFont): Update the installed font selection
        algorithm to understand font-stretch.
        (WebCore::findClosestStretch):
        (WebCore::filterStretch):
        (WebCore::findClosestFont):
        (WebCore::platformFontLookupWithFamily):
        (WebCore::fontWithFamily):
        (WebCore::FontCache::createFontPlatformData):

2017-03-01  Antti Koivisto  <antti@apple.com>

        Rename recalcStyle to resolveStyle and clean up the signature
        https://bugs.webkit.org/show_bug.cgi?id=169049

        Reviewed by Sam Weinig.

        Move to modern naming.

        * dom/Document.cpp:
        (WebCore::Document::resolveStyle):

            Only two of the possible values are used so pass in a two-value enum.

        (WebCore::Document::updateStyleIfNeeded):
        (WebCore::Document::updateLayoutIgnorePendingStylesheets):
        (WebCore::Document::createRenderTree):
        (WebCore::Document::finishedParsing):
        (WebCore::Document::webkitWillEnterFullScreenForElement):
        (WebCore::Document::recalcStyle): Deleted.
        * dom/Document.h:
        * inspector/InspectorOverlay.cpp:
        (WebCore::InspectorOverlay::update):
        * loader/DocumentWriter.cpp:
        (WebCore::DocumentWriter::reportDataReceived):
        * page/Frame.cpp:
        (WebCore::Frame::setPageAndTextZoomFactors):
        * page/Page.cpp:
        (WebCore::Page::setPageScaleFactor):
        * style/StyleTreeResolver.cpp:
        (WebCore::Style::TreeResolver::Parent::Parent):
        (WebCore::Style::TreeResolver::resolve):

            Remove the argument, Document invalidates the document element if everything needs to be re-resolved.

        * style/StyleTreeResolver.h:

2017-03-01  Alex Christensen  <achristensen@webkit.org>

        Unreviewed, rolling out r213259.

        Broke an internal build

        Reverted changeset:

        "Continue enabling WebRTC"
        https://bugs.webkit.org/show_bug.cgi?id=169056
        http://trac.webkit.org/changeset/213259

2017-03-01  Alex Christensen  <achristensen@webkit.org>

        Continue enabling WebRTC
        https://bugs.webkit.org/show_bug.cgi?id=169056

        Reviewed by Jon Lee.

        * Configurations/FeatureDefines.xcconfig:

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-01  Antoine Quint  <graouts@apple.com>

        [ios-simulator] Unskip media/modern-media-controls/audio/audio-controls-metrics.html
        https://bugs.webkit.org/show_bug.cgi?id=167258
        <rdar://problem/30282740>

        We weren't enforcing the min-width to be 200px as well as the default width, and the
        UA stylesheet would override it. Setting a default min-width that trumps the UA
        stylesheet makes the test work correctly on iOS and we can safely unskip this test.

        Reviewed by Jon Lee.

        * Modules/modern-media-controls/controls/media-controls.css:
        (:host(audio)):

2017-03-01  Javier Fernandez  <jfernandez@igalia.com>

        Missing 'specification' section in the place-content shorthand
        https://bugs.webkit.org/show_bug.cgi?id=169052

        Reviewed by Darin Adler.

        Added 'specification' section in the place-content shorthand.

        No new tests, no new functionality.

        * css/CSSProperties.json:

2017-02-28  Matt Rajca  <mrajca@apple.com>

        Media: notify clients when autoplayed media is muted
        https://bugs.webkit.org/show_bug.cgi?id=168987

        Reviewed by Alex Christensen.

        Added API tests.

        * html/HTMLMediaElement.cpp:
        (WebCore::HTMLMediaElement::setMuted):
        (WebCore::HTMLMediaElement::pageMutedStateDidChange):
        * page/AutoplayEvent.h:

2017-03-01  Commit Queue  <commit-queue@webkit.org>

        Unreviewed, rolling out r213226.
        https://bugs.webkit.org/show_bug.cgi?id=169051

        Speculative rollout, might be causing several failures and
        crashes in WebKitGTK+ (Requested by lajava on #webkit).

        Reverted changeset:

        "REGRESSION(r213062): [SOUP] UTF-8 filename in Content-
        Disposition header incorrectly handled since r213062"
        https://bugs.webkit.org/show_bug.cgi?id=169024
        http://trac.webkit.org/changeset/213226

2017-03-01  James Craig  <jcraig@apple.com>

        AX: add role aliases for ARIA DPUB module
        https://bugs.webkit.org/show_bug.cgi?id=168978
        <rdar://problem/30762724>

        Reviewed by Chris Fleizach.

        Added role aliases for ARIA DPUB module, and updated existing tests.

        Test: accessibility/roles-exposed.html
        Test: inspector/dom/getAccessibilityPropertiesForNode.html

        * accessibility/AccessibilityObject.cpp:
        (WebCore::initializeRoleMap): 

2017-03-01  Alex Christensen  <achristensen@webkit.org>

        Don't call libwebrtc functions if libwebrtc.dylib doesn't exist while testing
        https://bugs.webkit.org/show_bug.cgi?id=169045
        <rdar://problem/30735413>

        Reviewed by Youenn Fablet.

        WebRTC tests fail instead of crashing now if libwebrtc.dylib is missing.
        All other tests pass instead of crashing immediately when creating an Internals object.

        * Modules/mediastream/RTCController.cpp:
        (WebCore::RTCController::disableICECandidateFiltering):
        (WebCore::RTCController::enableICECandidateFiltering):
        * Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.cpp:
        (WebCore::createLibWebRTCPeerConnectionBackend):
        * testing/Internals.cpp:
        (WebCore::Internals::enableMockMediaEndpoint):
        (WebCore::Internals::emulateRTCPeerConnectionPlatformEvent):
        (WebCore::Internals::useMockRTCPeerConnectionFactory):
        * testing/Internals.h:

2017-03-01  Javier Fernandez  <jfernandez@igalia.com>

        [css-align] Implement the place-content shorthand
        https://bugs.webkit.org/show_bug.cgi?id=168771

        Reviewed by Manuel Rego Casasnovas.

        The CSS Box Alignment specification defines a new shorthand to set the
        Content Alignment properties (align-content and justify-content) at the
        same time.

        This patch provides the implementation of the CSS parsing logic and the
        required regression tests.

        Test: css3/parse-place-content.html

        * css/CSSComputedStyleDeclaration.cpp:
        (WebCore::ComputedStyleExtractor::propertyValue):
        * css/CSSProperties.json:
        * css/StyleProperties.cpp:
        (WebCore::StyleProperties::getPropertyValue):
        * css/parser/CSSPropertyParser.cpp:
        (WebCore::consumeSimplifiedContentPosition):
        (WebCore::CSSPropertyParser::consumePlaceContentShorthand):
        (WebCore::CSSPropertyParser::parseShorthand):
        * css/parser/CSSPropertyParser.h:

2017-03-01  Simon Fraser  <simon.fraser@apple.com>

        Try to fix Windows build after r213191.

        * platform/spi/win/CoreTextSPIWin.h:

2017-03-01  Carlos Garcia Campos  <cgarcia@igalia.com>

        REGRESSION(r213062): [SOUP] UTF-8 filename in Content-Disposition header incorrectly handled since r213062
        https://bugs.webkit.org/show_bug.cgi?id=169024

        Reviewed by Youenn Fablet.

        This made test http/tests/download/literal-utf-8.html to start failing. The problem is that I removed the
        conversion made by String::fromUTF8WithLatin1Fallback that was added in r176930. I removed it because that made
        fast/dom/HTMLAnchorElement/anchor-file-blob-download-includes-unicode.html to timeout. This patch brings back
        the String::fromUTF8WithLatin1Fallback call but only when the header string is 8 bit one.

        Fixes: http/tests/download/literal-utf-8.html

        * platform/network/soup/ResourceResponseSoup.cpp:
        (WebCore::ResourceResponse::platformSuggestedFilename):

2017-03-01  Carlos Garcia Campos  <cgarcia@igalia.com>

        [GTK] fast/canvas/canvas-createPattern-video-loading.html makes its subsequent test timeout
        https://bugs.webkit.org/show_bug.cgi?id=169019

        Reviewed by Xabier Rodriguez-Calvar.

        The timeout happens normally when the media player is deleted and the pipeline state is set to NULL. The call to
        gst_element_set_state() never returns because of different deadlocks with the video sink. Sometimes the deadlock
        happens with the sample mutex used by VideoRenderRequestScheduler. VideoRenderRequestScheduler::requestRender()
        calls webkitVideoSinkRepaintRequested() with the lock held, that ends up calling
        MediaPlayerPrivateGStreamerBase::triggerRepaint(). When rendering can't be accelerated the draw timer is
        scheduled and triggerRepaint blocks until the timer is fired. If the media player is destroyed before the timer
        is fired, when setting the pipeline state to NULL, other VideoRenderRequestScheduler methods can be called, like
        stop() that tries to get the sample mutex that is still held by requestRender(). So, first we need to make
        sure that requestRender() releases the lock before calling webkitVideoSinkRepaintRequested(). But that's not
        enough, we also need to ensure that the pipeline is set to NULL state after everyting has been properly
        stopped. This is currently done in ~MediaPlayerPrivateGStreamer that happens before
        ~MediaPlayerPrivateGStreamerBase, so gst_element_set_state() is hanging before allowing the
        MediaPlayerPrivateGStreamerBase to be cleaned up. We should move the call to the end of
        ~MediaPlayerPrivateGStreamerBase and ensure the draw timer and mutex are properly cleaned up before.

        Fixes: fast/canvas/canvas-createPattern-video-loading.html

        * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
        (WebCore::MediaPlayerPrivateGStreamer::~MediaPlayerPrivateGStreamer): Do not reset pipeline here.
        * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
        (WebCore::MediaPlayerPrivateGStreamerBase::~MediaPlayerPrivateGStreamerBase): Stop the draw mutex and notify the
        lock to ensure we unblock. Do the pipeline reset at the end.
        * platform/graphics/gstreamer/VideoSinkGStreamer.cpp:
        (VideoRenderRequestScheduler::requestRender): Release the mutex lock before calling webkitVideoSinkRepaintRequested().

2017-03-01  Tomas Popela  <tpopela@redhat.com>

        Unreviewed compiler warning fix after r213218

        * platform/gtk/PlatformKeyboardEventGtk.cpp:
        (WebCore::PlatformKeyboardEvent::PlatformKeyboardEvent):

2017-03-01  Tomas Popela  <tpopela@redhat.com>

        [Cairo] Incorrectly determining height in GraphicsContext::roundToDevicePixels()
        https://bugs.webkit.org/show_bug.cgi?id=169031

        Reviewed by Carlos Garcia Campos.

        We should compare if height is between -1 and 0 and not mixing height
        and width together.

        * platform/graphics/cairo/GraphicsContextCairo.cpp:
        (WebCore::GraphicsContext::roundToDevicePixels):

2017-03-01  Tomas Popela  <tpopela@redhat.com>

        [GTK] Fix problems found by Coverity scan in platform's keyboard and mouse events
        https://bugs.webkit.org/show_bug.cgi?id=169028

        Reviewed by Carlos Garcia Campos.

        * platform/gtk/PlatformKeyboardEventGtk.cpp:
        (WebCore::PlatformKeyboardEvent::PlatformKeyboardEvent): Initialize
        the m_handledByInputMethod member.
        * platform/gtk/PlatformMouseEventGtk.cpp:
        (WebCore::PlatformMouseEvent::PlatformMouseEvent): Initialize the
        m_modifierFlags member.

2017-03-01  Andreas Kling  <akling@apple.com>

        Move MemoryPressureHandler to WTF
        <https://webkit.org/b/168908>

        Reviewed by Sam Weinig.

        * CMakeLists.txt:
        * PlatformMac.cmake:
        * PlatformWin.cmake:
        * WebCore.xcodeproj/project.pbxproj:
        * bindings/js/ScriptController.cpp:
        * history/PageCache.cpp:
        * html/HTMLMediaElement.cpp:
        * inspector/InspectorInstrumentation.h:
        * inspector/InspectorMemoryAgent.h:
        * page/FrameView.cpp:
        * page/MemoryRelease.h:
        * page/linux/ResourceUsageThreadLinux.cpp:
        * platform/Linux.cmake:
        * platform/graphics/FontCache.cpp:
        * platform/graphics/WidthCache.h:
        * platform/graphics/ca/TileController.cpp:
        * platform/graphics/win/MediaPlayerPrivateMediaFoundation.h:
        * platform/ios/LegacyTileCache.mm:
        * platform/ios/LegacyTileGrid.mm:
        * platform/ios/LegacyTileLayerPool.mm:
        * platform/ios/TileControllerMemoryHandlerIOS.cpp:
        * testing/Internals.cpp:

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-03-01  Joseph Pecoraro  <pecoraro@apple.com>

        [WebRTC] Install libwebrtc.dylib inside of WebCore.framework
        https://bugs.webkit.org/show_bug.cgi?id=168859

        Reviewed by Dan Bernstein.

        * Configurations/WebCore.xcconfig:
        Set library search path to find the libwebrtc.dylib inside of WebCore's Frameworks
        or in the WK_OVERRIDE_FRAMEWORKS_DIR.

2017-02-28  Myles C. Maxfield  <mmaxfield@apple.com>

        Addressing post-review comments on r213163
        https://bugs.webkit.org/show_bug.cgi?id=168678

        Unreviewed.

        No new tests because there is no behavior change.

        * platform/graphics/cocoa/FontCacheCoreText.cpp:
        (WebCore::platformFontLookupWithFamily):

2017-02-28  Simon Fraser  <simon.fraser@apple.com>

        Don't use the LinearGlyphMask format if accelerated drawing is disabled
        https://bugs.webkit.org/show_bug.cgi?id=168997

        Reviewed by Tim Horton.

        Non-accelerated drawing doesn't work into LinearGlyphMask-format backing store,
        so don't use that backing store format when accelerated drawing is disabled.

        * platform/graphics/ca/PlatformCALayer.cpp:
        (WebCore::PlatformCALayer::drawRepaintIndicator):
        * platform/graphics/ca/cocoa/PlatformCALayerCocoa.mm:
        (layerContentsFormat):
        (PlatformCALayerCocoa::updateContentsFormat):

2017-02-28  Simon Fraser  <simon.fraser@apple.com>

        Make the repaint indicators show subpixel antialiased text indication a bit more clearly
        https://bugs.webkit.org/show_bug.cgi?id=168988

        Reviewed by Tim Horton.

        Put a more obvious stroke around the repaint count when subpixel-antialiased layer text is enabled.

        * platform/graphics/ca/PlatformCALayer.cpp:
        (WebCore::PlatformCALayer::drawRepaintIndicator):
        (WebCore::PlatformCALayer::drawTextAtPoint):
        * platform/graphics/ca/PlatformCALayer.h:
        * platform/graphics/ca/win/PlatformCALayerWin.cpp:
        (PlatformCALayerWin::drawTextAtPoint):
        * platform/graphics/ca/win/PlatformCALayerWin.h:

2017-02-28  Alex Christensen  <achristensen@webkit.org>

        LibWebRTCProvider should check existence of libwebrtc.dylib
        https://bugs.webkit.org/show_bug.cgi?id=168986
        <rdar://problem/30735413>

        Reviewed by Youenn Fablet.

        Some configurations of the webrtc tests overwrite the availability of WebRTC in order to test it
        with MockLibWebRTCPeerConnection.  If the dylib can not be found, we can't use it, so we want to
        fail these tests rather than crashing calling rtc::LogMessage::LogToDebug.

        * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp:
        (WebCore::LibWebRTCMediaEndpoint::doCreateOffer):
        (WebCore::LibWebRTCMediaEndpoint::doCreateAnswer):
        * platform/mediastream/libwebrtc/LibWebRTCProvider.cpp:
        (WebCore::LibWebRTCProvider::factory):
        (WebCore::LibWebRTCProvider::webRTCAvailable):
        * platform/mediastream/libwebrtc/LibWebRTCProvider.h:
        * testing/MockLibWebRTCPeerConnection.cpp:
        (WebCore::useMockRTCPeerConnectionFactory):
        (WebCore::MockLibWebRTCPeerConnectionFactory::CreatePeerConnection):

2017-02-28  Tim Horton  <timothy_horton@apple.com>

        Apply a review comment that was missing in r213182

        * loader/ios/QuickLook.mm:
        (WebCore::isQuickLookPreviewURL):

2017-02-28  Tim Horton  <timothy_horton@apple.com>

        [iOS] Getting QLPreviewProtocol slows down first navigation in Web process
        https://bugs.webkit.org/show_bug.cgi?id=168940
        <rdar://problem/29468999>

        Reviewed by Simon Fraser.

        No new tests, just a performance improvement.

        * loader/DocumentLoader.cpp:
        (WebCore::isRemoteWebArchive):
        * loader/PolicyChecker.cpp:
        (WebCore::PolicyChecker::checkNavigationPolicy):
        * loader/ResourceLoadNotifier.cpp:
        (WebCore::ResourceLoadNotifier::dispatchWillSendRequest):
        Make use of isQuickLookPreviewURL.

        * loader/ios/QuickLook.h:
        * loader/ios/QuickLook.mm:
        (WebCore::isQuickLookPreviewURL):
        Add isQuickLookPreviewURL, which first early-returns if the protocol
        of the URL is a well-known protocol, and then falls back to loading QuickLook.

        In a microbenchmark this is a 30-40% improvement in total time spent
        loading an empty HTML document (wall-clock time between loadHTMLString
        and didFinishNavigation).

2017-02-28  Simon Fraser  <simon.fraser@apple.com>

        Add Geolocation and DeviceOrientation to features.json 

        * features.json:

2017-02-28  Wenson Hsieh  <wenson_hsieh@apple.com>

        Data interaction should support attachment elements
        https://bugs.webkit.org/show_bug.cgi?id=168916
        <rdar://problem/30664519>

        Reviewed by Ryosuke Niwa.

        Teaches DragController to recognize and initiate dragging on attachment elements, and also adds a new
        convenience method to the WebItemProviderPasteboard for block enumeration of available UIItemProviders. Covered
        by a new API test: DataInteractionTests.AttachmentElementItemProviders.

        * page/DragController.cpp:
        (WebCore::DragController::draggableElement):
        (WebCore::DragController::startDrag):
        * platform/ios/WebItemProviderPasteboard.h:
        * platform/ios/WebItemProviderPasteboard.mm:
        (-[WebItemProviderPasteboard enumerateItemProvidersWithBlock:]):

2017-02-28  Mark Lam  <mark.lam@apple.com>

        Remove setExclusiveThread() and peers from the JSLock.
        https://bugs.webkit.org/show_bug.cgi?id=168977

        Reviewed by Filip Pizlo.

        No new tests because this should already be covered by existing tests.

        * bindings/js/CommonVM.cpp:
        (WebCore::commonVMSlow):

2017-02-28  Dave Hyatt  <hyatt@apple.com>

        Centering text inside a button set to display flex and justify-content: center is impossible
        https://bugs.webkit.org/show_bug.cgi?id=148872
        <rdar://problem/22590086>

        Reviewed by Simon Fraser.

        Added new test in fast/forms.

        * rendering/RenderButton.cpp:
        (WebCore::RenderButton::addChild):
        (WebCore::RenderButton::updateAnonymousChildStyle):
        (WebCore::RenderButton::styleDidChange):
        (WebCore::RenderButton::styleWillChange): Deleted.
        (WebCore::RenderButton::setupInnerStyle): Deleted.
        * rendering/RenderButton.h:
        * rendering/RenderElement.cpp:
        (WebCore::RenderElement::propagateStyleToAnonymousChildren):
        * rendering/RenderElement.h:
        (WebCore::RenderElement::updateAnonymousChildStyle):

2017-02-28  Antoine Quint  <graouts@apple.com>

        [Modern Media Controls] Add missing compact mode assets for macOS
        https://bugs.webkit.org/show_bug.cgi?id=168980
        <rdar://problem/30763269>

        Reviewed by Jon Lee.

        Adding missing compact mode assets for the AirPlay, tracks, PiP and volume buttons.

        * Modules/modern-media-controls/controls/icon-service.js:
        * Modules/modern-media-controls/controls/macos-compact-inline-media-controls.css:
        (.media-controls.mac.inline.compact button.airplay):
        (.media-controls.mac.inline.compact button.pip):
        (.media-controls.mac.inline.compact button.tracks):
        * Modules/modern-media-controls/images/macOS/airplay-compact@1x.png: Added.
        * Modules/modern-media-controls/images/macOS/airplay-compact@2x.png: Added.
        * Modules/modern-media-controls/images/macOS/media-selection-compact@1x.png: Added.
        * Modules/modern-media-controls/images/macOS/media-selection-compact@2x.png: Added.
        * Modules/modern-media-controls/images/macOS/pip-in-compact@1x.png: Added.
        * Modules/modern-media-controls/images/macOS/pip-in-compact@2x.png: Added.
        * Modules/modern-media-controls/images/macOS/volume-compact@1x.png:
        * Modules/modern-media-controls/images/macOS/volume-compact@2x.png:
        * Modules/modern-media-controls/images/macOS/volume-mute-compact@1x.png: Added.
        * Modules/modern-media-controls/images/macOS/volume-mute-compact@2x.png: Added.

2017-02-28  Chris Dumez  <cdumez@apple.com>

        [iOS] Throttle requestAnimationFrame to 30fps in low power mode
        https://bugs.webkit.org/show_bug.cgi?id=168837
        <rdar://problem/30700929>

        Reviewed by Simon Fraser.

        Throttle requestAnimationFrame to 30fps in low power mode on iOS to save battery.

        ScriptedAnimationController now maintains an OptionSet of throttling reasons.
        Throttling reasons for now are: OutsideViewport, VisuallyIdle, and LowPowerMode.
        The requestAnimationFrame interval is then determined based on those throttling
        reasons:
        - OutsideViewport or VisuallyIdle: 10 seconds (very aggressive throttling)
        - LowPowerMode: 30fps
        - No reasons: 60fps

        The Page now keeps track of low power mode state using a LowPowerModeNotifier.
        Whenever low power mode changes, it updates the throttling reasons in all the
        documents' ScriptedAnimationControllers in the frame tree.

        Tests: fast/animation/request-animation-frame-throttling-detached-iframe.html
               fast/animation/request-animation-frame-throttling-lowPowerMode.html

        * dom/Document.cpp:
        (WebCore::Document::requestAnimationFrame):
        * dom/Document.h:
        * dom/ScriptedAnimationController.cpp:
        (WebCore::ScriptedAnimationController::ScriptedAnimationController):
        (WebCore::throttlingReasonToString):
        (WebCore::throttlingReasonsToString):
        (WebCore::ScriptedAnimationController::addThrottlingReason):
        (WebCore::ScriptedAnimationController::removeThrottlingReason):
        (WebCore::ScriptedAnimationController::isThrottled):
        (WebCore::ScriptedAnimationController::interval):
        (WebCore::ScriptedAnimationController::page):
        (WebCore::ScriptedAnimationController::scheduleAnimation):
        * dom/ScriptedAnimationController.h:
        (WebCore::ScriptedAnimationController::create):
        * page/FrameView.cpp:
        (WebCore::FrameView::updateScriptedAnimationsAndTimersThrottlingState):
        * page/Page.cpp:
        (WebCore::Page::Page):
        (WebCore::Page::isLowPowerModeEnabled):
        (WebCore::Page::setLowPowerModeEnabledOverrideForTesting):
        (WebCore::updateScriptedAnimationsThrottlingReason):
        (WebCore::Page::setIsVisuallyIdleInternal):
        (WebCore::Page::handleLowModePowerChange):
        * page/Page.h:
        * testing/Internals.cpp:
        (WebCore::Internals::resetToConsistentState):
        (WebCore::Internals::requestAnimationFrameInterval):
        (WebCore::Internals::setLowPowerModeEnabled):
        * testing/Internals.h:
        * testing/Internals.idl:

2017-02-28  Youenn Fablet  <youenn@apple.com>

        [WebRTC] Limit libwebrtc logging in Debug build
        https://bugs.webkit.org/show_bug.cgi?id=168974

        Reviewed by Alex Christensen.

        Covered by manual testing..

        * platform/Logging.h:
        * platform/mediastream/libwebrtc/LibWebRTCProvider.cpp:
        (WebCore::LibWebRTCProvider::callOnWebRTCSignalingThread):

2017-02-28  Myles C. Maxfield  <mmaxfield@apple.com>

        [macOS] Migrate off of CTFontCreateForCSS
        https://bugs.webkit.org/show_bug.cgi?id=168678

        Reviewed by David Hyatt.

        This patch implements the Font Matching Algorithm detailed in
        https://drafts.csswg.org/css-fonts-4/#font-matching-algorithm
        Previously, this was implemented inside Core Text (via
        CTFontCreateForCSS()), but that implementation does not understand
        variation fonts. Therefore it should move to WebKit (along with
        the general fact that CSS algorithms should be implemented in a
        CSS engine, not the platform's text engine).

        This implementation is not completely divorced from the platform,
        however - Core Text exposes font weights on a [-1, 1] range, but
        CSS operates on a [1, 999] range. In order to provide the mapping
        to CSS weights, Core Text infrastructure is necessary. Therefore,
        this new implementation of the matching algorithm is only used
        on certain operating systems.

        The new implementation of the algorithm is not bug-compatible with
        the existing implementation; this patch does represent a behavior
        change. However, I have reviewed the differences manually and
        believe this algorithm to be a progression over the previous one
        (except for one case with Helvetica Neue - see
        LayoutTests/ChangeLog for more information about that).

        This patch also represents a 27% performance progression on our
        standard page load test (just measuring the performance of the font
        matching algorithm, and nothing else). (Because font matching is
        only a small part of the entire test, the overall progression is
        much smaller.)

        Tests: FontCacheTest.FontLookupFromFamilyName
               FontCacheTest.FontLookupFromPostScriptName

        * platform/graphics/FontCache.h:
        (WebCore::FontCache::createFontPlatformDataForTesting): Allow for
        unit testing.
        * platform/graphics/cocoa/FontCacheCoreText.cpp:
        (WebCore::isSystemFont): Inlined.
        (WebCore::FontDatabase::singleton): Cache results of Core Text
        lookups.
        (WebCore::FontDatabase::Range::Range): Because of variation fonts,
        fonts' weights, widths, and slopes need to be represented as a range
        instead of an individual value.
        (WebCore::FontDatabase::Range::isValid):
        (WebCore::FontDatabase::Range::expand):
        (WebCore::FontDatabase::Range::includes):
        (WebCore::FontDatabase::InstalledFont::InstalledFont): Represents a
        Font Descriptor as well as some lookup information about it.
        (WebCore::FontDatabase::InstalledFontCollection::InstalledFontCollection):
        A collection of installed fonts.
        (WebCore::FontDatabase::InstalledFontCollection::insertInstalledFont):
        Cache minima and maxima.
        (WebCore::FontDatabase::InstalledFontCollection::isEmpty):
        (WebCore::FontDatabase::InstalledFontCollection::size):
        (WebCore::FontDatabase::lookupFamilyName): Get all the fonts in
        the family.
        (WebCore::FontDatabase::lookupPostScriptName): Get the font with
        the given PostScript name.
        (WebCore::FontDatabase::clear):
        (WebCore::FontDatabase::FontDatabase): Cache.
        (WebCore::iterateActiveFontsWithReturn): The Font Matching Algorithm
        works by starting with every font in the family, and the eliminating
        items from the set iteratively. Instead of actually removing items
        from a vector or linked list, we instead want to treat the collection
        as immutable and keep a parallel side-table of which items have been
        eliminated (in order to reduce copies and allocations). This makes
        sense because most families only have a handful of fonts in them.
        This function consults with the side-table to iterate only over the
        fonts which have not been eliminated.
        (WebCore::iterateActiveFonts): Ditto.
        (WebCore::findClosestStretch):
        (WebCore::filterStretch): Eliminate fonts based on their stretch
        value.
        (WebCore::findClosestStyle):
        (WebCore::filterStyle): Eliminate fonts based on their style value.
        (WebCore::findClosestWeight):
        (WebCore::filterWeight): Eliminate fonts based on their weight value.
        (WebCore::computeTargetWeight):
        (WebCore::findClosestFont): If we have a set of fonts in a family,
        select the font in the set which best matches the criteria.
        (WebCore::platformFontLookupWithFamily): While findClosestFont()
        function satisfies the spec's notion of the font matching algorithm,
        WebKit actually claims to be able to look up fonts by their PostScript
        name. Therefore, this function has a higher-level of logic to rectify
        the confusion that results when the PostScript name doesn't agree with
        the other CSS properties (like if you say "Helvetica-Bold" but also say
        font-weight: 100).
        * platform/spi/cocoa/CoreTextSPI.h: Add signature for system CSS
        font weight support.

2017-02-24  Matt Rajca  <mrajca@apple.com>

        Media: notify clients when autoplayed media ends without being paused
        https://bugs.webkit.org/show_bug.cgi?id=168852

        Reviewed by Alex Christensen.

        Added API tests.

        * html/HTMLMediaElement.cpp:
        (WebCore::HTMLMediaElement::setReadyState):
         Set state accordingly if we autoplayed or if playback was prevented.
        (WebCore::HTMLMediaElement::play):
         Update state if playback was prevented.
        (WebCore::HTMLMediaElement::playInternal):
         Update state if playback began without user interaction.
        (WebCore::HTMLMediaElement::pauseInternal):
         Update state.
        (WebCore::HTMLMediaElement::mediaPlayerTimeChanged):
         If playback ends and it began without user interaction, send a DidPlayMediaWithoutInterference event.
        (WebCore::HTMLMediaElement::stopWithoutDestroyingMediaPlayer): Ditto.
        * html/HTMLMediaElement.h:
        * page/AutoplayEvent.h:

2017-02-27  Dave Hyatt  <hyatt@apple.com>

        Update flexbox to Blink's tip of tree
        https://bugs.webkit.org/show_bug.cgi?id=168657

        Reviewed by Zalan Bujtas.

        Added new tests in css3/flexbox.

        * CMakeLists.txt:
        * WebCore.xcodeproj/project.pbxproj:
        * css/CSSComputedStyleDeclaration.cpp:
        (WebCore::ComputedStyleExtractor::propertyValue):
        * rendering/FlexibleBoxAlgorithm.cpp: Added.
        (WebCore::FlexItem::FlexItem):
        (WebCore::FlexLayoutAlgorithm::FlexLayoutAlgorithm):
        (WebCore::FlexLayoutAlgorithm::computeNextFlexLine):
        * rendering/FlexibleBoxAlgorithm.h: Added.
        (WebCore::FlexItem::hypotheticalMainAxisMarginBoxSize):
        (WebCore::FlexItem::flexBaseMarginBoxSize):
        (WebCore::FlexItem::flexedMarginBoxSize):
        (WebCore::FlexLayoutAlgorithm::isMultiline):
        * rendering/GridTrackSizingAlgorithm.cpp:
        (WebCore::GridTrackSizingAlgorithm::computeTrackBasedSize):
        (WebCore::GridTrackSizingAlgorithm::increaseSizesToAccommodateSpanningItems):
        (WebCore::GridTrackSizingAlgorithm::assumedRowsSizeForOrthogonalChild):
        (WebCore::GridTrackSizingAlgorithm::gridAreaBreadthForChild):
        (WebCore::IndefiniteSizeStrategy::recomputeUsedFlexFractionIfNeeded):
        * rendering/GridTrackSizingAlgorithm.h:
        * rendering/OrderIterator.cpp:
        (WebCore::OrderIterator::next):
        (WebCore::OrderIterator::reset):
        (WebCore::OrderIteratorPopulator::~OrderIteratorPopulator):
        (WebCore::OrderIteratorPopulator::collectChild):
        (WebCore::OrderIteratorPopulator::OrderIteratorPopulator): Deleted.
        (WebCore::OrderIteratorPopulator::removeDuplicatedOrderValues): Deleted.
        * rendering/OrderIterator.h:
        (WebCore::OrderIteratorPopulator::OrderIteratorPopulator):
        * rendering/RenderBlock.cpp:
        (WebCore::RenderBlock::updateBlockChildDirtyBitsBeforeLayout):
        (WebCore::RenderBlock::layoutPositionedObject):
        (WebCore::RenderBlock::computeBlockPreferredLogicalWidths):
        (WebCore::RenderBlock::computeChildPreferredLogicalWidths):
        (WebCore::RenderBlock::hasDefiniteLogicalHeight):
        (WebCore::RenderBlock::availableLogicalHeightForPercentageComputation):
        * rendering/RenderBlock.h:
        (WebCore::RenderBlock::hasPercentHeightDescendants):
        * rendering/RenderBlockFlow.cpp:
        (WebCore::RenderBlockFlow::computeInlinePreferredLogicalWidths):
        * rendering/RenderBox.cpp:
        (WebCore::RenderBox::columnFlexItemHasStretchAlignment):
        (WebCore::RenderBox::isStretchingColumnFlexItem):
        (WebCore::RenderBox::hasStretchedLogicalWidth):
        (WebCore::RenderBox::sizesLogicalWidthToFitContent):
        (WebCore::RenderBox::computeInlineDirectionMargins):
        (WebCore::RenderBox::cacheIntrinsicContentLogicalHeightForFlexItem):
        (WebCore::RenderBox::updateLogicalHeight):
        (WebCore::RenderBox::computeLogicalHeightWithoutLayout):
        (WebCore::RenderBox::skipContainingBlockForPercentHeightCalculation):
        (WebCore::RenderBox::shouldTreatChildAsReplacedInTableCells):
        (WebCore::tableCellShouldHaveZeroInitialSize):
        (WebCore::RenderBox::computePercentageLogicalHeight):
        (WebCore::RenderBox::computeReplacedLogicalHeightUsing):
        (WebCore::RenderBox::availableLogicalHeightUsing):
        (WebCore::RenderBox::percentageLogicalHeightIsResolvable):
        (WebCore::RenderBox::hasUnsplittableScrollingOverflow):
        (WebCore::flexItemHasStretchAlignment): Deleted.
        (WebCore::isStretchingColumnFlexItem): Deleted.
        (WebCore::logicalWidthIsResolvable): Deleted.
        (WebCore::RenderBox::hasDefiniteLogicalWidth): Deleted.
        (WebCore::percentageLogicalHeightIsResolvable): Deleted.
        (WebCore::RenderBox::percentageLogicalHeightIsResolvableFromBlock): Deleted.
        (WebCore::RenderBox::hasDefiniteLogicalHeight): Deleted.
        * rendering/RenderBox.h:
        (WebCore::RenderBox::isGridItem):
        (WebCore::RenderBox::isFlexItem):
        (WebCore::RenderBox::selfAlignmentNormalBehavior):
        * rendering/RenderBoxModelObject.cpp:
        (WebCore::isOutOfFlowPositionedWithImplicitHeight):
        (WebCore::RenderBoxModelObject::containingBlockForAutoHeightDetection):
        (WebCore::RenderBoxModelObject::hasAutoHeightOrContainingBlockWithAutoHeight):
        * rendering/RenderBoxModelObject.h:
        * rendering/RenderElement.cpp:
        (WebCore::RenderElement::removeChildInternal):
        * rendering/RenderFlexibleBox.cpp:
        (WebCore::RenderFlexibleBox::LineContext::LineContext):
        (WebCore::RenderFlexibleBox::RenderFlexibleBox):
        (WebCore::RenderFlexibleBox::computeIntrinsicLogicalWidths):
        (WebCore::contentAlignmentNormalBehavior):
        (WebCore::RenderFlexibleBox::styleDidChange):
        (WebCore::RenderFlexibleBox::layoutBlock):
        (WebCore::RenderFlexibleBox::repositionLogicalHeightDependentFlexItems):
        (WebCore::RenderFlexibleBox::clientLogicalBottomAfterRepositioning):
        (WebCore::RenderFlexibleBox::hasOrthogonalFlow):
        (WebCore::RenderFlexibleBox::flexBasisForChild):
        (WebCore::RenderFlexibleBox::crossAxisExtentForChild):
        (WebCore::RenderFlexibleBox::cachedChildIntrinsicContentLogicalHeight):
        (WebCore::RenderFlexibleBox::setCachedChildIntrinsicContentLogicalHeight):
        (WebCore::RenderFlexibleBox::clearCachedChildIntrinsicContentLogicalHeight):
        (WebCore::RenderFlexibleBox::childIntrinsicLogicalHeight):
        (WebCore::RenderFlexibleBox::childIntrinsicLogicalWidth):
        (WebCore::RenderFlexibleBox::crossAxisIntrinsicExtentForChild):
        (WebCore::RenderFlexibleBox::mainAxisExtentForChild):
        (WebCore::RenderFlexibleBox::mainAxisContentExtentForChildIncludingScrollbar):
        (WebCore::RenderFlexibleBox::crossAxisExtent):
        (WebCore::RenderFlexibleBox::mainAxisExtent):
        (WebCore::RenderFlexibleBox::mainAxisContentExtent):
        (WebCore::RenderFlexibleBox::computeMainAxisExtentForChild):
        (WebCore::RenderFlexibleBox::transformedWritingMode):
        (WebCore::RenderFlexibleBox::flowAwareMarginStartForChild):
        (WebCore::RenderFlexibleBox::flowAwareMarginEndForChild):
        (WebCore::RenderFlexibleBox::flowAwareMarginBeforeForChild):
        (WebCore::RenderFlexibleBox::crossAxisMarginExtentForChild):
        (WebCore::RenderFlexibleBox::flowAwareLocationForChild):
        (WebCore::RenderFlexibleBox::useChildAspectRatio):
        (WebCore::RenderFlexibleBox::computeMainSizeFromAspectRatioUsing):
        (WebCore::RenderFlexibleBox::setFlowAwareLocationForChild):
        (WebCore::RenderFlexibleBox::mainAxisLengthIsDefinite):
        (WebCore::RenderFlexibleBox::crossAxisLengthIsDefinite):
        (WebCore::RenderFlexibleBox::cacheChildMainSize):
        (WebCore::RenderFlexibleBox::clearCachedMainSizeForChild):
        (WebCore::RenderFlexibleBox::computeInnerFlexBaseSizeForChild):
        (WebCore::RenderFlexibleBox::layoutFlexItems):
        (WebCore::RenderFlexibleBox::autoMarginOffsetInMainAxis):
        (WebCore::RenderFlexibleBox::updateAutoMarginsInMainAxis):
        (WebCore::RenderFlexibleBox::hasAutoMarginsInCrossAxis):
        (WebCore::RenderFlexibleBox::availableAlignmentSpaceForChild):
        (WebCore::RenderFlexibleBox::updateAutoMarginsInCrossAxis):
        (WebCore::RenderFlexibleBox::marginBoxAscentForChild):
        (WebCore::RenderFlexibleBox::computeChildMarginValue):
        (WebCore::RenderFlexibleBox::adjustChildSizeForMinAndMax):
        (WebCore::RenderFlexibleBox::crossSizeForPercentageResolution):
        (WebCore::RenderFlexibleBox::mainSizeForPercentageResolution):
        (WebCore::RenderFlexibleBox::childLogicalHeightForPercentageResolution):
        (WebCore::RenderFlexibleBox::adjustChildSizeForAspectRatioCrossAxisMinAndMax):
        (WebCore::RenderFlexibleBox::constructFlexItem):
        (WebCore::RenderFlexibleBox::freezeViolations):
        (WebCore::RenderFlexibleBox::freezeInflexibleItems):
        (WebCore::RenderFlexibleBox::resolveFlexibleLengths):
        (WebCore::alignmentOffset):
        (WebCore::RenderFlexibleBox::setOverrideMainAxisContentSizeForChild):
        (WebCore::RenderFlexibleBox::staticMainAxisPositionForPositionedChild):
        (WebCore::RenderFlexibleBox::staticCrossAxisPositionForPositionedChild):
        (WebCore::RenderFlexibleBox::staticInlinePositionForPositionedChild):
        (WebCore::RenderFlexibleBox::staticBlockPositionForPositionedChild):
        (WebCore::RenderFlexibleBox::setStaticPositionForPositionedLayout):
        (WebCore::RenderFlexibleBox::prepareChildForPositionedLayout):
        (WebCore::RenderFlexibleBox::alignmentForChild):
        (WebCore::RenderFlexibleBox::resetAutoMarginsAndLogicalTopInCrossAxis):
        (WebCore::RenderFlexibleBox::needToStretchChildLogicalHeight):
        (WebCore::RenderFlexibleBox::childHasIntrinsicMainAxisSize):
        (WebCore::RenderFlexibleBox::crossAxisOverflowForChild):
        (WebCore::RenderFlexibleBox::layoutAndPlaceChildren):
        (WebCore::RenderFlexibleBox::layoutColumnReverse):
        (WebCore::initialAlignContentOffset):
        (WebCore::alignContentSpaceBetweenChildren):
        (WebCore::RenderFlexibleBox::alignFlexLines):
        (WebCore::RenderFlexibleBox::adjustAlignmentForChild):
        (WebCore::RenderFlexibleBox::alignChildren):
        (WebCore::RenderFlexibleBox::applyStretchAlignmentToChild):
        (WebCore::RenderFlexibleBox::flipForRightToLeftColumn):
        (WebCore::RenderFlexibleBox::flipForWrapReverse):
        (WebCore::RenderFlexibleBox::Violation::Violation): Deleted.
        (WebCore::RenderFlexibleBox::setCrossAxisExtent): Deleted.
        (WebCore::RenderFlexibleBox::flowAwareMarginAfterForChild): Deleted.
        (WebCore::RenderFlexibleBox::mainAxisBorderAndPaddingExtentForChild): Deleted.
        (WebCore::RenderFlexibleBox::mainAxisScrollbarExtentForChild): Deleted.
        (WebCore::RenderFlexibleBox::preferredMainAxisContentExtentForChild): Deleted.
        (WebCore::RenderFlexibleBox::computeNextFlexLine): Deleted.
        (WebCore::RenderFlexibleBox::setLogicalOverrideSize): Deleted.
        (WebCore::RenderFlexibleBox::numberOfInFlowPositionedChildren): Deleted.
        (WebCore::RenderFlexibleBox::needToStretchChild): Deleted.
        (WebCore::contentAlignmentNormalBehaviorFlexibleBox): Deleted.
        * rendering/RenderFlexibleBox.h:
        (WebCore::RenderFlexibleBox::orderIterator):
        (WebCore::RenderFlexibleBox::isFlexibleBoxImpl):
        * rendering/RenderFullScreen.h:
        * rendering/RenderGrid.cpp:
        (WebCore::selfAlignmentChangedToStretchInRowAxis):
        (WebCore::selfAlignmentChangedFromStretchInRowAxis):
        (WebCore::selfAlignmentChangedFromStretchInColumnAxis):
        (WebCore::RenderGrid::styleDidChange):
        (WebCore::RenderGrid::computeTrackBasedLogicalHeight):
        (WebCore::RenderGrid::computeTrackSizesForDefiniteSize):
        (WebCore::RenderGrid::gridGapForDirection):
        (WebCore::RenderGrid::guttersSize):
        (WebCore::RenderGrid::computeTrackSizesForIndefiniteSize):
        (WebCore::RenderGrid::computeAutoRepeatTracksCount):
        (WebCore::RenderGrid::trackSizesForComputedStyle):
        (WebCore::RenderGrid::offsetAndBreadthForPositionedChild):
        (WebCore::RenderGrid::populateGridPositionsForDirection):
        (WebCore::RenderGrid::alignSelfForChild):
        (WebCore::RenderGrid::justifySelfForChild):
        (WebCore::RenderGrid::columnAxisPositionForChild):
        (WebCore::RenderGrid::rowAxisPositionForChild):
        (WebCore::RenderGrid::columnAxisOffsetForChild):
        (WebCore::RenderGrid::rowAxisOffsetForChild):
        (WebCore::RenderGrid::needToStretchChildLogicalHeight): Deleted.
        * rendering/RenderGrid.h:
        * rendering/RenderLayer.cpp:
        (WebCore::RenderLayer::updateScrollbarsAfterLayout):
        * rendering/RenderListBox.cpp:
        (WebCore::RenderListBox::computeLogicalHeight):
        * rendering/RenderTable.cpp:
        (WebCore::RenderTable::layout):
        * rendering/RenderTableCell.cpp:
        (WebCore::RenderTableCell::layout):
        * rendering/RenderTableSection.cpp:
        (WebCore::shouldFlexCellChild):
        (WebCore::RenderTableSection::relayoutCellIfFlexed):
        (WebCore::RenderTableSection::layoutRows):
        * rendering/RenderTableSection.h:
        * rendering/RenderTextControl.cpp:
        (WebCore::RenderTextControl::computeLogicalHeight):
        * rendering/style/RenderStyle.cpp:
        (WebCore::resolvedSelfAlignment):
        (WebCore::RenderStyle::resolvedAlignSelf):
        (WebCore::RenderStyle::resolvedJustifySelf):
        * rendering/style/RenderStyle.h:
        * style/RenderTreeUpdater.cpp:
        (WebCore::textRendererIsNeeded):

2017-02-28  Alex Christensen  <achristensen@webkit.org>

        Main resource requests need cachePartition
        https://bugs.webkit.org/show_bug.cgi?id=168806
        <rdar://30639764>

        Reviewed by Brady Eidson.

        Test: http/tests/security/credentials-main-resource.html

        r211751 caused an unintended regression on pages whose main resource is protected
        by basic authentication.  We were not setting the cache partition for main resource
        requests, and we use the cache partition now for credentials, so the credentials for
        the main resource were not being put into a partition in the CredentialStorage that
        would not be used for subresources of the page, whose requests had the correct partition
        for the domain of the page.  This caused users to have to enter their credentials twice,
        once for the main resource and once for any subresources.  This is fixed by using the
        domain from the main resource request as the cache partition.  Elsewhere the Document is
        used to get the cache partition, but there is no Document yet when requesting the main resource.

        * loader/DocumentLoader.cpp:
        (WebCore::DocumentLoader::startLoadingMainResource):
        Set the cache partition for the main resource loads based on the SecurityOrigin of the
        initial request if we are loading the main resource for a new top document.  If the main resource
        request is redirected, then we will still use the partition of the initial request because that is
        what the user requested and that is where the user entered the credentials.
        * loader/cache/CachedResourceLoader.h:
        * loader/cache/CachedResourceRequest.cpp:
        (WebCore::CachedResourceRequest::setDomainForCachePartition):
        * loader/cache/CachedResourceRequest.h:

2017-02-28  Alex Christensen  <achristensen@webkit.org>

        REGRESSION: LayoutTest http/tests/security/credentials-iframes.html is failing on ios-simulator
        https://bugs.webkit.org/show_bug.cgi?id=167967

        Reviewed by Brady Eidson.

        XHR credentials have a persistence of CredentialPersistenceNone because we keep
        them in the WebCore::CredentialStorage.  We were storing them to CFNetwork's NSURLCredentialStorage
        on iOS and then they were being given as the proposedCredential in
        NetworkDataTaskCocoa::tryPasswordBasedAuthentication even though we set CredentialPersistenceNone.

        This fixes http/tests/security/credentials-iframes.html

        * platform/network/CredentialStorage.cpp:
        (WebCore::CredentialStorage::set):
        * platform/network/CredentialStorage.h:
        * platform/network/cf/CredentialStorageCFNet.cpp:
        (WebCore::CredentialStorage::saveToPersistentStorage): Deleted.
        * platform/network/mac/CredentialStorageMac.mm:
        (WebCore::CredentialStorage::saveToPersistentStorage): Deleted.

2017-02-27  Alex Christensen  <achristensen@webkit.org>

        Fix WinCairo build.

        * PlatformWinCairo.cmake:

2017-02-27  Alex Christensen  <achristensen@webkit.org>

        Begin enabling WebRTC on 64-bit
        https://bugs.webkit.org/show_bug.cgi?id=168915

        Reviewed by Eric Carlson.

        * Configurations/FeatureDefines.xcconfig:

2017-02-27  Antoine Quint  <graouts@apple.com>

        [Modern Media Controls] Use compact mode by default on macOS
        https://bugs.webkit.org/show_bug.cgi?id=168958
        <rdar://problem/30748638>

        Reviewed by Jon Lee.

        We now use the compact layout mode by default on macOS.

        * Modules/modern-media-controls/controls/layout-item.js: Remove the ReducedPadding trait.
        * Modules/modern-media-controls/controls/macos-compact-inline-media-controls.css: 
        (.media-controls.mac.inline.compact .time-label,): Vertically align the time label with
        the scrubber in compact mode.
        (.media-controls.mac.inline.compact .scrubber.slider): Correctly position the scrubber in
        compact mode so that it's vertically aligned.
        * Modules/modern-media-controls/controls/macos-inline-media-controls.js:
        (MacOSInlineMediaControls.prototype.layoutTraitsDidChange): Remove handling of tight and
        reduced padding traits since these do not apply to macOS anymore. We also notify the
        scrubber of a layout trait change so that it may adjust its height.
        * Modules/modern-media-controls/controls/scrubber.js:
        (Scrubber):
        (Scrubber.prototype.layoutTraitsDidChange): Adjust the height of the scrubber to match
        compact layout traits.
        * Modules/modern-media-controls/controls/time-control.js:
        (TimeControl.prototype.get isSufficientlyWide): Adjust the minimum scrubber width for
        TimeControl visibility to match compact layout traits.
        * Modules/modern-media-controls/media/media-controller.js:
        (MediaController.prototype.get layoutTraits): Use the compact layout trait by default
        on macOS and make the tight padding specific to iOS.

2017-02-27  Antoine Quint  <graouts@apple.com>

        [Modern Media Controls] Adhere to tight padding on iOS
        https://bugs.webkit.org/show_bug.cgi?id=168949
        <rdar://problem/30746164>

        Reviewed by Jon Lee.

        We used to only support custom margins on macOS, to support this on iOS as
        well, we promote the notification when the layoutTraits property is set to
        MediaControls and expose a new protected method layoutTraitsDidChange() for
        subclasses to implement. IOSInlineMediaControls now implements that method
        and will use tighter margins for the TightPadding layout trait.

        Test: media/modern-media-controls/ios-inline-media-controls/ios-inline-media-controls-tight-padding.html

        * Modules/modern-media-controls/controls/ios-inline-media-controls.js:
        (IOSInlineMediaControls.prototype.layoutTraitsDidChange):
        (IOSInlineMediaControls):
        * Modules/modern-media-controls/controls/macos-inline-media-controls.js:
        (MacOSInlineMediaControls.prototype.get layoutTraits): Deleted.
        (MacOSInlineMediaControls.prototype.set layoutTraits): Deleted.
        (MacOSInlineMediaControls.prototype._matchLayoutTraits): Deleted.
        * Modules/modern-media-controls/controls/media-controls.js:
        (MediaControls.prototype.get layoutTraits):
        (MediaControls.prototype.set layoutTraits):
        (MediaControls.prototype.layoutTraitsDidChange):

2017-02-27  Youenn Fablet  <youenn@apple.com>

        [WebRTC] Support modern RTCStatsReport
        https://bugs.webkit.org/show_bug.cgi?id=166916
        <rdar://problem/30293780>

        Reviewed by Alex Christensen.

        Updating binding generator and IDL parser to handle maplike.
        Covered by binding tests.

        Added support for maplike binding from JS wrapper to DOM class.
        The principle is to have the JSXX wrapper having a @backingMap slot containing a Map.
        All maplike methods are forwarded to the corresponding Map methods.
        The XX object is responsible to add key/value pairs using a helper routine.
        The creation of the Map is done at creation of the JSXX wrapper.

        DOM class is interacting with the map through DOMMapLike.
        Extracted DOMGuarded from DOM promise implementation.
        This allows reusing this code for DOMMapLike.

        Covered by binding tests and manual tests.

        * CMakeLists.txt:
        * DerivedSources.make:
        * Modules/mediastream/RTCStatsReport.h:
        (WebCore::RTCStatsReport::InboundRTPStreamStats::InboundRTPStreamStats):
        (WebCore::RTCStatsReport::OutboundRTPStreamStats::OutboundRTPStreamStats):
        (WebCore::RTCStatsReport::create):
        (WebCore::RTCStatsReport::synchronizeBackingMap):
        (WebCore::RTCStatsReport::backingMap):
        (WebCore::RTCStatsReport::addStats):
        * Modules/mediastream/RTCStatsReport.idl:
        * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp:
        (WebCore::fromStdString):
        (WebCore::fillRTCStats):
        (WebCore::fillRTCRTPStreamStats):
        (WebCore::fillInboundRTPStreamStats):
        (WebCore::fillOutboundRTPStreamStats):
        (WebCore::LibWebRTCMediaEndpoint::StatsCollector::OnStatsDelivered):
        * Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.h:
        * WebCore.xcodeproj/project.pbxproj:
        * bindings/js/JSDOMBindingInternals.js: Added.
        (mapLikeForEach):
        * bindings/js/JSDOMGlobalObject.cpp:
        (WebCore::JSDOMGlobalObject::visitChildren):
        * bindings/js/JSDOMGlobalObject.h:
        * bindings/js/JSDOMGuardedObject.cpp: Added.
        (WebCore::DOMGuardedObject::DOMGuardedObject):
        (WebCore::DOMGuardedObject::~DOMGuardedObject):
        (WebCore::DOMGuardedObject::clear):
        (WebCore::DOMGuardedObject::contextDestroyed):
        * bindings/js/JSDOMGuardedObject.h: Added.
        (WebCore::DOMGuardedObject::isSuspended):
        (WebCore::DOMGuardedObject::visitAggregate):
        (WebCore::DOMGuardedObject::guardedObject):
        (WebCore::DOMGuardedObject::globalObject):
        (WebCore::DOMGuardedObject::isEmpty):
        (WebCore::DOMGuarded::DOMGuarded):
        (WebCore::DOMGuarded::guarded):
        * bindings/js/JSDOMMapLike.cpp: Added.
        (WebCore::getBackingMap):
        (WebCore::initializeBackingMap):
        (WebCore::createBackingMap):
        (WebCore::forwardAttributeGetterToBackingMap):
        (WebCore::forwardFunctionCallToBackingMap):
        (WebCore::forwardForEachCallToBackingMap):
        * bindings/js/JSDOMMapLike.h: Added.
        (WebCore::DOMMapLike::set):
        (WebCore::synchronizeBackingMap):
        (WebCore::forwardSizeToMapLike):
        (WebCore::forwardEntriesToMapLike):
        (WebCore::forwardKeysToMapLike):
        (WebCore::forwardValuesToMapLike):
        (WebCore::forwardClearToMapLike):
        (WebCore::forwardForEachToMapLike):
        (WebCore::forwardHasToMapLike):
        (WebCore::forwardAddToMapLike):
        (WebCore::forwardDeleteToMapLike):
        * bindings/js/JSDOMPromise.cpp:
        (WebCore::DeferredPromise::promise):
        (WebCore::DeferredPromise::reject):
        * bindings/js/JSDOMPromise.h:
        (WebCore::DeferredPromise::resolve):
        (WebCore::DeferredPromise::resolveWithNewlyCreated):
        (WebCore::DeferredPromise::reject):
        (WebCore::DeferredPromise::resolveWithCallback):
        (WebCore::DeferredPromise::rejectWithCallback):
        (WebCore::DeferredPromise::DeferredPromise):
        (WebCore::DeferredPromise::deferred):
        * bindings/js/WebCoreBuiltinNames.h:
        * bindings/scripts/CodeGeneratorJS.pm:
        (PrototypeFunctionCount):
        (GeneratePropertiesHashTable):
        (InterfaceNeedsIterator):
        (GenerateImplementation):
        (GenerateParametersCheck):
        * bindings/scripts/IDLParser.pm:
        (assert):
        (parseAttributeOrOperationOrIterator):
        (parseSerializer):
        (parseAttributeOrOperationRest):
        (parseAttribute):
        (parseAttributeRest):
        (parseOperationOrIterator):
        (parseOptionalIterableInterface):
        (parseMapLikeRest):
        (parseMapLikeProperties):
        (parseOperationRest):
        (applyMemberList):
        * bindings/scripts/test/JS/JSMapLike.cpp: Added.
        * bindings/scripts/test/JS/JSMapLike.h: Added.
        * bindings/scripts/test/JS/JSReadOnlyMapLike.cpp: Added.
        * bindings/scripts/test/JS/JSReadOnlyMapLike.h: Added.
        * bindings/scripts/test/TestMapLike.idl: Added.
        * bindings/scripts/test/TestReadOnlyMapLike.idl: Added.

2017-02-27  Mark Lam  <mark.lam@apple.com>

        Introduce a VM Traps mechanism and refactor Watchdog to use it.
        https://bugs.webkit.org/show_bug.cgi?id=168842

        Reviewed by Filip Pizlo.

        No new tests needed because this is a re-implementation of existing functionality.

        * bindings/js/WorkerScriptController.cpp:
        (WebCore::WorkerScriptController::WorkerScriptController):
        (WebCore::WorkerScriptController::scheduleExecutionTermination):

2017-02-27  Andy Estes  <aestes@apple.com>

        [Cocoa] Rename FileMac.mm to FileCocoa.mm
        https://bugs.webkit.org/show_bug.cgi?id=168947

        Reviewed by Zalan Bujtas.

        * PlatformMac.cmake:
        * WebCore.xcodeproj/project.pbxproj:
        * fileapi/FileCocoa.mm: Renamed from Source/WebCore/fileapi/FileMac.mm.

2017-02-27  Andy Estes  <aestes@apple.com>

        [iOS] Enable file replacement
        https://bugs.webkit.org/show_bug.cgi?id=168907
        <rdar://problem/22258242>

        Reviewed by David Kilzer.

        Covered by existing tests.

        * fileapi/FileMac.mm:
        (WebCore::File::shouldReplaceFile): Stop using Carbon and AppKit API for determining if a
        file path is a file package. Use NSURL and CoreServices instead, which exist on Mac and iOS.

2017-02-27  Antoine Quint  <graouts@apple.com>

        [Modern Media Controls] Use a solid background for <audio> controls on macOS
        https://bugs.webkit.org/show_bug.cgi?id=168941
        <rdar://problem/30744316>

        Reviewed by Dean Jackson.

        Use a solid background for <audio> elements on macOS, the same way we do on iOS.

        Test: media/modern-media-controls/macos-inline-media-controls/macos-inline-media-controls-audio-background.html

        * Modules/modern-media-controls/controls/macos-media-controls.css:
        (:host(audio) .media-controls.mac.inline > .controls-bar):
        (:host(audio) .media-controls.mac.inline > .controls-bar > .background-tint):

2017-02-27  Antoine Quint  <graouts@apple.com>

        [Modern Media Controls] StatusLabel should use similar properties to TimeLabel
        https://bugs.webkit.org/show_bug.cgi?id=168938
        <rdar://problem/30743185>

        Reviewed by Dean Jackson.

        Ensure we use the same styling properties for StatusLabel and TimeLabel.

        Tests: media/modern-media-controls/status-label/status-label-ios.html
               media/modern-media-controls/status-label/status-label-macos.html

        * Modules/modern-media-controls/controls/ios-inline-media-controls.css:
        (.media-controls.ios.inline .time-label,):
        (.media-controls.ios.inline .time-label): Deleted.
        * Modules/modern-media-controls/controls/macos-media-controls.css:
        (.media-controls.mac > .controls-bar .time-label,):
        (.media-controls.mac > .controls-bar .time-label): Deleted.
        * Modules/modern-media-controls/controls/status-label.css:
        (.status-label):

2017-02-27  Myles C. Maxfield  <mmaxfield@apple.com>

        Rename ICU cursor iterator to caret iterator
        https://bugs.webkit.org/show_bug.cgi?id=168206

        Reviewed by Simon Fraser.

        Mechanical find/replace.

        No new tests because there is no behavior change.

        * platform/graphics/ComplexTextController.cpp:
        (WebCore::ComplexTextController::offsetForPosition):
        * rendering/RenderText.cpp:
        (WebCore::RenderText::previousOffset):
        (WebCore::RenderText::nextOffset):

2017-02-27  Myles C. Maxfield  <mmaxfield@apple.com>

        Unprefix -webkit-line-break
        https://bugs.webkit.org/show_bug.cgi?id=168213

        Reviewed by Darin Adler.

        We support the property as specced.

        Test: fast/text/line-break-unprefixed.html

        * css/CSSComputedStyleDeclaration.cpp:
        (WebCore::ComputedStyleExtractor::propertyValue):
        * css/CSSProperties.json:
        * css/parser/CSSParserFastPaths.cpp:
        (WebCore::CSSParserFastPaths::isValidKeywordPropertyAndValue):
        (WebCore::CSSParserFastPaths::isKeywordPropertyID):
        * editing/Editor.cpp:
        (WebCore::Editor::applyEditingStyleToElement):
        * html/HTMLElement.cpp:
        (WebCore::HTMLElement::collectStyleForPresentationAttribute):

2017-02-27  Myles C. Maxfield  <mmaxfield@apple.com>

        Use RAII for ICU breaking iterators
        https://bugs.webkit.org/show_bug.cgi?id=168203

        Reviewed by Simon Fraser.

        No new tests because there is no behavior change.

        * platform/graphics/ComplexTextController.cpp:
        (WebCore::ComplexTextController::offsetForPosition):
        * rendering/RenderText.cpp:
        (WebCore::RenderText::previousOffset):
        (WebCore::RenderText::nextOffset):

2017-02-27  Basuke Suzuki  <Basuke.Suzuki@am.sony.com>

        [WinCairo][MiniBrowser] Add ca-bundle to display secure pages
        https://bugs.webkit.org/show_bug.cgi?id=168486

        Reviewed by Alex Christensen.

        change the order of path location search to make it possible to 
        configure with environment variable because bundled ca-bundle is
        always available now.

        * platform/network/curl/ResourceHandleManager.cpp:
        (WebCore::certificatePath):

2017-02-27  Antoine Quint  <graouts@apple.com>

        [Modern Media Controls] Status text does not appear on iOS
        https://bugs.webkit.org/show_bug.cgi?id=168918
        <rdar://problem/30737644>

        Reviewed by Dean Jackson.

        We refactor the layout code out of MacOSInlineMediaControls and into a new
        InlineLayoutSupport class which IOSInlineMediaControls uses as well. Now
        both the macOS and iOS inline media controls run the same layout logic to
        control whether the status label or scrubber should be displayed, and which
        controls should be dropped due to space constraints.

        Test: media/modern-media-controls/ios-inline-media-controls/ios-inline-media-controls-status-label.html

        * Modules/modern-media-controls/controls/inline-layout-support.js: Added.
        (InlineLayoutSupport):
        (InlineLayoutSupport.prototype.childrenAfterPerformingLayout):
        * Modules/modern-media-controls/controls/ios-inline-media-controls.js:
        (IOSInlineMediaControls.prototype.layout):
        (IOSInlineMediaControls):
        * Modules/modern-media-controls/controls/macos-inline-media-controls.js:
        (MacOSInlineMediaControls.prototype.layout):
        * Modules/modern-media-controls/js-files:

2017-02-27  Simon Fraser  <simon.fraser@apple.com>

        Add specification and status metadata to CSSProperties.json, and validate it
        https://bugs.webkit.org/show_bug.cgi?id=168901

        Reviewed by Darin Adler.

        Annotate CSS properties with data about the WebKit development status, and
        where they are specified. A property has a canonical specification reference,
        but individual values may have a reference to a more recent spec.

        Add a list of specifications to the JSON that properties reference by key.

        Enhance check-webkit-style to validate the status and spec data.

        * css/CSSProperties.json:

2017-02-27  Jiewen Tan  <jiewen_tan@apple.com>

        [CredentialManagement] Add IDL definitions for Credential, SiteBoundCredential, and PasswordCredential
        https://bugs.webkit.org/show_bug.cgi?id=168616
        <rdar://problem/30167149>

        Reviewed by Daniel Bates.

        This patch adds IDL definitions for:
        1. Credential(https://w3c.github.io/webappsec-credential-management/#interfaces-credential-types-credential),
        2. SiteBoundCredential(https://w3c.github.io/webappsec-credential-management/#interfaces-credential-types-siteboundcredential), and
        3. PasswordCredential(https://w3c.github.io/webappsec-credential-management/#interfaces-credential-types-passwordcredential).

        Test: credentials/idlharness.html

        * CMakeLists.txt:
        * DerivedSources.make:
        * Modules/credentials/BasicCredential.cpp: Added.
        (WebCore::BasicCredential::BasicCredential):
        (WebCore::BasicCredential::~BasicCredential):
        (WebCore::BasicCredential::type):
        * Modules/credentials/BasicCredential.h: Added.
        (WebCore::BasicCredential::id):
        * Modules/credentials/BasicCredential.idl: Added.
        * Modules/credentials/CredentialData.h: Added.
        * Modules/credentials/CredentialData.idl: Added.
        * Modules/credentials/PasswordCredential.cpp: Added.
        (WebCore::PasswordCredential::PasswordCredential):
        (WebCore::PasswordCredential::PasswordCredential):
        Dummy constructors for now.
        * Modules/credentials/PasswordCredential.h: Added.
        (WebCore::PasswordCredential::create):
        (WebCore::PasswordCredential::create):
        (WebCore::PasswordCredential::setIdName):
        (WebCore::PasswordCredential::idName):
        (WebCore::PasswordCredential::setPasswordName):
        (WebCore::PasswordCredential::passwordName):
        (WebCore::PasswordCredential::setAdditionalData):
        (WebCore::PasswordCredential::additionalData):
        * Modules/credentials/PasswordCredential.idl: Added.
        * Modules/credentials/SiteBoundCredential.cpp: Added.
        (WebCore::SiteBoundCredential::SiteBoundCredential):
        (WebCore::SiteBoundCredential::~SiteBoundCredential):
        * Modules/credentials/SiteBoundCredential.h: Added.
        (WebCore::SiteBoundCredential::name):
        (WebCore::SiteBoundCredential::iconURL):
        (WebCore::SiteBoundCredential::setOrigin):
        (WebCore::SiteBoundCredential::origin):
        * Modules/credentials/SiteBoundCredential.idl: Added.
        * Modules/credentials/SiteBoundCredentialData.h: Added.
        * Modules/credentials/SiteBoundCredentialData.idl: Added.
        * WebCore.xcodeproj/project.pbxproj:

2017-02-27  Jer Noble  <jer.noble@apple.com>

        [WebRTC] Fix remote audio rendering
        https://bugs.webkit.org/show_bug.cgi?id=168898

        Reviewed by Eric Carlson.

        Test: webrtc/audio-peer-connection-webaudio.html

        Fix MediaStreamAudioSourceNode by not bailing out early if the input sample rate doesn't match
        the AudioContext's sample rate; there's code in setFormat() to do the sample rate conversion
        correctly.

        * Modules/webaudio/MediaStreamAudioSourceNode.cpp:
        (WebCore::MediaStreamAudioSourceNode::setFormat):

        Fix AudioSampleBufferList by making the AudioConverter input proc a free function, and passing
        its refCon a struct containing only the information it needs to perform its task. Because the
        conversion may result in a different number of output samples than input ones, just ask to
        generate the entire capacity of the scratch buffer, and signal that the input buffer was fully
        converted with a special return value.

        * platform/audio/mac/AudioSampleBufferList.cpp:
        (WebCore::audioConverterFromABLCallback):
        (WebCore::AudioSampleBufferList::copyFrom):
        (WebCore::AudioSampleBufferList::convertInput): Deleted.
        (WebCore::AudioSampleBufferList::audioConverterCallback): Deleted.
        * platform/audio/mac/AudioSampleBufferList.h:

        Fix AudioSampleDataSource by updating both the sampleCount and the sampleTime after doing
        a sample rate conversion to take into account that both the number of samples may have changed,
        as well as the timeScale of the sampleTime. This may result in small off-by-one rounding errors
        due to the sample rate conversion of sampleTime, so remember what the next expected sampleTime
        should be, and correct sampleTime if it is indeed off-by-one. If the pull operation has gotten
        ahead of the push operation, delay the next pull by the empty amount by rolling back the
        m_outputSampleOffset. Introduce the same offset behavior during pull operations.

        * platform/audio/mac/AudioSampleDataSource.h:
        * platform/audio/mac/AudioSampleDataSource.mm:
        (WebCore::AudioSampleDataSource::pushSamplesInternal):
        (WebCore::AudioSampleDataSource::pullSamplesInternal):
        (WebCore::AudioSampleDataSource::pullAvalaibleSamplesAsChunks):

        Fix MediaPlayerPrivateMediaStreamAVFObjC by obeying the m_muted property.

        * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm:
        (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::setVolume):
        (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::setMuted):

        Fix LibWebRTCAudioModule by sleeping for the correct amount after emitting frames. Previously,
        LibWebRTCAudioModule would sleep for a fixed amount of time, which meant it would get slowly out
        of sync when emitting frames took a non-zero amount of time. Now, the amount of time before the
        next cycle starts is correctly calculated, and then LibWebRTCAudioModule sleeps for a dynamic amount
        of time in order to wake up correctly at the beginning of the next cycle.

        * platform/mediastream/libwebrtc/LibWebRTCAudioModule.cpp:
        (WebCore::LibWebRTCAudioModule::StartPlayoutOnAudioThread):

        Fix AudioTrackPrivateMediaStreamCocoa by just using the output unit's preferred format
        description (with the current system sample rate), rather than whatever is the current
        input description.

        * platform/mediastream/mac/AudioTrackPrivateMediaStreamCocoa.cpp:
        (WebCore::AudioTrackPrivateMediaStreamCocoa::createAudioUnit):
        (WebCore::AudioTrackPrivateMediaStreamCocoa::audioSamplesAvailable):
        * platform/mediastream/mac/AudioTrackPrivateMediaStreamCocoa.h:

        Fix RealtimeIncomingAudioSource by actually creating an AudioSourceProvider when asked.

        * platform/mediastream/mac/RealtimeIncomingAudioSource.cpp:
        (WebCore::RealtimeIncomingAudioSource::OnData):
        (WebCore::RealtimeIncomingAudioSource::audioSourceProvider):
        * platform/mediastream/mac/RealtimeIncomingAudioSource.h:

        Fix RealtimeOutgoingAudioSource by using the outgoing format description rather than the
        incoming one to determine the sample rate, channel count, sample byte size, etc., to use
        when delivering data upstream to libWebRTC.

        * platform/mediastream/mac/RealtimeOutgoingAudioSource.cpp:
        (WebCore::RealtimeOutgoingAudioSource::audioSamplesAvailable):
        (WebCore::RealtimeOutgoingAudioSource::pullAudioData):
        * platform/mediastream/mac/RealtimeOutgoingAudioSource.h:

        Fix WebAudioSourceProviderAVFObjC by using a AudioSampleDataSource to do format and sample
        rate conversion rather than trying to duplicate all that code and use a CARingBuffer and 
        AudioConverter directly.

        * platform/mediastream/mac/WebAudioSourceProviderAVFObjC.h:
        * platform/mediastream/mac/WebAudioSourceProviderAVFObjC.mm:
        (WebCore::WebAudioSourceProviderAVFObjC::~WebAudioSourceProviderAVFObjC):
        (WebCore::WebAudioSourceProviderAVFObjC::provideInput):
        (WebCore::WebAudioSourceProviderAVFObjC::prepare):
        (WebCore::WebAudioSourceProviderAVFObjC::unprepare):
        (WebCore::WebAudioSourceProviderAVFObjC::audioSamplesAvailable):

        Fix the MockLibWebRTCAudioTrack by passing along the AddSink() sink to its AudioSourceInterface,
        allowing the RealtimeOutgoingAudioSource to push data into the libWebRTC network stack. Also,
        make sure m_enabled is initialized to a good value.

        * testing/MockLibWebRTCPeerConnection.h:

2017-02-21  Jer Noble  <jer.noble@apple.com>

        AudioSampleDataSource should not exclusively lock its read and write threads.
        https://bugs.webkit.org/show_bug.cgi?id=168646

        Reviewed by Eric Carlson.

        Locking the write thread causes the read thread to drop audio samples and generates audible
        glitches, and the realtime audio thread backing the read thread should never block. There's
        no real reason to lock these threads against one another here; they both rely on the
        CARingBuffer to safely and simultaneously read and write data.

        * platform/audio/mac/AudioSampleDataSource.cpp:
        (WebCore::AudioSampleDataSource::setPaused):
        (WebCore::AudioSampleDataSource::pushSamplesInternal):
        (WebCore::AudioSampleDataSource::pushSamples):
        (WebCore::AudioSampleDataSource::pullSamplesInternal):
        (WebCore::AudioSampleDataSource::pullAvalaibleSamplesAsChunks):
        (WebCore::AudioSampleDataSource::pullSamples):
        * platform/audio/mac/AudioSampleDataSource.h:

2017-02-21  Jer Noble  <jer.noble@apple.com>

        AudioTrackPrivateMediaStreamCocoa should not exclusively lock its read and write threads.
        https://bugs.webkit.org/show_bug.cgi?id=168643

        Reviewed by Eric Carlson.

        Locking the write thread causes the read thread to drop audio samples and generates audible
        glitches, and the realtime audio thread backing the read thread should never block. There's
        no real reason to lock these threads against one another here; they both rely on the
        AudioSampleDataSource and it's CARingBuffer to safely and simultaneously read and write
        data.

        The one piece which locks previously protected against unsafe access was during creation of
        the audio unit.  Without a lock, the audio unit could begin playback after the unit was
        created and assigned to m_remoteIOUnit but before the ring buffer was created. To protect
        against this possibility, create the unit, set the input and output descriptions, but only
        assign the new audio unit to m_remoteIOUnit after the ring buffer has been created and
        initialized.

        * platform/audio/mac/CAAudioStreamDescription.h:
        * platform/mediastream/mac/AudioTrackPrivateMediaStreamCocoa.cpp:
        (WebCore::AudioTrackPrivateMediaStreamCocoa::~AudioTrackPrivateMediaStreamCocoa):
        (WebCore::AudioTrackPrivateMediaStreamCocoa::playInternal):
        (WebCore::AudioTrackPrivateMediaStreamCocoa::play):
        (WebCore::AudioTrackPrivateMediaStreamCocoa::pause):
        (WebCore::AudioTrackPrivateMediaStreamCocoa::setVolume):
        (WebCore::AudioTrackPrivateMediaStreamCocoa::createAudioUnit):
        (WebCore::AudioTrackPrivateMediaStreamCocoa::setupAudioUnit): Renamed to createAudioUnit()
        (WebCore::AudioTrackPrivateMediaStreamCocoa::audioSamplesAvailable):
        * platform/mediastream/mac/AudioTrackPrivateMediaStreamCocoa.h:

2017-02-27  Youenn Fablet  <youenn@apple.com>

        [WebRTC] RealtimOutgoingVideoSource should not need to do image conversion
        https://bugs.webkit.org/show_bug.cgi?id=168802

        Reviewed by Jon Lee.

        Covered by manual testing as mock sources do not hit the same code path.

        * platform/mediastream/mac/AVVideoCaptureSource.h:
        * platform/mediastream/mac/AVVideoCaptureSource.mm:
        (WebCore::AVVideoCaptureSource::currentFrameCGImage):
        * platform/mediastream/mac/RealtimeOutgoingVideoSource.cpp:
        (WebCore::RealtimeOutgoingVideoSource::sendFrame):
        (WebCore::RealtimeOutgoingVideoSource::videoSampleAvailable):
        * platform/mediastream/mac/RealtimeOutgoingVideoSource.h:

2017-02-27  Carlos Garcia Campos  <cgarcia@igalia.com>

        [GTK] Downloads attributes tests are failing
        https://bugs.webkit.org/show_bug.cgi?id=168871

        Reviewed by Michael Catanzaro.

        Use libsoup to get the suggested filename from the Content-Disposition header instead of buggy
        filenameFromHTTPContentDisposition().

        Fixes: fast/dom/HTMLAnchorElement/anchor-file-blob-download-includes-doublequote.html
               fast/dom/HTMLAnchorElement/anchor-file-blob-download-includes-unicode.html

        * platform/network/soup/ResourceResponseSoup.cpp:
        (WebCore::ResourceResponse::platformSuggestedFilename):

2017-02-27  Antoine Quint  <graouts@apple.com>

        [Modern Media Controls] Dragging controls in fullscreen on macOS prevents scrubbing or interacting with controls
        https://bugs.webkit.org/show_bug.cgi?id=168820
        <rdar://problem/30690281>

        Reviewed by Jon Lee.

        We broke this in https://bugs.webkit.org/show_bug.cgi?id=168755. We restore the check that the
        event target when initiating a drag is the controls bar itself and not some of its content.

        Since this wasn't caught by our existing tests, we add a test that attemps to initiate a drag
        starting over one of the controls and notice that no dragging occurs.

        We also fix an issue where we wouldn't update the layout of the left container as its icon
        buttons would load, which would cause the layout width of the left container to be incorrect
        and the related tests to time out.

        Test: media/modern-media-controls/macos-fullscreen-media-controls/macos-fullscreen-media-controls-drag-is-prevented-over-button.html

        * Modules/modern-media-controls/controls/macos-fullscreen-media-controls.js:
        (MacOSFullscreenMediaControls.prototype.layout):
        (MacOSFullscreenMediaControls.prototype._handleMousedown):

2017-02-27  Alex Christensen  <achristensen@webkit.org>

        [libwebrtc] Enable WebRTC in some Production Builds
        https://bugs.webkit.org/show_bug.cgi?id=168858

        * Configurations/FeatureDefines.xcconfig:

2017-02-27  Zan Dobersek  <zdobersek@igalia.com>

        [TextureMapper] Clean up BitmapTextureGL construction
        https://bugs.webkit.org/show_bug.cgi?id=168909

        Reviewed by Carlos Garcia Campos.

        Have the BitmapTextureGL constructor accept an rvalue reference pointer
        to the GraphicsContext3D object. A static create() method is also added
        to help with constructing these objects. Construction sites are updated
        appropriately.

        The BitmapTextureGL constructor is further cleaned up by moving default
        member initializations together with the member declarations.

        * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
        (WebCore::MediaPlayerPrivateGStreamerBase::pushTextureToCompositor):
        * platform/graphics/texmap/BitmapTextureGL.cpp:
        (WebCore::BitmapTextureGL::BitmapTextureGL):
        * platform/graphics/texmap/BitmapTextureGL.h:
        * platform/graphics/texmap/BitmapTexturePool.cpp:
        (WebCore::BitmapTexturePool::createTexture):
        * platform/graphics/texmap/TextureMapperGL.cpp:
        (WebCore::TextureMapperGL::createTexture):

2017-02-27  Zan Dobersek  <zdobersek@igalia.com>

        [TextureMapper] Remove InterpolationQuality, TextDrawingModeFlags member variables
        https://bugs.webkit.org/show_bug.cgi?id=168906

        Reviewed by Carlos Garcia Campos.

        Remove the InterpolationQuality and TextDrawingModeFlags member variables from the
        TextureMapper class. These weren't modified anywhere in the code.

        BitmapTexture::updateContents() still sets the image interpolation quality and
        drawing mode on the ImageBuffer's GraphicsContext, but now uses the default
        InterpolationDefault and TextModeFill values.

        * platform/graphics/texmap/BitmapTexture.cpp:
        (WebCore::BitmapTexture::updateContents):
        * platform/graphics/texmap/TextureMapper.cpp:
        (WebCore::TextureMapper::TextureMapper): Deleted.
        (WebCore::TextureMapper::~TextureMapper): Deleted.
        * platform/graphics/texmap/TextureMapper.h:
        (WebCore::TextureMapper::setImageInterpolationQuality): Deleted.
        (WebCore::TextureMapper::setTextDrawingMode): Deleted.
        (WebCore::TextureMapper::imageInterpolationQuality): Deleted.
        (WebCore::TextureMapper::textDrawingMode): Deleted.

2017-02-26  Zan Dobersek  <zdobersek@igalia.com>

        [CoordinatedGraphics] Remove CoordinatedGraphicsScene::paintToGraphicsContext()
        https://bugs.webkit.org/show_bug.cgi?id=168903

        Reviewed by Carlos Garcia Campos.

        Remove the GraphicsContext pointer member from the TextureMapper class
        since the getter and setter methods are not used anywhere.

        * platform/graphics/texmap/TextureMapper.cpp:
        (WebCore::TextureMapper::TextureMapper):
        * platform/graphics/texmap/TextureMapper.h:
        (WebCore::TextureMapper::setGraphicsContext): Deleted.
        (WebCore::TextureMapper::graphicsContext): Deleted.

2017-02-26  Myles C. Maxfield  <mmaxfield@apple.com>

        Stop compiling our own cursorMovementIterator()
        https://bugs.webkit.org/show_bug.cgi?id=168211

        Reviewed by David Hyatt.

        Covered by existing tests.

        Hook up the caret iterator.

        * platform/graphics/ComplexTextController.cpp:
        (WebCore::ComplexTextController::offsetForPosition):
        * rendering/RenderText.cpp:
        (WebCore::RenderText::previousOffset):
        (WebCore::RenderText::nextOffset):
        * rendering/RenderText.h:

2017-02-26  Commit Queue  <commit-queue@webkit.org>

        Unreviewed, rolling out r212942.
        https://bugs.webkit.org/show_bug.cgi?id=168882

        Made EWS very flaky (Requested by ap on #webkit).

        Reverted changeset:

        "[Modern Media Controls] Dragging controls in fullscreen on
        macOS prevents scrubbing or interacting with controls"
        https://bugs.webkit.org/show_bug.cgi?id=168820
        http://trac.webkit.org/changeset/212942

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-25  Zalan Bujtas  <zalan@apple.com>

        Simple line layout: Move coverage functions out of SimpleLineLayout.cpp
        https://bugs.webkit.org/show_bug.cgi?id=168872
        
        Reviewed by Simon Fraser.

        SimpleLineLayout.cpp is for core functions only.

        No change in functionality.

        * CMakeLists.txt:
        * WebCore.xcodeproj/project.pbxproj:
        * rendering/RenderingAllInOne.cpp:
        * rendering/SimpleLineLayout.cpp:
        (WebCore::SimpleLineLayout::canUseForWithReason):
        (WebCore::SimpleLineLayout::printReason): Deleted.
        (WebCore::SimpleLineLayout::printReasons): Deleted.
        (WebCore::SimpleLineLayout::printTextForSubtree): Deleted.
        (WebCore::SimpleLineLayout::textLengthForSubtree): Deleted.
        (WebCore::SimpleLineLayout::collectNonEmptyLeafRenderBlockFlows): Deleted.
        (WebCore::SimpleLineLayout::collectNonEmptyLeafRenderBlockFlowsForCurrentPage): Deleted.
        (WebCore::SimpleLineLayout::toggleSimpleLineLayout): Deleted.
        (WebCore::SimpleLineLayout::printSimpleLineLayoutBlockList): Deleted.
        (WebCore::SimpleLineLayout::printSimpleLineLayoutCoverage): Deleted.
        * rendering/SimpleLineLayout.h:
        * rendering/SimpleLineLayoutCoverage.cpp: Added.
        (WebCore::SimpleLineLayout::printReason):
        (WebCore::SimpleLineLayout::printReasons):
        (WebCore::SimpleLineLayout::printTextForSubtree):
        (WebCore::SimpleLineLayout::textLengthForSubtree):
        (WebCore::SimpleLineLayout::collectNonEmptyLeafRenderBlockFlows):
        (WebCore::SimpleLineLayout::collectNonEmptyLeafRenderBlockFlowsForCurrentPage):
        (WebCore::SimpleLineLayout::toggleSimpleLineLayout):
        (WebCore::SimpleLineLayout::printSimpleLineLayoutBlockList):
        (WebCore::SimpleLineLayout::printSimpleLineLayoutCoverage):
        * rendering/SimpleLineLayoutCoverage.h: Added.

2017-02-25  Zalan Bujtas  <zalan@apple.com>

        Text might wrap when its preferred logical width is used for sizing the containing block.
        https://bugs.webkit.org/show_bug.cgi?id=168864
        <rdar://problem/30690734>

        Reviewed by Antti Koivisto.

        In certain cases we end up measuring a text run in 2 different ways.
        1. preferred width computation -> slow path FontCascade::width() 
        2. line breaking logic -> fast path FontCascade::widthForSimpleText()
 
        FontCascade::width() and ::widthForSimpleText() might return different results for the same run even when
        the individual glyph widths are measured to be the same. It's because they run diffrent set of
        arithmetics on the float values and for certain values these arithmetics produce different results due to the floating point
        precision.
        Since RenderText::computePreferredLogicalWidths() currently forces us to use the slow path
        (to retrieve fontfallback and glyph overflow information) the only alternative solution is to turn off the fast path
        for all runs that have been already measured using the slow path (which would be just wasteful).

        Test: fast/text/fast-run-width-vs-slow-run-width.html

        * platform/graphics/FontCascade.cpp:
        (WebCore::FontCascade::widthForSimpleText): Mimics WidthIterator::applyFontTransforms. Use the same set of arithmetics here.  

2017-02-24  Simon Fraser  <simon.fraser@apple.com>

        Improve how multiple codegen-properties are handled in CSSProperties.json
        https://bugs.webkit.org/show_bug.cgi?id=168867

        Reviewed by Zalan Bujtas.

        To make upcoming metadata storage easier, it's better if property entries in CSSProperties.json
        are always hashes. One property (line-height) used an array, in order to represent settings for
        two different build flags (ENABLE_TEXT_AUTOSIZING and !ENABLE_TEXT_AUTOSIZING).

        Fix by making "codegen-properties" optionally be an array. The relevant item is selected in
        removeInactiveCodegenProperties() and used to replace the array.

        Sort @internalProprerties when generating code, otherwise the contents of isInternalCSSProperty()
        are unstable (the order in @allNames is not stable because it's the keys in a hash).

        * css/CSSProperties.json:
        * css/makeprop.pl:
        (matchEnableFlags):
        (removeInactiveCodegenProperties):
        (isPropertyEnabled):

2017-02-24  Joseph Pecoraro  <pecoraro@apple.com>

        [Resource Timing] Media elements initiated loads should set the initiatorType to their element name (video/audio)
        https://bugs.webkit.org/show_bug.cgi?id=168680

        Reviewed by Youenn Fablet.

        * html/HTMLMediaElement.cpp:
        (WebCore::HTMLMediaElement::mediaPlayerCreateResourceLoader):
        Pass in the element so it may be used as the initiator.

        * html/HTMLVideoElement.h:
        Export create() for TestWebKitAPI to use.

        * loader/MediaResourceLoader.cpp:
        (WebCore::MediaResourceLoader::MediaResourceLoader):
        (WebCore::MediaResourceLoader::contextDestroyed):
        (WebCore::MediaResourceLoader::requestResource):
        * loader/MediaResourceLoader.h:
        Include the HTMLMediaElement as the initiator.

2017-02-24  Joseph Pecoraro  <pecoraro@apple.com>

        [Resource Timing] Gather timing information with reliable responseEnd time
        https://bugs.webkit.org/show_bug.cgi?id=168351

        Reviewed by Alex Christensen.

        This patch replaces the unused `double finishTime` in ResourceLoader's
        didFinishLoad with a complete WebCore::NetworkLoadMetrics object. This
        allows the NetworkProcess to give complete timing information, and more
        final metrics about the load, to WebCore. Currently this is only used
        by ResourceTiming, but it will soon be used by Web Inspector as well.
        We may also end up extending this to the didFail path as well, since it
        is possible that we have some metrics for load failures.

        At the same time we want to start moving away from the legacy path that
        populated a subset of this information in ResourceResponse's NetworkLoadMetrics.
        It doesn't make sense to store this information on the ResourceResponse
        for a few reasons: We don't want to store the metrics in our Network Cache and
        not all of the load timing metrics have been populated yet (responseEnd).
        In an effort to move off of this data we've renamed the accessor to
        "deprecatedNetworkLoadMetrics". There are a few remaining clients
        (ResourceHandle, PerformanceTiming, InspectorNetworkAgent) which can be
        migrated separately from this patch.

        Having both the legacy and new code paths adds a little bit of complexity.
        One advantage of the new path is that the complete load timing data
        (fetchStart -> dns -> connect -> request -> response -> responseEnd) can
        be packaged together. The legacy path could not include a responseEnd, so
        WebCore faked that value with its own timestamp. Having the fake responseEnd
        caused issues as timestamps / clocks are different between processes. In order
        for PerformanceResponseTiming to know whether or not the NetworkLoadMetrics
        has the complete network timing metrics it checks isComplete(). If true
        it knows it can use the responseEnd time from NetworkLoadMetrics, otherwise
        it must fallback to the legacy value from LoadTiming. Once all of the
        deprecatedNetworkLoadMetrics clients go away, we should always have the
        complete data and this can be eliminated.

        Tests: imported/w3c/web-platform-tests/resource-timing/rt-nextHopProtocol.html
               imported/w3c/web-platform-tests/resource-timing/rt-nextHopProtocol.worker.html

        * PlatformMac.cmake:
        * WebCore.xcodeproj/project.pbxproj:
        Rename NetworkLoadTiming -> NetworkLoadMetrics.

        * page/PerformanceResourceTiming.cpp:
        (WebCore::entryStartTime):
        (WebCore::entryEndTime):
        (WebCore::PerformanceResourceTiming::PerformanceResourceTiming):
        (WebCore::PerformanceResourceTiming::nextHopProtocol):
        (WebCore::PerformanceResourceTiming::domainLookupStart):
        (WebCore::PerformanceResourceTiming::domainLookupEnd):
        (WebCore::PerformanceResourceTiming::connectStart):
        (WebCore::PerformanceResourceTiming::connectEnd):
        (WebCore::PerformanceResourceTiming::secureConnectionStart):
        (WebCore::PerformanceResourceTiming::requestStart):
        (WebCore::PerformanceResourceTiming::responseStart):
        (WebCore::PerformanceResourceTiming::responseEnd):
        (WebCore::PerformanceResourceTiming::networkLoadTimeToDOMHighResTimeStamp):
        * page/PerformanceResourceTiming.h:
        Mostly just updating names and types. This does however need to get the
        correct endTime based on whether the NetworkLoadMetrics are complete
        (meaning includes responseEnd) or not (legacy, use LoadTiming value).

        * page/PerformanceResourceTiming.idl:
        Add nextHopProtocol.

        * page/PerformanceTiming.cpp:
        (WebCore::PerformanceTiming::domainLookupStart):
        (WebCore::PerformanceTiming::domainLookupEnd):
        (WebCore::PerformanceTiming::connectStart):
        (WebCore::PerformanceTiming::connectEnd):
        (WebCore::PerformanceTiming::secureConnectionStart):
        (WebCore::PerformanceTiming::requestStart):
        (WebCore::PerformanceTiming::responseStart):
        (WebCore::PerformanceTiming::resourceLoadTimeRelativeToFetchStart):
        * page/PerformanceTiming.h:
        Navigation Timing values still uses the NetworkLoadTiming values stored on
        the DocumentLoader. This should be moved off of the deprecated path separately.

        * platform/network/NetworkLoadMetrics.h: Renamed from Source/WebCore/platform/network/NetworkLoadTiming.h.
        (WebCore::NetworkLoadMetrics::NetworkLoadMetrics):
        (WebCore::NetworkLoadMetrics::isolatedCopy):
        (WebCore::NetworkLoadMetrics::reset):
        (WebCore::NetworkLoadMetrics::operator==):
        (WebCore::NetworkLoadMetrics::operator!=):
        (WebCore::NetworkLoadMetrics::isComplete):
        (WebCore::NetworkLoadMetrics::markComplete):
        (WebCore::NetworkLoadMetrics::encode):
        (WebCore::NetworkLoadMetrics::decode):
        Re-introduce a reset() method (for NetworkLoadSoup to reset between redirects).
        Add protocolName and "complete" boolean.

        * platform/network/cocoa/NetworkLoadMetrics.mm: Renamed from Source/WebCore/platform/network/cocoa/NetworkLoadTiming.mm.
        (WebCore::timingValue):
        (WebCore::copyTimingData):
        (WebCore::setCollectsTimingData):
        Use this opportunity to convert NetworkLoadTiming timestamps to WTF::Seconds.
        Since we already have to modify all the clients this moves us to use the more
        strongly typed units that are less ambiguous then "double". The rest of the
        Performance API has already moved to these units.

        * inspector/InspectorNetworkAgent.cpp:
        (WebCore::InspectorNetworkAgent::buildObjectForTiming):
        (WebCore::InspectorNetworkAgent::buildObjectForResourceResponse):
        (WebCore::InspectorNetworkAgent::didFinishLoading):
        * inspector/InspectorNetworkAgent.h:
        Inspector was the only client of the finishTime, and since the value was
        erratically coming from clients in different ways it was almost certainly
        inaccurate. Simplify this in preparation for using NetworkLoadMetrics.

        * Modules/fetch/FetchLoader.cpp:
        (WebCore::FetchLoader::didFinishLoading):
        * Modules/fetch/FetchLoader.h:
        * fileapi/FileReaderLoader.cpp:
        (WebCore::FileReaderLoader::didFinishLoading):
        * fileapi/FileReaderLoader.h:
        * html/MediaFragmentURIParser.cpp:
        (WebCore::MediaFragmentURIParser::parseNPTTime):
        * inspector/InspectorInstrumentation.cpp:
        (WebCore::InspectorInstrumentation::didFinishLoadingImpl):
        * inspector/InspectorInstrumentation.h:
        (WebCore::InspectorInstrumentation::didFinishLoading):
        * loader/CrossOriginPreflightChecker.cpp:
        (WebCore::CrossOriginPreflightChecker::validatePreflightResponse):
        * loader/DocumentLoader.cpp:
        (WebCore::DocumentLoader::notifyFinished):
        (WebCore::DocumentLoader::finishedLoading):
        (WebCore::DocumentLoader::continueAfterContentPolicy):
        (WebCore::DocumentLoader::maybeLoadEmpty):
        * loader/DocumentLoader.h:
        * loader/DocumentThreadableLoader.cpp:
        (WebCore::DocumentThreadableLoader::didReceiveResponse):
        (WebCore::DocumentThreadableLoader::notifyFinished):
        (WebCore::DocumentThreadableLoader::didFinishLoading):
        (WebCore::DocumentThreadableLoader::loadRequest):
        * loader/DocumentThreadableLoader.h:
        * loader/NetscapePlugInStreamLoader.cpp:
        (WebCore::NetscapePlugInStreamLoader::didFinishLoading):
        * loader/NetscapePlugInStreamLoader.h:
        * loader/ResourceLoadNotifier.cpp:
        (WebCore::ResourceLoadNotifier::didFinishLoad):
        (WebCore::ResourceLoadNotifier::dispatchDidFinishLoading):
        (WebCore::ResourceLoadNotifier::sendRemainingDelegateMessages):
        * loader/ResourceLoadNotifier.h:
        * loader/ResourceLoader.cpp:
        (WebCore::ResourceLoader::deliverResponseAndData):
        (WebCore::ResourceLoader::loadDataURL):
        (WebCore::ResourceLoader::didFinishLoading):
        (WebCore::ResourceLoader::didFinishLoadingOnePart):
        * loader/ResourceLoader.h:
        * loader/ResourceTiming.cpp:
        (WebCore::ResourceTiming::fromLoad):
        (WebCore::ResourceTiming::fromSynchronousLoad):
        (WebCore::ResourceTiming::ResourceTiming):
        (WebCore::ResourceTiming::isolatedCopy):
        * loader/ResourceTiming.h:
        (WebCore::ResourceTiming::networkLoadMetrics):
        (WebCore::ResourceTiming::ResourceTiming):
        (WebCore::ResourceTiming::networkLoadTiming): Deleted.
        * loader/SubresourceLoader.cpp:
        (WebCore::SubresourceLoader::SubresourceLoader):
        (WebCore::SubresourceLoader::willSendRequestInternal):
        (WebCore::SubresourceLoader::didReceiveResponse):
        (WebCore::SubresourceLoader::didFinishLoading):
        (WebCore::SubresourceLoader::reportResourceTiming):
        * loader/SubresourceLoader.h:
        * loader/ThreadableLoaderClient.h:
        (WebCore::ThreadableLoaderClient::didFinishLoading):
        * loader/ThreadableLoaderClientWrapper.h:
        (WebCore::ThreadableLoaderClientWrapper::didFinishLoading):
        * loader/WorkerThreadableLoader.cpp:
        (WebCore::WorkerThreadableLoader::MainThreadBridge::didFinishLoading):
        * loader/WorkerThreadableLoader.h:
        * loader/appcache/ApplicationCacheGroup.cpp:
        (WebCore::ApplicationCacheGroup::didFinishLoading):
        * loader/appcache/ApplicationCacheGroup.h:
        * loader/cache/CachedResource.h:
        (WebCore::CachedResource::setLoadFinishTime):
        * loader/ios/QuickLook.mm:
        (-[WebPreviewLoader connectionDidFinishLoading:]):
        * page/EventSource.cpp:
        (WebCore::EventSource::didFinishLoading):
        * page/EventSource.h:
        * platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp:
        (ResourceHandleStreamingClient::didFinishLoading):
        * platform/network/BlobResourceHandle.cpp:
        (WebCore::doNotifyFinish):
        * platform/network/PingHandle.h:
        * platform/network/ResourceHandle.h:
        * platform/network/ResourceHandleClient.h:
        (WebCore::ResourceHandleClient::didFinishLoading):
        * platform/network/ResourceResponseBase.cpp:
        (WebCore::ResourceResponseBase::crossThreadData):
        (WebCore::ResourceResponseBase::fromCrossThreadData):
        (WebCore::ResourceResponseBase::compare):
        * platform/network/ResourceResponseBase.h:
        (WebCore::ResourceResponseBase::deprecatedNetworkLoadMetrics):
        (WebCore::ResourceResponseBase::encode):
        (WebCore::ResourceResponseBase::decode):
        (WebCore::ResourceResponseBase::networkLoadTiming): Deleted.
        * platform/network/SynchronousLoaderClient.cpp:
        (WebCore::SynchronousLoaderClient::didFinishLoading):
        * platform/network/SynchronousLoaderClient.h:
        * platform/network/cf/ResourceHandleCFURLConnectionDelegateWithOperationQueue.cpp:
        (WebCore::ResourceHandleCFURLConnectionDelegateWithOperationQueue::didReceiveResponse):
        (WebCore::ResourceHandleCFURLConnectionDelegateWithOperationQueue::didFinishLoading):
        * platform/network/cf/SynchronousResourceHandleCFURLConnectionDelegate.cpp:
        (WebCore::SynchronousResourceHandleCFURLConnectionDelegate::didReceiveResponse):
        (WebCore::SynchronousResourceHandleCFURLConnectionDelegate::didFinishLoading):
        * platform/network/curl/ResourceHandleCurl.cpp:
        (WebCore::WebCoreSynchronousLoader::didFinishLoading):
        * platform/network/curl/ResourceHandleManager.cpp:
        (WebCore::calculateWebTimingInformations):
        (WebCore::ResourceHandleManager::downloadTimerCallback):
        (WebCore::handleDataURL):
        (WebCore::milisecondsSinceRequest): Deleted.
        * platform/network/mac/ResourceHandleMac.mm:
        (WebCore::ResourceHandle::getConnectionTimingData):
        * platform/network/mac/WebCoreResourceHandleAsDelegate.mm:
        (-[WebCoreResourceHandleAsDelegate connection:didReceiveResponse:]):
        (-[WebCoreResourceHandleAsDelegate connectionDidFinishLoading:]):
        * platform/network/mac/WebCoreResourceHandleAsOperationQueueDelegate.mm:
        (-[WebCoreResourceHandleAsOperationQueueDelegate connection:didReceiveResponse:]):
        (-[WebCoreResourceHandleAsOperationQueueDelegate connectionDidFinishLoading:]):
        * platform/network/soup/ResourceHandleSoup.cpp:
        (WebCore::restartedCallback):
        (WebCore::nextMultipartResponsePartCallback):
        (WebCore::sendRequestCallback):
        (WebCore::ResourceHandle::didStartRequest):
        (WebCore::networkEventCallback):
        (WebCore::ResourceHandle::sendPendingRequest):
        (WebCore::readCallback):
        (WebCore::milisecondsSinceRequest): Deleted.
        * workers/WorkerScriptLoader.cpp:
        (WebCore::WorkerScriptLoader::didFinishLoading):
        * workers/WorkerScriptLoader.h:
        * xml/XMLHttpRequest.cpp:
        (WebCore::XMLHttpRequest::didFinishLoading):
        * xml/XMLHttpRequest.h:
        Eliminate the unused finishTime double.

2017-02-24  Chris Dumez  <cdumez@apple.com>

        Unreviewed GTK build fix after r212965

        * CMakeLists.txt:

2017-02-24  Chris Dumez  <cdumez@apple.com>

        Unreviewed, rolling out r212944.

        Caused a lot of failures on the debug bots

        Reverted changeset:

        "[Resource Timing] Gather timing information with reliable
        responseEnd time"
        https://bugs.webkit.org/show_bug.cgi?id=168351
        http://trac.webkit.org/changeset/212944

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-24  Zalan Bujtas  <zalan@apple.com>

        Simple line layout: Re-adjust paginated lines when block height changes.
        https://bugs.webkit.org/show_bug.cgi?id=168838
        <rdar://problem/30701233>

        Reviewed by Antti Koivisto.

        When the estimated block height is wrong, we issue an additional layout on the inline children
        so that we get the pagination right (this layout is setChildNeedsLayout(MarkOnlyThis) only).
        Since the height change only affects the struts and page breaks (and again, the relayoutChildren flag is false)
        we don't need to re-layout the content, but instead we just need to re-adjust the pagination for the simple lines. 
        This patch also moves the pagination logic to SimpleLineLayoutPagination.cpp.

        Not enabled yet.

        * CMakeLists.txt:
        * WebCore.xcodeproj/project.pbxproj:
        * rendering/RenderBlockFlow.cpp:
        (WebCore::RenderBlockFlow::layoutSimpleLines):
        * rendering/RenderingAllInOne.cpp:
        * rendering/SimpleLineLayout.cpp:
        (WebCore::SimpleLineLayout::canUseForWithReason):
        (WebCore::SimpleLineLayout::create):
        (WebCore::SimpleLineLayout::Layout::create):
        (WebCore::SimpleLineLayout::Layout::Layout):
        (WebCore::SimpleLineLayout::computeLineTopAndBottomWithOverflow): Deleted.
        (WebCore::SimpleLineLayout::computeLineBreakIndex): Deleted.
        (WebCore::SimpleLineLayout::computeOffsetAfterLineBreak): Deleted.
        (WebCore::SimpleLineLayout::setPageBreakForLine): Deleted.
        (WebCore::SimpleLineLayout::updateMinimumPageHeight): Deleted.
        (WebCore::SimpleLineLayout::adjustLinePositionsForPagination): Deleted.
        * rendering/SimpleLineLayout.h:
        (WebCore::SimpleLineLayout::Layout::setIsPaginated):
        (WebCore::SimpleLineLayout::Layout::setLineStruts):
        * rendering/SimpleLineLayoutPagination.cpp: Added.
        (WebCore::SimpleLineLayout::computeLineTopAndBottomWithOverflow):
        (WebCore::SimpleLineLayout::computeLineBreakIndex):
        (WebCore::SimpleLineLayout::computeOffsetAfterLineBreak):
        (WebCore::SimpleLineLayout::setPageBreakForLine):
        (WebCore::SimpleLineLayout::updateMinimumPageHeight):
        (WebCore::SimpleLineLayout::adjustLinePositionsForPagination):
        * rendering/SimpleLineLayoutPagination.h: Added.

2017-02-24  Jon Lee  <jonlee@apple.com>

        Alias "system-ui" for the System font name
        https://bugs.webkit.org/show_bug.cgi?id=151493

        Reviewed by Tim Horton and Joseph Pecoraro.

        Updated existing tests.

        * WebCore.xcodeproj/project.pbxproj: Add WebKitFontFamilyNames.in for
        convenience.
        * css/CSSValueKeywords.in: Add system-ui as a keyword.
        * css/WebKitFontFamilyNames.in: Add system-ui.

        * platform/graphics/ios/FontCacheIOS.mm:
        (WebCore::platformFontWithFamilySpecialCase): Include "system-ui" as an
        alias.
        * platform/graphics/mac/FontCacheMac.mm:
        (WebCore::platformFontWithFamilySpecialCase): Ditto.

        * rendering/RenderThemeMac.mm:
        (WebCore::RenderThemeMac::updateCachedSystemFontDescription): Update
        serialization to "system-ui" from "-apple-system".

        * css/CSSComputedStyleDeclaration.cpp:
        (WebCore::identifierForFamily):
        * css/CSSFontFaceSet.cpp:
        (WebCore::CSSFontFaceSet::familyNameFromPrimitive):
        * css/StyleBuilderCustom.h:
        (WebCore::StyleBuilderCustom::applyValueFontFamily):

2017-02-24  Matt Rajca  <mrajca@apple.com>

        Media: notify clients when autoplay is denied
        https://bugs.webkit.org/show_bug.cgi?id=168840

        Reviewed by Alex Christensen.

        Added API tests.

        * WebCore.xcodeproj/project.pbxproj:
        * html/HTMLMediaElement.cpp:
        (WebCore::HTMLMediaElement::setReadyState):
        (WebCore::HTMLMediaElement::play):
        (WebCore::HTMLMediaElement::playInternal):
        * page/AutoplayEvent.h: Added.
        * page/ChromeClient.h:

2017-02-24  Basuke Suzuki  <Basuke.Suzuki@am.sony.com>

        curl: Improve errors by including the domain
        https://bugs.webkit.org/show_bug.cgi?id=134340

        Reviewed by Alex Christensen.

        Added proper error domain to ResourceError created by
        Curl problem.

        * platform/network/curl/ResourceHandleManager.cpp:
        (WebCore::ResourceHandleManager::downloadTimerCallback):
        (WebCore::ResourceHandleManager::dispatchSynchronousJob):

2017-02-24  Antoine Quint  <graouts@apple.com>

        [Modern Media Controls] <audio> controls should center in their container when the page is scaled
        https://bugs.webkit.org/show_bug.cgi?id=168841
        <rdar://problem/28612794>

        Reviewed by Eric Carlson.

        When dealing with <audio> elements, we vertically center the controls relative to their containing
        media element such that if the controls visually overflow, they overflow equally above and below
        to minimize the likelihood of overlap with surrounding elements.

        Test: media/modern-media-controls/media-controller/media-controller-scale-factor-audio.html

        * Modules/modern-media-controls/controls/media-controls.js:
        (MediaControls.prototype.get shouldCenterControlsVertically):
        (MediaControls.prototype.set shouldCenterControlsVertically):
        (MediaControls.prototype.commitProperty):
        * Modules/modern-media-controls/media/media-controller.js:
        (MediaController.prototype.get isAudio):
        (MediaController.prototype.get layoutTraits):
        (MediaController.prototype._updateControlsSize):

2017-02-24  Alex Christensen  <achristensen@webkit.org>

        Non-special relative URLs should not ignore extra slashes
        https://bugs.webkit.org/show_bug.cgi?id=168834

        Reviewed by Sam Weinig.

        Special authority ignore slashes state should, as its name implies,
        only be reached by special URLs.  See https://url.spec.whatwg.org/#relative-slash-state

        Covered by newly passing web platform tests.

        * platform/URLParser.cpp:
        (WebCore::URLParser::parse):

2017-02-24  Alexey Proskuryakov  <ap@apple.com>

        Build fix for newer clang
        https://bugs.webkit.org/show_bug.cgi?id=168849
        rdar://problem/30638741

        Reviewed by Ryosuke Niwa.

        * dom/Range.cpp: (WebCore::Range::toString): std::max(0, <unsigned>) is not meaningful,
        and now triggers a warning.

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-24  Miguel Gomez  <magomez@igalia.com>

        [GTK] WebkitWebProcess crashes on exit on nvidia if threaded compositing is enabled
        https://bugs.webkit.org/show_bug.cgi?id=165522

        Reviewed by Carlos Garcia Campos.

        Before destrying a GLContextGLX we need to set the default framebufer to avoid a bug
        in some nvidia drivers. Ensure that we set the context as current before performing
        that operation, and set the appropriate current context after doing so.

        No new tests.

        * platform/graphics/glx/GLContextGLX.cpp:
        (WebCore::GLContextGLX::~GLContextGLX):

2017-02-24  Chris Dumez  <cdumez@apple.com>

        [iOS][WK2] Disable network cache speculative revalidation / loading in low power mode
        https://bugs.webkit.org/show_bug.cgi?id=168832
        <rdar://problem/30697911>

        Reviewed by Antti Koivisto.

        Add LowPowerModeNotifier class to monitor low power mode state on iOS.

        * WebCore.xcodeproj/project.pbxproj:
        * platform/LowPowerModeNotifier.cpp: Added.
        (WebCore::LowPowerModeNotifier::LowPowerModeNotifier):
        (WebCore::LowPowerModeNotifier::isLowPowerModeEnabled):
        * platform/LowPowerModeNotifier.h: Added.
        * platform/ios/LowPowerModeNotifierIOS.mm: Added.
        (-[WebLowPowerModeObserver initWithNotifier:]):
        (-[WebLowPowerModeObserver dealloc]):
        (-[WebLowPowerModeObserver _didReceiveLowPowerModeChange]):
        (WebCore::LowPowerModeNotifier::LowPowerModeNotifier):
        (WebCore::LowPowerModeNotifier::isLowPowerModeEnabled):
        (WebCore::LowPowerModeNotifier::notifyLowPowerModeChanged):
        (WebCore::notifyLowPowerModeChanged):

2017-02-24  Chris Dumez  <cdumez@apple.com>

        [Mac] Report domains using abnormally high memory usage via enhanced privacy logging
        https://bugs.webkit.org/show_bug.cgi?id=168797
        <rdar://problem/29964017>

        Reviewed by Andreas Kling.

        Report domains using abnormally high memory usage (> 2GB) via enhanced privacy
        logging on Mac.

        * page/DiagnosticLoggingKeys.cpp:
        (WebCore::DiagnosticLoggingKeys::domainCausingJetsamKey):
        * page/DiagnosticLoggingKeys.h:
        * page/PerformanceMonitor.cpp:
        (WebCore::reportPageOverPostLoadResourceThreshold):
        (WebCore::PerformanceMonitor::measurePostLoadCPUUsage):
        (WebCore::PerformanceMonitor::measurePostLoadMemoryUsage):
        (WebCore::reportPageOverPostLoadCPUUsageThreshold): Deleted.

2017-02-24  Alex Christensen  <achristensen@webkit.org>

        .. should not remove windows drive letters in paths of file URLs
        https://bugs.webkit.org/show_bug.cgi?id=168824

        Reviewed by Youenn Fablet.

        It's specified in https://url.spec.whatwg.org/#shorten-a-urls-path and helps behavior for browsers on Windows.
        It can't hurt to pass a few more web platform tests, though.

        * platform/URLParser.cpp:
        (WebCore::URLParser::copyURLPartsUntil):
        (WebCore::URLParser::shouldPopPath):
        (WebCore::URLParser::popPath):
        (WebCore::URLParser::parse):
        * platform/URLParser.h:

2017-02-24  Csaba Osztrogonác  <ossy@webkit.org>

        [Mac][cmake] Unreviewed buildfix after r212736.

        * PlatformMac.cmake:

2017-02-24  John Wilander  <wilander@apple.com>

        Resource Load Statistics: Add alternate classification method
        https://bugs.webkit.org/show_bug.cgi?id=168347
        <rdar://problem/30352793>
        <rdar://problem/30646710>
        <rdar://problem/30660708>

        Reviewed by Alex Christensen.

        This patch only adds test infrastructure in WebCore.

        Tests: http/tests/loading/resourceLoadStatistics/classify-as-non-prevalent-based-on-mixed-statistics.html
               http/tests/loading/resourceLoadStatistics/classify-as-non-prevalent-based-on-sub-frame-under-top-frame-origins.html
               http/tests/loading/resourceLoadStatistics/classify-as-non-prevalent-based-on-subresource-under-top-frame-origins.html
               http/tests/loading/resourceLoadStatistics/classify-as-non-prevalent-based-on-subresource-unique-redirects-to.html
               http/tests/loading/resourceLoadStatistics/classify-as-prevalent-based-on-mixed-statistics.html
               http/tests/loading/resourceLoadStatistics/classify-as-prevalent-based-on-sub-frame-under-top-frame-origins.html
               http/tests/loading/resourceLoadStatistics/classify-as-prevalent-based-on-subresource-under-top-frame-origins.html
               http/tests/loading/resourceLoadStatistics/classify-as-prevalent-based-on-subresource-unique-redirects-to.html

        * loader/ResourceLoadObserver.cpp:
        (WebCore::ResourceLoadObserver::setSubframeUnderTopFrameOrigin):
        (WebCore::ResourceLoadObserver::setSubresourceUnderTopFrameOrigin):
        (WebCore::ResourceLoadObserver::setSubresourceUniqueRedirectTo):
        * loader/ResourceLoadObserver.h:

2017-02-23  Antoine Quint  <graouts@apple.com>

        [Modern Media Controls] No controls are shown for <audio preload="none">
        https://bugs.webkit.org/show_bug.cgi?id=168800
        <rdar://problem/30652142>

        Reviewed by Eric Carlson.

        A media element's currentSrc property will only be set when data has started
        to load. In the case where preload="none" is used, regardless of whether a
        source is specified, currentSrc would be the empty string and we wouldn't
        show controls at all. Identifying whether a source is specified is a little
        tricky because it could be specified in a variety of ways and dynamically
        as well.

        So instead we optimistically show controls always provided the "controls"
        attribute is set.

        * Modules/modern-media-controls/media/controls-visibility-support.js:
        (ControlsVisibilitySupport.prototype._updateControls):
        (ControlsVisibilitySupport):
        * Modules/modern-media-controls/media/start-support.js:
        (StartSupport.prototype._shouldShowStartButton):
        (StartSupport):

2017-02-23  Joseph Pecoraro  <pecoraro@apple.com>

        [Resource Timing] Gather timing information with reliable responseEnd time
        https://bugs.webkit.org/show_bug.cgi?id=168351

        Reviewed by Alex Christensen.

        This patch replaces the unused `double finishTime` in ResourceLoader's
        didFinishLoad with a complete WebCore::NetworkLoadMetrics object. This
        allows the NetworkProcess to give complete timing information, and more
        final metrics about the load, to WebCore. Currently this is only used
        by ResourceTiming, but it will soon be used by Web Inspector as well.
        We may also end up extending this to the didFail path as well, since it
        is possible that we have some metrics for load failures.

        At the same time we want to start moving away from the legacy path that
        populated a subset of this information in ResourceResponse's NetworkLoadMetrics.
        It doesn't make sense to store this information on the ResourceResponse
        for a few reasons: We don't want to store the metrics in our Network Cache and
        not all of the load timing metrics have been populated yet (responseEnd).
        In an effort to move off of this data we've renamed the accessor to
        "deprecatedNetworkLoadMetrics". There are a few remaining clients
        (ResourceHandle, PerformanceTiming, InspectorNetworkAgent) which can be
        migrated separately from this patch.

        Having both the legacy and new code paths adds a little bit of complexity.
        One advantage of the new path is that the complete load timing data
        (fetchStart -> dns -> connect -> request -> response -> responseEnd) can
        be packaged together. The legacy path could not include a responseEnd, so
        WebCore faked that value with its own timestamp. Having the fake responseEnd
        caused issues as timestamps / clocks are different between processes. In order
        for PerformanceResponseTiming to know whether or not the NetworkLoadMetrics
        has the complete network timing metrics it checks isComplete(). If true
        it knows it can use the responseEnd time from NetworkLoadMetrics, otherwise
        it must fallback to the legacy value from LoadTiming. Once all of the
        deprecatedNetworkLoadMetrics clients go away, we should always have the
        complete data and this can be eliminated.

        Tests: imported/w3c/web-platform-tests/resource-timing/rt-nextHopProtocol.html
               imported/w3c/web-platform-tests/resource-timing/rt-nextHopProtocol.worker.html

        * PlatformMac.cmake:
        * WebCore.xcodeproj/project.pbxproj:
        Rename NetworkLoadTiming -> NetworkLoadMetrics.

        * page/PerformanceResourceTiming.cpp:
        (WebCore::entryStartTime):
        (WebCore::entryEndTime):
        (WebCore::PerformanceResourceTiming::PerformanceResourceTiming):
        (WebCore::PerformanceResourceTiming::nextHopProtocol):
        (WebCore::PerformanceResourceTiming::domainLookupStart):
        (WebCore::PerformanceResourceTiming::domainLookupEnd):
        (WebCore::PerformanceResourceTiming::connectStart):
        (WebCore::PerformanceResourceTiming::connectEnd):
        (WebCore::PerformanceResourceTiming::secureConnectionStart):
        (WebCore::PerformanceResourceTiming::requestStart):
        (WebCore::PerformanceResourceTiming::responseStart):
        (WebCore::PerformanceResourceTiming::responseEnd):
        (WebCore::PerformanceResourceTiming::networkLoadTimeToDOMHighResTimeStamp):
        * page/PerformanceResourceTiming.h:
        Mostly just updating names and types. This does however need to get the
        correct endTime based on whether the NetworkLoadMetrics are complete
        (meaning includes responseEnd) or not (legacy, use LoadTiming value).

        * page/PerformanceResourceTiming.idl:
        Add nextHopProtocol.

        * page/PerformanceTiming.cpp:
        (WebCore::PerformanceTiming::domainLookupStart):
        (WebCore::PerformanceTiming::domainLookupEnd):
        (WebCore::PerformanceTiming::connectStart):
        (WebCore::PerformanceTiming::connectEnd):
        (WebCore::PerformanceTiming::secureConnectionStart):
        (WebCore::PerformanceTiming::requestStart):
        (WebCore::PerformanceTiming::responseStart):
        (WebCore::PerformanceTiming::resourceLoadTimeRelativeToFetchStart):
        * page/PerformanceTiming.h:
        Navigation Timing values still uses the NetworkLoadTiming values stored on
        the DocumentLoader. This should be moved off of the deprecated path separately.

        * platform/network/NetworkLoadMetrics.h: Renamed from Source/WebCore/platform/network/NetworkLoadTiming.h.
        (WebCore::NetworkLoadMetrics::NetworkLoadMetrics):
        (WebCore::NetworkLoadMetrics::isolatedCopy):
        (WebCore::NetworkLoadMetrics::reset):
        (WebCore::NetworkLoadMetrics::operator==):
        (WebCore::NetworkLoadMetrics::operator!=):
        (WebCore::NetworkLoadMetrics::isComplete):
        (WebCore::NetworkLoadMetrics::markComplete):
        (WebCore::NetworkLoadMetrics::encode):
        (WebCore::NetworkLoadMetrics::decode):
        Re-introduce a reset() method (for NetworkLoadSoup to reset between redirects).
        Add protocolName and "complete" boolean.

        * platform/network/cocoa/NetworkLoadMetrics.mm: Renamed from Source/WebCore/platform/network/cocoa/NetworkLoadTiming.mm.
        (WebCore::timingValue):
        (WebCore::copyTimingData):
        (WebCore::setCollectsTimingData):
        Use this opportunity to convert NetworkLoadTiming timestamps to WTF::Seconds.
        Since we already have to modify all the clients this moves us to use the more
        strongly typed units that are less ambiguous then "double". The rest of the
        Performance API has already moved to these units.

        * inspector/InspectorNetworkAgent.cpp:
        (WebCore::InspectorNetworkAgent::buildObjectForTiming):
        (WebCore::InspectorNetworkAgent::buildObjectForResourceResponse):
        (WebCore::InspectorNetworkAgent::didFinishLoading):
        * inspector/InspectorNetworkAgent.h:
        Inspector was the only client of the finishTime, and since the value was
        erratically coming from clients in different ways it was almost certainly
        inaccurate. Simplify this in preparation for using NetworkLoadMetrics.

        * Modules/fetch/FetchLoader.cpp:
        (WebCore::FetchLoader::didFinishLoading):
        * Modules/fetch/FetchLoader.h:
        * fileapi/FileReaderLoader.cpp:
        (WebCore::FileReaderLoader::didFinishLoading):
        * fileapi/FileReaderLoader.h:
        * html/MediaFragmentURIParser.cpp:
        (WebCore::MediaFragmentURIParser::parseNPTTime):
        * inspector/InspectorInstrumentation.cpp:
        (WebCore::InspectorInstrumentation::didFinishLoadingImpl):
        * inspector/InspectorInstrumentation.h:
        (WebCore::InspectorInstrumentation::didFinishLoading):
        * loader/CrossOriginPreflightChecker.cpp:
        (WebCore::CrossOriginPreflightChecker::validatePreflightResponse):
        * loader/DocumentLoader.cpp:
        (WebCore::DocumentLoader::notifyFinished):
        (WebCore::DocumentLoader::finishedLoading):
        (WebCore::DocumentLoader::continueAfterContentPolicy):
        (WebCore::DocumentLoader::maybeLoadEmpty):
        * loader/DocumentLoader.h:
        * loader/DocumentThreadableLoader.cpp:
        (WebCore::DocumentThreadableLoader::didReceiveResponse):
        (WebCore::DocumentThreadableLoader::notifyFinished):
        (WebCore::DocumentThreadableLoader::didFinishLoading):
        (WebCore::DocumentThreadableLoader::loadRequest):
        * loader/DocumentThreadableLoader.h:
        * loader/NetscapePlugInStreamLoader.cpp:
        (WebCore::NetscapePlugInStreamLoader::didFinishLoading):
        * loader/NetscapePlugInStreamLoader.h:
        * loader/ResourceLoadNotifier.cpp:
        (WebCore::ResourceLoadNotifier::didFinishLoad):
        (WebCore::ResourceLoadNotifier::dispatchDidFinishLoading):
        (WebCore::ResourceLoadNotifier::sendRemainingDelegateMessages):
        * loader/ResourceLoadNotifier.h:
        * loader/ResourceLoader.cpp:
        (WebCore::ResourceLoader::deliverResponseAndData):
        (WebCore::ResourceLoader::loadDataURL):
        (WebCore::ResourceLoader::didFinishLoading):
        (WebCore::ResourceLoader::didFinishLoadingOnePart):
        * loader/ResourceLoader.h:
        * loader/ResourceTiming.cpp:
        (WebCore::ResourceTiming::fromLoad):
        (WebCore::ResourceTiming::fromSynchronousLoad):
        (WebCore::ResourceTiming::ResourceTiming):
        (WebCore::ResourceTiming::isolatedCopy):
        * loader/ResourceTiming.h:
        (WebCore::ResourceTiming::networkLoadMetrics):
        (WebCore::ResourceTiming::ResourceTiming):
        (WebCore::ResourceTiming::networkLoadTiming): Deleted.
        * loader/SubresourceLoader.cpp:
        (WebCore::SubresourceLoader::SubresourceLoader):
        (WebCore::SubresourceLoader::willSendRequestInternal):
        (WebCore::SubresourceLoader::didReceiveResponse):
        (WebCore::SubresourceLoader::didFinishLoading):
        (WebCore::SubresourceLoader::reportResourceTiming):
        * loader/SubresourceLoader.h:
        * loader/ThreadableLoaderClient.h:
        (WebCore::ThreadableLoaderClient::didFinishLoading):
        * loader/ThreadableLoaderClientWrapper.h:
        (WebCore::ThreadableLoaderClientWrapper::didFinishLoading):
        * loader/WorkerThreadableLoader.cpp:
        (WebCore::WorkerThreadableLoader::MainThreadBridge::didFinishLoading):
        * loader/WorkerThreadableLoader.h:
        * loader/appcache/ApplicationCacheGroup.cpp:
        (WebCore::ApplicationCacheGroup::didFinishLoading):
        * loader/appcache/ApplicationCacheGroup.h:
        * loader/cache/CachedResource.h:
        (WebCore::CachedResource::setLoadFinishTime):
        * loader/ios/QuickLook.mm:
        (-[WebPreviewLoader connectionDidFinishLoading:]):
        * page/EventSource.cpp:
        (WebCore::EventSource::didFinishLoading):
        * page/EventSource.h:
        * platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp:
        (ResourceHandleStreamingClient::didFinishLoading):
        * platform/network/BlobResourceHandle.cpp:
        (WebCore::doNotifyFinish):
        * platform/network/PingHandle.h:
        * platform/network/ResourceHandle.h:
        * platform/network/ResourceHandleClient.h:
        (WebCore::ResourceHandleClient::didFinishLoading):
        * platform/network/ResourceResponseBase.cpp:
        (WebCore::ResourceResponseBase::crossThreadData):
        (WebCore::ResourceResponseBase::fromCrossThreadData):
        (WebCore::ResourceResponseBase::compare):
        * platform/network/ResourceResponseBase.h:
        (WebCore::ResourceResponseBase::deprecatedNetworkLoadMetrics):
        (WebCore::ResourceResponseBase::encode):
        (WebCore::ResourceResponseBase::decode):
        (WebCore::ResourceResponseBase::networkLoadTiming): Deleted.
        * platform/network/SynchronousLoaderClient.cpp:
        (WebCore::SynchronousLoaderClient::didFinishLoading):
        * platform/network/SynchronousLoaderClient.h:
        * platform/network/cf/ResourceHandleCFURLConnectionDelegateWithOperationQueue.cpp:
        (WebCore::ResourceHandleCFURLConnectionDelegateWithOperationQueue::didReceiveResponse):
        (WebCore::ResourceHandleCFURLConnectionDelegateWithOperationQueue::didFinishLoading):
        * platform/network/cf/SynchronousResourceHandleCFURLConnectionDelegate.cpp:
        (WebCore::SynchronousResourceHandleCFURLConnectionDelegate::didReceiveResponse):
        (WebCore::SynchronousResourceHandleCFURLConnectionDelegate::didFinishLoading):
        * platform/network/curl/ResourceHandleCurl.cpp:
        (WebCore::WebCoreSynchronousLoader::didFinishLoading):
        * platform/network/curl/ResourceHandleManager.cpp:
        (WebCore::calculateWebTimingInformations):
        (WebCore::ResourceHandleManager::downloadTimerCallback):
        (WebCore::handleDataURL):
        (WebCore::milisecondsSinceRequest): Deleted.
        * platform/network/mac/ResourceHandleMac.mm:
        (WebCore::ResourceHandle::getConnectionTimingData):
        * platform/network/mac/WebCoreResourceHandleAsDelegate.mm:
        (-[WebCoreResourceHandleAsDelegate connection:didReceiveResponse:]):
        (-[WebCoreResourceHandleAsDelegate connectionDidFinishLoading:]):
        * platform/network/mac/WebCoreResourceHandleAsOperationQueueDelegate.mm:
        (-[WebCoreResourceHandleAsOperationQueueDelegate connection:didReceiveResponse:]):
        (-[WebCoreResourceHandleAsOperationQueueDelegate connectionDidFinishLoading:]):
        * platform/network/soup/ResourceHandleSoup.cpp:
        (WebCore::restartedCallback):
        (WebCore::nextMultipartResponsePartCallback):
        (WebCore::sendRequestCallback):
        (WebCore::ResourceHandle::didStartRequest):
        (WebCore::networkEventCallback):
        (WebCore::ResourceHandle::sendPendingRequest):
        (WebCore::readCallback):
        (WebCore::milisecondsSinceRequest): Deleted.
        * workers/WorkerScriptLoader.cpp:
        (WebCore::WorkerScriptLoader::didFinishLoading):
        * workers/WorkerScriptLoader.h:
        * xml/XMLHttpRequest.cpp:
        (WebCore::XMLHttpRequest::didFinishLoading):
        * xml/XMLHttpRequest.h:
        Eliminate the unused finishTime double.

2017-02-23  Antoine Quint  <graouts@apple.com>

        [Modern Media Controls] Controls overflow when media element has border or padding
        https://bugs.webkit.org/show_bug.cgi?id=168818
        <rdar://problem/30689780>

        Reviewed by Jon Lee.

        We used to query the media element's layout size to compute the size of the media controls,
        which would account for border and padding. Instead, we should use the size of the container,
        at the root of the ShadowRoot, which will always match the size of the media.

        Test: media/modern-media-controls/media-controller/media-controller-controls-sizing-with-border-and-padding.html

        * Modules/modern-media-controls/controls/media-controls.css:
        (.media-controls-container,):
        * Modules/modern-media-controls/media/media-controller.js:
        (MediaController.prototype._updateControlsSize):
        (MediaController.prototype._controlsWidth):

2017-02-23  Antoine Quint  <graouts@apple.com>

        [Modern Media Controls] Dragging controls in fullscreen on macOS prevents scrubbing or interacting with controls
        https://bugs.webkit.org/show_bug.cgi?id=168820
        <rdar://problem/30690281>

        Reviewed by Jon Lee.

        We broke this in https://bugs.webkit.org/show_bug.cgi?id=168755. We restore the check that the
        event target when initiating a drag is the controls bar itself and not some of its content.

        Since this wasn't caught by our existing tests, we add a test that attemps to initiate a drag
        starting over one of the controls and notice that no dragging occurs.

        Test: media/modern-media-controls/macos-fullscreen-media-controls/macos-fullscreen-media-controls-drag-is-prevented-over-button.html

        * Modules/modern-media-controls/controls/macos-fullscreen-media-controls.js:
        (MacOSFullscreenMediaControls.prototype._handleMousedown):

2017-02-23  Simon Fraser  <simon.fraser@apple.com>

        REGRESSION (r211305): Masks on composited elements with preserve-3d broken
        https://bugs.webkit.org/show_bug.cgi?id=168815
        rdar://problem/30676846

        Reviewed by Jon Lee.

        r211305 moved the mask layer to be on the structural layer if there is one, to fix
        masking backdrops. However, with preserve-3d the structural layer can be a CATransformLayer,
        which doesn't take a mask, so limit the previous change to backdrops only.

        Test: compositing/masks/mask-with-preserve-3d.html

        * platform/graphics/ca/GraphicsLayerCA.cpp:
        (WebCore::GraphicsLayerCA::updateMaskLayer):

2017-02-23  Antoine Quint  <graouts@apple.com>

        [Modern Media Controls] Show "Loading" until playback starts
        https://bugs.webkit.org/show_bug.cgi?id=168809
        <rdar://problem/30687468>

        Reviewed by Jon Lee.

        We now display the "Loading" status as soon as we've started loading and
        until we've obtained enough data to play. No test provided since we don't
        have a way to specifically set networkState and readyState to the satisfactory
        values.

        * Modules/modern-media-controls/media/status-support.js:
        (StatusSupport.prototype.syncControl):
        (StatusSupport):

2017-02-23  Antoine Quint  <graouts@apple.com>

        [Modern Media Controls] Enforce a minimum layout height of 50pt for <audio>
        https://bugs.webkit.org/show_bug.cgi?id=168801
        <rdar://problem/30683453>

        Reviewed by Eric Carlson.

        We enforce a 50pt minimum layout height for <audio> elements. There is no way
        for the page author to override this value since the min-height property is set
        as !important in a <style> element contained in a ShadowRoot.

        * Modules/modern-media-controls/controls/media-controls.css:
        (:host(audio)):

2017-02-23  Youenn Fablet  <youenn@apple.com>

        [WebRTC] Outgoing video quality is poor
        https://bugs.webkit.org/show_bug.cgi?id=168778
        <rdar://problem/30674673>

        Reviewed by Eric Carlson.

        Covered by manually ensuring the voice process thread is not spinning.

        * platform/mediastream/libwebrtc/LibWebRTCAudioModule.h: Setting the next call to max was not a good idea since the thread process is adding some value to it, making it a negative value.

2017-02-23  Wenson Hsieh  <wenson_hsieh@apple.com>

        Data interaction with a URL should navigate the page if the operation is not handled
        https://bugs.webkit.org/show_bug.cgi?id=168798
        <rdar://problem/30665969>

        Reviewed by Tim Horton.

        Refactors some drag and drop code on the Mac, and implements PlatformPasteboard::stringForType.

        * page/DragController.cpp:
        (WebCore::DragController::performDragOperation):
        * platform/ios/PlatformPasteboardIOS.mm:
        (WebCore::PlatformPasteboard::stringForType):
        * platform/mac/DragDataMac.mm:

2017-02-23  Youenn Fablet  <youenn@apple.com>

        [WebRTC] RealtimeOutgoingAudioSource does not need to upsample audio buffers
        https://bugs.webkit.org/show_bug.cgi?id=168796

        Reviewed by Jer Noble.

        Covered by manual testing.
        Limiting RealtimeOutgoingAudioSource conversion to interleaving and float-to-integer.
        Removed the sample rate conversion.

        * platform/mediastream/mac/RealtimeOutgoingAudioSource.cpp:
        (WebCore::libwebrtcAudioFormat):
        (WebCore::RealtimeOutgoingAudioSource::audioSamplesAvailable):
        (WebCore::RealtimeOutgoingAudioSource::pullAudioData):

2017-02-23  Alex Christensen  <achristensen@webkit.org>

        Re-soft-link CoreVideo after r212906
        https://bugs.webkit.org/show_bug.cgi?id=168803

        Reviewed by Jer Noble.

        CoreVideo should be soft linked to reduce startup time.
        Linking against the framework just for a few symbols used in one file was the wrong solution.

        * Configurations/WebCore.xcconfig:
        * platform/cocoa/CoreVideoSoftLink.cpp:
        * platform/cocoa/CoreVideoSoftLink.h:
        * platform/mediastream/mac/RealtimeOutgoingVideoSource.cpp:

2017-02-23  Chris Dumez  <cdumez@apple.com>

        Report domains using abnormally high CPU usage via enhanced privacy logging
        https://bugs.webkit.org/show_bug.cgi?id=168794
        <rdar://problem/29964018>

        Reviewed by Ryosuke Niwa.

        Report domains using abnormally high CPU usage (> 20%) via enhanced privacy
        logging.

        * page/DiagnosticLoggingKeys.cpp:
        (WebCore::DiagnosticLoggingKeys::domainCausingEnergyDrainKey):
        * page/DiagnosticLoggingKeys.h:
        * page/PerformanceMonitor.cpp:
        (WebCore::reportPageOverPostLoadCPUUsageThreshold):
        (WebCore::PerformanceMonitor::measurePostLoadCPUUsage):

2017-02-23  Zalan Bujtas  <zalan@apple.com>

        Simple line layout: Adjust RunResolver::lineIndexForHeight with line struts.
        https://bugs.webkit.org/show_bug.cgi?id=168783
        <rdar://problem/30676449>

        Reviewed by Antti Koivisto.

        When there's a pagination gap between lines the simple lineIndex = y / lineHeight formula does not work anymore.
        This patch takes the line gaps into account by offsetting the y position accordingly.

        Not enabled yet.

        * rendering/SimpleLineLayoutResolver.cpp:
        (WebCore::SimpleLineLayout::RunResolver::lineIndexForHeight):

2017-02-23  Alex Christensen  <achristensen@webkit.org>

        Fix iOS WebRTC build after r212812
        https://bugs.webkit.org/show_bug.cgi?id=168790

        Reviewed by Tim Horton.

        * Configurations/WebCore.xcconfig:

2017-02-23  Carlos Garcia Campos  <cgarcia@igalia.com>

        [GStreamer] Several layout tests trigger GStreamer-CRITICAL **: gst_bin_get_by_name: assertion 'GST_IS_BIN (bin)' failed
        https://bugs.webkit.org/show_bug.cgi?id=167016

        Reviewed by Xabier Rodriguez-Calvar.

        This is because we create AudioSourceProviderGStreamer objects that are never loaded. In the destructor the
        AudioSourceProviderGStreamer calls gst_bin_get_by_name() on its m_audioSinkBin that is nullptr. We could simply
        check m_audioSinkBin in the destructor, but I think it's better to simply not create
        AudioSourceProviderGStreamer for nothing. MediaPlayerPrivateGStreamer should create the AudioSourceProvider on demand.

        * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
        (WebCore::MediaPlayerPrivateGStreamer::MediaPlayerPrivateGStreamer): Do not create the AudioSourceProvider.
        (WebCore::MediaPlayerPrivateGStreamer::createAudioSink): Call ensureAudioSourceProvider() before using m_audioSourceProvider.
        (WebCore::MediaPlayerPrivateGStreamer::ensureAudioSourceProvider): Create the AudioSourceProvider if needed.
        (WebCore::MediaPlayerPrivateGStreamer::audioSourceProvider): Ensure and return the m_audioSourceProvider.
        * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h:

2017-02-23  Tomas Popela  <tpopela@redhat.com>

        [GTK] Drag and drop is always moving the content even if copy is requested
        https://bugs.webkit.org/show_bug.cgi?id=168424

        Reviewed by Carlos Garcia Campos.

        Drag and drop is always moving the content around even if the copy is
        requested (i.e. by pressing the Control key).

        Test: editing/pasteboard/drag-drop-copy-content.html

        * page/gtk/DragControllerGtk.cpp:
        (WebCore::DragController::isCopyKeyDown):

2017-02-22  Myles C. Maxfield  <mmaxfield@apple.com>

        [Cocoa] Remove Yosemite-specific font lookup code
        https://bugs.webkit.org/show_bug.cgi?id=168682

        Reviewed by Zalan Bujtas.

        No new tests because there is no behavior change.

        * platform/graphics/cocoa/FontCacheCoreText.cpp:
        (WebCore::platformFontLookupWithFamily):
        (WebCore::fontWithFamily):
        * platform/graphics/mac/FontCacheMac.mm:
        (WebCore::platformInvalidateFontCache):
        (WebCore::acceptableChoice): Deleted.
        (WebCore::betterChoice): Deleted.
        (WebCore::desiredFamilyToAvailableFamilyMap): Deleted.
        (WebCore::hasDesiredFamilyToAvailableFamilyMapping): Deleted.
        (WebCore::rememberDesiredFamilyToAvailableFamilyMapping): Deleted.
        (WebCore::toAppKitFontWeight): Deleted.
        (WebCore::appkitWeightToFontWeight): Deleted.
        (WebCore::toNSFontTraits): Deleted.
        (WebCore::platformFontWithFamily): Deleted.

2017-02-22  Antoine Quint  <graouts@apple.com>

        [Modern Media Controls] Clicking on the video doesn't toggle playback state in fullscreen on macOS
        https://bugs.webkit.org/show_bug.cgi?id=168755
        <rdar://problem/30664484>

        Reviewed by Dean Jackson.

        We now call super in the handleEvent() method of MacOSFullscreenMediaControls if we're not dealing
        with an event type and target combination that was specifically registered in this class's scope.
        We had mistakenly added the call to super.handleEvent(event) in the wrong method when fixing
        https://bugs.webkit.org/show_bug.cgi?id=168515.

        Test: media/modern-media-controls/media-controller/media-controller-click-on-video-background-should-pause-fullscreen.html

        * Modules/modern-media-controls/controls/macos-fullscreen-media-controls.js:
        (MacOSFullscreenMediaControls.prototype.handleEvent):
        (MacOSFullscreenMediaControls.prototype._handleMousedown):
        * Modules/modern-media-controls/controls/macos-media-controls.js:
        (MacOSMediaControls.prototype.handleEvent):
        (MacOSMediaControls):

2017-02-22  Antoine Quint  <graouts@apple.com>

        [Modern Media Controls] Scrubber stops moving while scrubbing on macOS
        https://bugs.webkit.org/show_bug.cgi?id=168518
        <rdar://problem/30577637>

        Reviewed by Dean Jackson.

        As we start to scrub, controlValueWillStartChanging() is called on
        ScrubberSupport and pauses the media if it's not already paused. This
        causes the play/pause button to change icon and for layout() to be
        called on MacOSInlineMediaControls. This in turns sets the .children
        property on the .controlsBar and eventually yields a DOM manipulation
        which re-inserts the scrubber's DOM hierarchy, causing stutters during
        user interaction.

        Our solution is to make the .children setter smarter about identifying
        that the children list hasn't changed and that no DOM invalidation is
        necessary.

        * Modules/modern-media-controls/controls/layout-node.js:
        (LayoutNode.prototype.set children):

2017-02-22  Antoine Quint  <graouts@apple.com>

        [Modern Media Controls] Controls bar may disappear while captions menu is visible
        https://bugs.webkit.org/show_bug.cgi?id=168751
        <rdar://problem/30663411>

        Reviewed by Dean Jackson.

        We now prevent the controls bar from fading out due to the auto-hide timer firing
        when the tracks panel is up, and wait until the track panel is hidden before fading
        the controls bar.

        Test: media/modern-media-controls/tracks-panel/tracks-panel-prevent-controls-bar-from-fading.html

        * Modules/modern-media-controls/controls/controls-bar.js:
        (ControlsBar.prototype.set userInteractionEnabled):
        (ControlsBar.prototype._autoHideTimerFired):

2017-02-22  Antoine Quint  <graouts@apple.com>

        [Modern Media Controls] Can't set the volume slider with macOS inline controls
        https://bugs.webkit.org/show_bug.cgi?id=168747
        <rdar://problem/30605528>

        Reviewed by Dean Jackson.

        Only call super for events we haven't registered specifically in the context
        of this class. Otherwise we'd invalidate the volume container visibility for
        a "mousedown" event registered by the MacOSMediaControls, the super class.

        * Modules/modern-media-controls/controls/macos-inline-media-controls.js:
        (MacOSInlineMediaControls.prototype.handleEvent):

2017-02-22  Antti Koivisto  <antti@apple.com>

        Replace SimpleLineLayout::Range by WTF::IteratorRange
        https://bugs.webkit.org/show_bug.cgi?id=168742

        Reviewed by Zalan Bujtas.

        Kill a redundant custom type.

        * rendering/SimpleLineLayoutResolver.cpp:
        (WebCore::SimpleLineLayout::RunResolver::rangeForRect):
        (WebCore::SimpleLineLayout::RunResolver::rangeForRenderer):
        (WebCore::SimpleLineLayout::RunResolver::rangeForRendererWithOffsets):
        * rendering/SimpleLineLayoutResolver.h:
        (WebCore::SimpleLineLayout::LineResolver::rangeForRect):
        (WebCore::SimpleLineLayout::Range::Range): Deleted.
        (WebCore::SimpleLineLayout::Range::begin): Deleted.
        (WebCore::SimpleLineLayout::Range::end): Deleted.

2017-02-22  Simon Fraser  <simon.fraser@apple.com>

        Add the Web Authentication API as "Under Consideration".

        * features.json:

2017-02-22  Zalan Bujtas  <zalan@apple.com>

        Simple line layout: Set the pagination strut on the flow when the first line does not fit the page.
        https://bugs.webkit.org/show_bug.cgi?id=168738
        <rdar://problem/30659469>

        Reviewed by Antti Koivisto.

        The pagination strut for the first line is tracked by the parent RenderBlockFlow and not by
        the line itself (see RenderBlockFlow::adjustLinePositionForPagination()). Also renamed *PaginationStrut* to
        *LineStrut* to make sure we don't confuse it with the block level strut.

        Not enabled yet.

        * rendering/SimpleLineLayout.cpp:
        (WebCore::SimpleLineLayout::computeLineTopAndBottomWithOverflow):
        (WebCore::SimpleLineLayout::computeLineBreakIndex):
        (WebCore::SimpleLineLayout::setPageBreakForLine):
        (WebCore::SimpleLineLayout::adjustLinePositionsForPagination):
        (WebCore::SimpleLineLayout::create):
        (WebCore::SimpleLineLayout::Layout::create):
        (WebCore::SimpleLineLayout::Layout::Layout):
        * rendering/SimpleLineLayout.h:
        (WebCore::SimpleLineLayout::Layout::hasLineStruts):
        (WebCore::SimpleLineLayout::Layout::struts):
        (WebCore::SimpleLineLayout::Layout::hasPaginationStruts): Deleted.
        * rendering/SimpleLineLayoutFunctions.cpp:
        (WebCore::SimpleLineLayout::paintFlow):
        * rendering/SimpleLineLayoutFunctions.h:
        (WebCore::SimpleLineLayout::computeFlowHeight):
        * rendering/SimpleLineLayoutResolver.h:
        (WebCore::SimpleLineLayout::RunResolver::Run::computeBaselinePosition):

2017-02-22  Youenn Fablet  <youenn@apple.com>

        [WebRTC] Disable libwebrtc stderr logging in release mode
        https://bugs.webkit.org/show_bug.cgi?id=168734

        Reviewed by Tim Horton.

        No change of behavior.

        * platform/mediastream/libwebrtc/LibWebRTCProvider.cpp:
        (WebCore::initializePeerConnectionFactoryAndThreads):

2017-02-22  Jer Noble  <jer.noble@apple.com>

        MediaStreamSourceNode never receives audio from MockRealtimeAudioSourceMac.
        https://bugs.webkit.org/show_bug.cgi?id=168731

        Reviewed by Eric Carlson.

        Test: fast/mediastream/mock-media-source-webaudio.html

        Because the audioSourceProvider can be created before the mock source is configured, explicitly configure the
        source if necessary after creating the audioSourceProvider.

        * platform/mediastream/mac/MockRealtimeAudioSourceMac.mm:
        (WebCore::MockRealtimeAudioSourceMac::audioSourceProvider):

2017-02-22  Chris Dumez  <cdumez@apple.com>

        Do not aggressively throttle DOM timers until they've reached their max nesting level
        https://bugs.webkit.org/show_bug.cgi?id=168700
        <rdar://problem/29808005>

        Reviewed by Simon Fraser.

        Do not aggressively throttle DOM timers until they've actually areached their max
        nesting level (5). This overly aggressive throttling of non-nested timers is what
        was causing Google Maps to use 100% CPU in background tabs for several minutes.

        Test: fast/dom/timer-throttling-hidden-page-non-nested.html

        * dom/Document.cpp:
        (WebCore::Document::timerAlignmentInterval):

2017-02-22  Eric Carlson  <eric.carlson@apple.com>

        [MediaStream iOS] Respond to capture interruptions and notifications
        https://bugs.webkit.org/show_bug.cgi?id=168610

        Reviewed by Jer Noble.

        * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm:
        (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::ensureLayer): Drive-by cleanup: don't create
        a sample buffer display layer unless there is an active video track.

        * platform/mediastream/mac/AVMediaCaptureSource.h:
        * platform/mediastream/mac/AVMediaCaptureSource.mm:
        (WebCore::AVMediaCaptureSource::AVMediaCaptureSource): Add static_asserts to ensure that
        WebCore::InterruptionReason values map directly to AVCaptureSessionInterruptionReason values.
        (WebCore::AVMediaCaptureSource::~AVMediaCaptureSource): Minor cleanup.
        (WebCore::AVMediaCaptureSource::startProducingData): Start listening for notifications before
        starting the session.
        (WebCore::AVMediaCaptureSource::stopProducingData): Remove the notification observers before
        stopping the session.
        (WebCore::AVMediaCaptureSource::setupSession): Minor style cleanup.
        (WebCore::AVMediaCaptureSource::captureSessionRuntimeError): New. When the error is AVErrorMediaServicesWereReset,
        sometimes caused by a mediaserverd crash, try to restart the session one time.
        (WebCore::AVMediaCaptureSource::captureSessionBeginInterruption): Store the interruption reason.
        (WebCore::AVMediaCaptureSource::captureSessionEndInterruption): Try to restart the session if
        it was interrupted because the app went into multi-app layout mode.
        (WebCore::sessionKVOProperties): Drive-by cleanup.
        (-[WebCoreAVMediaCaptureSourceObserver initWithCallback:]):
        (-[WebCoreAVMediaCaptureSourceObserver disconnect]):
        (-[WebCoreAVMediaCaptureSourceObserver addNotificationObservers]):
        (-[WebCoreAVMediaCaptureSourceObserver removeNotificationObservers]):
        (-[WebCoreAVMediaCaptureSourceObserver sessionRuntimeError:]):
        (-[WebCoreAVMediaCaptureSourceObserver beginSessionInterrupted:]):
        (-[WebCoreAVMediaCaptureSourceObserver endSessionInterrupted:]):

        * platform/mediastream/mac/AVVideoCaptureSource.mm:
        (WebCore::AVVideoCaptureSource::initializeCapabilities): Not all AVCaptureSession preset strings
        are available on all platforms so load with SOFT_LINK_POINTER_OPTIONAL and NULL check before use.
        (WebCore::sizeForPreset): Ditto.
        (WebCore::AVVideoCaptureSource::bestSessionPresetForVideoDimensions): Ditto.

2017-02-22  Zalan Bujtas  <zalan@apple.com>

        Simple line layout: ensureLineBoxes for paginated content.
        https://bugs.webkit.org/show_bug.cgi?id=168729
        <rdar://problem/30654400>

        Reviewed by Antti Koivisto.

        This patch sets the layout state bits for paginated subtree layout, when we are switching
        over from simple line runs to inline tree. 

        Not enabled yet.

        * rendering/RenderBlockFlow.cpp:
        (WebCore::RenderBlockFlow::ensureLineBoxes):
        * rendering/RenderView.cpp:
        (WebCore::RenderView::pushLayoutStateForPagination): LayoutUnit(1) is not the real height, it's just
        an indicator that we've got paginated content.
        * rendering/RenderView.h:
        * rendering/SimpleLineLayout.cpp:
        (WebCore::SimpleLineLayout::create):
        (WebCore::SimpleLineLayout::Layout::create):
        (WebCore::SimpleLineLayout::Layout::Layout):
        * rendering/SimpleLineLayout.h:
        (WebCore::SimpleLineLayout::Layout::isPaginated):
        (WebCore::SimpleLineLayout::Layout::hasPaginationStruts):
        * rendering/SimpleLineLayoutFunctions.h:
        (WebCore::SimpleLineLayout::computeFlowHeight):
        * rendering/SimpleLineLayoutResolver.h:
        (WebCore::SimpleLineLayout::RunResolver::Run::computeBaselinePosition):

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  Xabier Rodriguez Calvar  <calvaris@igalia.com>

        [GStreamer][EME] Fix issue with allowed systems extraction
        https://bugs.webkit.org/show_bug.cgi?id=168717

        Reviewed by Carlos Garcia Campos.

        The allowed systems were not being extracted from the need-context
        message because the loop was not stopping on the right condition.

        * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
        (WebCore::extractEventsAndSystemsFromMessage): Fix wrong
        condition.
        (WebCore::MediaPlayerPrivateGStreamerBase::handleProtectionEvent):
        Add better debug category.

2017-02-22  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 Andreas Kling.

        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-08  Sergio Villar Senin  <svillar@igalia.com>

        [css-grid] Move the track sizing algorithm to its own class
        https://bugs.webkit.org/show_bug.cgi?id=167988

        Reviewed by Manuel Rego Casasnovas.

        This is about moving the track sizing algorithm code out of RenderGrid to a new class
        GridTrackSizingAlgorithm, making RenderGrid more compact and easy to maintain. A nice side
        effect of this patch is the removal of the GridSizingData structure as it is no longer
        needed. All the data structures in that class were transferred to GridTrackSizingAlgorithm
        as private attribute members. The GridTrack class was also moved to the new file.

        The algorithm execution starts with the call to run(). It's mandatory to call setup() before
        any call to run() in order to properly configure the behaviour of the algorithm. You can
        call setup() & run() multiple times for a single layout operation (normally twice, one for
        columns and another one for rows). The algorithm uses a state machine to verify that the
        client issues the calls in the proper order (i.e. first columns and then rows). After
        finishing the layout, the client should call reset() to allow the algorithm to perform
        cleanups and to prepare itself for another round of calls.

        In order to implement the different behaviours of the algorithm depending on whether the
        available size is definite or not, a strategy pattern was implemented in the
        GridTrackSizingAlgorithmStrategy class. It has two subclasses, one for definite sizes and
        another one for indefinite ones.

        We took advantage of this change to perform some renames of the track sizing algorithm
        methods that were still using the names from the first versions of the specs. Not only that,
        the original track sizing algorithm method (computeUsedBreadthOfGridTracks) was split in 4
        different parts representing the 4 steps of the algorithm.

        No new tests as this is about moving code and refactoring.

        * CMakeLists.txt:
        * WebCore.xcodeproj/project.pbxproj:
        * rendering/GridTrackSizingAlgorithm.cpp: Added.
        (WebCore::GridTrack::baseSize):
        (WebCore::GridTrack::growthLimit):
        (WebCore::GridTrack::setBaseSize):
        (WebCore::GridTrack::setGrowthLimit):
        (WebCore::GridTrack::growthLimitIfNotInfinite):
        (WebCore::GridTrack::setTempSize):
        (WebCore::GridTrack::growTempSize):
        (WebCore::GridTrack::setGrowthLimitCap):
        (WebCore::GridTrack::ensureGrowthLimitIsBiggerThanBaseSize):
        (WebCore::shouldClearOverrideContainingBlockContentSizeForChild):
        (WebCore::hasOverrideContainingBlockContentSizeForChild):
        (WebCore::setOverrideContainingBlockContentSizeForChild):
        (WebCore::flowAwareDirectionForChild):
        (WebCore::overrideContainingBlockContentSizeForChild):
        (WebCore::computeMarginLogicalSizeForChild):
        (WebCore::marginIntrinsicLogicalWidthForChild):
        (WebCore::GridTrackSizingAlgorithm::setFreeSpace):
        (WebCore::GridTrackSizingAlgorithm::rawGridTrackSize):
        (WebCore::GridTrackSizingAlgorithm::computeTrackBasedSize):
        (WebCore::GridTrackSizingAlgorithm::initialBaseSize):
        (WebCore::GridTrackSizingAlgorithm::initialGrowthLimit):
        (WebCore::GridTrackSizingAlgorithm::sizeTrackToFitNonSpanningItem):
        (WebCore::GridTrackSizingAlgorithm::spanningItemCrossesFlexibleSizedTracks):
        (WebCore::GridItemWithSpan::GridItemWithSpan):
        (WebCore::GridItemWithSpan::gridItem):
        (WebCore::GridItemWithSpan::span):
        (WebCore::GridItemWithSpan::operator<):
        (WebCore::GridTrackSizingAlgorithm::itemSizeForTrackSizeComputationPhase):
        (WebCore::shouldProcessTrackForTrackSizeComputationPhase):
        (WebCore::trackSizeForTrackSizeComputationPhase):
        (WebCore::updateTrackSizeForTrackSizeComputationPhase):
        (WebCore::trackShouldGrowBeyondGrowthLimitsForTrackSizeComputationPhase):
        (WebCore::markAsInfinitelyGrowableForTrackSizeComputationPhase):
        (WebCore::GridTrackSizingAlgorithm::increaseSizesToAccommodateSpanningItems):
        (WebCore::sortByGridTrackGrowthPotential):
        (WebCore::clampGrowthShareIfNeeded):
        (WebCore::GridTrackSizingAlgorithm::distributeSpaceToTracks):
        (WebCore::GridTrackSizingAlgorithm::assumedRowsSizeForOrthogonalChild):
        (WebCore::GridTrackSizingAlgorithm::gridAreaBreadthForChild):
        (WebCore::GridTrackSizingAlgorithm::gridTrackSize):
        (WebCore::GridTrackSizingAlgorithm::computeFlexFactorUnitSize):
        (WebCore::GridTrackSizingAlgorithm::computeFlexSizedTracksGrowth):
        (WebCore::GridTrackSizingAlgorithm::findFrUnitSize):
        (WebCore::GridTrackSizingAlgorithm::computeGridContainerIntrinsicSizes):
        (WebCore::GridTrackSizingAlgorithmStrategy::logicalHeightForChild):
        (WebCore::GridTrackSizingAlgorithmStrategy::minContentForChild):
        (WebCore::GridTrackSizingAlgorithmStrategy::maxContentForChild):
        (WebCore::GridTrackSizingAlgorithmStrategy::minSizeForChild):
        (WebCore::GridTrackSizingAlgorithmStrategy::updateOverrideContainingBlockContentSizeForChild):
        (WebCore::IndefiniteSizeStrategy::minLogicalWidthForChild):
        (WebCore::IndefiniteSizeStrategy::layoutGridItemForMinSizeComputation):
        (WebCore::IndefiniteSizeStrategy::maximizeTracks):
        (WebCore::normalizedFlexFraction):
        (WebCore::IndefiniteSizeStrategy::findUsedFlexFraction):
        (WebCore::IndefiniteSizeStrategy::recomputeUsedFlexFractionIfNeeded):
        (WebCore::DefiniteSizeStrategy::minLogicalWidthForChild):
        (WebCore::DefiniteSizeStrategy::maximizeTracks):
        (WebCore::DefiniteSizeStrategy::layoutGridItemForMinSizeComputation):
        (WebCore::DefiniteSizeStrategy::findUsedFlexFraction):
        (WebCore::DefiniteSizeStrategy::recomputeUsedFlexFractionIfNeeded):
        (WebCore::GridTrackSizingAlgorithm::initializeTrackSizes):
        (WebCore::GridTrackSizingAlgorithm::resolveIntrinsicTrackSizes):
        (WebCore::GridTrackSizingAlgorithm::stretchFlexibleTracks):
        (WebCore::GridTrackSizingAlgorithm::advanceNextState):
        (WebCore::GridTrackSizingAlgorithm::isValidTransition):
        (WebCore::GridTrackSizingAlgorithm::setup):
        (WebCore::GridTrackSizingAlgorithm::run):
        (WebCore::GridTrackSizingAlgorithm::reset):
        (WebCore::GridTrackSizingAlgorithm::tracksAreWiderThanMinTrackBreadth):
        (WebCore::GridTrackSizingAlgorithm::StateMachine::StateMachine):
        (WebCore::GridTrackSizingAlgorithm::StateMachine::~StateMachine):
        * rendering/GridTrackSizingAlgorithm.h: Added.
        (WebCore::GridTrack::GridTrack):
        (WebCore::GridTrack::infiniteGrowthPotential):
        (WebCore::GridTrack::plannedSize):
        (WebCore::GridTrack::setPlannedSize):
        (WebCore::GridTrack::tempSize):
        (WebCore::GridTrack::infinitelyGrowable):
        (WebCore::GridTrack::setInfinitelyGrowable):
        (WebCore::GridTrack::growthLimitCap):
        (WebCore::GridTrack::growthLimitIsInfinite):
        (WebCore::GridTrack::isGrowthLimitBiggerThanBaseSize):
        (WebCore::GridTrackSizingAlgorithmStrategy::GridTrackSizingAlgorithmStrategy):
        (WebCore::GridTrackSizingAlgorithmStrategy::computeTrackBasedSize):
        (WebCore::GridTrackSizingAlgorithmStrategy::direction):
        (WebCore::GridTrackSizingAlgorithmStrategy::findFrUnitSize):
        (WebCore::GridTrackSizingAlgorithmStrategy::distributeSpaceToTracks):
        (WebCore::GridTrackSizingAlgorithmStrategy::renderGrid):
        * rendering/RenderGrid.cpp:
        (WebCore::RenderGrid::RenderGrid):
        (WebCore::RenderGrid::computeTrackBasedLogicalHeight):
        (WebCore::RenderGrid::computeTrackSizesForDefiniteSize):
        (WebCore::RenderGrid::repeatTracksSizingIfNeeded):
        (WebCore::RenderGrid::layoutBlock):
        (WebCore::RenderGrid::computeIntrinsicLogicalWidths):
        (WebCore::RenderGrid::computeTrackSizesForIndefiniteSize):
        (WebCore::RenderGrid::placeSpecifiedMajorAxisItemsOnGrid):
        (WebCore::RenderGrid::applyStretchAlignmentToTracksIfNeeded):
        (WebCore::RenderGrid::layoutGridItems):
        (WebCore::RenderGrid::gridAreaBreadthForChildIncludingAlignmentOffsets):
        (WebCore::RenderGrid::populateGridPositionsForDirection):
        (WebCore::RenderGrid::columnAxisOffsetForChild):
        (WebCore::RenderGrid::rowAxisOffsetForChild):
        (WebCore::RenderGrid::findChildLogicalPosition):
        (WebCore::GridTrack::GridTrack): Deleted.
        (WebCore::GridTrack::baseSize): Deleted.
        (WebCore::GridTrack::growthLimit): Deleted.
        (WebCore::GridTrack::setBaseSize): Deleted.
        (WebCore::GridTrack::setGrowthLimit): Deleted.
        (WebCore::GridTrack::infiniteGrowthPotential): Deleted.
        (WebCore::GridTrack::growthLimitIfNotInfinite): Deleted.
        (WebCore::GridTrack::plannedSize): Deleted.
        (WebCore::GridTrack::setPlannedSize): Deleted.
        (WebCore::GridTrack::tempSize): Deleted.
        (WebCore::GridTrack::setTempSize): Deleted.
        (WebCore::GridTrack::growTempSize): Deleted.
        (WebCore::GridTrack::infinitelyGrowable): Deleted.
        (WebCore::GridTrack::setInfinitelyGrowable): Deleted.
        (WebCore::GridTrack::setGrowthLimitCap): Deleted.
        (WebCore::GridTrack::growthLimitCap): Deleted.
        (WebCore::GridTrack::growthLimitIsInfinite): Deleted.
        (WebCore::GridTrack::isGrowthLimitBiggerThanBaseSize): Deleted.
        (WebCore::GridTrack::ensureGrowthLimitIsBiggerThanBaseSize): Deleted.
        (WebCore::RenderGrid::GridSizingData::GridSizingData): Deleted.
        (WebCore::RenderGrid::GridSizingData::freeSpace): Deleted.
        (WebCore::RenderGrid::GridSizingData::availableSpace): Deleted.
        (WebCore::RenderGrid::GridSizingData::setAvailableSpace): Deleted.
        (WebCore::RenderGrid::GridSizingData::advanceNextState): Deleted.
        (WebCore::RenderGrid::GridSizingData::isValidTransition): Deleted.
        (WebCore::RenderGrid::GridSizingData::grid): Deleted.
        (WebCore::RenderGrid::GridSizingData::setFreeSpace): Deleted.
        (WebCore::RenderGrid::computeTrackSizesForDirection): Deleted.
        (WebCore::RenderGrid::computeIntrinsicLogicalHeight): Deleted.
        (WebCore::normalizedFlexFraction): Deleted.
        (WebCore::RenderGrid::computeUsedBreadthOfGridTracks): Deleted.
        (WebCore::RenderGrid::computeFlexSizedTracksGrowth): Deleted.
        (WebCore::RenderGrid::computeUsedBreadthOfMinLength): Deleted.
        (WebCore::RenderGrid::computeUsedBreadthOfMaxLength): Deleted.
        (WebCore::RenderGrid::computeFlexFactorUnitSize): Deleted.
        (WebCore::RenderGrid::findFlexFactorUnitSize): Deleted.
        (WebCore::hasOverrideContainingBlockContentSizeForChild): Deleted.
        (WebCore::setOverrideContainingBlockContentSizeForChild): Deleted.
        (WebCore::shouldClearOverrideContainingBlockContentSizeForChild): Deleted.
        (WebCore::RenderGrid::rawGridTrackSize): Deleted.
        (WebCore::RenderGrid::gridTrackSize): Deleted.
        (WebCore::RenderGrid::logicalHeightForChild): Deleted.
        (WebCore::RenderGrid::minSizeForChild): Deleted.
        (WebCore::RenderGrid::updateOverrideContainingBlockContentSizeForChild): Deleted.
        (WebCore::RenderGrid::minContentForChild): Deleted.
        (WebCore::RenderGrid::maxContentForChild): Deleted.
        (WebCore::GridItemWithSpan::GridItemWithSpan): Deleted.
        (WebCore::GridItemWithSpan::gridItem): Deleted.
        (WebCore::GridItemWithSpan::span): Deleted.
        (WebCore::GridItemWithSpan::operator<): Deleted.
        (WebCore::RenderGrid::spanningItemCrossesFlexibleSizedTracks): Deleted.
        (WebCore::RenderGrid::resolveContentBasedTrackSizingFunctions): Deleted.
        (WebCore::RenderGrid::resolveContentBasedTrackSizingFunctionsForNonSpanningItems): Deleted.
        (WebCore::trackSizeForTrackSizeComputationPhase): Deleted.
        (WebCore::RenderGrid::shouldProcessTrackForTrackSizeComputationPhase): Deleted.
        (WebCore::RenderGrid::trackShouldGrowBeyondGrowthLimitsForTrackSizeComputationPhase): Deleted.
        (WebCore::RenderGrid::markAsInfinitelyGrowableForTrackSizeComputationPhase): Deleted.
        (WebCore::RenderGrid::updateTrackSizeForTrackSizeComputationPhase): Deleted.
        (WebCore::RenderGrid::currentItemSizeForTrackSizeComputationPhase): Deleted.
        (WebCore::RenderGrid::resolveContentBasedTrackSizingFunctionsForItems): Deleted.
        (WebCore::sortByGridTrackGrowthPotential): Deleted.
        (WebCore::clampGrowthShareIfNeeded): Deleted.
        (WebCore::RenderGrid::distributeSpaceToTracks): Deleted.
        (WebCore::RenderGrid::tracksAreWiderThanMinTrackBreadth): Deleted.
        (WebCore::RenderGrid::assumedRowsSizeForOrthogonalChild): Deleted.
        (WebCore::RenderGrid::gridAreaBreadthForChild): Deleted.
        * rendering/RenderGrid.h:

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  Carlos Garcia Campos  <cgarcia@igalia.com>

        [GStreamer] Crash in MediaPlayerPrivateGStreamerMSE::buffered() when MEDIA_STREAM is disabled
        https://bugs.webkit.org/show_bug.cgi?id=168662

        Reviewed by Michael Catanzaro.

        When MEDIA_STREAM is disabled, if MediaPlayer::loadWithNextMediaEngine is called with a current engine and
        there's no type specified, the next media engine that is used is the MSE one. Since there's no actually a media
        stream, the engine is created but never loaded. When buffered is called it tries to use its media source that is
        nullptr. It doesn't happen when MEDIA_STREAM is enabled, because the next media engine returned is Owr that
        doesn't implement buffered and always returns an empty PlatformTimeRanges.

        * platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.cpp:
        (WebCore::MediaPlayerPrivateGStreamerMSE::buffered): Return an empty PlatformTimeRanges if m_mediaSource is nullptr.

2017-02-21  Youenn Fablet  <youenn@apple.com>

        [WebRTC][Mac] Activate libwebrtc
        https://bugs.webkit.org/show_bug.cgi?id=167293

        Reviewed by Alex Christensen.

        * Configurations/WebCore.xcconfig:
        * Configurations/WebCoreTestSupport.xcconfig:
        * Configurations/FeatureDefines.xcconfig:

2017-02-21  Carlos Garcia Campos  <cgarcia@igalia.com>

        Unreviewed. Fix WinCairo build after r212703.

        * platform/TextureMapper.cmake:

2017-02-21  Per Arne Vollan  <pvollan@apple.com>

        Add support for CSS properties paint-order, stroke-linecap, and stroke-linejoin in text rendering.
        https://bugs.webkit.org/show_bug.cgi?id=168601
        rdar://problem/30583872

        Reviewed by Simon Fraser.

        Text rendering should respect the CSS properties paint-order, stroke-linecap, and stroke-linejoin,
        see https://drafts.fxtf.org/paint/. The text rendering changes are mainly in the TextPainter class,
        where text is painted in three phases (fill, stroke, markers), where the order follows the
        paint-order property. The linecap and linejoin properties are set on the graphics context before
        rendering the text.

        Tests: fast/css/paint-order.html
               fast/css/paint-order-shadow.html

        * css/CSSComputedStyleDeclaration.cpp:
        (WebCore::paintOrder):
        * css/StyleBuilderConverter.h:
        (WebCore::StyleBuilderConverter::convertPaintOrder):
        * rendering/TextPaintStyle.cpp:
        (WebCore::computeTextPaintStyle):
        (WebCore::updateGraphicsContext):
        * rendering/TextPaintStyle.h:
        * rendering/TextPainter.cpp:
        (WebCore::TextPainter::paintTextAndEmphasisMarksIfNeeded):
        * rendering/style/RenderStyle.cpp:
        (WebCore::RenderStyle::paintTypesForPaintOrder):
        * rendering/style/RenderStyle.h:
        (WebCore::RenderStyle::setPaintOrder):
        (WebCore::RenderStyle::initialPaintOrder):
        * rendering/style/RenderStyleConstants.h:
        * rendering/style/SVGRenderStyleDefs.h:
        * rendering/style/StyleRareInheritedData.cpp:
        (WebCore::StyleRareInheritedData::StyleRareInheritedData):
        * rendering/svg/RenderSVGShape.cpp:
        (WebCore::RenderSVGShape::fillStrokeMarkers):
        * rendering/svg/SVGInlineTextBox.cpp:
        (WebCore::SVGInlineTextBox::paint):

2017-02-21  Joseph Pecoraro  <pecoraro@apple.com>

        [User Timing] Throw a SyntaxError for performance.measure if mark name is not found
        https://bugs.webkit.org/show_bug.cgi?id=168707

        Reviewed by Ryosuke Niwa.

        Test: performance-api/performance-measure-name.html

        * page/PerformanceUserTiming.cpp:
        (WebCore::UserTiming::findExistingMarkStartTime):
        Instead of returning zero, throw a SyntaxError. This is more in line
        with User Timing Level 1 and behavior in Window. This is an issue with
        the Level 2 spec: https://github.com/w3c/user-timing/issues/21

2017-02-21  Ryan Haddad  <ryanhaddad@apple.com>

        Unreviewed attempt to fix the Windows build.

        * platform/graphics/ca/win/PlatformCALayerWin.cpp:
        (PlatformCALayerWin::supportsSubpixelAntialiasedText):

2017-02-21  Ryan Haddad  <ryanhaddad@apple.com>

        Unreviewed, rolling out r212737.

        This change caused an existing LayoutTest to crash.

        Reverted changeset:

        "REGRESSION(r207669): Crash after mutating selector text"
        https://bugs.webkit.org/show_bug.cgi?id=168655
        http://trac.webkit.org/changeset/212737

2017-02-21  Chris Dumez  <cdumez@apple.com>

        REGRESSION (r207720): /more/conformance/conformance/quickCheckAPI-S_V.html test fails
        https://bugs.webkit.org/show_bug.cgi?id=168632
        <rdar://problem/30620129>

        Reviewed by Darin Adler.

        After r207720, the following WebGL conformance tests started failing:
        - /more/conformance/conformance/quickCheckAPI-S_V.html
        - /context/context-lost.html

        We started throwing security errors in case where we did not before.
        Chrome and Firefox are both passing these tests so our new behavior was not interoperable.

        This patch reverts part of r207720 to restore our previous behavior.

        * html/canvas/WebGLRenderingContextBase.cpp:
        (WebCore::WebGLRenderingContextBase::texSubImage2D):
        (WebCore::WebGLRenderingContextBase::texImage2D):
        (WebCore::WebGLRenderingContextBase::validateHTMLImageElement):
        (WebCore::WebGLRenderingContextBase::validateHTMLCanvasElement):
        (WebCore::WebGLRenderingContextBase::validateHTMLVideoElement):
        * html/canvas/WebGLRenderingContextBase.h:

2017-02-21  Dean Jackson  <dino@apple.com>

        No need for static attributes when creating a pixel format
        https://bugs.webkit.org/show_bug.cgi?id=168688
        <rdar://problem/30642256>

        Reviewed by Myles Maxfield.

        Just create the attributes when needed.

        * platform/graphics/mac/GraphicsContext3DMac.mm:
        (WebCore::GraphicsContext3DManager::updateHighPerformanceState):

2017-02-20  Filip Pizlo  <fpizlo@apple.com>

        The collector thread should only start when the mutator doesn't have heap access
        https://bugs.webkit.org/show_bug.cgi?id=167737

        Reviewed by Keith Miller.

        Added new tests in JSTests.
        
        The WebCore changes involve:
        
        - Refactoring around new header discipline.
        
        - Adding crazy GC APIs to window.internals to enable us to test the GC's runloop discipline.

        * ForwardingHeaders/heap/GCFinalizationCallback.h: Added.
        * ForwardingHeaders/heap/IncrementalSweeper.h: Added.
        * ForwardingHeaders/heap/MachineStackMarker.h: Added.
        * ForwardingHeaders/heap/RunningScope.h: Added.
        * bindings/js/CommonVM.cpp:
        * testing/Internals.cpp:
        (WebCore::Internals::parserMetaData):
        (WebCore::Internals::isReadableStreamDisturbed):
        (WebCore::Internals::isGCRunning):
        (WebCore::Internals::addGCFinalizationCallback):
        (WebCore::Internals::stopSweeping):
        (WebCore::Internals::startSweeping):
        * testing/Internals.h:
        * testing/Internals.idl:

2017-02-20  Simon Fraser  <simon.fraser@apple.com>

        Add support to PlatformCALayer/GraphicsLayerCA for subpixel-antialiased text, with a Setting and a MiniBrowser switch
        https://bugs.webkit.org/show_bug.cgi?id=168620
        <rdar://problem/30617772>

        Reviewed by Tim Horton.

        Add a Setting for subpixel-antialiased layer text. Plumb this through GraphicsLayerCA and
        PlatformCALayer, where it ultimately affects the layer contents format.
        
        TileControllers are slightly special because we communicate with them via an Obj-C
        WebTiledBackingLayer.

        Test: compositing/contents-format/subpixel-antialiased-text-enabled.html

        * page/Settings.in:
        * platform/graphics/GraphicsLayer.cpp:
        (WebCore::GraphicsLayer::GraphicsLayer):
        (WebCore::GraphicsLayer::dumpProperties):
        * platform/graphics/GraphicsLayer.h:
        (WebCore::GraphicsLayer::supportsSubpixelAntialiasedText):
        (WebCore::GraphicsLayer::setSupportsSubpixelAntialiasedText):
        * platform/graphics/ca/GraphicsLayerCA.cpp:
        (WebCore::GraphicsLayerCA::setSupportsSubpixelAntialiasedText):
        (WebCore::GraphicsLayerCA::commitLayerChangesBeforeSublayers):
        (WebCore::GraphicsLayerCA::updateSupportsSubpixelAntialiasedText):
        * platform/graphics/ca/GraphicsLayerCA.h:
        * platform/graphics/ca/PlatformCALayer.cpp:
        (WebCore::PlatformCALayer::drawRepaintIndicator):
        * platform/graphics/ca/PlatformCALayer.h:
        * platform/graphics/ca/TileController.cpp:
        (WebCore::TileController::setWantsDeepColorBackingStore):
        (WebCore::TileController::setSupportsSubpixelAntialiasedText):
        (WebCore::TileController::setTilesOpaque):
        * platform/graphics/ca/TileController.h:
        * platform/graphics/ca/TileGrid.cpp:
        (WebCore::TileGrid::updateTileLayerProperties):
        * platform/graphics/ca/cocoa/PlatformCALayerCocoa.h:
        * platform/graphics/ca/cocoa/PlatformCALayerCocoa.mm:
        (PlatformCALayerCocoa::supportsSubpixelAntialiasedText):
        (PlatformCALayerCocoa::setSupportsSubpixelAntialiasedText):
        (layerContentsFormat):
        (PlatformCALayerCocoa::updateContentsFormat):
        (PlatformCALayer::drawLayerContents):
        * platform/graphics/ca/cocoa/WebTiledBackingLayer.h:
        * platform/graphics/ca/cocoa/WebTiledBackingLayer.mm:
        (-[WebTiledBackingLayer drawsAsynchronously]):
        (-[WebTiledBackingLayer setSupportsSubpixelAntialiasedText:]):
        (-[WebTiledBackingLayer supportsSubpixelAntialiasedText]):
        * platform/spi/cocoa/QuartzCoreSPI.h:
        * rendering/RenderLayerBacking.cpp:
        (WebCore::RenderLayerBacking::createGraphicsLayer):

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  Jer Noble  <jer.noble@apple.com>

        AudioSampleDataSource doesn't need to use the m_scratchBuffer on the pulling thread
        https://bugs.webkit.org/show_bug.cgi?id=168640

        Reviewed by Eric Carlson.

        Rather than copying the pulled data into a scratch buffer, applying a volume transformation
        and then copying back out, just do the volume transformation in-place in the destination
        buffer.

        * platform/audio/mac/AudioSampleDataSource.cpp:
        (WebCore::AudioSampleDataSource::pullSamplesInternal):

2017-02-21  Youenn Fablet  <youenn@apple.com>

        [WebRTC] Implement Incoming libwebrtc audio source support.
        https://bugs.webkit.org/show_bug.cgi?id=167961

        Reviewed by Eric Carlson.

        Hook libwebrtc incoming audio source into WebCore audio rendering path.
        Manually testing that muted sources produce data with zeros and unmuted sources provide data with non zeros.

        * platform/mediastream/mac/RealtimeIncomingAudioSource.cpp:
        (WebCore::RealtimeIncomingAudioSource::create):
        (WebCore::streamDescription):
        (WebCore::RealtimeIncomingAudioSource::OnData):
        (WebCore::RealtimeIncomingAudioSource::audioSourceProvider):
        * platform/mediastream/mac/RealtimeIncomingAudioSource.h:

2017-02-21  Simon Fraser  <simon.fraser@apple.com>

        Fix ImageBitmap comment to not insert a <canvas>.

        * features.json:

2017-02-21  Alex Christensen  <achristensen@webkit.org>

        Fix CMake build.

        * PlatformMac.cmake:

2017-02-21  Simon Fraser  <simon.fraser@apple.com>

        Add Media Streams and Capture to features.json.

        * features.json:

2017-02-21  Jiewen Tan  <jiewen_tan@apple.com>

        Clarify the status of 'webkitSubtle' and 'subtle' attributes on the WebCrypto API.

        * features.json:

2017-02-21  Romain Bellessort  <romain.bellessort@crf.canon.fr>

        [Readable Streams API] Add ReadableStreamBYOBRequest view getter
        https://bugs.webkit.org/show_bug.cgi?id=168652

        Reviewed by Youenn Fablet.

        Implemented getter for ReadableStreamBYOBRequest view attribute.
        
        Added 1 test checking that view length corresponds to autoAllocateChunkSize.
        Also updated test expectations for W3C imported tests.

        * Modules/streams/ReadableByteStreamInternals.js:
        (isReadableStreamBYOBRequest): Added.
        * Modules/streams/ReadableStreamBYOBRequest.js:
        (view): Added.

2017-02-21  Simon Fraser  <simon.fraser@apple.com>

        Clarify the status of 'webkitSubtle' and 'subtle' attributes on the WebCrypto API.

        * features.json:

2017-02-21  Youenn Fablet  <youenn@apple.com>

        [WebRTC] ICE candidates should be filtered according a policy
        https://bugs.webkit.org/show_bug.cgi?id=168348

        Reviewed by Alex Christensen.

        Covered by manual tests. Should be covered in the future by layout tests with dedicated internals API.

        Adding support for ICE candidate filtering at RTCPeerConnection level.
        If ICE candidate filtering is on (by default), host candidates are stored and not sent immediately.
        Reflexive candidates are purged from raddr information to not leak the host IP address.

        Stored candidates may be advertised to the JS layer if RTCController is notified of a change of filtering policy.
        To implement that, PeerConnectionBackend stores all filtered out candidates and RTCPeerConnection register
        themselves to RTCController to get notifications of filtering policy changes.

        Making RTCPeerConnection use setPendingActivity throughout its lifetime.
        This ensures it does not get collected until the page is off or close() is called on the object.

        Adding support for enumerating or not all interfaces at libwebrtc level.
        This choice is done at creation of the peer connection.

        * Modules/mediastream/PeerConnectionBackend.cpp:
        (WebCore::PeerConnectionBackend::enableICECandidateFiltering):
        (WebCore::PeerConnectionBackend::disableICECandidateFiltering):
        (WebCore::filterICECandidate):
        (WebCore::PeerConnectionBackend::newICECandidate):
        * Modules/mediastream/PeerConnectionBackend.h:
        * Modules/mediastream/RTCController.cpp: Added.
        (WebCore::RTCController::remove):
        (WebCore::RTCController::add):
        (WebCore::RTCController::disableICECandidateFiltering):
        (WebCore::RTCController::enableICECandidateFiltering):
        * Modules/mediastream/RTCController.h: Added.
        * Modules/mediastream/RTCPeerConnection.cpp:
        (WebCore::RTCPeerConnection::create):
        (WebCore::RTCPeerConnection::close):
        (WebCore::RTCPeerConnection::rtcController):
        (WebCore::RTCPeerConnection::registerToController):
        (WebCore::RTCPeerConnection::unregisterFromController):
        * Modules/mediastream/RTCPeerConnection.h:
        * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp:
        (WebCore::LibWebRTCMediaEndpoint::OnIceCandidate):
        * WebCore.xcodeproj/project.pbxproj:
        * page/Page.h:
        (WebCore::Page::rtcController):
        * platform/mediastream/libwebrtc/LibWebRTCProvider.cpp:
        (WebCore::LibWebRTCProvider::createPeerConnection):
        * platform/mediastream/libwebrtc/LibWebRTCProvider.h:

2017-02-21  Jiewen Tan  <jiewen_tan@apple.com>

        Unreviewed, update WebCrypto API feature status.

        * features.json:

2017-02-21  Simon Fraser  <simon.fraser@apple.com>

        Fix the bad JSON.

        * features.json:

2017-02-21  Andreas Kling  <akling@apple.com>

        [iOS] WebKit1 should use shared memory pressure handler code.
        <https://webkit.org/b/168653>

        Reviewed by Antti Koivisto.

        Remove iOS WebKit1 specific members and code from MemoryPressureHandler in favor
        of using the same code that iOS WebKit2 and macOS WebKit uses.

        * page/cocoa/MemoryReleaseCocoa.mm:
        (WebCore::platformReleaseMemory): Add two cleanup calls that were only in the iOS WebView code.
        * platform/MemoryPressureHandler.h:
        (WebCore::MemoryPressureHandler::m_releaseMemoryBlock): Deleted.
        * platform/cocoa/MemoryPressureHandlerCocoa.mm:
        (WebCore::respondToMemoryPressureCallback): Deleted.
        (WebCore::MemoryPressureHandler::installMemoryReleaseBlock): Deleted.
        (WebCore::MemoryPressureHandler::setReceivedMemoryPressure): Deleted.
        (WebCore::MemoryPressureHandler::clearMemoryPressure): Deleted.
        (WebCore::MemoryPressureHandler::shouldWaitForMemoryClearMessage): Deleted.
        (WebCore::MemoryPressureHandler::respondToMemoryPressureIfNeeded): Deleted.

2017-02-21  Anders Carlsson  <andersca@apple.com>

        Fix two failing WebKit legacy tests
        https://bugs.webkit.org/show_bug.cgi?id=168667

        Reviewed by Tim Horton.

        Handle the NSPasteboardTypeString type.

        * platform/mac/PasteboardMac.mm:
        (WebCore::Pasteboard::read):
        (WebCore::addHTMLClipboardTypesForCocoaType):

2017-02-21  Simon Fraser  <simon.fraser@apple.com>

        Add Web Audio and Web MIDI to features.json.

        * features.json:

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-21  Jiewen Tan  <jiewen_tan@apple.com>

        [WebCrypto] Add support for AES-CFB
        https://bugs.webkit.org/show_bug.cgi?id=168344
        <rdar://problem/20940221>

        Reviewed by Brent Fulgham.

        This patch adds support for AES-CFB. Operations of AES-CFB include: encrypt, decrypt, generateKey,
        importKey, exportKey, wrapKey, and unwrapKey. This implementation follows a slightly old version
        of WebCryptoAPI spec: https://www.w3.org/TR/2014/CR-WebCryptoAPI-20141211/#aes-cfb.

        Tests: crypto/subtle/aes-cbc-cfb-decrypt-malformed-parameters.html
               crypto/subtle/aes-cbc-cfb-encrypt-malformed-parameters.html
               crypto/subtle/aes-cbc-import-key-unwrap-jwk-rsa-key-public.html
               crypto/subtle/aes-cfb-generate-export-key-jwk-length-128.html
               crypto/subtle/aes-cfb-generate-export-key-jwk-length-192.html
               crypto/subtle/aes-cfb-generate-export-key-jwk-length-256.html
               crypto/subtle/aes-cfb-generate-export-raw-key.html
               crypto/subtle/aes-cfb-generate-key-encrypt-decrypt.html
               crypto/subtle/aes-cfb-generate-key.html
               crypto/subtle/aes-cfb-import-jwk-key-length-128.html
               crypto/subtle/aes-cfb-import-jwk-key-length-192.html
               crypto/subtle/aes-cfb-import-jwk-key-length-256.html
               crypto/subtle/aes-cfb-import-key-decrypt.html
               crypto/subtle/aes-cfb-import-key-encrypt.html
               crypto/subtle/aes-cfb-import-key-unwrap-jwk-key.html
               crypto/subtle/aes-cfb-import-key-unwrap-raw-key.html
               crypto/subtle/aes-cfb-import-key-wrap-jwk-key.html
               crypto/subtle/aes-cfb-import-key-wrap-raw-key.html
               crypto/subtle/aes-cfb-import-raw-key.html
               crypto/workers/subtle/aes-cfb-import-key-decrypt.html
               crypto/workers/subtle/aes-cfb-import-key-encrypt.html
               crypto/workers/subtle/aes-cfb-import-key-unwrap-key.html
               crypto/workers/subtle/aes-cfb-import-key-wrap-key.html

        * CMakeLists.txt:
        * DerivedSources.make:
        * PlatformGTK.cmake:
        * PlatformMac.cmake:
        * WebCore.xcodeproj/project.pbxproj:
        Add CryptoAlgorithmAES_CFB.cpp,
        change AesCbcParams.idl to AesCbcCfbParams.idl.
        * bindings/js/JSSubtleCryptoCustom.cpp:
        (WebCore::normalizeCryptoAlgorithmParameters):
        Add support for AES-CFB.
        * crypto/CryptoAlgorithm.h:
        Include <wtf/Variant.h>.
        * crypto/CryptoAlgorithmParameters.h:
        Add support for AES-CFB.
        * crypto/algorithms/CryptoAlgorithmAES_CBC.cpp:
        (WebCore::CryptoAlgorithmAES_CBC::encrypt):
        (WebCore::CryptoAlgorithmAES_CBC::decrypt):
        Rename CryptoAlgorithmAesCbcParams to CryptoAlgorithmAesCbcCfbParams.
        * crypto/algorithms/CryptoAlgorithmAES_CFB.cpp: Added.
        (WebCore::usagesAreInvalidForCryptoAlgorithmAES_CFB):
        (WebCore::CryptoAlgorithmAES_CFB::create):
        (WebCore::CryptoAlgorithmAES_CFB::identifier):
        (WebCore::CryptoAlgorithmAES_CFB::encrypt):
        (WebCore::CryptoAlgorithmAES_CFB::decrypt):
        (WebCore::CryptoAlgorithmAES_CFB::generateKey):
        (WebCore::CryptoAlgorithmAES_CFB::importKey):
        (WebCore::CryptoAlgorithmAES_CFB::exportKey):
        * crypto/algorithms/CryptoAlgorithmAES_CFB.h: Added.
        * crypto/gnutls/CryptoAlgorithmAES_CFBGnuTLS.cpp: Added.
        (WebCore::CryptoAlgorithmAES_CFB::platformEncrypt):
        (WebCore::CryptoAlgorithmAES_CFB::platformDecrypt):
        Add dummy support of AES_CFB for GTK+.
        * crypto/mac/CryptoAlgorithmAES_CBCMac.cpp:
        (WebCore::transformAES_CBC):
        Drop conditional PLATFORM(COCOA).
        (WebCore::CryptoAlgorithmAES_CBC::platformEncrypt):
        (WebCore::CryptoAlgorithmAES_CBC::platformDecrypt):
        Rename CryptoAlgorithmAesCbcParams to CryptoAlgorithmAesCbcCfbParams.
        * crypto/mac/CryptoAlgorithmAES_CFBMac.cpp: Added.
        (WebCore::transformAES_CFB):
        (WebCore::CryptoAlgorithmAES_CFB::platformEncrypt):
        (WebCore::CryptoAlgorithmAES_CFB::platformDecrypt):
        * crypto/mac/CryptoAlgorithmRegistryMac.cpp:
        (WebCore::CryptoAlgorithmRegistry::platformRegisterAlgorithms):
        Add support for AES-CFB.
        * crypto/parameters/AesCbcCfbParams.idl: Renamed from Source/WebCore/crypto/parameters/AesCbcParams.idl.
        * crypto/parameters/CryptoAlgorithmAesCbcCfbParams.h: Renamed from Source/WebCore/crypto/parameters/CryptoAlgorithmAesCbcParams.h.
        Since dictionaries AesCbcParams and AesCfbParams are essentially the same, I combine them together in our implementations.

2017-02-21  Wenson Hsieh  <wenson_hsieh@apple.com>

        Unreviewed, fix the ToT iOS build

        Adopt updated UIKit SPI and remove calls to the deprecated version.

        * platform/ios/WebItemProviderPasteboard.mm:
        (-[WebItemProviderPasteboard setItems:]):

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-21  Jer Noble  <jer.noble@apple.com>

        Make logging in high-priority audio threads less expensive
        https://bugs.webkit.org/show_bug.cgi?id=168639

        Reviewed by Jon Lee.

        Logging from inside a high-priority audio thread will make a number of calls to malloc, block, and
        therefore cause audio glitches. Make this logging less expensive by dispatching to the main thread
        before creating and outputting the log string.

        * WebCore.xcodeproj/project.pbxproj:
        * platform/audio/mac/AudioSampleDataSource.mm: Renamed from Source/WebCore/platform/audio/mac/AudioSampleDataSource.cpp.
        (WebCore::AudioSampleDataSource::pushSamplesInternal):
        (WebCore::AudioSampleDataSource::pullSamplesInternal):

2017-02-21  Jer Noble  <jer.noble@apple.com>

        Give the Mock audio input a "hum" to make drop-outs more detectable
        https://bugs.webkit.org/show_bug.cgi?id=168641

        Reviewed by Eric Carlson.

        Add two helper functions to generate waveforms: addHum() and writeHum(). Use these methods
        to create a bip-bop audio buffer which can be used to "blit" a portion the waveform into the
        destination buffer during rendering. The background hum must be seamless across multiple
        pull operations, so add the hum sound during rendering.

        To ensure the waveform buffer is created, initialize the sampleRate to zero, then call
        applySampleRate() with the desired default rate, 44.1kHz.

        * platform/mediastream/mac/MockRealtimeAudioSourceMac.h:
        * platform/mediastream/mac/MockRealtimeAudioSourceMac.mm:
        (WebCore::writeHum):
        (WebCore::addHum):
        (WebCore::MockRealtimeAudioSource::create):
        (WebCore::MockRealtimeAudioSourceMac::render):
        (WebCore::MockRealtimeAudioSourceMac::applySampleRate):

2017-02-21  Jer Noble  <jer.noble@apple.com>

        Make TrackPrivateBase ThreadSafeRefCounted, so that it can be retained in non-main threads
        https://bugs.webkit.org/show_bug.cgi?id=168642

        Reviewed by Eric Carlson.

        AudioTrackPrivateMediaStreamCocoa has two entry points from background threads:
        audioSamplesAvailable() and render(). Protect against being destroyed mid-execution by
        retaining this for the duration of those methods.

        * platform/graphics/TrackPrivateBase.h:
        * platform/mediastream/mac/AudioTrackPrivateMediaStreamCocoa.cpp:
        (WebCore::AudioTrackPrivateMediaStreamCocoa::audioSamplesAvailable):
        (WebCore::AudioTrackPrivateMediaStreamCocoa::render):

2017-02-21  Jer Noble  <jer.noble@apple.com>

        Pulling too quickly from an AudioSampleDataSource should increase the pre-buffer amount
        https://bugs.webkit.org/show_bug.cgi?id=168645

        Reviewed by Eric Carlson.

        If a pull operation runs past the end of the buffered range of a CARingBuffer, the underrun
        is zero-filled, causing an audible glitch.  In this case, bias m_outputSampleOffset by the
        amount of the underrun, which should keep the underrun from reoccurring.

        * platform/audio/mac/AudioSampleDataSource.cpp:
        (WebCore::AudioSampleDataSource::pullSamplesInternal):

2017-02-21  Jer Noble  <jer.noble@apple.com>

        AudioSampleBufferList::zeroABL() takes a byte-count, not a sample-count.
        https://bugs.webkit.org/show_bug.cgi?id=168635

        Reviewed by Jon Lee.

        * platform/audio/mac/AudioSampleDataSource.cpp:
        (WebCore::AudioSampleDataSource::pullSamplesInternal):
        (WebCore::AudioSampleDataSource::pullAvalaibleSamplesAsChunks):

2017-02-21  Carlos Garcia Campos  <cgarcia@igalia.com>

        REGRESSION(r212681): Crash when dragging links without a drag image
        https://bugs.webkit.org/show_bug.cgi?id=168648

        Reviewed by Tim Horton.

        This happens in GTK+ port, because we don't use a drag image for links.

        Fixes: editing/pasteboard/drop-link.html
               editing/pasteboard/drop-text-without-selection.html
               editing/pasteboard/files-during-page-drags.html
               fast/events/content-changed-during-drop.html
               fast/events/drag-and-drop-link-fast-multiple-times-does-not-crash.html
               fast/events/drag-and-drop-link-into-focused-contenteditable.html
               fast/events/drag-and-drop-link.html
               fast/events/drag-in-frames.html
               fast/events/drag-parent-node.html
               fast/events/shift-drag-selection-on-link-triggers-drag-n-drop.html

        * page/DragController.cpp:
        (WebCore::DragController::startDrag): Do not try to use drag image and its size when createDragImageForLink
        returns nullptr.

2017-02-21  Alex Christensen  <achristensen@webkit.org>

        Unreviewed, rolling out r212699.

        Internal build not ready

        Reverted changeset:

        "[WebRTC][Mac] Activate libwebrtc"
        https://bugs.webkit.org/show_bug.cgi?id=167293
        http://trac.webkit.org/changeset/212699

2017-02-20  Carlos Garcia Campos  <cgarcia@igalia.com>

        Remove ENABLE_THREADED_COMPOSITOR build option
        https://bugs.webkit.org/show_bug.cgi?id=168606

        Reviewed by Michael Catanzaro.

        * platform/TextureMapper.cmake:

2017-02-20  Alex Christensen  <achristensen@webkit.org>

        Fix some 32-bit builds after r212699

        * platform/mediastream/mac/RealtimeIncomingVideoSource.cpp:
        (WebCore::RealtimeIncomingVideoSource::OnFrame):
        Explicitly cast OSStatus to int for logging.

2017-02-20  Joseph Pecoraro  <pecoraro@apple.com>

        Remove unnecessary PerformanceEntry virtual methods
        https://bugs.webkit.org/show_bug.cgi?id=168633

        Reviewed by Ryosuke Niwa.

        * page/PerformanceEntry.h:
        (WebCore::PerformanceEntry::isResource):
        (WebCore::PerformanceEntry::isMark):
        (WebCore::PerformanceEntry::isMeasure):
        Implement based on the Type.

        * page/PerformanceMark.h:
        * page/PerformanceMeasure.h:
        * page/PerformanceResourceTiming.h:
        Remove virtual overrides.

2017-02-20  Youenn Fablet  <youenn@apple.com>

        [WebRTC][Mac] Activate libwebrtc
        https://bugs.webkit.org/show_bug.cgi?id=167293

        Reviewed by Alex Christensen.

        * Configurations/WebCore.xcconfig:
        * Configurations/WebCoreTestSupport.xcconfig:

2017-02-20  Joseph Pecoraro  <pecoraro@apple.com>

        ASSERTION FAILED: m_normalWorld->hasOneRef() under WorkerThread::stop
        https://bugs.webkit.org/show_bug.cgi?id=168356
        <rdar://problem/30592486>

        Reviewed by Ryosuke Niwa.

        * page/DOMWindow.cpp:
        (WebCore::DOMWindow::removeAllEventListeners):
        Remove Performance object EventListeners.

        * workers/WorkerGlobalScope.cpp:
        (WebCore::WorkerGlobalScope::~WorkerGlobalScope):
        (WebCore::WorkerGlobalScope::removeAllEventListeners):
        (WebCore::WorkerGlobalScope::performance):
        * workers/WorkerGlobalScope.h:
        Remove Performance object EventListeners.
        Also clear Performance early in destruction since its ContextDestructionObserver
        destruction makes checks about the WorkerThread.

2017-02-20  Jer Noble  <jer.noble@apple.com>

        Local audio-only stream will not trigger playback to begin
        https://bugs.webkit.org/show_bug.cgi?id=168412

        Reviewed by Youenn Fablet.

        Test: fast/mediastream/local-audio-playing-event.html

        With video-bearing streams, the first video sample emitted from the stream causes the
        readyState to move from HAVE_NOTHING to HAVE_ENOUGH_DATA. Wire up this same behavior for
        audio-bearing streams. Add a MediaStreamTrackPrivate::Observer callback method
        audioSamplesAvailable(), which gets passed up to MediaPlayerPrivateMediaStreamAVFObjC.
        Because this callback may be (and probably will be) called on a background thread, run the
        updateReadyState() task in a scheduledDeferredTask().

        * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.h:
        * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm:
        (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::audioSamplesAvailable):
        (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::updateTracks):
        * platform/mediastream/MediaStreamTrackPrivate.cpp:
        (WebCore::MediaStreamTrackPrivate::audioSamplesAvailable):
        * platform/mediastream/MediaStreamTrackPrivate.h:
        (WebCore::MediaStreamTrackPrivate::Observer::audioSamplesAvailable):

2017-02-20  Zalan Bujtas  <zalan@apple.com>

        Simple line layout: Implement absoluteQuadsForRange.
        https://bugs.webkit.org/show_bug.cgi?id=168613
        <rdar://problem/30614618>

        Reviewed by Simon Fraser.

        This patch ensures that the commonly used Range::getClientRects calls do not
        throw us off of the simple line layout path.

        Test: fast/dom/Range/simple-line-layout-getclientrects.html

        * rendering/RenderText.cpp:
        (WebCore::RenderText::absoluteQuadsForRange):
        * rendering/SimpleLineLayoutFunctions.cpp:
        (WebCore::SimpleLineLayout::collectAbsoluteQuadsForRange): Special case empty ranges with multiple empty runs.
        * rendering/SimpleLineLayoutFunctions.h:
        * rendering/SimpleLineLayoutResolver.cpp:
        (WebCore::SimpleLineLayout::RunResolver::rangeForRendererWithOffsets):
        * rendering/SimpleLineLayoutResolver.h:

2017-02-20  Ryan Haddad  <ryanhaddad@apple.com>

        Unreviewed, rolling out r212685.

        This change broke the 32-bit Sierra build.

        Reverted changeset:

        "Resource Load Statistics: Add alternate classification
        method"
        https://bugs.webkit.org/show_bug.cgi?id=168347
        http://trac.webkit.org/changeset/212685

2017-02-20  Sam Weinig  <sam@webkit.org>

        [WebIDL] Add support for constructors that have variadic parameters
        https://bugs.webkit.org/show_bug.cgi?id=168614

        Reviewed by Alex Christensen.

        In preparation of removing some more custom bindings, move the constructor calling
        code over to using GenerateParametersCheck completely. This required
        - Removing special case of NamedConstructors automatically getting a Document passed
          to them. The three named constructors that expected this have been updated to add
          the required attributes.
        - Add a version of the GenerateCallWith prologue for constructors.
        - Remove now unnecessary argumentCount return value from GenerateParametersCheck.

        * bindings/scripts/CodeGeneratorJS.pm:
        (GenerateImplementation):
        (GenerateCallWithUsingReferences):
        (GenerateCallWithUsingPointers):
        (GenerateConstructorCallWithUsingPointers):
        (GenerateCallWith):
        (GenerateParametersCheck):
        (GenerateConstructorDefinition):

        * bindings/scripts/test/JS/JSTestInterface.cpp:
        * bindings/scripts/test/JS/JSTestNamedConstructor.cpp:
        * bindings/scripts/test/JS/JSTestObj.cpp:
        * bindings/scripts/test/JS/JSTestOverloadedConstructors.cpp:
        Update results for more consistent placement of ScriptExecutionContext and Document
        accessors, add UNLIKELY to context checks, and remove automatic Document passing
        for NamedConstructors.

        * html/HTMLAudioElement.idl:
        * html/HTMLImageElement.idl:
        * html/HTMLOptionElement.idl:
        Add ConstructorCallWith=Document.

2017-02-20  John Wilander  <wilander@apple.com>

        Resource Load Statistics: Add alternate classification method
        https://bugs.webkit.org/show_bug.cgi?id=168347
        <rdar://problem/30352793>

        Reviewed by Alex Christensen.

        This patch only adds test infrastructure in WebCore.

        Tests: http/tests/loading/resourceLoadStatistics/classify-as-non-prevalent-based-on-mixed-statistics.html
               http/tests/loading/resourceLoadStatistics/classify-as-non-prevalent-based-on-sub-frame-under-top-frame-origins.html
               http/tests/loading/resourceLoadStatistics/classify-as-non-prevalent-based-on-subresource-under-top-frame-origins.html
               http/tests/loading/resourceLoadStatistics/classify-as-non-prevalent-based-on-subresource-unique-redirects-to.html
               http/tests/loading/resourceLoadStatistics/classify-as-prevalent-based-on-mixed-statistics.html
               http/tests/loading/resourceLoadStatistics/classify-as-prevalent-based-on-sub-frame-under-top-frame-origins.html
               http/tests/loading/resourceLoadStatistics/classify-as-prevalent-based-on-subresource-under-top-frame-origins.html
               http/tests/loading/resourceLoadStatistics/classify-as-prevalent-based-on-subresource-unique-redirects-to.html

        * loader/ResourceLoadObserver.cpp:
        (WebCore::ResourceLoadObserver::setSubframeUnderTopFrameOrigin):
        (WebCore::ResourceLoadObserver::setSubresourceUnderTopFrameOrigin):
        (WebCore::ResourceLoadObserver::setSubresourceUniqueRedirectTo):
        * loader/ResourceLoadObserver.h:

2017-02-20  Anders Carlsson  <andersca@apple.com>

        Use the new drag code path when dragging links
        https://bugs.webkit.org/show_bug.cgi?id=168612

        Reviewed by Tim Horton.

        * editing/Editor.cpp:
        (WebCore::Editor::copyURL):
        Use userVisibleString instead of fillInUserVisibleForm.

        (WebCore::Editor::pasteboardWriterURL):
        New function that returns a PasteboardWriterData::URL for a given URL + title.

        * editing/Editor.h:
        Add new members.

        * editing/mac/EditorMac.mm:
        (WebCore::Editor::userVisibleString):
        (WebCore::Editor::fillInUserVisibleForm): Deleted.
        Add a getter instead of a function that fills in a struct member.

        * page/DragController.cpp:
        (WebCore::DragController::startDrag):
        Add the new DragItem code path when dragging links.

        * platform/PasteboardWriterData.cpp:
        (WebCore::PasteboardWriterData::isEmpty):
        Check for m_url as well.

        (WebCore::PasteboardWriterData::setURL):
        Set m_url.

        * platform/PasteboardWriterData.h:
        Add new members.

        * platform/mac/PasteboardWriter.mm:
        (WebCore::toUTI):
        New helper function that returns an UTI from a pasteboard type.

        (WebCore::createPasteboardWriter):
        Handle converting URLs to the various pasteboard types.

2017-02-20  Wenson Hsieh  <wenson_hsieh@apple.com>

        Add plumbing to the UI process for TextIndicatorData when computing the drag image
        https://bugs.webkit.org/show_bug.cgi?id=168583
        Work towards <rdar://problem/30313681>

        Reviewed by Tim Horton.

        Adds some additional arguments to drag image creation functions to allow platforms to specify TextIndicatorData
        for a link or selection-based DragImage. This TextIndicatorData is an optional member of the DragImage, and is
        propagated to the UI process via SetDragImage in the WebDragClient.

        Additionally renames hasDataInteractionAtPosition to hasSelectionAtPosition to better reflect its purpose.

        No new tests, since there is no behavior change.

        * page/DragController.cpp:
        (WebCore::DragController::startDrag):
        * page/Page.cpp:
        (WebCore::Page::hasSelectionAtPosition):
        (WebCore::Page::hasDataInteractionAtPosition): Deleted.
        * page/Page.h:
        * platform/DragImage.cpp:
        (WebCore::createDragImageForSelection):
        (WebCore::createDragImageForLink):
        (WebCore::DragImage::operator=):
        * platform/DragImage.h:
        * platform/gtk/DragImageGtk.cpp:
        (WebCore::createDragImageForLink):
        * platform/mac/DragImageMac.mm:
        (WebCore::createDragImageForLink):
        * platform/win/DragImageWin.cpp:
        (WebCore::createDragImageForLink):

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-17  Anders Carlsson  <andersca@apple.com>

        Add a new drag code path and use it for dragging plain text
        https://bugs.webkit.org/show_bug.cgi?id=168534

        Reviewed by Geoffrey Garen.

        The new code path is currently only used for plain text selection dragging.

        * WebCore.xcodeproj/project.pbxproj:
        * page/DragClient.h:
        (WebCore::DragClient::useLegacyDragClient):
        Add a new member function. This currently returns true everywhere except legacy WebKit on Mac.

        (WebCore::DragClient::beginDrag):
        Add new empty member function.

        * page/DragController.cpp:
        (WebCore::dragImageAnchorPointForSelectionDrag):
        Helper function that returns the anchor point for a selection drag image.

        (WebCore::DragController::startDrag):
        If we can use the new code path, set up a drag item with an image and pasteboard data.

        (WebCore::DragController::beginDrag):
        New function that calls out to the client.

        * page/DragController.h:
        Add new members.

        * platform/DragItem.h:
        Add a new class - it's essentially a tuple of a drag image, an anchor point and the pasteboard data the item represents.

        * platform/mac/PasteboardWriter.h:
        Rename createPasteboardWriting to createPasteboardWriter.

        * platform/mac/PasteboardWriter.mm:
        (WebCore::createPasteboardWriter):
        Use the UTI pasteboard type.

2017-02-20  Alex Christensen  <achristensen@webkit.org>

        Fix libwebrtc build after r212644.
        https://bugs.webkit.org/show_bug.cgi?id=168596

        * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp:
        (WebCore::LibWebRTCMediaEndpoint::StatsCollector::OnStatsDelivered):
        m_endpoint changed from a c++ reference to a WTF::Ref, so we need to use operator -> instead of .

2017-02-20  Romain Bellessort  <romain.bellessort@crf.canon.fr>

        [Readable Streams API] Add ReadableByteStreamController byobRequest attribute
        https://bugs.webkit.org/show_bug.cgi?id=168319

        Reviewed by Youenn Fablet.

        Added ReadableByteStreamController byobRequest attribute.

        Added tests related to ReadableStreamBYOBRequest as a dedicated object
        and also as an attribute of ReadableByteStreamController.

        * CMakeLists.txt: Added new files.
        * DerivedSources.cpp: Added new files.
        * DerivedSources.make: Added new files.
        * Modules/streams/ReadableByteStreamController.idl: Added byobRequest support.
        * Modules/streams/ReadableByteStreamController.js: Added byobRequest support.
        * Modules/streams/ReadableByteStreamInternals.js:
        (privateInitializeReadableStreamBYOBRequest): Added constructor.
        * Modules/streams/ReadableStreamBYOBRequest.idl: Added.
        * Modules/streams/ReadableStreamBYOBRequest.js: Added.
        (respond): Not implemented yet.
        (respondWithNewView): Not implemented yet.
        (view): Not implemented yet.
        * WebCore.xcodeproj/project.pbxproj: Added new files.
        * bindings/js/JSDOMGlobalObject.cpp: Added ReadableStreamBYOBRequest support.
        (WebCore::JSDOMGlobalObject::addBuiltinGlobals):
        (WebCore::JSDOMGlobalObject::finishCreation):
        (WebCore::JSDOMGlobalObject::visitChildren):
        * bindings/js/JSReadableStreamPrivateConstructors.cpp: Added ReadableStreamBYOBRequest support.
        (WebCore::constructJSReadableByteStreamController):
        (WebCore::constructJSReadableStreamBYOBRequest):
        (WebCore::JSBuiltinReadableStreamBYOBRequestPrivateConstructor::initializeExecutable):
        (WebCore::createReadableStreamBYOBRequestPrivateConstructor):
        * bindings/js/JSReadableStreamPrivateConstructors.h: Added ReadableStreamBYOBRequest support.
        * bindings/js/WebCoreBuiltinNames.h: Added ReadableStreamBYOBRequest support.

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  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  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  Youenn Fablet  <youenn@apple.com>

        [WebRTC] Fix some memory leaks in libwebrtc binding code
        https://bugs.webkit.org/show_bug.cgi?id=168596

        Reviewed by Eric Carlson.

        Covered by manual testing.

        * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp:
        (WebCore::LibWebRTCMediaEndpoint::StatsCollector::StatsCollector): Using the libwebrtc way of creating such objects.
        * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.h:
        (WebCore::LibWebRTCMediaEndpoint::StatsCollector::create):
        * platform/mediastream/libwebrtc/LibWebRTCProvider.cpp:
        (WebCore::PeerConnectionFactoryAndThreads::OnMessage):

2017-02-20  Alexey Proskuryakov  <ap@apple.com>

        Clean up how WebKit exports _WebCreateFragment
        https://bugs.webkit.org/show_bug.cgi?id=168579

        Reviewed by Dan Bernstein.

        * editing/Editor.h: Removed the declaration of _WebCreateFragment, SOFT_LINK doesn't need it.
        * editing/cocoa/EditorCocoa.mm: Moved a FIXME comment here.

2017-02-20  Ryan Haddad  <ryanhaddad@apple.com>

        Unreviewed, rolling out r212637.

        This change broke iOS builds.

        Reverted changeset:

        "Add 'webglcontextchanged' WebGLContextEvent"
        https://bugs.webkit.org/show_bug.cgi?id=168595
        http://trac.webkit.org/changeset/212637

2017-02-20  Carlos Garcia Campos  <cgarcia@igalia.com>

        Remove code under USE(GRAPHICS_SURFACE)
        https://bugs.webkit.org/show_bug.cgi?id=168592

        Reviewed by Michael Catanzaro.

        This was only used by EFL port.

        * platform/TextureMapper.cmake:
        * platform/graphics/opengl/GLPlatformSurface.cpp: Removed.
        * platform/graphics/surfaces/GLTransportSurface.cpp: Removed.
        * platform/graphics/surfaces/GLTransportSurface.h: Removed.
        * platform/graphics/surfaces/GraphicsSurface.cpp: Removed.
        * platform/graphics/surfaces/GraphicsSurface.h: Removed.
        * platform/graphics/surfaces/GraphicsSurfaceToken.h: Removed.
        * platform/graphics/surfaces/egl/EGLConfigSelector.cpp: Removed.
        * platform/graphics/surfaces/egl/EGLConfigSelector.h: Removed.
        * platform/graphics/surfaces/egl/EGLContext.cpp: Removed.
        * platform/graphics/surfaces/egl/EGLContext.h: Removed.
        * platform/graphics/surfaces/egl/EGLHelper.cpp: Removed.
        * platform/graphics/surfaces/egl/EGLHelper.h: Removed.
        * platform/graphics/surfaces/egl/EGLSurface.cpp: Removed.
        * platform/graphics/surfaces/egl/EGLSurface.h: Removed.
        * platform/graphics/surfaces/egl/EGLXSurface.cpp: Removed.
        * platform/graphics/surfaces/egl/EGLXSurface.h: Removed.
        * platform/graphics/surfaces/glx/GLXConfigSelector.h: Removed.
        * platform/graphics/surfaces/glx/GLXContext.cpp: Removed.
        * platform/graphics/surfaces/glx/GLXContext.h: Removed.
        * platform/graphics/surfaces/glx/GLXSurface.cpp: Removed.
        * platform/graphics/surfaces/glx/GLXSurface.h: Removed.
        * platform/graphics/surfaces/glx/X11Helper.cpp: Removed.
        * platform/graphics/surfaces/glx/X11Helper.h: Removed.
        * platform/graphics/texmap/TextureMapperBackingStore.cpp:
        * platform/graphics/texmap/TextureMapperBackingStore.h:
        * platform/graphics/texmap/TextureMapperPlatformLayer.h:
        (WebCore::TextureMapperPlatformLayer::setClient):
        * platform/graphics/texmap/TextureMapperSurfaceBackingStore.cpp: Removed.
        * platform/graphics/texmap/TextureMapperSurfaceBackingStore.h: Removed.
        * platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp:
        (WebCore::CoordinatedGraphicsLayer::CoordinatedGraphicsLayer):
        (WebCore::CoordinatedGraphicsLayer::setContentsNeedsDisplay):
        (WebCore::CoordinatedGraphicsLayer::setContentsToPlatformLayer):
        (WebCore::CoordinatedGraphicsLayer::syncPlatformLayer):
        * platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.h:
        * platform/graphics/texmap/coordinated/CoordinatedGraphicsState.h:
        (WebCore::CoordinatedGraphicsLayerState::CoordinatedGraphicsLayerState):

2017-02-20  Dean Jackson  <dino@apple.com>

        Add 'webglcontextchanged' WebGLContextEvent
        https://bugs.webkit.org/show_bug.cgi?id=168595
        <rdar://problem/30604254>

        Reviewed by Antoine Quint.

        Add a new event that is dispatched when the GraphicsContext3D
        notices that the active GPU has changed.

        Test: fast/canvas/webgl/webglcontextchangedevent.html

        * dom/EventNames.h: Add 'webglcontextchanged'.
        * html/canvas/WebGLRenderingContextBase.cpp:
        (WebCore::WebGLRenderingContextBase::dispatchContextChangedEvent): Dispatch the new event.
        (WebCore::WebGLRenderingContextBase::simulateContextChanged): Tell the GraphicsContext3D to
        pretend there was a GPU switch. This is called from Internals for testing.
        * html/canvas/WebGLRenderingContextBase.h:
        * html/canvas/WebGLRenderingContextBase.idl: Export the interface so Internals can see it.

        * platform/graphics/GraphicsContext3D.cpp:
        (WebCore::GraphicsContext3D::simulateContextChanged): Tell the GraphicsContext3DManager
        that it should pretend a GPU change has happened, which causes it to notify all the
        active contexts.
        * platform/graphics/GraphicsContext3D.h:

        * platform/graphics/mac/GraphicsContext3DMac.mm:
        (WebCore::GraphicsContext3DManager::updateAllContexts): Tell the GraphicsContext3Ds
        to tell their WebGLRenderingContexts to dispatch an event.
        (WebCore::GraphicsContext3D::simulateContextChanged): Fake the display change.
        * platform/graphics/opengl/GraphicsContext3DOpenGLCommon.cpp:
        (WebCore::GraphicsContext3D::dispatchContextChangedNotification): Tell the WebGLRenderingContext
        that a change has occurred, and that it should dispatch an event. This is a layering
        violation which will need to be fixed (although with other communication from GC3D back
        to WebGL).
        * testing/Internals.cpp:
        (WebCore::Internals::simulateWebGLContextChanged):
        * testing/Internals.h:
        * testing/Internals.idl:

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  Manuel Rego Casasnovas  <rego@igalia.com>

        [css-grid] Remove compilation flag ENABLE_CSS_GRID_LAYOUT
        https://bugs.webkit.org/show_bug.cgi?id=167693

        Reviewed by Sergio Villar Senin.

        * Configurations/FeatureDefines.xcconfig:
        * css/CSSComputedStyleDeclaration.cpp:
        (WebCore::valueForGridPosition):
        (WebCore::isLayoutDependent):
        (WebCore::resolveJustifySelfAuto):
        (WebCore::isImplicitlyInheritedGridOrFlexProperty):
        (WebCore::valueForContentPositionAndDistributionWithOverflowAlignment):
        (WebCore::ComputedStyleExtractor::propertyValue):
        * css/CSSGridAutoRepeatValue.cpp:
        * css/CSSGridAutoRepeatValue.h:
        * css/CSSGridLineNamesValue.cpp:
        * css/CSSGridLineNamesValue.h:
        * css/CSSGridTemplateAreasValue.cpp:
        * css/CSSGridTemplateAreasValue.h:
        * css/CSSPrimitiveValueMappings.h:
        (WebCore::CSSPrimitiveValue::CSSPrimitiveValue):
        * css/CSSProperties.json:
        * css/CSSValue.cpp:
        (WebCore::CSSValue::equals):
        (WebCore::CSSValue::cssText):
        (WebCore::CSSValue::destroy):
        * css/CSSValue.h:
        (WebCore::CSSValue::isContentDistributionValue):
        (WebCore::CSSValue::isGridLineNamesValue):
        * css/CSSValueKeywords.in:
        * css/StyleBuilderConverter.h:
        (WebCore::StyleBuilderConverter::convertGridAutoFlow):
        (WebCore::StyleBuilderConverter::convertContentAlignmentData):
        * css/StyleBuilderCustom.h:
        (WebCore::StyleBuilderCustom::applyValueGridTemplateRows):
        * css/StyleProperties.cpp:
        (WebCore::StyleProperties::getPropertyValue):
        * css/StyleResolver.cpp:
        (WebCore::equivalentBlockDisplay):
        * css/StyleResolver.h:
        * css/parser/CSSParser.cpp:
        (WebCore::CSSParserContext::CSSParserContext):
        (WebCore::operator==):
        * css/parser/CSSParserFastPaths.cpp:
        (WebCore::isSimpleLengthPropertyID):
        (WebCore::CSSParserFastPaths::isValidKeywordPropertyAndValue):
        (WebCore::CSSParserFastPaths::isKeywordPropertyID):
        * css/parser/CSSParserMode.h:
        (WebCore::CSSParserContextHash::hash):
        * css/parser/CSSPropertyParser.cpp:
        (WebCore::consumeGridAutoFlow):
        (WebCore::consumeGridTemplateAreas):
        (WebCore::CSSPropertyParser::parseSingleValue):
        (WebCore::CSSPropertyParser::consumeGridShorthand):
        (WebCore::CSSPropertyParser::parseShorthand):
        * dom/Document.cpp:
        * dom/Document.h:
        * dom/Position.cpp:
        (WebCore::Position::isCandidate):
        * page/RuntimeEnabledFeatures.h:
        (WebCore::RuntimeEnabledFeatures::isCSSGridLayoutEnabled):
        * rendering/Grid.cpp:
        * rendering/Grid.h:
        * rendering/RenderBlock.cpp:
        (WebCore::RenderBlock::getFirstLetter):
        * rendering/RenderBox.cpp:
        (WebCore::RenderBox::~RenderBox):
        (WebCore::RenderBox::styleDidChange):
        (WebCore::RenderBox::clearExtraInlineAndBlockOffests):
        (WebCore::RenderBox::containingBlockLogicalWidthForContent):
        (WebCore::RenderBox::containingBlockLogicalHeightForContent):
        (WebCore::RenderBox::perpendicularContainingBlockLogicalHeight):
        (WebCore::RenderBox::computeLogicalWidthInRegion):
        (WebCore::RenderBox::sizesLogicalWidthToFitContent):
        (WebCore::RenderBox::computeLogicalHeight):
        (WebCore::RenderBox::computePercentageLogicalHeight):
        (WebCore::RenderBox::containingBlockLogicalWidthForPositioned):
        (WebCore::RenderBox::containingBlockLogicalHeightForPositioned):
        (WebCore::RenderBox::computePositionedLogicalWidth):
        (WebCore::RenderBox::computePositionedLogicalHeight):
        (WebCore::RenderBox::createsNewFormattingContext):
        (WebCore::logicalWidthIsResolvable):
        (WebCore::RenderBox::percentageLogicalHeightIsResolvableFromBlock):
        (WebCore::RenderBox::hasDefiniteLogicalHeight):
        * rendering/RenderBox.h:
        (WebCore::RenderBox::isGridItem):
        * rendering/RenderElement.cpp:
        (WebCore::RenderElement::createFor):
        * rendering/RenderFlexibleBox.cpp:
        (WebCore::RenderFlexibleBox::alignChildren):
        * rendering/RenderGrid.cpp:
        * rendering/RenderGrid.h:
        * rendering/RenderObject.h:
        (WebCore::RenderObject::isRenderGrid):
        * rendering/style/GridArea.h:
        * rendering/style/GridLength.h:
        * rendering/style/GridPosition.h:
        * rendering/style/GridPositionsResolver.cpp:
        * rendering/style/GridPositionsResolver.h:
        * rendering/style/GridTrackSize.h:
        * rendering/style/RenderStyle.cpp:
        (WebCore::RenderStyle::isCSSGridLayoutEnabled):
        (WebCore::RenderStyle::changeRequiresLayout):
        * rendering/style/RenderStyle.h:
        (WebCore::RenderStyle::gridItemRowEnd):
        (WebCore::RenderStyle::setGridRowGap):
        (WebCore::RenderStyle::initialGridItemRowEnd):
        (WebCore::RenderStyle::isDisplayReplacedType):
        (WebCore::RenderStyle::isDisplayGridBox):
        * rendering/style/RenderStyleConstants.h:
        * rendering/style/StyleGridData.cpp:
        * rendering/style/StyleGridData.h:
        * rendering/style/StyleGridItemData.cpp:
        * rendering/style/StyleGridItemData.h:
        * rendering/style/StyleRareNonInheritedData.cpp:
        (WebCore::StyleRareNonInheritedData::StyleRareNonInheritedData):
        (WebCore::StyleRareNonInheritedData::operator==):
        * rendering/style/StyleRareNonInheritedData.h:
        * testing/InternalSettings.cpp:
        (WebCore::InternalSettings::Backup::Backup):
        (WebCore::InternalSettings::Backup::restoreTo):
        (WebCore::InternalSettings::setCSSGridLayoutEnabled):

2017-02-20  Carlos Garcia Campos  <cgarcia@igalia.com>

        REGRESSION(r212345): [GTK] ASSERT(cookieChangeCallbackMap().contains(jar)) failed in WebCore::stopObservingCookieChanges:54
        https://bugs.webkit.org/show_bug.cgi?id=168375

        Reviewed by Alex Christensen.

        Simplify the way cookie storage is handled in NetworkStorageSessionSoup. Now we always keep a reference to the
        cookie jar, no matter if we have a session or not, that is always kept in sync with the one actually used by the
        session. We always connect to the changed signal of the current cookie jar and notify the observer if it has been
        set.

        * platform/network/NetworkStorageSession.h:
        * platform/network/soup/CookieStorageSoup.cpp:
        (WebCore::startObservingCookieChanges): Remove this implementation and add an ASSERT to ensure we don't use this anymore.
        (WebCore::stopObservingCookieChanges): Ditto.
        (WebCore::cookieChangeCallbackMap): Deleted.
        (WebCore::soupCookiesChanged): Deleted.
        * platform/network/soup/NetworkStorageSessionSoup.cpp:
        (WebCore::NetworkStorageSession::NetworkStorageSession): Initialize the cookie storage.
        (WebCore::NetworkStorageSession::~NetworkStorageSession): Disconnect the changed signal.
        (WebCore::NetworkStorageSession::getOrCreateSoupNetworkSession): Always pass the current cookie storage.
        (WebCore::NetworkStorageSession::cookiesDidChange): Notify the observer.
        (WebCore::NetworkStorageSession::cookieStorage): Return the current cookie storage.
        (WebCore::NetworkStorageSession::setCookieStorage): Update the current cookie storage and update the session if
        needed too. We always have a valid cookie storage so if nullptr is given we create a new one.
        (WebCore::NetworkStorageSession::setCookieObserverHandler): Set a cookie observer handler.

2017-02-19  Chris Dumez  <cdumez@apple.com>

        onbeforeunload event return value coercion is not per-spec
        https://bugs.webkit.org/show_bug.cgi?id=168382

        Reviewed by Darin Adler.

        Update handling of value returned by onbeforeunload event listeners
        to match Firefox and the specification:
        - https://html.spec.whatwg.org/#the-event-handler-processing-algorithm (step 4)

        Namely, the following changes were made:
        - Only set the event's returnValue attribute to the returned value if the attribute
          value is the empty string (so as to not override the attribute value if it has
          explicitly been set by JS).
        - Cancel the event when the return value is not null by calling preventDefault().

        Additionally, the following changes were made:
        - Ask the user to confirm the navigation if the event was canceled, not just if the
          returnValue attribute was set to a non-empty string.
        as per:
        - https://html.spec.whatwg.org/#prompt-to-unload-a-document (step 8)

        Tests: fast/events/before-unload-return-string-conversion.html
               imported/w3c/web-platform-tests/html/browsers/browsing-the-web/unloading-documents/beforeunload-canceling.html

        * bindings/js/JSEventListener.cpp:
        (WebCore::handleBeforeUnloadEventReturnValue):
        (WebCore::JSEventListener::handleEvent):
        * loader/FrameLoader.cpp:
        (WebCore::shouldAskForNavigationConfirmation):
        (WebCore::FrameLoader::dispatchBeforeUnloadEvent):

2017-02-19  Carlos Garcia Campos  <cgarcia@igalia.com>

        [SOUP] Call SoupNetworkSession::setShouldIgnoreTLSErrors when testRunner.setAllowsAnySSLCertificate() is called
        https://bugs.webkit.org/show_bug.cgi?id=168571

        Reviewed by Michael Catanzaro.

        Fixes: http/tests/ssl/upgrade-origin-usage.html

        * testing/InternalSettings.cpp:
        (WebCore::InternalSettings::setAllowsAnySSLCertificate):

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-19  Chris Dumez  <cdumez@apple.com>

        <input type=color readonly> doesn't act per spec
        https://bugs.webkit.org/show_bug.cgi?id=168421
        <rdar://problem/30593185>

        Reviewed by Ryosuke Niwa.

        The 'readonly' attribute should not apply to <input type=color> as per the
        HTML specification:
        - https://html.spec.whatwg.org/#the-input-element:attr-input-readonly-3

        Chrome / Firefox and Edge already behave as per the specification.

        Tests: fast/forms/color/input-color-disabled.html
               fast/forms/color/input-color-readonly.html

        * html/ColorInputType.cpp:
        (WebCore::ColorInputType::handleDOMActivateEvent):
        (WebCore::ColorInputType::didChooseColor):

2017-02-19  Commit Queue  <commit-queue@webkit.org>

        Unreviewed, rolling out r212466.
        https://bugs.webkit.org/show_bug.cgi?id=168577

        causes crashes on AArch64 on linux, maybe it's causing crashes
        on iOS too (Requested by pizlo on #webkit).

        Reverted changeset:

        "The collector thread should only start when the mutator
        doesn't have heap access"
        https://bugs.webkit.org/show_bug.cgi?id=167737
        http://trac.webkit.org/changeset/212466

2017-02-19  Zalan Bujtas  <zalan@apple.com>

        Simple line layout: Implement positionForPoint.
        https://bugs.webkit.org/show_bug.cgi?id=168565
        <rdar://problem/30593370>

        Reviewed by Antti Koivisto.

        With this patch, now we don't need to switch over to line box tree anymore when positionForPoint()
        is called on a single RenderText content (which is the majority of the simple line content).
        This patch also adds a new positionForPoint method which returns a Position object instead of VisiblePosition.
        Some of the positionForPoint() callsites are only interested in the Position object so constructing a VisiblePosition
        (which could potentially kick off a layout) is a waste. At this point the non-simple line layout codepath still constructs
        a VisiblePosition and that should be addresses as part of webkit.org/b/168566.

        Covered by existing tests.

        * dom/Document.cpp:
        (WebCore::Document::caretRangeFromPoint):
        * rendering/RenderBlockFlow.cpp:
        (WebCore::RenderBlockFlow::positionForPoint):
        * rendering/RenderBlockFlow.h:
        * rendering/RenderObject.cpp:
        (WebCore::RenderObject::positionForPoint):
        * rendering/RenderObject.h:
        * rendering/RenderText.cpp:
        (WebCore::RenderText::positionForPoint):
        * rendering/RenderText.h:
        * rendering/SimpleLineLayoutFunctions.cpp:
        (WebCore::SimpleLineLayout::positionForPoint):
        * rendering/SimpleLineLayoutFunctions.h:
        * rendering/SimpleLineLayoutResolver.cpp:
        (WebCore::SimpleLineLayout::RunResolver::runForPoint):
        * rendering/SimpleLineLayoutResolver.h:
        (WebCore::SimpleLineLayout::RunResolver::Run::logicalLeft):
        (WebCore::SimpleLineLayout::RunResolver::Run::logicalRight):

2017-02-19  Antti Koivisto  <antti@apple.com>

        Execute pending scripts asynchronously after stylesheet loads complete
        https://bugs.webkit.org/show_bug.cgi?id=168367
        rdar://problem/30561379

        Reviewed by Andreas Kling.

        The current synchronous execution is fragile and creates various problems.

        * css/StyleSheetContents.cpp:
        (WebCore::StyleSheetContents::checkLoaded):
        * dom/ContainerNode.cpp:
        (WebCore::ContainerNode::takeAllChildrenFrom):
        (WebCore::ContainerNode::notifyChildInserted):
        (WebCore::ContainerNode::removeChild):
        (WebCore::ContainerNode::parserRemoveChild):
        (WebCore::ContainerNode::removeChildren):

            Remove various places where we would trigger delayed synchronous execution.

        * dom/Document.cpp:
        (WebCore::Document::Document):
        (WebCore::Document::recalcStyle):

            Trigger scroll to anchor at the end of style resolution instead of when style sheet load completes.

        (WebCore::Document::didRemoveAllPendingStylesheet):

            Call asynchronous script execution function.

        * dom/Document.h:
        (WebCore::Document::setNeedsNotifyRemoveAllPendingStylesheet): Deleted.
        (WebCore::Document::notifyRemovePendingSheetIfNeeded): Deleted.
        * dom/ScriptableDocumentParser.cpp:
        (WebCore::ScriptableDocumentParser::ScriptableDocumentParser):
        (WebCore::ScriptableDocumentParser::executeScriptsWaitingForStylesheetsSoon):
        (WebCore::ScriptableDocumentParser::scriptsWaitingForStylesheetsExecutionTimerFired):

            Add a timer for executing pending scripts.

        (WebCore::ScriptableDocumentParser::detach):
        * dom/ScriptableDocumentParser.h:
        (WebCore::ScriptableDocumentParser::executeScriptsWaitingForStylesheets):
        * html/HTMLLinkElement.cpp:
        (WebCore::HTMLLinkElement::removedFrom):
        (WebCore::HTMLLinkElement::removePendingSheet):
        * html/HTMLLinkElement.h:
        * html/parser/HTMLDocumentParser.cpp:
        (WebCore::HTMLDocumentParser::detach):
        * loader/DocumentLoader.cpp:
        (WebCore::DocumentLoader::isLoadingInAPISense):

            Stay in loading state if we have a pending script. This matches existing behavior.

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

2017-02-18  Chris Dumez  <cdumez@apple.com>

        <input type=range readonly> doesn't act per spec
        https://bugs.webkit.org/show_bug.cgi?id=168422
        <rdar://problem/30593189>

        Reviewed by Ryosuke Niwa.

        'readonly' attribute should not apply to <input type=range> as per the HTML
        specification:
        - https://html.spec.whatwg.org/#the-input-element:attr-input-readonly-3

        Firefox and Edge already behave as per the specification.

        No new tests, updated existing tests.

        * html/RangeInputType.cpp:
        (WebCore::RangeInputType::handleMouseDownEvent):
        (WebCore::RangeInputType::handleTouchEvent):
        (WebCore::RangeInputType::handleKeydownEvent):
        * html/shadow/SliderThumbElement.cpp:
        (WebCore::SliderThumbElement::defaultEventHandler):
        (WebCore::SliderThumbElement::willRespondToMouseMoveEvents):
        (WebCore::SliderThumbElement::willRespondToMouseClickEvents):

2017-02-18  Chris Dumez  <cdumez@apple.com>

        Recursive MessagePort.postMessage() calls causes tab to become unresponsive
        https://bugs.webkit.org/show_bug.cgi?id=168548
        <rdar://problem/29808005>

        Reviewed by Darin Adler.

        MessagePort::dispatchMessages() was getting messages one by one of the
        channel's MessageQueue and firing the MessageEvent for each of them.
        The issue is that we can get stuck in an infinite loop if the
        MessageEvent handler posts a message on the same post.

        To address the issue, we now takes all messages from the queue before
        iterating over them to fire the event. This way, if new messages are
        added to the queue in one of the MessageEvent handlers, they will not
        be processed until the next event loop iteration, as is expected.

        Test: fast/events/message-port-postMessage-recursive.html

        * dom/MessagePort.cpp:
        (WebCore::MessagePort::dispatchMessages):
        * dom/MessagePortChannel.h:
        (WebCore::MessagePortChannel::EventData::EventData):
        * dom/default/PlatformMessagePortChannel.cpp:
        (WebCore::MessagePortChannel::postMessageToRemote):
        * dom/default/PlatformMessagePortChannel.h:
        (WebCore::PlatformMessagePortChannel::MessagePortQueue::takeMessage):
        (WebCore::PlatformMessagePortChannel::MessagePortQueue::takeAllMessages):
        (WebCore::PlatformMessagePortChannel::MessagePortQueue::appendAndCheckEmpty):

2017-02-18  Michael Catanzaro  <mcatanzaro@igalia.com>

        Remove COORDINATED_GRAPHICS_MULTIPROCESS
        https://bugs.webkit.org/show_bug.cgi?id=168514

        Reviewed by Darin Adler.

        * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
        * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.h:

2017-02-17  Simon Fraser  <simon.fraser@apple.com>

        Allow properties in CSSProperties.json that don't trigger code generation
        https://bugs.webkit.org/show_bug.cgi?id=168535

        Reviewed by Sam Weinig.
        
        In order to track the development of CSS properties that we have not yet implemented,
        support '"skip-codegen" : true' in "codegen-properties".

        Test by adding a few fill-related properties with this attribute.

        * css/CSSProperties.json:
        * css/makeprop.pl:
        (isPropertyEnabled):
        (addProperty):

2017-02-17  Brian Burg  <bburg@apple.com>

        Web Inspector: RTL: Inspector window should dock to the left when using RTL layout direction
        https://bugs.webkit.org/show_bug.cgi?id=168273
        <rdar://problem/29949325>

        Reviewed by Matt Baker.

        Add the ability to dock Web Inspector to the left of the inspected view.
        The frontend decides whether the Dock to Side button docks left or right
        based on the current layout direction.

        * inspector/InspectorFrontendClient.h:
        * inspector/InspectorFrontendClientLocal.cpp:
        (WebCore::InspectorFrontendClientLocal::setAttachedWindow):
        * inspector/InspectorFrontendHost.cpp:
        (WebCore::InspectorFrontendHost::requestSetDockSide):

2017-02-16  Simon Fraser  <simon.fraser@apple.com>

        Allow PlatformCALayers to specify that they want deep color backing store
        https://bugs.webkit.org/show_bug.cgi?id=168495

        Reviewed by Tim Horton.
        
        Currently capable iOS devices get deep color backing store by virtue of a supports
        check in PlatformCALayerCocoa::PlatformCALayerCocoa(), and LegacyTileGridTile.

        Future work will make layer contents format selection more complex, so express the need
        for deep color on PlatformCALayer, and have the creators of PlatformCALayer (mainly the
        flavors of GraphicsLayerCA) choose for them to support deep color. A bit of special-casing
        is needed to propagte the state to TileControllers.
        
        The deep-colorness now propagates from PlatformCALayerRemote to RemoteLayerBackingStore,
        instead of RemoteLayerBackingStore looking at the properties of the screen directly.

        Remove PlatformCALayer::LayerTypeWebTiledLayer which was only used for the old CATiledLayers
        that we no longer use.

        An iphone7 test verifies that page tiles, normal layers and tiled layers get the deep
        color state set on them.

        Test: tiled-drawing/ios/iphone7/compositing-layers-deep-color.html

        * platform/graphics/ca/GraphicsLayerCA.cpp:
        (WebCore::GraphicsLayerCA::createPlatformCALayer):
        (WebCore::GraphicsLayerCA::dumpAdditionalProperties):
        * platform/graphics/ca/GraphicsLayerCA.h:
        * platform/graphics/ca/PlatformCALayer.cpp:
        (WebCore::PlatformCALayer::canHaveBackingStore):
        (WebCore::operator<<):
        * platform/graphics/ca/PlatformCALayer.h:
        * platform/graphics/ca/TileController.cpp:
        (WebCore::TileController::setZoomedOutContentsScale):
        (WebCore::TileController::setAcceleratesDrawing):
        (WebCore::TileController::setWantsDeepColorBackingStore):
        (WebCore::TileController::createTileLayer):
        * platform/graphics/ca/TileController.h:
        * platform/graphics/ca/TileGrid.cpp:
        (WebCore::TileGrid::updateTileLayerProperties):
        * platform/graphics/ca/cocoa/PlatformCALayerCocoa.h:
        * platform/graphics/ca/cocoa/PlatformCALayerCocoa.mm:
        (PlatformCALayerCocoa::PlatformCALayerCocoa):
        (PlatformCALayerCocoa::commonInit):
        (PlatformCALayerCocoa::wantsDeepColorBackingStore):
        (PlatformCALayerCocoa::setWantsDeepColorBackingStore):
        (layerContentsFormat):
        (PlatformCALayerCocoa::updateContentsFormat):
        * platform/graphics/ca/cocoa/WebTiledBackingLayer.h:
        * platform/graphics/ca/cocoa/WebTiledBackingLayer.mm:
        (-[WebTiledBackingLayer setWantsDeepColorBackingStore:]):
        (-[WebTiledBackingLayer wantsDeepColorBackingStore]):
        * platform/graphics/ca/win/PlatformCALayerWin.cpp:
        (PlatformCALayerWin::wantsDeepColorBackingStore):
        (PlatformCALayerWin::setWantsDeepColorBackingStore):
        (printLayer):
        * platform/graphics/ca/win/PlatformCALayerWin.h:
        * platform/spi/cocoa/QuartzCoreSPI.h:

2017-02-17  Jer Noble  <jer.noble@apple.com>

        Refactoring: Make sure to unprepare WebAudioSourceProviderAVFObjC when its owner is destroyed.
        https://bugs.webkit.org/show_bug.cgi?id=168532

        Reviewed by Youenn Fablet.

        Because WebAudioSourceProviderAVFObjC has a back-pointer to the object which creted it, make
        sure that back-pointer is invalidated once the creating object is destroyed by calling
        WebAudioSOurceProviderAVFObjC::unprepare().

        Drive-by Fix: In WebAudioSourceProviderAVFObjC::audioSamplesAvailable(), PlatformAudioData will
        always be of the WebAudioBufferList type. If this ever becomes untrue, an invalid downcast will
        be caught by downcast<>, so just remove the is<> check.

        * platform/mediastream/mac/AVAudioCaptureSource.mm:
        (WebCore::AVAudioCaptureSource::~AVAudioCaptureSource):
        * platform/mediastream/mac/MockRealtimeAudioSourceMac.h:
        * platform/mediastream/mac/MockRealtimeAudioSourceMac.mm:
        (WebCore::MockRealtimeAudioSourceMac::~MockRealtimeAudioSourceMac):
        * platform/mediastream/mac/RealtimeIncomingAudioSource.cpp:
        (WebCore::RealtimeIncomingAudioSource::~RealtimeIncomingAudioSource):
        * platform/mediastream/mac/RealtimeIncomingAudioSource.h:
        * platform/mediastream/mac/WebAudioSourceProviderAVFObjC.mm:
        (WebCore::WebAudioSourceProviderAVFObjC::~WebAudioSourceProviderAVFObjC):
        (WebCore::WebAudioSourceProviderAVFObjC::setClient):
        (WebCore::WebAudioSourceProviderAVFObjC::unprepare):
        (WebCore::WebAudioSourceProviderAVFObjC::audioSamplesAvailable):

2017-02-17  Antoine Quint  <graouts@apple.com>

        [Modern Media Controls] Improve handling of <video> with only audio tracks
        https://bugs.webkit.org/show_bug.cgi?id=167836
        <rdar://problem/30255812>

        Reviewed by Dean Jackson.

        We now check for the availability of video tracks before considering a <video>
        element is displaying an actual video file and turning auto-hide on. We also
        check that we have video tracks before enabling the fullscreen button. This
        brings the behavior of a <video> pointing to a resource with no video tracks
        to be the same as an <audio> element.

        Test: media/modern-media-controls/media-controller/media-controller-video-with-only-audio.html

        * Modules/modern-media-controls/media/controls-visibility-support.js:
        (ControlsVisibilitySupport.prototype.get tracksToMonitor):
        (ControlsVisibilitySupport.prototype._updateControls):
        (ControlsVisibilitySupport):
        * Modules/modern-media-controls/media/fullscreen-support.js:
        (FullscreenSupport.prototype.syncControl):
        (FullscreenSupport):

2017-02-17  Antoine Quint  <graouts@apple.com>

        [Modern Media Controls] Toggle playback when clicking on the video on macOS
        https://bugs.webkit.org/show_bug.cgi?id=168515
        <rdar://problem/30577441>

        Reviewed by Dean Jackson.

        Listen to click events on the macOS media controls. Detect any clicks that were on the
        background instead of the controls widgets themselves, and tell the delegate (MediaController)
        about them.

        Tests: media/modern-media-controls/media-controller/media-controller-click-on-video-background-should-pause.html
               media/modern-media-controls/media-controller/media-controller-click-on-video-background-to-dismiss-tracks-panel-should-not-toggle-playback.html
               media/modern-media-controls/media-controller/media-controller-click-on-video-controls-should-not-pause.html

        * Modules/modern-media-controls/controls/macos-fullscreen-media-controls.js:
        (MacOSFullscreenMediaControls.prototype._handleMousedown):
        * Modules/modern-media-controls/controls/macos-inline-media-controls.js:
        (MacOSInlineMediaControls.prototype.handleEvent):
        * Modules/modern-media-controls/controls/macos-media-controls.js:
        (MacOSMediaControls.prototype.handleEvent):
        (MacOSMediaControls):
        * Modules/modern-media-controls/media/media-controller.js:
        (MediaController.prototype.togglePlayback):
        (MediaController.prototype.macOSControlsBackgroundWasClicked):
        (MediaController.prototype._updateControlsIfNeeded):
        * Modules/modern-media-controls/media/playback-support.js:
        (PlaybackSupport.prototype.buttonWasPressed):

2017-02-17  Jer Noble  <jer.noble@apple.com>

        Refactoring: Remove AudioSourceObserverObjC and AudioCaptureSourceProviderObjC
        https://bugs.webkit.org/show_bug.cgi?id=168520

        Reviewed by Youenn Fablet.

        Having AudioCaptureSourceProviderObjC as the type provided to WebAudioSourceProviderAVFObjC
        (and only ever to WebAudioSourceProviderAVFObjC) makes it impossible for that class to add
        an observer on RealtimeMediaSource, of which all classes inheriting from
        WebAudioSourceProviderAVFObjC are subclasses. There is no need to treat
        WebAudioSourceProviderAVFObjC as an "observer", since the only thing it will ever observe is
        the object which created it and hold an explicit reference to it. So replace all instances
        of the "observer" pattern with direct calls to the necessary (newly non-virtual) methods.
        This allows WebAudioSourceProviderAVFObjC to register as an observer directly on
        RealtimeMediaSource, to listen for audioSamplesAvailable() instead of process(), and remove
        a lot of unnecessary conversion code and observer duplication.

        * WebCore.xcodeproj/project.pbxproj:
        * platform/mediastream/RealtimeMediaSource.h:
        (WebCore::RealtimeMediaSource::Observer::sourceStopped):
        (WebCore::RealtimeMediaSource::Observer::sourceMutedChanged):
        (WebCore::RealtimeMediaSource::Observer::sourceEnabledChanged):
        (WebCore::RealtimeMediaSource::Observer::sourceSettingsChanged):
        (WebCore::RealtimeMediaSource::Observer::preventSourceFromStopping):
        * platform/mediastream/mac/AVAudioCaptureSource.h:
        * platform/mediastream/mac/AVAudioCaptureSource.mm:
        (WebCore::AVAudioCaptureSource::shutdownCaptureSession):
        (WebCore::AVAudioCaptureSource::captureOutputDidOutputSampleBufferFromConnection):
        (WebCore::AVAudioCaptureSource::addObserver): Deleted.
        (WebCore::AVAudioCaptureSource::removeObserver): Deleted.
        (WebCore::AVAudioCaptureSource::start): Deleted.
        * platform/mediastream/mac/AudioCaptureSourceProviderObjC.h: Removed.
        * platform/mediastream/mac/AudioSourceObserverObjC.h: Removed.
        * platform/mediastream/mac/AudioTrackPrivateMediaStreamCocoa.h:
        * platform/mediastream/mac/MockRealtimeAudioSourceMac.h:
        * platform/mediastream/mac/MockRealtimeAudioSourceMac.mm:
        (WebCore::MockRealtimeAudioSourceMac::emitSampleBuffers):
        (WebCore::MockRealtimeAudioSourceMac::reconfigure):
        (WebCore::MockRealtimeAudioSourceMac::audioSourceProvider):
        (WebCore::MockRealtimeAudioSourceMac::addObserver): Deleted.
        (WebCore::MockRealtimeAudioSourceMac::removeObserver): Deleted.
        (WebCore::MockRealtimeAudioSourceMac::start): Deleted.
        * platform/mediastream/mac/RealtimeIncomingAudioSource.cpp:
        (WebCore::RealtimeIncomingAudioSource::audioSourceProvider):
        (WebCore::RealtimeIncomingAudioSource::addObserver): Deleted.
        (WebCore::RealtimeIncomingAudioSource::removeObserver): Deleted.
        (WebCore::RealtimeIncomingAudioSource::start): Deleted.
        * platform/mediastream/mac/RealtimeIncomingAudioSource.h:
        * platform/mediastream/mac/RealtimeOutgoingAudioSource.h:
        * platform/mediastream/mac/RealtimeOutgoingVideoSource.h:
        * platform/mediastream/mac/WebAudioSourceProviderAVFObjC.h:
        * platform/mediastream/mac/WebAudioSourceProviderAVFObjC.mm:
        (WebCore::WebAudioSourceProviderAVFObjC::create):
        (WebCore::WebAudioSourceProviderAVFObjC::WebAudioSourceProviderAVFObjC):
        (WebCore::WebAudioSourceProviderAVFObjC::setClient):
        (WebCore::WebAudioSourceProviderAVFObjC::audioSamplesAvailable):
        (WebCore::WebAudioSourceProviderAVFObjC::process): Deleted.

2017-02-17  Antoine Quint  <graouts@apple.com>

        REGRESSION: Subtitles menu in media controls allows multiple items to be selected
        https://bugs.webkit.org/show_bug.cgi?id=168168
        <rdar://problem/30488605>

        Reviewed by Dean Jackson.

        Ensure that only a single audio track and a single text track can be selected
        in the tracks panel at any given point.

        * Modules/modern-media-controls/media/tracks-support.js:
        (TracksSupport.prototype.tracksPanelSelectionDidChange):
        (TracksSupport.prototype._sortedTrackList):
        (TracksSupport):

2017-02-17  Jeremy Jones  <jeremyj@apple.com>

        Invalidate WebAVSampleBufferStatusChangeListener when MediaPlayerPrivateMediaStreamAVFObjC is deallocated.
        https://bugs.webkit.org/show_bug.cgi?id=168488

        Reviewed by Jer Noble.

        Fixes periodically crashing test: fast/mediastream/MediaStream-video-element-track-stop.html

        WebAVSampleBufferStatusChangeListener has an unretained referecne to MediaPlayerPrivateMediaStreamAVFObjC
        that must be invaldated when MediaPlayerPrivateMediaStreamAVFObjC is deallocated.

        * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm:
        (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::~MediaPlayerPrivateMediaStreamAVFObjC):

2017-02-17  Antoine Quint  <graouts@apple.com>

        [Modern Media Controls] Improve handling of live broadcast video
        https://bugs.webkit.org/show_bug.cgi?id=168506
        <rdar://problem/30432094>

        Reviewed by Dean Jackson.

        We improve the handling of live broadcast video by:
        
            - checking that we have a media source before deciding to show the controls
              bar and start button
            - support a mode where neither the status text nor the scrubber is visible
              in case we're still waiting on sufficient data to determine the video
              time and we haven't really started loading data yet
            - not showing time labels when we have an infinite duration
            - ensuring the status label is left-aligned

        Test: media/modern-media-controls/status-label/status-label-text-align.html

        * Modules/modern-media-controls/controls/macos-inline-media-controls.js:
        (MacOSInlineMediaControls.prototype.layout):
        * Modules/modern-media-controls/controls/status-label.css:
        (.status-label):
        * Modules/modern-media-controls/controls/status-label.js:
        (StatusLabel.prototype.get enabled):
        (StatusLabel.prototype.set enabled):
        * Modules/modern-media-controls/media/controls-visibility-support.js:
        (ControlsVisibilitySupport.prototype._updateControls):
        (ControlsVisibilitySupport):
        * Modules/modern-media-controls/media/status-support.js:
        (StatusSupport.prototype.syncControl):
        (StatusSupport):
        * Modules/modern-media-controls/media/time-labels-support.js:
        (TimeLabelsSupport.prototype.syncControl):
        (TimeLabelsSupport):

2017-02-17  Anders Carlsson  <andersca@apple.com>

        Begin overhauling the pasteboard implementation
        https://bugs.webkit.org/show_bug.cgi?id=168525

        Reviewed by Tim Horton.

        Add a new PasteboardWriterData object. This object will hold data that is going
        to be written to the pasteboard at some point. Currently it only supports plain text.

        Also add a Mac-only PasteboardWriter class which can convert a PasteboardWriterDataObject
        into an object that conforms to NSPasteboardWriting.

        The basic idea is that instead of doing a bunch of pasteboard operations,
        we'll just package all the pasteboard data up into an object and ship it over to WebKit.

        This code is currently unused but will be adopted by a new drag implementation (in an upcoming patch).

        * WebCore.xcodeproj/project.pbxproj:
        * platform/PasteboardWriterData.cpp: Added.
        (WebCore::PasteboardWriterData::PasteboardWriterData):
        (WebCore::PasteboardWriterData::~PasteboardWriterData):
        (WebCore::PasteboardWriterData::isEmpty):
        (WebCore::PasteboardWriterData::setPlainText):
        * platform/PasteboardWriterData.h: Added.
        * platform/mac/PasteboardWriter.h: Added.
        * platform/mac/PasteboardWriter.mm: Added.
        (WebCore::createPasteboardWriting):
        * platform/spi/mac/NSPasteboardSPI.h: Added.

2017-02-17  Per Arne Vollan  <pvollan@apple.com>

        Apply SVG styles paint-order, stroke-linejoin, and stroke-linecap on DOM text.
        https://bugs.webkit.org/show_bug.cgi?id=168044
        rdar://problem/30165746

        Reviewed by Simon Fraser.

        This patch moves these styles out of svg, and sets the properties on video cues.

        Tests: fast/css/parsing-paint-order.html
               fast/css/parsing-stroke-linecap.html
               fast/css/parsing-stroke-linejoin.html
               fast/css/parsing-stroke-width.html

        * css/CSSComputedStyleDeclaration.cpp:
        (WebCore::paintOrder):
        (WebCore::ComputedStyleExtractor::propertyValue):
        * css/CSSProperties.json:
        * css/SVGCSSComputedStyleDeclaration.cpp:
        (WebCore::ComputedStyleExtractor::svgPropertyValue):
        (WebCore::paintOrder): Deleted.
        * css/StyleResolver.cpp:
        (WebCore::StyleResolver::isValidCueStyleProperty):
        * page/CaptionUserPreferencesMediaAF.cpp:
        (WebCore::CaptionUserPreferencesMediaAF::cssPropertyWithTextEdgeColor):
        * rendering/style/RenderStyle.cpp:
        (WebCore::RenderStyle::diff):
        (WebCore::RenderStyle::paintTypesForPaintOrder):
        * rendering/style/RenderStyle.h:
        (WebCore::RenderStyle::setPaintOrder):
        (WebCore::RenderStyle::paintOrder):
        (WebCore::RenderStyle::initialPaintOrder):
        (WebCore::RenderStyle::setCapStyle):
        (WebCore::RenderStyle::capStyle):
        (WebCore::RenderStyle::initialCapStyle):
        (WebCore::RenderStyle::setJoinStyle):
        (WebCore::RenderStyle::joinStyle):
        (WebCore::RenderStyle::initialJoinStyle):
        (WebCore::RenderStyle::strokeWidth):
        (WebCore::RenderStyle::setStrokeWidth):
        (WebCore::RenderStyle::hasVisibleStroke):
        (WebCore::RenderStyle::setStrokeOpacity):
        * rendering/style/SVGRenderStyle.cpp:
        (WebCore::SVGRenderStyle::diff):
        (WebCore::SVGRenderStyle::paintTypesForPaintOrder): Deleted.
        * rendering/style/SVGRenderStyle.h:
        (WebCore::SVGRenderStyle::initialBufferedRendering):
        (WebCore::SVGRenderStyle::initialFillRule):
        (WebCore::SVGRenderStyle::initialMaskType):
        (WebCore::SVGRenderStyle::setBufferedRendering):
        (WebCore::SVGRenderStyle::setFillRule):
        (WebCore::SVGRenderStyle::setMaskType):
        (WebCore::SVGRenderStyle::bufferedRendering):
        (WebCore::SVGRenderStyle::fillRule):
        (WebCore::SVGRenderStyle::strokeMiterLimit):
        (WebCore::SVGRenderStyle::maskType):
        (WebCore::SVGRenderStyle::hasStroke):
        (WebCore::SVGRenderStyle::setBitDefaults):
        (WebCore::SVGRenderStyle::InheritedFlags::operator==):
        (WebCore::SVGRenderStyle::initialCapStyle): Deleted.
        (WebCore::SVGRenderStyle::initialJoinStyle): Deleted.
        (WebCore::SVGRenderStyle::initialPaintOrder): Deleted.
        (WebCore::SVGRenderStyle::setCapStyle): Deleted.
        (WebCore::SVGRenderStyle::setJoinStyle): Deleted.
        (WebCore::SVGRenderStyle::setPaintOrder): Deleted.
        (WebCore::SVGRenderStyle::capStyle): Deleted.
        (WebCore::SVGRenderStyle::joinStyle): Deleted.
        (WebCore::SVGRenderStyle::strokeWidth): Deleted.
        (WebCore::SVGRenderStyle::paintOrder): Deleted.
        (WebCore::SVGRenderStyle::hasVisibleStroke): Deleted.
        (WebCore::SVGRenderStyle::setStrokeWidth): Deleted.
        * rendering/style/SVGRenderStyleDefs.cpp:
        (WebCore::StyleStrokeData::StyleStrokeData):
        (WebCore::StyleStrokeData::operator==):
        * rendering/style/SVGRenderStyleDefs.h:
        * rendering/style/StyleRareInheritedData.cpp:
        (WebCore::StyleRareInheritedData::StyleRareInheritedData):
        (WebCore::StyleRareInheritedData::operator==):
        * rendering/style/StyleRareInheritedData.h:
        * rendering/svg/RenderSVGEllipse.cpp:
        (WebCore::RenderSVGEllipse::strokeShape):
        * rendering/svg/RenderSVGPath.cpp:
        (WebCore::RenderSVGPath::strokeShape):
        (WebCore::RenderSVGPath::shapeDependentStrokeContains):
        (WebCore::RenderSVGPath::shouldStrokeZeroLengthSubpath):
        (WebCore::RenderSVGPath::zeroLengthLinecapPath):
        * rendering/svg/RenderSVGRect.cpp:
        (WebCore::RenderSVGRect::strokeShape):
        * rendering/svg/RenderSVGShape.cpp:
        (WebCore::RenderSVGShape::strokeShape):
        (WebCore::RenderSVGShape::fillStrokeMarkers):
        (WebCore::RenderSVGShape::strokeWidth):
        (WebCore::RenderSVGShape::hasSmoothStroke):
        * rendering/svg/RenderSVGText.cpp:
        (WebCore::RenderSVGText::strokeBoundingBox):
        * rendering/svg/SVGInlineTextBox.cpp:
        (WebCore::SVGInlineTextBox::paint):
        (WebCore::SVGInlineTextBox::paintDecoration):
        * rendering/svg/SVGRenderSupport.cpp:
        (WebCore::SVGRenderSupport::applyStrokeStyleToContext):
        * rendering/svg/SVGRenderTreeAsText.cpp:
        (WebCore::writeStyle):

2017-02-17  Carlos Garcia Campos  <cgarcia@igalia.com>

        [SOUP] Handle Settings::allowsAnySSLCertificate() in SSL sockets
        https://bugs.webkit.org/show_bug.cgi?id=168521

        Reviewed by Michael Catanzaro.

        When Settings::allowsAnySSLCertificate() is enabled, connect to accept-certificate signal of the GTlsConnection
        to always accept the certificates.

        Fixes: http/tests/websocket/tests/hybi/simple-wss.html

        * platform/network/soup/SocketStreamHandleImplSoup.cpp:
        (WebCore::wssConnectionAcceptCertificateCallback):
        (WebCore::wssSocketClientEventCallback):
        (WebCore::SocketStreamHandleImpl::create):

2017-02-17  Simon Fraser  <simon.fraser@apple.com>

        Fixed elements bounce when rubber-banding at the bottom of the page
        https://bugs.webkit.org/show_bug.cgi?id=168493
        rdar://problem/30567713

        Reviewed by Tim Horton.

        FrameView::visibleDocumentRect() was computing a bad visible rect when bottom-rubber-banding,
        by adding rubberBandBottom which is negative, rather than subtracting.

        Log some more scrolling stuff.

        Ironically, the existing test didn't test stick-to-viewport fixed position because
        backgroundShouldExtendBeyondPage() is off by default in WTR, so clone it to a test
        that sets this, to test both behaviors.

        This also revealed that dynamic changes to backgroundShouldExtendBeyondPage() need
        to be propagated to the scrolling tree, which is fixed in AsyncScrollingCoordinator::frameViewLayoutUpdated().

        Test: fast/visual-viewport/rubberbanding-viewport-rects-extended-background.html

        * page/FrameView.cpp:
        (WebCore::FrameView::updateLayoutViewport):
        (WebCore::FrameView::visibleDocumentRect):
        * page/scrolling/AsyncScrollingCoordinator.cpp:
        (WebCore::AsyncScrollingCoordinator::frameViewLayoutUpdated):
        * page/scrolling/ScrollingStateFrameScrollingNode.cpp:
        (WebCore::ScrollingStateFrameScrollingNode::dumpProperties):
        * page/scrolling/ScrollingTreeFrameScrollingNode.cpp:
        (WebCore::ScrollingTreeFrameScrollingNode::layoutViewportForScrollPosition):
        * page/scrolling/mac/ScrollingCoordinatorMac.mm:
        (WebCore::ScrollingCoordinatorMac::scheduleTreeStateCommit):
        (WebCore::ScrollingCoordinatorMac::commitTreeState):

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  Commit Queue  <commit-queue@webkit.org>

        Unreviewed, rolling out r212463.
        https://bugs.webkit.org/show_bug.cgi?id=168526

        Some crashes with GuardMalloc (Requested by anttik on
        #webkit).

        Reverted changeset:

        "Execute pending scripts asynchronously after stylesheet loads
        complete"
        https://bugs.webkit.org/show_bug.cgi?id=168367
        http://trac.webkit.org/changeset/212463

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  Enrique Ocaña González  <eocanha@igalia.com>

        [GStreamer] Fast replay on video hide/unhide on platforms with limited video buffer pools
        https://bugs.webkit.org/show_bug.cgi?id=168505

        Reviewed by Žan Doberšek.

        The WebKit code isn't consuming the video samples when the video layer is hidden,
        so the buffers aren't being returned to the pool and starve the decoder when the
        buffer pool runs out of buffers (on platforms using a buffer pool and a custom
        allocator, such as OMX on the Raspberry Pi 2). When the video layer is restored,
        the pipeline tries to catch up and the user sees the video "going fast forward".

        The added code "consumes" (removes and unrefs) the buffer in that case. However,
        the sample isn't completely removed because it still holds important info (eg:
        caps) needed for the proper operation of the video element.

        * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
        (WebCore::MediaPlayerPrivateGStreamerBase::pushTextureToCompositor):

2017-02-17  Carlos Garcia Campos  <cgarcia@igalia.com>

        [SOUP] Stop removing the fragment identifier from resource requests
        https://bugs.webkit.org/show_bug.cgi?id=168509

        Reviewed by Sergio Villar Senin.

        I don't know why, but have always removed the fragment identifier from the URL when creating the SoupURI that
        is passed to libsoup. Maybe it was a bug in a very old version of libsoup, but it doesn't look necessary anymore
        and it's causing several layout test failures.

        Fixes: http/tests/svg/svg-use-external.html
               imported/w3c/web-platform-tests/html/webappapis/scripting/processing-model-2/compile-error-same-origin-with-hash.html
               imported/w3c/web-platform-tests/html/webappapis/scripting/processing-model-2/runtime-error-same-origin-with-hash.html

        * platform/network/soup/ResourceRequestSoup.cpp:
        (WebCore::ResourceRequest::createSoupURI): Do not remove the fragment identifier from the URL.

2017-02-16  Yusuke Suzuki  <utatane.tea@gmail.com>

        [JSC] Drop PassRefPtr from ArrayBuffer
        https://bugs.webkit.org/show_bug.cgi?id=168455

        Reviewed by Geoffrey Garen.

        * bindings/js/SerializedScriptValue.cpp:
        (WebCore::CloneDeserializer::readArrayBufferView):
        * css/FontFace.cpp:
        (WebCore::FontFace::create):
        * platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.cpp:
        (WebCore::MediaPlayerPrivateAVFoundation::extractKeyURIKeyIDAndCertificateFromInitData):
        * platform/graphics/avfoundation/cf/MediaPlayerPrivateAVFoundationCF.cpp:
        (WebCore::AVFWrapper::shouldWaitForLoadingOfResource):
        * platform/graphics/avfoundation/objc/CDMSessionAVFoundationObjC.mm:
        (WebCore::CDMSessionAVFoundationObjC::generateKeyRequest):
        * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
        (WebCore::MediaPlayerPrivateAVFoundationObjC::shouldWaitForLoadingOfResource):

2017-02-16  Simon Fraser  <simon.fraser@apple.com>

        REGRESSION(r212439): Web Inspector Toolbar / Window appears broken
        https://bugs.webkit.org/show_bug.cgi?id=168494

        Reviewed by Joseph Pecoraro.

        Missed one conversion from acceleratesDrawing to drawsAsynchronously, which
        caused non-Whippet GrpahicsContext shadow drawing to happen unexpectedly.

        * platform/graphics/ca/cocoa/WebTiledBackingLayer.mm:
        (-[WebTiledBackingLayer drawsAsynchronously]):
        (-[WebTiledBackingLayer acceleratesDrawing]): Deleted.

2017-02-16  Chris Dumez  <cdumez@apple.com>

        <input>.labels is empty if type changes from text->hidden->checkbox
        https://bugs.webkit.org/show_bug.cgi?id=168358

        Reviewed by Ryosuke Niwa.

        We were invalidating LabelsNodeLists on 'for' attribute change.
        We now also invalidate them of 'type' attribute change since
        HTMLInputElements whose type is 'hidden' do not support labels.

        No new tests, updated existing test.

        * dom/Document.h:
        * dom/LiveNodeList.h:
        (WebCore::shouldInvalidateTypeOnAttributeChange):
        * html/LabelsNodeList.cpp:
        (WebCore::LabelsNodeList::LabelsNodeList):

2017-02-16  Michael Catanzaro  <mcatanzaro@igalia.com>

        Remove even more EFL from WebCore
        https://bugs.webkit.org/show_bug.cgi?id=168485

        Reviewed by Alex Christensen.

        * accessibility/atk/WebKitAccessibleWrapperAtk.cpp:
        (webkitAccessibleGetAttributes):
        (atkRole):
        * css/StyleRule.cpp:
        (WebCore::StyleRuleBase::copy):
        * platform/ContextMenuItem.h:
        * platform/graphics/OpenGLESShims.h:
        * platform/graphics/PlatformDisplay.cpp:
        (WebCore::PlatformDisplay::createPlatformDisplay):
        * platform/graphics/PlatformDisplay.h:
        * platform/graphics/cairo/ImageBufferCairo.cpp:
        * platform/graphics/freetype/SimpleFontDataFreeType.cpp:
        (WebCore::Font::platformInit):
        * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
        (WebCore::MediaPlayerPrivateGStreamer::MediaPlayerPrivateGStreamer):
        * platform/graphics/texmap/GraphicsLayerTextureMapper.cpp:
        (WebCore::GraphicsLayerTextureMapper::setContentsToImage):
        * platform/graphics/texmap/TextureMapperGC3DPlatformLayer.cpp:
        * platform/graphics/texmap/TextureMapperGC3DPlatformLayer.h:
        * platform/network/soup/ResourceErrorSoup.cpp:
        (WebCore::ResourceError::timeoutError):
        * platform/network/soup/SoupNetworkSession.cpp:
        (WebCore::SoupNetworkSession::setProxySettingsFromEnvironment): Deleted.
        * platform/network/soup/SoupNetworkSession.h:

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  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  Alex Christensen  <achristensen@webkit.org>

        Remove EFL-specific files in Source.

        Rubber-stamped by Anders Carlsson.

        * editing/efl: Removed.
        * page/efl: Removed.
        * platform/audio/efl: Removed.
        * platform/efl: Removed.
        * platform/efl/DefaultTheme: Removed.
        * platform/efl/DefaultTheme/widget: Removed.
        * platform/efl/DefaultTheme/widget/button: Removed.
        * platform/efl/DefaultTheme/widget/check: Removed.
        * platform/efl/DefaultTheme/widget/combo: Removed.
        * platform/efl/DefaultTheme/widget/entry: Removed.
        * platform/efl/DefaultTheme/widget/progressbar: Removed.
        * platform/efl/DefaultTheme/widget/radio: Removed.
        * platform/efl/DefaultTheme/widget/scrollbar: Removed.
        * platform/efl/DefaultTheme/widget/search: Removed.
        * platform/efl/DefaultTheme/widget/search/cancel: Removed.
        * platform/efl/DefaultTheme/widget/search/decoration: Removed.
        * platform/efl/DefaultTheme/widget/search/field: Removed.
        * platform/efl/DefaultTheme/widget/slider: Removed.
        * platform/efl/DefaultTheme/widget/spinner: Removed.
        * platform/gamepad/efl: Removed.
        * platform/graphics/efl: Removed.
        * platform/graphics/surfaces/efl: Removed.
        * platform/network/efl: Removed.

2017-02-16  Simon Fraser  <simon.fraser@apple.com>

        Add WebUSB to features.json as a "Not Considering".

        * features.json:

2017-02-16  Alex Christensen  <achristensen@webkit.org>

        Remove old URL parser
        https://bugs.webkit.org/show_bug.cgi?id=168483

        Reviewed by Tim Horton.

        * platform/URL.cpp:
        (WebCore::isSchemeFirstChar):
        (WebCore::isSchemeChar):
        (WebCore::URL::URL):
        (WebCore::URL::setProtocol):
        (WebCore::URL::setHost):
        (WebCore::URL::removePort):
        (WebCore::URL::setPort):
        (WebCore::URL::setHostAndPort):
        (WebCore::URL::setUser):
        (WebCore::URL::setPass):
        (WebCore::URL::setFragmentIdentifier):
        (WebCore::URL::setQuery):
        (WebCore::URL::setPath):
        (WebCore::URL::serialize):
        (WebCore::isUserInfoChar): Deleted.
        (WebCore::isHostnameChar): Deleted.
        (WebCore::isIPv6Char): Deleted.
        (WebCore::isPathSegmentEndChar): Deleted.
        (WebCore::appendASCII): Deleted.
        (WebCore::findFirstOf): Deleted.
        (WebCore::checkEncodedString): Deleted.
        (WebCore::URL::init): Deleted.
        (WebCore::appendEscapingBadChars): Deleted.
        (WebCore::escapeAndAppendNonHierarchicalPart): Deleted.
        (WebCore::copyPathRemovingDots): Deleted.
        (WebCore::hasSlashDotOrDotDot): Deleted.
        (WebCore::URL::parse): Deleted.
        (WebCore::cannotBeABaseURL): Deleted.
        (WebCore::isDefaultPortForScheme): Deleted.
        (WebCore::hostPortIsEmptyButCredentialsArePresent): Deleted.
        (WebCore::isNonFileHierarchicalScheme): Deleted.
        (WebCore::isCanonicalHostnameLowercaseForScheme): Deleted.
        (WebCore::findHostnamesInMailToURL): Deleted.
        (WebCore::findHostnameInHierarchicalURL): Deleted.
        (WebCore::encodeHostnames): Deleted.
        (WebCore::encodeRelativeString): Deleted.
        (WebCore::substituteBackslashes): Deleted.
        * platform/URLParser.cpp:
        (WebCore::URLParser::URLParser):
        (WebCore::URLParser::setEnabled): Deleted.
        (WebCore::URLParser::enabled): Deleted.
        * platform/URLParser.h:
        * platform/cf/URLCF.cpp:
        (WebCore::URL::URL):
        * platform/mac/URLMac.mm:
        (WebCore::URL::URL):

2017-02-16  Anders Carlsson  <andersca@apple.com>

        Build fixes.

        * page/gtk/EventHandlerGtk.cpp:
        (WebCore::EventHandler::createDraggingDataTransfer):
        * page/win/EventHandlerWin.cpp:
        (WebCore::EventHandler::createDraggingDataTransfer):

2017-02-16  Anders Carlsson  <andersca@apple.com>

        Remove EFL from WebCore
        https://bugs.webkit.org/show_bug.cgi?id=168477

        Reviewed by Brian Burg.

        * accessibility/AccessibilityList.cpp:
        (WebCore::AccessibilityList::childHasPseudoVisibleListItemMarkers):
        * accessibility/AccessibilityNodeObject.cpp:
        (WebCore::AccessibilityNodeObject::canSetValueAttribute):
        * accessibility/AccessibilityObject.cpp:
        (WebCore::AccessibilityObject::AccessibilityObject):
        (WebCore::AccessibilityObject::textIteratorBehaviorForTextRange):
        * accessibility/AccessibilityObject.h:
        * accessibility/AccessibilityRenderObject.cpp:
        (WebCore::AccessibilityRenderObject::determineAccessibilityRole):
        * accessibility/AccessibilityTableColumn.cpp:
        (WebCore::AccessibilityTableColumn::computeAccessibilityIsIgnored):
        * accessibility/AccessibilityTableHeaderContainer.cpp:
        (WebCore::AccessibilityTableHeaderContainer::computeAccessibilityIsIgnored):
        * crypto/CryptoKey.cpp:
        * crypto/keys/CryptoKeyRSA.h:
        * dom/Document.cpp:
        (WebCore::Document::implicitClose):
        * editing/Editor.cpp:
        (WebCore::Editor::performCutOrCopy):
        (WebCore::Editor::copyImage):
        * editing/Editor.h:
        * editing/FrameSelection.h:
        * html/HTMLCanvasElement.cpp:
        (WebCore::requiresAcceleratedCompositingForWebGL):
        * inspector/InspectorFrontendHost.cpp:
        (WebCore::InspectorFrontendHost::port):
        * loader/HistoryController.cpp:
        (WebCore::HistoryController::restoreScrollPositionAndViewState):
        * loader/icon/IconDatabase.cpp:
        (WebCore::IconDatabase::performURLImport):
        * page/ContextMenuController.cpp:
        (WebCore::ContextMenuController::contextMenuItemSelected):
        (WebCore::ContextMenuController::populate):
        (WebCore::ContextMenuController::checkOrEnableIfNeeded):
        * page/DragController.cpp:
        (WebCore::DragController::startDrag):
        * page/EventHandler.cpp:
        (WebCore::EventHandler::eventInvertsTabsToLinksClientCallResult):
        * page/FrameView.cpp:
        (WebCore::FrameView::layout):
        * platform/ContextMenuItem.h:
        * platform/Cursor.h:
        * platform/DragData.h:
        * platform/DragImage.h:
        * platform/FileSystem.h:
        * platform/LocalizedStrings.h:
        * platform/MIMETypeRegistry.cpp:
        (WebCore::initializeSupportedImageMIMETypesForEncoding):
        * platform/NotImplemented.h:
        * platform/Pasteboard.h:
        * platform/PlatformKeyboardEvent.h:
        * platform/PlatformMouseEvent.h:
        * platform/PlatformSpeechSynthesizer.h:
        * platform/PlatformWheelEvent.h:
        * platform/Widget.h:
        * platform/graphics/ANGLEWebKitBridge.h:
        * platform/graphics/BitmapImage.h:
        * platform/graphics/GraphicsContext3D.h:
        * platform/graphics/Icon.h:
        * platform/graphics/Image.h:
        (WebCore::Image::getEvasObject): Deleted.
        * platform/graphics/IntPoint.h:
        * platform/graphics/IntRect.h:
        * platform/graphics/opengl/Extensions3DOpenGL.cpp:
        (WebCore::Extensions3DOpenGL::createVertexArrayOES):
        (WebCore::Extensions3DOpenGL::deleteVertexArrayOES):
        (WebCore::Extensions3DOpenGL::isVertexArrayOES):
        (WebCore::Extensions3DOpenGL::bindVertexArrayOES):
        (WebCore::Extensions3DOpenGL::supportsExtension):
        * platform/graphics/opengl/Extensions3DOpenGL.h:
        * platform/graphics/opengl/Extensions3DOpenGLCommon.cpp:
        * platform/graphics/opengl/GraphicsContext3DOpenGL.cpp:
        * platform/graphics/opengl/GraphicsContext3DOpenGLCommon.cpp:
        (WebCore::GraphicsContext3D::createForCurrentGLContext):
        (WebCore::GraphicsContext3D::reshape):
        (WebCore::GraphicsContext3D::createVertexArray):
        (WebCore::GraphicsContext3D::deleteVertexArray):
        (WebCore::GraphicsContext3D::isVertexArray):
        (WebCore::GraphicsContext3D::bindVertexArray):
        * platform/graphics/opengl/TemporaryOpenGLSetting.cpp:
        * platform/network/NetworkStateNotifier.h:
        * platform/posix/FileSystemPOSIX.cpp:
        * rendering/RenderLayerCompositor.cpp:
        (WebCore::RenderLayerCompositor::ensureRootLayer):
        * rendering/RenderText.cpp:
        (WebCore::RenderText::previousOffsetForBackwardDeletion):
        * xml/XSLStyleSheetLibxslt.cpp:
        * xml/XSLTExtensions.cpp:
        * xml/XSLTProcessorLibxslt.cpp:
        * xml/XSLTUnicodeSort.cpp:

2017-02-16  Zalan Bujtas  <zalan@apple.com>

        Simple line layout: Add forced line layout info to coverage print.
        https://bugs.webkit.org/show_bug.cgi?id=168470

        Reviewed by Simon Fraser.

        This is about potential vs. actual coverage:

        Simple line layout potential coverage: 65.05%
        Simple line layout actual coverage: 46.60%
        Forced line layout blocks: 4 content length: 57(18.45%)

        Not testable.

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

2017-02-16  Anders Carlsson  <andersca@apple.com>

        Rename DataTransfer functions to indicate whether they are for dragging or dropping
        https://bugs.webkit.org/show_bug.cgi?id=168478

        Reviewed by Tim Horton.

        * dom/DataTransfer.cpp:
        (WebCore::DataTransfer::createForDrag):
        (WebCore::DataTransfer::createForDrop):
        (WebCore::DataTransfer::createForDragAndDrop): Deleted.
        * dom/DataTransfer.h:
        * page/DragController.cpp:
        (WebCore::DragController::dragExited):
        (WebCore::DragController::performDragOperation):
        (WebCore::DragController::tryDHTMLDrag):
        * page/mac/EventHandlerMac.mm:
        (WebCore::EventHandler::createDraggingDataTransfer):

2017-02-16  Anders Carlsson  <andersca@apple.com>

        Rename EventHandler::freeDataTransfer to invalidateDataTransfer
        https://bugs.webkit.org/show_bug.cgi?id=168472

        Reviewed by Tim Horton.

        The code doesn't necessarily free the data transfer object, so rename the member function
        to reflect that. Also, get rid of a goto.

        * page/EventHandler.cpp:
        (WebCore::EventHandler::invalidateDataTransfer):
        (WebCore::EventHandler::dragSourceEndedAt):
        (WebCore::EventHandler::handleDrag):
        (WebCore::EventHandler::freeDataTransfer): Deleted.
        * page/EventHandler.h:

2017-02-16  Alex Christensen  <achristensen@webkit.org>

        Special URLs without a host are invalid
        https://bugs.webkit.org/show_bug.cgi?id=168461

        Reviewed by Tim Horton.

        http://? should be invalid.  This matches Chrome and the spec and the intent of my implementation
        of URLParser which already fails with urls like http:// and this was just an oversight.
        Covered by newly passing web platform tests.  Updated API tests.

        * platform/URLParser.cpp:
        (WebCore::URLParser::parse):

2017-02-16  Zalan Bujtas  <zalan@apple.com>

        Simple line layout: Add support for pagination.
        https://bugs.webkit.org/show_bug.cgi?id=168355
        <rdar://problem/30119769>

        Reviewed by David Hyatt.

        This patch adds basic support for paginated content including widows and orphans.

        This is based on the normal line layout pagination logic. However there are 2 major
        advantages here (and they allow us to have a much simpler logic):
        1. all the lines are positioned by the time we start paginating them and
        2. lines always have uniform heights. 

        This is not enabled yet.

        * rendering/RenderBlockFlow.h:
        * rendering/SimpleLineLayout.cpp:
        (WebCore::SimpleLineLayout::computeLineTopAndBottomWithOverflow):
        (WebCore::SimpleLineLayout::computeLineBreakIndex):
        (WebCore::SimpleLineLayout::setPageBreakForLine):
        (WebCore::SimpleLineLayout::computeOffsetAfterLineBreak):
        (WebCore::SimpleLineLayout::updateMinimumPageHeight):
        (WebCore::SimpleLineLayout::adjustLinePositionsForPagination):
        (WebCore::SimpleLineLayout::create):
        (WebCore::SimpleLineLayout::Layout::create):
        (WebCore::SimpleLineLayout::Layout::Layout):
        * rendering/SimpleLineLayout.h:
        (WebCore::SimpleLineLayout::Layout::isPaginated):
        (WebCore::SimpleLineLayout::Layout::struts):
        * rendering/SimpleLineLayoutFunctions.h:
        (WebCore::SimpleLineLayout::computeFlowHeight):
        * rendering/SimpleLineLayoutResolver.h:
        (WebCore::SimpleLineLayout::RunResolver::Run::computeBaselinePosition):

2017-02-11  Filip Pizlo  <fpizlo@apple.com>

        The collector thread should only start when the mutator doesn't have heap access
        https://bugs.webkit.org/show_bug.cgi?id=167737

        Reviewed by Keith Miller.

        Added new tests in JSTests and LayoutTests.
        
        The WebCore changes involve:
        
        - Refactoring around new header discipline.
        
        - Adding crazy GC APIs to window.internals to enable us to test the GC's runloop discipline.

        * ForwardingHeaders/heap/GCFinalizationCallback.h: Added.
        * ForwardingHeaders/heap/IncrementalSweeper.h: Added.
        * ForwardingHeaders/heap/MachineStackMarker.h: Added.
        * ForwardingHeaders/heap/RunningScope.h: Added.
        * bindings/js/CommonVM.cpp:
        * testing/Internals.cpp:
        (WebCore::Internals::parserMetaData):
        (WebCore::Internals::isReadableStreamDisturbed):
        (WebCore::Internals::isGCRunning):
        (WebCore::Internals::addGCFinalizationCallback):
        (WebCore::Internals::stopSweeping):
        (WebCore::Internals::startSweeping):
        * testing/Internals.h:
        * testing/Internals.idl:

2017-02-16  Jiewen Tan  <jiewen_tan@apple.com>

        [WebCrypto] remove toJSValueFromJsonWebKey from custom SubtleCrypto binding codes
        https://bugs.webkit.org/show_bug.cgi?id=167026

        Reviewed by Chris Dumez.

        Covered by existing tests.

        * bindings/js/JSSubtleCryptoCustom.cpp:
        (WebCore::jsSubtleCryptoFunctionExportKeyPromise):
        (WebCore::jsSubtleCryptoFunctionWrapKeyPromise):
        (WebCore::toJSValueFromJsonWebKey): Deleted.
        * crypto/JsonWebKey.h:
        * crypto/JsonWebKey.idl:
        * crypto/RsaOtherPrimesInfo.idl:
        Change std::optional<String> to String in order to use toJS<IDLDictionary<JsonWebKey>>.
        * crypto/algorithms/CryptoAlgorithmAES_CBC.cpp:
        (WebCore::CryptoAlgorithmAES_CBC::importKey):
        * crypto/algorithms/CryptoAlgorithmAES_KW.cpp:
        (WebCore::CryptoAlgorithmAES_KW::importKey):
        * crypto/algorithms/CryptoAlgorithmHMAC.cpp:
        (WebCore::CryptoAlgorithmHMAC::importKey):
        * 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):
        * crypto/keys/CryptoKeyAES.cpp:
        (WebCore::CryptoKeyAES::importJwk):
        Only check if key_ops contains all of the specified usages when key_ops field of jwk is present,
        as per the specification: https://www.w3.org/TR/WebCryptoAPI/#aes-cbc-operations
        * crypto/keys/CryptoKeyAES.h:
        * crypto/keys/CryptoKeyHMAC.cpp:
        (WebCore::CryptoKeyHMAC::importJwk):
        * crypto/keys/CryptoKeyHMAC.h:
        * crypto/keys/CryptoKeyRSA.cpp:
        (WebCore::CryptoKeyRSA::importJwk):
        Accommodate the change from std::optional<String> to String.
        * crypto/mac/CryptoKeyRSAMac.cpp:
        (WebCore::CryptoKeyRSA::create):
        Add a null check for p.

2017-02-16  Antti Koivisto  <antti@apple.com>

        Execute pending scripts asynchronously after stylesheet loads complete
        https://bugs.webkit.org/show_bug.cgi?id=168367
        rdar://problem/30561379

        Reviewed by Andreas Kling.

        The current synchronous execution is fragile and creates various problems.

        * css/StyleSheetContents.cpp:
        (WebCore::StyleSheetContents::checkLoaded):
        * dom/ContainerNode.cpp:
        (WebCore::ContainerNode::takeAllChildrenFrom):
        (WebCore::ContainerNode::notifyChildInserted):
        (WebCore::ContainerNode::removeChild):
        (WebCore::ContainerNode::parserRemoveChild):
        (WebCore::ContainerNode::removeChildren):

            Remove various places where we would trigger delayed synchronous execution.

        * dom/Document.cpp:
        (WebCore::Document::Document):
        (WebCore::Document::recalcStyle):

            Trigger scroll to anchor at the end of style resolution instead of when style sheet load completes.

        (WebCore::Document::didRemoveAllPendingStylesheet):

            Call asynchronous script execution function.

        * dom/Document.h:
        (WebCore::Document::setNeedsNotifyRemoveAllPendingStylesheet): Deleted.
        (WebCore::Document::notifyRemovePendingSheetIfNeeded): Deleted.
        * dom/ScriptableDocumentParser.cpp:
        (WebCore::ScriptableDocumentParser::ScriptableDocumentParser):
        (WebCore::ScriptableDocumentParser::executeScriptsWaitingForStylesheetsSoon):
        (WebCore::ScriptableDocumentParser::scriptsWaitingForStylesheetsExecutionTimerFired):

            Add a timer for executing pending scripts.

        (WebCore::ScriptableDocumentParser::detach):
        * dom/ScriptableDocumentParser.h:
        (WebCore::ScriptableDocumentParser::executeScriptsWaitingForStylesheets):
        * html/HTMLLinkElement.cpp:
        (WebCore::HTMLLinkElement::removedFrom):
        (WebCore::HTMLLinkElement::removePendingSheet):
        * html/HTMLLinkElement.h:
        * html/parser/HTMLDocumentParser.cpp:
        (WebCore::HTMLDocumentParser::detach):
        * loader/DocumentLoader.cpp:
        (WebCore::DocumentLoader::isLoadingInAPISense):

            Stay in loading state if we have a pending script. This matches existing behavior.

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

2017-02-16  Anders Carlsson  <andersca@apple.com>

        Set the DHTML drag image in the DHTML type check
        https://bugs.webkit.org/show_bug.cgi?id=168451

        Reviewed by Wenson Hsieh.

        * page/DragController.cpp:
        (WebCore::DragController::startDrag):

2017-02-16  Anders Carlsson  <andersca@apple.com>

        Begin removing EFL code from WebCore.

        Rubber-stamped by Alex Christensen.

        * PlatformEfl.cmake: Removed.
        * editing/efl/EditorEfl.cpp: Removed.
        * page/efl/DragControllerEfl.cpp: Removed.
        * page/efl/EventHandlerEfl.cpp: Removed.
        * platform/audio/efl/AudioBusEfl.cpp: Removed.
        * platform/efl/CursorEfl.cpp: Removed.
        * platform/efl/DefaultTheme/CMakeLists.txt: Removed.
        * platform/efl/DefaultTheme/default.edc: Removed.
        * platform/efl/DefaultTheme/widget/button/button.edc: Removed.
        * platform/efl/DefaultTheme/widget/button/img_button_focus.png: Removed.
        * platform/efl/DefaultTheme/widget/button/img_button_hover.png: Removed.
        * platform/efl/DefaultTheme/widget/button/img_button_normal.png: Removed.
        * platform/efl/DefaultTheme/widget/button/img_button_press.png: Removed.
        * platform/efl/DefaultTheme/widget/check/check.edc: Removed.
        * platform/efl/DefaultTheme/widget/check/img_check_bg_disabled.png: Removed.
        * platform/efl/DefaultTheme/widget/check/img_check_bg_enabled.png: Removed.
        * platform/efl/DefaultTheme/widget/check/img_check_off.png: Removed.
        * platform/efl/DefaultTheme/widget/check/img_check_off_focus.png: Removed.
        * platform/efl/DefaultTheme/widget/check/img_check_off_hover.png: Removed.
        * platform/efl/DefaultTheme/widget/check/img_check_on.png: Removed.
        * platform/efl/DefaultTheme/widget/check/img_check_on_focus.png: Removed.
        * platform/efl/DefaultTheme/widget/check/img_check_on_hover.png: Removed.
        * platform/efl/DefaultTheme/widget/combo/combo.edc: Removed.
        * platform/efl/DefaultTheme/widget/combo/combo_focus.png: Removed.
        * platform/efl/DefaultTheme/widget/combo/combo_focus_button.png: Removed.
        * platform/efl/DefaultTheme/widget/combo/combo_focus_button_transparent.png: Removed.
        * platform/efl/DefaultTheme/widget/combo/combo_focus_transparent.png: Removed.
        * platform/efl/DefaultTheme/widget/combo/combo_hover.png: Removed.
        * platform/efl/DefaultTheme/widget/combo/combo_hover_button.png: Removed.
        * platform/efl/DefaultTheme/widget/combo/combo_hover_button_transparent.png: Removed.
        * platform/efl/DefaultTheme/widget/combo/combo_hover_transparent.png: Removed.
        * platform/efl/DefaultTheme/widget/combo/combo_normal.png: Removed.
        * platform/efl/DefaultTheme/widget/combo/combo_normal_button.png: Removed.
        * platform/efl/DefaultTheme/widget/combo/combo_normal_button_transparent.png: Removed.
        * platform/efl/DefaultTheme/widget/combo/combo_normal_transparent.png: Removed.
        * platform/efl/DefaultTheme/widget/combo/combo_press.png: Removed.
        * platform/efl/DefaultTheme/widget/combo/combo_press_button.png: Removed.
        * platform/efl/DefaultTheme/widget/combo/combo_press_button_transparent.png: Removed.
        * platform/efl/DefaultTheme/widget/combo/combo_press_transparent.png: Removed.
        * platform/efl/DefaultTheme/widget/combo/icon.png: Removed.
        * platform/efl/DefaultTheme/widget/entry/entry.edc: Removed.
        * platform/efl/DefaultTheme/widget/entry/img_focused.png: Removed.
        * platform/efl/DefaultTheme/widget/entry/img_hovered.png: Removed.
        * platform/efl/DefaultTheme/widget/entry/img_normal.png: Removed.
        * platform/efl/DefaultTheme/widget/progressbar/bt_base.png: Removed.
        * platform/efl/DefaultTheme/widget/progressbar/progressbar.edc: Removed.
        * platform/efl/DefaultTheme/widget/progressbar/shelf_inset.png: Removed.
        * platform/efl/DefaultTheme/widget/radio/img_radio_bg_disabled.png: Removed.
        * platform/efl/DefaultTheme/widget/radio/img_radio_bg_enabled.png: Removed.
        * platform/efl/DefaultTheme/widget/radio/img_radio_off.png: Removed.
        * platform/efl/DefaultTheme/widget/radio/img_radio_off_focus.png: Removed.
        * platform/efl/DefaultTheme/widget/radio/img_radio_off_hover.png: Removed.
        * platform/efl/DefaultTheme/widget/radio/img_radio_on.png: Removed.
        * platform/efl/DefaultTheme/widget/radio/img_radio_on_focus.png: Removed.
        * platform/efl/DefaultTheme/widget/radio/img_radio_on_hover.png: Removed.
        * platform/efl/DefaultTheme/widget/radio/radio.edc: Removed.
        * platform/efl/DefaultTheme/widget/scrollbar/scrollbar.edc: Removed.
        * platform/efl/DefaultTheme/widget/scrollbar/scrollbar_bg_horizontal.png: Removed.
        * platform/efl/DefaultTheme/widget/scrollbar/scrollbar_bg_vertical.png: Removed.
        * platform/efl/DefaultTheme/widget/scrollbar/scrollbar_thumb_horizontal.png: Removed.
        * platform/efl/DefaultTheme/widget/scrollbar/scrollbar_thumb_vertical.png: Removed.
        * platform/efl/DefaultTheme/widget/search/cancel/cancel_normal_button.png: Removed.
        * platform/efl/DefaultTheme/widget/search/cancel/cancel_normal_button2.png: Removed.
        * platform/efl/DefaultTheme/widget/search/cancel/search_cancel.edc: Removed.
        * platform/efl/DefaultTheme/widget/search/decoration/decoration_normal_button.png: Removed.
        * platform/efl/DefaultTheme/widget/search/decoration/search_decoration.edc: Removed.
        * platform/efl/DefaultTheme/widget/search/field/field_focused.png: Removed.
        * platform/efl/DefaultTheme/widget/search/field/field_hovered.png: Removed.
        * platform/efl/DefaultTheme/widget/search/field/field_normal.png: Removed.
        * platform/efl/DefaultTheme/widget/search/field/search_field.edc: Removed.
        * platform/efl/DefaultTheme/widget/slider/slider.edc: Removed.
        * platform/efl/DefaultTheme/widget/slider/slider_fill_h.png: Removed.
        * platform/efl/DefaultTheme/widget/slider/slider_fill_v.png: Removed.
        * platform/efl/DefaultTheme/widget/slider/slider_h.png: Removed.
        * platform/efl/DefaultTheme/widget/slider/slider_thumb_h.png: Removed.
        * platform/efl/DefaultTheme/widget/slider/slider_thumb_press_h.png: Removed.
        * platform/efl/DefaultTheme/widget/slider/slider_thumb_press_v.png: Removed.
        * platform/efl/DefaultTheme/widget/slider/slider_thumb_v.png: Removed.
        * platform/efl/DefaultTheme/widget/slider/slider_v.png: Removed.
        * platform/efl/DefaultTheme/widget/spinner/sp_bg.png: Removed.
        * platform/efl/DefaultTheme/widget/spinner/sp_down_default.png: Removed.
        * platform/efl/DefaultTheme/widget/spinner/sp_down_hover.png: Removed.
        * platform/efl/DefaultTheme/widget/spinner/sp_down_pressed.png: Removed.
        * platform/efl/DefaultTheme/widget/spinner/sp_up_default.png: Removed.
        * platform/efl/DefaultTheme/widget/spinner/sp_up_hover.png: Removed.
        * platform/efl/DefaultTheme/widget/spinner/sp_up_pressed.png: Removed.
        * platform/efl/DefaultTheme/widget/spinner/spinner.edc: Removed.
        * platform/efl/DragDataEfl.cpp: Removed.
        * platform/efl/DragImageEfl.cpp: Removed.
        * platform/efl/EflInspectorUtilities.cpp: Removed.
        * platform/efl/EflInspectorUtilities.h: Removed.
        * platform/efl/EflKeyboardUtilities.cpp: Removed.
        * platform/efl/EflKeyboardUtilities.h: Removed.
        * platform/efl/EflScreenUtilities.cpp: Removed.
        * platform/efl/EflScreenUtilities.h: Removed.
        * platform/efl/ErrorsEfl.cpp: Removed.
        * platform/efl/ErrorsEfl.h: Removed.
        * platform/efl/EventLoopEfl.cpp: Removed.
        * platform/efl/FileSystemEfl.cpp: Removed.
        * platform/efl/LocalizedStringsEfl.cpp: Removed.
        * platform/efl/MIMETypeRegistryEfl.cpp: Removed.
        * platform/efl/MainThreadSharedTimerEfl.cpp: Removed.
        * platform/efl/PasteboardEfl.cpp: Removed.
        * platform/efl/PlatformKeyboardEventEfl.cpp: Removed.
        * platform/efl/PlatformMouseEventEfl.cpp: Removed.
        * platform/efl/PlatformScreenEfl.cpp: Removed.
        * platform/efl/PlatformSpeechSynthesisProviderEfl.cpp: Removed.
        * platform/efl/PlatformSpeechSynthesisProviderEfl.h: Removed.
        * platform/efl/PlatformSpeechSynthesizerEfl.cpp: Removed.
        * platform/efl/PlatformWheelEventEfl.cpp: Removed.
        * platform/efl/ScrollbarThemeEfl.cpp: Removed.
        * platform/efl/ScrollbarThemeEfl.h: Removed.
        * platform/efl/SoundEfl.cpp: Removed.
        * platform/efl/TemporaryLinkStubs.cpp: Removed.
        * platform/efl/UserAgentEfl.cpp: Removed.
        * platform/efl/WidgetEfl.cpp: Removed.
        * platform/gamepad/efl/GamepadsEfl.cpp: Removed.
        * platform/graphics/efl/CairoUtilitiesEfl.cpp: Removed.
        * platform/graphics/efl/CairoUtilitiesEfl.h: Removed.
        * platform/graphics/efl/EvasGLContext.cpp: Removed.
        * platform/graphics/efl/EvasGLContext.h: Removed.
        * platform/graphics/efl/EvasGLSurface.cpp: Removed.
        * platform/graphics/efl/EvasGLSurface.h: Removed.
        * platform/graphics/efl/GraphicsContext3DEfl.cpp: Removed.
        * platform/graphics/efl/GraphicsContext3DPrivate.cpp: Removed.
        * platform/graphics/efl/GraphicsContext3DPrivate.h: Removed.
        * platform/graphics/efl/IconEfl.cpp: Removed.
        * platform/graphics/efl/ImageBufferEfl.cpp: Removed.
        * platform/graphics/efl/ImageEfl.cpp: Removed.
        * platform/graphics/efl/IntPointEfl.cpp: Removed.
        * platform/graphics/efl/IntRectEfl.cpp: Removed.
        * platform/graphics/surfaces/efl/GraphicsSurfaceCommon.cpp: Removed.
        * platform/network/efl/NetworkStateNotifierEfl.cpp: Removed.
        * rendering/RenderThemeEfl.cpp: Removed.
        * rendering/RenderThemeEfl.h: Removed.

2017-02-16  Joseph Pecoraro  <pecoraro@apple.com>

        [Resource Timing] Support Resource Timing in Workers
        https://bugs.webkit.org/show_bug.cgi?id=168086
        <rdar://problem/30430117>

        Reviewed by Alex Christensen.

        Worker's load resources through the Document that loaded them. However,
        their PerformanceResourceTiming entries should be added to the Performance
        object inside the Worker context, not the Document's context.

        This change adds an InitiatorContext to ResourceLoadOptions so that loaders
        can determine if the load was initiated by the Document or a Worker. This
        allows loaders to then know if the ResourceTiming data they collect should
        be added to the Document's Performance object or forwarded on to the Worker's.

        This adds a new ThreadableLoaderClient method intended only for the purpose
        of adding the ResourceTiming information to the Worker's Performance object.
        Unlike other ThreadableLoaderClient methods that are bridged and forwarded
        on to a client inside the worker (e.g. XMLHttpRequest or FetchLoader) this
        method never needs to be handled by clients and can be uniformly handled by
        the WorkerThreadableLoader itself.

        We also add a new ResourceTiming object that encapsulates all of the data
        ultimately needed for a PerformanceResourceTimingEntry object. This allows
        for all of the information to be gathered while loading on the Document
        before serializing across to the Worker. That includes the Timing-Allow-Origin
        check which uses the SecurityOrigin of the Worker.

        This also modernizes and addresses issues in the Resource Timing implementation.
        Better handling cases like loading from the Cache, Synchronous Loads, and
        improving initiatorType information.

        Tests: imported/w3c/web-platform-tests/resource-timing/rt-cors.html
               imported/w3c/web-platform-tests/resource-timing/rt-cors.worker.html
               imported/w3c/web-platform-tests/resource-timing/rt-initiatorType-css.html
               imported/w3c/web-platform-tests/resource-timing/rt-initiatorType-element.html
               imported/w3c/web-platform-tests/resource-timing/rt-initiatorType-fetch.html
               imported/w3c/web-platform-tests/resource-timing/rt-initiatorType-media.html
               imported/w3c/web-platform-tests/resource-timing/rt-initiatorType-other.html
               imported/w3c/web-platform-tests/resource-timing/rt-initiatorType-script-module.html
               imported/w3c/web-platform-tests/resource-timing/rt-initiatorType-xmlhttprequest.html
               imported/w3c/web-platform-tests/resource-timing/rt-initiatorType.worker.html
               imported/w3c/web-platform-tests/resource-timing/rt-performance-extensions.html
               imported/w3c/web-platform-tests/resource-timing/rt-performance-extensions.worker.html
               imported/w3c/web-platform-tests/resource-timing/rt-resource-errors.html
               imported/w3c/web-platform-tests/resource-timing/rt-resource-ignored.html
               imported/w3c/web-platform-tests/resource-timing/rt-resources-per-frame.html
               imported/w3c/web-platform-tests/resource-timing/rt-resources-per-worker.html
               imported/w3c/web-platform-tests/resource-timing/rt-serialization.html
               imported/w3c/web-platform-tests/resource-timing/rt-shared-resource-in-frames.html
               imported/w3c/web-platform-tests/resource-timing/rt-shared-resource-in-workers.html
               performance-api/resource-timing-apis.html

        * CMakeLists.txt:
        * WebCore.xcodeproj/project.pbxproj:
        New files.

        * platform/network/NetworkLoadTiming.h:
        (WebCore::NetworkLoadTiming::reset): Deleted.
        We no longer need to reset.

        * loader/ResourceTiming.cpp: Added.
        (WebCore::passesTimingAllowCheck):
        (WebCore::ResourceTiming::fromCache):
        (WebCore::ResourceTiming::fromLoad):
        (WebCore::ResourceTiming::fromSynchronousLoad):
        (WebCore::ResourceTiming::ResourceTiming):
        (WebCore::ResourceTiming::isolatedCopy):
        * loader/ResourceTiming.h: Added.
        (WebCore::ResourceTiming::url):
        (WebCore::ResourceTiming::initiator):
        (WebCore::ResourceTiming::loadTiming):
        (WebCore::ResourceTiming::networkLoadTiming):
        (WebCore::ResourceTiming::allowTimingDetails):
        (WebCore::ResourceTiming::overrideInitiatorName):
        (WebCore::ResourceTiming::ResourceTiming):
        Class that encapsulates all of the data needed for a PerformanceResourceTiming entry.
        There are three static constructors indicating the different ways this object can
        be constructed and the different data available at the time of construction.

        * loader/ResourceLoaderOptions.h:
        Add the new InitiatorContext, default to Document.

        * loader/ThreadableLoaderClient.h:
        (WebCore::ThreadableLoaderClient::didFinishTiming):
        New client method only used by WorkerThreadableLoader.

        * loader/WorkerThreadableLoader.h:
        * loader/WorkerThreadableLoader.cpp:
        (WebCore::WorkerThreadableLoader::MainThreadBridge::MainThreadBridge):
        (WebCore::WorkerThreadableLoader::MainThreadBridge::didFinishTiming):
        All loads initiated in a WorkerThreadableLoader get identified as InitiatorContext::Worker.
        Add timing information to the Performance object when received. No need to inform clients.

        * loader/DocumentThreadableLoader.h:
        * loader/DocumentThreadableLoader.cpp:
        (WebCore::DocumentThreadableLoader::finishedTimingForWorkerLoad):
        (WebCore::DocumentThreadableLoader::loadRequest):
        Provide APIs to pass timing data on to a WorkerThreadableLoader.
        Create ResourceTiming data for synchronous loads.

        * loader/LoadTiming.h:
        * loader/LoadTiming.cpp:
        (WebCore::LoadTiming::isolatedCopy):
        Add isolatedCopy to allow this data to be passed across to a Worker.

        * loader/ResourceTimingInformation.h:
        * loader/ResourceTimingInformation.cpp:
        (WebCore::ResourceTimingInformation::shouldAddResourceTiming):
        (WebCore::ResourceTimingInformation::addResourceTiming):
        (WebCore::ResourceTimingInformation::storeResourceTimingInitiatorInformation):
        Refactor to remove unused / unnecessary bits. Extract out some helpful code.
        Changed this to match when Blink decides when to add or ignore entries, however
        this may change over time.

        * loader/SubresourceLoader.cpp:
        (WebCore::SubresourceLoader::didFinishLoading):
        (WebCore::SubresourceLoader::notifyDone):
        (WebCore::SubresourceLoader::reportResourceTiming):
        * loader/SubresourceLoader.h:
        * loader/cache/CachedRawResource.cpp:
        (WebCore::CachedRawResource::finishedTimingForWorkerLoad):
        * loader/cache/CachedRawResource.h:
        * loader/cache/CachedRawResourceClient.h:
        (WebCore::CachedRawResourceClient::finishedTimingForWorkerLoad):
        Plumbing to report timing information to Worker if this resource was loaded for a Worker.

        * loader/cache/CachedResource.cpp:
        (WebCore::CachedResource::CachedResource):
        * loader/cache/CachedResource.h:
        (WebCore::CachedResource::initiatorName):
        Store the initiator name on the CachedResource like other data added to the original
        CachedResourceRequest. This is a bit of a hack but follows an existing pattern, and
        cleans up other hacks that worked around this later on.

        * loader/cache/CachedResourceLoader.h:
        * loader/cache/CachedResourceLoader.cpp:
        (WebCore::CachedResourceLoader::requestResource):
        (WebCore::CachedResourceLoader::revalidateResource):
        (WebCore::CachedResourceLoader::loadResource):
        Simply the creation of a ResourceTiming object for cache hits.
        Report timing information to Worker if this resource was loaded for a Worker.

        (WebCore::CachedResourceLoader::loadDone):
        Eliminate this redundant point attempting to add a ResourceTiming entry.

        * loader/cache/CachedResourceRequest.cpp:
        (WebCore::CachedResourceRequest::initiatorName):
        Update to match the spec. The fallback is "other".

        * page/Performance.h:
        * page/Performance.cpp:
        (WebCore::Performance::setResourceTimingBufferSize):
        (WebCore::Performance::addResourceTiming):
        Update to support PerformanceObservers.
        Update to match spec (event should bubble).

        * page/PerformanceResourceTiming.h:
        * page/PerformanceResourceTiming.cpp:
        (WebCore::PerformanceResourceTiming::create):
        (WebCore::PerformanceResourceTiming::PerformanceResourceTiming):
        (WebCore::PerformanceResourceTiming::fetchStart):
        (WebCore::PerformanceResourceTiming::domainLookupStart):
        (WebCore::PerformanceResourceTiming::domainLookupEnd):
        (WebCore::PerformanceResourceTiming::connectStart):
        (WebCore::PerformanceResourceTiming::connectEnd):
        (WebCore::PerformanceResourceTiming::secureConnectionStart):
        (WebCore::PerformanceResourceTiming::requestStart):
        (WebCore::PerformanceResourceTiming::responseStart):
        (WebCore::PerformanceResourceTiming::responseEnd):
        (WebCore::PerformanceResourceTiming::networkLoadTimeToDOMHighResTimeStamp):
        Construct with a ResourceTiming object containing all the data we need for the entry.
        Update to match spec for what is required, should fallback, should be zero, etc.

        (WebCore::passesTimingAllowCheck): Deleted.
        Extracted this to ResourceTiming creation time in the loading context,
        since this can't be determined on the Worker context without also having
        all of the header information from each resource response.

        * page/PerformanceResourceTiming.idl:
        Expose to Workers!

2017-02-16  Yusuke Suzuki  <utatane.tea@gmail.com>

        [JSC] Drop PassRefPtr in inspector/
        https://bugs.webkit.org/show_bug.cgi?id=168420

        Reviewed by Alex Christensen.

        Use Ref<Inspector::ScriptArguments> and Ref<ScriptCallStack> as much as possible.
        It drops some unnecessary null checks.

        * bindings/scripts/CodeGeneratorJS.pm:
        (GenerateCallWith):
        * bindings/scripts/test/JS/JSTestObj.cpp:
        (WebCore::jsTestObjPrototypeFunctionWithScriptArgumentsAndCallStackCaller):
        * dom/ScriptExecutionContext.cpp:
        (WebCore::ScriptExecutionContext::PendingException::PendingException):
        * inspector/InspectorInstrumentation.cpp:
        (WebCore::InspectorInstrumentation::consoleCountImpl):
        (WebCore::InspectorInstrumentation::stopConsoleTimingImpl):
        (WebCore::InspectorInstrumentation::consoleTimeStampImpl):
        * inspector/InspectorInstrumentation.h:
        (WebCore::InspectorInstrumentation::consoleCount):
        (WebCore::InspectorInstrumentation::stopConsoleTiming):
        (WebCore::InspectorInstrumentation::consoleTimeStamp):
        * inspector/InspectorNetworkAgent.cpp:
        (WebCore::InspectorNetworkAgent::buildInitiatorObject):
        * inspector/TimelineRecordFactory.cpp:
        (WebCore::TimelineRecordFactory::createGenericRecord):
        * inspector/WebInjectedScriptManager.cpp:
        (WebCore::WebInjectedScriptManager::WebInjectedScriptManager):
        * inspector/WebInjectedScriptManager.h:
        * page/DOMWindow.cpp:
        (WebCore::DOMWindow::postMessageTimerFired):
        We dispatch appropriate addMessage function according to whether
        `timer.stackTrace()` is nullptr.

        * page/PageConsoleClient.cpp:
        (WebCore::PageConsoleClient::addMessage):
        (WebCore::PageConsoleClient::messageWithTypeAndLevel):
        (WebCore::PageConsoleClient::count):
        (WebCore::PageConsoleClient::timeEnd):
        (WebCore::PageConsoleClient::timeStamp):
        * page/PageConsoleClient.h:
        * workers/WorkerConsoleClient.cpp:
        (WebCore::WorkerConsoleClient::messageWithTypeAndLevel):
        (WebCore::WorkerConsoleClient::count):
        (WebCore::WorkerConsoleClient::timeEnd):
        (WebCore::WorkerConsoleClient::timeStamp):
        * workers/WorkerConsoleClient.h:
        * workers/WorkerGlobalScope.cpp:
        (WebCore::WorkerGlobalScope::addMessage):

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  Simon Fraser  <simon.fraser@apple.com>

        Clean up use of some CALayer-related SPI
        https://bugs.webkit.org/show_bug.cgi?id=168401

        Reviewed by Tim Horton.

        Use -setDrawsAsynchronously: rather than the old -setAcceleratesDrawing: SPI.

        Remove CATiledLayer-related stuff from QuartzCoreSPI.h, since we don't use it any more.

        * platform/graphics/ca/cocoa/PlatformCALayerCocoa.mm:
        (PlatformCALayerCocoa::acceleratesDrawing):
        (PlatformCALayerCocoa::setAcceleratesDrawing):
        * platform/graphics/ca/cocoa/WebTiledBackingLayer.mm:
        (-[WebTiledBackingLayer setDrawsAsynchronously:]): This override passes the state
        onto the TileController.
        (-[WebTiledBackingLayer setAcceleratesDrawing:]): Deleted.
        * platform/ios/LegacyTileGridTile.mm:
        (WebCore::LegacyTileGridTile::LegacyTileGridTile):
        * platform/spi/cocoa/QuartzCoreSPI.h:

2017-02-16  Yusuke Suzuki  <utatane.tea@gmail.com>

        Web Inspector: allow import() inside the inspector
        https://bugs.webkit.org/show_bug.cgi?id=167457

        Reviewed by Ryosuke Niwa.

        When evaluating `import("...")`, we need the caller's context to resolve
        the module specifier correctly. For example, if `import("./cocoa.js")` is
        evaluated in the script "drinks/hot.js", this module name is resolved to
        "drinks/cocoa.js". If the same import operator is evaluated in the script
        "menu/all.js", the module specifier becomes "menu/cocoa.js".

        Previously we reject the import operator if the caller does not have such
        a context. These context is SourceOrigin and its ScriptFetcher. While they
        are offered in the script tag and other code evaluations, the inspector
        console does not offer that. These class are offered in the WebCore side
        and we should not touch these classes in the JSC's inspector code.

        Now we relax the above restriction. If the above caller information is not
        offered, we fallback to the default one. In the web page, we use the page's
        URL as the caller's source origin. This allows us to evaluate the import
        operator in the inspector console.

        And as of r167698, the console recognizes `await import("...")` form. We use
        this to test this `import()` in the console functionality.

        Test: inspector/controller/runtime-controller-import.html

        * bindings/js/ScriptModuleLoader.cpp:
        (WebCore::ScriptModuleLoader::importModule):

2017-02-16  Miguel Gomez  <magomez@igalia.com>

        [GTK] scroll with transparent background not repainted after scrollY >= 32768
        https://bugs.webkit.org/show_bug.cgi?id=154283

        Reviewed by Carlos Garcia Campos.

        Due to a limitation of the pixman backend, which uses 16 bits to hold signed integers, cairo is
        not able to draw anything when using transformation matrices with values bigger than 32768. When
        drawing patterns into large pages, the matrices values can overflow those 16 bits, so cairo doesn't
        draw anything in, which causes the reported transparent backgrounds.

        The patch modifies the transformation matrices both from the current context and the pattern we
        are painting, to avoid them to hold values that cannot stored in 16 bits.

        There's still the possibility that this happens, but it would require using a pattern with a size
        bigger than 32768.

        Based on a previous patch by Gwang Yoon Hwang  <yoon@igalia.com>.

        Test: fast/backgrounds/background-repeat-long-scroll.html

        * platform/graphics/cairo/CairoUtilities.cpp:
        (WebCore::drawPatternToCairoContext):

2017-02-16  Carlos Garcia Campos  <cgarcia@igalia.com>

        [GTK] Images are never read from the clipboard
        https://bugs.webkit.org/show_bug.cgi?id=168419

        Reviewed by Sergio Villar Senin.

        We write images in the clipboard, but we don't read them.

        Fixes: editing/pasteboard/paste-image-using-image-data.html

        * editing/Editor.cpp:
        (WebCore::Editor::createFragmentForImageAndURL): Moved from EditorMac.mm since it's cross-platform code.
        * editing/Editor.h:
        * editing/gtk/EditorGtk.cpp:
        (WebCore::createFragmentFromPasteboardData): Check if there's an image in the selection, and use
        Editor::createFragmentForImageAndURL in that case.
        * editing/mac/EditorMac.mm:
        (WebCore::Editor::createFragmentForImageAndURL): Deleted.
        * platform/gtk/PasteboardHelper.cpp:
        (WebCore::PasteboardHelper::getClipboardContents): Check also if there's an image in the clipboard.

2017-02-15  Jer Noble  <jer.noble@apple.com>

        REGRESSION (r212311): NULL-dereference in HTMLMediaElement::prepareToPlay()
        https://bugs.webkit.org/show_bug.cgi?id=168404
        <rdar://problem/30547188>

        Reviewed by Brian Weinstein.

        Prior to r212311, m_player was always guaranteed to be initialized when calling
        prepareToPlay(). r212311 began calling prepareToPlay() on a subsequent run-loop iteration
        after creating m_player. So now check whether m_player is NULL before calling methods on it.

        * html/HTMLMediaElement.cpp:
        (WebCore::HTMLMediaElement::prepareToPlay):

2017-02-15  Eric Carlson  <eric.carlson@apple.com>

        [MediaStream] delete CaptureDeviceInfo struct
        https://bugs.webkit.org/show_bug.cgi?id=168395

        The CaptureDeviceInfo struct and CaptureDevice class were almost identical, so
        add an "enabled" field to the later, delete the former, and switch all uses of
        CaptureDeviceInfo to CaptureDevice.

        Do some minor drive-by cleanup of AVCaptureDeviceManager::refreshCaptureDevices
        and CaptureDeviceManager::captureDeviceFromDeviceID.
        
        Reviewed by Sam Weinig.

        No new tests, no behavior change.

        * Modules/mediastream/MediaDevicesRequest.cpp:
        (WebCore::MediaDevicesRequest::start): SourceKind -> DeviceType
        * platform/mediastream/CaptureDevice.h:
        (WebCore::CaptureDevice::CaptureDevice):
        (WebCore::CaptureDevice::type): Renamed from kind.
        (WebCore::CaptureDevice::setType):
        (WebCore::CaptureDevice::enabled): Added.
        (WebCore::CaptureDevice::setEnabled):
        (WebCore::CaptureDevice::kind): Deleted.
        (WebCore::CaptureDevice::setKind): Deleted.

        * platform/mediastream/CaptureDeviceManager.cpp:
        (CaptureDeviceManager::getSourcesInfo):
        (CaptureDeviceManager::captureDeviceFromDeviceID): Don't call sourceWithUID.
        (CaptureDeviceManager::bestSourcesForTypeAndConstraints):
        (CaptureDeviceManager::sourceWithUID):
        * platform/mediastream/CaptureDeviceManager.h:
        (WebCore::CaptureDeviceManager::refreshCaptureDevices):
        (WebCore::CaptureDeviceManager::refreshCaptureDeviceList): Deleted.

        * platform/mediastream/mac/AVCaptureDeviceManager.h:
        * platform/mediastream/mac/AVCaptureDeviceManager.mm:
        (WebCore::AVCaptureDeviceManager::captureDevices):
        (WebCore::deviceIsAvailable):
        (WebCore::AVCaptureDeviceManager::refreshCaptureDevices):
        (WebCore::AVCaptureDeviceManager::createMediaSourceForCaptureDeviceWithConstraints):
        (WebCore::AVCaptureDeviceManager::deviceConnected):
        (WebCore::AVCaptureDeviceManager::deviceDisconnected):
        (WebCore::AVCaptureDeviceManager::captureDeviceList): Deleted.
        (WebCore::shouldConsiderDeviceInDeviceList): Deleted.
        (WebCore::AVCaptureDeviceManager::refreshCaptureDeviceList): Deleted.
        * platform/mock/MockRealtimeMediaSource.cpp:
        (WebCore::MockRealtimeMediaSource::audioDeviceInfo):
        (WebCore::MockRealtimeMediaSource::videoDeviceInfo):

2017-02-15  Sam Weinig  <sam@webkit.org>

        [WebIDL] Remove custom conversion from FontFace code by using a Variant
        https://bugs.webkit.org/show_bug.cgi?id=168384

        Reviewed by Alex Christensen.

        Match the font face spec and use a union rather than any in the FontFace constructor.

        Test: Added additional cases to fast/text/font-face-javascript.html.

        * css/FontFace.cpp:
        (WebCore::FontFace::create):
        * css/FontFace.h:
        * css/FontFace.idl:

2017-02-15  Jer Noble  <jer.noble@apple.com>

        Disabled Media Sources should render black/silence
        https://bugs.webkit.org/show_bug.cgi?id=168281

        Reviewed by Eric Carlson.

        Test: webrtc/video-disabled-black.html

        Pass the enabled flag setting down from the MediaStreamTrackPrivate to its underlying
        source, including RealtimeMediaSource and RealtimeOutgoingAudio/VideoSource. When either
        enabled is cleared or muted is set, generate empty (black or silent) media, as opposed to
        pausing media or (worse) continuing to send generated media.

        * platform/mediastream/MediaStreamTrackPrivate.cpp:
        (WebCore::MediaStreamTrackPrivate::setEnabled):
        (WebCore::MediaStreamTrackPrivate::sourceEnabledChanged):
        * platform/mediastream/MediaStreamTrackPrivate.h:
        * platform/mediastream/RealtimeMediaSource.cpp:
        (WebCore::RealtimeMediaSource::setEnabled):
        * platform/mediastream/RealtimeMediaSource.h:
        (WebCore::RealtimeMediaSource::enabled):
        * platform/mediastream/mac/AudioTrackPrivateMediaStreamCocoa.h:
        * platform/mediastream/mac/MockRealtimeAudioSourceMac.mm:
        (WebCore::MockRealtimeAudioSourceMac::render):
        * platform/mediastream/mac/RealtimeOutgoingAudioSource.cpp:
        (WebCore::RealtimeOutgoingAudioSource::sourceMutedChanged):
        (WebCore::RealtimeOutgoingAudioSource::sourceEnabledChanged):
        (WebCore::RealtimeOutgoingAudioSource::pullAudioData):
        * platform/mediastream/mac/RealtimeOutgoingAudioSource.h:
        * platform/mediastream/mac/RealtimeOutgoingVideoSource.cpp:
        (WebCore::RealtimeOutgoingVideoSource::sourceMutedChanged):
        (WebCore::RealtimeOutgoingVideoSource::sourceEnabledChanged):
        (WebCore::RealtimeOutgoingVideoSource::videoSampleAvailable):
        * platform/mediastream/mac/RealtimeOutgoingVideoSource.h:
        * platform/mock/MockRealtimeVideoSource.cpp:
        (WebCore::MockRealtimeVideoSource::generateFrame):

2017-02-15  Wenson Hsieh  <wenson_hsieh@apple.com>

        Editing history scripts should not add the contenteditable attribute or override key events
        https://bugs.webkit.org/show_bug.cgi?id=168389
        <rdar://problem/30529945>

        Reviewed by Dan Bernstein.

        Clients that hook into editing history tracking should handle setting the contenteditable attribute on the body
        rather than have the script add it to the body. Additionally, this script should NOT be overriding any keydown
        events. These were initially added for compatibility with a test harness early on, and should have been removed
        earlier.

        * Scripts/DumpEditingHistory.js:

2017-02-15  Jer Noble  <jer.noble@apple.com>

        Pass "RequiresCustomURLLoading" in AVURLAsset options dictionary
        https://bugs.webkit.org/show_bug.cgi?id=168381

        Reviewed by Eric Carlson.

        * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
        (WebCore::MediaPlayerPrivateAVFoundationObjC::createAVAssetForURL):

2017-02-15  Anders Carlsson  <andersca@apple.com>

        Fix build.

        * page/DragController.cpp:
        (WebCore::DragController::doSystemDrag):

2017-02-15  Anders Carlsson  <andersca@apple.com>

        Modernize DragClient::startDrag somewhat
        https://bugs.webkit.org/show_bug.cgi?id=168379

        Reviewed by Tim Horton.

        Change DragClient::startDrag to take a DragImage instead of a DragImageRef, and to pass along the source action
        instead of whether it's a link or not.

        * loader/EmptyClients.cpp:
        * page/DragClient.h:
        * page/DragController.cpp:
        (WebCore::DragController::startDrag):
        (WebCore::DragController::doImageDrag):
        (WebCore::DragController::doSystemDrag):
        * page/DragController.h:

2017-02-15  Chris Dumez  <cdumez@apple.com>

        Expose Symbol.toPrimitive / valueOf on Location instances
        https://bugs.webkit.org/show_bug.cgi?id=168295

        Reviewed by Geoffrey Garen, Keith Miller and Mark Lam.

        Expose Symbol.toPrimitive / valueOf on Location instances as per:
        - https://html.spec.whatwg.org/#the-location-interface

        Firefox and Chrome already comply with the specification.

        Tests: fast/dom/location-valueOf-after-object-prototype-update.html
               fast/dom/location-valueOf-after-object-prototype-update2.html
               imported/w3c/web-platform-tests/html/browsers/history/the-location-interface/location-symbol-toprimitive.html
               imported/w3c/web-platform-tests/html/browsers/history/the-location-interface/location-valueof.html

        * bindings/scripts/CodeGeneratorJS.pm:
        (GenerateImplementation):

2017-02-15  Aakash Jain  <aakash_jain@apple.com>

        Remove WebIOSEvent interface
        https://bugs.webkit.org/show_bug.cgi?id=168368

        Reviewed by Tim Horton.

        * platform/ios/WebEvent.h: Removed WebIOSEvent.

2017-02-15  Chris Dumez  <cdumez@apple.com>

        [iOS] Form Validation Bubble should be sensitive to Dynamic Type
        https://bugs.webkit.org/show_bug.cgi?id=168291
        <rdar://problem/30508593>

        Reviewed by Tim Horton.

        Update ValidationBubble implementation on iOS to stop obeying the
        minimum font size setting, given that this setting is not exposed
        on iOS. Instead, we now rely on
        [UIFont preferredFontForTextStyle:UIFontTextStyleCallout], which
        will give us a font whose size obeys Dynamic Type [1] setting on iOS.

        [1] https://developer.apple.com/ios/human-interface-guidelines/visual-design/typography/

        No new tests, no easily testable.

        * platform/ios/ValidationBubbleIOS.mm:
        (WebCore::ValidationBubble::ValidationBubble):

2017-02-15  Yusuke Suzuki  <utatane.tea@gmail.com>

        [JSC] Drop PassRefPtr
        https://bugs.webkit.org/show_bug.cgi?id=168320

        Reviewed by Saam Barati.

        * bindings/js/ScriptSourceCode.h:
        (WebCore::ScriptSourceCode::ScriptSourceCode):
        Use Ref and pass it to SourceCode.

        * replay/ReplayController.cpp:
        (WebCore::ReplayController::frameNavigated):
        Pass reference.

2017-02-15  Xabier Rodriguez Calvar  <calvaris@igalia.com>

        [GStreamer][MSE][EME] Handle protection event also at decryptor level
        https://bugs.webkit.org/show_bug.cgi?id=168316

        Reviewed by Žan Doberšek.

        So far in MSE pipeline we were handling the encryption events
        only when they arrived at the demuxer but this won't work in any
        kind of key renegotiation as the event will never arrive. Now we
        connect to the element messages, check for the drm id and send it
        to the private player for processing.

        * platform/graphics/gstreamer/mse/AppendPipeline.cpp:
        (WebCore::appendPipelineElementMessageCallback):
        (WebCore::AppendPipeline::AppendPipeline):
        (WebCore::AppendPipeline::handleElementMessage):
        * platform/graphics/gstreamer/mse/AppendPipeline.h:

2017-02-15  Zan Dobersek  <zdobersek@igalia.com>

        [EME] MediaKeys::setServerCertificate() must resolve with 'false' when certificates aren't supported
        https://bugs.webkit.org/show_bug.cgi?id=168362

        Reviewed by Xabier Rodriguez-Calvar.

        In MediaKeys::setServerCertificate(), when the CDM implementation
        doesn't support server certificates, it should resolve the promise
        with the 'false' value, as mandated by the specification, and not
        reject it.

        A test case in mock-MediaKeys-setServerCertificate.html is updated.

        * Modules/encryptedmedia/MediaKeys.cpp:
        (WebCore::MediaKeys::setServerCertificate):

2017-02-15  Carlos Garcia Campos  <cgarcia@igalia.com>

        REGRESSION (r206014): HTTPHeaderMap does not consistently use comma without space to separate values of header fields
        https://bugs.webkit.org/show_bug.cgi?id=168115

        Reviewed by Darin Adler.

        In r206014 HTTPHeaderMap::add() was updated to combine common headers with ',' instead of ", " to match the
        fetch specification, but the uncommon headers are still combined with ", ".

        * platform/network/HTTPHeaderMap.cpp:
        (WebCore::HTTPHeaderMap::add):

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-15  Carlos Garcia Campos  <cgarcia@igalia.com>

        [GStreamer] Several tests are timing out after r212349
        https://bugs.webkit.org/show_bug.cgi?id=168359

        Reviewed by Žan Doberšek.

        This is because they are failing the cross origin check. Those tests are not using WebKitWebSrc, but
        GstFileSrc. I didn't consider the case of source not being a WebKitWebSrc.

        Fixes several timeout instroduced in r212349.

        * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
        (WebCore::MediaPlayerPrivateGStreamer::hasSingleSecurityOrigin): Split the source check in two. First check if
        it's nullptr, and return false. Then check if it's a WebKitWebSrc and return true if it isn't.

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-14  Carlos Garcia Campos  <cgarcia@igalia.com>

        [GStreamer] Implement MediaPlayerPrivate::hasSingleSecurityOrigin()
        https://bugs.webkit.org/show_bug.cgi?id=168322

        Reviewed by Žan Doberšek.

        It currently returns true unconditionally. Add resolved-location property to WebKitWebSourceGStreamer to track
        the resolved url returned by the server and use that from MediaPlayerPrivate to check if there was a cross
        origin redirection.

        Fixes: http/tests/security/canvas-remote-read-remote-video-redirect.html

        * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
        (WebCore::MediaPlayerPrivateGStreamer::hasSingleSecurityOrigin):
        * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h:
        * platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp:
        (webKitWebSrcFinalize):
        (webKitWebSrcGetProperty):
        (webKitWebSrcStart):
        (webKitWebSrcQueryWithParent):
        (webKitWebSrcGetUri):
        (webKitWebSrcSetUri):
        (StreamingClient::handleResponseReceived):
        (ResourceHandleStreamingClient::wasBlocked):
        (ResourceHandleStreamingClient::cannotShowURL):

2017-02-14  Carlos Garcia Campos  <cgarcia@igalia.com>

        Unreviewed, rolling out r211967.

        Caused rendering issues in HiDPI

        Reverted changeset:

        "[GTK] scroll with transparent background not repainted after
        scrollY >= 32768"
        https://bugs.webkit.org/show_bug.cgi?id=154283
        http://trac.webkit.org/changeset/211967

2017-02-14  Carlos Garcia Campos  <cgarcia@igalia.com>

        [GTK] Update cookie manager API to properly work with ephemeral sessions
        https://bugs.webkit.org/show_bug.cgi?id=168230

        Reviewed by Michael Catanzaro.

        Add implementation for deleteAllCookiesModifiedSince. Note that this only works when the timespan is 0, we need
        new libsoup API to support removing recently modified cookies.

        * platform/network/soup/CookieJarSoup.cpp:
        (WebCore::deleteAllCookiesModifiedSince):

2017-02-14  Joseph Pecoraro  <pecoraro@apple.com>

        [WebIDL] Improve serializer = { inherit }
        https://bugs.webkit.org/show_bug.cgi?id=168293

        Reviewed by Youenn Fablet.

        * bindings/scripts/CodeGeneratorJS.pm:
        (GenerateHeader):
        Expose a serialize() method on the interface.

        (GenerateSerializerFunction):
        (GenerateSerializerAttributesForInterface): Deleted.
        Subclasses that have `serializer = { inherit }` can use
        their parent's serialize() method to get the initial object.
        We can now collapse everything back into a single function
        because we only generate code for our own attributes.

        * bindings/scripts/test/JS/JSTestNode.cpp:
        (WebCore::JSTestNode::serialize):
        (WebCore::jsTestNodePrototypeFunctionToJSONCaller):
        * bindings/scripts/test/JS/JSTestNode.h:
        * bindings/scripts/test/JS/JSTestObj.cpp:
        (WebCore::JSTestObj::serialize):
        (WebCore::jsTestObjPrototypeFunctionToJSONCaller):
        * bindings/scripts/test/JS/JSTestObj.h:
        * bindings/scripts/test/JS/JSTestSerialization.cpp:
        (WebCore::JSTestSerialization::serialize):
        (WebCore::jsTestSerializationPrototypeFunctionToJSONCaller):
        * bindings/scripts/test/JS/JSTestSerialization.h:
        * bindings/scripts/test/JS/JSTestSerializationInherit.cpp:
        (WebCore::JSTestSerializationInherit::serialize):
        (WebCore::jsTestSerializationInheritPrototypeFunctionToJSONCaller):
        * bindings/scripts/test/JS/JSTestSerializationInherit.h:
        * bindings/scripts/test/JS/JSTestSerializationInheritFinal.cpp:
        (WebCore::JSTestSerializationInheritFinal::serialize):
        (WebCore::jsTestSerializationInheritFinalPrototypeFunctionToJSONCaller):
        * bindings/scripts/test/JS/JSTestSerializationInheritFinal.h:
        Updated results.

2017-02-14  Aakash Jain  <aakash_jain@apple.com>

        Move methods from WebCoreThread.h to WebCoreThreadInternal.h
        https://bugs.webkit.org/show_bug.cgi?id=168326

        Reviewed by Alexey Proskuryakov.

        * platform/ios/wak/WebCoreThread.h: Move methods WebThreadRunLoop and WebThreadCurrentContext to WebCoreThreadInternal.h
        * platform/ios/wak/WebCoreThreadInternal.h: Ditto.
        * platform/ios/wak/WebCoreThreadRun.cpp: Removed WebCoreThread.h as it is already included by WebCoreThreadInternal.h
        * platform/ios/wak/WKGraphics.mm: Included WebCoreThreadInternal.h, it subsequently includes WebCoreThread.h
        * inspector/InspectorTimelineAgent.cpp: Ditto.
        * page/mac/PageMac.mm: Ditto.
        * platform/cf/MainThreadSharedTimerCF.cpp: Ditto.
        * platform/cocoa/MemoryPressureHandlerCocoa.mm: Ditto.
        * platform/graphics/ca/cocoa/LayerFlushSchedulerMac.cpp: Ditto.
        * platform/network/cf/SynchronousResourceHandleCFURLConnectionDelegate.cpp: Ditto.
        * bindings/js/CommonVM.cpp: included WebCoreThreadInternal.h

2017-02-14  Wenson Hsieh  <wenson_hsieh@apple.com>

        [WK2] Support data interaction on links
        https://bugs.webkit.org/show_bug.cgi?id=168331
        <rdar://problem/30200837>

        Reviewed by Tim Horton.

        Adds support for data interaction on links at the WebCore layer, refactoring some drag-and-drop code on the Mac
        along the way. Also adds two new TestWebKitAPI unit tests in DataInteractionTests.mm: LinkToInput and
        BackgroundImageLinkToInput (see Tools/ChangeLog for more information).

        * page/DragController.cpp:
        (WebCore::DragController::startDrag):
        (WebCore::DragController::doImageDrag):
        (WebCore::DragController::doSystemDrag):

        Introduce platformAdjustDragImageForDeviceScaleFactor, and special-case drag images for links to anchor at the
        bottom center.

        * platform/DragImage.cpp:
        (WebCore::platformAdjustDragImageForDeviceScaleFactor):

        Scale the drag image up by the device scale factor. In WebDragClient, we scale the image back down to the
        original size. It seems the reason we do this extra dance is because the image sizing heuristic in between
        assumes that the image dimensions are for a non-retina device, but this work should really not be necessary if
        we tweak the heuristic to account for deviceScaleFactor. We should address this in a separate patch.

        * platform/DragImage.h:
        * platform/graphics/Path.h:

2017-02-14  Basuke Suzuki  <Basuke.Suzuki@am.sony.com>

        [CURL] ResourceError created with error information should have default type Type::General
        https://bugs.webkit.org/show_bug.cgi?id=168345

        Reviewed by Alex Christensen.

        ResourceError has separate implementaion for each platform
        so that the interface should be same.
        On CURL port, the constructor with error information has
        different default value on `type` parameter. It is Type::Null but other implementaitons have Type::General.
        This causes some ResourceError is created inconsistent. 

        * platform/network/curl/ResourceError.h:
        (WebCore::ResourceError::ResourceError):

2017-02-14  Youenn Fablet  <youennf@gmail.com>

        [WebRTC] Add support for libwebrtc negotiation needed event
        https://bugs.webkit.org/show_bug.cgi?id=168267

        Reviewed by Eric Carlson.

        Test: webrtc/negotiatedneeded-event-addStream.html

        Moving generic code (markAsNeedingNegotiation) from MediaEndpointPeerConnection to PeerConnectionBackend.
        This code handles the control of sending or not the negotiationneeded event.

        Updating mock to use markAsNeedingNegotiation when streams are changed.
        Updating libwebrtc backend to call markAsNeedingNegotiation when required by libwebrtc implementation.

        * Modules/mediastream/MediaEndpointPeerConnection.cpp:
        (WebCore::MediaEndpointPeerConnection::setLocalDescriptionTask):
        * Modules/mediastream/MediaEndpointPeerConnection.h:
        * Modules/mediastream/PeerConnectionBackend.cpp:
        (WebCore::PeerConnectionBackend::markAsNeedingNegotiation):
        * Modules/mediastream/PeerConnectionBackend.h:
        (WebCore::PeerConnectionBackend::isNegotiationNeeded):
        (WebCore::PeerConnectionBackend::clearNegotiationNeededState):
        * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp:
        (WebCore::LibWebRTCMediaEndpoint::OnRenegotiationNeeded):
        * Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.cpp:
        * Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.h:
        * testing/MockLibWebRTCPeerConnection.cpp:
        (WebCore::MockLibWebRTCPeerConnection::AddStream):
        (WebCore::MockLibWebRTCPeerConnection::RemoveStream):

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-14  Matt Rajca  <mrajca@apple.com>

        Website policies: iframes should respect the autoplay policy of the top-level document
        https://bugs.webkit.org/show_bug.cgi?id=168333

        Reviewed by Alex Christensen.

        API tests were added.

        * html/HTMLMediaElement.cpp:
        (WebCore::HTMLMediaElement::HTMLMediaElement):

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-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-14  Youenn Fablet  <youenn@apple.com>

        [WebRTC] Remove obsolete WebRTC stats API
        https://bugs.webkit.org/show_bug.cgi?id=167910

        Reviewed by Alex Christensen.

        No change of behavior as removed constructs are not functional.
        Removing RTCStatsResponse which no longer exists and made RTCStatsReport an empty container for now.

        * CMakeLists.txt:
        * DerivedSources.cpp:
        * DerivedSources.make:
        * Modules/mediastream/MediaEndpointPeerConnection.cpp:
        (WebCore::MediaEndpointPeerConnection::getStats):
        * Modules/mediastream/MediaEndpointPeerConnection.h:
        * Modules/mediastream/PeerConnectionBackend.h:
        * Modules/mediastream/RTCPeerConnection.cpp:
        (WebCore::RTCPeerConnection::getStats):
        * Modules/mediastream/RTCStatsReport.cpp:
        (WebCore::RTCStatsReport::create): Deleted.
        (WebCore::RTCStatsReport::RTCStatsReport): Deleted.
        (WebCore::RTCStatsReport::names): Deleted.
        (WebCore::RTCStatsReport::local): Deleted.
        (WebCore::RTCStatsReport::remote): Deleted.
        (WebCore::RTCStatsReport::addStatistic): Deleted.
        * Modules/mediastream/RTCStatsReport.h:
        (WebCore::RTCStatsReport::create):
        (WebCore::RTCStatsReport::timestamp): Deleted.
        (WebCore::RTCStatsReport::id): Deleted.
        (WebCore::RTCStatsReport::type): Deleted.
        (WebCore::RTCStatsReport::stat): Deleted.
        * Modules/mediastream/RTCStatsReport.idl:
        * Modules/mediastream/RTCStatsResponse.cpp: Removed.
        * Modules/mediastream/RTCStatsResponse.h: Removed.
        * Modules/mediastream/RTCStatsResponse.idl: Removed.
        * WebCore.xcodeproj/project.pbxproj:
        * platform/mediastream/MediaEndpoint.h:
        (WebCore::MediaEndpoint::getStats):
        * platform/mediastream/RTCStatsRequest.h: Removed.
        * platform/mediastream/RTCStatsResponseBase.h: Removed.

2017-02-14  Karim H  <karim@karhm.com>

        Removed unused methods of WebCore::FileStream
        https://bugs.webkit.org/show_bug.cgi?id=168025

        Reviewed by Michael Catanzaro.

        * fileapi/AsyncFileStream.cpp:
        (WebCore::AsyncFileStream::openForWrite): Deleted.
        (WebCore::AsyncFileStream::write): Deleted.
        (WebCore::AsyncFileStream::truncate): Deleted.
        * fileapi/AsyncFileStream.h:
        * platform/FileStream.cpp:
        (WebCore::FileStream::openForWrite): Deleted.
        (WebCore::FileStream::write): Deleted.
        (WebCore::FileStream::truncate): Deleted.
        * platform/FileStream.h:

2017-02-14  Chris Dumez  <cdumez@apple.com>

        HTML Form Validation bubble should take minimum font size setting into consideration
        https://bugs.webkit.org/show_bug.cgi?id=168271
        <rdar://problem/29869869>

        Reviewed by Simon Fraser.

        HTML Form Validation bubble should take minimum font size setting into consideration
        for better accessibility.

        Test: fast/forms/validation-message-minimum-font-size.html

        * platform/ValidationBubble.h:
        (WebCore::ValidationBubble::create):
        (WebCore::ValidationBubble::fontSize):
        * platform/ios/ValidationBubbleIOS.mm:
        (WebCore::ValidationBubble::ValidationBubble):
        * platform/mac/ValidationBubbleMac.mm:
        (WebCore::ValidationBubble::ValidationBubble):
        Update the ValidationBubble constructor to take in Settings. For now, there is a
        single setting that is the minimum font size and that is taken into account when
        setting the font size of the validation bubble text.

2017-02-14  Eric Carlson  <eric.carlson@apple.com>

        [MediaStream] add navigator.getUserMedia for compatibility with legacy content
        https://bugs.webkit.org/show_bug.cgi?id=168324
        <rdar://problem/30513125>

        Reviewed by Youenn Fablet.

        Tests: fast/mediastream/argument-types.html
               fast/mediastream/getusermedia.html
               fast/mediastream/webkitGetUserMedia-shadowing-then.html

        * CMakeLists.txt:
        * DerivedSources.cpp:
        * DerivedSources.make:
        * Modules/mediastream/MediaDevices.idl:
        * Modules/mediastream/NavigatorUserMedia.idl: Added.
        * Modules/mediastream/NavigatorUserMedia.js: Added.
        * WebCore.xcodeproj/project.pbxproj:
        * bindings/js/WebCoreBuiltinNames.h:
        * page/Navigator.idl:

2017-02-14  Chris Dumez  <cdumez@apple.com>

        Fallback to legacy type only when event is trusted
        https://bugs.webkit.org/show_bug.cgi?id=168301

        Reviewed by Ryosuke Niwa.

        Fallback to legacy type only when event is trusted as per a recent
        DOM specification change:
        - https://github.com/whatwg/dom/issues/404
        - https://github.com/whatwg/dom/pull/406

        No new tests, rebaselined existing test.

        * dom/EventTarget.cpp:
        (WebCore::legacyType):
        (WebCore::EventTarget::fireEventListeners):

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-14  Youenn Fablet  <youennf@gmail.com>

        [WebRTC] Implement description getters for libwebrtc RTCPeerConnection
        https://bugs.webkit.org/show_bug.cgi?id=168234

        Reviewed by Alex Christensen.

        Allows passing W3C webrtc tests.

        Implementing localDescription/remoteDescription using libwebrtc backend.
        current and pending description getters are made the same as local/remote getters for the moment.
        This should be fixed when upgrading to latest libwebrtc revision.

        * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp:
        (WebCore::toSessionDescriptionType):
        (WebCore::fromSessionDescriptionType):
        (WebCore::fromSessionDescription):
        (WebCore::LibWebRTCMediaEndpoint::localDescription):
        (WebCore::LibWebRTCMediaEndpoint::remoteDescription):
        (WebCore::LibWebRTCMediaEndpoint::doSetLocalDescription):
        (WebCore::LibWebRTCMediaEndpoint::doSetRemoteDescription):
        * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.h:
        * Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.cpp:
        (WebCore::LibWebRTCPeerConnectionBackend::localDescription):
        * Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.h:

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-14  Jer Noble  <jer.noble@apple.com>

        Video elements with MediaSource objects set by srcObject are not cleared when srcObject is set to null
        https://bugs.webkit.org/show_bug.cgi?id=168268

        Reviewed by Eric Carlson.

        Test: fast/mediastream/MediaStream-MediaElement-setObject-null.html

        Make the setSrcObject() operation compliant with the HTML spec. Since the specification defines
        srcObject in terms of either a MediaSource, MediaStream, or Blob object, add the variant typedef
        to HTMLMediaElement and move the definition out of the Modules/mediastream extension IDL and into
        HTMLMediaElement.idl. Then bring the "media elements load" and "resource selection" algorithms up
        to their most recent definitions in the HTML5 spec.

        Drive-by fix: Allow the (admittedly weird) single-element-union type in IDL.

        * CMakeLists.txt:
        * DerivedSources.cpp:
        * DerivedSources.make:
        * Modules/mediastream/HTMLMediaElementMediaStream.cpp: Removed.
        * Modules/mediastream/HTMLMediaElementMediaStream.h: Removed.
        * Modules/mediastream/HTMLMediaElementMediaStream.idl: Removed.
        * WebCore.xcodeproj/project.pbxproj:
        * bindings/scripts/IDLParser.pm:
        (parseUnionType):
        * html/HTMLAudioElement.cpp:
        (WebCore::HTMLAudioElement::createForJSConstructor):
        * html/HTMLMediaElement.cpp:
        (WebCore::actionName):
        (WebCore::HTMLMediaElement::parseAttribute):
        (WebCore::HTMLMediaElement::insertedInto):
        (WebCore::HTMLMediaElement::scheduleDelayedAction):
        (WebCore::HTMLMediaElement::scheduleNextSourceChild):
        (WebCore::HTMLMediaElement::pendingActionTimerFired):
        (WebCore::HTMLMediaElement::setSrcObject):
        (WebCore::HTMLMediaElement::load):
        (WebCore::HTMLMediaElement::prepareForLoad):
        (WebCore::HTMLMediaElement::selectMediaResource):
        (WebCore::HTMLMediaElement::loadResource):
        (WebCore::HTMLMediaElement::playInternal):
        (WebCore::HTMLMediaElement::pauseInternal):
        (WebCore::HTMLMediaElement::sourceWasAdded):
        (WebCore::HTMLMediaElement::clearMediaPlayer):
        (WebCore::HTMLMediaElement::resume):
        (WebCore::HTMLMediaElement::mediaCanStart):
        (WebCore::HTMLMediaElement::createMediaPlayer):
        (WebCore::HTMLMediaElement::loadInternal): Deleted.
        * html/HTMLMediaElement.h:
        (WebCore::HTMLMediaElement::srcObject):
        * html/HTMLMediaElement.idl:
        * platform/ContentType.h:

2017-02-14  Aakash Jain  <aakash_jain@apple.com>

        Remove unused WebThreadContextIsCurrent method from WebCoreThread.h
        https://bugs.webkit.org/show_bug.cgi?id=168254

        Reviewed by Dan Bernstein.

        * platform/ios/wak/WebCoreThread.h: Removed unused WebThreadContextIsCurrent.
        * platform/ios/wak/WebCoreThread.mm:
        (WebThreadContextIsCurrent): Deleted.

2017-02-14  Alexey Proskuryakov  <ap@apple.com>

        WebCore shouldn't export SystemMemory.h
        https://bugs.webkit.org/show_bug.cgi?id=168285

        Reviewed by Alex Christensen.

        * WebCore.xcodeproj/project.pbxproj:

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-14  Zan Dobersek  <zdobersek@igalia.com>

        HTMLMediaElement: WebKitMediaKeys member name should be prefixed
        https://bugs.webkit.org/show_bug.cgi?id=168297

        Reviewed by Xabier Rodriguez-Calvar.

        Rename the LEGACY_ENCRYPTED_MEDIA m_mediaKeys variable to m_webkitMediaKeys
        so that it contains the legacy prefix, just like the API. This will make
        room for the MediaKeys member variable that will be implemented under
        the ENCRYPTED_MEDIA guards.

        * html/HTMLMediaElement.cpp:
        (WebCore::HTMLMediaElement::mediaPlayerCachedKeyForKeyId):
        (WebCore::HTMLMediaElement::webkitSetMediaKeys):
        * html/HTMLMediaElement.h:
        (WebCore::HTMLMediaElement::webkitKeys):

2017-02-14  Carlos Garcia Campos  <cgarcia@igalia.com>

        [GTK] Make DragImageRef a RefPtr instead of a plain pointer
        https://bugs.webkit.org/show_bug.cgi?id=168296

        Reviewed by Sergio Villar Senin.

        Use RefPtr<cairo_surface_t> as DragImageRef for GTK+ port to avoid memory leaks.

        * platform/DragImage.h:
        * platform/gtk/DragImageGtk.cpp:
        (WebCore::dragImageSize):
        (WebCore::deleteDragImage):
        (WebCore::scaleDragImage):
        (WebCore::dissolveDragImageToFraction):
        (WebCore::createDragImageFromImage):
        (WebCore::createDragImageIconForCachedImageFilename):

2017-02-14  Vanessa Chipirrás Navalón  <vchipirras@igalia.com>

        [GStreamer][MSE] Some GStreamer log messages are generated with the 'default' category
        https://bugs.webkit.org/show_bug.cgi?id=168015

        Reviewed by Xabier Rodriguez-Calvar.

        The elements AppendPipeline, PlaybackPipeline, MediaSourceClientGstreamerMSE do not have
        a defined Gstreamer log category, then the webkitmse category has been added to them.
        WebKitMediaSourceGstreamer has its own category but was not declared at the beginning of
        the .cpp file.

        * platform/graphics/gstreamer/mse/AppendPipeline.cpp: Added webkitmse category.
        * platform/graphics/gstreamer/mse/MediaSourceClientGStreamerMSE.cpp:
        Added webkitmse category and gst header.
        * platform/graphics/gstreamer/mse/PlaybackPipeline.cpp: Added webkitmse category.
        * platform/graphics/gstreamer/mse/WebKitMediaSourceGStreamer.cpp:
        Added webkitmediasrc category.

2017-02-14  Carlos Garcia Campos  <cgarcia@igalia.com>

        CookieManager only works with the default session
        https://bugs.webkit.org/show_bug.cgi?id=168229

        Reviewed by Alex Christensen.

        Update cookie observer API to use a std::function instead of a function pointer and make it work with multiple
        sessions in the backends that support it.

        * platform/network/CookieStorage.h:
        * platform/network/cf/CookieStorageCFNet.cpp:
        (WebCore::cookieChangeCallbackMap):
        (WebCore::notifyCookiesChanged):
        (WebCore::startObservingCookieChanges):
        (WebCore::stopObservingCookieChanges):
        * platform/network/mac/CookieStorageMac.mm:
        (-[WebCookieStorageObjCAdapter startListeningForCookieChangeNotificationsWithCallback:]):
        (-[WebCookieStorageObjCAdapter stopListeningForCookieChangeNotifications]):
        (WebCore::startObservingCookieChanges):
        (WebCore::stopObservingCookieChanges):
        * platform/network/soup/CookieStorageSoup.cpp:
        (WebCore::cookieChangeCallbackMap):
        (WebCore::soupCookiesChanged):
        (WebCore::startObservingCookieChanges):
        (WebCore::stopObservingCookieChanges):

2017-02-13  Antoine Quint  <graouts@apple.com>

        REGRESSION: Update volume and scrubbing slider to match HI designs
        https://bugs.webkit.org/show_bug.cgi?id=168170
        <rdar://problem/28095266>

        Reviewed by Dean Jackson.

        We bring the designs of the control's background materials, scrubber and
        volume slider up to spec.

        The first important set of changes is that, on macOS, the materials and colors
        were incorrect. Buttons and time labels now set a mix-blend-mode to correctly
        appear vibrant against the media, and the controls bar, volume container
        and tracks menu now use a new BackgroundTint node to correctly apply both
        a backdrop-filter and blended tint above it.

        The second important set of changes is the rendering of the sliders. Up to now
        we would simply style the <input type="range"> track and thumb, applying solid
        fills and strokes. We now draw sliders in two ways depending on the platform.
        
        On macOS, we draw the whole slider with a <canvas> element with "mix-blend-mode"
        set to "plus-lighter". On iOS, we draw the track as a <div> with "mix-blend-mode"
        set to "plus-darker" and draw the fill (up to the thumb) in the <canvas> with
        no blend mode to obtain a pure white color, finally the thumb is rendered by the
        <input> element. We couldn't draw the pure white color with the track in the
        same <canvas> due to the "plus-darker" blend mode.

        Test: media/modern-media-controls/background-tint/background-tint.html

        * Modules/modern-media-controls/controls/airplay-button.css:
        (button.airplay.on):
        * Modules/modern-media-controls/controls/background-tint.css: Added.
        (.background-tint):
        (.background-tint,):
        (.background-tint > .blur):
        (.background-tint > .tint):
        * Modules/modern-media-controls/controls/background-tint.js: Added.
        (BackgroundTint):
        * Modules/modern-media-controls/controls/ios-inline-media-controls.css:
        (.media-controls.ios.inline .scrubber.slider):
        (.media-controls.ios.inline .scrubber.slider > div):
        (.media-controls.ios.inline .scrubber.slider > input::-webkit-slider-thumb):
        (.media-controls.ios.inline .scrubber.slider > .fill): Deleted.
        * Modules/modern-media-controls/controls/macos-compact-inline-media-controls.css:
        (.media-controls.mac.inline.compact .volume-slider-container):
        (.media-controls.mac.inline.compact .volume.slider):
        (.media-controls.mac.inline.compact .scrubber.slider > input::-webkit-slider-thumb): Deleted.
        * Modules/modern-media-controls/controls/macos-fullscreen-media-controls.css:
        (.media-controls.mac.fullscreen > .controls-bar):
        (.media-controls.mac.fullscreen > .controls-bar > .background-tint > div):
        (.media-controls.mac.fullscreen .volume.slider):
        (.media-controls.mac.fullscreen button.volume-up):
        (.media-controls.mac.fullscreen button.rewind):
        (.media-controls.mac.fullscreen button.forward):
        (.media-controls.mac.fullscreen .buttons-container.right button):
        (.media-controls.mac.fullscreen .scrubber):
        (.media-controls.mac.fullscreen > .controls-bar button): Deleted.
        (.media-controls.mac.fullscreen button.airplay): Deleted.
        (.media-controls.mac.fullscreen button.aspect-ratio): Deleted.
        (.media-controls.mac.fullscreen button.pip): Deleted.
        (.media-controls.mac.fullscreen button.tracks): Deleted.
        (.media-controls.mac.fullscreen button.fullscreen): Deleted.
        * Modules/modern-media-controls/controls/macos-fullscreen-media-controls.js:
        * Modules/modern-media-controls/controls/macos-inline-media-controls.css:
        (.media-controls.mac.inline .scrubber.slider):
        (.media-controls.mac.inline .volume-slider-container):
        (.media-controls.mac.inline .volume-slider-container > .background-tint):
        (.media-controls.mac.inline .volume-slider-container > .background-tint > div):
        (.media-controls.mac.inline .volume.slider):
        (.media-controls.mac.inline button): Deleted.
        (.media-controls.mac.inline button:active): Deleted.
        (.media-controls.mac.inline > .controls-bar button): Deleted.
        (.media-controls.mac.inline > .controls-bar,): Deleted.
        (.media-controls.mac.inline .volume-slider-container:before): Deleted.
        * Modules/modern-media-controls/controls/macos-inline-media-controls.js:
        (MacOSInlineMediaControls.prototype.layout):
        * Modules/modern-media-controls/controls/macos-media-controls.css: Added.
        (.media-controls.mac button:active):
        (.media-controls.mac > .controls-bar button):
        (.media-controls.mac > .controls-bar .time-label):
        (.media-controls.mac > .controls-bar .slider > canvas):
        (.media-controls.mac > .controls-bar .slider > input::-webkit-slider-thumb):
        * Modules/modern-media-controls/controls/scrubber.css: Removed.
        * Modules/modern-media-controls/controls/scrubber.js:
        (Scrubber):
        (Scrubber.prototype.get buffered):
        (Scrubber.prototype.set buffered):
        (Scrubber.prototype.draw):
        (Scrubber.prototype._drawMacOS):
        (Scrubber.prototype._drawiOS):
        * Modules/modern-media-controls/controls/slider.css:
        (.slider):
        (.slider > canvas,):
        (.slider > canvas):
        (.slider > input):
        (.slider > input,): Deleted.
        (.slider > .fill): Deleted.
        (.slider > input::-webkit-slider-thumb): Deleted.
        * Modules/modern-media-controls/controls/slider.js:
        (Slider.prototype.set value):
        (Slider.prototype.set width):
        (Slider.prototype.commitProperty):
        (Slider.prototype.layout):
        (Slider.prototype.draw):
        (Slider.prototype._handleInputEvent):
        (Slider.prototype._handleChangeEvent):
        (addRoundedRect):
        (Slider.prototype._updateFill): Deleted.
        * Modules/modern-media-controls/controls/start-button.css:
        (button.start):
        * Modules/modern-media-controls/controls/time-control.js:
        * Modules/modern-media-controls/controls/time-label.css:
        (.time-label):
        * Modules/modern-media-controls/controls/tracks-panel.css:
        (.tracks-panel):
        (.tracks-panel > .background-tint > div):
        (.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):
        (.tracks-panel-section): Deleted.
        (.tracks-panel-section:first-of-type): Deleted.
        (.tracks-panel-section > h3): Deleted.
        (.tracks-panel-section > ul): Deleted.
        (.tracks-panel-section > ul > li): Deleted.
        (.tracks-panel-section > ul > li:focus): Deleted.
        (.tracks-panel-section > ul > li.selected:before): Deleted.
        (.tracks-panel-section > ul > li.animated): Deleted.
        * Modules/modern-media-controls/controls/tracks-panel.js:
        (TracksPanel.prototype._childrenFromDataSource):
        (TracksPanel.prototype._childrenFromDataSource.): Deleted.
        * Modules/modern-media-controls/controls/volume-slider.js:
        (VolumeSlider):
        (VolumeSlider.prototype.handleEvent):
        (VolumeSlider.prototype.draw):
        * Modules/modern-media-controls/js-files:
        * Modules/modern-media-controls/media/scrubbing-support.js:
        (ScrubbingSupport.prototype.get mediaEvents):
        (ScrubbingSupport.prototype.syncControl):
        (ScrubbingSupport):

2017-02-13  Alex Christensen  <achristensen@webkit.org>

        URLs with an invalid IPv4 address should be invalid
        https://bugs.webkit.org/show_bug.cgi?id=168260

        Reviewed by Tim Horton.

        All URL hosts are fed through the IPv4 parser.  https://webkit.org/ doesn't
        look enough like an IPv4 address to be considered an invalid IPv4 address, so 
        we continue to the String host processing.  http://127.0.0.257 does, though, and
        according to https://url.spec.whatwg.org/#concept-ipv4-parser parsing that URL
        should fail.

        Covered by newly passing web platform tests.

        * platform/URLParser.cpp:
        (WebCore::URLParser::parseIPv4Host):
        (WebCore::URLParser::parseHostAndPort):
        * platform/URLParser.h:

2017-02-13  Dan Bernstein  <mitz@apple.com>

        Reverted r212275. It still breaks some Apple-internal builds.

        * platform/spi/mac/TUCallSPI.h:

2017-02-13  Joseph Pecoraro  <pecoraro@apple.com>

        Address ESLint warnings in modern-media-controls
        https://bugs.webkit.org/show_bug.cgi?id=168224

        Reviewed by Alexey Proskuryakov.

        * Modules/modern-media-controls/controls/controls-bar.js:
        * Modules/modern-media-controls/controls/fullscreen-button.js:
        * Modules/modern-media-controls/controls/layout-node.js:
        * Modules/modern-media-controls/controls/macos-fullscreen-media-controls.js:
        * Modules/modern-media-controls/controls/media-controls.js:
        * Modules/modern-media-controls/controls/scheduler.js:
        * Modules/modern-media-controls/controls/seek-button.js:
        * Modules/modern-media-controls/controls/tracks-panel.js:
        * Modules/modern-media-controls/controls/volume-slider.js:
        * Modules/modern-media-controls/gesture-recognizers/gesture-recognizer.js:
        * Modules/modern-media-controls/gesture-recognizers/pinch.js:
        * Modules/modern-media-controls/media/fullscreen-support.js:
        * Modules/modern-media-controls/media/media-controller.js:
        * Modules/modern-media-controls/media/placard-support.js:
        * Modules/modern-media-controls/media/status-support.js:
        Address pedantic warnings.

2017-02-13  Dan Bernstein  <mitz@apple.com>

        Restored changes from r212210 in a way that does not break the build.

        * platform/spi/mac/TUCallSPI.h:

2017-02-13  Zalan Bujtas  <zalan@apple.com>

        FontCascade::widthForSimpleText should skip applyTransforms() when kerning and ligatures are off.
        https://bugs.webkit.org/show_bug.cgi?id=168251
        <rdar://problem/30498102>

        Reviewed by Antti Koivisto.

        Covered by existing (perf)tests.

        * platform/graphics/FontCascade.cpp:
        (WebCore::FontCascade::widthForSimpleText):

2017-02-12  Brian Burg  <bburg@apple.com>

        Web Inspector: expose system user interface layout direction through InspectorFrontendHost
        https://bugs.webkit.org/show_bug.cgi?id=168209
        <rdar://problem/11573736>

        Reviewed by Joseph Pecoraro.

        Forward the UserInterfaceLayoutDirection of the inspector page. If the WebKit client has
        properly set the UI directionality from system settings in PageClient, this will get inherited
        automatically by the Inspector's WebPage instance.

        * inspector/InspectorFrontendClient.h:
        * inspector/InspectorFrontendClientLocal.cpp:
        (WebCore::InspectorFrontendClientLocal::userInterfaceLayoutDirection):
        * inspector/InspectorFrontendClientLocal.h:

        * inspector/InspectorFrontendHost.h:
        * inspector/InspectorFrontendHost.idl:
        * inspector/InspectorFrontendHost.cpp:
        (WebCore::InspectorFrontendHost::userInterfaceLayoutDirection):
        Expose the directionality to the frontend as "ltr" or "rtl" strings.

2017-02-13  Zalan Bujtas  <zalan@apple.com>

        Simple line layout: Do not measure runs with trailing whitespace when kerning and ligatures are off.
        https://bugs.webkit.org/show_bug.cgi?id=168247
        <rdar://problem/30497288>

        Reviewed by Antti Koivisto.

        The width of the run is supposed to be the same with or without the trailing whitespace.

        Covered by performance test.

        * rendering/SimpleLineLayoutTextFragmentIterator.cpp:
        (WebCore::SimpleLineLayout::TextFragmentIterator::Style::Style):
        (WebCore::SimpleLineLayout::TextFragmentIterator::textWidth):
        * rendering/SimpleLineLayoutTextFragmentIterator.h:

2017-02-13  Karim H  <karim@karhm.com>

        Added the other missing BSTR roles tag names.
        https://bugs.webkit.org/show_bug.cgi?id=165545

        Reviewed by Chris Fleizach.

        Test: accessibility/win/bstr-elements-role.html

        * accessibility/AccessibilityRenderObject.cpp:
        (WebCore::shouldReturnTagNameAsRoleForMSAA):

2017-02-13  Youenn Fablet  <youennf@gmail.com>

        [WebRTC] Creating RTCPeerConnection with libwebrtc backend is crashing on rwt
        https://bugs.webkit.org/show_bug.cgi?id=168250

        Reviewed by Alex Christensen.

        Covered by webrtc tests in LayoutTests and in web-platform-tests.
        Making mock peer connection factory keep a ref of the real libwebrtc peer connection factory.
        That way, it can create real libwebrtc backends whenever requested by tests.

        Moving LibWebRTCUtils.h routines as static LibWebRTCProvider methods.
        In the future, we should make them no longer static.

        * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp:
        (WebCore::LibWebRTCMediaEndpoint::doCreateOffer):
        (WebCore::LibWebRTCMediaEndpoint::doCreateAnswer):
        * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.h:
        * WebCore.xcodeproj/project.pbxproj:
        * platform/mediastream/libwebrtc/LibWebRTCProvider.cpp: Renamed from Source/WebCore/platform/mediastream/libwebrtc/LibWebRTCUtils.cpp.
        (WebCore::LibWebRTCProvider::callOnWebRTCNetworkThread):
        (WebCore::LibWebRTCProvider::callOnWebRTCSignalingThread):
        (WebCore::LibWebRTCProvider::factory):
        (WebCore::LibWebRTCProvider::setPeerConnectionFactory):
        (WebCore::createActualPeerConnection):
        (WebCore::LibWebRTCProvider::createPeerConnection):
        * platform/mediastream/libwebrtc/LibWebRTCProvider.h:
        * platform/mediastream/libwebrtc/LibWebRTCUtils.h: Removed.
        * platform/mediastream/mac/RealtimeOutgoingAudioSource.cpp:
        (WebCore::RealtimeOutgoingAudioSource::audioSamplesAvailable):
        * testing/Internals.cpp:
        * testing/MockLibWebRTCPeerConnection.cpp:
        (WebCore::useMockRTCPeerConnectionFactory):
        (WebCore::MockLibWebRTCPeerConnectionForIceCandidates::gotLocalDescription):
        (WebCore::releaseInNetworkThread):
        (WebCore::MockLibWebRTCPeerConnection::SetLocalDescription):
        (WebCore::MockLibWebRTCPeerConnection::SetRemoteDescription):
        (WebCore::MockLibWebRTCPeerConnection::CreateOffer):
        (WebCore::MockLibWebRTCPeerConnection::CreateAnswer):

2017-02-13  Anders Carlsson  <andersca@apple.com>

        Simplify DragController::startDrag
        https://bugs.webkit.org/show_bug.cgi?id=168240

        Reviewed by Tim Horton.

        Use early returns instead of assigning to a variable that's returned at the end of the function.

        * page/DragController.cpp:
        (WebCore::DragController::startDrag):

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-13  Myles C. Maxfield  <mmaxfield@apple.com>

        [Cocoa] Stop soft-linking CTRunGetBaseAdvancesAndOrigins()
        https://bugs.webkit.org/show_bug.cgi?id=168256

        Reviewed by Alex Christensen.

        Use of this function is already behind a platform guard.

        No new tests because there is no behavior change.

        * platform/graphics/mac/ComplexTextControllerCoreText.mm:
        (SOFT_LINK): Deleted.

2017-02-13  Jiewen Tan  <jiewen_tan@apple.com>

        [WebCrypto] WebInspector should indicate webkitSubtle is deprecated
        https://bugs.webkit.org/show_bug.cgi?id=165913
        <rdar://problem/30477222>

        Reviewed by Joseph Pecoraro.

        Covered by existing tests.

        * page/Crypto.cpp:
        (WebCore::Crypto::webkitSubtle):

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-13  Youenn Fablet  <youenn@apple.com>

        ASSERTION FAILED: !m_bodyLoader
        https://bugs.webkit.org/show_bug.cgi?id=166986

        Reviewed by Sam Weinig.

        Refactoring to make the unset/set pending activity part of body loader.
        This allows ensuring to not forget to do that by simply deleting the body loader.

        * Modules/fetch/FetchResponse.cpp:
        (WebCore::FetchResponse::fetch):
        (WebCore::FetchResponse::BodyLoader::didSucceed):
        (WebCore::FetchResponse::BodyLoader::didFail):
        (WebCore::FetchResponse::BodyLoader::BodyLoader):
        (WebCore::FetchResponse::BodyLoader::~BodyLoader):
        (WebCore::FetchResponse::stop):
        * Modules/fetch/FetchResponse.h:

2017-02-13  Aakash Jain  <aakash_jain@apple.com>

        Remove unused WebCoreThreadSafe.h
        https://bugs.webkit.org/show_bug.cgi?id=168236

        Reviewed by Dan Bernstein.

        * platform/ios/wak/WebCoreThreadSafe.h: Removed.
        * WebCore.xcodeproj/project.pbxproj: Removed WebCoreThreadSafe.h
        * platform/ios/wak/WebCoreThread.mm: Removed WebCoreThreadSafe.h and included WAKWindow.h directly

2017-02-13  Anders Carlsson  <andersca@apple.com>

        Fix iOS build.

        * platform/ios/DragImageIOS.mm:
        (WebCore::deleteDragImage):

2017-02-13  Sam Weinig  <sam@webkit.org>

        Rename MediaQueryExp.h/cpp to MediaQueryExpression.h/cpp
        https://bugs.webkit.org/show_bug.cgi?id=168249

        Reviewed by Dean Jackson.

        Fix a FIXME and rename MediaQueryExp.h/cpp to match the class it contains, MediaQueryExpression.

        * CMakeLists.txt:
        * WebCore.xcodeproj/project.pbxproj:
        * css/CSSAllInOne.cpp:
        * css/MediaQuery.h:
        * css/MediaQueryEvaluator.h:
        * css/MediaQueryExp.cpp: Removed.
        * css/MediaQueryExp.h: Removed.
        * css/MediaQueryExpression.cpp: Copied from Source/WebCore/css/MediaQueryExp.cpp.
        * css/MediaQueryExpression.h: Copied from Source/WebCore/css/MediaQueryExp.h.
        * css/parser/MediaQueryParser.h:

2017-02-13  Aakash Jain  <aakash_jain@apple.com>

        WAKResponder should be exported from WebCore
        https://bugs.webkit.org/show_bug.cgi?id=168245

        Reviewed by Dan Bernstein.

        * platform/ios/wak/WAKResponder.h:

2017-02-13  Simon Fraser  <simon.fraser@apple.com>

        Log to the History Channel in a few more places
        https://bugs.webkit.org/show_bug.cgi?id=168252

        Reviewed by Brady Eidson.

        *** Aliens ***

        * loader/HistoryController.cpp:
        (WebCore::HistoryController::restoreScrollPositionAndViewState):
        (WebCore::HistoryController::updateForReload):
        * loader/NavigationScheduler.cpp:
        (WebCore::NavigationScheduler::scheduleHistoryNavigation):
        (WebCore::NavigationScheduler::timerFired):
        (WebCore::NavigationScheduler::cancel):
        * page/History.cpp:
        (WebCore::History::go):

2017-02-13  Alex Christensen  <achristensen@webkit.org>

        Percent should be allowed in non-special URL hosts
        https://bugs.webkit.org/show_bug.cgi?id=168255

        Reviewed by Tim Horton.

        In the last few weeks, the spec has consolidated its sets of code points.
        Now forbidden host code points replace the old invalid host code points with
        the modification that percents are allowed in non-special hosts because we
        percent-encode non-ascii code points in non-special hosts.
        See https://url.spec.whatwg.org/#concept-opaque-host-parser

        Covered by newly passing web platform tests.

        * platform/URLParser.cpp:
        (WebCore::isC0Control):
        (WebCore::isInUserInfoEncodeSet):
        (WebCore::URLParser::hasForbiddenHostCodePoint):
        (WebCore::URLParser::parseHostAndPort):
        (WebCore::isInvalidDomainCharacter): Deleted.
        (WebCore::URLParser::hasInvalidDomainCharacter): Deleted.
        * platform/URLParser.h:

2017-02-13  Anders Carlsson  <andersca@apple.com>

        Fix Windows build.

        * platform/win/PasteboardWin.cpp:
        (WebCore::Pasteboard::setDragImage):

2017-02-13  Alex Christensen  <achristensen@webkit.org>

        Fix Yosemite build after r211765
        https://bugs.webkit.org/show_bug.cgi?id=168246
        <rdar://problem/30494174>

        Reviewed by Brady Eidson.

        * platform/graphics/mac/ComplexTextControllerCoreText.mm:
        (SOFT_LINK):

2017-02-13  Anders Carlsson  <andersca@apple.com>

        Add a DragImage class that wraps a DragImageRef
        https://bugs.webkit.org/show_bug.cgi?id=168131

        Reviewed by Beth Dakin.

        This allows us to get rid of the explicit deleteDragImage calls and will make additional cleanup of the
        various drag code paths possible. No functionality change.

        * dom/DataTransfer.cpp:
        (WebCore::DataTransfer::updateDragImage):
        * page/DragController.cpp:
        (WebCore::DragController::startDrag):
        (WebCore::DragController::doImageDrag):
        (WebCore::DragController::doSystemDrag):
        * page/DragController.h:
        * platform/DragImage.cpp:
        (WebCore::DragImage::DragImage):
        (WebCore::DragImage::operator=):
        (WebCore::DragImage::~DragImage):
        * platform/DragImage.h:
        * platform/Pasteboard.h:
        * platform/StaticPasteboard.h:
        * platform/mac/PasteboardMac.mm:
        (WebCore::Pasteboard::setDragImage):

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-13  Myles C. Maxfield  <mmaxfield@apple.com>

        Update custom line breaking iterators to the latest version of Unicode
        https://bugs.webkit.org/show_bug.cgi?id=168182

        Reviewed by Zalan Bujtas.

        Clean up our breaking code to be more descriptive about the difference between
        line-break: auto vs line-break: loose | normal | strict. The only difference is
        that we have some hardcoded tables to speed up character iteration for
        line-break: auto.

        Tests: TestWebKitAPI WebKit2.LineBreaking

        * rendering/BreakLines.h:
        (WebCore::nextBreakablePosition):
        (WebCore::nextBreakablePositionIgnoringNBSP):
        (WebCore::nextBreakablePositionWithoutShortcut):
        (WebCore::nextBreakablePositionIgnoringNBSPWithoutShortcut):
        (WebCore::isBreakable):
        (WebCore::nextBreakablePositionNonLoosely): Deleted.
        (WebCore::nextBreakablePositionLoosely): Deleted.
        (WebCore::nextBreakablePositionLoose): Deleted.
        (WebCore::nextBreakablePositionIgnoringNBSPLoose): Deleted.
        * rendering/RenderText.cpp:
        (WebCore::RenderText::computePreferredLogicalWidths):
        * rendering/SimpleLineLayoutTextFragmentIterator.cpp:
        (WebCore::SimpleLineLayout::nextBreakablePositionInSegment):
        * rendering/line/BreakingContext.h:
        (WebCore::BreakingContext::handleText):
        (WebCore::BreakingContext::optimalLineBreakLocationForTrailingWord):

2017-02-13  Youenn Fablet  <youenn@apple.com>

        Remove @getUserMedia identifier
        https://bugs.webkit.org/show_bug.cgi?id=168216

        Reviewed by Sam Weinig.

        No change of behavior.

        * Modules/mediastream/MediaDevices.idl:
        * bindings/js/WebCoreBuiltinNames.h:

2017-02-13  Carlos Garcia Campos  <cgarcia@igalia.com>

        [GTK] Non-accelerated drawing is broken with HiDPI
        https://bugs.webkit.org/show_bug.cgi?id=168128

        Reviewed by Michael Catanzaro.

        When device scale factor changes, the page notifies the page overlay controller about it. Then overlay root
        layers are created to be notified about the device scale factor. That causes us to enter in accelerated
        compositing mode, because the graphics layer factory is called. But the render layer compositor doesn't really
        enter in accelerated mode, because there aren't page overlays, the accelerated mode is not forced and the website
        doesn't require acceleration either. This leaves our drawing area in an inconsistent state, it thinks it's in AC
        mode because it has a layer tree host, but without a root layer attached, so nothing is rendered. The page
        overlay controller doesn't need to create the layers when device scale factor changes, when an overlay is
        installed, layers will be created with the current device scale factor anyway.

        * page/PageOverlayController.cpp:
        (WebCore::PageOverlayController::didChangeDeviceScaleFactor): Return early if not initialized yet.

2017-02-13  Csaba Osztrogonác  <ossy@webkit.org>

        REGRESSION(r210845) Build broken with ENABLE_MHTML disabled
        https://bugs.webkit.org/show_bug.cgi?id=167771

        Reviewed by Daniel Bates.

        * loader/DocumentLoader.cpp:
        (WebCore::DocumentLoader::commitData):

2017-02-12  Dan Bernstein  <mitz@apple.com>

        Tried to fix USE(APPLE_INTERNAL_SDK) builds after r212211.

        * platform/spi/mac/TUCallSPI.h: Reverted to r212210.

2017-02-12  Dan Bernstein  <mitz@apple.com>

        Tried to fix USE(APPLE_INTERNAL_SDK) builds after r212211.

        * platform/spi/mac/TUCallSPI.h:

2017-02-12  Dan Bernstein  <mitz@apple.com>

        Tried to fix USE(APPLE_INTERNAL_SDK) builds after r212211.

        * platform/spi/mac/TUCallSPI.h:

2017-02-12  Dan Bernstein  <mitz@apple.com>

        Tried to fix USE(APPLE_INTERNAL_SDK) builds after r212211.

        * platform/spi/mac/NSMenuSPI.h: Replaced declaration of deprecated method with its current
          equivalent.

2017-02-12  Dan Bernstein  <mitz@apple.com>

        Tried to fix USE(APPLE_INTERNAL_SDK) builds after r212211.

        * platform/spi/mac/NSImmediateActionGestureRecognizerSPI.h:

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-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-12  Ryosuke Niwa  <rniwa@webkit.org>

        Rebaseline bindings tests after r212207.

        * bindings/scripts/test/JS/JSTestObj.cpp:
        * bindings/scripts/test/JS/JSTestOverloadedConstructorsWithSequence.cpp:

2017-02-12  Dan Bernstein  <mitz@apple.com>

        [Cocoa] Some -respondsToSelector: checks are unnecessary
        https://bugs.webkit.org/show_bug.cgi?id=168183

        Reviewed by Tim Horton.

        * English.lproj/Localizable.strings: Removed a string that’s no longer needed after the
          change to WebKit2/Platform/mac/MenuUtilities.mm.

        * editing/mac/DictionaryLookup.mm:
        (WebCore::showPopupOrCreateAnimationController): Removed check whether
          LULookupDefinitionModule responds to +showDefinitionForTerm:relativeToRect:ofView:options:.

        * platform/cocoa/NetworkExtensionContentFilter.mm:
        (WebCore::NetworkExtensionContentFilter::initialize): Changed to use
          -[NEFilterSource setSourceAppIdentifier:], without checking, instead of
          -setSourceAppBundleID:, which does not exist.

        * platform/cocoa/ScrollController.mm:
        (systemUptime): Deleted.
        (WebCore::ScrollController::snapRubberBand): Use -[NSProcessInfo systemUptime] directly.

        * platform/graphics/avfoundation/objc/MediaPlaybackTargetPickerMac.mm:
        (WebCore::MediaPlaybackTargetPickerMac::showPlaybackTargetPicker): Remove unnecessary check.

        * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
        (WebCore::MediaPlayerPrivateAVFoundationObjC::createAVPlayerLayer): Ditto.
        (WebCore::MediaPlayerPrivateAVFoundationObjC::setVideoFullscreenMode): Ditto.
        (WebCore::MediaPlayerPrivateAVFoundationObjC::didPassCORSAccessCheck): Replaced
          -respondsToSelector: check with -isKindOfClass: check corresponding to the above cast.
        (WebCore::MediaPlayerPrivateAVFoundationObjC::setShouldDisableSleep): Removed unnecessary
          check.

        * platform/graphics/avfoundation/objc/VideoFullscreenLayerManager.mm:
        (WebCore::VideoFullscreenLayerManager::setVideoFullscreenLayer): Removed unnecessary checks.

        * platform/graphics/mac/WebGLLayer.mm:
        (-[WebGLLayer initWithGraphicsContext3D:]): Ditto.

        * platform/mac/PlatformEventFactoryMac.mm:
        (WebCore::typeForEvent): Removed check whether NSMenu responds to +menuTypeForEvent: and
          all code to handle that case that it doesn’t.

        * platform/mac/WebVideoFullscreenController.mm:
        (-[WebVideoFullscreenController applicationDidResignActive:]): Removed check whether
          NSWindow responds to -isOnActiveSpace.
        (-[WebVideoFullscreenController updateMenuAndDockForFullscreen]): Removed check whether
          NSApplication responds to -setPresentationOptions:

        * platform/mac/WebVideoFullscreenInterfaceMac.mm:
        (-[WebVideoFullscreenInterfaceMacObjC updateIsPlaying:newPlaybackRate:]): Removed
          unnecessary -respondsToSelector: check.
        (-[WebVideoFullscreenInterfaceMacObjC setVideoDimensions:]): Ditto.
        (-[WebVideoFullscreenInterfaceMacObjC setUpPIPForVideoView:withFrame:inWindow:]): Ditto.

        * platform/spi/cf/CFNetworkSPI.h: Moved declarations of
          -[NSURLCache _initWithMemoryCapacity:diskCapacity:relativePath:] and
          -[NSURLCache _CFURLCache] to the !USE(APPLE_INTERNAL_SDK) section.

        * platform/spi/cocoa/NEFilterSourceSPI.h: Added declaration of NEFilterSource’
          sourceAppIdentifier property to the !USE(APPLE_INTERNAL_SDK) section and deleted
          unconditional declaration of sourceAppBundleID property, which doesn’t exist.

        * platform/spi/cocoa/QuartzCoreSPI.h: Removed redundant declarations.

        * platform/spi/ios/DataDetectorsUISPI.h: Moved declarations of DDDetectionController methods
          from WebKit2/UIProcess/ios/{WKActionSheetAssistant,WKContentViewInteraction}.mm to here.
          Removed an unused declaration.

        * platform/spi/mac/LookupSPI.h: Moved redundant declarations into the
          !USE(APPLE_INTERNAL_SDK) section.

        * platform/spi/mac/NSMenuSPI.h: Changed to import NSMenu_Private.h when using the
          Apple internal SDK. Cleaned up the declarations for the other case.

        * platform/spi/mac/TUCallSPI.h: Changed to import TUCall_Strings.h when use the Apple
          internal SDK.

2017-02-11  Sam Weinig  <sam@webkit.org>

        Remove the remaining functions out of JSDOMBinding
        https://bugs.webkit.org/show_bug.cgi?id=168179

        Reviewed by Darin Adler.

        Move utility functions into more appropriate locations.
        - Move hasIteratorMethod to runtime/IteratorOperations.h
        - Move nonCachingStaticFunctionGetter to runtime/Lookup.h
        - Move addImpureProperty to CommonVM

        Remove toJS overload that took a Vector<T>. Replace it's usage
        with toJS<IDLSequence<T>> usage. To make this work, added two
        new types, IDLIDBKeyData and IDLIDBValue.

        * Modules/indexeddb/IDBCursor.cpp:
        (WebCore::IDBCursor::setGetResult):
        * Modules/indexeddb/IDBRequest.cpp:
        (WebCore::IDBRequest::setResult):
        (WebCore::IDBRequest::setResultToStructuredClone):
        Adopt JSDOMConvert infrastructure for conversions using new types.

        * bindings/IDLTypes.h:
        * bindings/js/JSDOMConvertIndexedDB.h:
        (WebCore::JSConverter<IDLIDBKeyData>::convert):
        (WebCore::JSConverter<IDLIDBValue>::convert):
        Add new types for IDBKeyData and IDBValue.

        * bindings/js/CommonVM.cpp:
        (WebCore::addImpureProperty):
        * bindings/js/CommonVM.h:
        Move addImpureProperty here from JSDOMBinding.

        * bindings/js/IDBBindingUtilities.cpp:
        (WebCore::idbKeyDataToScriptValue): Deleted.
        * bindings/js/IDBBindingUtilities.h:
        Remove unused idbKeyDataToScriptValue, and group like functions
        together.

        * bindings/js/JSDOMBinding.cpp: Removed.
        * bindings/js/JSDOMBinding.h:
        (WebCore::nonCachingStaticFunctionGetter): Deleted.
        (WebCore::toJS): Deleted.
        Move/remove functions.

        * bindings/js/JSDOMConvertUnion.h:
        Update for move of hasIteratorMethod to runtime/IteratorOperations.h

        * bindings/js/JSDOMWindowCustom.cpp:
        * bindings/js/JSHTMLDocumentCustom.cpp:
        * bindings/js/JSLocationCustom.cpp:
        Update for move of nonCachingStaticFunctionGetter to runtime/Lookup.h

        * bindings/js/JSSubtleCryptoCustom.cpp:
        Remove unneeded include of runtime/IteratorOperations.h

        * bindings/scripts/CodeGeneratorJS.pm:
        (GenerateOverloadedFunctionOrConstructor):
        Include runtime/IteratorOperations when needing to distinguish a sequence.

        * html/HTMLDocument.cpp:
        Replace include of JSDOMBinding.h with CommonVM.h for addImpureProperty.

2017-02-12  Carlos Garcia Campos  <cgarcia@igalia.com>

        [GTK] Handle caps lock indicator in event modifiers
        https://bugs.webkit.org/show_bug.cgi?id=168186

        Reviewed by Michael Catanzaro.

        Add helper function to check if caps lock is present in the given modifiers. We need this because in GDK
        GDK_LOCK_MASK might be either CapsLock or ShiftLock in X11. We use this new method in all platform event
        implementations to add the appropriate modifiers.

        Fixes: fast/events/special-key-events-in-input-text.html

        * platform/PlatformKeyboardEvent.h:
        * platform/gtk/PlatformKeyboardEventGtk.cpp:
        (WebCore::modifiersForGdkKeyEvent):
        (WebCore::PlatformKeyboardEvent::modifiersContainCapsLock):
        * platform/gtk/PlatformMouseEventGtk.cpp:
        (WebCore::PlatformMouseEvent::PlatformMouseEvent):
        * platform/gtk/PlatformWheelEventGtk.cpp:
        (WebCore::PlatformWheelEvent::PlatformWheelEvent):

2017-02-11  Sam Weinig  <sam@webkit.org>

        Remove custom bindings for XSLTProcessor.idl
        https://bugs.webkit.org/show_bug.cgi?id=168174

        Reviewed by Andreas Kling.

        * CMakeLists.txt:
        * WebCore.xcodeproj/project.pbxproj:
        * bindings/js/JSBindingsAllInOne.cpp:
        * bindings/js/JSXSLTProcessorCustom.cpp: Removed.
        Remove file.
 
        * bindings/js/JSDOMBinding.cpp:
        (WebCore::jsStringOrUndefined): Deleted.
        * bindings/js/JSDOMBinding.h:
        Remove now unused jsStringOrUndefined.

        * xml/XSLTProcessor.cpp:
        (WebCore::XSLTProcessor::setParameter):
        (WebCore::XSLTProcessor::getParameter):
        (WebCore::XSLTProcessor::removeParameter):
        * xml/XSLTProcessor.idl:
        Replace custom bindings bindings with early returns. One subtle difference
        between the custom bindings and this, is that getParameter will return 
        jsNull() rather than jsUndefined() for null String returns. This matches
        all other bindings.

2017-02-11  Olivier Blin  <olivier.blin@softathome.com>

        [GStreamer][MSE][EME] Fix decryptor assignment
        https://bugs.webkit.org/show_bug.cgi?id=168122

        Reviewed by Michael Catanzaro.

        The new decryptor is a floating reference so we should not use the
        adopt GRefPtr constructor, but use the regular assignment operator
        that will sink the object (clear the floating flag).

        This fixes assertions in debug build.

        See previous pipeline fix in r210851 and WPE commit
        06020b18831e1c0eead34e2c1a5a4b7d026c227d.

        * platform/graphics/gstreamer/mse/AppendPipeline.cpp:
        (WebCore::AppendPipeline::parseDemuxerSrcPadCaps):
        Do not use adoptGRef(), it prevented the object from being sunk.

2017-02-11  Simon Fraser  <simon.fraser@apple.com>

        Avoid a redundant scroll to 0,0 when navigating back to a url with no fragment
        https://bugs.webkit.org/show_bug.cgi?id=168177

        Reviewed by Sam Weinig.

        FrameView::scrollToFragment() is called from FrameLoader::scrollToFragmentWithParentBoundary()
        when navigating within the page. If the URL had no fragment identifier, this code would
        call into FrameView::scrollToAnchor() with an empty name, where maintainScrollPositionAtAnchor()
        used the document as the anchor, thus scrolling to 0,0. Later, history().restoreScrollPositionAndViewState()
        the restores the scroll position from history.
        
        This scroll to 0,0 happened to be not visible to the page because of scroll event
        coalescing, but it makes implementation of history.scrollRestoration harder, so avoid it
        by just returning early from FrameView::scrollToFragment() if there is no fragment,
        making sure to clear the document's CSSTarget.

        * dom/Document.cpp:
        (WebCore::Document::setCSSTarget):
        * page/FrameView.cpp:
        (WebCore::FrameView::scrollToFragment):
        (WebCore::FrameView::scrollToAnchor):

2017-02-11  Chris Dumez  <cdumez@apple.com>

        Implement URL's toJSON()
        https://bugs.webkit.org/show_bug.cgi?id=167979

        Reviewed by Sam Weinig.

        Implement URL's toJSON() as per:
        - https://url.spec.whatwg.org/#dom-url-tojson

        This is already supported by Firefox.

        Also, drop URLUtils.idl as it is no longer in the specification.
        Merge its content to DOMURL.idl as per the URL specification.

        Finally, mark href attribute as stringifier and drop the toString()
        operation to match the specification. This fixes a bug where our
        toString property was not enumerable but should have been.

        Tests: fast/url/url-tojson.html
               imported/w3c/web-platform-tests/url/url-tojson.html

        * CMakeLists.txt:
        * DerivedSources.make:
        * WebCore.xcodeproj/project.pbxproj:
        * html/DOMURL.idl:
        * html/URLUtils.h:
        (WebCore::URLUtils<T>::toJSON):
        * html/URLUtils.idl: Removed.

2017-02-11  Carlos Garcia Campos  <cgarcia@igalia.com>

        [GTK][EFL] Implement MIMETypeRegistry::getPreferredExtensionForMIMEType
        https://bugs.webkit.org/show_bug.cgi?id=168163

        Reviewed by Michael Catanzaro.

        It's missing causing several HTML anchor download tests to fail because the suggested filename missed the
        extension. This patch moves MIMETypeRegistry::appendFileExtensionIfNecessary() from the cocoa specific file to the
        common file because it's not actually platform specific. MIMETypeRegistry::getPreferredExtensionForMIMEType() is
        what platforms should implement.

        Fixes: fast/dom/HTMLAnchorElement/anchor-download-user-triggered-synthetic-click.html
               fast/dom/HTMLAnchorElement/anchor-download.html
               fast/dom/HTMLAnchorElement/anchor-file-blob-download-no-extension.html
               fast/dom/HTMLAnchorElement/anchor-nodownload-set.html

        * platform/MIMETypeRegistry.cpp:
        (WebCore::MIMETypeRegistry::appendFileExtensionIfNecessary):
        * platform/cocoa/MIMETypeRegistryCocoa.mm:
        (WebCore::MIMETypeRegistry::appendFileExtensionIfNecessary): Deleted.
        * platform/efl/MIMETypeRegistryEfl.cpp:
        (WebCore::MIMETypeRegistry::getPreferredExtensionForMIMEType):
        * platform/gtk/MIMETypeRegistryGtk.cpp:
        (WebCore::MIMETypeRegistry::getPreferredExtensionForMIMEType):

2017-02-11  Carlos Garcia Campos  <cgarcia@igalia.com>

        Unreviewed. Update imageTitle translatable string.

        To match mac port. Fixes fast/images/imageDocument-title.html.

        * platform/gtk/LocalizedStringsGtk.cpp:
        (WebCore::imageTitle):

2017-02-10  John Wilander  <wilander@apple.com>

        Updates to Resource Load Statistics: Get the right website data store and introduce timeout for user interaction
        https://bugs.webkit.org/show_bug.cgi?id=167474
        <rdar://problem/24681808>
        <rdar://problem/24703286>
        <rdar://problem/30290270>

        This patch does the following:
        1. Gets the right website data store. API::WebsiteDataStore::defaultDataStore()
            does not provide the right data store.
        2. Introduces timeout for user interaction. A domain needs interaction every 30
            days to stay in that category.
        3. Adds grandfathered to the statistics model in preparation for grandfathering of
            existing data records.
        4. Adds test infrastructure to allow testing of the various rules in place for
            data records removal.
        5. Fixes various smaller bugs that were found as part of setting up the tests.
        6. Regresses the data records removal counting. We need to come up with a thread
            safe way of gathering removal statistics from more than one data store now
            that we potentially interact with multiple stores.
        7. Adds a first set of layout tests for resource load statistics.

        Reviewed by Andy Estes.

        Tests: http/tests/loading/resourceLoadStatistics/non-prevalent-resource-with-user-interaction.html
               http/tests/loading/resourceLoadStatistics/non-prevalent-resource-without-user-interaction.html
               http/tests/loading/resourceLoadStatistics/prevalent-resource-with-user-interaction-timeout.html
               http/tests/loading/resourceLoadStatistics/prevalent-resource-with-user-interaction.html
               http/tests/loading/resourceLoadStatistics/prevalent-resource-without-user-interaction.html

        * dom/Document.cpp:
        (WebCore::Document::updateLastHandledUserGestureTimestamp):
            This now calls ResourceLoadObserver::logUserInteraction() every time since
            we want to keep track of the most recent user interaction.
        * loader/ResourceLoadObserver.cpp:
        (WebCore::ResourceLoadObserver::statisticsStore):
            New getter used by WebResourceLoadStatisticsManager::resetToConsistentState().
        (WebCore::reduceTimeResolutionToOneDay):
            Convenience function.
        (WebCore::ResourceLoadObserver::logUserInteractionWithReducedTimeResolution):
            Reduces time resolution for privacy reasons.
        (WebCore::ResourceLoadObserver::logUserInteraction):
        (WebCore::ResourceLoadObserver::clearUserInteraction):
        (WebCore::ResourceLoadObserver::hasHadUserInteraction):
        (WebCore::ResourceLoadObserver::setPrevalentResource):
        (WebCore::ResourceLoadObserver::isPrevalentResource):
        (WebCore::ResourceLoadObserver::clearPrevalentResource):
        (WebCore::ResourceLoadObserver::setTimeToLiveUserInteraction):
        (WebCore::ResourceLoadObserver::fireDataModificationHandler):
            New functions that allow WebKitTestRunner to stage exact
            statistics, fire the handler, and test the outcome.
        * loader/ResourceLoadObserver.h:
        * loader/ResourceLoadStatistics.cpp:
        (WebCore::ResourceLoadStatistics::encode):
        (WebCore::ResourceLoadStatistics::decode):
        (WebCore::ResourceLoadStatistics::toString):
        (WebCore::ResourceLoadStatistics::merge):
            Support for statistics mostRecentUserInteraction, grandfathered, and
            dataRecordsRemoved.
        * loader/ResourceLoadStatistics.h:
        * loader/ResourceLoadStatisticsStore.cpp:
        (WebCore::ResourceLoadStatisticsStore::setTimeToLiveUserInteraction):
            New function that allows WebKitTestRunner to test 
            aging out of user interaction.
        (WebCore::ResourceLoadStatisticsStore::hasHadRecentUserInteraction):
            Now takes into account the timestamp and ages
            out user interaction.
        (WebCore::ResourceLoadStatisticsStore::prevalentResourceDomainsWithoutUserInteraction):
            Now makes use of ResourceLoadStatisticsStore::hasHadRecentUserInteraction().
        * loader/ResourceLoadStatisticsStore.h:

2017-02-10  Sam Weinig  <sam@webkit.org>

        [WebIDL] Cleanup XMLHttpRequest's bindings
        https://bugs.webkit.org/show_bug.cgi?id=168067

        Reviewed by Chris Dumez.

        * bindings/js/JSDOMBinding.cpp:
        (WebCore::jsOwnedStringOrNull): Deleted.
        * bindings/js/JSDOMBinding.h:
        Remove jsOwnedStringOrNull and inline it into it's one use
        in JSXMLHttpRequestCustom.

        * bindings/js/JSXMLHttpRequestCustom.cpp:
        (WebCore::JSXMLHttpRequest::responseText):
        (WebCore::SendFunctor::SendFunctor): Deleted.
        (WebCore::SendFunctor::line): Deleted.
        (WebCore::SendFunctor::column): Deleted.
        (WebCore::SendFunctor::url): Deleted.
        (WebCore::SendFunctor::operator()): Deleted.
        (WebCore::JSXMLHttpRequest::send): Deleted.
        * xml/XMLHttpRequest.cpp:
        (WebCore::XMLHttpRequest::send):
        * xml/XMLHttpRequest.h:
        Remove custom send, replacing it with a single send implementation that
        takes a variant.

        * xml/XMLHttpRequest.idl:
        Cleanup the IDL to better match the spec. Update correct types where trivial.

2017-02-10  Chris Dumez  <cdumez@apple.com>

        document.origin doesn't match spec
        https://bugs.webkit.org/show_bug.cgi?id=168022

        Reviewed by Sam Weinig.

        Update document.origin to return the origin in the expected format:
        - https://dom.spec.whatwg.org/#dom-document-origin

        Change: "https_webkit.org_0 -> "https://webkit.org".

        The new behavior matches Firefox and Chrome.

        No new tests, updated existing tests.

        * dom/Document.cpp:
        (WebCore::Document::origin):

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-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-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-10  Commit Queue  <commit-queue@webkit.org>

        Unreviewed, rolling out r212154, r212154, and r212156.
        https://bugs.webkit.org/show_bug.cgi?id=168156

        broke internal builds (Requested by smfr on #webkit).

        Reverted changesets:

        "Add a DragImage class that wraps a DragImageRef"
        https://bugs.webkit.org/show_bug.cgi?id=168131
        http://trac.webkit.org/changeset/212154

        "Add a DragImage class that wraps a DragImageRef"
        https://bugs.webkit.org/show_bug.cgi?id=168131
        http://trac.webkit.org/changeset/212154

        "Try to fix the iOS and Windows builds."
        http://trac.webkit.org/changeset/212156

2017-02-10  Csaba Osztrogonác  <ossy@webkit.org>

        Fix the !ENABLE(WEBGL) build
        https://bugs.webkit.org/show_bug.cgi?id=168112

        Reviewed by Alex Christensen.

        * html/canvas/WebGLRenderingContextBase.h:

2017-02-10  Youenn Fablet  <youenn@apple.com>

        [Fetch API] fetch fails when undefined is passed as headers
        https://bugs.webkit.org/show_bug.cgi?id=168043

        Reviewed by Geoffrey Garen.

        Covered by updated test.

        * Modules/fetch/FetchInternals.js:
        (fillFetchHeaders): Exit early in case of undefined headers, since it is an optional parameter.

2017-02-10  Csaba Osztrogonác  <ossy@webkit.org>

        Fix the !ENABLE(WEB_TIMING) build
        https://bugs.webkit.org/show_bug.cgi?id=168113

        Reviewed by Alex Christensen.

        * workers/WorkerGlobalScope.cpp:
        (WebCore::WorkerGlobalScope::WorkerGlobalScope):

2017-02-10  Joseph Pecoraro  <pecoraro@apple.com>

        Update features.json for Performance Timing APIs
        https://bugs.webkit.org/show_bug.cgi?id=168148

        Reviewed by Simon Fraser.

        * features.json:

2017-02-10  Anders Carlsson  <andersca@apple.com>

        Try to fix the iOS and Windows builds.

        * platform/ios/DragImageIOS.mm:
        (WebCore::deleteDragImage):
        * platform/win/PasteboardWin.cpp:
        (WebCore::Pasteboard::setDragImage):

2017-02-10  Anders Carlsson  <andersca@apple.com>

        Add a DragImage class that wraps a DragImageRef
        https://bugs.webkit.org/show_bug.cgi?id=168131

        Reviewed by Beth Dakin.

        This allows us to get rid of the explicit deleteDragImage calls and will make additional cleanup of the
        various drag code paths possible. No functionality change.

        * dom/DataTransfer.cpp:
        (WebCore::DataTransfer::updateDragImage):
        * page/DragController.cpp:
        (WebCore::DragController::startDrag):
        (WebCore::DragController::doImageDrag):
        (WebCore::DragController::doSystemDrag):
        * page/DragController.h:
        * platform/DragImage.cpp:
        (WebCore::DragImage::DragImage):
        (WebCore::DragImage::operator=):
        (WebCore::DragImage::~DragImage):
        * platform/DragImage.h:
        * platform/Pasteboard.h:
        * platform/StaticPasteboard.h:
        * platform/mac/PasteboardMac.mm:
        (WebCore::Pasteboard::setDragImage):

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-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-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-10  Joseph Pecoraro  <pecoraro@apple.com>

        [Resource Timing] Enable Resource Timing by default in Tests
        https://bugs.webkit.org/show_bug.cgi?id=168145

        Reviewed by Ryosuke Niwa.

        * loader/ResourceTimingInformation.cpp:
        (WebCore::ResourceTimingInformation::addResourceTiming):
        * testing/InternalSettings.cpp:
        (WebCore::InternalSettings::Backup::Backup):
        (WebCore::InternalSettings::Backup::restoreTo):
        (WebCore::InternalSettings::setResourceTimingEnabled): Deleted.
        * testing/InternalSettings.h:
        * testing/InternalSettings.idl:
        No longer needed for tests.

2017-02-10  Dan Bernstein  <mitz@apple.com>

        [Cocoa] Add shouldChangeSelectedRange to WKWebProcessPlugInEditingDelegate
        https://bugs.webkit.org/show_bug.cgi?id=168097

        Reviewed by Tim Horton.

        Added a userTriggered argument to FrameSelection::setSelectedRange so that WebKit2 can
        indicate that changes should be agreed to by the delegate.

        * editing/FrameSelection.cpp:
        (WebCore::FrameSelection::setSelectedRange): If the change is user-triggered, check with
          shouldChangeSelection.
        * editing/FrameSelection.h:

2017-02-10  Jonathan Bedard  <jbedard@apple.com>

        Removing LayoutTestRelay
        https://bugs.webkit.org/show_bug.cgi?id=165927

        Reviewed by Daniel Bates.
        Part 2

        LayoutTestRelay uses SPI, since recent versions of the iOS SDK allow for installing apps on
        simulators through simctl (iOS 10 and later), use this functionality instead.

        * platform/RuntimeApplicationChecks.mm:
        (WebCore::IOSApplication::isDumpRenderTree): Update comment to reflect removal of LayoutTestRelay.

2017-02-10  Youenn Fablet  <youenn@apple.com>

        [WebRTC] Implement Outgoing libwebrtc audio source support
        https://bugs.webkit.org/show_bug.cgi?id=168118

        Reviewed by Eric Carlson.

        No new automated tests as we need the audio rendering to work to test the whole loop.

        Using an AudioSampleDataSource to convert the captured data to libwebrtc expected format.
        Capturing and pushing data happens in the capture thread.
        Pulling of converted data happens in libwebrtc thread.

        Introducing LibWebRTCAudioFormat.h to centralize libwbebrtc expected audio format.

        * WebCore.xcodeproj/project.pbxproj:
        * platform/audio/WebAudioBufferList.cpp:
        (WebCore::WebAudioBufferList::WebAudioBufferList): Missing initialization leads to assertion failure.
        * platform/audio/mac/AudioSampleBufferList.cpp:
        (WebCore::AudioSampleBufferList::copyFrom): In case of interleaved channels, there is one buffer but two channels.
        * platform/audio/mac/AudioSampleDataSource.cpp:
        (WebCore::AudioSampleDataSource::pushSamples):
        (WebCore::AudioSampleDataSource::pullAvalaibleSamplesAsChunks):
        * platform/audio/mac/AudioSampleDataSource.h:
        * platform/mediastream/libwebrtc/LibWebRTCAudioFormat.h: Added.
        * platform/mediastream/mac/RealtimeOutgoingAudioSource.cpp:
        (WebCore::libwebrtcAudioFormat):
        (WebCore::RealtimeOutgoingAudioSource::RealtimeOutgoingAudioSource):
        (WebCore::RealtimeOutgoingAudioSource::sourceMutedChanged):
        (WebCore::RealtimeOutgoingAudioSource::audioSamplesAvailable):
        (WebCore::RealtimeOutgoingAudioSource::pullAudioData):
        * platform/mediastream/mac/RealtimeOutgoingAudioSource.h:

2017-02-10  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-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  Zan Dobersek  <zdobersek@igalia.com>

        [EME] Implement MediaKeySession::load()
        https://bugs.webkit.org/show_bug.cgi?id=168041

        Reviewed by Xabier Rodriguez-Calvar.

        Implement the MediaKeySession::load() method, tracing the steps as they
        are defined in the EME specification. The only exception is step 8.3,
        which requires additional facility that tracks currently open sessions
        and provides information whether for a given session ID there's already
        a MediaKeySession that's not yet been closed.

        Session ID sanitization is done through the CDM::sanitizeSessionId()
        method, which relays the task to the CDMPrivate implementation.

        The CDMInstance::loadSession() virtual method is called with the session
        type, sanitized ID, the Document's origin (in string form) and the
        callback that's invoked upon completion of the task. The callback
        checks whether the operation was successful, or examines the reason for
        the load failure in case it wasn't, rejecting the promise in the latter
        case either immediately or in the following task at the latest.

        When the load was successful, the optional known keys, expiration time
        and message are handled appropriately, and the promise is resolved.

        MockCDM::sanitizeSessionId() implementation only treats
        'valid-loaded-session' as a valid session ID.
        MockCDMInstance::loadSession() implementation is kept slim for now, only
        providing the 'license-renewal' message when invoking the passed-in
        callback. Known keys and expiration time will also be tested once the
        relevant MediaKeySession algorithms are implemented.

        Test: media/encrypted-media/mock-MediaKeySession-load.html

        * Modules/encryptedmedia/CDM.cpp:
        (WebCore::CDM::sanitizeSessionId):
        * Modules/encryptedmedia/CDM.h:
        * Modules/encryptedmedia/CDMInstance.h:
        * Modules/encryptedmedia/CDMPrivate.h:
        * Modules/encryptedmedia/MediaKeySession.cpp:
        (WebCore::MediaKeySession::load):
        * testing/MockCDMFactory.cpp:
        (WebCore::MockCDM::sanitizeSessionId):
        (WebCore::MockCDMInstance::loadSession):
        * testing/MockCDMFactory.h:

2017-02-10  Zan Dobersek  <zdobersek@igalia.com>

        [EME] Implement MediaKeySession::sessionClosed()
        https://bugs.webkit.org/show_bug.cgi?id=168039

        Reviewed by Xabier Rodriguez-Calvar.

        Implement the 'session closed' algorithm for MediaKeySession by
        following the specified steps. After this algorithm is run, the
        session should be considered closed, which we track via the m_closed
        member variable on the class. This is set to true before the promise
        that's accessible through the 'closed' attribute is resolved.

        Because the algorithm requires the CDM instance to store any record
        of key usage when the session's type is 'persistent-usage-record', the
        storeRecordOfKeyUsage() virtual method is added to the CDMInstance
        interface. MockCDMInstance implementation is left unimplemented for now.

        JSMediaKeySession::closed() accessor now has a custom implementation
        that creates a deferred promise for that object if there's none yet, and
        shares it with the wrapped class through the registerClosedPromise()
        method, storing a reference to the promise in the m_closedPromise
        member variable, or resolving the promise immediately if the session was
        already closed.

        Test cases added to media/encrypted-media/mock-MediaKeySession-close.html.

        * Modules/encryptedmedia/CDMInstance.h:
        * Modules/encryptedmedia/MediaKeySession.cpp:
        (WebCore::MediaKeySession::registerClosedPromise):
        (WebCore::MediaKeySession::sessionClosed):
        * Modules/encryptedmedia/MediaKeySession.h:
        * bindings/js/JSMediaKeySessionCustom.cpp:
        (WebCore::JSMediaKeySession::closed):
        * testing/MockCDMFactory.cpp:
        (WebCore::MockCDMInstance::storeRecordOfKeyUsage):
        * testing/MockCDMFactory.h:

2017-02-10  Zan Dobersek  <zdobersek@igalia.com>

        [EME] Implement MediaKeySession::updateKeyStatuses(), MediaKeyStatusMap
        https://bugs.webkit.org/show_bug.cgi?id=167888

        Reviewed by Xabier Rodriguez-Calvar.

        Implement MediaKeySession::updateKeyStatuses(), transforming the passed-in
        KeyStatusVector into a Vector mapping the key IDs to MediaKeyStatus values.
        A keystatuseschange event is fired on the MediaKeySession object afterwards.
        The queueing of the task that runs the 'attemp to resume playback' on the
        related HTMLMediaElement objects isn't done yet since that algorithm isn't
        implemented yet.

        The statuses Vector is stored on the MediaKeySession object. That Vector is
        then exposed through the MediaKeyStatusMap object, each such object being
        unique to one MediaKeySession object. The implementation of MediaKeyStatusMap
        thus keeps a reference to the session object as long as that object is alive,
        and queries the MediaKeySession::statuses() getter to access the Vector that
        contains status information for all the key IDs.

        MediaKeyStatusMap::Iterator object keeps a reference to the MediaKeyStatusMap
        object and accesses the statuses by indexing into the status Vector of the
        related MediaKeySession object.

        CDMInstance::updateLicense() now accepts the session ID string as the first
        argument, making it possible to specify which session should be updated.

        MockCDMFactory::keysForSessionWithID() returns an optional reference to the
        Vector value in the session map that lists all the key IDs that are being
        stored for that session.

        MockCDMInstance::updateLicense() now detects the 'keys-changed' entry in the
        passed-in response data, and upon detecting that constructs a KeyStatusVector
        object containing all the keys for that session. KeyStatus::Usable is returned
        for each object at the moment, but this should be adjustable in the future
        through additional parameters passed through the response data. The Vector
        object is then passed to the callback and is then passed to the 'update key
        statuses' algorithm in MediaKeySession.

        Covered by a test case in media/encrypted-media/mock-MediaKeySession-update.html.

        * Modules/encryptedmedia/CDMInstance.h:
        * Modules/encryptedmedia/MediaKeySession.cpp:
        (WebCore::MediaKeySession::MediaKeySession):
        (WebCore::MediaKeySession::~MediaKeySession):
        (WebCore::MediaKeySession::update):
        (WebCore::MediaKeySession::updateKeyStatuses):
        * Modules/encryptedmedia/MediaKeySession.h:
        * Modules/encryptedmedia/MediaKeyStatusMap.cpp:
        (WebCore::MediaKeyStatusMap::MediaKeyStatusMap):
        (WebCore::MediaKeyStatusMap::detachSession):
        (WebCore::MediaKeyStatusMap::size):
        (WebCore::keyIdsMatch):
        (WebCore::MediaKeyStatusMap::has):
        (WebCore::MediaKeyStatusMap::get):
        (WebCore::MediaKeyStatusMap::Iterator::Iterator):
        (WebCore::MediaKeyStatusMap::Iterator::next):
        * Modules/encryptedmedia/MediaKeyStatusMap.h:
        (WebCore::MediaKeyStatusMap::create):
        * Modules/encryptedmedia/MediaKeyStatusMap.idl:
        * testing/MockCDMFactory.cpp:
        (WebCore::MockCDMFactory::keysForSessionWithID):
        (WebCore::MockCDMInstance::updateLicense):
        * testing/MockCDMFactory.h:

2017-02-09  Simon Fraser  <simon.fraser@apple.com>

        Improve IOSurfacePool logging
        https://bugs.webkit.org/show_bug.cgi?id=168098

        Reviewed by Tim Horton.

        Pass a string to DUMP_POOL_STATISTICS so we can tell what's triggering the
        logging.

        * platform/graphics/cg/IOSurfacePool.cpp:
        (WebCore::IOSurfacePool::takeSurface):
        (WebCore::IOSurfacePool::addSurface):
        (WebCore::IOSurfacePool::evict):
        (WebCore::IOSurfacePool::collectionTimerFired):
        (WebCore::IOSurfacePool::showPoolStatistics):
        * platform/graphics/cg/IOSurfacePool.h:

2017-02-09  Alex Christensen  <achristensen@webkit.org>

        Unreviewed, rolling out r212040.

        Broke build.  I'm not surprised

        Reverted changeset:

        "[WebRTC][Mac] Activate libwebrtc"
        https://bugs.webkit.org/show_bug.cgi?id=167293
        http://trac.webkit.org/changeset/212040

2017-02-09  Chris Dumez  <cdumez@apple.com>

        [Mac][WK2] Use MIME type to add file extension to downloads' suggested filenames when missing
        https://bugs.webkit.org/show_bug.cgi?id=168077
        <rdar://problem/30412595>

        Reviewed by Alex Christensen.

        Add utility function to MIMETypeRegistry that appends an extension to
        a filename if necessary, based on a provided MIME type.

        Tests: fast/dom/HTMLAnchorElement/anchor-file-blob-download-no-extension.html
               http/tests/download/anchor-download-no-extension.html

        * platform/MIMETypeRegistry.cpp:
        (WebCore::MIMETypeRegistry::appendFileExtensionIfNecessary):
        * platform/MIMETypeRegistry.h:
        * platform/cocoa/MIMETypeRegistryCocoa.mm:
        (WebCore::MIMETypeRegistry::appendFileExtensionIfNecessary):

2017-02-09  Youenn Fablet  <youenn@apple.com>

        [WebRTC][Mac] Activate libwebrtc
        https://bugs.webkit.org/show_bug.cgi?id=167293

        Reviewed by Alex Christensen.

        * Configurations/WebCore.xcconfig:
        * Configurations/WebCoreTestSupport.xcconfig:

2017-02-09  Philip Rogers  <pdr@google.com>

        SVG clip-path references can clip out later content
        https://bugs.webkit.org/show_bug.cgi?id=164181

        Reviewed by Said Abou-Hallawa.

        RenderSVGResourceClipper can modify the GraphicsContext state (through the path-only
        clipping codepath) so we need to ensure RenderLayer::setupClipPath saves the context
        and its caller restores it back so later content is not clipped as well.

        This patch is based on a chromium patch by fs@opera.com:
        https://chromium.googlesource.com/chromium/src/+/b3f7e7d2c4afb3c7e5c7eb438ff5933cbe2109b3

        Test: css3/masking/clip-path-reference-restore.html

        * rendering/RenderLayer.cpp:
        (WebCore::RenderLayer::setupClipPath): Add a GC save and return true to restore. Also switch to downcast instead of static_cast.

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-09  Brent Fulgham  <bfulgham@apple.com>

        Unreviewed build fix after r212025.

        inDocument -> isConnected

        * html/FormAssociatedElement.cpp:
        (WebCore::FormAssociatedElement::didMoveToNewDocument):
        (WebCore::FormAssociatedElement::resetFormAttributeTargetObserver):
        * html/HTMLFormElement.cpp:
        (WebCore::HTMLFormElement::formElementIndex):

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  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  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  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) synchrono