2019-05-16 Carlos Garcia Campos [FreeType] Some character sequences with a variation selector are not rendered https://bugs.webkit.org/show_bug.cgi?id=197838 Reviewed by Michael Catanzaro. We get the invalid glyph instead. See http://mts.io/2015/04/21/unicode-symbol-render-text-emoji/. In the table at the end the Emoji and Text columns are not correctly rendered. It happens also when copying an emoji from GtkEmojiChooser and pasting in WebKit text field, because GTK appends U+FE0F to all emojis to force the emoji style. We need to take into account the variation selector when checking if a font can render a combining sequence, using FT_Face_GetCharVariantIndex to get the right glyph in case of variation character present. * platform/graphics/Font.cpp: (WebCore::Font::platformSupportsCodePoint const): Add optional variation parameter. (WebCore::Font::canRenderCombiningCharacterSequence const): Take into account variation selector characters * platform/graphics/Font.h: * platform/graphics/cairo/FontCairoHarfbuzzNG.cpp: (WebCore::FontCascade::fontForCombiningCharacterSequence const): Check variation selectors 0xFE0E and 0xFE0F to decide whether to use the emoji or text style. * platform/graphics/cocoa/FontCocoa.mm: (WebCore::Font::platformSupportsCodePoint const): Return false when a variation character is passed so that characters are checked individually. * platform/graphics/freetype/SimpleFontDataFreeType.cpp: (WebCore::Font::platformSupportsCodePoint const): Use FT_Face_GetCharVariantIndex when a variation character is passed. * platform/graphics/harfbuzz/ComplexTextControllerHarfBuzz.cpp: (WebCore::harfBuzzFontFunctions): Do not return true when FT_Face_GetCharVariantIndex returns 0. 2019-03-16 Darin Adler Improve normalization code, including moving from unorm.h to unorm2.h https://bugs.webkit.org/show_bug.cgi?id=195330 Reviewed by Michael Catanzaro. * editing/TextIterator.cpp: Include unorm2.h. (WebCore::normalizeCharacters): Rewrote to use unorm2_normalize rather than unorm_normalize, but left the logic otherwise the same. * platform/graphics/SurrogatePairAwareTextIterator.cpp: Include unorm2.h. (WebCore::SurrogatePairAwareTextIterator::normalizeVoicingMarks): Use unorm2_composePair instead of unorm_normalize. * platform/graphics/cairo/FontCairoHarfbuzzNG.cpp: (characterSequenceIsEmoji): Changed to use existing SurrogatePairAwareTextIterator. (FontCascade::fontForCombiningCharacterSequence): Use normalizedNFC instead of calling unorm2_normalize directly. * WebCore/platform/graphics/freetype/SimpleFontDataFreeType.cpp: Removed unneeded include of . * platform/text/TextEncoding.cpp: (WebCore::TextEncoding::encode const): Use normalizedNFC instead of the code that was here. The normalizedNFC function is better in multiple ways, but primarily it handles 8-bit strings and other already-normalized strings much more efficiently. 2019-05-15 Zalan Bujtas Do not create a shape object outside of the layout context https://bugs.webkit.org/show_bug.cgi?id=197926 Reviewed by Simon Fraser. ShapeOutside objects are used to compute line constrains during layout (in a strict sense, they are part of the layout context and should only be mutated during layout). If we don't create one during layout, we probably don't need to know its geometry during paint (or any other non-layout activity) either. Test: fast/block/float/float-with-shape-outside-crash.html * rendering/FloatingObjects.cpp: (WebCore::ComputeFloatOffsetForLineLayoutAdapter::updateOffsetIfNeeded): (WebCore::ComputeFloatOffsetForLineLayoutAdapter::updateOffsetIfNeeded): * rendering/shapes/ShapeOutsideInfo.cpp: (WebCore::ShapeOutsideInfo::computeDeltasForContainingBlockLine): 2019-05-14 Zalan Bujtas Do not try to issue repaint while the render tree is being destroyed. https://bugs.webkit.org/show_bug.cgi?id=197461 Reviewed by Simon Fraser. Test: http/tests/svg/crash-on-reload-with-filter.html We don't need to compute repaint rects when the render tree is getting torn down. We'll issue a full repaint at some point. Also during full render tree destruction the inline tree state is undefined. We should avoid accessing it. * rendering/svg/RenderSVGResourceContainer.cpp: (WebCore::RenderSVGResourceContainer::markAllClientLayersForInvalidation): 2019-05-09 Brent Fulgham Correct delayed load event handling https://bugs.webkit.org/show_bug.cgi?id=197679 Reviewed by Alex Christensen. We need to properly account for the fact that JavaScript might run while performing loads. * dom/Document.cpp: (WebCore::Document::loadEventDelayTimerFired): 2019-05-08 Brent Fulgham Correct delayed load event handling https://bugs.webkit.org/show_bug.cgi?id=197679 Reviewed by Alex Christensen. We need to properly account for the fact that JavaScript might run while performing loads. * dom/Document.cpp: (WebCore::Document::loadEventDelayTimerFired): 2019-05-02 Chris Dumez Setting a frame's src to a javascript URL should not run it synchronously https://bugs.webkit.org/show_bug.cgi?id=197466 Reviewed by Darin Adler. When an iframe's src attribute is set to a javascript URL, whether when parsing or later on via JS, we now execute the URL's JavaScript asynchronously. We used to execute it synchronously, which was a source of bugs and also did not match other browsers. I have verified that our new behavior is aligned with both Firefox and Chrome. Note that for backward-compatibility and interoperability with Blink (https://bugs.chromium.org/p/chromium/issues/detail?id=923585), the "javascript:''" URL will still run synchronously. We should consider dropping this quirk at some point. Test: fast/dom/frame-src-javascript-url-async.html * loader/NavigationScheduler.cpp: (WebCore::ScheduledLocationChange::ScheduledLocationChange): (WebCore::ScheduledLocationChange::~ScheduledLocationChange): (WebCore::NavigationScheduler::scheduleLocationChange): * loader/NavigationScheduler.h: (WebCore::NavigationScheduler::scheduleLocationChange): * loader/SubframeLoader.cpp: (WebCore::SubframeLoader::requestFrame): 2019-02-21 Daniel Bates Same Site Lax cookies are not sent with cross-site redirect from client-initiated load https://bugs.webkit.org/show_bug.cgi?id=194906 Reviewed by Brent Fulgham. Ensure that a request for a top-level navigation is annotated as such regardless of whether the request has a computed Same Site policy. "New loads" initiated by a the client (Safari) either by API or a human either explicitly typing a URL in the address bar or Command + clicking a hyperlink to open it in a new window/tab are always considered Same Site. This is by definition from the spec. [1] as we aren't navigating from an existing page. (Command + click should be thought of as a convenience to the user from having to copy the hyperlink's URL, create a new window, and paste the URL into the address bar). Currently the frame loader marks a request as a top-level navigation if and only if the request does not have a pre-computed Same Site policy. However, "New loads" have a pre-computed Same Site policy. So, these loads would never be marked as a top-level navigation by the frame loading code. Therefore, if the "new load" turned out to be a cross-site redirect then WebKit would incorrectly tell the networking stack that the load was a cross-site, non-top-level navigation, and per the Same Site spec [2], the networking stack would not send Same Site Lax cookies. Instead, WebKit should unconditionally ensure that requests are marked as a top-level navigation, if applicable. [1] See Note for (1) in [2] Test: http/tests/cookies/same-site/user-load-cross-site-redirect.php * loader/FrameLoader.cpp: (WebCore::FrameLoader::addExtraFieldsToRequest): Unconditionally update the request's top- level navigation bit. * platform/network/ResourceRequestBase.cpp: (WebCore::ResourceRequestBase::setAsIsolatedCopy): Unconditionally copy a request's top- level navigation bit. 2019-04-03 Myles C. Maxfield -apple-trailing-word is needed for browser detection https://bugs.webkit.org/show_bug.cgi?id=196575 Unreviewed. This is an unreviewed partial revert of r243819. Turns out there are some websites which use this property to do browser detection. So, we need to continue to parse the property, but we don't need the property to do anything. Test: fast/text/trailing-word-detection.html * Configurations/FeatureDefines.xcconfig: * css/CSSComputedStyleDeclaration.cpp: (WebCore::ComputedStyleExtractor::valueForPropertyinStyle): * css/CSSPrimitiveValueMappings.h: (WebCore::CSSPrimitiveValue::CSSPrimitiveValue): (WebCore::CSSPrimitiveValue::operator TrailingWord const): * css/CSSProperties.json: * css/CSSValueKeywords.in: * css/parser/CSSParserFastPaths.cpp: (WebCore::CSSParserFastPaths::isValidKeywordPropertyAndValue): (WebCore::CSSParserFastPaths::isKeywordPropertyID): * rendering/style/RenderStyle.h: (WebCore::RenderStyle::trailingWord const): (WebCore::RenderStyle::setTrailingWord): (WebCore::RenderStyle::initialTrailingWord): * rendering/style/RenderStyleConstants.h: 2019-04-03 Myles C. Maxfield Remove support for -apple-trailing-word https://bugs.webkit.org/show_bug.cgi?id=196525 Reviewed by Zalan Bujtas. This CSS property is nonstandard and not used. * Configurations/FeatureDefines.xcconfig: * css/CSSComputedStyleDeclaration.cpp: (WebCore::ComputedStyleExtractor::valueForPropertyinStyle): * css/CSSPrimitiveValueMappings.h: (WebCore::CSSPrimitiveValue::operator TrailingWord const): Deleted. * css/CSSProperties.json: * css/CSSValueKeywords.in: * css/parser/CSSParserFastPaths.cpp: (WebCore::CSSParserFastPaths::isValidKeywordPropertyAndValue): (WebCore::CSSParserFastPaths::isKeywordPropertyID): * rendering/SimpleLineLayout.cpp: (WebCore::SimpleLineLayout::canUseForStyle): * rendering/SimpleLineLayoutCoverage.cpp: (WebCore::SimpleLineLayout::printReason): * rendering/SimpleLineLayoutCoverage.h: * rendering/line/BreakingContext.h: (WebCore::BreakingContext::BreakingContext): (WebCore::BreakingContext::lineBreak): (WebCore::BreakingContext::clearLineBreakIfFitsOnLine): (WebCore::BreakingContext::commitLineBreakClear): (WebCore::BreakingContext::commitLineBreakAtCurrentWidth): (WebCore::BreakingContext::handleBR): (WebCore::BreakingContext::handleFloat): (WebCore::BreakingContext::handleText): (WebCore::BreakingContext::handleEndOfLine): (WebCore::BreakingContext::InlineIteratorHistory::InlineIteratorHistory): Deleted. (WebCore::BreakingContext::InlineIteratorHistory::push): Deleted. (WebCore::BreakingContext::InlineIteratorHistory::update): Deleted. (WebCore::BreakingContext::InlineIteratorHistory::renderer const): Deleted. (WebCore::BreakingContext::InlineIteratorHistory::offset const): Deleted. (WebCore::BreakingContext::InlineIteratorHistory::nextBreakablePosition const): Deleted. (WebCore::BreakingContext::InlineIteratorHistory::atTextParagraphSeparator const): Deleted. (WebCore::BreakingContext::InlineIteratorHistory::previousInSameNode const): Deleted. (WebCore::BreakingContext::InlineIteratorHistory::get const): Deleted. (WebCore::BreakingContext::InlineIteratorHistory::current const): Deleted. (WebCore::BreakingContext::InlineIteratorHistory::historyLength const): Deleted. (WebCore::BreakingContext::InlineIteratorHistory::moveTo): Deleted. (WebCore::BreakingContext::InlineIteratorHistory::increment): Deleted. (WebCore::BreakingContext::InlineIteratorHistory::clear): Deleted. (WebCore::BreakingContext::optimalLineBreakLocationForTrailingWord): Deleted. * rendering/style/RenderStyle.h: (WebCore::RenderStyle::trailingWord const): Deleted. (WebCore::RenderStyle::setTrailingWord): Deleted. (WebCore::RenderStyle::initialTrailingWord): Deleted. * rendering/style/RenderStyleConstants.h: * rendering/style/StyleRareInheritedData.cpp: (WebCore::StyleRareInheritedData::StyleRareInheritedData): (WebCore::StyleRareInheritedData::operator== const): * rendering/style/StyleRareInheritedData.h: 2019-04-02 Simon Fraser REGRESSION (r238266): Exchange 2013 Outlook Web Access displays partially blank page when creating new e-mail https://bugs.webkit.org/show_bug.cgi?id=196522 rdar://problem/49472941 Reviewed by Zalan Bujtas. In this content a layer is composited to clip descendants, and has negative z-order children, so we compute that it "paints into ancestor", and has a foreground layer. This combination doesn't make sense, and when the layer becomes scrollable, we end up with bad paint phases on layers, and fail to paint the contents. Fix by ensuring that a layer has its own backing store if it requires a foreground layer by virtue of having negative z-order children. Test: compositing/backing/foreground-layer-no-paints-into-ancestor.html * rendering/RenderLayerCompositor.cpp: (WebCore::RenderLayerCompositor::requiresOwnBackingStore const): 2019-03-28 Zalan Bujtas [SimpleLineLayout] Disable SLL when text-underline-position is not auto. https://bugs.webkit.org/show_bug.cgi?id=196338 Reviewed by Daniel Bates. Disable simple line layout unconditionally on non-auto text-underline-position content. We don't support it yet. Test: fast/text/simple-line-layout-with-text-underline-position.html * rendering/SimpleLineLayout.cpp: (WebCore::SimpleLineLayout::canUseForStyle): 2019-03-11 Wenson Hsieh [macOS] Dispatching reentrant "contextmenu" events may cause crashes https://bugs.webkit.org/show_bug.cgi?id=195571 Reviewed by Andy Estes. Make ContextMenuController::handleContextMenuEvent robust against reentrancy by guarding it with a boolean flag. As demonstrated in the test case, it is currently possible to force WebKit into a bad state by dispatching a synthetic "contextmenu" event from within the scope of one of the "before(copy|cut|paste)" events triggered as a result of handling a context menu event. Test: fast/events/contextmenu-reentrancy-crash.html * page/ContextMenuController.cpp: (WebCore::ContextMenuController::handleContextMenuEvent): * page/ContextMenuController.h: 2019-05-08 Carlos Garcia Campos REGRESSION(r239915): [FreeType] White space skipped when rendering plain text with noto CJK font https://bugs.webkit.org/show_bug.cgi?id=197658 Reviewed by Michael Catanzaro. Since r239915 we no longer overwrite control characters with zero width space, they are handled later when filling the glyph pages. In Font::platformGlyphInit() there's an optimization to get the glyph of zero with space character that assumes that control characters are always overwritten. Since the glyph for character at 0 index is always overwritten with zero width space, we can avoid loading the page for the actual zero width space character and use the first page instead. In the particular case of noto CJK font, character at 0 is mapped to the same glyph as space character, so space and zero width space end up being the same glyph. That breaks the space width calculation, that returns 0 when isZeroWidthSpaceGlyph() is true. That's why spaces are no longer rendered, ComplexTextController::adjustGlyphsAndAdvances() is setting the x advance for the space glyphs to 0. * platform/graphics/Font.cpp: (WebCore::Font::platformGlyphInit): Use the actual zero width space page to get the glyph instead of 0 when using FreeType. 2019-05-08 Philippe Normand REGRESSION(r243197): [GStreamer] Error playing redirected streams https://bugs.webkit.org/show_bug.cgi?id=197410 Reviewed by Carlos Garcia Campos. Revert the change introduced in r243197 that was checking the redirected URI instead of the original URI. Non-main URIs should be ignored only when they are HLS (or similar) fragments. Test http/tests/security/canvas-remote-read-remote-video-hls.html still passes. * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp: (WebCore::MediaPlayerPrivateGStreamer::handleMessage): 2019-04-25 Philippe Normand [GStreamer] gst_element_get_state: assertion 'GST_IS_ELEMENT (element)' failed in WebCore::MediaPlayerPrivateGStreamer::paused https://bugs.webkit.org/show_bug.cgi?id=196691 Reviewed by Eric Carlson. For gif assets, fail media loading early and notify the MediaPlayer by setting both network and ready states, so that the MediaPlayer will try with with the next media engine or pass the error to HTMLMediaElement if there are none. * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp: (WebCore::MediaPlayerPrivateGStreamer::loadFull): (WebCore::MediaPlayerPrivateGStreamer::loadingFailed): * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h: 2019-04-25 Philippe Normand [REGRESSION(r243197)][GStreamer] http/tests/media/clearkey/collect-webkit-media-session.html hits an ASSERT https://bugs.webkit.org/show_bug.cgi?id=197230 Reviewed by Xabier Rodriguez-Calvar. Perform the resource loader disposal and destruction from the main thread. Also ensure there's no circular reference between the CachedResourceStreamingClient and WebKitWebSrc when disposing of the private WebKitWebSrc storage. * platform/graphics/gstreamer/MainThreadNotifier.h: * platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp: (_WebKitWebSrcPrivate::~_WebKitWebSrcPrivate): (webkit_web_src_class_init): (webKitWebSrcDispose): (webKitWebSrcCloseSession): (webKitWebSrcFinalize): Deleted. 2019-04-24 Philippe Normand [GTK][GStreamer] Flaky ASSERTION FAILED: m_lock.isHeld() in TextureMapperPlatformLayerProxy https://bugs.webkit.org/show_bug.cgi?id=196739 Reviewed by Xabier Rodriguez-Calvar. The crash was triggered because m_videoDecoderPlatform not being explicitely set, its value would be inferred as one of the enum class values. Making it Optional avoids this issue. * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.h: 2019-03-29 Philippe Normand [GStreamer] imxvpudecoder detection and handling https://bugs.webkit.org/show_bug.cgi?id=196346 Reviewed by Xabier Rodriguez-Calvar. When the imxvpudecoder is used, the texture sampling of the directviv-uploaded texture returns an RGB value, so there's no need to convert it. This patch also includes a refactoring of the ImageRotation flag handling. The flag is now computed once only and stored in an instance variable. * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp: (WebCore::MediaPlayerPrivateGStreamer::createGSTPlayBin): * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp: (WebCore::GstVideoFrameHolder::GstVideoFrameHolder): (WebCore::MediaPlayerPrivateGStreamerBase::~MediaPlayerPrivateGStreamerBase): (WebCore::MediaPlayerPrivateGStreamerBase::pushTextureToCompositor): (WebCore::MediaPlayerPrivateGStreamerBase::flushCurrentBuffer): (WebCore::MediaPlayerPrivateGStreamerBase::copyVideoTextureToPlatformTexture): (WebCore::MediaPlayerPrivateGStreamerBase::nativeImageForCurrentTime): (WebCore::MediaPlayerPrivateGStreamerBase::setVideoSourceOrientation): (WebCore::MediaPlayerPrivateGStreamerBase::updateTextureMapperFlags): (WebCore::texMapFlagFromOrientation): Deleted. * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.h: 2019-04-24 Philippe Normand [GStreamer] Crash in AudioTrackPrivate with playbin3 enabled https://bugs.webkit.org/show_bug.cgi?id=196913 Reviewed by Xabier Rodriguez-Calvar. The crash was due to a playbin3 code path being triggered during MSE playback, which is not supposed to work in playbin3 anyway. The problem is that setting the USE_PLAYBIN3 environment variable to "1" makes the GStreamer playback plugin register the playbin3 element under the playbin name. So that leads to playbin3 being used everywhere in WebKit where we assume the playbin element is used. So the proposed solution is to: - use a WebKit-specific environment variable instead of the GStreamer USE_PLAYBIN3 variable. - emit a warning if the USE_PLAYBIN3 environment variable is detected. We can't unset it ourselves for security reasons. The patch also includes a code cleanup of the player method handling the pipeline creation. The previous code had a bug leading to playbin3 being used for MSE. * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp: (WebCore::MediaPlayerPrivateGStreamer::createGSTPlayBin): 2019-04-10 Philippe Normand there is no vp8 support in youtube.com/html5 page with libwebkit2gtk 2.24 (MSE enabled) https://bugs.webkit.org/show_bug.cgi?id=196615 Reviewed by Xabier Rodriguez-Calvar. Add vp8.0 and vp9.0 in supported mime-types if the corresponding video decoders are found. No new tests, existing web-platform-tests cover this change. * platform/graphics/gstreamer/GStreamerRegistryScanner.cpp: (WebCore::GStreamerRegistryScanner::initialize): 2019-04-10 Philippe Normand [GStreamer] Adaptive streaming playback broken with GStreamer < 1.12 https://bugs.webkit.org/show_bug.cgi?id=196765 Reviewed by Xabier Rodriguez-Calvar. Without the following patch in gst-plugins-bad, the uridownloader doesn't relay need-context messages to its parent, so in our case the player can't share its context with secondary webkitwebsrc elements and a RELEASE_ASSERT is hit in the WebProcess. So the workaround is to use again webkit+ protocol prefixes for GStreamer versions older than 1.12. https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/commit/8cf858fb27919e1d631223375f81b98055623733 * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp: (WebCore::convertToInternalProtocol): (WebCore::MediaPlayerPrivateGStreamer::setPlaybinURL): (WebCore::MediaPlayerPrivateGStreamer::loadFull): (WebCore::MediaPlayerPrivateGStreamer::handleMessage): (WebCore::MediaPlayerPrivateGStreamer::wouldTaintOrigin const): * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h: * platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp: (webKitWebSrcStart): (webKitWebSrcGetProtocols): (convertPlaybinURI): (webKitWebSrcSetUri): (CachedResourceStreamingClient::responseReceived): (webKitSrcWouldTaintOrigin): * platform/graphics/gstreamer/WebKitWebSourceGStreamer.h: 2019-05-03 Tomoki Imai [Cairo] Improve ShadowBlur performance using tiling optimization https://bugs.webkit.org/show_bug.cgi?id=197308 Reviewed by Žan Doberšek. Enable tiling tiling-based optimization for drawRectShadow() and drawInsetShadow(). Since r228776, cairo ports doesn't have tiling-based optimization. For AppleWin, this patch refactors code and it shares almost same code as cairo port. Only the difference is that AppleWin uses ScratchBuffer, but cairo ports doesn't. This should avoid a performance regression for AppleWin. No new tests, covered by existing tests. * platform/graphics/ShadowBlur.cpp: (WebCore::calculateLobes): Fix stylecheck errors (WebCore::ShadowBlur::blurLayerImage): Fix stylecheck errors (WebCore::ShadowBlur::calculateLayerBoundingRect): We don't use position of m_sourceRect, so change the type to FloatSize. (WebCore::ShadowBlur::drawShadowBuffer): Use m_layerSize instead of m_shadowedResultSize to fillRect, as m_layerSize is always smaller than m_shadowedResultSize. It's because in m_layerSize is equal to m_shadowedResultSize if it's not clipped. Clipping doesn't increase size of m_layerSize, so m_layerSize is always smaller than or equal to m_shadowedResultSize. (WebCore::ShadowBlur::templateSize const): Fix stylecheck errors (WebCore::ShadowBlur::drawRectShadow): (WebCore::ShadowBlur::drawInsetShadow): (WebCore::ShadowBlur::drawRectShadowWithoutTiling): (WebCore::ShadowBlur::drawInsetShadowWithoutTiling): (WebCore::ShadowBlur::drawRectShadowWithTiling): (WebCore::ShadowBlur::drawInsetShadowWithTiling): Incorporate tile-based drawing. To accomplish it, this patch abstracts GraphicsContext::drawImageBuffer to ShadowBlur::DrawImageCallback, GraphicsContext::fillRect to ShadowBlur::FillRectCallback, drawing rect with hole to ShadowBlur::FillRectWithHoleCallback. Variants which takes GraphicsContext as parameter now just calls another drawRectShadow. (WebCore::ShadowBlur::drawLayerPieces): Instead of graphicsContext.drawImageBuffer, call corresponding callback. (WebCore::ShadowBlur::drawLayerPiecesAndFillCenter): This function calls drawLayerPieces and fill center for outer shadow. Drawing outer shadow requires another callback for graphicsContext.fillRect. (WebCore::ShadowBlur::drawShadowLayer): Use m_layerSize instead of m_shadowedResultSize to fillRect, as m_layerSize is always smaller than m_shadowedResultSize. * platform/graphics/ShadowBlur.h: Rename m_sourceRect to m_shadowedResultSize, and change it to FloatSize from FloatRect. Remove GraphicsContext usage as much as possible and replace them by corresponding callbacks. * platform/graphics/cairo/CairoOperations.cpp: (WebCore::Cairo::drawShadowImage): This function corresponds to ShadowBlur::DrawImageCallback. (WebCore::Cairo::fillShadowBuffer): Erase sourceRect, as it's always bigger than layerSize. (WebCore::Cairo::drawPathShadow): (WebCore::Cairo::drawGlyphsShadow): Erase unused parameter. (WebCore::Cairo::fillRect): (WebCore::Cairo::fillRoundedRect): (WebCore::Cairo::fillRectWithRoundedHole): For tile-based optimization, add extra arguments to drawRectShadow. (WebCore::Cairo::drawSurface): Erase unused parameter. 2019-04-22 Carlos Garcia Campos REGRESSION(r241289): [GTK] accessibility/removed-continuation-element-causes-crash.html and accessibility/removed-anonymous-block-child-causes-crash.html crashes https://bugs.webkit.org/show_bug.cgi?id=194630 Reviewed by Michael Catanzaro. Do not assume core object always has a wrapper in webkitAccessibleRefChild(). Fixes: accessibility/removed-continuation-element-causes-crash.html accessibility/removed-anonymous-block-child-causes-crash.html * accessibility/atk/WebKitAccessible.cpp: (webkitAccessibleRefChild): Return early if wrapper is nullptr. 2019-04-11 Carlos Garcia Campos [GTK] Layout test accessibility/aria-hidden-false-works-in-subtrees.html fails after r184890 https://bugs.webkit.org/show_bug.cgi?id=146718 Reviewed by Joanmarie Diggs. Allow to get the text under element for nodes hidden in DOM but explicitly exposed to accessibility with aria-hidden="false". Fixes: accessibility/aria-hidden-false-works-in-subtrees.html * accessibility/AccessibilityNodeObject.cpp: (WebCore::AccessibilityNodeObject::textUnderElement const): * accessibility/atk/WebKitAccessible.cpp: (roleIsTextType): Also consider ApplicationGroup role as text elements, so that
text
is equivalent to
test
. 2019-04-10 Carlos Garcia Campos [ATK] Defer the emision of AtkObject::children-changed signal after layout is done https://bugs.webkit.org/show_bug.cgi?id=187948 Reviewed by Michael Catanzaro. The signal AtkObject::children-changed is emitted from AXObjectCache::attachWrapper() and AXObjectCache::detachWrapper(). Both can be called in the middle of a layout, so we need to defer the emission of the signal after the layout is done, to avoid other atk entry points from being called at that point, since most of them update the backing store at the beginning. Fixes: accessibility/children-changed-sends-notification.html * accessibility/AXObjectCache.cpp: (WebCore::AXObjectCache::performDeferredCacheUpdate): Call platformPerformDeferredCacheUpdate(). * accessibility/AXObjectCache.h: * accessibility/atk/AXObjectCacheAtk.cpp: (WebCore::wrapperParent): Helper to get the AtkObject parent of a given WebKitAccessible. (WebCore::AXObjectCache::detachWrapper): Add wrapper to m_deferredDetachedWrapperList. (WebCore::AXObjectCache::attachWrapper): Add object to m_deferredAttachedWrapperObjectList. (WebCore::AXObjectCache::platformPerformDeferredCacheUpdate): Emit AtkObject::children-changed::add for objects in m_deferredAttachedWrapperObjectList and AtkObject::children-changed::remove for wrappers in m_deferredDetachedWrapperList. * accessibility/ios/AXObjectCacheIOS.mm: (WebCore::AXObjectCache::platformPerformDeferredCacheUpdate): * accessibility/mac/AXObjectCacheMac.mm: (WebCore::AXObjectCache::platformPerformDeferredCacheUpdate): * accessibility/win/AXObjectCacheWin.cpp: (WebCore::AXObjectCache::platformPerformDeferredCacheUpdate): * accessibility/wpe/AXObjectCacheWPE.cpp: (WebCore::AXObjectCache::platformPerformDeferredCacheUpdate): 2019-04-10 Carlos Garcia Campos [ATK] Test accessibility/insert-children-assert.html is crashing since added in r216980 https://bugs.webkit.org/show_bug.cgi?id=172281 Reviewed by Joanmarie Diggs. The crash happens because at some point the test tries to get the anonymous block text, getting the RenderText as first child and RenderFullScreen as last child and the latter doesn't have a node. This is because in atk we do things differently, we don't include the static text elements individually, but parent element uses textUnderElement() to get all the pieces together. We can just turn the asserts into actual nullptr checks. Fixes: accessibility/insert-children-assert.html * accessibility/AccessibilityRenderObject.cpp: (WebCore::AccessibilityRenderObject::textUnderElement const): 2019-04-09 Carlos Garcia Campos [ATK] Cleanup WebKitAccessibleHyperlink https://bugs.webkit.org/show_bug.cgi?id=196602 Reviewed by Michael Catanzaro. Cleanups: - Rename webkitAccessibleHyperlinkNew() as webkitAccessibleHyperlinkGetOrCreate() and move the code to get/set the object data here. - Use WEBKIT_DEFINE_TYPE instead of custom type registration. This ensures that all CStrings used in private struct are no longer leaked. - Remove all confusing core() functions and simply use webkitAccessibleGetAccessibilityObject(). - Use nullptr instead of 0 and other coding style issues. * accessibility/atk/WebKitAccessibleHyperlink.cpp: (webkitAccessibleHyperlinkActionDoAction): (webkitAccessibleHyperlinkActionGetNActions): (webkitAccessibleHyperlinkActionGetDescription): (webkitAccessibleHyperlinkActionGetKeybinding): (webkitAccessibleHyperlinkActionGetName): (atk_action_interface_init): (webkitAccessibleHyperlinkGetURI): (webkitAccessibleHyperlinkGetObject): (rangeLengthForObject): (webkitAccessibleHyperlinkGetStartIndex): (webkitAccessibleHyperlinkGetEndIndex): (webkitAccessibleHyperlinkIsValid): (webkitAccessibleHyperlinkGetNAnchors): (webkitAccessibleHyperlinkIsSelectedLink): (webkitAccessibleHyperlinkGetProperty): (webkitAccessibleHyperlinkSetProperty): (webkit_accessible_hyperlink_class_init): (webkitAccessibleHyperlinkGetOrCreate): (core): Deleted. (atkActionInterfaceInit): Deleted. (getRangeLengthForObject): Deleted. (webkitAccessibleHyperlinkFinalize): Deleted. (webkitAccessibleHyperlinkClassInit): Deleted. (webkitAccessibleHyperlinkInit): Deleted. (webkitAccessibleHyperlinkGetType): Deleted. (webkitAccessibleHyperlinkNew): Deleted. (webkitAccessibleHyperlinkGetAccessibilityObject): Deleted. * accessibility/atk/WebKitAccessibleHyperlink.h: * accessibility/atk/WebKitAccessibleInterfaceHyperlinkImpl.cpp: (webkitAccessibleHyperlinkImplGetHyperlink): (webkitAccessibleHyperlinkImplInterfaceInit): 2019-04-08 Carlos Garcia Campos [ATK] Cleanup accessible wrapper base class https://bugs.webkit.org/show_bug.cgi?id=196601 Reviewed by Mario Sanchez Prada. Cleanups: - Rename WebKitAccessibleWrapperAtk cpp and header as WebKitAccessible for consistency with the class name. - Use WEBKIT_DEFINE_TYPE instead of custom type registration. This ensures that all CStrings used in private struct are no longer leaked. - Move core object pointer to the private struct. - Remove confusing core() function and simply get the core object from the private struct. - Use nullptr instead of 0 and other coding style issues. - Rename cacheAndReturnAtkProperty as webkitAccessibleCacheAndReturnAtkProperty and use WebKitAccessible as instance parameter. - Make webkitAccessibleGetAccessibilityObject() return a reference, since we use a fallback object on detach it never returns nullptr. - Move objectFocusedAndCaretOffsetUnignored() to WebKitAccessibleUtil. * SourcesGTK.txt: * accessibility/atk/AXObjectCacheAtk.cpp: * accessibility/atk/WebKitAccessible.cpp: Renamed from Source/WebCore/accessibility/atk/WebKitAccessibleWrapperAtk.cpp. (webkitAccessibleGetName): (webkitAccessibleGetDescription): (setAtkRelationSetFromCoreObject): (isRootObject): (webkitAccessibleGetParent): (webkitAccessibleGetNChildren): (webkitAccessibleRefChild): (webkitAccessibleGetIndexInParent): (webkitAccessibleGetAttributes): (atkRole): (webkitAccessibleGetRole): (webkitAccessibleRefStateSet): (webkitAccessibleRefRelationSet): (webkitAccessibleInit): (webkitAccessibleGetObjectLocale): (webkit_accessible_class_init): (interfaceMaskFromObject): (uniqueAccessibilityTypeName): (accessibilityTypeFromObject): (webkitAccessibleNew): (webkitAccessibleGetAccessibilityObject): (webkitAccessibleDetach): (webkitAccessibleIsDetached): (webkitAccessibleCacheAndReturnAtkProperty): * accessibility/atk/WebKitAccessible.h: Renamed from Source/WebCore/accessibility/atk/WebKitAccessibleWrapperAtk.h. * accessibility/atk/WebKitAccessibleHyperlink.cpp: (core): * accessibility/atk/WebKitAccessibleInterfaceAction.cpp: (core): (webkitAccessibleActionGetKeybinding): (webkitAccessibleActionGetName): * accessibility/atk/WebKitAccessibleInterfaceComponent.cpp: (core): * accessibility/atk/WebKitAccessibleInterfaceDocument.cpp: (core): (documentAttributeValue): * accessibility/atk/WebKitAccessibleInterfaceEditableText.cpp: (core): * accessibility/atk/WebKitAccessibleInterfaceHypertext.cpp: (core): * accessibility/atk/WebKitAccessibleInterfaceImage.cpp: (core): (webkitAccessibleImageGetImageDescription): * accessibility/atk/WebKitAccessibleInterfaceSelection.cpp: (core): * accessibility/atk/WebKitAccessibleInterfaceTable.cpp: (core): * accessibility/atk/WebKitAccessibleInterfaceTableCell.cpp: (core): * accessibility/atk/WebKitAccessibleInterfaceText.cpp: (core): * accessibility/atk/WebKitAccessibleInterfaceValue.cpp: (core): * accessibility/atk/WebKitAccessibleUtil.cpp: (objectFocusedAndCaretOffsetUnignored): * accessibility/atk/WebKitAccessibleUtil.h: * editing/atk/FrameSelectionAtk.cpp: 2019-04-05 Carlos Garcia Campos [ATK] Use a smart pointer for AccessibilityObject wrapper and remove GTK specific code https://bugs.webkit.org/show_bug.cgi?id=196593 Reviewed by Michael Catanzaro. We have specific code for GTK to get/set the wrapper only because we don't use smart pointers. Also use WebKitAccessible as AccessibilityObjectWrapper instead of generic AtkObject, to enforce wrappers to be WebKitAccessible instances. This requires a few casts to AtkObject. * accessibility/AccessibilityObject.h: (WebCore::AccessibilityObject::setWrapper): * accessibility/AccessibilityObjectInterface.h: * accessibility/atk/AXObjectCacheAtk.cpp: (WebCore::AXObjectCache::detachWrapper): (WebCore::AXObjectCache::attachWrapper): (WebCore::notifyChildrenSelectionChange): (WebCore::AXObjectCache::postPlatformNotification): (WebCore::AXObjectCache::nodeTextChangePlatformNotification): (WebCore::AXObjectCache::frameLoadingEventPlatformNotification): (WebCore::AXObjectCache::platformHandleFocusedUIElementChanged): * accessibility/atk/AccessibilityObjectAtk.cpp: * accessibility/atk/WebKitAccessibleInterfaceComponent.cpp: (webkitAccessibleComponentRefAccessibleAtPoint): * accessibility/atk/WebKitAccessibleInterfaceHypertext.cpp: (webkitAccessibleHypertextGetLink): (webkitAccessibleHypertextGetNLinks): * accessibility/atk/WebKitAccessibleInterfaceSelection.cpp: (webkitAccessibleSelectionRefSelection): * accessibility/atk/WebKitAccessibleInterfaceTable.cpp: (webkitAccessibleTableRefAt): (webkitAccessibleTableGetColumnHeader): (webkitAccessibleTableGetRowHeader): (webkitAccessibleTableGetCaption): * accessibility/atk/WebKitAccessibleInterfaceTableCell.cpp: (convertToGPtrArray): (webkitAccessibleTableCellGetTable): * accessibility/atk/WebKitAccessibleInterfaceText.cpp: (accessibilityObjectLength): * accessibility/atk/WebKitAccessibleWrapperAtk.cpp: (setAtkRelationSetFromCoreObject): (atkParentOfRootObject): (webkitAccessibleGetParent): (webkitAccessibleRefChild): (isTextWithCaret): * editing/atk/FrameSelectionAtk.cpp: (WebCore::emitTextSelectionChange): (WebCore::maybeEmitTextFocusChange): 2019-04-03 Carlos Garcia Campos [ATK] Wrong index passed to AtkObject::children-changed::add signal in AXObjectCache::attachWrapper() https://bugs.webkit.org/show_bug.cgi?id=196538 Reviewed by Michael Catanzaro. In most of the cases the parent is not found, probably because the child is not a direct descendant of the parent returned by parentObjectUnignored(). We need to handle the case of find() returning notFound. * accessibility/atk/AXObjectCacheAtk.cpp: (WebCore::AXObjectCache::attachWrapper): Use -1 as the index when find() returns notFound. 2019-04-03 Myles C. Maxfield Documents can be destroyed before their CSSFontFaceSet is destroyed https://bugs.webkit.org/show_bug.cgi?id=195830 Reviewed by Darin Adler. CSSFontFaceSet has a raw pointer to its owning document. JS can keep the CSSFontFaceSet alive (by using FontFaceSet) and can destroy the document at any time. When the document is destroyed, the link between the two objects needs to be severed. Test: fast/text/font-face-set-destroy-document.html * css/CSSFontFace.cpp: (WebCore::CSSFontFace::CSSFontFace): * css/CSSFontFace.h: * css/CSSFontFaceSet.cpp: (WebCore::CSSFontFaceSet::CSSFontFaceSet): (WebCore::CSSFontFaceSet::ensureLocalFontFacesForFamilyRegistered): * css/CSSFontFaceSet.h: * css/CSSFontSelector.cpp: (WebCore::CSSFontSelector::CSSFontSelector): (WebCore::CSSFontSelector::addFontFaceRule): * css/CSSFontSelector.h: * css/FontFace.cpp: (WebCore::FontFace::FontFace): 2019-04-02 Ryosuke Niwa Crash in HTMLCanvasElement::createContext2d after the element got adopted to a new document https://bugs.webkit.org/show_bug.cgi?id=196527 Reviewed by Antti Koivisto. We need to update CanvasBase::m_scriptExecutionContext when HTMLCanvasElement moves from one document to another. Fixed the bug by making CanvasBase::scriptExecutionContext make a virtual function call instead of directly storing a raw pointer. In HTMLCanvasElement, we use Node::scriptExecutionContext(). Use ContextDestructionObserver in CustomPaintCanvas and OffscreenCanvas instead of a raw pointer. Unfortunately, no new tests since there is no reproducible test case. * html/CanvasBase.cpp: (WebCore::CanvasBase::CanvasBase): * html/CanvasBase.h: (WebCore::CanvasBase::scriptExecutionContext const): * html/CustomPaintCanvas.cpp: (WebCore::CustomPaintCanvas::CustomPaintCanvas): * html/CustomPaintCanvas.h: * html/HTMLCanvasElement.cpp: (WebCore::HTMLCanvasElement::HTMLCanvasElement): * html/HTMLCanvasElement.h: * html/OffscreenCanvas.cpp: (WebCore::OffscreenCanvas::OffscreenCanvas): * html/OffscreenCanvas.h: 2019-03-26 Dean Jackson vertexAttribPointer must restrict offset parameter https://bugs.webkit.org/show_bug.cgi?id=196261 Reviewed by Antoine Quint. This WebGL function should fail if the offset parameter is not within [0, max 32-bit int]. Test: fast/canvas/webgl/vertexAttribPointer-with-bad-offset.html * html/canvas/WebGLRenderingContextBase.cpp: (WebCore::WebGLRenderingContextBase::vertexAttribPointer): 2019-03-21 Jer Noble Inband Text Track cues interspersed with Data cues can display out of order. https://bugs.webkit.org/show_bug.cgi?id=196095 Reviewed by Eric Carlson. The compareCueIntervalForDisplay() comparator depends on a virtual function, isPositionedAbove(TextTrackCue* other), but this comparison returns inconsistent results for cueA->isPositionedAbove(cueB) and cueB->isPositionedAbove(cueA) if the two cues are different subclasses of TextTrackCue. The underlying algorithm should be fixed in a future patch, but for now, remove all non-displaying cues from the array of activeCues before sorting, rather than after when iterating over the sorted list of activeCues. * html/shadow/MediaControlElements.cpp: (WebCore::MediaControlTextTrackContainerElement::updateDisplay): 2019-03-21 Zalan Bujtas Do not insert the first-letter anonymous container until after we've constructed the first-letter renderer. https://bugs.webkit.org/show_bug.cgi?id=195919 Reviewed by Brent Fulgham. When the container is injected too early, we might end up removing it as part of the collapsing logic while the text renderer is being removed (replaced with the first letter + remaining text). Test: fast/css/first-letter-and-float-crash.html * rendering/updating/RenderTreeBuilderFirstLetter.cpp: (WebCore::RenderTreeBuilder::FirstLetter::createRenderers): 2019-03-19 Ryosuke Niwa appendChild should throw when inserting an ancestor of a template into its content adopted to another document https://bugs.webkit.org/show_bug.cgi?id=195984 Reviewed by Darin Adler. The WPT test caught a bug that appendChild and other DOM insertion functions were incorrectly assuming that any node that's in a HTML template element has the current document's template document as its owner. The assumption is wrong when the template element's content DocumentFragment is adopted to another document. Fixed the bug by always checking the ancestor host elements in checkAcceptChild. Also Test: fast/dom/insert-template-parent-into-adopted-content.html * dom/ContainerNode.cpp: (WebCore::isInTemplateContent): Deleted. This code is simply wrong. (WebCore::containsConsideringHostElements): Deleted. Call sites are updated to use containsIncludingHostElements. (WebCore::containsIncludingHostElements): Moved from Node.cpp and optimized this code a bit. It's more efficient to get the parent node and check for ShadowRoot and DocumentFragment only when the parent is null than to check for those two node types before getting the parent node. (WebCore::checkAcceptChild): Merged two code paths to call containsIncludingHostElements. The early return for a pseudo element is there only to prevent tree corruption in release build even in the presence of a major bug so it shouldn't be an spec compliance issue. * dom/Node.cpp: (WebCore::Node::containsIncludingHostElements const): Deleted. * dom/Node.h: 2019-03-19 Ryosuke Niwa Reparenting during a mutation event inside appendChild could result in a circular DOM tree https://bugs.webkit.org/show_bug.cgi?id=192825 Reviewed by Zalan Bujtas. The bug was caused by appendChildWithoutPreInsertionValidityCheck, insertBefore and replaceChild checking the circular dependency against newChild instead of targets even though when newChild is a document fragment, appendChildWithoutPreInsertionValidityCheck inserts the children of the document fragment. Fixed the bug by checking the circular dependency against each target child. Also fixed the bug that checkAcceptChildGuaranteedNodeTypes was not considering shadow inclusive ancestors or template host elements. Tests: fast/dom/append-child-with-mutation-event-removal-and-circular-insertion.html fast/dom/append-child-with-mutation-event-removal-and-circular-shadow-insertion.html fast/dom/append-child-with-mutation-event-removal-and-circular-template-insertion.html fast/dom/insert-child-with-mutation-event-removal-and-circular-insertion.html fast/dom/insert-child-with-mutation-event-removal-and-circular-shadow-insertion.html fast/dom/insert-child-with-mutation-event-removal-and-circular-template-insertion.html fast/dom/replace-child-with-mutation-event-removal-and-circular-insertion.html fast/dom/replace-child-with-mutation-event-removal-and-circular-shadow-insertion.html fast/dom/replace-child-with-mutation-event-removal-and-circular-template-insertion.html * dom/ContainerNode.cpp: (WebCore::checkAcceptChildGuaranteedNodeTypes): (WebCore::ContainerNode::insertBefore): (WebCore::ContainerNode::replaceChild): (WebCore::ContainerNode::appendChildWithoutPreInsertionValidityCheck): 2019-03-14 Ryosuke Niwa Storing a Node in Ref/RefPtr inside its destructor results in double delete https://bugs.webkit.org/show_bug.cgi?id=195661 Reviewed by Brent Fulgham. Set Node::m_refCount to 1 before calling its virtual destructor. This is a security mitigation to prevent any code which ends up storing the node to Ref / RefPtr inside the destructor, which is a programming error caught by debug assertions, from triggering a double-delete on the same Node. Such a code would hit the debug assertions in Node::deref() because m_inRemovedLastRefFunction had been set to true by then. * dom/Document.cpp: (WebCore::Document::removedLastRef): * dom/Document.h: (WebCore::Document::decrementReferencingNodeCount): * dom/Node.cpp: (WebCore::Node::~Node): (WebCore::Node::removedLastRef): 2019-03-14 Zalan Bujtas Cleanup inline boxes when list marker gets blockified https://bugs.webkit.org/show_bug.cgi?id=195746 Reviewed by Antti Koivisto. Normally when an element gets blockified (inline -> block) we destroy its renderer and construct a new one (RenderInline -> RenderBlock). During this process the associated inline boxtree gets destroyed as well. Since RenderListMarker is just a generic RenderBox, the blockifying change does not require a new renderer. This patch takes care of destroying the inline boxtree when the marker gains block display type. Test: fast/block/float/list-marker-is-float-crash.html * rendering/RenderListMarker.cpp: (WebCore::RenderListMarker::styleDidChange): 2019-03-13 Zalan Bujtas [WeakPtr] RenderListMarker::m_listItem should be a WeakPtr https://bugs.webkit.org/show_bug.cgi?id=195704 Reviewed by Simon Fraser. * rendering/RenderListMarker.cpp: (WebCore::RenderListMarker::RenderListMarker): (WebCore::RenderListMarker::paint): (WebCore::RenderListMarker::layout): (WebCore::RenderListMarker::updateContent): (WebCore::RenderListMarker::computePreferredLogicalWidths): (WebCore::RenderListMarker::lineHeight const): (WebCore::RenderListMarker::baselinePosition const): (WebCore::RenderListMarker::suffix const): (WebCore::RenderListMarker::isInside const): (WebCore::RenderListMarker::getRelativeMarkerRect): * rendering/RenderListMarker.h: 2019-03-13 Zalan Bujtas Use RenderBox::previousSiblingBox/nextSiblingBox in RenderMultiColumnFlow https://bugs.webkit.org/show_bug.cgi?id=195701 Reviewed by Simon Fraser. It's safer to use existing RenderBox functions to get sibling boxes. Test: fast/ruby/crash-when-paginated-ruby.html * rendering/RenderMultiColumnFlow.cpp: (WebCore::RenderMultiColumnFlow::nextColumnSetOrSpannerSiblingOf): (WebCore::RenderMultiColumnFlow::previousColumnSetOrSpannerSiblingOf): 2019-03-13 Wenson Hsieh Fix an edge case where HTMLFormElement::removeFormElement is invoked twice with the same element https://bugs.webkit.org/show_bug.cgi?id=195663 Reviewed by Ryosuke Niwa. Currently, it's possible for HTMLFormControlElement's destructor to be reentrant. This may happen if the form control element is ref'd while carrying out its destructor's logic. This may happen in two places in HTMLFormControlElement (didChangeForm and resetDefaultButton), both of which actually don't require ensuring a protected reference to the form control element since they should never result in any script execution. To fix the bug, convert these strong references into raw pointers, and add ScriptDisallowedScope to ensure that we don't change these codepaths in the future, such that they trigger arbitrary script execution. Test: fast/forms/remove-associated-element-after-gc.html * html/HTMLFormControlElement.cpp: (WebCore::HTMLFormControlElement::didChangeForm): * html/HTMLFormElement.cpp: (WebCore::HTMLFormElement::resetDefaultButton): 2019-04-04 Miguel Gomez [GTK][WPE] Use a timer to request the creation of pending tiles https://bugs.webkit.org/show_bug.cgi?id=196594 Reviewed by Žan Doberšek. Use a timer to request pending tile creation, as calls to notifyFlushRequired() are discarded while inside a layer flush. * platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp: (WebCore::CoordinatedGraphicsLayer::CoordinatedGraphicsLayer): (WebCore::CoordinatedGraphicsLayer::flushCompositingStateForThisLayerOnly): (WebCore::CoordinatedGraphicsLayer::updateContentBuffers): (WebCore::CoordinatedGraphicsLayer::requestPendingTileCreationTimerFired): * platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.h: 2019-04-05 Sergio Villar Senin [GTK][WPE] outlook.live.com displays old-fashioned UI https://bugs.webkit.org/show_bug.cgi?id=196642 Reviewed by Carlos Garcia Campos. The new good looking UI is shown as long as pretend we're a Mac in the UA. * platform/UserAgentQuirks.cpp: (WebCore::urlRequiresChromeBrowser): 2019-04-03 Michael Catanzaro Get rid of HTMLInputElement::setEditingValue https://bugs.webkit.org/show_bug.cgi?id=196402 Reviewed by Darin Adler. HTMLInputElement::setEditingValue is only used for Epiphany password autofill. We did it this way because that's what Chrome uses for autofill, but Apple uses HTMLInputElement::setValueForUser. Let's switch to that instead, then we can get rid of setEditingValue. This fixes logging into ting.com after username and password are autofilled by Epiphany. Before this change, the login would fail unless you first manually edit either the username or the password field. * html/HTMLInputElement.cpp: (WebCore::HTMLInputElement::setEditingValue): Deleted. * html/HTMLInputElement.h: * testing/Internals.cpp: (WebCore::Internals::setEditingValue): Deleted. * testing/Internals.h: * testing/Internals.idl: 2019-03-28 Carlos Garcia Campos [FreeType] Incorrect application of glyph positioning in the Y direction https://bugs.webkit.org/show_bug.cgi?id=161493 Reviewed by Michael Catanzaro. Use the first glyph origin as the initial advance of every complex text run. * platform/graphics/cairo/FontCairo.cpp: (WebCore::FontCascade::drawGlyphs): Update the yOffset using the height advance. * platform/graphics/cairo/GraphicsContextImplCairo.cpp: (WebCore::GraphicsContextImplCairo::drawGlyphs): Ditto. * platform/graphics/harfbuzz/ComplexTextControllerHarfBuzz.cpp: (WebCore::ComplexTextController::ComplexTextRun::ComplexTextRun): Set the initial advance. 2019-02-28 Carlos Garcia Campos [CoordinatedGraphics] Remove COORDINATED_GRAPHICS_THREADED option https://bugs.webkit.org/show_bug.cgi?id=195159 Reviewed by Don Olmstead. Use COORDINATED_GRAPHICS instead. * platform/graphics/GraphicsContext3D.h: * platform/graphics/PlatformLayer.h: * platform/graphics/cairo/ImageBufferCairo.cpp: (WebCore::ImageBufferData::ImageBufferData): (WebCore::ImageBufferData::~ImageBufferData): * platform/graphics/cairo/ImageBufferDataCairo.h: * platform/graphics/nicosia/NicosiaPaintingEngineThreaded.cpp: * platform/graphics/nicosia/NicosiaPaintingEngineThreaded.h: * platform/graphics/nicosia/texmap/NicosiaGC3DLayer.cpp: (Nicosia::GC3DLayer::swapBuffersIfNeeded): * platform/graphics/opengl/GraphicsContext3DOpenGL.cpp: (WebCore::GraphicsContext3D::reshapeFBOs): * platform/graphics/opengl/GraphicsContext3DOpenGLCommon.cpp: (WebCore::GraphicsContext3D::prepareTexture): * platform/graphics/opengl/GraphicsContext3DOpenGLES.cpp: (WebCore::GraphicsContext3D::reshapeFBOs): * platform/graphics/texmap/GraphicsContext3DTextureMapper.cpp: (WebCore::GraphicsContext3D::GraphicsContext3D): (WebCore::GraphicsContext3D::~GraphicsContext3D): * platform/graphics/texmap/TextureMapperGC3DPlatformLayer.cpp: (WebCore::TextureMapperGC3DPlatformLayer::TextureMapperGC3DPlatformLayer): (WebCore::TextureMapperGC3DPlatformLayer::~TextureMapperGC3DPlatformLayer): * platform/graphics/texmap/TextureMapperGC3DPlatformLayer.h: * platform/graphics/texmap/TextureMapperPlatformLayerBuffer.cpp: * platform/graphics/texmap/TextureMapperPlatformLayerBuffer.h: * platform/graphics/texmap/TextureMapperPlatformLayerProxy.cpp: * platform/graphics/texmap/TextureMapperPlatformLayerProxy.h: * platform/graphics/texmap/TextureMapperPlatformLayerProxyProvider.h: * platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp: (WebCore::CoordinatedGraphicsLayer::setContentsNeedsDisplay): (WebCore::CoordinatedGraphicsLayer::setContentsToPlatformLayer): (WebCore::CoordinatedGraphicsLayer::updatePlatformLayer): * rendering/RenderLayerBacking.cpp: (WebCore::RenderLayerBacking::paintsIntoWindow const): * rendering/RenderLayerCompositor.cpp: (WebCore::RenderLayerCompositor::shouldCompositeOverflowControls const): 2019-03-27 Philippe Normand [GStreamer] Remove the HLS queue buffering query hack https://bugs.webkit.org/show_bug.cgi?id=196244 Reviewed by Xabier Rodriguez-Calvar. Because the http src element now provides network statistics to the player we can now compute an estimation of the data loading in case the buffering query isn't handled by any element of the pipeline. No new tests, existing HLS tests cover this change. * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp: (WebCore::MediaPlayerPrivateGStreamer::fillTimerFired): (WebCore::findHLSQueue): Deleted. (WebCore::isHLSProgressing): Deleted. 2019-03-20 Philippe Normand [GStreamer] Switch back to webkitwebsrc for adaptive streaming fragments downloading https://bugs.webkit.org/show_bug.cgi?id=195948 Reviewed by Xabier Rodriguez-Calvar. The webkitwebsrc element now behaves much better when used through GStreamer's adaptivedemux, so use it for all WebKit media downloads. The MediaPlayer needed by the webkitwebsrc element now travels through GstContext messages and queries so that it can be shared by multiple elements, typically the first webkitwebsrc element downloads the HLS manifest and then adaptivedemux, through uridownloader, will create new webkitwebsrc elements for fragments downloading. Those new elements will query the first webkitwebsrc element for its context. The previous hack used to check SecurityOrigins can also be cleaned-up. The origins are now cached upon reception of the HTTP headers message from webkitwebsrc. No new tests, existing http/tests/media/hls tests cover this change. * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp: (WebCore::MediaPlayerPrivateGStreamer::setPlaybinURL): (WebCore::MediaPlayerPrivateGStreamer::loadFull): (WebCore::MediaPlayerPrivateGStreamer::handleMessage): (WebCore::MediaPlayerPrivateGStreamer::loadNextLocation): (WebCore::MediaPlayerPrivateGStreamer::wouldTaintOrigin const): (WebCore::convertToInternalProtocol): Deleted. * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h: * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp: (WebCore::MediaPlayerPrivateGStreamerBase::handleSyncMessage): * platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp: (webkit_web_src_class_init): (webKitWebSrcSetContext): (webKitWebSrcStart): (webKitWebSrcGetProtocols): (webKitWebSrcSetUri): (CachedResourceStreamingClient::responseReceived): (convertPlaybinURI): Deleted. (webKitSrcWouldTaintOrigin): Deleted. * platform/graphics/gstreamer/WebKitWebSourceGStreamer.h: 2019-03-19 Philippe Normand REGRESSION(r243058): [GStreamer] 3 tests now timing out https://bugs.webkit.org/show_bug.cgi?id=195888 Reviewed by Xabier Rodriguez-Calvar. A breaking change was introduced in r243058. Now on-disk-buffering is disabled when the reported Content-Length is 0 or not present at all. This broke the progress event logic in didLoadProgress() because leading to progress events not being fired as expected. The proposed solution is to make webkitwebsrc notify the player every time the network process receives data from the network. So the player can now easily determine if the load progressed by checking the reported statistics. No new tests, existing media tests cover this change. * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp: (WebCore::MediaPlayerPrivateGStreamer::handleMessage): (WebCore::MediaPlayerPrivateGStreamer::didLoadingProgress const): * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h: * platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp: (CachedResourceStreamingClient::dataReceived): 2019-03-18 Philippe Normand [GStreamer] Rewrite HTTP source element using pushsrc base class https://bugs.webkit.org/show_bug.cgi?id=195631 Reviewed by Xabier Rodriguez-Calvar. If we want to use webkitwebsrc in adaptivedemux (HLS, DASH, etc) we need a source element that behaves like souphttpsrc, which is implemented using pushsrc. This rewrite might also fix some seek issues. No new tests, existing http/tests/media tests cover this patch. * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp: (WebCore::MediaPlayerPrivateGStreamer::handleMessage): * platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp: (webkit_web_src_class_init): (webkitWebSrcReset): (webkit_web_src_init): (webKitWebSrcCreate): (webKitWebSrcStart): (webKitWebSrcCloseSession): (webKitWebSrcStop): (webKitWebSrcGetSize): (webKitWebSrcIsSeekable): (webKitWebSrcDoSeek): (webKitWebSrcQuery): (webKitWebSrcUnLock): (webKitWebSrcUnLockStop): (webKitWebSrcChangeState): (CachedResourceStreamingClient::checkUpdateBlocksize): (CachedResourceStreamingClient::responseReceived): (CachedResourceStreamingClient::dataReceived): (CachedResourceStreamingClient::accessControlCheckFailed): (CachedResourceStreamingClient::loadFailed): (CachedResourceStreamingClient::loadFinished): * platform/graphics/gstreamer/WebKitWebSourceGStreamer.h: 2019-02-13 Alex Christensen Stop using setDefersLoading from WebCore https://bugs.webkit.org/show_bug.cgi?id=194315 Reviewed by Jer Noble. That is what CompletionHandlers are for. * loader/MediaResourceLoader.cpp: (WebCore::MediaResource::responseReceived): (WebCore::MediaResource::setDefersLoading): Deleted. * loader/MediaResourceLoader.h: * platform/graphics/PlatformMediaResourceLoader.h: (WebCore::PlatformMediaResourceClient::responseReceived): (WebCore::PlatformMediaResource::stop): (WebCore::PlatformMediaResource::setDefersLoading): Deleted. * platform/network/cocoa/WebCoreNSURLSession.mm: (WebCore::WebCoreNSURLSessionDataTaskClient::responseReceived): (-[WebCoreNSURLSessionDataTask resource:receivedResponse:completionHandler:]): (-[WebCoreNSURLSessionDataTask _setDefersLoading:]): Deleted. (-[WebCoreNSURLSessionDataTask resource:receivedResponse:]): Deleted. 2019-03-27 Philippe Normand Build failure with gstreamer 1.12.5 if USE_GSTREAMER_GL is enabled https://bugs.webkit.org/show_bug.cgi?id=196178 Reviewed by Xabier Rodriguez-Calvar. The gst/gl/gl.h header needs to be included before GraphicsContext3D.h to avoid declaration conflicts with OpenGLShims. Based on a patch from Mike Gorse * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp: (WebCore::GstVideoFrameHolder::GstVideoFrameHolder): 2019-03-26 Philippe Normand [GStreamer] Sound loop with Google Hangouts and WhatsApp notifications https://bugs.webkit.org/show_bug.cgi?id=189471 Reviewed by Xabier Rodriguez-Calvar. The media duration is now cached (again). The loop issue was triggered by the previous version of the code returning positive infinite duration in didEnd(), followed by the timeupdate event propagation that would trick the HTMLMediaElement into a new call to play(). Now the cached duration is updated to current position at EOS (for forward playback direction only), so the media element no longer triggers a new play call for those cases. * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp: (WebCore::MediaPlayerPrivateGStreamer::MediaPlayerPrivateGStreamer): (WebCore::MediaPlayerPrivateGStreamer::loadFull): (WebCore::MediaPlayerPrivateGStreamer::playbackPosition const): (WebCore::MediaPlayerPrivateGStreamer::platformDuration const): (WebCore::MediaPlayerPrivateGStreamer::durationMediaTime const): (WebCore::MediaPlayerPrivateGStreamer::currentMediaTime const): (WebCore::MediaPlayerPrivateGStreamer::didEnd): (WebCore::MediaPlayerPrivateGStreamer::durationChanged): * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h: * platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.cpp: (WebCore::MediaPlayerPrivateGStreamerMSE::currentMediaTime const): 2019-03-22 Alicia Boya García [MSE][GStreamer] Don't construct segments on PlaybackPipeline::flush https://bugs.webkit.org/show_bug.cgi?id=195867 Reviewed by Xabier Rodriguez-Calvar. The previous approach did not really work for flushes on only one branch, as setting reset-time in FLUSH_STOP affects the running time of the entire pipeline, causing timing issues in the other branch. Since it's preferable not to interfere with the other branch if possible, setting reset-time to FALSE fixes that problem. Also, it's not necessary to fabricate a segment. Since we are not seeking, only the base needs to be adjusted, and gstbasesrc already handles this correctly by default. This fixes an audio/video synchronization bug in YT when some automatic quality changes occur. Tests: imported/w3c/web-platform-tests/media-source/mediasource-correct-frames-after-reappend.html imported/w3c/web-platform-tests/media-source/mediasource-correct-frames.html * platform/graphics/gstreamer/mse/PlaybackPipeline.cpp: (WebCore::PlaybackPipeline::flush): 2019-03-20 Alicia Boya García [MSE][GStreamer] Fix handling of resolution changes in AppendPipeline https://bugs.webkit.org/show_bug.cgi?id=195855 Reviewed by Xabier Rodriguez-Calvar. MediaSample instances produced by the AppendPipeline were not accounting for resolution changes. The causes of this are twofold: 1) m_presentationSize is set by connectDemuxerSrcPadToAppsink() (by calling parseDemuxerSrcPadCaps()), but not by appsinkCapsChanged(). 2) appsinkCapsChanged() was being called in the main thread as an asynchronous task. In consequence, even if m_presentationSize is set there, many samples with the new resolution would still be wrapped in a MediaSampleGStreamer using the old resolution by the main thread running consumeAppsinkAvailableSamples() before appsinkCapsChanged() is dispatched. This patch fixes these problems by updating m_presentationSize in appsinkCapsChanged() and making the streaming thread block until the main thread has dispatched appsinkCapsChanged(). This way the handling of caps changes is serialized with the handling of frames. Test: media/media-source/media-source-samples-resolution-change.html * platform/graphics/gstreamer/mse/AppendPipeline.cpp: (WebCore::AppendPipeline::AppendPipeline): (WebCore::AppendPipeline::appsinkCapsChanged): 2019-03-19 Alicia Boya García [MSE] Use tolerance in eraseBeginTime https://bugs.webkit.org/show_bug.cgi?id=195911 Reviewed by Jer Noble. https://bugs.webkit.org/show_bug.cgi?id=190085 introduced tolerance when erasing frames during the Coded Frame Processing algorithm in such a way that, in files with less than perfect timestamps, a frame existing before after the current append is not erased accidentally due to small overlaps. This patch takes care of the opposite problem: we don't want an old frame being accidentally NOT erased by a new one with the same timestamps just because these overlaps make highestPresentationTimestamp very slightly higher than the frame PTS. This bug in practice causes some frames of the old quality to not be erased when the new quality is appended, resulting in some seemingly still frames from a different quality appearing at some points during WebM video in presence of quality changes. This bug can be reduced to this minimal test case that illustrates the timestamp imprecission of a typical WebM file: function sampleRun(generation) { return concatenateSamples([ makeASample( 0, 0, 166667, 1000000, 1, SAMPLE_FLAG.SYNC, generation), makeASample(167000, 167000, 166667, 1000000, 1, SAMPLE_FLAG.NONE, generation), makeASample(333000, 333000, 166667, 1000000, 1, SAMPLE_FLAG.SYNC, generation), // overlaps previous frame makeASample(500000, 500000, 166667, 1000000, 1, SAMPLE_FLAG.NONE, generation), ]); } After appending this twice it would be expected that the second generation takes fully over the first, since the timestamps are completely the same. Due to the bug, sync frames with an overlap, like the third one in that list, actually persist from the first generation, due to lack of tolerance when comparing the start of a new frame with highestPresentationTimestamp. This patch introduces the tolerance in that case too to fix this problem. Test: media/media-source/media-source-append-twice-overlapping-sync-frame.html * Modules/mediasource/SourceBuffer.cpp: (WebCore::SourceBuffer::sourceBufferPrivateDidReceiveSample): 2019-03-18 Chris Dumez REGRESSION(r236862): early frame decoupling leaves JSC ArrayBuffer objects lingering https://bugs.webkit.org/show_bug.cgi?id=195322 Reviewed by Ryosuke Niwa. Since r236862, DOMWindow objects get disconnected from their Frame object as soon as their iframe element gets removed from the document. Previously, DOMWindow was a FrameDestructionObserver and would stay connected to its frame until the frame died. This means that some of the work that we were doing in DOMWindow::frameDestroyed() and Document::willDetachPage() no longer happens for subframe windows because they get disconnected from their frame because they get a chance to get such notifications. To address this issue, we now also do this work in DOMWindow::willDetachDocumentFromFrame() which gets called when the iframe gets removed from the document and the document / window get disconnected from the Frame element. No new tests, verified locally that the leak is gone on JetStream. * page/DOMWindow.cpp: (WebCore::DOMWindow::willDetachDocumentFromFrame): 2019-03-12 Philippe Normand [GStreamer][v4l2] Synchronous video texture flushing support https://bugs.webkit.org/show_bug.cgi?id=195453 Reviewed by Xabier Rodriguez-Calvar. The v4l2 video decoder currently requires that downstream users of the graphics resources complete any pending draw call and release resources before returning from the DRAIN query. To accomplish this the player monitors the pipeline and whenever a v4l2 decoder is added, synchronous video texture flushing support is enabled. Additionally and for all decoder configurations, a flush is performed before disposing of the player. * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp: (WebCore::MediaPlayerPrivateGStreamer::playbinDeepElementAddedCallback): Monitor elements added to the decodebin bin. (WebCore::MediaPlayerPrivateGStreamer::decodebinElementAdded): Set a flag if a v4l2 decoder was added in decodebin. (WebCore::MediaPlayerPrivateGStreamer::createGSTPlayBin): Connect to the deep-element-added signal so as to monitor pipeline topology updates. * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h: * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp: (WebCore::MediaPlayerPrivateGStreamerBase::~MediaPlayerPrivateGStreamerBase): Flush video texture before disposing of the player. (WebCore::MediaPlayerPrivateGStreamerBase::flushCurrentBuffer): Synchronously flush if the pipeline contains a v4l2 decoder. (WebCore::MediaPlayerPrivateGStreamerBase::createGLAppSink): Monitor push events only. * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.h: * platform/graphics/texmap/TextureMapperPlatformLayerProxy.cpp: (WebCore::TextureMapperPlatformLayerProxy::pushNextBuffer): New boolean flag used mostly to trigger synchronous flush conditions. (WebCore::TextureMapperPlatformLayerProxy::dropCurrentBufferWhilePreservingTexture): Optionally drop the current buffer in a synchronous manner. By default the method keeps operating asynchronously. * platform/graphics/texmap/TextureMapperPlatformLayerProxy.h: 2019-03-08 Zan Dobersek GLContextEGL: desired EGL config should search for 8-bit components by default https://bugs.webkit.org/show_bug.cgi?id=195413 Reviewed by Carlos Garcia Campos. The EGL config search in GLContextEGL should by default look for RGBA8888 configurations while allowing RGB565 as an alternative. This prevents from accidentally landing on an RGBA1010102 configuration that is available with some graphics stacks, and which is not expected in e.g. window snapshotting that's done for layout test output comparison. * platform/graphics/egl/GLContextEGL.cpp: (WebCore::GLContextEGL::getEGLConfig): EGL config search should by default request 8-bit color channels. 2019-03-13 Miguel Gomez [CoordinatedGraphics] Null dereference in CoordinatedGraphicsLayer::setCoordinatorIncludingSubLayersIfNeeded https://bugs.webkit.org/show_bug.cgi?id=195615 Reviewed by Carlos Garcia Campos. Exit early if we don't receive a valid coordinator. * platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp: (WebCore::CoordinatedGraphicsLayer::setCoordinatorIncludingSubLayersIfNeeded): 2019-03-12 Dean Jackson [WebGL] WebGLBuffer can be too large https://bugs.webkit.org/show_bug.cgi?id=195068 Reviewed by Antoine Quint. When creating an element array buffer, make sure to test against the maximum size of an ArrayBuffer, rather than just assume it can be created. Test: fast/canvas/webgl/largeBuffer.html * html/canvas/WebGLBuffer.cpp: (WebCore::WebGLBuffer::associateBufferDataImpl): 2019-03-05 Said Abou-Hallawa SVGPathSegList.insertItemBefore() should fail if the newItem belongs to an animating animPathSegList https://bugs.webkit.org/show_bug.cgi?id=195333 Reviewed by Simon Fraser. Because the SVG1.1 specs states that the newItem should be removed from its original list before adding it to another list, SVGPathSegList.insertItemBefore() should fail if the new item belongs to an animating animPathSegList since it is read-only. Test: svg/dom/SVGPathSegList-insert-from-animating-animPathSegList.svg * svg/SVGPathSegList.cpp: (WebCore::SVGPathSegList::processIncomingListItemValue): 2019-03-08 Miguel Gomez Use a thread safe refcounter for FilterOperation. https://bugs.webkit.org/show_bug.cgi?id=194149 Reviewed by Carlos Garcia Campos. Use a thread safe refcounter for FilterOperation. * platform/graphics/filters/FilterOperation.h: 2019-03-06 Wenson Hsieh Crash when attempting to change input type while dismissing datalist suggestions https://bugs.webkit.org/show_bug.cgi?id=195384 Reviewed by Brent Fulgham. When closing a datalist suggestion menu, WebPageProxy sends a message to WebPage instructing it to tell its active datalist suggestions picker to close. However, for a myriad of reasons, the suggestions picker (kept alive by its text input type) may have already gone away by this point. To mitigate this, make WebPage weakly reference its active datalist suggestions picker. Test: fast/forms/datalist/change-input-type-after-closing-datalist-suggestions.html * platform/DataListSuggestionPicker.h: Make DataListSuggestionPicker capable of being weakly referenced. Additionally, fix some minor preexisting issues in this header (#imports instead of #includes, as well as an unnecessary include of IntRect.h). 2019-03-02 Darin Adler Retire legacy dtoa function and DecimalNumber class https://bugs.webkit.org/show_bug.cgi?id=195253 Reviewed by Daniel Bates. * css/CSSPrimitiveValue.cpp: (WebCore::CSSPrimitiveValue::formatNumberValue const): Use makeString instead of DecimalNumber. Also changed return type to String and use StringView and removed special handling of literals. (WebCore::CSSPrimitiveValue::formatNumberForCustomCSSText const): Removed an unnecessary use of StringBuilder. * css/CSSPrimitiveValue.h: Updated for changes to formatNumberValue. 2019-03-03 Michael Catanzaro [SOUP] Cleanups in SoupNetworkSession https://bugs.webkit.org/show_bug.cgi?id=195247 Reviewed by Daniel Bates. This renames clientCertificates to allowedCertificates, since they are not client certificates at all, but server certificates. It also adds a using statement to avoid repeating the long type of the map, and avoids an unnecessary copy. * platform/network/soup/SoupNetworkSession.cpp: (WebCore::allowedCertificates): (WebCore::SoupNetworkSession::checkTLSErrors): (WebCore::SoupNetworkSession::allowSpecificHTTPSCertificateForHost): (WebCore::clientCertificates): Deleted. 2019-03-03 Michael Catanzaro -Wformat error in SharedBuffer::tryCreateArrayBuffer https://bugs.webkit.org/show_bug.cgi?id=195004 Reviewed by Darin Adler. Seems C++ has no format specifier appropriate for printing the result of sizeof. We should just not try to print it. Anyway, that's easy in this case, because sizeof(char) is guaranteed to be 1. This code was an attempt to be pedantic to account for mythical systems with char larger than one byte, but perhaps it didn't realize sizeof always returns multiples of char and so sizeof(char) is always one even on such mythical systems. Note the sizeof(char) use two lines up is left since it's not clear that switching it to 1 would actually be more readable. * platform/SharedBuffer.cpp: (WebCore::SharedBuffer::tryCreateArrayBuffer const): 2019-02-27 Darin Adler Fixed makeString(float) to do shortest-form serialization without first converting to double https://bugs.webkit.org/show_bug.cgi?id=195142 Reviewed by Daniel Bates. * platform/graphics/Color.cpp: Removed unneeded include of DecimalNumber.h. 2019-03-01 Wenson Hsieh [Datalist] fast/forms/datalist/datalist-child-validation.html crashes with a debug assertion in isValidFormControlElement() https://bugs.webkit.org/show_bug.cgi?id=190620 Reviewed by Ryosuke Niwa. Fixes and re-enables an existing layout test that is asserting on debug builds (and failing on release builds). To understand why we hit this assertion, we first note several observations: - The validity of a form control (`isValid()`) depends on the value of `willValidate()`. - Both of these results are cached in member variables: `m_isValid` and `m_willValidate`, respectively. - `willValidate()` changes the cached value of `m_willValidate` if necessary, but `isValid()` uses the cached value without update. Now, consider the following scenario: 1. Something changes in the DOM that changes the result of `willValidate()`. This can happen as a result of several things: a. The form control changes readonly state b. The form control changes disabled state c. The form control is added to a datalist element d. The form control is removed from a datalist element 2. Call `willValidate()`. 3. Call `isValid()`. In scenarios (a) - (c), we ensure that cached form control validity (`m_isValid`) is updated alongside `m_willValidate` by invoking `setNeedsWillValidateCheck()`, such that the result of `isValid()` matches the result of `m_isValid` in step (3). However, in the last scenario (d), we don't do this, which causes form control validity to fall out of sync with the result of `isValid()`. To fix the bug, we update willValidate and isValid when a form control is removed from an ancestor, only if one of its ancestors is a datalist element. * html/HTMLFormControlElement.cpp: (WebCore::HTMLFormControlElement::insertedIntoAncestor): (WebCore::HTMLFormControlElement::removedFromAncestor): Make a couple of minor tweaks: - Currently, we always invalidate `m_dataListAncestorState` by resetting the state to `Unknown` when the form control is removed from an ancestor or inserted. Instead, we only need to reset it when the form control already has an ancestor that is a datalist (in the case where it's being removed) or when the form control does not yet have an ancestor (in the case where it is being added). - If the form control was inside a datalist prior to removal, recompute its cached value of `m_willValidate`, as well as its cached validity (`m_isValid`). 2019-03-01 Darin Adler Finish removing String::format https://bugs.webkit.org/show_bug.cgi?id=194893 Reviewed by Daniel Bates. * dom/Document.cpp: (WebCore::Document::lastModified const): Use makeString and pad. * html/FTPDirectoryDocument.cpp: (WebCore::processFileDateString): Ditto. * mathml/MathMLElement.cpp: (WebCore::convertToPercentageIfNeeded): Use makeString and FormattedNumber. * page/cocoa/ResourceUsageOverlayCocoa.mm: (WebCore::ResourceUsageOverlay::platformDraw): Use makeString and pad. * page/linux/ResourceUsageOverlayLinux.cpp: (WebCore::cpuUsageString): Use makeString, FormattedNumber, and pad. (WebCore::gcTimerString): Use String::number. * platform/DateComponents.cpp: (WebCore::DateComponents::toStringForTime const): Use makeString and pad. (WebCore::DateComponents::toString const): Ditto. * platform/LocalizedStrings.cpp: Removed comment that mentioned String::format, and that was also inaccurate. * platform/audio/HRTFElevation.cpp: (WebCore::HRTFElevation::calculateKernelsForAzimuthElevation): Use makeString and pad. * platform/mock/MockRealtimeVideoSource.cpp: (WebCore::MockRealtimeVideoSource::drawText): Ditto. * rendering/RenderLayerCompositor.cpp: (WebCore::RenderLayerCompositor::logLayerInfo): Ditto. * rendering/RenderTheme.cpp: (WebCore::RenderTheme::formatMediaControlsTime const): Ditto. 2019-03-01 Youenn Fablet Serialize IndexedDB::ObjectStoreOverwriteMode as an enum https://bugs.webkit.org/show_bug.cgi?id=195213 Reviewed by Alex Christensen. Add traits to enable enum IPC encoding. No change of behavior. * Modules/indexeddb/IndexedDB.h: 2019-02-28 Myles C. Maxfield Use-after-move in RenderCombineText::combineTextIfNeeded() https://bugs.webkit.org/show_bug.cgi?id=195188 Reviewed by Zalan Bujtas. r241288 uncovered an existing problem with our text-combine code. r242204 alleviated the symptom, but this patch fixes the source of the problem (and reverts r242204). The code in RenderCombineText::combineTextIfNeeded() has a bit that’s like: FontDescription bestFitDescription; while (...) { FontCascade compressedFont(WTFMove(bestFitDescription), ...); ... } Clearly this is wrong. Test: fast/text/text-combine-crash-2.html * platform/graphics/cocoa/FontDescriptionCocoa.cpp: (WebCore::FontDescription::platformResolveGenericFamily): * rendering/RenderCombineText.cpp: (WebCore::RenderCombineText::combineTextIfNeeded): 2019-02-27 Ulrich Pflueger [MSE] SourceBuffer sample time increment vs. last frame duration check is broken https://bugs.webkit.org/show_bug.cgi?id=194747 Reviewed by Jer Noble. Prevent unintended frame drops by including last frame duration in discontinuity check. Test: media/media-source/media-source-append-variable-frame-lengths-with-matching-durations.html * Modules/mediasource/SourceBuffer.cpp: (WebCore::SourceBuffer::sourceBufferPrivateDidReceiveSample): 2019-02-26 Wenson Hsieh Remove conditional compile guard for InsertIntoTextNodeCommand::doReapply https://bugs.webkit.org/show_bug.cgi?id=195067 Reviewed by Tim Horton. This iOS-specific override was introduced to fix , in which the last typed character would be revealed when redoing text input on iOS inside a password field. The associated change fixed this bug by overriding doReapply on iOS to only insert text (instead of additionally handling password echo); however, it really makes sense to skip password echo when redoing on all platforms, so we can just remove the platform- specific guards around this logic. Doing this allows us to add the `hasEditableStyle()` check on iOS when redoing text insertion, which results in a very subtle behavior change covered by the new layout test below. Test: editing/undo/redo-text-insertion-in-non-editable-node.html * editing/InsertIntoTextNodeCommand.cpp: (WebCore::InsertIntoTextNodeCommand::doReapply): * editing/InsertIntoTextNodeCommand.h: 2019-02-26 Keith Miller Code quality cleanup in NeverDestroyed https://bugs.webkit.org/show_bug.cgi?id=194824 Reviewed by Mark Lam. name_names.pl should not just assume the layout of LazyNeverDestroyed. * dom/make_names.pl: (printNamesCppFile): 2019-02-26 Sihui Liu [Mac WK2] storage/indexeddb/IDBObject-leak.html is flaky https://bugs.webkit.org/show_bug.cgi?id=195036 Reviewed by Geoffrey Garen. When connection to IDBServer is lost, IDBDatabase in web process should not only stop active transactions, but also transactions in committing process. Also, TransactionOpration should clear its perform function when the operation is being completed, otherwise there is a reference cycle of TransactionOpration. Covered by existing tests storage/indexeddb/IDBObject-leak.html. * Modules/indexeddb/IDBDatabase.cpp: (WebCore::IDBDatabase::connectionToServerLost): notify committing transasctions that connection is lost. * Modules/indexeddb/IDBTransaction.cpp: (WebCore::IDBTransaction::connectionClosedFromServer): notify IDBConnectionProxy that transaction ends. * Modules/indexeddb/client/IDBConnectionProxy.cpp: (WebCore::IDBClient::IDBConnectionProxy::forgetTransaction): clear finished transactions. * Modules/indexeddb/client/IDBConnectionProxy.h: * Modules/indexeddb/client/TransactionOperation.h: (WebCore::IDBClient::TransactionOperation::doComplete): clear perform function unconditionally when the operation is in completion process. 2019-02-26 Philippe Normand [EGL] Runtime support for RGB565 pixel layout https://bugs.webkit.org/show_bug.cgi?id=194817 Reviewed by Carlos Garcia Campos. Currently our graphics pipeline always relies on a ARGB8888 (32 bpp) pixel configuration. On some low-end (old) embedded platforms the graphics driver is sometimes optimized for 16 bpp configurations, such as RGB565. On those platforms the application can now set the WEBKIT_EGL_PIXEL_LAYOUT environment variable to "RGB565" to adjust to the best pixel configuration supported by the screen and graphics driver. * platform/graphics/egl/GLContextEGL.cpp: (WebCore::GLContextEGL::getEGLConfig): 2019-02-26 Philippe Normand and Carlos Garcia Campos [WPE] Add API for webview background color configuration https://bugs.webkit.org/show_bug.cgi?id=192305 Reviewed by Michael Catanzaro. Adapt the FrameView API to allow a default non-white background color. * page/Frame.cpp: (WebCore::Frame::createView): Replace isTransparent argument with a background color one. * page/Frame.h: * page/FrameView.cpp: (WebCore::FrameView::recalculateBaseBackgroundColor): Use Color::transparent if m_isTransparent is true. (WebCore::FrameView::updateBackgroundRecursively): Allow the fallback background color to be non-white, this is used only in non-dark-mode-css build configurations. * page/FrameView.h: * testing/Internals.cpp: (WebCore::Internals::setViewIsTransparent): Use Color::transparent if transparent is true. 2019-02-25 Sihui Liu IndexedDB: IDBDatabase and IDBTransaction are leaked in layout tests https://bugs.webkit.org/show_bug.cgi?id=194709 Reviewed by Geoffrey Garen. When connection to IDB server is closed, IDBTransaction would abort without notifying IDBDatabase, so IDBDatabase didn't clear its reference to IDBTransaction which created a reference cycle. Also IDBTransaction didn't clear its reference to IDBRequest in this case and it led to another reference cycle between IDBOpenDBRequest and IDBTransaction. Test: storage/indexeddb/IDBObject-leak.html * Modules/indexeddb/IDBDatabase.cpp: (WebCore::IDBDatabase::connectionToServerLost): * Modules/indexeddb/IDBTransaction.cpp: (WebCore::IDBTransaction::IDBTransaction): (WebCore::IDBTransaction::~IDBTransaction): (WebCore::IDBTransaction::connectionClosedFromServer): * Modules/indexeddb/IDBTransaction.h: * testing/Internals.cpp: (WebCore::Internals::numberOfIDBTransactions const): * testing/Internals.h: * testing/Internals.idl: 2019-02-25 Charlie Turner [EME][GStreamer] Replace caps field loop with gst_structure_remove_fields https://bugs.webkit.org/show_bug.cgi?id=194992 Reviewed by Xabier Rodriguez-Calvar. Refactoring, no new tests. * platform/graphics/gstreamer/eme/WebKitCommonEncryptionDecryptorGStreamer.cpp: (transformCaps): Simplify the code a little. The idea to use this utility function came from a review upstream here: https://gitlab.freedesktop.org/gstreamer/gst-devtools/merge_requests/67 2019-02-25 Alicia Boya García [MSE][GStreamer] Batch player duration updates https://bugs.webkit.org/show_bug.cgi?id=194220 Reviewed by Xabier Rodriguez-Calvar. This saves up a ton of CPU cycles doing layout unnecessarily when all the appended frames extend the duration of the movie, like in YTTV 2018 59.DASHLatencyVP9. This patch is an optimization that introduces no new behavior. * platform/graphics/gstreamer/mse/AppendPipeline.cpp: (WebCore::AppendPipeline::consumeAppsinkAvailableSamples): * platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.cpp: (WebCore::MediaPlayerPrivateGStreamerMSE::blockDurationChanges): (WebCore::MediaPlayerPrivateGStreamerMSE::unblockDurationChanges): (WebCore::MediaPlayerPrivateGStreamerMSE::durationChanged): * platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.h: 2019-02-25 Miguel Gomez [WPE] Add support for holepunch using an external video player https://bugs.webkit.org/show_bug.cgi?id=194899 Reviewed by Xabier Rodriguez-Calvar. Implement the holepunch feature to allow playback using an external player. This creates a new dummy MediaPlayerPrivateHolePunch that accepts only the type "video/holepunch", and whose goal is to just draw a transparent rectangle in the position where the video should be. This can be used to allow a player placed on a lower plane than the browser to become visible. Added ManualTest wpe/video-player-holepunch-external.html to test the feature. * PlatformWPE.cmake: * platform/HolePunch.cmake: Added. * platform/graphics/MediaPlayer.cpp: (WebCore::buildMediaEnginesVector): * platform/graphics/holepunch/MediaPlayerPrivateHolePunch.cpp: Added. (WebCore::MediaPlayerPrivateHolePunch::MediaPlayerPrivateHolePunch): (WebCore::MediaPlayerPrivateHolePunch::~MediaPlayerPrivateHolePunch): (WebCore::MediaPlayerPrivateHolePunch::platformLayer const): (WebCore::MediaPlayerPrivateHolePunch::naturalSize const): (WebCore::MediaPlayerPrivateHolePunch::pushNextHolePunchBuffer): (WebCore::MediaPlayerPrivateHolePunch::swapBuffersIfNeeded): (WebCore::MediaPlayerPrivateHolePunch::proxy const): (WebCore::mimeTypeCache): (WebCore::MediaPlayerPrivateHolePunch::getSupportedTypes): (WebCore::MediaPlayerPrivateHolePunch::supportsType): (WebCore::MediaPlayerPrivateHolePunch::registerMediaEngine): (WebCore::MediaPlayerPrivateHolePunch::notifyReadyState): * platform/graphics/holepunch/MediaPlayerPrivateHolePunch.h: Added. * platform/graphics/texmap/TextureMapperPlatformLayerBuffer.cpp: (WebCore::TextureMapperPlatformLayerBuffer::paintToTextureMapper): 2019-02-24 Michael Catanzaro [WPE][GTK] Remove user agent quirk for washingtonpost.com https://bugs.webkit.org/show_bug.cgi?id=194981 Reviewed by Žan Doberšek. Remove user agent quirk for washingtonpost.com because we support JPEG 2000 now. * platform/UserAgentQuirks.cpp: (WebCore::urlRequiresChromeBrowser): 2019-02-22 Sihui Liu Crash under IDBServer::IDBConnectionToClient::identifier() const https://bugs.webkit.org/show_bug.cgi?id=194843 Reviewed by Geoffrey Garen. UniqueIDBDatabase should ignore requests from connections that are already closed. Tests are hard to create without some tricks on UniqueIDBDatabase so this fix is verified manually. One test is created by adding delay to UniqueIDBDatabase::openBackingStore on the background thread to make sure disconnection of web process happens before UniqueIDBDatabase::didOpenBackingStore, because didOpenBackingStore may start a version change transaction and ask for identifier from the connection that is already gone. * Modules/indexeddb/server/IDBConnectionToClient.cpp: (WebCore::IDBServer::IDBConnectionToClient::connectionToClientClosed): * Modules/indexeddb/server/IDBConnectionToClient.h: (WebCore::IDBServer::IDBConnectionToClient::isClosed): * Modules/indexeddb/server/UniqueIDBDatabase.cpp: (WebCore::IDBServer::UniqueIDBDatabase::clearStalePendingOpenDBRequests): (WebCore::IDBServer::UniqueIDBDatabase::handleDatabaseOperations): (WebCore::IDBServer::UniqueIDBDatabase::operationAndTransactionTimerFired): * Modules/indexeddb/server/UniqueIDBDatabase.h: 2019-02-22 Rob Buis Fix unitless usage of mathsize https://bugs.webkit.org/show_bug.cgi?id=194940 Reviewed by Frédéric Wang. Convert unitless lengths to percentage values to correct the computed font size. * mathml/MathMLElement.cpp: (WebCore::convertToPercentageIfNeeded): (WebCore::MathMLElement::collectStyleForPresentationAttribute): 2019-02-21 Darin Adler Some refinements for Node and Document https://bugs.webkit.org/show_bug.cgi?id=194764 Reviewed by Ryosuke Niwa. * accessibility/AccessibilityObject.cpp: (WebCore::AccessibilityObject::press): Use shadowHost instead of deprecatedShadowAncestorNode. (WebCore::AccessibilityObject::axObjectCache const): Tweak coding style. (WebCore::AccessibilityObject::focusedUIElement const): Use existing page function to streamline. * accessibility/AccessibilityRenderObject.cpp: (WebCore::AccessibilityRenderObject::accessKey const): Use attributeWithoutSynchronization for efficiency and consistency with other code working with the accesskey attribute. * dom/ContainerNode.cpp: (WebCore::ContainerNode::childrenChanged): Added call to invalidateAccessKeyCache, replacing old scheme tied to style recalculation. * dom/DecodedDataDocumentParser.cpp: (WebCore::DecodedDataDocumentParser::appendBytes): Update for name and return type change of createDecoderIfNeeded to decoder. (WebCore::DecodedDataDocumentParser::flush): Ditto. * dom/Document.cpp: (WebCore::Document::elementForAccessKey): Renamed from getElementForAccessKey to match WebKit coding style. Changed to use unique_ptr instead of separate boolean to keep track of map validity status. (WebCore::Document::buildAccessKeyCache): Renamed from buildAccessKeyMap to clarify that this is a cache. Changed to use composedTreeDescendants rather than explicit calls to shadowRoot. Use add instead of set so that first element in document order wins, instead of last element in document order. Updated to make a new map in a new unique_ptr instead of populating a map. (WebCore::Document::invalidateAccessKeyCacheSlowCase): Renamed from invalidateAccessKeyMap, and left an inline part in the header so the fast case of quickly checking for a null pointer can be inlined. (WebCore::Document::doctype const): Use downcast instead of static_cast. (WebCore::Document::scheduleStyleRecalc): Moved call to invalidateAccessKeyMap from here to childrenChanged and accesskey attribute change handling. (WebCore::Document::processFormatDetection): Set m_isTelephoneNumberParsingAllowed directly since this is the only place that does it and we don't need to factor that one line of code into a function. (WebCore::Document::getOverrideStyle): Moved to header since it's just a stub that always returns nullptr and can be inlined. (WebCore::Document::setIsTelephoneNumberParsingAllowed): Deleted. (WebCore::Document::ensureTemplateDocument): Removed nullptr frame argument to the create function, since Document::create now always involves no frame. (WebCore::Document::didAssociateFormControl): Changed argument type to a reference and simplified the logic with a local variable. (WebCore::Document::didAssociateFormControlsTimerFired): Simplified the null checks and rearranged things so that m_associatedFormControls will always get cleared even if the document is no longer associated with a page. * dom/Document.h: Removed unnnecessary explicit values for enumerations (first value is always zero, etc.) and formatted simple enumerations in a single line for easier reading. Moved Document::create fucntion bodies out of line, removed the frame argument from the simple "create with URL" overload and made the frame argument for createNonRenderedPlaceholder be a reference rather than a pointer. Renamed getElementByAccessKey to elementForAccessKey, invalidateAccessKeyMap to invalidateAccessKeyCache, buildAccessKeyMap to buildAccessKeCache, m_elementsByAccessKey to m_accessKeyCache and changed its type. Removed bogus "DOM methods" comment, unused setParserFeature friend declaration, setIsTelephoneNumberParsingAllowed function, and m_accessKeyMapValid flag. * dom/Document.idl: Added comment highlighting that getOverrideStyle is just a placeholder returning null. * dom/Element.cpp: (WebCore::Element::attributeChanged): Call invalidateAccessKeyCache when the value of the accesskey attribute is changed. Also moved the class attribute code so the attributes here are in alphabetical order (only class and id were out of alphabetical order). * dom/Node.cpp: (WebCore::Node::isDescendantOrShadowDescendantOf const): Rewrote to no longer use deprecatedShadowAncestorNode and used boolean operators to make it a single line and easier to understand. Also added a FIXME since the containsIncludingShadowDOM function is so similar, yet differently written. (WebCore::Node::contains const): Rewrote as a single line to make this easier to read and to *slightly* improve the speed in the "this == node" case. (WebCore::Node::containsIncludingHostElements const): Use downcast. (WebCore::Node::deprecatedShadowAncestorNode const): Deleted. * dom/Node.h: Deleted now-unused deprecatedShadowAncestorNode. * editing/ReplaceSelectionCommand.cpp: (WebCore::ReplacementFragment::ReplacementFragment): Rewrote to use shadowHost instead of deprecatedShadowAncestorNode. * html/FormAssociatedElement.cpp: (WebCore::FormAssociatedElement::resetFormOwner): Pass reference to didAssociateFormControl. (WebCore::FormAssociatedElement::formAttributeChanged): Ditto. * html/HTMLAreaElement.cpp: (WebCore::HTMLAreaElement::parseAttribute): Removed special case for accesskey attribute, because we want to call the base class parseAttribute in that case. * html/HTMLFormElement.cpp: (WebCore::HTMLFormElement::insertedIntoAncestor): Pass reference to didAssociateFormControl. * html/HTMLSelectElement.cpp: (WebCore::HTMLSelectElement::parseAttribute): Removed special case for accesskey attribute with mysterious FIXME, because we want to call the base class parseAttribute in that case. The old code had no effect before; the access key logic would still find the attribute; if the goal is to ignore the attribute for these elements we will need a different solution. * html/HTMLTextAreaElement.cpp: (WebCore::HTMLTextAreaElement::parseAttribute): Ditto. * loader/DocumentLoader.cpp: (WebCore::DocumentLoader::DocumentLoader): Removed code that was always passing nullptr as the frame for the newly created DocumentWriter. It used m_frame, but m_frame was always null. (WebCore::DocumentLoader::attachToFrame): Pass reference to DocumentWriter::setFrame. * loader/DocumentWriter.cpp: (WebCore::DocumentWriter::DocumentWriter): Deleted. The old version set m_frame to the passed in frame, which was always nullptr, and initialized some booleans and an enumeration, which are now initialized in the class definition. (WebCore::DocumentWriter::createDocument): Pass a reference for the frame. (WebCore::DocumentWriter::begin): Updated now that State is an enum class. (WebCore::DocumentWriter::decoder): Renamed from createDecoderIfNeeded and changed to return a reference. (WebCore::DocumentWriter::addData): Use RELEASE_ASSERT instead of if/CRASH and updated now that State is an enum class. (WebCore::DocumentWriter::insertDataSynchronously): Updated now that State is an enum class. (WebCore::DocumentWriter::end): Ditto. * loader/DocumentWriter.h: Removed unneeded include and forward declaration. Removed the frame pointer argument to the constructor, caller was always passing a nullptr. Changed argument to setFrame to be a reference. Renamed createDecoderIfNeeded to decoder and changed it to return a reference. Initialized m_frame, m_hasReceivedSomeData, m_encodingWasChosenByUser, and m_state here so we don't need to initialize them in a constructor. Renamed the enum from WriterState to State since it's a member of DocumentWriter already, and made it an enum class rather than ending each enumeration value with WritingState. * page/DragController.cpp: (WebCore::isEnabledColorInput): Removed boolean argument setToShadowAncestor. The one caller that formerly passed true now calls the new hasEnabledColorInputAsShadowHost function instead. (WebCore::hasEnabledColorInputAsShadowHost): Added. (WebCore::elementUnderMouse): Use shadowHost instead of deprecatedShadowAncestorNode. Also added FIXME since it seems this should instead be using parentElementInComposedTree. (WebCore::DragController::concludeEditDrag): Removed "false" argument to isEnabledColorInput. (WebCore::DragController::canProcessDrag): Removed "true" argument to isEnabledColorInput and added call to hasEnabledColorInputAsShadowHost. Also put the value of the node to drag into a local variable to simplify code. (WebCore::DragController::draggableElement const): Removed "false" argument to isEnabledColorInput. * page/EventHandler.cpp: (WebCore::EventHandler::handleAccessKey): Update name of elementForAccessKey. * page/FocusController.cpp: (WebCore::clearSelectionIfNeeded): Use shadowHost instead of deprecatedShadowAncestorNode. * workers/service/context/ServiceWorkerThreadProxy.cpp: (WebCore::createPageForServiceWorker): Pass reference instead of pointer for frame to Document::createNonRenderedPlaceholder. 2019-02-21 Sihui Liu IndexedDB: leak UniqueIDBDatabase in layout tests https://bugs.webkit.org/show_bug.cgi?id=194870 Reviewed by Geoffrey Garen. UniqueIDBDatabase owns a pointer to itself after it is hard closed. It should release the pointer when it receives confirmation from clients and all pending tasks are done. UniqueIDBDatabase already checks whether the pointer should be released when a database task finishes, but it didn't perform a check when a confirm message is received. No new test as the order of task completion and confirmation arrival is uncertain. * Modules/indexeddb/server/UniqueIDBDatabase.cpp: (WebCore::IDBServer::UniqueIDBDatabase::confirmDidCloseFromServer): 2019-02-21 Rob Buis Update MIME type parser https://bugs.webkit.org/show_bug.cgi?id=180526 Reviewed by Darin Adler. Further testing showed the MIME parser needs these fixes: - stripWhitespace is wrong for removing HTTP whitespace, use stripLeadingAndTrailingHTTPSpaces instead. - HTTP Token code points checking for Rfc2045 and Mimesniff were mixed up, use the dedicated isValidHTTPToken for Mimesniff mode. - Quoted Strings were not unescaped/escaped, this seems ok for serializing but is wrong when gettings individual parameter values. Implement [1] and [2] Step 2.4 to properly unescape and escape. This change also tries to avoid hard to read uses of find. Test: ParsedContentType.Serialize [1] https://fetch.spec.whatwg.org/#collect-an-http-quoted-string [2] https://mimesniff.spec.whatwg.org/#serializing-a-mime-type * platform/network/ParsedContentType.cpp: (WebCore::skipSpaces): (WebCore::parseToken): (WebCore::isNotQuoteOrBackslash): (WebCore::collectHTTPQuotedString): (WebCore::containsNonTokenCharacters): (WebCore::parseQuotedString): (WebCore::ParsedContentType::parseContentType): (WebCore::ParsedContentType::create): (WebCore::ParsedContentType::setContentType): (WebCore::containsNonQuoteStringTokenCharacters): (WebCore::ParsedContentType::setContentTypeParameter): (WebCore::ParsedContentType::serialize const): (WebCore::substringForRange): Deleted. (WebCore::isNonTokenCharacter): Deleted. (WebCore::isNonQuotedStringTokenCharacter): Deleted. * platform/network/ParsedContentType.h: 2019-02-20 Simon Fraser REGRESSION (240698): Fixed position banners flicker and move when scrolling on iOS https://bugs.webkit.org/show_bug.cgi?id=194889 rdar://problem/47755552 Reviewed by Tim Horton. After r240698 we could commit scrolling changes for a fixed node where the "viewportRectAtLastLayout" and the layer position were mismatched; this happened when AsyncScrollingCoordinator::reconcileScrollingState() came back from the UI process with an unstable update and set a new layoutViewport, then some other layout triggered a compositing tree update. During the tree update, we'd update the fixed scrolling node with the new viewport, and an old layer position. Fix by ensuring that we only update the geometry info for a scrolling tree node when we update layer geometry for the corresponding layer. Not currently testable. * rendering/RenderLayerCompositor.cpp: (WebCore::RenderLayerCompositor::updateBackingAndHierarchy): 2019-02-20 Ryosuke Niwa Crash in DOMWindowExtension::suspendForPageCache https://bugs.webkit.org/show_bug.cgi?id=194871 Reviewed by Chris Dumez. This is a speculative fix for a crash in DOMWindowExtension::suspendForPageCache. We think it's possible for DOMWindowExtension::suspendForPageCache notifying the clients via dispatchWillDisconnectDOMWindowExtensionFromGlobalObject to remove other DOMWindowExtension's. Check that each DOMWindowProperty is still in m_properties before invoking suspendForPageCache to avoid the crash. * page/DOMWindow.cpp: (WebCore::DOMWindow::willDestroyCachedFrame): (WebCore::DOMWindow::willDestroyDocumentInFrame): (WebCore::DOMWindow::willDetachDocumentFromFrame): (WebCore::DOMWindow::suspendForPageCache): (WebCore::DOMWindow::resumeFromPageCache): * page/DOMWindowExtension.cpp: (WebCore::DOMWindowExtension::suspendForPageCache): 2019-02-20 Alex Christensen Always call CompletionHandlers after r240909 https://bugs.webkit.org/show_bug.cgi?id=194823 Reviewed by Ryosuke Niwa. * loader/PolicyChecker.cpp: (WebCore::PolicyChecker::checkNavigationPolicy): (WebCore::PolicyChecker::checkNewWindowPolicy): 2019-02-20 Said Abou-Hallawa drawImage() clears the canvas if it's the source of the image and globalCompositeOperation is "copy" https://bugs.webkit.org/show_bug.cgi?id=194746 Reviewed by Dean Jackson. Test: fast/canvas/canvas-drawImage-composite-copy.html If the source canvas of drawImage() is the same as the destination and globalCompositeOperation is set to "copy", copy the srcRect from the canvas to a temporary buffer before calling clearCanvas() then drawImage from this temporary buffer. * html/canvas/CanvasRenderingContext2DBase.cpp: (WebCore::CanvasRenderingContext2DBase::drawImage): * platform/graphics/ImageBuffer.cpp: (WebCore::ImageBuffer::copyRectToBuffer): * platform/graphics/ImageBuffer.h: 2019-02-20 Simon Fraser REGRESSION (r241788>): ASSERTION FAILED: !m_normalFlowListDirty in TestWebKitAPI.WebKit.ResizeReversePaginatedWebView test https://bugs.webkit.org/show_bug.cgi?id=194866 Reviewed by Antti Koivisto. r241788 removed some calls that updated layer lists (normal flow and z-order) during compositing updates, causing a later call to RenderLayerCompositor::recursiveRepaintLayer() to assert when the lists were dirty. Fix by updating the lists in RenderLayerCompositor::recursiveRepaintLayer(), as we do in various other places. * rendering/RenderLayerCompositor.cpp: (WebCore::RenderLayerCompositor::recursiveRepaintLayer): 2019-02-20 Loïc Yhuel Fix crash when opening Web Inspector after a WebSocket was blocked by content extensions https://bugs.webkit.org/show_bug.cgi?id=194819 Reviewed by Joseph Pecoraro. Test: http/tests/inspector/network/contentextensions/blocked-websocket-crash.html * Modules/websockets/WebSocketChannel.h: (WebCore::WebSocketChannel::hasCreatedHandshake): * inspector/agents/page/PageNetworkAgent.cpp: Ignore WebSocketChannel without an WebSocketHandshake, which would crash in InspectorNetworkAgent::enable. 2019-02-20 Don Olmstead [MSVC] Fix compilation errors with lambdas in Service Workers https://bugs.webkit.org/show_bug.cgi?id=194841 Reviewed by Alex Christensen. No new tests. No change in behavior. MSVC has problems with the scoping of `this` within a nested lambda. In these cases `this` is referring to the enclosing lambda according to MSVC. This patch works around this behavior through by using the `protectedThis` pattern in WebKit code. * workers/service/server/RegistrationDatabase.cpp: (WebCore::RegistrationDatabase::openSQLiteDatabase): 2019-02-20 Adrian Perez de Castro [WPE][GTK] Enable support for CONTENT_EXTENSIONS https://bugs.webkit.org/show_bug.cgi?id=167941 Reviewed by Carlos Garcia Campos. * platform/gtk/po/POTFILES.in: Added WebKitUserContentFilterStore.cpp to the list of files with translatable strings. 2019-02-19 Simon Fraser REGRESSION (r238090): Toggling visibility on the element can result in a blank web view https://bugs.webkit.org/show_bug.cgi?id=194827 rdar://problem/47620594 Reviewed by Antti Koivisto. Incremental compositing updates, added in rr238090, use repaints as a trigger for re-evaluating layer configurations, since a repaint implies that a layer gains painted content. This is done via the call to setNeedsCompositingConfigurationUpdate() in RenderLayerBacking::setContentsNeedDisplay{InRect}. The RenderView's layer is opted out of this to avoid doing lots of redundant layer config recomputation for the root. The configuration state that matters here is whether the layer contains painted content, and therefore needs backing store; this is computed by RenderLayerBacking::isSimpleContainerCompositingLayer(), and feeds into GraphicsLayer::drawsContent(). However, if starts as "visibility:hidden" or "opacity:0", as some sites do to hide incremental loading, then we'll fail to recompute 'drawsContent' for the root and leave the root with drawsContent=false, which causes RenderLayerBacking::setContentsNeedDisplay{InRect} to short-circuit, and then we paint nothing. Ironically, 'drawsContent' doesn't actually save any backing store for the root, since it has no affect on the root tile caches; we always make tiles. So the simple fix here is to change RenderLayerBacking::isSimpleContainerCompositingLayer() to always return false for the RenderView's layer (the root). Testing this was tricky; ref testing doesn't work because we force repaint, and we normally skip properties of the root in layer tree dumps to hide WK1/WK2 differences. Therefore I had to add LAYER_TREE_INCLUDES_ROOT_LAYER_PROPERTIES and fix RenderLayerBacking::shouldDumpPropertyForLayer to respect it. Test: compositing/visibility/root-visibility-toggle.html * page/Frame.h: * platform/graphics/GraphicsLayer.cpp: (WebCore::GraphicsLayer::dumpProperties const): * platform/graphics/GraphicsLayerClient.h: (WebCore::GraphicsLayerClient::shouldDumpPropertyForLayer const): * rendering/RenderLayerBacking.cpp: (WebCore::RenderLayerBacking::isSimpleContainerCompositingLayer const): (WebCore::RenderLayerBacking::shouldDumpPropertyForLayer const): * rendering/RenderLayerBacking.h: * rendering/RenderLayerCompositor.cpp: (WebCore::RenderLayerCompositor::layerTreeAsText): * testing/Internals.cpp: (WebCore::toLayerTreeFlags): * testing/Internals.h: * testing/Internals.idl: 2019-02-19 Ryosuke Niwa REGRESSION(r240909): Release assertion in FrameLoader::loadPostRequest when opening new window https://bugs.webkit.org/show_bug.cgi?id=194820 Reviewed by Geoffrey Garen. This release assertion was wrong. The invocation of PolicyChecker::checkNewWindowPolicy in FrameLoader doesn’t require PolicyChecker's load type to be set in PolicyChecker because FrameLoader's continueLoadAfterNewWindowPolicy invokes loadWithNavigationAction which sets the load type later, and we don't rely on PolicyChecker's load type until then. Fixed the crash by removing relese asserts before invoking checkNewWindowPolicy accordingly. This patch reverts r241015 since it too was asserting that PolicyChecker's load type is set before invoking checkNewWindowPolicy which is not the right assumption. Test: fast/loader/navigate-with-post-to-new-target-after-back-forward-navigation.html * loader/FrameLoader.cpp: (WebCore::FrameLoader::loadURL): (WebCore::FrameLoader::load): (WebCore::FrameLoader::loadPostRequest): 2019-02-16 Darin Adler Continue reducing use of String::format, now focusing on hex: "%p", "%x", etc. https://bugs.webkit.org/show_bug.cgi?id=194752 Reviewed by Daniel Bates. * Modules/websockets/WebSocket.cpp: Added an include of HexNumber.h. This previously got included because of Logger.h, but that no longer pulls in HexNumber.h. * css/CSSMarkup.cpp: Removed unneeded include of StringBuffer.h. * css/CSSPrimitiveValue.cpp: Ditto. * css/CSSUnicodeRangeValue.cpp: (WebCore::CSSUnicodeRangeValue::customCSSText const): Use makeString and hex instead of String::format and "%x". * html/HTMLMediaElement.h: (WTF::ValueToString [css-grid] Handle indefinite percentages in fit-content() https://bugs.webkit.org/show_bug.cgi?id=194509 Reviewed by Javier Fernandez. Test: imported/w3c/web-platform-tests/css/css-grid/layout-algorithm/grid-fit-content-percentage.html If the size of the grid container depends on the size of its tracks, a percentage in fit-content() is indefinite. Without this patch, some places treated this case as fit-content(0), which prevented the grid container from growing enough to contain the max-content contribution of its grid items. This patch treats such fit-content() as minmax(auto, max-content), but once the size of the grid container is known and it is laid out "for real", then the percentage is definite and it's used. * rendering/GridTrackSizingAlgorithm.cpp: (WebCore::GridTrackSizingAlgorithm::gridTrackSize const): (WebCore::GridTrackSizingAlgorithm::initializeTrackSizes): 2019-02-18 John Wilander Check the existence of the frame in Document::hasFrameSpecificStorageAccess() and Document::setHasFrameSpecificStorageAccess() https://bugs.webkit.org/show_bug.cgi?id=194777 Reviewed by Geoffrey Garen and Chris Dumez. Test: http/tests/storageAccess/remove-requesting-iframe.html * dom/Document.cpp: (WebCore::Document::hasFrameSpecificStorageAccess const): Now checks for the existence of the frame. (WebCore::Document::setHasFrameSpecificStorageAccess): Now checks for the existence of the frame. * loader/ResourceLoadObserver.cpp: (WebCore::ResourceLoadObserver::logUserInteractionWithReducedTimeResolution): Now checks that the session ID is valid. 2019-02-16 Zalan Bujtas [LFC] Apply min/max width constraints to preferred width computation https://bugs.webkit.org/show_bug.cgi?id=194739 Reviewed by Simon Fraser. Ensure that both min-height and max-height are taken into account while computing the preferred width. Test: fast/block/block-only/min-max-and-preferred-width-simple.html * layout/blockformatting/BlockFormattingContextGeometry.cpp: (WebCore::Layout::BlockFormattingContext::Geometry::intrinsicWidthConstraints): 2019-02-15 Yusuke Suzuki [JSC] Make builtin objects more lazily initialized under non-JIT mode https://bugs.webkit.org/show_bug.cgi?id=194727 Reviewed by Saam Barati. * Modules/streams/ReadableByteStreamInternals.js: (privateInitializeReadableByteStreamController): (readableByteStreamControllerRespond): 2019-02-15 Chris Dumez Sample domainsVisited diagnostic logging https://bugs.webkit.org/show_bug.cgi?id=194657 Reviewed by Ryosuke Niwa. Sample domainsVisited diagnostic logging, we are getting a lot of data from this key and this is hurting our other keys. * page/Page.cpp: (WebCore::Page::logNavigation): 2019-02-15 Ryosuke Niwa Crash in the hit testing code via HTMLPlugInElement::isReplacementObscured() https://bugs.webkit.org/show_bug.cgi?id=194691 Reviewed by Simon Fraser. The crash was caused by HTMLPlugInElement::isReplacementObscured updating the document without updating the layout of ancestor documents (i.e. documents in which frame owner elements appear) even though it hit-tests against the top-level document's RenderView. Fixed the bug by updating the layout of the top-level document as needed. Test: plugins/unsupported-plugin-with-replacement-in-iframe-crash.html * html/HTMLPlugInElement.cpp: (WebCore::HTMLPlugInElement::isReplacementObscured): 2019-02-15 Per Arne Vollan [WebVTT] Inline WebVTT styles should start with '::cue' https://bugs.webkit.org/show_bug.cgi?id=194227 Reviewed by Eric Carlson. The original fix in r241203 is not sufficient, since it only checks if the CSS string starts with '::cue'. Before accepting a CSS string from a WebVTT file, it should be checked that all selectors starts with '::cue'. Test: media/track/track-cue-css.html * html/track/WebVTTParser.cpp: (WebCore::WebVTTParser::checkAndStoreStyleSheet): 2019-02-15 Youenn Fablet Make ServiceWorkerClientFetch closer to WebResourceLoader https://bugs.webkit.org/show_bug.cgi?id=194651 Reviewed by Alex Christensen. Check for redirection response and if so call a specific client API. Ensure ServiceWorkerFetch::Client gets called in the service worker thread proxy so that its m_connection is only accessed on that thread. Covered by existing tests. * platform/network/FormData.h: * platform/network/ResourceErrorBase.h: * workers/service/context/ServiceWorkerFetch.cpp: (WebCore::ServiceWorkerFetch::processResponse): * workers/service/context/ServiceWorkerFetch.h: * workers/service/context/ServiceWorkerThreadProxy.cpp: (WebCore::ServiceWorkerThreadProxy::cancelFetch): (WebCore::ServiceWorkerThreadProxy::continueDidReceiveFetchResponse): * workers/service/context/ServiceWorkerThreadProxy.h: 2019-02-15 Youenn Fablet Make navigator.mediaDevices SecureContext https://bugs.webkit.org/show_bug.cgi?id=194666 Reviewed by Eric Carlson. Make navigator.mediaDevices SecureContext. This can still be enabled for unsecure context using the existing page settings. To cover that case, introduce ContextHasMediaDevices custom IDL keyword. Covered by API test. * Modules/mediastream/NavigatorMediaDevices.idl: * bindings/scripts/CodeGeneratorJS.pm: (GenerateRuntimeEnableConditionalString): * bindings/scripts/IDLAttributes.json: * dom/ScriptExecutionContext.cpp: (WebCore::ScriptExecutionContext::hasMediaDevices const): (WebCore::ScriptExecutionContext::hasServiceWorkerScheme const): * dom/ScriptExecutionContext.h: 2019-02-15 Youenn Fablet WebSocket should not fire events after being stopped https://bugs.webkit.org/show_bug.cgi?id=194690 Reviewed by Geoffrey Garen. dispatchOrQueueErrorEvent is scheduled using RunLoop::main().dispatch or dispatch_async. This makes it possible to dispatch an event while WebSocket is already stopped. Instead, use Document::postTask so that the task is only executed if WebSocket is not stopped. As a refactoring, make use of PendingActivity to keep track of setPendingActivity/unsetPendingActivity more easily. * Modules/websockets/WebSocket.cpp: (WebCore::WebSocket::stop): (WebCore::WebSocket::connect): * Modules/websockets/WebSocket.h: 2019-02-15 Youenn Fablet Performance should not fire events when its context is stopped https://bugs.webkit.org/show_bug.cgi?id=194689 Reviewed by Alex Christensen. Stop the timer when its context is destroyed. Add an assertion to ensure the timer does not fire after context is destroyed. * page/Performance.cpp: (WebCore::Performance::stop): 2019-02-15 Zalan Bujtas [LFC] Out-of-flow box is never a float box https://bugs.webkit.org/show_bug.cgi?id=194704 Reviewed by Antti Koivisto. We can't have it both ways. Absolute positioning wins. Test: fast/block/block-only/out-of-flow-is-never-float-box.html * layout/layouttree/LayoutBox.cpp: (WebCore::Layout::Box::isFloatingPositioned const): (WebCore::Layout::Box::isLeftFloatingPositioned const): (WebCore::Layout::Box::isRightFloatingPositioned const): 2019-02-15 Philippe Normand [GStreamer] Simplify GObject class name check https://bugs.webkit.org/show_bug.cgi?id=194537 Reviewed by Michael Catanzaro. * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp: (WebCore::MediaPlayerPrivateGStreamer::uriDecodeBinElementAddedCallback): Use G_OBJECT_TYPE_NAME() to filter out uridecodebin child elements. 2019-02-15 Wenson Hsieh Refactor EditingStyle::textDirection to return an Optional instead of a bool https://bugs.webkit.org/show_bug.cgi?id=194686 Reviewed by Ryosuke Niwa. Changes EditingStyle::textDirection to return an Optional, instead of taking a reference to the resulting WritingDirection. No change in behavior. * editing/ApplyStyleCommand.cpp: (WebCore::ApplyStyleCommand::splitAncestorsWithUnicodeBidi): (WebCore::ApplyStyleCommand::applyInlineStyle): * editing/EditingStyle.cpp: (WebCore::EditingStyle::textDirection const): (WebCore::EditingStyle::textDirectionForSelection): * editing/EditingStyle.h: 2019-02-10 Darin Adler Replace more uses of String::format with StringConcatenate (mostly non-Apple platform-specific cases) https://bugs.webkit.org/show_bug.cgi?id=194487 Reviewed by Daniel Bates. * accessibility/win/AccessibilityObjectWrapperWin.cpp: (WebCore::AccessibilityObjectWrapper::accessibilityAttributeValue): Use makeString instead of String::format. * page/linux/ResourceUsageOverlayLinux.cpp: (WebCore::formatByteNumber): Use String::number instead of String::format. * platform/audio/gstreamer/AudioSourceProviderGStreamer.cpp: (WebCore::AudioSourceProviderGStreamer::AudioSourceProviderGStreamer): Use makeString instead of String::format. * platform/glib/UserAgentGLib.cpp: (WebCore::platformVersionForUAString): Ditto. * platform/graphics/gstreamer/GStreamerCommon.cpp: (WebCore::simpleBusMessageCallback): Ditto. * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp: (WebCore::MediaPlayerPrivateGStreamer::handleMessage): Ditto. * platform/graphics/gstreamer/mse/AppendPipeline.cpp: (WebCore::AppendPipeline::AppendPipeline): Ditto. (WebCore::AppendPipeline::handleStateChangeMessage): Ditto. (WebCore::AppendPipeline::resetParserState): Ditto. * platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.cpp: (WebCore::MediaPlayerPrivateGStreamerMSE::load): Ditto. (WebCore::MediaPlayerPrivateGStreamerMSE::doSeek): Ditto. * platform/graphics/gtk/ImageBufferGtk.cpp: (WebCore::encodeImage): Use String::number instead of String::format. * platform/mediastream/gstreamer/GStreamerAudioCaptureSource.cpp: (WebCore::GStreamerAudioCaptureSource::create): Use makeString instead of String::format. * platform/mediastream/gstreamer/GStreamerCaptureDeviceManager.cpp: (WebCore::GStreamerCaptureDeviceManager::addDevice): Ditto. * platform/mediastream/gstreamer/GStreamerMediaStreamSource.cpp: (WebCore::webkitMediaStreamSrcAddPad): Ditto. * platform/mediastream/gstreamer/GStreamerVideoCaptureSource.cpp: (WebCore::GStreamerVideoCaptureSource::create): Ditto. * platform/network/curl/CookieJarDB.cpp: (WebCore::CookieJarDB::verifySchemaVersion): Ditto. * platform/win/SearchPopupMenuDB.cpp: (WebCore::SearchPopupMenuDB::verifySchemaVersion): Ditto. 2019-02-15 Philippe Normand [GStreamer] Decoding media-capabilities configuration initial support https://bugs.webkit.org/show_bug.cgi?id=191191 Reviewed by Xabier Rodriguez-Calvar. This patch enables basic platform probing for GStreamer decoders, optionally using Hardware decoding capabilities. The previous code for decoders/demuxers probing partially duplicated between the MSE player and its parent class was moved to a new module called GStreamerRegistryScanner. There is one instance of it for the MSE player and one for the parent class. The scanner can check for the presence of the GstElement Hardware metadata classifier in decoders and thus advise the MediaEngineConfigurationFactoryGStreamer that hardware decoding is supported or not. This is only a first step though. The scanner should also probably attempt a NULL->READY transition on decoders to validate specific input caps are supported. As this might require changes in GStreamer, this part of the patch wasn't included. This patch is covered by the existing media tests. * platform/GStreamer.cmake: New files. * platform/graphics/MediaPlayer.cpp: Add support for converting SupportsType enum to string. (WebCore::convertEnumerationToString): * platform/graphics/MediaPlayer.h: Ditto. * platform/graphics/MediaPlayerEnums.h: Ditto. * platform/graphics/gstreamer/GStreamerCommon.cpp: Move gstRegistryHasElementForMediaType to GStreamerRegistryScanner. * platform/graphics/gstreamer/GStreamerCommon.h: Ditto. * platform/graphics/gstreamer/GStreamerRegistryScanner.cpp: Added. (WebCore::GStreamerRegistryScanner::singleton): (WebCore::GStreamerRegistryScanner::GStreamerRegistryScanner): Initialize supported mime-types and codecs from the GStreamer registry. (WebCore::GStreamerRegistryScanner::~GStreamerRegistryScanner): Free the element factories. (WebCore::GStreamerRegistryScanner::gstRegistryHasElementForMediaType): Check the input caps are supported, optionally using hardware device. (WebCore::GStreamerRegistryScanner::fillMimeTypeSetFromCapsMapping): Moved from MediaPlayerPrivateGStreamer{,MSE}. (WebCore::GStreamerRegistryScanner::initialize): Ditto. (WebCore::GStreamerRegistryScanner::supportsCodec const): Ditto. (WebCore::GStreamerRegistryScanner::supportsAllCodecs const): Ditto. (WebCore::GStreamerRegistryScanner::isDecodingSupported const): Check the given configuration is supported. For now hardware support is checked for video configurations only as it is quite uncommon anyway to have hardware-enabled audio decoders. * platform/graphics/gstreamer/GStreamerRegistryScanner.h: Added. (WebCore::GStreamerRegistryScanner::mimeTypeSet): (WebCore::GStreamerRegistryScanner::supportsContainerType const): (WebCore::GStreamerRegistryScanner::RegistryLookupResult::operator bool const): * platform/graphics/gstreamer/MediaEngineConfigurationFactoryGStreamer.cpp: Added. (WebCore::createMediaPlayerDecodingConfigurationGStreamer): * platform/graphics/gstreamer/MediaEngineConfigurationFactoryGStreamer.h: Added. * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp: Rely on new GStreamerRegistryScanner and add some debugging macros. (WebCore::MediaPlayerPrivateGStreamer::getSupportedTypes): (WebCore::MediaPlayerPrivateGStreamer::supportsType): * platform/graphics/gstreamer/mse/AppendPipeline.cpp: Ditto. Also plug qtdemux for AAC containers, this is an explicit consequence of finer-grained codecs probing. (WebCore::AppendPipeline::AppendPipeline): (WebCore::AppendPipeline::parseDemuxerSrcPadCaps): * platform/graphics/gstreamer/mse/GStreamerRegistryScannerMSE.cpp: Added. (WebCore::GStreamerRegistryScannerMSE::singleton): (WebCore::GStreamerRegistryScannerMSE::GStreamerRegistryScannerMSE): * platform/graphics/gstreamer/mse/GStreamerRegistryScannerMSE.h: Added. * platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.cpp: Rely on new GStreamerRegistryScanner and add some debugging macros. (WebCore::MediaPlayerPrivateGStreamerMSE::getSupportedTypes): (WebCore::MediaPlayerPrivateGStreamerMSE::supportsType): * platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.h: * platform/mediacapabilities/MediaEngineConfigurationFactory.cpp: (WebCore::factories): GStreamer support. 2019-02-14 Joseph Pecoraro Web Inspector: Occasional crash under WebCore::CSSStyleSheet::item called from Inspector https://bugs.webkit.org/show_bug.cgi?id=194671 Reviewed by Devin Rousso. * css/CSSStyleSheet.cpp: (WebCore::CSSStyleSheet::item): A crash may happen if the m_childRuleCSSOMWrappers Vector gets out of sync with the m_contents list of rules. In particular if the wrappers vector is shorter than the rule list. We tried exercising code paths that modify these lists but were not able to reproduce the crash. To avoid a crash we can make this access safer and avoid the original overflow. At the same time we will keep and promote the assertion that would catch the lists getting out of sync in debug builds. 2019-02-13 Brian Burg Web Inspector: don't include accessibility role in DOM.Node object payloads https://bugs.webkit.org/show_bug.cgi?id=194623 Reviewed by Devin Rousso. Accessibility properties are complicated to fetch at all the points where we want to build and push nodes immediately. Turning on AX often indirectly causes style recalc and layout. This is bad because we are often building nodes in the first place due to a DOM node tree update (i.e., NodeInserted). It turns out that DOM.getAccessibilityPropertiesForNode is called every time we display the computed role in the Elements Tab > Nodes Sidebar > Accessibility Section. So it is not necessary to collect this information in a problematic way when initially pushing the node, as it will be updated anyway. No new tests, no change in behavior. * inspector/agents/InspectorDOMAgent.cpp: (WebCore::InspectorDOMAgent::buildObjectForNode): 2019-02-14 Zalan Bujtas [LFC][BFC][MarginCollapse] Replaced boxes don't collapse through their margins https://bugs.webkit.org/show_bug.cgi?id=194622 Reviewed by Antti Koivisto. Ensure that block replaced boxes don't collapse through their vertical margins. Test: fast/block/block-only/block-replaced-with-vertical-margins.html * layout/blockformatting/BlockMarginCollapse.cpp: (WebCore::Layout::BlockFormattingContext::MarginCollapse::marginsCollapseThrough): * page/FrameViewLayoutContext.cpp: (WebCore::layoutUsingFormattingContext): 2019-02-14 Zalan Bujtas [LFC] Shrink-to-fit-width should be constrained by min/max width https://bugs.webkit.org/show_bug.cgi?id=194653 Reviewed by Antti Koivisto. Use the fixed value of min-width/max-width to constrain the computed preferred width. * layout/FormattingContext.h: * layout/FormattingContextGeometry.cpp: (WebCore::Layout::FormattingContext::Geometry::constrainByMinMaxWidth): * layout/blockformatting/BlockFormattingContextGeometry.cpp: (WebCore::Layout::BlockFormattingContext::Geometry::intrinsicWidthConstraints): * layout/inlineformatting/InlineFormattingContext.cpp: (WebCore::Layout::InlineFormattingContext::computeIntrinsicWidthConstraints const): 2019-02-13 Ryosuke Niwa Crash in DOMTimer::fired https://bugs.webkit.org/show_bug.cgi?id=194638 Reviewed by Brent Fulgham. This patch continues the saga of hunting down timer related crashes after r239814, r225985, r227934. The crash was caused by the bug that we don't remove a DOMTimer from NestedTimersMap if a DOMTimer is created & installed inside another DOMTimer's callback (via execute call in DOMTimer::fired). Fixed the crash by using a Ref in NestedTimersMap. This will keep the timer alive until we exit from DOMTimer::fired. Because DOMTimer::fired always calls stopTracking() which clears the map we would not leak these DOM timers. We could, alternatively, use WeakPtr in NestedTimersMap but that would unnecessarily increase the size of DOMTimer for a very marginal benefit of DOMTimer objcets being deleted slightly earlier. Deleting itself in DOMTimer's destructor involves more logic & house keeping in the timer code, and is no longer the preferred approach when dealing with these classes of bugs in WebKit. Test: fast/dom/timer-destruction-during-firing.html * page/DOMTimer.cpp: (WebCore::NestedTimersMap::add): (WebCore::DOMTimer::install): (WebCore::DOMTimer::fired): 2019-02-13 Joseph Pecoraro Web Inspector: Crash when inspecting an element that constantly changes visibility https://bugs.webkit.org/show_bug.cgi?id=194632 Reviewed by Matt Baker and Devin Rousso. * inspector/agents/InspectorDOMAgent.h: * inspector/agents/InspectorDOMAgent.cpp: (WebCore::InspectorDOMAgent::processAccessibilityChildren): (WebCore::InspectorDOMAgent::buildObjectForAccessibilityProperties): Don't use rvalue-references as that was taking ownership and deleting the object we want to keep around. Instead simplify this to just use references so no ref counting changes happen. 2019-02-13 Chris Fleizach AX: Crash in handleMenuOpen https://bugs.webkit.org/show_bug.cgi?id=194627 Reviewed by Zalan Bujtas. Tests run under libGuardMalloc will cause crashes. This list of objects is a Node list, not an Element list, so we were not removing some nodes when they were being deallocated. * accessibility/AXObjectCache.cpp: (WebCore::AXObjectCache::remove): 2019-02-13 Jer Noble Entering fullscreen inside a shadow root will not set fullscreen pseudoclasses outside of root https://bugs.webkit.org/show_bug.cgi?id=194516 Reviewed by Antoine Quint. Test: fast/shadow-dom/fullscreen-in-shadow-full-screen-ancestor.html When walking up the element ancestor chain, use parentElementInComposedTree() to walk past the shadow root boundary. * dom/Element.cpp: (WebCore::parentCrossingFrameBoundaries): 2019-02-12 Jiewen Tan Further restricting webarchive loads https://bugs.webkit.org/show_bug.cgi?id=194567 Reviewed by Youenn Fablet. This patch futher restricts main frame webarchive loads to the followings: 1) loaded by clients; 2) loaded by drag; 3) reloaded from any of the previous two. It moves setAlwaysAllowLocalWebarchive, which is used for testing only, from Document to FrameLoader such that the option is remembered during redirections. Covered by API tests. * dom/Document.h: (WebCore::Document::setAlwaysAllowLocalWebarchive): Deleted. (WebCore::Document::alwaysAllowLocalWebarchive const): Deleted. * loader/DocumentLoader.cpp: (WebCore::DocumentLoader::disallowWebArchive const): * loader/DocumentLoader.h: (WebCore::DocumentLoader::setAllowsWebArchiveForMainFrame): (WebCore::DocumentLoader::allowsWebArchiveForMainFrame): * loader/FrameLoadRequest.h: (WebCore::FrameLoadRequest::setIsRequestFromClientOrUserInput): (WebCore::FrameLoadRequest::isRequestFromClientOrUserInput): * loader/FrameLoader.cpp: (WebCore::FrameLoader::load): (WebCore::FrameLoader::reload): * loader/FrameLoader.h: (WebCore::FrameLoader::setAlwaysAllowLocalWebarchive): (WebCore::FrameLoader::alwaysAllowLocalWebarchive const): * page/DragController.cpp: (WebCore::DragController::performDragOperation): * testing/Internals.cpp: (WebCore::Internals::setAlwaysAllowLocalWebarchive const): * testing/Internals.h: * testing/Internals.idl: 2019-02-13 Michael Catanzaro Unreviewed, fix unused variable warnings after r241148/r241251 https://bugs.webkit.org/show_bug.cgi?id=194348 * Modules/mediasource/SourceBuffer.cpp: (WebCore::SourceBuffer::sourceBufferPrivateDidReceiveRenderingError): (WebCore::SourceBuffer::evictCodedFrames): (WebCore::SourceBuffer::provideMediaData): 2019-02-13 Sihui Liu REGRESSION: [ Mac Debug WK2 ] Layout Test storage/indexeddb/key-type-infinity-private.html is a flaky crash https://bugs.webkit.org/show_bug.cgi?id=194413 Reviewed by Brady Eidson. IDB clients expected transaction operations to be executed in order, but in UniqueIDBDatabase::immediateCloseForUserDelete, callbacks in callback map were errored out randomly. This patch added a callback queue to UniqueIDBDatabase to make sure callbacks will be called in the same order as IDB Server receives the request. * Modules/indexeddb/server/UniqueIDBDatabase.cpp: (WebCore::IDBServer::UniqueIDBDatabase::storeCallbackOrFireError): (WebCore::IDBServer::UniqueIDBDatabase::immediateCloseForUserDelete): (WebCore::IDBServer::UniqueIDBDatabase::performErrorCallback): (WebCore::IDBServer::UniqueIDBDatabase::performKeyDataCallback): (WebCore::IDBServer::UniqueIDBDatabase::performGetResultCallback): (WebCore::IDBServer::UniqueIDBDatabase::performGetAllResultsCallback): (WebCore::IDBServer::UniqueIDBDatabase::performCountCallback): (WebCore::IDBServer::UniqueIDBDatabase::forgetErrorCallback): * Modules/indexeddb/server/UniqueIDBDatabase.h: 2019-02-13 Eric Carlson Revert r240434 https://bugs.webkit.org/show_bug.cgi?id=194600 Reviewed by Brent Fulgham. * html/HTMLMediaElement.cpp: (WebCore::HTMLMediaElement::setVolume): (WebCore::HTMLMediaElement::mediaPlayerVolumeChanged): (WebCore::HTMLMediaElement::updateVolume): * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm: (WebCore::MediaPlayerPrivateAVFoundationObjC::setVolume): 2019-02-13 Carlos Garcia Campos [FreeType] Unable to render some Hebrew characters https://bugs.webkit.org/show_bug.cgi?id=194498 Reviewed by Michael Catanzaro. We are failing to find a font for some of the combining character sequences because normalization is failing due to overflow error. In case of overflow, normalize returns the required length for the normalized characters, so we should handle that case to resize the output buffer and try again. * platform/graphics/cairo/FontCairoHarfbuzzNG.cpp: (WebCore::FontCascade::fontForCombiningCharacterSequence const): 2019-02-13 Ryosuke Niwa Release assert in PolicyCheckIdentifier::isValidFor via WebFrameLoaderClient::dispatchDecidePolicyForNavigationAction https://bugs.webkit.org/show_bug.cgi?id=194582 Reviewed by Antti Koivisto. Check the zero-ness of m_policyCheck first so that we can differentiate process ID being wrong from the non-generated identifier being sent to us as it was the case in this failure. * loader/PolicyChecker.cpp: (WebCore::PolicyCheckIdentifier::isValidFor): 2019-02-13 Commit Queue Unreviewed, rolling out r241273. https://bugs.webkit.org/show_bug.cgi?id=194579 This change is causing a flaky assertion failure crash in High Sierra Debug (Requested by ShawnRoberts on #webkit). Reverted changeset: "Stop using setDefersLoading from WebCore" https://bugs.webkit.org/show_bug.cgi?id=194315 https://trac.webkit.org/changeset/241273 2019-02-12 Rob Buis Align with Fetch on data: URLs https://bugs.webkit.org/show_bug.cgi?id=182325 Reviewed by Alex Christensen. The MIME type part of the data url should be serialized as specified in step 3 under "data" [1]. Test: web-platform-tests/fetch/data-urls/processing.any.js [1] https://fetch.spec.whatwg.org/#concept-scheme-fetch * platform/network/DataURLDecoder.cpp: (WebCore::DataURLDecoder::parseMediaType): 2019-02-12 Alex Christensen Remove setDefersLoading infrastructure from WebKit2 https://bugs.webkit.org/show_bug.cgi?id=194506 Reviewed by Brady Eidson. setDefersLoading is inherently racy from WebCore to the NetworkProcess, it adds unwanted complexity to the initialization and use of network objects, and it has led to many unrecoverable hang bugs over the years. We needed to force it into WebKit2 to transition some existing clients who relied on it, but we have recently finished transitioning those clients to other solutions, mostly completion handlers. * inspector/PageScriptDebugServer.cpp: (WebCore::PageScriptDebugServer::setJavaScriptPaused): 2019-02-12 Michael Catanzaro Unreviewed, fix build warnings after content extensions enablement https://bugs.webkit.org/show_bug.cgi?id=193622 * contentextensions/DFABytecode.h: (WebCore::ContentExtensions::instructionSizeWithArguments): * contentextensions/DFABytecodeCompiler.h: * contentextensions/URLFilterParser.cpp: (WebCore::ContentExtensions::URLFilterParser::statusString): 2019-02-12 Youenn Fablet Make use of is https://bugs.webkit.org/show_bug.cgi?id=194541 Reviewed by Alex Christensen. No change of behavior. * inspector/agents/InspectorNetworkAgent.cpp: (WebCore::InspectorNetworkAgent::didReceiveResponse): * loader/SubresourceLoader.h: (isType): 2019-02-12 Mark Lam Add some null checks in JSNodeCustom.h's root() and generated isReachableFromOpaqueRoots() functions. https://bugs.webkit.org/show_bug.cgi?id=194530 Reviewed by Chris Dumez. This is needed to fix a null pointer dereference that arises from the following scenario: 1. a Document detaches from its StyleSheetList. 2. the JSStyleSheetList that is associated with the detached StyleSheetList has yet to be scanned and collected by the GC. 3. the GC eventually looks for the opaque root of the StyleSheetList's owner, and discovers a null owner pointer. This patch fixes this issue by applying the following null checks: 1. Add a null check in JSNodeCustom.h's root(). root() is called from a isReachableFromOpaqueRoots() generated by CodeGeneratorJS.pm. isReachableFromOpaqueRoots() calls a ownerNode() method and passes its result to root(). However, depending on which class the ownerNode() method belongs to, it can either return a pointer or a reference. The null check only makes sense in the pointer case. To accommodate the 2 forms, root() itself is has an overload that takes a reference instead of a pointer. Since CodeGeneratorJS.pm can't tell what the generated class' ownerNode() returns, it can't discern when the result is a pointer and apply the null check. Instead, we just add the null check to the version of root() that takes a pointer. If the node pointer is null, we'll return a null opaque root. 2. Fix CodeGeneratorJS.pm to null check the opaque root before using it. * bindings/js/JSNodeCustom.h: (WebCore::root): * bindings/scripts/CodeGeneratorJS.pm: (GenerateImplementation): * bindings/scripts/test/JS/JSTestGenerateIsReachable.cpp: (WebCore::JSTestGenerateIsReachableOwner::isReachableFromOpaqueRoots): 2019-02-12 Antti Koivisto Crash in WebCore::ScrollingTree::updateTreeFromStateNode https://bugs.webkit.org/show_bug.cgi?id=194538 Reviewed by Zalan Bujtas. * page/scrolling/ScrollingTree.cpp: (WebCore::ScrollingTree::updateTreeFromStateNode): Make sure we don't leave node entry behind in m_nodeMap in case we failed to add it to the parent. 2019-02-12 Zalan Bujtas [LFC] Remove redundant InlineFormattingContext::computeBorderAndPadding https://bugs.webkit.org/show_bug.cgi?id=194540 Reviewed by Antti Koivisto. Use FormattingContext::computeBorderAndPadding instead. * layout/FormattingContext.cpp: (WebCore::Layout::FormattingContext::computeBorderAndPadding const): * layout/FormattingContext.h: * layout/inlineformatting/InlineFormattingContext.cpp: (WebCore::Layout::InlineFormattingContext::computeBorderAndPadding const): Deleted. * layout/inlineformatting/InlineFormattingContext.h: 2019-02-12 Zalan Bujtas [LFC][IFC] Add intrinsic width support for float boxes. https://bugs.webkit.org/show_bug.cgi?id=194528 Reviewed by Antti Koivisto. This patch implements a very simple float box support for intrinsic width. * layout/inlineformatting/InlineFormattingContext.cpp: (WebCore::Layout::InlineFormattingContext::computeIntrinsicWidthConstraints const): (WebCore::Layout::InlineFormattingContext::computeIntrinsicWidthForFloatBox const): (WebCore::Layout::InlineFormattingContext::computeIntrinsicWidthForInlineBlock const): (WebCore::Layout::InlineFormattingContext::computeMargin const): (WebCore::Layout::InlineFormattingContext::computeIntrinsicWidthForFormattingContextRoot const): Deleted. * layout/inlineformatting/InlineFormattingContext.h: 2019-02-12 Rob Buis Implement serializing in MIME type parser https://bugs.webkit.org/show_bug.cgi?id=193909 Reviewed by Darin Adler. Implement serializing in MIME type parser [1], to preserve the parameter order the Vector m_parameterNames is introduced, since HashMaps do not guarantee any order. Test: ParsedContentType.Serialize [1] https://mimesniff.spec.whatwg.org/#serializing-a-mime-type * platform/network/ParsedContentType.cpp: (WebCore::skipSpaces): (WebCore::parseQuotedString): (WebCore::ParsedContentType::parseContentType): (WebCore::ParsedContentType::parameterValueForName const): (WebCore::ParsedContentType::parameterCount const): (WebCore::ParsedContentType::setContentType): (WebCore::ParsedContentType::setContentTypeParameter): (WebCore::ParsedContentType::serialize const): * platform/network/ParsedContentType.h: 2019-02-08 Chris Fleizach AXObjectCache::childrenChanged shouldn't update layout or style during another style recalc https://bugs.webkit.org/show_bug.cgi?id=182280 Reviewed by Alan Bujtas. Remove the possibility that changing children calls back into updating layout by handling children changes in a deferred manner. This follows the same architecture as many other deferred changes, but also requires us to check deferred changes in updateBackingStore, because things like aria-hidden changes won't trigger a layout, but will require us to update children. A few tests had to be modified to no longer change the tree and then check the children immediately. * accessibility/AXObjectCache.cpp: (WebCore::AXObjectCache::remove): (WebCore::AXObjectCache::childrenChanged): (WebCore::AXObjectCache::prepareForDocumentDestruction): (WebCore::AXObjectCache::performDeferredCacheUpdate): * accessibility/AXObjectCache.h: * accessibility/AccessibilityObject.cpp: (WebCore::AccessibilityObject::updateBackingStore): * accessibility/mac/WebAccessibilityObjectWrapperBase.mm: (convertToNSArray): (-[WebAccessibilityObjectWrapperBase updateObjectBackingStore]): 2019-02-11 Myles C. Maxfield [Cocoa] Ask platform for generic font family mappings https://bugs.webkit.org/show_bug.cgi?id=187723 Reviewed by Brent Fulgham. WebKit API allows setting the generic font families for the USCRIPT_COMMON script. When trying to style a character with a generic font family, we first look to see if we have a mapping for the particular script the character is rendered with, and if we don't find a match, we then check USCRIPT_COMMON. In the Cocoa ports, the only way families get set for non-USCRIPT_COMMON scripts (aka the only scripts which won't use the API families) is in SettingsBase::initializeDefaultFontFamilies(). That function only sets the families for the CJK scripts. The mappings inside SettingsBase are incorrect and conflict with our policy regarding user-installed fonts. Instead, we should be consulting with the platform for some of these mappings, by calling CTFontDescriptorCreateForCSSFamily(). However, the WebKit API still has to work to set the mappings for untagged content. Therefore, we use the system mappings for language-tagged content, and the API mappings for non-language-tagged content. This is a good balance that makes sure we always have a good mapping for every language, but API clients can still set the mappings, too. Test: fast/text/ja-sans-serif.html * css/CSSComputedStyleDeclaration.cpp: * css/CSSFontSelector.cpp: (WebCore::resolveGenericFamily): * css/parser/CSSPropertyParser.cpp: (WebCore::consumeFontFamily): * page/cocoa/SettingsBaseCocoa.mm: (WebCore::SettingsBase::initializeDefaultFontFamilies): (WebCore::osakaMonoIsInstalled): Deleted. * platform/graphics/FontDescription.cpp: (WebCore::FontDescription::platformResolveGenericFamily): * platform/graphics/FontDescription.h: * platform/graphics/cocoa/FontDescriptionCocoa.cpp: (WebCore::computeSpecializedChineseLocale): (WebCore::cachedSpecializedChineseLocale): (WebCore::languageChanged): (WebCore::FontDescription::platformResolveGenericFamily): * platform/graphics/cocoa/SystemFontDatabaseCoreText.cpp: (WebCore::SystemFontDatabaseCoreText::clear): (WebCore::genericFamily): (WebCore::SystemFontDatabaseCoreText::serifFamily): (WebCore::SystemFontDatabaseCoreText::sansSerifFamily): (WebCore::SystemFontDatabaseCoreText::cursiveFamily): (WebCore::SystemFontDatabaseCoreText::fantasyFamily): (WebCore::SystemFontDatabaseCoreText::monospaceFamily): * platform/graphics/cocoa/SystemFontDatabaseCoreText.h: 2019-02-11 Adrian Perez de Castro [GTK][WPE] Add content extensions support in WKTR and unskip layout tests https://bugs.webkit.org/show_bug.cgi?id=193622 Reviewed by Michael Catanzaro. No new tests needed. * SourcesCocoa.txt: Remove loader/ResourceLoadInfo.cpp, it's not Cocoa-specific anymore. * Sources.txt: Add loader/ResourceLoadInfo.cpp, all ports use it now. 2019-02-11 Daniel Bates [iOS] Mouse/Touch/Pointer events are missing modifier keys https://bugs.webkit.org/show_bug.cgi?id=191446 Reviewed by Tim Horton. Extract the modifier flags from the WebEvent. This code is only used by Legacy WebKit on iOS and we will need to fix in order for modifier flags to be passed to WebKit. Tests: fast/events/touch/ios/mouse-events-with-modifiers.html fast/events/touch/ios/pointer-events-with-modifiers.html fast/events/touch/ios/touch-events-with-modifiers.html * platform/ios/PlatformEventFactoryIOS.mm: (WebCore::PlatformMouseEventBuilder::PlatformMouseEventBuilder): * platform/ios/WebEvent.h: * platform/ios/WebEvent.mm: (-[WebEvent initWithMouseEventType:timeStamp:location:]): (-[WebEvent initWithMouseEventType:timeStamp:location:modifiers:]): 2019-02-11 Jer Noble [Cocoa] Notify AVSystemController of our presenting PID before registering as a Now Playing app. https://bugs.webkit.org/show_bug.cgi?id=194504 Reviewed by Eric Carlson. This allows the MediaRemote framework to associate the WebContent process with its host application. * Modules/mediastream/UserMediaRequest.cpp: (WebCore::UserMediaRequest::start): * platform/audio/PlatformMediaSessionManager.h: (WebCore::PlatformMediaSessionManager::prepareToSendUserMediaPermissionRequest): * platform/audio/cocoa/MediaSessionManagerCocoa.h: * platform/audio/cocoa/MediaSessionManagerCocoa.mm: (MediaSessionManagerCocoa::prepareToSendUserMediaPermissionRequest): (MediaSessionManagerCocoa::providePresentingApplicationPIDIfNecessary): (MediaSessionManagerCocoa::updateNowPlayingInfo): 2019-02-11 Commit Queue Unreviewed, rolling out r241272 and r241276. https://bugs.webkit.org/show_bug.cgi?id=194514 Broke the Apple Internal build and the fix requires human intervention :( (Requested by dydz on #webkit). Reverted changesets: "[iOS] Mouse/Touch/Pointer events are missing modifier keys" https://bugs.webkit.org/show_bug.cgi?id=191446 https://trac.webkit.org/changeset/241272 "Fix internal iOS build after r241272" https://bugs.webkit.org/show_bug.cgi?id=191446 https://trac.webkit.org/changeset/241276 2019-02-11 Alex Christensen Stop using setDefersLoading from WebCore https://bugs.webkit.org/show_bug.cgi?id=194315 Reviewed by Jer Noble. That is what CompletionHandlers are for. * loader/MediaResourceLoader.cpp: (WebCore::MediaResource::responseReceived): (WebCore::MediaResource::setDefersLoading): Deleted. * loader/MediaResourceLoader.h: * platform/graphics/PlatformMediaResourceLoader.h: (WebCore::PlatformMediaResourceClient::responseReceived): (WebCore::PlatformMediaResource::stop): (WebCore::PlatformMediaResource::setDefersLoading): Deleted. * platform/network/cocoa/WebCoreNSURLSession.mm: (WebCore::WebCoreNSURLSessionDataTaskClient::responseReceived): (-[WebCoreNSURLSessionDataTask resource:receivedResponse:completionHandler:]): (-[WebCoreNSURLSessionDataTask _setDefersLoading:]): Deleted. (-[WebCoreNSURLSessionDataTask resource:receivedResponse:]): Deleted. 2019-02-11 Daniel Bates [iOS] Mouse/Touch/Pointer events are missing modifier keys https://bugs.webkit.org/show_bug.cgi?id=191446 Reviewed by Tim Horton. Extract the modifier flags from the WebEvent. This code is only used by Legacy WebKit on iOS and we will need to fix in order for modifier flags to be passed to WebKit. Tests: fast/events/touch/ios/mouse-events-with-modifiers.html fast/events/touch/ios/pointer-events-with-modifiers.html fast/events/touch/ios/touch-events-with-modifiers.html * platform/ios/PlatformEventFactoryIOS.mm: (WebCore::PlatformMouseEventBuilder::PlatformMouseEventBuilder): * platform/ios/WebEvent.h: * platform/ios/WebEvent.mm: (-[WebEvent initWithMouseEventType:timeStamp:location:]): (-[WebEvent initWithMouseEventType:timeStamp:location:modifiers:]): 2019-02-11 Daniel Bates Separate out outline-style: auto user-agent appearance from Mac animated focus ring drawing https://bugs.webkit.org/show_bug.cgi?id=193591 Reviewed by Simon Fraser. Untangle the Mac-specific concept of animated focus ring drawing from the concepts of using the fancy shrink-wrapped focus ring appearance and using the platform focus ring color when outline-style: auto. No functionality changed. So, no new tests. * platform/graphics/GraphicsContext.h: * platform/graphics/cocoa/GraphicsContextCocoa.mm: (WebCore::drawFocusRing): (WebCore::drawFocusRingToContextAtTime): Change some macro guards. * rendering/RenderElement.cpp: (WebCore::usePlatformFocusRingColorForOutlineStyleAuto): Added. (WebCore::useShrinkWrappedFocusRingForOutlineStyleAuto): Added. (WebCore::drawFocusRing): Added. (WebCore::RenderElement::paintFocusRing): Write in terms of drawFocusRing(). 2019-02-11 Truitt Savell Unreviewed, rolling out r241229. Revision broke internal builds for watchOS. Reverted changeset: "[Cocoa] Ask platform for generic font family mappings" https://bugs.webkit.org/show_bug.cgi?id=187723 https://trac.webkit.org/changeset/241229 2019-02-11 Youenn Fablet Make Request constructor throw if FetchRequestInit.signal is not undefined, null or an AbortSignal object https://bugs.webkit.org/show_bug.cgi?id=194404 Reviewed by Geoffrey Garen. Align with the spec, except for known problematic web sites. Covered by updated test. * Modules/fetch/FetchRequest.cpp: (WebCore::needsSignalQuirk): (WebCore::processInvalidSignal): (WebCore::FetchRequest::initializeWith): 2019-02-11 Zalan Bujtas [LFC] FormattingContext::Geometry::floatingHeightAndMargin should take UsedHorizontalValues https://bugs.webkit.org/show_bug.cgi?id=194490 Reviewed by Antti Koivisto. This is in preparation for adding floating preferred width computation support. It requires height computaiton which uses containing block width to resolve vertical margins. * layout/FormattingContext.cpp: (WebCore::Layout::FormattingContext::computeBorderAndPadding const): * layout/FormattingContext.h: * layout/FormattingContextGeometry.cpp: (WebCore::Layout::FormattingContext::Geometry::outOfFlowNonReplacedVerticalGeometry): (WebCore::Layout::FormattingContext::Geometry::outOfFlowReplacedVerticalGeometry): (WebCore::Layout::FormattingContext::Geometry::complicatedCases): (WebCore::Layout::FormattingContext::Geometry::floatingHeightAndMargin): (WebCore::Layout::FormattingContext::Geometry::inlineReplacedHeightAndMargin): (WebCore::Layout::FormattingContext::Geometry::computedVerticalMargin): * layout/FormattingContextQuirks.cpp: (WebCore::Layout::FormattingContext::Quirks::heightValueOfNearestContainingBlockWithFixedHeight): * layout/LayoutUnits.h: (WebCore::Layout::UsedHorizontalValues::UsedHorizontalValues): * layout/blockformatting/BlockFormattingContext.cpp: (WebCore::Layout::BlockFormattingContext::computeHeightAndMargin const): * layout/blockformatting/BlockFormattingContextGeometry.cpp: (WebCore::Layout::BlockFormattingContext::Geometry::inFlowNonReplacedHeightAndMargin): (WebCore::Layout::BlockFormattingContext::Geometry::inFlowHeightAndMargin): * layout/blockformatting/BlockFormattingContextQuirks.cpp: (WebCore::Layout::BlockFormattingContext::Quirks::stretchedInFlowHeight): * layout/blockformatting/BlockMarginCollapse.cpp: (WebCore::Layout::BlockFormattingContext::MarginCollapse::positiveNegativeValues): (WebCore::Layout::BlockFormattingContext::MarginCollapse::estimatedMarginBefore): * layout/inlineformatting/InlineFormattingContext.cpp: (WebCore::Layout::InlineFormattingContext::layout const): (WebCore::Layout::InlineFormattingContext::computeHeightAndMargin const): * layout/inlineformatting/InlineFormattingContextGeometry.cpp: (WebCore::Layout::InlineFormattingContext::Geometry::inlineBlockHeightAndMargin): 2019-02-11 Zalan Bujtas [LFC] FormattingContext::intrinsicWidthConstraints should compute and save the intrinsic widths consistently. https://bugs.webkit.org/show_bug.cgi?id=194483 Reviewed by Antti Koivisto. Rename intrinsicWidthConstraints to computeIntrinsicWidthConstraints (it does not return the width values anymore). * layout/FormattingContext.h: * layout/FormattingContextGeometry.cpp: (WebCore::Layout::FormattingContext::Geometry::shrinkToFitWidth): * layout/blockformatting/BlockFormattingContext.cpp: (WebCore::Layout::BlockFormattingContext::computeIntrinsicWidthConstraints const): (WebCore::Layout::BlockFormattingContext::intrinsicWidthConstraints const): Deleted. * layout/blockformatting/BlockFormattingContext.h: * layout/inlineformatting/InlineFormattingContext.cpp: (WebCore::Layout::InlineFormattingContext::computeIntrinsicWidthConstraints const): (WebCore::Layout::InlineFormattingContext::computeIntrinsicWidthForFormattingContextRoot const): (WebCore::Layout::InlineFormattingContext::intrinsicWidthConstraints const): Deleted. * layout/inlineformatting/InlineFormattingContext.h: 2019-02-10 Zalan Bujtas [LFC] Fix spelling error. https://bugs.webkit.org/show_bug.cgi?id=194489 Reviewed by Simon Fraser. instrinsic -> intrinsic * layout/FormattingContext.h: * layout/FormattingContextGeometry.cpp: (WebCore::Layout::FormattingContext::Geometry::shrinkToFitWidth): * layout/FormattingState.h: (WebCore::Layout::FormattingState::setIntrinsicWidthConstraints): (WebCore::Layout::FormattingState::clearIntrinsicWidthConstraints): (WebCore::Layout::FormattingState::intrinsicWidthConstraints const): (WebCore::Layout::FormattingState::setInstrinsicWidthConstraints): Deleted. (WebCore::Layout::FormattingState::clearInstrinsicWidthConstraints): Deleted. (WebCore::Layout::FormattingState::instrinsicWidthConstraints const): Deleted. * layout/blockformatting/BlockFormattingContext.cpp: (WebCore::Layout::BlockFormattingContext::intrinsicWidthConstraints const): (WebCore::Layout::BlockFormattingContext::instrinsicWidthConstraints const): Deleted. * layout/blockformatting/BlockFormattingContext.h: * layout/blockformatting/BlockFormattingContextGeometry.cpp: (WebCore::Layout::BlockFormattingContext::Geometry::intrinsicWidthConstraintsNeedChildrenWidth): (WebCore::Layout::BlockFormattingContext::Geometry::intrinsicWidthConstraints): (WebCore::Layout::BlockFormattingContext::Geometry::instrinsicWidthConstraintsNeedChildrenWidth): Deleted. (WebCore::Layout::BlockFormattingContext::Geometry::instrinsicWidthConstraints): Deleted. * layout/inlineformatting/InlineFormattingContext.cpp: (WebCore::Layout::InlineFormattingContext::intrinsicWidthConstraints const): (WebCore::Layout::InlineFormattingContext::computeIntrinsicWidthForFormattingContextRoot const): (WebCore::Layout::InlineFormattingContext::instrinsicWidthConstraints const): Deleted. * layout/inlineformatting/InlineFormattingContext.h: 2019-02-10 Darin Adler Switch uses of StringBuilder with String::format for hex numbers to use HexNumber.h instead https://bugs.webkit.org/show_bug.cgi?id=194485 Reviewed by Daniel Bates. * Modules/websockets/WebSocket.cpp: (WebCore::encodeProtocolString): Use appendUnsignedAsHexFixedSize instead of String::format. * css/parser/CSSParserToken.cpp: (WebCore::CSSParserToken::serialize const): Fixed style of many return statements that called a function returning void; doesn't match WebKit's prevailing style. Also use break instead of return. Used appendLiteral instead of append in many cases, and append character instead of single-character literal in others. Use appendUnsignedAsHex instead of String::format. * platform/graphics/opengl/GraphicsContext3DOpenGLCommon.cpp: (WebCore::generateHashedName): Use appendUnsignedAsHex instad of appendUnsigned64AsHex. Should come back here and use makeString once we make HexNumber.h work with that. * platform/mac/WebCoreNSURLExtras.mm: Removed unnecessary include of HexNumber.h. * rendering/RenderTreeAsText.cpp: (WebCore::quoteAndEscapeNonPrintables): Use appendLiteral instead of multiple calls to character append. Touched because it was next to a call to appendUnsignedAsHex. 2019-02-10 Pablo Saavedra libWPEWebKit-0.1.so: undefined reference to `JSC::JSValue::asCell() const https://bugs.webkit.org/show_bug.cgi?id=194484 Reviewed by Darin Adler. * bindings/js/JSUndoItemCustom.cpp: 2019-02-10 Philippe Normand Unreviewed, GTK Debug build fix after r241148. * Modules/mediasource/SourceBuffer.cpp: (WebCore::removeSamplesFromTrackBuffer): SourceBuffer::logClassName and friends are declared for !RELEASE_LOG_DISABLED builds so adapt calling sites accordingly. 2019-02-10 Zalan Bujtas [LFC][IFC] Add intrinsic width support for inline-block boxes https://bugs.webkit.org/show_bug.cgi?id=194479 Reviewed by Antti Koivisto. Compute the intrinsic width for the inline-block (formatting context root) and set it as the content box width while laying out the content for the min/max width.
beforeinline_block contentafter
The "inline-block" formatting root returns "inline_block" width for the minimum and "inline_block width" for the maximum width. These min/max values are used to figure out the intrinsic width for the parent
. * layout/inlineformatting/InlineFormattingContext.cpp: (WebCore::Layout::InlineFormattingContext::instrinsicWidthConstraints const): (WebCore::Layout::InlineFormattingContext::computeIntrinsicWidthForFormattingContextRoot const): (WebCore::Layout::InlineFormattingContext::computeMargin const): * layout/inlineformatting/InlineFormattingContext.h: * page/FrameViewLayoutContext.cpp: (WebCore::layoutUsingFormattingContext): 2019-02-10 Zalan Bujtas [LFC][IFC] Add intrinsic width support for replaced boxes https://bugs.webkit.org/show_bug.cgi?id=194478 Reviewed by Antti Koivisto. * layout/inlineformatting/InlineFormattingContext.cpp: (WebCore::Layout::InlineFormattingContext::layout const): (WebCore::Layout::InlineFormattingContext::instrinsicWidthConstraints const): (WebCore::Layout::InlineFormattingContext::computeMargin const): (WebCore::Layout::InlineFormattingContext::computeBorderAndPadding const): (WebCore::Layout::InlineFormattingContext::layoutFormattingContextRoot const): (WebCore::Layout::InlineFormattingContext::computeWidthAndHeightForReplacedInlineBox const): (WebCore::Layout::InlineFormattingContext::computeMarginBorderAndPadding const): Deleted. * layout/inlineformatting/InlineFormattingContext.h: 2019-02-10 Alicia Boya García [MSE][GStreamer] Add missing return type to lambda https://bugs.webkit.org/show_bug.cgi?id=194414 Reviewed by Darin Adler. Since g_signal_connect() is untyped, a compiler error was not generated when a lambda with a missing GstFlowReturn return type was provided for a signal that expects it. This used to work before r240784 because a recent function call had set GST_FLOW_OK in the return value register and it happened to survive until the lambda function call ended. Starting on that commit such return value was removed and it stopped working on debug. Of course, the actual problem is in the signature of the lambda function, and this patch fixes that. * platform/graphics/gstreamer/mse/AppendPipeline.cpp: (WebCore::AppendPipeline::AppendPipeline): 2019-02-09 Darin Adler Eliminate unnecessary String temporaries by using StringConcatenateNumbers https://bugs.webkit.org/show_bug.cgi?id=194021 Reviewed by Geoffrey Garen. For floating point numbers, String::number gives a fixed precision result, stripping trailing zeroes. When possible, I changed the code to instead use the equivalent of String::numberToStringECMAScript, which is what makeString does by default for floating point, gives the same results for many cases, and gives better results in many others. However, for floats, we do not yet have a good implementation, so instead I used FormattedNumber::fixedPrecision to match the old behavior. * Modules/indexeddb/shared/IDBTransactionInfo.cpp: (WebCore::IDBTransactionInfo::loggingString const): Remove String::number and let makeString do the conversion without allocating/destroying a String. * Modules/websockets/ThreadableWebSocketChannel.cpp: (WebCore::ThreadableWebSocketChannel::create): Ditto. * Modules/websockets/WebSocket.cpp: (WebCore::WebSocket::connect): Ditto. Added a cast to "unsigned" to sidestep the ambiguity with 16-bit unsigned types that are sometimes used for numbers (uint16_t) and sometimes used for UTF-16 code units (UChar) and can be the same type. * Modules/websockets/WebSocketChannel.cpp: (WebCore::WebSocketChannel::didFailSocketStream): Use ASCIILiteral when intializing a string instead of just a normal C literal. Switched to makeString so we could remove String::number and do the conversion without allocating/destroying a String. (WebCore::WebSocketChannel::didFail): Ditto. (WebCore::WebSocketChannel::processFrame): Ditto. * Modules/websockets/WebSocketFrame.cpp: (WebCore::WebSocketFrame::parseFrame): Ditto. * Modules/websockets/WebSocketHandshake.cpp: (WebCore::WebSocketHandshake::readServerHandshake): Ditto. * accessibility/AccessibilityRenderObject.cpp: (WebCore::AccessibilityRenderObject::positionalDescriptionForMSAA const): Ditto. * bindings/js/JSDOMConvertNumbers.cpp: (WebCore::rangeErrorString): Ditto. * css/CSSAspectRatioValue.cpp: (WebCore::CSSAspectRatioValue::customCSSText const): Ditto. Used FormattedNumber::fixedPrecision since these are floats. * css/DOMMatrixReadOnly.cpp: (WebCore::DOMMatrixReadOnly::toString const): Use StringBuilder::builder.appendECMAScriptNumber instead of String::numberToStringECMAScript so we can do it without allocating/destroying a String. * css/WebKitCSSMatrix.cpp: (WebCore::WebKitCSSMatrix::toString const): Ditto. * dom/MessagePortIdentifier.h: (WebCore::MessagePortIdentifier::logString const): Remove String::number and let makeString do the conversion without allocating/destroying a String. * editing/cocoa/DataDetection.mm: (WebCore::dataDetectorStringForPath): Remove unnecessary type casts on values passed to String::number and to StringBuilder::appendNumber. These could do harm if the values were out of range, and should not be necessary. * history/BackForwardItemIdentifier.h: (WebCore::BackForwardItemIdentifier::logString const): Remove String::number and let makeString do the conversion without allocating/destroying a String. * html/FTPDirectoryDocument.cpp: (WebCore::processFileDateString): Ditto. * html/canvas/WebGLRenderingContextBase.cpp: (WebCore::WebGLRenderingContextBase::getUniformLocation): Ditto. (WebCore::WebGLRenderingContextBase::checkTextureCompleteness): Ditto. * inspector/agents/WebConsoleAgent.cpp: (WebCore::WebConsoleAgent::didReceiveResponse): Ditto. * loader/WorkerThreadableLoader.cpp: (WebCore::WorkerThreadableLoader::loadResourceSynchronously): Ditto. * loader/appcache/ApplicationCacheGroup.cpp: (WebCore::ApplicationCacheGroup::didFailLoadingManifest): Ditto. * page/PageSerializer.cpp: (WebCore::PageSerializer::urlForBlankFrame): Ditto. * page/PrintContext.cpp: (WebCore::PrintContext::pageProperty): Ditto. (WebCore::PrintContext::pageSizeAndMarginsInPixels): Ditto. * page/WheelEventTestTrigger.cpp: (WebCore::dumpState): Use StringBuilder::appendNumber instead of String::number so we can do it without allocating/destroying a String. Also use StringBuilder::appendLiteral on a literal. * page/cocoa/ResourceUsageOverlayCocoa.mm: (WebCore::ResourceUsageOverlay::platformDraw): Pass explicit KeepTrailingZeros to FormattedNumber::fixedPrecision to preserve behavior, since default is now to truncate trailing zeros. * platform/graphics/Color.cpp: (WebCore::Color::cssText): Use StringBuilder::appendNumber instead of calling numberToFixedPrecisionString to do the same thing. * platform/graphics/ExtendedColor.cpp: (WebCore::ExtendedColor::cssText): Ditto. * platform/graphics/ca/GraphicsLayerCA.cpp: (WebCore::animationIdentifier): Remove String::number and let makeString do the conversion without allocating/destroying a String. Had to add a typecast to convert the enumeration into an integer. * platform/graphics/ca/cocoa/PlatformCAFiltersCocoa.mm: (WebCore::PlatformCAFilters::setFiltersOnLayer): Ditto. * platform/graphics/cocoa/FontPlatformDataCocoa.mm: (WebCore::FontPlatformData::description const): Ditto. * platform/mock/mediasource/MockSourceBufferPrivate.cpp: (WebCore::MockMediaSample::MockMediaSample): Use AtomicString::number instead of String::number to avoid unneccessarily allocating an additional temporary String when an AtomicString already exists. * platform/network/cf/SocketStreamHandleImplCFNet.cpp: (WebCore::SocketStreamHandleImpl::reportErrorToClient): Remove String::number and let makeString do the conversion without allocating/destroying a String. * platform/sql/SQLiteDatabase.cpp: (WebCore::SQLiteDatabase::setMaximumSize): Ditto. (WebCore::SQLiteDatabase::setSynchronous): Ditto. Had to add a typecast to convert the enumeration into an integer. * svg/SVGAngleValue.cpp: (WebCore::SVGAngleValue::valueAsString const): Ditto. * svg/SVGLengthValue.cpp: (WebCore::SVGLengthValue::valueAsString const): Ditto. * testing/Internals.cpp: (WebCore::Internals::configurationForViewport): Ditto. Used FormattedNumber::fixedPrecision since these are floats. (WebCore::Internals::getCurrentCursorInfo): Use StringBuilder::appendNumber instead of calling numberToFixedPrecisionString to do the same thing. (WebCore::Internals::queueMicroTask): Remove String::number and let makeString do the conversion without allocating/destroying a String. (WebCore::appendOffsets): Use StringBuilder::appendNumber instead of String::number so we can do it without allocating/destroying a String. * workers/service/ServiceWorkerClientIdentifier.h: (WebCore::ServiceWorkerClientIdentifier::toString const): Remove String::number and let makeString do the conversion without allocating/destroying a String. * workers/service/server/RegistrationDatabase.cpp: (WebCore::databaseFilenameFromVersion): Ditto. 2019-02-09 Zalan Bujtas [LFC][IFC] Add intrinsic width support for basic inline containers https://bugs.webkit.org/show_bug.cgi?id=194473 Reviewed by Antti Koivisto. Preferred width computation logic is very similar to normal layout. One of the main difference is that the preferred width codepath does not provide valid containing block width. This patch implement basic inline container support by passing nullopt containing block width in UsedHorizontalValues. * layout/inlineformatting/InlineFormattingContext.cpp: (WebCore::Layout::InlineFormattingContext::layout const): (WebCore::Layout::InlineFormattingContext::instrinsicWidthConstraints const): (WebCore::Layout::InlineFormattingContext::computeBorderAndPadding const): (WebCore::Layout::InlineFormattingContext::computeMarginBorderAndPadding const): (WebCore::Layout::InlineFormattingContext::computeWidthAndMargin const): (WebCore::Layout::InlineFormattingContext::layoutFormattingContextRoot const): (WebCore::Layout::InlineFormattingContext::computeWidthAndHeightForReplacedInlineBox const): * layout/inlineformatting/InlineFormattingContext.h: 2019-02-08 Myles C. Maxfield [Cocoa] CTLineGetGlyphRuns() might return nullptr https://bugs.webkit.org/show_bug.cgi?id=194467 Reviewed by Simon Fraser. Be somewhat defensive to try to make sure this sort of thing doesn't happen in the future. Covered by find/text/find-backwards.html * platform/graphics/mac/ComplexTextControllerCoreText.mm: (WebCore::ComplexTextController::collectComplexTextRunsForCharacters): 2019-02-08 Myles C. Maxfield [Cocoa] Ask platform for generic font family mappings https://bugs.webkit.org/show_bug.cgi?id=187723 Reviewed by Brent Fulgham. WebKit API allows setting the generic font families for the USCRIPT_COMMON script. When trying to style a character with a generic font family, we first look to see if we have a mapping for the particular script the character is rendered with, and if we don't find a match, we then check USCRIPT_COMMON. In the Cocoa ports, the only way families get set for non-USCRIPT_COMMON scripts (aka the only scripts which won't use the API families) is in SettingsBase::initializeDefaultFontFamilies(). That function only sets the families for the CJK scripts. The mappings inside SettingsBase are incorrect and conflict with our policy regarding user-installed fonts. Instead, we should be consulting with the platform for some of these mappings, by calling CTFontDescriptorCreateForCSSFamily(). However, the WebKit API still has to work to set the mappings for untagged content. Therefore, we use the system mappings for language-tagged content, and the API mappings for non-language-tagged content. This is a good balance that makes sure we always have a good mapping for every language, but API clients can still set the mappings, too. Test: fast/text/ja-sans-serif.html * css/CSSComputedStyleDeclaration.cpp: * css/CSSFontSelector.cpp: (WebCore::resolveGenericFamily): * css/parser/CSSPropertyParser.cpp: (WebCore::consumeFontFamily): * page/cocoa/SettingsBaseCocoa.mm: (WebCore::SettingsBase::initializeDefaultFontFamilies): (WebCore::osakaMonoIsInstalled): Deleted. * platform/graphics/FontDescription.cpp: (WebCore::FontDescription::platformResolveGenericFamily): * platform/graphics/FontDescription.h: * platform/graphics/cocoa/FontDescriptionCocoa.cpp: (WebCore::computeSpecializedChineseLocale): (WebCore::cachedSpecializedChineseLocale): (WebCore::languageChanged): (WebCore::FontDescription::platformResolveGenericFamily): * platform/graphics/cocoa/SystemFontDatabaseCoreText.cpp: (WebCore::SystemFontDatabaseCoreText::clear): (WebCore::SystemFontDatabaseCoreText::serifFamily): (WebCore::SystemFontDatabaseCoreText::sansSerifFamily): (WebCore::SystemFontDatabaseCoreText::cursiveFamily): (WebCore::SystemFontDatabaseCoreText::fantasyFamily): (WebCore::SystemFontDatabaseCoreText::monospaceFamily): * platform/graphics/cocoa/SystemFontDatabaseCoreText.h: 2019-02-08 Yusuke Suzuki [JSC] Shrink sizeof(CodeBlock) more https://bugs.webkit.org/show_bug.cgi?id=194419 Reviewed by Mark Lam. * testing/Internals.cpp: (WebCore::Internals::parserMetaData): 2019-02-08 Chris Dumez [Cocoa] Optimize ResourceResponse::platformLazyInit() https://bugs.webkit.org/show_bug.cgi?id=194438 Reviewed by Alex Christensen. Optimize ResourceResponse::platformLazyInit(). Most of the CPU time currently goes into getting the HTTP headers from CFNetwork: """ Sample Count, Samples %, CPU %, Symbol 46, 0.0%, 0.0%, WebCore::initializeHTTPHeaders(WebCore::OnlyCommonHeaders, NSHTTPURLResponse*, WebCore::HTTPHeaderMap&) (in WebCore) 34, 0.0%, 0.0%, HTTPHeaderDict::copyAsOrdinaryDict(__CFAllocator const*) const (in CFNetwork) 11, 0.0%, 0.0%, CFDictionaryApplyFunction (in CoreFoundation) """ We currently have 2 levels of initialization: CommonFieldsOnly & AllFields. With WebKit2, most ResourceResponses get sent over IPC and thus end up getting initialized twice, once with CommonFieldsOnly and then with AllFields. This would cause us to call the expensive HTTPHeaderDict::copyAsOrdinaryDict() twice instead of once, simply to initialize the common HTTP headers first and then the uncommon ones later. This patch updates ResourceResponse::platformLazyInit() to initialize all HTTP headers at once, as soon as CommonFieldsOnly initialization is requested, so that we no longer copy all HTTP headers twice. * platform/network/cocoa/ResourceResponseCocoa.mm: (WebCore::initializeHTTPHeaders): (WebCore::ResourceResponse::platformLazyInit): 2019-02-08 Justin Fan [Web GPU] Build fix for MTLStorageMode availability on different Cocoa platforms https://bugs.webkit.org/show_bug.cgi?id=194443 Unreviewed build fix. For MTLTextures, MTLStorageModeManaged is only available on macOS. Other platforms, if not using MTLStorageModePrivate, must use MTLStorageModeShared. Behavior unchanged. * platform/graphics/gpu/cocoa/GPUTextureMetal.mm: (WebCore::storageModeForPixelFormatAndSampleCount): 2019-02-08 Per Arne Vollan [WebVTT] Inline WebVTT styles should start with '::cue' https://bugs.webkit.org/show_bug.cgi?id=194227 Reviewed by Eric Carlson. Check that the CSS string starts with '::cue' and is successfully parsed before adding it to the CSS stylesheet list. Also, the caption preferences CSS string should start with '::cue', since it is added inside the video shadow root element. Test: media/track/track-cue-css.html * html/track/WebVTTParser.cpp: (WebCore::WebVTTParser::checkAndStoreStyleSheet): * page/CaptionUserPreferencesMediaAF.cpp: (WebCore::CaptionUserPreferencesMediaAF::captionsStyleSheetOverride const): 2019-02-08 Youenn Fablet Running RTCRtpSender.getCapabilities("video") before initial offer breaks VP8 https://bugs.webkit.org/show_bug.cgi?id=194380 Reviewed by Eric Carlson. Set whether VP8 is supported at creation of the page. This ensures that any call creating a peer connection factory will end up supporting the runtime flag configuration. Add internal API to enable resetting the factory to enable proper testing. Covered by updated test. * Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.cpp: (WebCore::createLibWebRTCPeerConnectionBackend): * page/Page.cpp: (WebCore::m_applicationManifest): * platform/mediastream/libwebrtc/LibWebRTCProvider.h: * testing/Internals.cpp: (WebCore::Internals::clearPeerConnectionFactory): * testing/Internals.h: * testing/Internals.idl: 2019-02-08 Andy Estes [WebIDL] Support serializing sequences and FrozenArrays of non-interfaces https://bugs.webkit.org/show_bug.cgi?id=190997 Reviewed by Brent Fulgham. Support serializing sequences and FrozenArrays of types that aren't interfaces. This is needed to properly serialize PaymentAddress, which has a FrozenArray of DOMStrings. We should support serializing sequences of interfaces too, but that's slightly more complicated since it involves iterating the sequence and serializing each of its items. I left that as a follow-up task, since I don't see any IDLs that currently need this. We also don't support serializing sequences with the CachedAttribute or CustomGetter extended attributes, because WebIDL specifies that a new array should be created when converting an IDL sequence into an ECMAScript value. Added bindings test cases to TestSerialization.idl and PaymentAddress test cases to http/tests/paymentrequest/payment-address-attributes-and-toJSON-method.https.html. * bindings/scripts/CodeGenerator.pm: (GetInterfaceForType): Renamed from GetInterfaceForAttribute. (IsSerializableType): Modified to allow sequences and FrozenArrays of non-interface types. (hasCachedAttributeOrCustomGetterExtendedAttribute): Added a helper to determine if an attribute has the CachedAttribute or CustomGetter extended attributes. (IsSerializableAttribute): Checked for sequences with the CachedAttribute or CustomGetter extended attributes before calling IsSerializableType. (GetInterfaceForAttribute): Renamed to GetInterfaceForType. * bindings/scripts/test/JS/JSTestSerialization.cpp: * bindings/scripts/test/TestSerialization.idl: 2019-02-08 Sihui Liu IndexedDB tests leak documents https://bugs.webkit.org/show_bug.cgi?id=189435 Reviewed by Geoffrey Garen. Remove use of JSC::Strong in IndexedDatabase. * Modules/indexeddb/IDBCursor.cpp: (WebCore::IDBCursor::update): (WebCore::IDBCursor::continuePrimaryKey): (WebCore::IDBCursor::continueFunction): (WebCore::IDBCursor::deleteFunction): (WebCore::IDBCursor::setGetResult): * Modules/indexeddb/IDBCursor.h: (WebCore::IDBCursor::key): (WebCore::IDBCursor::primaryKey): (WebCore::IDBCursor::value): (WebCore::IDBCursor::keyWrapper): (WebCore::IDBCursor::primaryKeyWrapper): (WebCore::IDBCursor::valueWrapper): (WebCore::IDBCursor::key const): Deleted. (WebCore::IDBCursor::primaryKey const): Deleted. (WebCore::IDBCursor::value const): Deleted. * Modules/indexeddb/IDBCursor.idl: * Modules/indexeddb/IDBCursorWithValue.idl: * Modules/indexeddb/IDBObjectStore.cpp: (WebCore::IDBObjectStore::putForCursorUpdate): * Modules/indexeddb/IDBObjectStore.h: * Modules/indexeddb/IDBRequest.cpp: (WebCore::IDBRequest::IDBRequest): (WebCore::IDBRequest::~IDBRequest): (WebCore::IDBRequest::result const): (WebCore::IDBRequest::setResult): (WebCore::IDBRequest::setResultToStructuredClone): (WebCore::IDBRequest::setResultToUndefined): (WebCore::IDBRequest::resultCursor): (WebCore::IDBRequest::willIterateCursor): (WebCore::IDBRequest::didOpenOrIterateCursor): * Modules/indexeddb/IDBRequest.h: (WebCore::IDBRequest::resultWrapper): * Modules/indexeddb/IDBRequest.idl: * Sources.txt: * WebCore.xcodeproj/project.pbxproj: * bindings/js/JSIDBCursorCustom.cpp: (WebCore::JSIDBCursor::key const): (WebCore::JSIDBCursor::primaryKey const): (WebCore::JSIDBCursor::visitAdditionalChildren): * bindings/js/JSIDBCursorWithValueCustom.cpp: (WebCore::JSIDBCursorWithValue::value const): (WebCore::JSIDBCursorWithValue::visitAdditionalChildren): * bindings/js/JSIDBRequestCustom.cpp: Added. (WebCore::JSIDBRequest::result const): (WebCore::JSIDBRequest::visitAdditionalChildren): * inspector/agents/InspectorIndexedDBAgent.cpp: 2019-02-08 Zalan Bujtas [LFC] The used containing block width value is optional https://bugs.webkit.org/show_bug.cgi?id=194428 Reviewed by Antti Koivisto. The preferred width codepath cannot provide a valid used containing block width value. "The percentage is calculated with respect to the width of the generated box's containing block. If the containing block's width depends on this element's width, then the resulting layout is undefined in CSS 2.2." Let's use 0 as used value for now. * layout/FormattingContextGeometry.cpp: (WebCore::Layout::FormattingContext::Geometry::shrinkToFitWidth): (WebCore::Layout::FormattingContext::Geometry::outOfFlowNonReplacedHorizontalGeometry): (WebCore::Layout::FormattingContext::Geometry::outOfFlowReplacedHorizontalGeometry): (WebCore::Layout::FormattingContext::Geometry::floatingNonReplacedWidthAndMargin): (WebCore::Layout::FormattingContext::Geometry::floatingReplacedWidthAndMargin): (WebCore::Layout::FormattingContext::Geometry::inlineReplacedWidthAndMargin): (WebCore::Layout::FormattingContext::Geometry::computedPadding): (WebCore::Layout::FormattingContext::Geometry::computedHorizontalMargin): * layout/LayoutUnits.h: (WebCore::Layout::UsedHorizontalValues::UsedHorizontalValues): * layout/blockformatting/BlockFormattingContextGeometry.cpp: (WebCore::Layout::BlockFormattingContext::Geometry::inFlowNonReplacedWidthAndMargin): * layout/inlineformatting/InlineFormattingContextGeometry.cpp: (WebCore::Layout::InlineFormattingContext::Geometry::inlineBlockWidthAndMargin): * page/FrameViewLayoutContext.cpp: 2019-02-08 Zalan Bujtas [LFC] Horizontal geometry compute functions should take the containing block's width as a used value https://bugs.webkit.org/show_bug.cgi?id=194424 Reviewed by Antti Koivisto. This is in preparation for passing optional containing block width for the preferred with codepath. * layout/FormattingContext.cpp: (WebCore::Layout::FormattingContext::computeOutOfFlowHorizontalGeometry const): (WebCore::Layout::FormattingContext::computeBorderAndPadding const): * layout/FormattingContext.h: * layout/FormattingContextGeometry.cpp: (WebCore::Layout::FormattingContext::Geometry::shrinkToFitWidth): (WebCore::Layout::FormattingContext::Geometry::outOfFlowNonReplacedHorizontalGeometry): (WebCore::Layout::FormattingContext::Geometry::outOfFlowReplacedHorizontalGeometry): (WebCore::Layout::FormattingContext::Geometry::floatingNonReplacedWidthAndMargin): (WebCore::Layout::FormattingContext::Geometry::floatingReplacedWidthAndMargin): (WebCore::Layout::FormattingContext::Geometry::inlineReplacedWidthAndMargin): (WebCore::Layout::FormattingContext::Geometry::computedBorder): (WebCore::Layout::FormattingContext::Geometry::computedPadding): (WebCore::Layout::FormattingContext::Geometry::computedHorizontalMargin): * layout/LayoutUnits.h: (WebCore::Layout::UsedHorizontalValues::UsedHorizontalValues): * layout/blockformatting/BlockFormattingContext.cpp: (WebCore::Layout::BlockFormattingContext::computeWidthAndMargin const): * layout/blockformatting/BlockFormattingContextGeometry.cpp: (WebCore::Layout::BlockFormattingContext::Geometry::inFlowNonReplacedWidthAndMargin): * layout/inlineformatting/InlineFormattingContext.cpp: (WebCore::Layout::InlineFormattingContext::computeMarginBorderAndPadding const): (WebCore::Layout::InlineFormattingContext::computeWidthAndMargin const): * layout/inlineformatting/InlineFormattingContext.h: * layout/inlineformatting/InlineFormattingContextGeometry.cpp: (WebCore::Layout::InlineFormattingContext::Geometry::inlineBlockWidthAndMargin): 2019-02-08 Benjamin Poulain clampTo(): do not convert the input to double when dealing with integers https://bugs.webkit.org/show_bug.cgi?id=194263 Reviewed by Darin Adler. Make the calls to clampTo() unambiguous. * page/FrameView.cpp: (WebCore::FrameView::computeUpdatedLayoutViewportRect): * rendering/style/RenderStyle.h: (WebCore::RenderStyle::setOpacity): (WebCore::RenderStyle::setShapeImageThreshold): 2019-02-08 Eric Liang When performing AXPress, check to see if the menu list is disabled. https://bugs.webkit.org/show_bug.cgi?id=193878 Reviewed by Chris Fleizach. Test: accessibility/mac/press-not-work-for-disabled-menu-list.html * accessibility/AXObjectCache.h: * accessibility/AccessibilityMenuList.cpp: (WebCore::AccessibilityMenuList::press): * accessibility/mac/AXObjectCacheMac.mm: (WebCore::AXObjectCache::postPlatformNotification): 2019-02-07 Devin Rousso PseudoElement created for any ::before/::after selector regardless of whether a content property exists https://bugs.webkit.org/show_bug.cgi?id=194423 Reviewed by Antti Koivisto. Test: inspector/css/pseudo-creation.html * style/StyleTreeResolver.cpp: (WebCore::Style::TreeResolver::resolvePseudoStyle): We should only be creating `PseudoElement`s if we actually have a `content` proprety in the `PseudoElement`'s style. Otherwise, we end up creating `PseudoElement`s for every CSS rule that has a `::before`/`::after`, only to immediately destroy them as there is nothing to show. 2019-02-07 Chris Dumez Mark more heap-allocated classes as fast allocated https://bugs.webkit.org/show_bug.cgi?id=194422 Reviewed by Ryosuke Niwa. * Modules/applepay/PaymentCoordinator.h: * Modules/beacon/NavigatorBeacon.h: * Modules/cache/DOMWindowCaches.h: * Modules/cache/WorkerGlobalScopeCaches.h: * Modules/credentialmanagement/NavigatorCredentials.h: * Modules/encryptedmedia/legacy/LegacyCDMPrivateClearKey.h: * Modules/gamepad/NavigatorGamepad.h: * Modules/indexeddb/IDBGetAllResult.h: * Modules/indexeddb/IDBGetResult.h: * Modules/indexeddb/IDBKeyData.h: * Modules/indexeddb/IDBValue.h: * Modules/indexeddb/WorkerGlobalScopeIndexedDatabase.h: * Modules/indexeddb/server/IndexValueEntry.h: * Modules/indexeddb/server/IndexValueStore.h: * Modules/indexeddb/server/MemoryBackingStoreTransaction.h: * Modules/indexeddb/server/MemoryCursor.h: * Modules/indexeddb/server/MemoryIDBBackingStore.h: * Modules/indexeddb/server/SQLiteIDBBackingStore.h: * Modules/indexeddb/server/SQLiteIDBCursor.h: * Modules/indexeddb/server/SQLiteIDBTransaction.h: * Modules/indexeddb/server/UniqueIDBDatabase.h: * Modules/indexeddb/shared/IDBDatabaseInfo.h: * Modules/indexeddb/shared/IDBResourceIdentifier.h: * Modules/indexeddb/shared/IDBTransactionInfo.h: * Modules/mediacapabilities/NavigatorMediaCapabilities.h: * Modules/mediasession/WebMediaSessionManager.cpp: * Modules/mediastream/NavigatorMediaDevices.h: * Modules/mediastream/libwebrtc/LibWebRTCDataChannelHandler.h: * Modules/mediastream/libwebrtc/LibWebRTCRtpReceiverBackend.h: * Modules/mediastream/libwebrtc/LibWebRTCRtpSenderBackend.h: * Modules/mediastream/libwebrtc/LibWebRTCRtpTransceiverBackend.h: * Modules/navigatorcontentutils/NavigatorContentUtils.h: * Modules/quota/DOMWindowQuota.h: * Modules/quota/NavigatorStorageQuota.h: * Modules/quota/WorkerNavigatorStorageQuota.h: * Modules/speech/DOMWindowSpeechSynthesis.h: * Modules/webaudio/BiquadProcessor.h: * Modules/webaudio/DelayProcessor.h: * Modules/webauthn/fido/FidoHidPacket.h: * Modules/webdriver/NavigatorWebDriver.h: * Modules/webgpu/DOMWindowWebGPU.h: * Modules/websockets/WebSocketChannel.h: * Modules/webvr/NavigatorWebVR.h: * accessibility/AXObjectCache.h: * bindings/js/DOMGCOutputConstraint.h: * bindings/js/DOMPromiseProxy.h: * bridge/c/c_runtime.h: * contentextensions/CombinedURLFilters.cpp: * crypto/CryptoAlgorithmParameters.h: * css/CSSComputedStyleDeclaration.h: * css/CSSRegisteredCustomProperty.h: * css/DOMCSSPaintWorklet.h: * css/DOMCSSRegisterCustomProperty.h: * css/StyleRule.h: * dom/ConstantPropertyMap.h: * dom/CustomElementReactionQueue.h: * dom/Document.h: * dom/GenericEventQueue.h: * dom/RejectedPromiseTracker.h: * dom/UserGestureIndicator.h: * editing/ReplaceSelectionCommand.cpp: * editing/SelectionRectGatherer.h: * editing/TextIterator.h: * editing/cocoa/HTMLConverter.mm: * fileapi/AsyncFileStream.cpp: * fileapi/AsyncFileStream.h: * html/forms/FileIconLoader.h: * html/parser/HTMLTreeBuilder.h: * html/track/WebVTTParser.h: * inspector/DOMPatchSupport.cpp: * loader/FrameLoaderClient.h: * loader/WorkerThreadableLoader.cpp: * page/IntersectionObserver.h: * page/PerformanceMonitor.h: * page/PerformanceUserTiming.h: * page/PrintContext.h: * page/ValidationMessageClient.h: * platform/ColorChooser.h: * platform/ControlStates.h: * platform/DataListSuggestionPicker.h: * platform/FileStream.h: * platform/KeyedCoding.h: * platform/LowPowerModeNotifier.h: * platform/PlatformSpeechSynthesizer.h: * platform/WebGLStateTracker.h: * platform/audio/AudioArray.h: * platform/audio/AudioDestination.h: * platform/audio/DownSampler.h: * platform/audio/DynamicsCompressor.h: * platform/audio/FFTFrame.h: * platform/audio/HRTFDatabase.h: * platform/audio/MultiChannelResampler.h: * platform/audio/Panner.h: * platform/audio/Reverb.h: * platform/audio/ReverbConvolver.h: * platform/audio/ReverbConvolverStage.h: * platform/audio/UpSampler.h: * platform/audio/mac/AudioSessionMac.cpp: * platform/audio/mac/CAAudioStreamDescription.h: * platform/audio/mac/CARingBuffer.h: * platform/cocoa/ScrollSnapAnimatorState.h: * platform/gamepad/PlatformGamepad.h: * platform/graphics/GraphicsLayer.cpp: * platform/graphics/GraphicsLayerFactory.h: * platform/graphics/PlatformTimeRanges.h: * platform/graphics/TextTrackRepresentation.h: * platform/graphics/avfoundation/objc/CDMSessionAVContentKeySession.h: * platform/graphics/avfoundation/objc/CDMSessionAVStreamSession.h: * platform/graphics/avfoundation/objc/MediaPlaybackTargetPickerMac.h: * platform/graphics/displaylists/DisplayListRecorder.h: * platform/network/cocoa/WebCoreNSURLSession.mm: * platform/sql/SQLiteDatabase.h: * platform/text/TextCodecICU.h: * rendering/GridBaselineAlignment.h: * rendering/GridTrackSizingAlgorithm.h: * rendering/RenderObject.h: * rendering/style/GridArea.h: * workers/service/context/SWContextManager.h: 2019-02-07 Justin Fan [Web GPU] GPUDevice::createTexture implementation prototype https://bugs.webkit.org/show_bug.cgi?id=194409 Reviewed by Myles C. Maxfield. Test: textures-textureviews.html updated to test new functionality. Implement GPUDevice::createTexture(): * Modules/webgpu/WebGPUDevice.cpp: (WebCore::WebGPUDevice::createTexture const): * Modules/webgpu/WebGPUDevice.h: * Modules/webgpu/WebGPUDevice.idl: * Modules/webgpu/WebGPUTexture.cpp: (WebCore::WebGPUTexture::create): Modified to return non-nullable to match direction of API. (WebCore::WebGPUTexture::WebGPUTexture): * Modules/webgpu/WebGPUTexture.h: Metal backend MTLTextureDescriptor and MTLTexture creation: * platform/graphics/gpu/GPUDevice.cpp: (WebCore::GPUDevice::tryCreateTexture const): * platform/graphics/gpu/GPUDevice.h: * platform/graphics/gpu/GPUTexture.h: * platform/graphics/gpu/cocoa/GPUTextureMetal.mm: (WebCore::mtlTextureTypeForGPUTextureDescriptor): (WebCore::mtlTextureUsageForGPUTextureUsageFlags): (WebCore::storageModeForPixelFormatAndSampleCount): (WebCore::tryCreateMtlTextureDescriptor): (WebCore::GPUTexture::tryCreate): (WebCore::GPUTexture::createDefaultTextureView): Add ObjC try/catch guards. Add GPUUtils.h/cpp for shared utility functions: * SourcesCocoa.txt: * WebCore.xcodeproj/project.pbxproj: * platform/graphics/gpu/GPUUtils.h: Added. Moved platformTextureFormatForGPUTextureFormat here. * platform/graphics/gpu/cocoa/GPUSwapChainMetal.mm: (WebCore::GPUSwapChain::setFormat): (WebCore::platformTextureFormatForGPUTextureFormat): Moved to GPUUtils. * platform/graphics/gpu/cocoa/GPUUtilsMetal.mm: Added. (WebCore::platformTextureFormatForGPUTextureFormat): Moved here to be referenced by multiple files. 2019-02-07 Sihui Liu REGRESSION(r239887): Crash under IDBConnectionToClient::didDeleteDatabase(WebCore::IDBResultData const&) https://bugs.webkit.org/show_bug.cgi?id=194402 Reviewed by Geoffrey Garen. r239887 removed a reference cycle of IDBConnectionToClient so that IDBConnectionToClient would no longer be around forever. Therefore, ServerOpenRequest should keep a reference to IDBConnectionToClient to make sure it is valid during access. * Modules/indexeddb/server/ServerOpenDBRequest.cpp: (WebCore::IDBServer::ServerOpenDBRequest::maybeNotifyRequestBlocked): (WebCore::IDBServer::ServerOpenDBRequest::notifyDidDeleteDatabase): * Modules/indexeddb/server/ServerOpenDBRequest.h: 2019-02-07 Timothy Hatcher Overflow element scrollbar is light for dark mode content. https://bugs.webkit.org/show_bug.cgi?id=194407 rdar://problem/45991585 Reviewed by Beth Dakin. Tested by css-dark-mode/supported-color-schemes-scrollbar.html. * page/ChromeClient.h: (WebCore::FrameView::preferredScrollbarOverlayStyle): Return WTF::nullopt by default to avoid short-circuiting auto detection in recalculateScrollbarOverlayStyle() for clients, like WK1, that do not implement preferredScrollbarOverlayStyle(). * page/FrameView.cpp: (WebCore::FrameView::recalculateScrollbarOverlayStyle): Use WTF::nullopt in the false case to auto detect overlay style when page() is null. * rendering/RenderLayer.cpp: (WebCore::RenderLayer::useDarkAppearance const): Added. * rendering/RenderLayer.h: * testing/Internals.cpp: (WebCore::Internals::scrollbarOverlayStyle const): Added Node argument. (WebCore::Internals::scrollbarUsingDarkAppearance const): Added. * testing/Internals.h: * testing/Internals.idl: 2019-02-07 Eric Carlson [MSE] Convert debug-only logging to runtime logging https://bugs.webkit.org/show_bug.cgi?id=194348 Reviewed by Jer Noble. No new tests, this just changes existing logging. * Modules/mediasource/MediaSource.cpp: (WebCore::convertEnumerationToString): (WebCore::MediaSource::MediaSource): (WebCore::MediaSource::~MediaSource): (WebCore::MediaSource::setPrivateAndOpen): (WebCore::MediaSource::addedToRegistry): (WebCore::MediaSource::removedFromRegistry): (WebCore::MediaSource::durationChanged): (WebCore::MediaSource::seekToTime): (WebCore::MediaSource::completeSeek): (WebCore::MediaSource::setLiveSeekableRange): (WebCore::MediaSource::clearLiveSeekableRange): (WebCore::MediaSource::setDuration): (WebCore::MediaSource::setDurationInternal): (WebCore::MediaSource::setReadyState): (WebCore::MediaSource::endOfStream): (WebCore::MediaSource::streamEndedWithError): (WebCore::MediaSource::addSourceBuffer): (WebCore::MediaSource::removeSourceBuffer): (WebCore::MediaSource::isTypeSupported): (WebCore::MediaSource::detachFromElement): (WebCore::MediaSource::attachToElement): (WebCore::MediaSource::openIfInEndedState): (WebCore::MediaSource::suspend): (WebCore::MediaSource::resume): (WebCore::MediaSource::stop): (WebCore::MediaSource::onReadyStateChange): (WebCore::MediaSource::scheduleEvent): (WebCore::MediaSource::logChannel const): (WebCore::MediaSourceInternal::toString): Deleted. * Modules/mediasource/MediaSource.h: (WTF::LogArgument::toString): (WTF::LogArgument::toString): * Modules/mediasource/SourceBuffer.cpp: (WebCore::SourceBuffer::SourceBuffer): (WebCore::SourceBuffer::~SourceBuffer): (WebCore::SourceBuffer::remove): (WebCore::SourceBuffer::seekToTime): (WebCore::SourceBuffer::appendBufferInternal): (WebCore::SourceBuffer::sourceBufferPrivateAppendComplete): (WebCore::SourceBuffer::sourceBufferPrivateDidReceiveRenderingError): (WebCore::removeSamplesFromTrackBuffer): (WebCore::SourceBuffer::removeCodedFrames): (WebCore::SourceBuffer::evictCodedFrames): (WebCore::SourceBuffer::sourceBufferPrivateDidReceiveInitializationSegment): (WebCore::SourceBuffer::sourceBufferPrivateDidReceiveSample): (WebCore::SourceBuffer::sourceBufferPrivateReenqueSamples): (WebCore::SourceBuffer::sourceBufferPrivateDidBecomeReadyForMoreSamples): (WebCore::SourceBuffer::provideMediaData): (WebCore::SourceBuffer::trySignalAllSamplesInTrackEnqueued): (WebCore::SourceBuffer::monitorBufferingRate): (WebCore::SourceBuffer::logChannel const): * Modules/mediasource/SourceBuffer.h: * dom/Document.cpp: (WebCore::messageSourceForWTFLogChannel): (WebCore::Document::didLogMessage): * html/HTMLMediaElement.cpp: (WebCore::convertEnumerationToString): (WebCore::HTMLMediaElement::scheduleCheckPlaybackTargetCompatability): (WebCore::HTMLMediaElement::selectMediaResource): (WebCore::HTMLMediaElement::loadResource): (WebCore::HTMLMediaElement::updateActiveTextTrackCues): (WebCore::HTMLMediaElement::scheduleConfigureTextTracks): (WebCore::HTMLMediaElement::scheduleMediaEngineWasUpdated): (WebCore::HTMLMediaElement::scheduleUpdatePlayState): (WebCore::HTMLMediaElement::scheduleUpdateMediaState): * platform/ContentType.cpp: (WebCore::ContentType::toJSONString const): * platform/ContentType.h: (WTF::LogArgument::toString): * platform/MediaSample.h: (WebCore::MediaSample::toJSONString const): (WTF::LogArgument::toString): * platform/graphics/FloatSize.cpp: (WebCore::FloatSize::toJSONObject const): (WebCore::FloatSize::toJSONString const): * platform/graphics/FloatSize.h: (WTF::LogArgument::toString): * platform/graphics/MediaSourcePrivate.h: (WebCore::MediaSourcePrivate::mediaSourceLogIdentifier): (WTF::LogArgument::toString): (WTF::LogArgument::toString): * platform/graphics/SourceBufferPrivate.h: (WebCore::SourceBufferPrivate::sourceBufferLogger const): (WebCore::SourceBufferPrivate::sourceBufferLogIdentifier): * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm: (WebCore::MediaPlayerPrivateAVFoundationObjC::setMuted): (WebCore::MediaPlayerPrivateAVFoundationObjC::setClosedCaptionsVisible): (WebCore::MediaPlayerPrivateAVFoundationObjC::isCurrentPlaybackTargetWireless const): (WebCore::MediaPlayerPrivateAVFoundationObjC::wirelessVideoPlaybackDisabled const): (WebCore::MediaPlayerPrivateAVFoundationObjC::setWirelessVideoPlaybackDisabled): (WebCore::MediaPlayerPrivateAVFoundationObjC::setShouldPlayToPlaybackTarget): (WebCore::MediaPlayerPrivateAVFoundationObjC::setShouldBufferData): * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.h: (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::mediaPlayerLogIdentifier): (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::mediaPlayerLogger): (WTF::LogArgument::toString): * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm: (WebCore::convertEnumerationToString): (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::MediaPlayerPrivateMediaSourceAVFObjC): (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::~MediaPlayerPrivateMediaSourceAVFObjC): (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::load): (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::play): (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::playInternal): (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::pause): (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::pauseInternal): (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::setVolume): (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::setMuted): (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::setVisible): (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::seekWithTolerance): (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::seekInternal): (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::waitForSeekCompleted): (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::seekCompleted): (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::setPreservesPitch): (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::setHasAvailableVideoFrame): (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::updateAllRenderersHaveAvailableSamples): (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::durationChanged): (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::setNaturalSize): (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::setCDMSession): (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::outputObscuredDueToInsufficientExternalProtectionChanged): (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::cdmInstanceAttached): (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::cdmInstanceDetached): (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::attemptToDecryptWithInstance): (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::waitingForKeyChanged): (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::initializationDataEncountered): (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::setReadyState): (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::setNetworkState): (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::setShouldPlayToPlaybackTarget): (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::isCurrentPlaybackTargetWireless const): (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::logChannel const): * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm: (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::enqueueVideoSample): * platform/graphics/avfoundation/objc/MediaSampleAVFObjC.h: * platform/graphics/avfoundation/objc/MediaSampleAVFObjC.mm: (WebCore::MediaSampleAVFObjC::toJSONString const): * platform/graphics/avfoundation/objc/MediaSourcePrivateAVFObjC.h: * platform/graphics/avfoundation/objc/MediaSourcePrivateAVFObjC.mm: (WebCore::MediaSourcePrivateAVFObjC::MediaSourcePrivateAVFObjC): (WebCore::MediaSourcePrivateAVFObjC::~MediaSourcePrivateAVFObjC): (WebCore::MediaSourcePrivateAVFObjC::addSourceBuffer): (WebCore::MediaSourcePrivateAVFObjC::logChannel const): * platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.h: * platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm: (WebCore::bufferWasConsumedCallback): (WebCore::SourceBufferPrivateAVFObjC::SourceBufferPrivateAVFObjC): (WebCore::SourceBufferPrivateAVFObjC::~SourceBufferPrivateAVFObjC): (WebCore::SourceBufferPrivateAVFObjC::didParseStreamDataAsAsset): (WebCore::SourceBufferPrivateAVFObjC::didFailToParseStreamDataWithError): (WebCore::SourceBufferPrivateAVFObjC::processCodedFrame): (WebCore::SourceBufferPrivateAVFObjC::willProvideContentKeyRequestInitializationDataForTrackID): (WebCore::SourceBufferPrivateAVFObjC::didProvideContentKeyRequestInitializationDataForTrackID): (WebCore::SourceBufferPrivateAVFObjC::append): (WebCore::SourceBufferPrivateAVFObjC::abort): (WebCore::SourceBufferPrivateAVFObjC::resetParserState): (WebCore::SourceBufferPrivateAVFObjC::removedFromMediaSource): (WebCore::SourceBufferPrivateAVFObjC::setReadyState): (WebCore::SourceBufferPrivateAVFObjC::trackDidChangeEnabled): (WebCore::SourceBufferPrivateAVFObjC::setCDMSession): (WebCore::SourceBufferPrivateAVFObjC::setCDMInstance): (WebCore::SourceBufferPrivateAVFObjC::layerDidReceiveError): (WebCore::SourceBufferPrivateAVFObjC::outputObscuredDueToInsufficientExternalProtectionChanged): (WebCore::SourceBufferPrivateAVFObjC::flush): (WebCore::SourceBufferPrivateAVFObjC::flushVideo): (WebCore::SourceBufferPrivateAVFObjC::enqueueSample): (WebCore::SourceBufferPrivateAVFObjC::bufferWasConsumed): (WebCore::SourceBufferPrivateAVFObjC::setActive): (WebCore::SourceBufferPrivateAVFObjC::willSeek): (WebCore::SourceBufferPrivateAVFObjC::didBecomeReadyForMoreSamples): (WebCore::SourceBufferPrivateAVFObjC::canSwitchToType): (WebCore::SourceBufferPrivateAVFObjC::setDecompressionSession): (WebCore::SourceBufferPrivateAVFObjC::logChannel const): 2019-02-07 Youenn Fablet Simplify applyConstraints callbacks https://bugs.webkit.org/show_bug.cgi?id=194297 Reviewed by Eric Carlson. Make use of one callback for both success and failure cases. No changed of behavior. * Modules/mediastream/MediaStreamTrack.cpp: (WebCore::MediaStreamTrack::applyConstraints): * platform/mediastream/MediaStreamTrackPrivate.cpp: (WebCore::MediaStreamTrackPrivate::applyConstraints): * platform/mediastream/MediaStreamTrackPrivate.h: * platform/mediastream/RealtimeMediaSource.cpp: (WebCore::RealtimeMediaSource::applyConstraints): * platform/mediastream/RealtimeMediaSource.h: * platform/mediastream/mac/AVVideoCaptureSource.mm: (WebCore::AVVideoCaptureSource::create): * platform/mediastream/mac/CoreAudioCaptureSource.cpp: (WebCore::CoreAudioCaptureSource::create): * platform/mediastream/gstreamer/MockGStreamerAudioCaptureSource.cpp: (WebCore::MockGStreamerAudioCaptureSource::applyConstraints): * platform/mediastream/gstreamer/MockGStreamerAudioCaptureSource.h: * platform/mediastream/gstreamer/MockGStreamerVideoCaptureSource.cpp: (WebCore::MockGStreamerVideoCaptureSource::applyConstraints): * platform/mediastream/gstreamer/MockGStreamerVideoCaptureSource.h: 2019-02-07 Youenn Fablet Unable to sign in leetcode. https://bugs.webkit.org/show_bug.cgi?id=194366 rdar://problem/47259025. Reviewed by Chris Dumez. In case a signal is passed as part of a FetchRequestInit, the IDL binding code is throwing an exception in case signal is not an AbortSignal object. This breaks an AbortSignal shim used in some web sites. Relaxed the IDL binding rule by marking signal as any and doing the conversion in FetchRequest. Test: http/wpt/fetch/request-abort.html Also covered by manually signing in to leetcode. * Modules/fetch/FetchRequest.cpp: (WebCore::FetchRequest::initializeWith): * Modules/fetch/FetchRequestInit.h: (WebCore::FetchRequestInit::hasMembers const): * Modules/fetch/FetchRequestInit.idl: 2019-02-07 Youenn Fablet Make to clear sources from UserMediaCaptureManagerProxy and UserMediaCaptureManager when no longer needed https://bugs.webkit.org/show_bug.cgi?id=194312 Reviewed by Eric Carlson. Add a way for sources to know when they are ended, i.e. that they will never be started again. No observable change of behavior. * platform/mediastream/RealtimeMediaSource.cpp: (WebCore::RealtimeMediaSource::requestStop): * platform/mediastream/RealtimeMediaSource.h: 2019-02-07 Jer Noble HTMLMediaElement registers wrong ScriptExecutionContext with its ActiveDOMObject parent class https://bugs.webkit.org/show_bug.cgi?id=194360 HTMLMediaElement registers the Document used to create it with ActiveDOMObject, when it should really use that Document's contextDocument(). Rather than just fix this in HTMLMediaElement, make sure that the correct document is used everywhere by adding a new ActiveDOMObject constructor taking a Document&, and making an explicitly deleted Document* constructor to catch any new cases. Reviewed by Geoffrey Garen. * Modules/applepay/ApplePaySession.cpp: (WebCore::ApplePaySession::ApplePaySession): * Modules/mediarecorder/MediaRecorder.cpp: (WebCore::MediaRecorder::MediaRecorder): * Modules/mediastream/MediaDevices.cpp: (WebCore::MediaDevices::MediaDevices): * Modules/mediastream/UserMediaRequest.cpp: (WebCore::UserMediaRequest::UserMediaRequest): * Modules/notifications/Notification.cpp: (WebCore::Notification::Notification): * Modules/paymentrequest/PaymentRequest.cpp: (WebCore::PaymentRequest::PaymentRequest): * Modules/webaudio/AudioContext.cpp: (WebCore::AudioContext::AudioContext): * animation/WebAnimation.cpp: (WebCore::WebAnimation::WebAnimation): * css/FontFaceSet.cpp: (WebCore::FontFaceSet::FontFaceSet): * dom/ActiveDOMObject.cpp: (WebCore::ActiveDOMObject::ActiveDOMObject): * dom/ActiveDOMObject.h: * dom/Document.h: (WebCore::ActiveDOMObject::ActiveDOMObject): * html/HTMLMarqueeElement.cpp: (WebCore::HTMLMarqueeElement::HTMLMarqueeElement): * html/HTMLMediaElement.cpp: (WebCore::HTMLMediaElement::HTMLMediaElement): * html/HTMLSourceElement.cpp: (WebCore::HTMLSourceElement::HTMLSourceElement): * page/IntersectionObserver.cpp: (WebCore::IntersectionObserver::IntersectionObserver): 2019-02-07 Zalan Bujtas [LFC][Out-of-flow] Use the containing block's padding width when computing min/max width. https://bugs.webkit.org/show_bug.cgi?id=194391 Reviewed by Antti Koivisto. The spec is not clear about this but that's what matches the current behaviour. Test: fast/block/block-only/absolute-positioned-min-max-percentage-with-parent-padding.html * layout/FormattingContext.cpp: (WebCore::Layout::FormattingContext::computeOutOfFlowHorizontalGeometry const): 2019-02-07 Zalan Bujtas [LFC] Use dedicated data structures for optional used values (input to geometry functions) https://bugs.webkit.org/show_bug.cgi?id=194376 Reviewed by Antti Koivisto. This is in preparation for being able to pass in the containing block's width as an optional used value. During layout we always have a valid width for the containing block, however it's not the case while computing the preferred width. * layout/FormattingContext.cpp: (WebCore::Layout::FormattingContext::computeOutOfFlowHorizontalGeometry const): (WebCore::Layout::FormattingContext::computeOutOfFlowVerticalGeometry const): * layout/FormattingContext.h: (WebCore::Layout::FormattingContext::Geometry::outOfFlowVerticalGeometry): Deleted. (WebCore::Layout::FormattingContext::Geometry::outOfFlowHorizontalGeometry): Deleted. (WebCore::Layout::FormattingContext::Geometry::floatingHeightAndMargin): Deleted. (WebCore::Layout::FormattingContext::Geometry::floatingWidthAndMargin): Deleted. (WebCore::Layout::FormattingContext::Geometry::inlineReplacedHeightAndMargin): Deleted. (WebCore::Layout::FormattingContext::Geometry::inlineReplacedWidthAndMargin): Deleted. (): Deleted. (WebCore::Layout::FormattingContext::Geometry::complicatedCases): Deleted. (WebCore::Layout::FormattingContext::Geometry::outOfFlowReplacedVerticalGeometry): Deleted. (WebCore::Layout::FormattingContext::Geometry::outOfFlowReplacedHorizontalGeometry): Deleted. (WebCore::Layout::FormattingContext::Geometry::outOfFlowNonReplacedVerticalGeometry): Deleted. (WebCore::Layout::FormattingContext::Geometry::outOfFlowNonReplacedHorizontalGeometry): Deleted. (WebCore::Layout::FormattingContext::Geometry::floatingReplacedHeightAndMargin): Deleted. (WebCore::Layout::FormattingContext::Geometry::floatingReplacedWidthAndMargin): Deleted. (WebCore::Layout::FormattingContext::Geometry::floatingNonReplacedWidthAndMargin): Deleted. * layout/FormattingContextGeometry.cpp: (WebCore::Layout::FormattingContext::Geometry::outOfFlowNonReplacedVerticalGeometry): (WebCore::Layout::FormattingContext::Geometry::outOfFlowNonReplacedHorizontalGeometry): (WebCore::Layout::FormattingContext::Geometry::outOfFlowReplacedVerticalGeometry): (WebCore::Layout::FormattingContext::Geometry::outOfFlowReplacedHorizontalGeometry): (WebCore::Layout::FormattingContext::Geometry::complicatedCases): (WebCore::Layout::FormattingContext::Geometry::floatingNonReplacedWidthAndMargin): (WebCore::Layout::FormattingContext::Geometry::floatingReplacedHeightAndMargin): (WebCore::Layout::FormattingContext::Geometry::floatingReplacedWidthAndMargin): (WebCore::Layout::FormattingContext::Geometry::outOfFlowVerticalGeometry): (WebCore::Layout::FormattingContext::Geometry::outOfFlowHorizontalGeometry): (WebCore::Layout::FormattingContext::Geometry::floatingHeightAndMargin): (WebCore::Layout::FormattingContext::Geometry::floatingWidthAndMargin): (WebCore::Layout::FormattingContext::Geometry::inlineReplacedHeightAndMargin): (WebCore::Layout::FormattingContext::Geometry::inlineReplacedWidthAndMargin): * layout/LayoutUnits.h: * layout/blockformatting/BlockFormattingContext.cpp: (WebCore::Layout::BlockFormattingContext::computeWidthAndMargin const): (WebCore::Layout::BlockFormattingContext::computeHeightAndMargin const): * layout/blockformatting/BlockFormattingContext.h: (WebCore::Layout::BlockFormattingContext::Geometry::inFlowHeightAndMargin): Deleted. (WebCore::Layout::BlockFormattingContext::Geometry::inFlowWidthAndMargin): Deleted. (WebCore::Layout::BlockFormattingContext::Geometry::inFlowNonReplacedHeightAndMargin): Deleted. (WebCore::Layout::BlockFormattingContext::Geometry::inFlowNonReplacedWidthAndMargin): Deleted. (WebCore::Layout::BlockFormattingContext::Geometry::inFlowReplacedWidthAndMargin): Deleted. * layout/blockformatting/BlockFormattingContextGeometry.cpp: (WebCore::Layout::BlockFormattingContext::Geometry::inFlowNonReplacedHeightAndMargin): (WebCore::Layout::BlockFormattingContext::Geometry::inFlowNonReplacedWidthAndMargin): (WebCore::Layout::BlockFormattingContext::Geometry::inFlowReplacedWidthAndMargin): (WebCore::Layout::BlockFormattingContext::Geometry::inFlowHeightAndMargin): (WebCore::Layout::BlockFormattingContext::Geometry::inFlowWidthAndMargin): * layout/inlineformatting/InlineFormattingContext.cpp: (WebCore::Layout::InlineFormattingContext::computeWidthAndMargin const): (WebCore::Layout::InlineFormattingContext::computeHeightAndMargin const): * layout/inlineformatting/InlineFormattingContextGeometry.cpp: (WebCore::Layout::InlineFormattingContext::Geometry::inlineBlockWidthAndMargin): (WebCore::Layout::InlineFormattingContext::Geometry::inlineBlockHeightAndMargin): * page/FrameViewLayoutContext.cpp: (WebCore::layoutUsingFormattingContext): 2019-02-07 Antti Koivisto Infinite recursion via CachedResource::~CachedResource https://bugs.webkit.org/show_bug.cgi?id=194378 Reviewed by Daniel Bates. I don't know the exact steps to trigger this but the mechanism seems clear. 1) An existing resource is removed from or replaced in CachedResourceLoader::m_documentResources map. 2) This decrements the handle count of resource and causes it be deleted. 3) CachedResource::~CachedResource calls m_owningCachedResourceLoader->removeCachedResource(*this). This only happens with resources that are "owned" by CachedResourceLoader which is a rare special case (used by image document and if memory cache is disabled). 4) CachedResourceLoader::removeCachedResource looks up the resource from the map which causes a temporary CachedResourceHandle to be created. This increments the handle count of the resource from 0 back to 1. 5) When the temporary dies, CachedResource::~CachedResource is called again and we cycle back to 3). The fix here is simply to remove CachedResourceLoader::removeCachedResource call from ~CachedResource. It is a leftover from when the map contained raw pointers instead of owning CachedResourceHandles. Since m_documentResources map has a handle to the resource, the only way we are in the destructor is that the resource has been removed from the map already (or is in process of being removed like in this crash). Any call that does anything other than bail out is going to crash. CachedResource::n_owningCachedResourceLoader member and CachedResourceLoader::removeCachedResource function only exist to support this erranous call so they are removed as well. * loader/ImageLoader.cpp: (WebCore::ImageLoader::updateFromElement): * loader/cache/CachedResource.cpp: (WebCore::CachedResource::~CachedResource): This is the substantive change. The rest just removes now-dead code. * loader/cache/CachedResource.h: (WebCore::CachedResource::setOwningCachedResourceLoader): Deleted. * loader/cache/CachedResourceLoader.cpp: (WebCore::CachedResourceLoader::~CachedResourceLoader): (WebCore::CachedResourceLoader::requestUserCSSStyleSheet): (WebCore::CachedResourceLoader::requestResource): (WebCore::CachedResourceLoader::loadResource): (WebCore::CachedResourceLoader::garbageCollectDocumentResources): (WebCore::CachedResourceLoader::removeCachedResource): Deleted. * loader/cache/CachedResourceLoader.h: 2019-02-07 Miguel Gomez [WPE] Implement GStreamer based holepunch https://bugs.webkit.org/show_bug.cgi?id=193715 Reviewed by Xabier Rodriguez-Calvar. Implement GStreamer based holepunch functionality. Instead of getting the video frames from the video sink and drawing then, the player just draws a transparent rectangle on the position where the video should be. MediaPlayerPrivateGStreamerBase will instantiate a platform dependant video sink which will be in charge of displaying the video frames in some way (usually on a plane below the browser), and will push empty frames to the compositor indicating that the rectangle to draw should overwrite the existent content. TextureMapperPlatformLayerBuffer::HolePunchClient is used to tell the video sink where to position the video so it's set below the browser transparent hole. Added ManualTest wpe/video-player-holepunch.html to test the feature. * platform/graphics/MediaPlayer.cpp: (WebCore::MediaPlayer::shouldIgnoreIntrinsicSize): * platform/graphics/MediaPlayer.h: * platform/graphics/MediaPlayerPrivate.h: (WebCore::MediaPlayerPrivateInterface::shouldIgnoreIntrinsicSize): * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp: (WebCore::MediaPlayerPrivateGStreamerBase::naturalSize const): (WebCore::MediaPlayerPrivateGStreamerBase::swapBuffersIfNeeded): (WebCore::setRectangleToVideoSink): (WebCore::GStreamerHolePunchClient::GStreamerHolePunchClient): (WebCore::MediaPlayerPrivateGStreamerBase::createHolePunchVideoSink): (WebCore::MediaPlayerPrivateGStreamerBase::pushNextHolePunchBuffer): (WebCore::MediaPlayerPrivateGStreamerBase::createVideoSink): * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.h: * platform/graphics/texmap/TextureMapper.h: * platform/graphics/texmap/TextureMapperGL.cpp: (WebCore::TextureMapperGL::drawSolidColor): * platform/graphics/texmap/TextureMapperGL.h: * platform/graphics/texmap/TextureMapperLayer.cpp: (WebCore::TextureMapperLayer::paintSelf): * platform/graphics/texmap/TextureMapperPlatformLayerBuffer.cpp: (WebCore::TextureMapperPlatformLayerBuffer::paintToTextureMapper): * platform/graphics/texmap/TextureMapperPlatformLayerBuffer.h: (WebCore::TextureMapperPlatformLayerBuffer::setHolePunchClient): * platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp: (WebCore::CoordinatedGraphicsLayer::setContentsToPlatformLayer): * rendering/RenderVideo.cpp: (WebCore::RenderVideo::videoBox const): 2019-02-06 Benjamin Poulain Unreviewed, rolling out r240759 and r240944. Some timer uses are done off the main thread, WebCore::Timer cannot be used Reverted changesets: " Responsiveness timers are too expensive for frequent events" https://bugs.webkit.org/show_bug.cgi?id=194003 https://trac.webkit.org/changeset/240759 "Use deferrable timer to restart the Responsiveness Timer on each wheel event" https://bugs.webkit.org/show_bug.cgi?id=194135 https://trac.webkit.org/changeset/240944 2019-02-06 Keith Rollin Update .xcfilelist files Unreviewed build fix. * DerivedSources-input.xcfilelist: * DerivedSources-output.xcfilelist: 2019-02-06 Devin Rousso Web Inspector: DOM: don't send the entire function string with each event listener https://bugs.webkit.org/show_bug.cgi?id=194293 Reviewed by Joseph Pecoraro. Test: inspector/dom/getEventListenersForNode.html * inspector/agents/InspectorDOMAgent.cpp: (WebCore::InspectorDOMAgent::buildObjectForEventListener): 2019-02-06 Andy Estes [Payment Request] It should be possible to require a phonetic name for shipping contacts https://bugs.webkit.org/show_bug.cgi?id=194311 Reviewed by Alex Christensen. It should be possible to require that a shipping contact has a phonetic name in Payment Request. To accomplish this, move requiredShippingContactFields from ApplePayPaymentRequest to ApplePayRequestBase so that it can be used as part of an Apple Pay payment method data. Since required shipping contact fields can now be specified both in requiredShippingContactFields and PaymentOptions, we merge the required fields from these two sources such that, e.g., email is required if it is specified in either place. So that clients can detect this new feature, the API version number is bumped from 5 to 6. Added test cases to ApplePayRequestShippingContact.https.html and ApplePayRequestShippingContactV3.https.html. * DerivedSources.make: * Modules/applepay/ApplePayPaymentRequest.h: * Modules/applepay/ApplePayPaymentRequest.idl: * Modules/applepay/ApplePayRequestBase.cpp: (WebCore::convertAndValidate): * Modules/applepay/ApplePayRequestBase.h: * Modules/applepay/ApplePayRequestBase.idl: * Modules/applepay/ApplePaySession.cpp: (WebCore::convertAndValidate): * Modules/applepay/PaymentCoordinatorClient.cpp: Added. (WebCore::PaymentCoordinatorClient::supportsVersion): * Modules/applepay/PaymentCoordinatorClient.h: * Modules/applepay/paymentrequest/ApplePayPaymentHandler.cpp: (WebCore::mergePaymentOptions): (WebCore::ApplePayPaymentHandler::show): * SourcesCocoa.txt: * WebCore.xcodeproj/project.pbxproj: * loader/EmptyClients.cpp: * testing/MockPaymentContactFields.h: Added. (WebCore::MockPaymentContactFields::MockPaymentContactFields): * testing/MockPaymentContactFields.idl: Added. * testing/MockPaymentCoordinator.cpp: (WebCore::MockPaymentCoordinator::showPaymentUI): (WebCore::MockPaymentCoordinator::supportsVersion): Deleted. * testing/MockPaymentCoordinator.h: * testing/MockPaymentCoordinator.idl: 2019-02-06 Yusuke Suzuki [JSC] PrivateName to PublicName hash table is wasteful https://bugs.webkit.org/show_bug.cgi?id=194277 Reviewed by Michael Saboff. Use WebCoreBuiltinNames instead of adding WebCore names to JSC CommonIdentifiers. * bindings/js/JSDOMWindowCustom.cpp: (WebCore::addCrossOriginPropertyNames): * bindings/js/JSLocationCustom.cpp: (WebCore::getOwnPropertySlotCommon): (WebCore::putCommon): * bindings/js/WebCoreBuiltinNames.h: 2019-02-06 Keith Rollin Really enable the automatic checking and regenerations of .xcfilelists during builds https://bugs.webkit.org/show_bug.cgi?id=194357 Reviewed by Chris Dumez. Bug 194124 was supposed to enable the automatic checking and regenerating of .xcfilelist files during the build. While related changes were included in that patch, the change to actually enable the operation somehow was omitted. This patch actually enables the operation. The check-xcfilelist.sh scripts now check WK_DISABLE_CHECK_XCFILELISTS, and if it's "1", opts-out the developer from the checking. No new tests since there should be no observable behavior difference. * Scripts/check-xcfilelists.sh: 2019-02-06 John Wilander Forward Ad Click Attribution data from HTMLAnchorElement::handleClick() to WebKit::NavigationActionData https://bugs.webkit.org/show_bug.cgi?id=194325 Reviewed by Chris Dumez. No new tests. This is just data forwarding. Once the data is stored, I will create test infrastructure to query it. * html/HTMLAnchorElement.cpp: (WebCore::HTMLAnchorElement::handleClick): * loader/AdClickAttribution.h: (WebCore::AdClickAttribution::encode const): (WebCore::AdClickAttribution::decode): (WebCore::AdClickAttribution::Conversion::encode const): (WebCore::AdClickAttribution::Conversion::decode): Infrastructure for IPC. * loader/FrameLoader.cpp: (WebCore::FrameLoader::urlSelected): (WebCore::FrameLoader::loadURLIntoChildFrame): (WebCore::FrameLoader::loadFrameRequest): (WebCore::FrameLoader::loadURL): These functions forward the optional WebCore::AdClickAttribution object FrameLoader::loadURL() creates the NavigationAction object and sets the WebCore::AdClickAttribution object on there. * loader/FrameLoader.h: (WebCore::FrameLoader::urlSelected): (WebCore::FrameLoader::loadURL): * loader/NavigationAction.h: (WebCore::NavigationAction::adClickAttribution): (WebCore::NavigationAction::setAdClickAttribution): 2019-02-06 Justin Fan [Web GPU] Implement supporting dictionaries for GPUTexture https://bugs.webkit.org/show_bug.cgi?id=194354 Reviewed by Dean Jackson. Add dictionaries needed to create a GPUTextureDescriptor. No new tests; no change in behavior. New interface and dictionaries added: * Modules/webgpu/GPUExtent3D.idl: * Modules/webgpu/GPUTextureDescriptor.idl: * Modules/webgpu/GPUTextureDimension.idl: * Modules/webgpu/GPUTextureUsage.idl: * platform/graphics/gpu/GPUExtent3D.h: * platform/graphics/gpu/GPUTextureDescriptor.h: * platform/graphics/gpu/GPUTextureDimension.h: * platform/graphics/gpu/GPUTextureUsage.h: Update WebGPUTextureFormatEnum to GPUTextureFormat: * Modules/webgpu/WebGPUTextureFormatEnum.h: Removed. * Modules/webgpu/GPUTextureFormat.idl: Renamed from WebGPUTextureFormatEnum.idl and updated to hyphen-case. * platform/graphics/gpu/GPUTextureFormat.h: Renamed from GPUTextureFormatEnum and updated for hyphen-case IDL. * Modules/webgpu/WebGPUSwapChain.cpp: * Modules/webgpu/WebGPUSwapChain.h: * Modules/webgpu/WebGPUSwapChain.idl: * platform/graphics/gpu/GPUSwapChain.h: * platform/graphics/gpu/cocoa/GPUSwapChainMetal.mm: (WebCore::platformTextureFormatForGPUTextureFormat): (WebCore::GPUSwapChain::setFormat): Update project files with new symbols: * CMakeLists.txt: * DerivedSources.make: * Sources.txt: * WebCore.xcodeproj/project.pbxproj: * bindings/js/WebCoreBuiltinNames.h: 2019-02-12 Dean Jackson BitmapRenderer should handle existing ImageBuffers https://bugs.webkit.org/show_bug.cgi?id=194555 Reviewed by Tim Horton. Our logic in ImageBitmapRenderingContext assumed that it had always created the ImageBuffer being used. However, it's valid to call something like toBlob() or toDataURL() before creating a context, so we need to handle the case where an ImageBuffer already exists. Test: fast/canvas/bitmaprenderer-created-after-toBlob.html * html/HTMLCanvasElement.cpp: (WebCore::HTMLCanvasElement::createImageBuffer const): Move some logic into setImageBuffer. (WebCore::HTMLCanvasElement::setImageBuffer const): Make sure to clear the state saver. 2019-02-06 Daniel Bates Standardize on ControlKey instead of CtrlKey https://bugs.webkit.org/show_bug.cgi?id=194317 Reviewed by Tim Horton. * dom/UIEventWithKeyState.cpp: (WebCore::UIEventWithKeyState::modifiersFromInitializer): (WebCore::UIEventWithKeyState::setModifierKeys): * dom/UIEventWithKeyState.h: (WebCore::UIEventWithKeyState::ctrlKey const): * page/ios/EventHandlerIOS.mm: (WebCore::EventHandler::accessKeyModifiers): * page/mac/EventHandlerMac.mm: (WebCore::EventHandler::accessKeyModifiers): * platform/PlatformEvent.h: (WebCore::PlatformEvent::controlKey const): (WebCore::PlatformEvent::PlatformEvent): (WebCore::PlatformEvent::ctrlKey const): Deleted. * platform/cocoa/KeyEventCocoa.mm: (WebCore::PlatformKeyboardEvent::getCurrentModifierState): * platform/gtk/PlatformKeyboardEventGtk.cpp: (WebCore::modifiersForGdkKeyEvent): * platform/gtk/PlatformMouseEventGtk.cpp: (WebCore::PlatformMouseEvent::PlatformMouseEvent): * platform/gtk/PlatformWheelEventGtk.cpp: (WebCore::PlatformWheelEvent::PlatformWheelEvent): * platform/ios/KeyEventIOS.mm: (WebCore::PlatformKeyboardEvent::currentStateOfModifierKeys): * platform/ios/PlatformEventFactoryIOS.mm: (WebCore::modifiersForEvent): * platform/mac/KeyEventMac.mm: (WebCore::PlatformKeyboardEvent::currentStateOfModifierKeys): * platform/mac/PlatformEventFactoryMac.mm: (WebCore::modifiersForEvent): * testing/Internals.cpp: (WebCore::Internals::accessKeyModifiers const): 2019-02-06 Alex Christensen Fix WatchOS build https://bugs.webkit.org/show_bug.cgi?id=194353 Rubber stamped by Tim Horton and Wenson Hsieh. * rendering/RenderThemeIOS.mm: (WebCore::iconForAttachment): 2019-02-06 Olivier Blin [SVG] fix SVGURIReference build by including SVGElement https://bugs.webkit.org/show_bug.cgi?id=194292 Reviewed by Michael Catanzaro. * svg/SVGURIReference.h: SVGURIReference is making use of SVGElement in its constructor, but it was not declared. The issue was not seen in unified builds because it was grouped with other files including SVGElement. 2019-02-06 Zalan Bujtas [LFC][IFC] Move line layout code to a dedicated file https://bugs.webkit.org/show_bug.cgi?id=194328 Reviewed by Antti Koivisto. * Sources.txt: * WebCore.xcodeproj/project.pbxproj: * layout/inlineformatting/InlineFormattingContext.cpp: (WebCore::Layout::InlineFormattingContext::layout const): (WebCore::Layout::isTrimmableContent): Deleted. (WebCore::Layout::InlineFormattingContext::initializeNewLine const): Deleted. (WebCore::Layout::InlineFormattingContext::splitInlineRunIfNeeded const): Deleted. (WebCore::Layout::InlineFormattingContext::createFinalRuns const): Deleted. (WebCore::Layout::InlineFormattingContext::postProcessInlineRuns const): Deleted. (WebCore::Layout::InlineFormattingContext::closeLine const): Deleted. (WebCore::Layout::InlineFormattingContext::appendContentToLine const): Deleted. (WebCore::Layout::InlineFormattingContext::layoutInlineContent const): Deleted. (WebCore::Layout::InlineFormattingContext::computeFloatPosition const): Deleted. (WebCore::Layout::InlineFormattingContext::placeInFlowPositionedChildren const): Deleted. * layout/inlineformatting/InlineFormattingContext.h: (WebCore::Layout::InlineFormattingContext::LineLayout::Line::hasContent const): (WebCore::Layout::InlineFormattingContext::LineLayout::Line::isClosed const): (WebCore::Layout::InlineFormattingContext::LineLayout::Line::isFirstLine const): (WebCore::Layout::InlineFormattingContext::LineLayout::Line::runs): (WebCore::Layout::InlineFormattingContext::LineLayout::Line::contentLogicalLeft const): (WebCore::Layout::InlineFormattingContext::LineLayout::Line::availableWidth const): (WebCore::Layout::InlineFormattingContext::LineLayout::Line::lastRunType const): (WebCore::Layout::InlineFormattingContext::LineLayout::Line::logicalTop const): (WebCore::Layout::InlineFormattingContext::LineLayout::Line::logicalBottom const): (WebCore::Layout::InlineFormattingContext::LineLayout::Line::logicalHeight const): (WebCore::Layout::InlineFormattingContext::Line::hasContent const): Deleted. (WebCore::Layout::InlineFormattingContext::Line::isClosed const): Deleted. (WebCore::Layout::InlineFormattingContext::Line::isFirstLine const): Deleted. (WebCore::Layout::InlineFormattingContext::Line::runs): Deleted. (WebCore::Layout::InlineFormattingContext::Line::contentLogicalLeft const): Deleted. (WebCore::Layout::InlineFormattingContext::Line::availableWidth const): Deleted. (WebCore::Layout::InlineFormattingContext::Line::lastRunType const): Deleted. (WebCore::Layout::InlineFormattingContext::Line::logicalTop const): Deleted. (WebCore::Layout::InlineFormattingContext::Line::logicalBottom const): Deleted. (WebCore::Layout::InlineFormattingContext::Line::logicalHeight const): Deleted. * layout/inlineformatting/InlineFormattingContextGeometry.cpp: (WebCore::Layout::adjustedLineLogicalLeft): Deleted. (WebCore::Layout::InlineFormattingContext::Geometry::justifyRuns): Deleted. (WebCore::Layout::InlineFormattingContext::Geometry::computeExpansionOpportunities): Deleted. (WebCore::Layout::InlineFormattingContext::Geometry::alignRuns): Deleted. (WebCore::Layout::InlineFormattingContext::Geometry::runWidth): Deleted. * layout/inlineformatting/Line.cpp: (WebCore::Layout::InlineFormattingContext::LineLayout::Line::init): (WebCore::Layout::InlineFormattingContext::LineLayout::Line::adjustLogicalLeft): (WebCore::Layout::InlineFormattingContext::LineLayout::Line::adjustLogicalRight): (WebCore::Layout::InlineFormattingContext::LineLayout::Line::contentLogicalRight const): (WebCore::Layout::InlineFormattingContext::LineLayout::Line::appendContent): (WebCore::Layout::InlineFormattingContext::LineLayout::Line::close): (WebCore::Layout::InlineFormattingContext::Line::init): Deleted. (WebCore::Layout::InlineFormattingContext::Line::adjustLogicalLeft): Deleted. (WebCore::Layout::InlineFormattingContext::Line::adjustLogicalRight): Deleted. (WebCore::Layout::InlineFormattingContext::Line::contentLogicalRight const): Deleted. (WebCore::Layout::InlineFormattingContext::Line::appendContent): Deleted. (WebCore::Layout::InlineFormattingContext::Line::close): Deleted. 2019-02-06 Youenn Fablet CoreAudioCaptureSource should not configure its audio unit until it starts producing data https://bugs.webkit.org/show_bug.cgi?id=194310 Reviewed by Eric Carlson. Delay the configuration of the audio unit until the source is instructed to start producing data. This allows the UIProcess to not start changing the audio unit when checking for constraints during getUserMedia call before the prompt. Covered by manual testing. * platform/mediastream/mac/CoreAudioCaptureSource.cpp: (WebCore::CoreAudioCaptureSource::CoreAudioCaptureSource): (WebCore::CoreAudioCaptureSource::initializeToStartProducingData): (WebCore::CoreAudioCaptureSource::startProducingData): * platform/mediastream/mac/CoreAudioCaptureSource.h: 2019-02-06 Youenn Fablet Disable audio ducking at Audio Unit setup time https://bugs.webkit.org/show_bug.cgi?id=194303 Reviewed by Eric Carlson. When creating a CoreAudioCaptureSource, the audio unit might be reconfigured if a past audio capture was done. This might trigger audio ducking which is undone in startInternal. In some cases, startInternal will never call start. In that case, the audio unit will continue ducking the other processing. To ensure ducking is disabled, unduck in setupAudioUnit as well as startInternal. In addition to that, once a shared unit is created, it stays alive until the UIProcess exits. This might affect all applications. Instead, whenever the shared unit is stopped, clean it so as to restore the state as if no capture ever happened. This has noticeable effects in the quality of audio being played on bluetooth devices. Covered by manual tests. * platform/mediastream/mac/CoreAudioCaptureSource.cpp: (WebCore::CoreAudioSharedUnit::setupAudioUnit): (WebCore::CoreAudioSharedUnit::unduck): (WebCore::CoreAudioSharedUnit::startInternal): (WebCore::CoreAudioSharedUnit::captureFailed): (WebCore::CoreAudioSharedUnit::stopProducingData): 2019-02-06 Antti Koivisto RELEASE_ASSERT(!m_document.isResolvingTreeStyle()) in com.apple.WebKit.WebContent at WebCore: WebCore::StyleResolver::~StyleResolver https://bugs.webkit.org/show_bug.cgi?id=194333 Reviewed by Zalan Bujtas. Content extensions may mutate the extension stylesheet in the middle of a style resolution as a result of the legacy animation code triggering a resource load. Test: http/tests/contentextensions/css-display-none-keyframe.html * style/StyleScope.cpp: (WebCore::Style::Scope::scheduleUpdate): Avoid clearing the style resolver if we are in the middle of a style resolution. A better fix that avoid doing this in the first place is tracked by https://bugs.webkit.org/show_bug.cgi?id=194335. 2019-02-06 Pablo Saavedra Build failure after r240315 https://bugs.webkit.org/show_bug.cgi?id=194341 Reviewed by Wenson Hsieh. * bindings/js/JSUndoItemCustom.cpp: (WebCore::JSUndoItemOwner::isReachableFromOpaqueRoots): 2019-02-05 Ryosuke Niwa REGRESSION (r240909): Release assert in FrameLoader::loadURL when navigating with a non-existent target name https://bugs.webkit.org/show_bug.cgi?id=194329 Reviewed by Geoffrey Garen. The bug was caused by the code path for when navigating with a specific target frame name that does not exist never setting the load type of PolicyChecker. As a result, we would use whatever load type used in the previous navigation, resulting in this release assertion. Updating the load type here should in theory fix the underlying bug r240909 was meant to catch & fix. Test: fast/loader/navigate-with-new-target-after-back-forward-navigation.html * loader/FrameLoader.cpp: (WebCore::FrameLoader::loadURL): 2019-02-05 Claudio Saavedra [FreeType] Build fix for Debian stable Unreviewed build fix. Debian stable currently has a version of fontconfig that doesn't yet have FC_COLOR. #ifdef its use to fix the build. * platform/graphics/freetype/FontCacheFreeType.cpp: (WebCore::FontCache::systemFallbackForCharacters): 2019-02-05 Alex Christensen Stop using blobRegistry in NetworkProcess https://bugs.webkit.org/show_bug.cgi?id=194027 Reviewed by Youenn Fablet. Also stop using NetworkBlobRegistry::singleton. Instead, have the NetworkProcess own a NetworkBlobRegistry which owns a BlobRegistryImpl. We now have to resolve all blob file references while we still have a NetworkConnectionToWebProcess/NetworkProcess/NetworkBlobRegistry/BlobRegistryImpl instead of using the singleton after we have passed everything to the loading code, but it works the same as it did before. We must consume the sandbox extension from the BlobRegistryImpl before using the resolved files, so I pass around a Vector> so we know which extensions to revoke. * platform/network/BlobRegistryImpl.h: * platform/network/FormData.cpp: (WebCore::appendBlobResolved): (WebCore::FormData::resolveBlobReferences): * platform/network/FormData.h: * platform/network/cf/FormDataStreamCFNet.cpp: (WebCore::createHTTPBodyCFReadStream): * platform/network/curl/CurlFormDataStream.cpp: (WebCore::CurlFormDataStream::CurlFormDataStream): 2019-02-05 Truitt Savell Unreviewed, rolling out r240984. Revision casued two API timeouts Reverted changeset: "Stop using blobRegistry in NetworkProcess" https://bugs.webkit.org/show_bug.cgi?id=194027 https://trac.webkit.org/changeset/240984 2019-02-05 Keith Rollin Enable the automatic checking and regenerations of .xcfilelists during builds https://bugs.webkit.org/show_bug.cgi?id=194124 Reviewed by Tim Horton. Bug 193790 add a facility for checking -- during build time -- that any needed .xcfilelist files are up-to-date and for updating them if they are not. This facility was initially opt-in by setting WK_ENABLE_CHECK_XCFILELISTS until other pieces were in place and until the process seemed robust. Its now time to enable this facility and make it opt-out. If there is a need to disable this facility, set and export WK_DISABLE_CHECK_XCFILELISTS=1 in your environment before running `make` or `build-webkit`, or before running Xcode from the command line. Additionally, remove the step that generates a list of source files going into the UnifiedSources build step. It's only necessarily to specify Sources.txt and SourcesCocoa.txt as inputs. No new tests since there should be no observable behavior difference. * UnifiedSources-input.xcfilelist: Removed. * WebCore.xcodeproj/project.pbxproj: 2019-02-05 Keith Rollin Update .xcfilelist files https://bugs.webkit.org/show_bug.cgi?id=194121 Reviewed by Tim Horton. Preparatory to enabling the facility for automatically updating the .xcfilelist files, check in a freshly-updated set so that not everyone runs up against having to regenerate them themselves. No new tests since there should be no observable behavior difference. * DerivedSources-input.xcfilelist: * DerivedSources-output.xcfilelist: 2019-02-05 Alex Christensen Stop using blobRegistry in NetworkProcess https://bugs.webkit.org/show_bug.cgi?id=194027 Reviewed by Youenn Fablet. Also stop using NetworkBlobRegistry::singleton. Instead, have the NetworkProcess own a NetworkBlobRegistry which owns a BlobRegistryImpl. We now have to resolve all blob file references while we still have a NetworkConnectionToWebProcess/NetworkProcess/NetworkBlobRegistry/BlobRegistryImpl instead of using the singleton after we have passed everything to the loading code, but it works the same as it did before. We must consume the sandbox extension from the BlobRegistryImpl before using the resolved files, so I pass around a Vector> so we know which extensions to revoke. * platform/network/BlobRegistryImpl.h: * platform/network/FormData.cpp: (WebCore::appendBlobResolved): (WebCore::FormData::resolveBlobReferences): * platform/network/FormData.h: * platform/network/cf/FormDataStreamCFNet.cpp: (WebCore::createHTTPBodyCFReadStream): * platform/network/curl/CurlFormDataStream.cpp: (WebCore::CurlFormDataStream::CurlFormDataStream): 2019-02-05 Ryan Haddad Unreviewed, rolling out r240742. Causes crashes on iOS simulator. Reverted changeset: "[iOS] Keyups for non-modifier keys identified as "Dead" when not focused in a content-editable element" https://bugs.webkit.org/show_bug.cgi?id=192824 https://trac.webkit.org/changeset/240742 2019-02-05 Zalan Bujtas [LFC][IFC] collectInlineContent should use pre-computed margins, paddings and borders https://bugs.webkit.org/show_bug.cgi?id=194269 Reviewed by Antti Koivisto. In this patch we pre-compute the margins padding and borders for formatting context roots, replaced boxes and non-replaced containers. These property values are input to collectInlineContent's inline item detaching logic. * layout/inlineformatting/InlineFormattingContext.cpp: (WebCore::Layout::nextInPreOrder): (WebCore::Layout::InlineFormattingContext::layout const): (WebCore::Layout::InlineFormattingContext::computeMarginBorderAndPadding const): (WebCore::Layout::InlineFormattingContext::collectInlineContent const): * layout/inlineformatting/InlineFormattingContext.h: * layout/layouttree/LayoutBox.h: ran out bits. 2019-02-05 Antoine Quint REGRESSION (r240579): com.apple.WebKit.WebContent at WebCore: WebCore::Document::absoluteEventRegionForNode https://bugs.webkit.org/show_bug.cgi?id=194284 Reviewed by Antti Koivisto. The m_touchActionElements list needs to be HashSet> instead of HashSet. It was initially storing raw pointers based on m_touchEventTargets which is an EventTargetSet (typedef’d to HashCountedSet), but that's because these nodes have an event listener registered for them and as such are kept alive, whereas elements with a touch-action property aren’t. Elements are removed from this list from Document::nodeWillBeRemoved() and from Document::updateTouchActionElements(), the latter being called from Style::TreeResolver::resolveElement(). * dom/Document.cpp: (WebCore::Document::updateTouchActionElements): * dom/Document.h: (WebCore::Document::touchActionElements const): 2019-02-05 Benjamin Poulain Hit testing functions optimizations https://bugs.webkit.org/show_bug.cgi?id=194073 Reviewed by Zalan Bujtas. This patch implements some easy optimizations that speed up hit testing without changing the algorithms. * page/FrameViewLayoutContext.h: The code for: view().frameView().layoutContext().isPaintOffsetCacheEnabled() followed by: view().frameView().layoutContext().layoutState() was loading all the intermediate values twice and calling layoutState() twice. By marking the function as pure, Clang can CSE the whole thing and remove the duplicated code. * platform/graphics/LayoutRect.h: (WebCore::LayoutRect::isInfinite const): That one is pretty funny. Since LayoutRect::isInfinite() was implemented before operator==() is declared, the compiler was falling back to the implicit convertion to FloatRect() before doing any comparison. This explains a bunch of the convertions to float when using LayoutRect. * rendering/RenderBox.cpp: (WebCore::RenderBox::mapLocalToContainer const): Just reoder to make the register nice and clean for the optimization described above. 2019-02-04 Yusuke Suzuki [JSC] Shrink size of VM by lazily allocating IsoSubspaces for non-common types https://bugs.webkit.org/show_bug.cgi?id=193993 Reviewed by Keith Miller. * bindings/scripts/CodeGeneratorJS.pm: (GenerateHeader): * bridge/runtime_method.h: 2019-02-04 Simon Fraser Move some macOS/iOS scrolling code into the scrolling/cocoa directory https://bugs.webkit.org/show_bug.cgi?id=194245 Reviewed by Zalan Bujtas. ScrollingTreeFixedNode and ScrollingTreeStickyNode are used on iOS and macOS, so move them to the cocoa directory. Standardize on the ordering of ENABLE(ASYNC_SCROLLING) && PLATFORM(MAC). Stop building ScrollingThread for iOS (it's never used), and stub out some functions so things build. * SourcesCocoa.txt: * WebCore.xcodeproj/project.pbxproj: * page/scrolling/ScrollingThread.cpp: (WebCore::ScrollingThread::initializeRunLoop): (WebCore::ScrollingThread::wakeUpRunLoop): (WebCore::ScrollingThread::threadRunLoopSourceCallback): * page/scrolling/cocoa/ScrollingTreeFixedNode.h: Renamed from Source/WebCore/page/scrolling/mac/ScrollingTreeFixedNode.h. * page/scrolling/cocoa/ScrollingTreeFixedNode.mm: Renamed from Source/WebCore/page/scrolling/mac/ScrollingTreeFixedNode.mm. * page/scrolling/cocoa/ScrollingTreeStickyNode.h: Renamed from Source/WebCore/page/scrolling/mac/ScrollingTreeStickyNode.h. * page/scrolling/cocoa/ScrollingTreeStickyNode.mm: Renamed from Source/WebCore/page/scrolling/mac/ScrollingTreeStickyNode.mm. * page/scrolling/mac/ScrollingThreadMac.mm: * page/scrolling/mac/ScrollingTreeScrollingNodeDelegateMac.h: * page/scrolling/mac/ScrollingTreeScrollingNodeDelegateMac.mm: 2019-02-04 Ms2ger [GTK][WPE] Need a function to convert internal URI to display ("pretty") URI https://bugs.webkit.org/show_bug.cgi?id=174816 Reviewed by Michael Catanzaro. Tests: enabled fast/url/user-visible/. * testing/Internals.cpp: (WebCore::Internals::userVisibleString): Enable method on all platforms. 2019-02-04 Fujii Hironori [curl] ASSERTION FAILED: !m_didNotifyResponse || m_multipartHandle https://bugs.webkit.org/show_bug.cgi?id=190895 Reviewed by Ross Kirsling. An assertion was failing in CurlRequest::invokeDidReceiveResponse because DidReceiveResponse was already dispatched. This condition was met if CurlRequestScheduler::completeTransfer is called while waiting for the reply for the first DidReceiveResponse. No new tests, covered by existing tests. * platform/network/curl/CurlRequest.h: (WebCore::CurlRequest::needToInvokeDidReceiveResponse const): Return true if m_didNotifyResponse is false disregard to m_didReturnFromNotify. 2019-02-04 Said Abou-Hallawa [CG] Enable setAdditionalSupportedImageTypes for WK1 https://bugs.webkit.org/show_bug.cgi?id=194190 Reviewed by Tim Horton. Move the function webCoreStringVectorFromNSStringArray from WebKit to WebCore so it can be used by both WebKit and WebKitLegacy. * platform/mac/StringUtilities.h: * platform/mac/StringUtilities.mm: (WebCore::webCoreStringVectorFromNSStringArray): 2019-02-04 Justin Fan [Web GPU] Code clean-up for RenderPipeline backend https://bugs.webkit.org/show_bug.cgi?id=194238 Reviewed by Dean Jackson. Replace dot syntax setters with calls to setter methods, and remove unnecessary setter calls for the input state's descriptor arrays. Covered by existing tests; no change in behavior. * platform/graphics/gpu/cocoa/GPURenderPipelineMetal.mm: (WebCore::tryCreateMtlDepthStencilState): Refactor to use implicit setters rather than dot syntax. (WebCore::setInputStateForPipelineDescriptor): Ditto, and remove unnecessary setter calls on array objects. 2019-02-04 Benjamin Poulain Use deferrable timer to restart the Responsiveness Timer on each wheel event https://bugs.webkit.org/show_bug.cgi?id=194135 Reviewed by Simon Fraser. The original DeferrableOneShotTimer was not really deferrable. What it allows is to restart the count down from scratch after firing. For this optimization, I want to keep the correct timing but avoid starting a real timer every time. I renamed DeferrableOneShotTimer to ResettableOneShotTimer and created a real DeferrableOneShotTimer that support deadlines. * css/CSSImageGeneratorValue.cpp: * html/HTMLPlugInImageElement.h: * loader/cache/CachedResource.h: * platform/Timer.cpp: (WebCore::DeferrableOneShotTimer::startOneShot): (WebCore::DeferrableOneShotTimer::fired): * platform/Timer.h: (WebCore::TimerBase::nextFireTime const): (WebCore::ResettableOneShotTimer::ResettableOneShotTimer): (WebCore::DeferrableOneShotTimer::DeferrableOneShotTimer): (WebCore::DeferrableOneShotTimer::stop): (WebCore::DeferrableOneShotTimer::restart): Deleted. * platform/graphics/ca/TileController.h: * platform/graphics/cg/SubimageCacheWithTimer.h: 2019-02-04 Antoine Quint Use constants for pointer types https://bugs.webkit.org/show_bug.cgi?id=194232 Reviewed by Dean Jackson. We cannot use an enum for the pointer type since a custom pointer type can be created by developers when creating a pointer event using JavaScript, but we can at least used string constants for the ones created internally. * dom/PointerEvent.cpp: (WebCore::PointerEvent::mousePointerType): (WebCore::PointerEvent::penPointerType): (WebCore::PointerEvent::touchPointerType): * dom/PointerEvent.h: * dom/ios/PointerEventIOS.cpp: 2019-02-04 Zalan Bujtas [First paint] Adjust "finishedParsingMainDocument" flag by taking deferred and async scripts into account. https://bugs.webkit.org/show_bug.cgi?id=194168 Reviewed by Simon Fraser. First paint should not be blocked by async or deferred scripts. * page/FrameView.cpp: (WebCore::FrameView::qualifiesAsVisuallyNonEmpty const): 2019-02-04 Simon Fraser Async overflow scroll with border-radius renders incorrectly https://bugs.webkit.org/show_bug.cgi?id=194205 Reviewed by Zalan Bujtas. When an element has composited overflow:scroll and border-radius, we need to make a layer to clip to the inside of the border radius if necessary. Existing code simply turned off needsDescendantsClippingLayer for composited scrolling layers, but now we check to see if the inner border is rounded. If we have both a m_childContainmentLayer and scrolling layers, we need to adjust the location of the scrolling layers (which are parented in m_childContainmentLayer). Also fix offsetFromRenderer for these layers; it's positive for layers inset from the top left of the border box. Tests: compositing/clipping/border-radius-async-overflow-clipping-layer.html compositing/clipping/border-radius-async-overflow-non-stacking.html compositing/clipping/border-radius-async-overflow-stacking.html * rendering/RenderLayerBacking.cpp: (WebCore::RenderLayerBacking::updateConfiguration): (WebCore::RenderLayerBacking::updateGeometry): (WebCore::RenderLayerBacking::updateChildClippingStrategy): Layout is always up-to-date now, so remove the comment. 2019-02-04 Simon Fraser PageOverlayController's layers should be created lazily https://bugs.webkit.org/show_bug.cgi?id=194199 Reviewed by Tim Horton. Expose PageOverlayController::hasDocumentOverlays() and hasViewOverlays() and use them to only parent the overlay-hosting layers when necessary. For document overlays, RenderLayerCompositor::appendDocumentOverlayLayers() can simply do nothing if there are none. Updates are triggered via Page::installedPageOverlaysChanged(), which calls FrameView::setNeedsCompositingConfigurationUpdate() to trigger the root layer compositing updates that parents the layerWithDocumentOverlays(). View overlays are added to the layer tree via the DrawingArea. When we go between having none and some view overlays, Page::installedPageOverlaysChanged() calls attachViewOverlayGraphicsLayer() on the ChromeClient, and the DrawingArea responds by calling updateRootLayers() and scheduling a compositing flush (this has to be done manually because view overlay layers are outside the subtree managed by RenderLayerCompositor). Now that GraphicsLayers are ref-counted, we can let the DrawingArea simply retain its m_viewOverlayRootLayer; there is no need for RenderLayerCompositor::attachRootLayer()/detachRootLayer() to do anything with view overlay layers. This implies that a page can navigate (new FrameView) and view overlays will persist, without having to be manually removed and re-added. We can also remove the Frame argument to attachViewOverlayGraphicsLayer(). * loader/EmptyClients.h: * page/ChromeClient.h: * page/FrameView.cpp: (WebCore::FrameView::setNeedsCompositingConfigurationUpdate): These functions need to schedule a compositing flush because there may be nothing else that does. (WebCore::FrameView::setNeedsCompositingGeometryUpdate): * page/Page.cpp: (WebCore::Page::installedPageOverlaysChanged): * page/Page.h: * page/PageOverlayController.cpp: (WebCore::PageOverlayController::hasDocumentOverlays const): (WebCore::PageOverlayController::hasViewOverlays const): (WebCore::PageOverlayController::attachViewOverlayLayers): PageOverlayController has the Page so it might as well be the one to call through the ChromeClient. (WebCore::PageOverlayController::detachViewOverlayLayers): (WebCore::PageOverlayController::installPageOverlay): (WebCore::PageOverlayController::uninstallPageOverlay): * page/PageOverlayController.h: * rendering/RenderLayerCompositor.cpp: (WebCore::RenderLayerCompositor::updateCompositingLayers): isFullUpdate is always true; remove it. (WebCore::RenderLayerCompositor::appendDocumentOverlayLayers): (WebCore::RenderLayerCompositor::attachRootLayer): (WebCore::RenderLayerCompositor::detachRootLayer): 2019-02-04 Eric Liang When performing Increment or Decrement on sliders, check to see if the slider is disabled. https://bugs.webkit.org/show_bug.cgi?id=173497 Reviewed by Chris Fleizach. Test: accessibility/set-value-not-work-for-disabled-sliders.html * accessibility/AccessibilityNodeObject.cpp: (WebCore::AccessibilityNodeObject::alterSliderValue): 2019-02-04 Sihui Liu IndexedDB: leak WebIDBConnectionToServer in layout tests https://bugs.webkit.org/show_bug.cgi?id=193688 Reviewed by Geoffrey Garen. Let IDBConnectionToServer keep a WeakPtr of IDBConnectionToServerDelegate. * Modules/indexeddb/client/IDBConnectionToServer.cpp: (WebCore::IDBClient::IDBConnectionToServer::IDBConnectionToServer): * Modules/indexeddb/client/IDBConnectionToServer.h: * Modules/indexeddb/client/IDBConnectionToServerDelegate.h: 2019-02-04 Youenn Fablet Make sure to remove the device observer in AVVideoCaptureSource https://bugs.webkit.org/show_bug.cgi?id=194181 Reviewed by Eric Carlson. Make sure to remove the device observer when the observer is destroyed. To simplify things, add the observer in AVVideoCaptureSource constructor and remove it in the destructor. Make also sure the session observer is also removed whenever the session is released by AVVideoCaptureSource. Covered by manual test. * platform/mediastream/mac/AVVideoCaptureSource.h: * platform/mediastream/mac/AVVideoCaptureSource.mm: (WebCore::AVVideoCaptureSource::AVVideoCaptureSource): (WebCore::AVVideoCaptureSource::~AVVideoCaptureSource): (WebCore::AVVideoCaptureSource::initializeSession): (WebCore::AVVideoCaptureSource::clearSession): (WebCore::AVVideoCaptureSource::stopProducingData): (WebCore::AVVideoCaptureSource::setupSession): 2019-02-04 Antoine Quint Use a dedicated type instead of int32_t for pointer identifiers https://bugs.webkit.org/show_bug.cgi?id=194217 Reviewed by Antti Koivisto. * WebCore.xcodeproj/project.pbxproj: * dom/PointerEvent.h: * dom/PointerID.h: Added. * page/PointerCaptureController.cpp: (WebCore::PointerCaptureController::setPointerCapture): (WebCore::PointerCaptureController::releasePointerCapture): (WebCore::PointerCaptureController::hasPointerCapture): (WebCore::PointerCaptureController::touchEndedOrWasCancelledForIdentifier): (WebCore::PointerCaptureController::hasCancelledPointerEventForIdentifier): (WebCore::PointerCaptureController::cancelPointer): * page/PointerCaptureController.h: 2019-02-04 Wenson Hsieh [iOS] Unable to make a selection in jsfiddle.net using arrow keys when requesting desktop site Followup to https://bugs.webkit.org/show_bug.cgi?id=193758 Reviewed by Daniel Bates. Put the iOS-specific behavior behind an EditingBehavior check, rather than a compile-time guard. No change in behavior. * editing/EditingBehavior.h: (WebCore::EditingBehavior::shouldMoveSelectionToEndWhenFocusingTextInput const): * html/HTMLInputElement.cpp: (WebCore::HTMLInputElement::setDefaultSelectionAfterFocus): 2019-02-04 Zalan Bujtas [LFC][IFC] Make InlineFormattingContext::collectInlineContent non-recursive. https://bugs.webkit.org/show_bug.cgi?id=194210 Reviewed by Antti Koivisto. Use iterative algorithm to collect inline content (and add breaking rules). This is in preparation for fixing the inline preferred width computation. * layout/Verification.cpp: (WebCore::Layout::resolveForRelativePositionIfNeeded): * layout/inlineformatting/InlineFormattingContext.cpp: (WebCore::Layout::addDetachingRules): (WebCore::Layout::createAndAppendInlineItem): (WebCore::Layout::InlineFormattingContext::collectInlineContent const): (WebCore::Layout::InlineFormattingContext::collectInlineContentForSubtree const): Deleted. * layout/inlineformatting/InlineFormattingContext.h: 2019-02-04 Michael Catanzaro Unreviewed, fix unused variable warnings introduced in r240912 https://bugs.webkit.org/show_bug.cgi?id=194198 * page/FrameView.cpp: (WebCore::FrameView::setNeedsCompositingConfigurationUpdate): (WebCore::FrameView::setNeedsCompositingGeometryUpdate): 2019-02-04 Frederic Wang [css-scroll-snap] scroll-snap-align not honored on child with non-visible overflow https://bugs.webkit.org/show_bug.cgi?id=191816 Reviewed by Wenson Hsieh. This patch fixes a bug that prevents children of a scroll container to create snap positions when they have non-visible overflow. This happens because for such a child, the function RenderBox::findEnclosingScrollableContainer() will return the child itself rather than the scroll container. To address that issue, we introduce a new RenderObject::enclosingScrollableContainerForSnapping() helper function that ensures that a real RenderBox ancestor is returned. Test: css3/scroll-snap/scroll-snap-children-with-overflow.html * page/scrolling/AxisScrollSnapOffsets.cpp: (WebCore::updateSnapOffsetsForScrollableArea): Use enclosingScrollableContainerForSnapping() so that we don't skip children with non-visible overflow. * rendering/RenderLayerModelObject.cpp: (WebCore::RenderLayerModelObject::styleDidChange): Ditto. The new function calls enclosingBox(). * rendering/RenderObject.cpp: (WebCore::RenderObject::enclosingScrollableContainerForSnapping const): Return the scrollable container of the enclosing box. If it is actually the render object itself then start the search from the parent box instead. * rendering/RenderObject.h: Declare enclosingScrollableContainerForSnapping(). 2019-02-04 Antti Koivisto Rename GraphicsLayer and PlatformCALayer scrolling layer type enum values to be less ambiguous https://bugs.webkit.org/show_bug.cgi?id=194215 Reviewed by Frédéric Wang. GraphicsLayer::Type::Scrolling -> GraphicsLayer::Type::ScrollContainer PlatformCALayer::LayerTypeScrollingLayer -> PlatformCALayer::LayerTypeScrollContainerLayer * platform/graphics/GraphicsLayer.cpp: (WebCore::GraphicsLayer::supportsLayerType): * platform/graphics/GraphicsLayer.h: * platform/graphics/ca/GraphicsLayerCA.cpp: (WebCore::GraphicsLayer::supportsLayerType): (WebCore::GraphicsLayerCA::initialize): * platform/graphics/ca/PlatformCALayer.cpp: (WebCore::operator<<): * platform/graphics/ca/PlatformCALayer.h: * platform/graphics/ca/cocoa/PlatformCALayerCocoa.mm: (WebCore::PlatformCALayerCocoa::PlatformCALayerCocoa): (WebCore::PlatformCALayerCocoa::commonInit): * rendering/RenderLayerBacking.cpp: (WebCore::RenderLayerBacking::updateScrollingLayers): * rendering/RenderLayerCompositor.cpp: (WebCore::RenderLayerCompositor::ensureRootLayer): 2019-02-03 Antti Koivisto [iOS] Tiles not created in large scrollable iframes https://bugs.webkit.org/show_bug.cgi?id=193665 Reviewed by Simon Fraser. We are not syncing scroll position back to the graphics layer tree correctly. Test by Frédéric Wang. * page/scrolling/AsyncScrollingCoordinator.cpp: (WebCore::AsyncScrollingCoordinator::frameViewRootLayerDidChange): (WebCore::AsyncScrollingCoordinator::reconcileScrollingState): (WebCore::AsyncScrollingCoordinator::reconcileScrollPosition): Factor setting and syncing scrolling layer positions into a function. Use bounds.origin scrolling mechanic when scrollContainerLayer is present. (WebCore::AsyncScrollingCoordinator::scrollableAreaScrollbarLayerDidChange): (WebCore::AsyncScrollingCoordinator::setSynchronousScrollingReasons): (WebCore::AsyncScrollingCoordinator::updateScrollLayerPosition): Deleted. * page/scrolling/AsyncScrollingCoordinator.h: * page/scrolling/ScrollingCoordinator.cpp: (WebCore::ScrollingCoordinator::scrollContainerLayerForFrameView): (WebCore::ScrollingCoordinator::scrolledContentsLayerForFrameView): (WebCore::ScrollingCoordinator::scrollLayerForFrameView): Deleted. * page/scrolling/ScrollingCoordinator.h: * rendering/RenderLayerCompositor.cpp: Rename scrollLayer to scrolledContentsLayer according to out preferred naming scheme and use it in that role only. Add scrollContainerLayer as a separate layer. It is only constructed when using async scrolling on iOS. (WebCore::RenderLayerCompositor::~RenderLayerCompositor): (WebCore::RenderLayerCompositor::customPositionForVisibleRectComputation const): (WebCore::RenderLayerCompositor::visibleRectForLayerFlushing const): (WebCore::RenderLayerCompositor::didChangePlatformLayerForLayer): (WebCore::RenderLayerCompositor::frameViewDidChangeSize): (WebCore::RenderLayerCompositor::updateScrollLayerPosition): (WebCore::RenderLayerCompositor::frameViewDidScroll): (WebCore::RenderLayerCompositor::updateLayerForTopOverhangArea): (WebCore::RenderLayerCompositor::updateLayerForBottomOverhangArea): (WebCore::RenderLayerCompositor::updateLayerForHeader): (WebCore::RenderLayerCompositor::updateLayerForFooter): (WebCore::RenderLayerCompositor::updateOverflowControlsLayers): (WebCore::RenderLayerCompositor::ensureRootLayer): (WebCore::RenderLayerCompositor::destroyRootLayer): (WebCore::RenderLayerCompositor::updateScrollingNodeForScrollingRole): * rendering/RenderLayerCompositor.h: 2019-02-03 Simon Fraser Make setNeedsLayout on the root more explicitly about triggering its side-effects https://bugs.webkit.org/show_bug.cgi?id=194198 Reviewed by Antti Koivisto. Calling setNeedsLayout() on the FrameView or RenderView is an odd concept; the render tree generally manages its own dirty state. Most callers of setNeedsLayout() on the root are really trying to trigger the side-effects of layout, like compositing updates, which are required when view configuration state, like headers, footers and transparency, change. These dependencies are currently implicit and poorly defined. Renaming "setNeedsLayout" on FrameView is a step towards being more explicit about pure rendering updates, vs updates of downstream data strutures like compositing. It's now called setNeedsLayoutAfterViewConfigurationChange(). In addition, expose setNeedsCompositingConfigurationUpdate() and setNeedsCompositingGeometryUpdate() so callers can trigger the appropriate types of compositing updates on the root layer. In addition, FrameViewLayoutContext::setNeedsLayoutAfterViewConfigurationChange() schedules a layout. Withtout this, some callers would dirty the RenderView's layout but rely on some other trigger to make the layout happen. This cleanup was prompted by noticing that FrameView::setHeaderHeight() dirtied layout but never scheduled it, making banner insertion in MiniBrowser unreliable. This patch also removes the aliasing of headerHeight/footerHeight between Page and FrameView. Banners are a property of Page, so FrameView fetches the banner heights from Page. * page/FrameView.cpp: (WebCore::FrameView::headerHeight const): (WebCore::FrameView::footerHeight const): (WebCore::FrameView::availableContentSizeChanged): (WebCore::FrameView::setNeedsLayoutAfterViewConfigurationChange): (WebCore::FrameView::setNeedsCompositingConfigurationUpdate): (WebCore::FrameView::setNeedsCompositingGeometryUpdate): (WebCore::FrameView::scheduleSelectionUpdate): (WebCore::FrameView::setTransparent): (WebCore::FrameView::setBaseBackgroundColor): (WebCore::FrameView::setAutoSizeFixedMinimumHeight): (WebCore::FrameView::enableAutoSizeMode): (WebCore::FrameView::setHeaderHeight): Deleted. (WebCore::FrameView::setFooterHeight): Deleted. (WebCore::FrameView::setNeedsLayout): Deleted. * page/FrameView.h: * page/FrameViewLayoutContext.cpp: (WebCore::FrameViewLayoutContext::setNeedsLayoutAfterViewConfigurationChange): (WebCore::FrameViewLayoutContext::setNeedsLayout): Deleted. * page/FrameViewLayoutContext.h: * page/Page.cpp: (WebCore::Page::setPageScaleFactor): (WebCore::Page::setHeaderHeight): (WebCore::Page::setFooterHeight): (WebCore::Page::addHeaderWithHeight): Deleted. (WebCore::Page::addFooterWithHeight): Deleted. * page/Page.h: * rendering/RenderLayerCompositor.cpp: (WebCore::RenderLayerCompositor::updateBacking): * testing/Internals.cpp: (WebCore::Internals::resetToConsistentState): (WebCore::Internals::setHeaderHeight): (WebCore::Internals::setFooterHeight): 2019-02-03 John Wilander Parse and handle Ad Click Attribution attributes in HTMLAnchorElement::handleClick() https://bugs.webkit.org/show_bug.cgi?id=194104 Reviewed by Chris Dumez, Daniel Bates, and Darin Adler. Test: http/tests/adClickAttribution/anchor-tag-attributes-validation.html This patch adds parsing and validation of the two new Ad Click Attribution attributes in anchor elements: adcampaignid and addestination. The data is not yet forwarded into the loader. * html/HTMLAnchorElement.cpp: (WebCore::HTMLAnchorElement::parseAdClickAttribution const): (WebCore::HTMLAnchorElement::handleClick): Now calls HTMLAnchorElement::parseAdClickAttribution(). * html/HTMLAnchorElement.h: * loader/AdClickAttribution.h: Made WebCore::AdClickAttribution copyable since it's needed to have it be WTF::Optional. Also made AdClickAttribution::MaxEntropy public. Changed numeric types from unsigned short to uint32_t. (WebCore::AdClickAttribution::Campaign::isValid const): (WebCore::AdClickAttribution::Conversion::isValid const): 2019-02-03 Ryosuke Niwa Validate navigation policy decisions to avoid crashes in continueLoadAfterNavigationPolicy https://bugs.webkit.org/show_bug.cgi?id=194189 Reviewed by Geoffrey Garen. Introduced PolicyCheckIdentifier to pair each navigation policy check request with a decision, and deployed it in PolicyChecker. The identifier is passed from WebContent process to UI process in WebKit2, and passed it back with the policy decision. Because PolicyCheckIdentifier embeds the process identifier from which a navigation policy is checked, we would be able to detect when UI process had sent the decision to a wrong WebContent process. This patch also adds release assertions to make sure history().provisionalItem() is set whenever we're requesting a navigation policy check. These code changes should either: 1. Fix crashes in FrameLoader::continueLoadAfterNavigationPolicy where isBackForwardLoadType would return true yet history().provisionalItem() is null. 2. Detect a bug that UI process can send a navigation policy decision to a wrong WebContent process. 3. Rule out the possibility that (2) exists. * loader/DocumentLoader.cpp: (WebCore::DocumentLoader::willSendRequest): (WebCore::DocumentLoader::responseReceived): * loader/EmptyClients.cpp: (WebCore::EmptyFrameLoaderClient::dispatchDecidePolicyForNewWindowAction): (WebCore::EmptyFrameLoaderClient::dispatchDecidePolicyForNavigationAction): * loader/EmptyFrameLoaderClient.h: * loader/FrameLoader.cpp: (WebCore::FrameLoader::checkContentPolicy): (WebCore::FrameLoader::loadURL): (WebCore::FrameLoader::load): (WebCore::FrameLoader::loadWithDocumentLoader): (WebCore::FrameLoader::loadPostRequest): * loader/FrameLoader.h: * loader/FrameLoaderClient.h: * loader/FrameLoaderTypes.h: (WebCore::PolicyCheckIdentifier): Added. (WebCore::PolicyCheckIdentifier::operator== const): Added. (WebCore::PolicyCheckIdentifier::PolicyCheckIdentifier): Added. (WebCore::PolicyCheckIdentifier::encode const): Added. (WebCore::PolicyCheckIdentifier::decode): Added. * loader/PolicyChecker.cpp: (WebCore::PolicyCheckIdentifier::generate): (WebCore::PolicyCheckIdentifier::isValidFor): Returns true if the identifer matches. Also release asserts that the process ID is same, and that m_check is always not zero (meaning it's a generated value). The failure of these release assertions would indicate that there is a bug in UI process, which results in a policy decision response being sent to a wrong Web process. (WebCore::PolicyChecker::checkNavigationPolicy): Exit early if isValidFor fails. (WebCore::PolicyChecker::checkNewWindowPolicy): 2019-02-03 Antti Koivisto Don't include ScrollCoordinator.h from Element.h https://bugs.webkit.org/show_bug.cgi?id=194206 Reviewed by Daniel Bates. * dom/Element.h: 2019-02-03 Wenson Hsieh Unable to move selection into editable roots with 0 height https://bugs.webkit.org/show_bug.cgi?id=194143 Reviewed by Ryosuke Niwa. Currently, positions inside editable elements of height 0 are not considered to be candidates when canonicalizing a position to its visible counterpart. This prevents us from moving the selection into these editable roots at all. To fix this, we relax this constraint by allowing positions anchored by root editable elements to be candidates. Test: editing/selection/insert-text-in-empty-content-editable.html * dom/Position.cpp: (WebCore::Position::isCandidate const): 2019-02-03 Simon Fraser Tidyup of Pagination and FrameView m_mediaType initialization https://bugs.webkit.org/show_bug.cgi?id=194203 Reviewed by Darin Adler. Fix post-commit feedback on lines around code changed in r240901. * page/FrameView.cpp: (WebCore::FrameView::FrameView): * page/FrameView.h: * rendering/Pagination.h: (WebCore::Pagination::operator!= const): 2019-02-03 Megan Gardner Turn on Smart Paste https://bugs.webkit.org/show_bug.cgi?id=193786 Reviewed by Ryosuke Niwa. Turned on a modified tests: LayoutTests/editing/pasteboard/smart-paste-001.html LayoutTests/editing/pasteboard/smart-paste-002.html LayoutTests/editing/pasteboard/smart-paste-003.html LayoutTests/editing/pasteboard/smart-paste-004.html LayoutTests/editing/pasteboard/smart-paste-005.html LayoutTests/editing/pasteboard/smart-paste-006.html LayoutTests/editing/pasteboard/smart-paste-007.html LayoutTests/editing/pasteboard/smart-paste-008.html * platform/ios/PasteboardIOS.mm: (WebCore::Pasteboard::canSmartReplace): Turn on smart replace. 2019-02-02 Simon Fraser Tidy up data memebers of FrameView and related classes to shrink class sizes https://bugs.webkit.org/show_bug.cgi?id=194197 Reviewed by Zalan Bujtas. Make various enums 8-bit. Re-order data members of FrameView, FrameViewLayoutContext, Widget and ScrollView to optimize padding. Use more data member initializers. This shrinks FrameView from 1168 (144 padding bytes) to 1096 (96 padding bytes). * dom/Element.h: * page/FrameView.cpp: (WebCore::FrameView::FrameView): * page/FrameView.h: * page/FrameViewLayoutContext.h: * platform/ScrollTypes.h: * platform/ScrollView.h: Data members should come after member functions. * platform/Widget.h: * rendering/Pagination.h: (WebCore::Pagination::Pagination): Deleted. 2019-02-02 Simon Fraser Rename "scrollingLayer" in RenderLayerBacking to "scrollContainerLayer" for clarity https://bugs.webkit.org/show_bug.cgi?id=194194 Rubber-stampted by Antti Koivisto. Our desired terminology is "scrollContainerLayer" for the outer, clipping layer for scrolling, and "scrolledContentsLayer" for the contents that move when you scroll. * rendering/RenderLayerBacking.cpp: (WebCore::RenderLayerBacking::updateDebugIndicators): (WebCore::RenderLayerBacking::destroyGraphicsLayers): (WebCore::RenderLayerBacking::updateGeometry): (WebCore::RenderLayerBacking::setLocationOfScrolledContents): (WebCore::RenderLayerBacking::updateAfterDescendants): (WebCore::RenderLayerBacking::updateInternalHierarchy): (WebCore::RenderLayerBacking::updateDrawsContent): (WebCore::RenderLayerBacking::updateScrollingLayers): * rendering/RenderLayerBacking.h: * rendering/RenderLayerCompositor.cpp: (WebCore::RenderLayerCompositor::didChangePlatformLayerForLayer): (WebCore::RenderLayerCompositor::updateScrollingNodeForScrollingRole): (WebCore::LegacyWebKitScrollingLayerCoordinator::registerAllViewportConstrainedLayers): (WebCore::LegacyWebKitScrollingLayerCoordinator::updateScrollingLayer): (WebCore::LegacyWebKitScrollingLayerCoordinator::unregisterAllScrollingLayers): (WebCore::LegacyWebKitScrollingLayerCoordinator::removeScrollingLayer): 2019-02-02 Justin Fan [Web GPU] Fix GPURenderPassEncoder::setVertexBuffers and allow overlapping indices with GPUBindGroups https://bugs.webkit.org/show_bug.cgi?id=194125 Reviewed by Myles C. Maxfield. GPURenderPassEncoder::setVertexBuffers is now actually written to set all buffers provided. In addition, shift vertex input buffer indices so that any resource bindings can bind vertex buffer resources to the same indices. Existing tests cover setVertexBuffers. Updated buffer-resource-triangles to assign bind groups and vertex buffers to the same index. * Modules/webgpu/WHLSL/Metal/WHLSLVertexBufferIndexCalculator.cpp: Added. (WebCore::WHLSL::Metal::calculateVertexBufferIndex): Simple shifting function for vertex input buffer indices. * Modules/webgpu/WHLSL/Metal/WHLSLVertexBufferIndexCalculator.h: Added. * Modules/webgpu/WebGPUProgrammablePassEncoder.cpp: (WebCore::WebGPUProgrammablePassEncoder::setBindGroup const): Limit maximum bind group indices to 0 to 3. * Modules/webgpu/WebGPURenderPassEncoder.cpp: (WebCore::WebGPURenderPassEncoder::setVertexBuffers): Limit vertex input indices to 0 to 15. * Modules/webgpu/WebGPURenderPassEncoder.h: Move IDL/bindings bug note to IDL file. * Modules/webgpu/WebGPURenderPassEncoder.idl: Ditto. * platform/graphics/gpu/GPULimits.h: Added. Home for Web GPU limits constants shared between files. * platform/graphics/gpu/GPURenderPassEncoder.h: Change IDL/bindings bug workaround to unsigned long long to prevent narrowing compared to spec. * platform/graphics/gpu/cocoa/GPURenderPassEncoderMetal.mm: (WebCore::GPURenderPassEncoder::setVertexBuffers): Now properly calls Metal's setVertexBuffers. * platform/graphics/gpu/cocoa/GPURenderPipelineMetal.mm: (WebCore::setInputStateForPipelineDescriptor): Fix validation checks for vertex attribute numbers and vertex buffer indices. Add symbols to project: * Sources.txt: * WebCore.xcodeproj/project.pbxproj: 2019-02-01 Simon Fraser Async overflow scroll is jumpy on macOS if the main thread is busy https://bugs.webkit.org/show_bug.cgi?id=194184 Reviewed by Antti Koivisto. This change extends to macOS some existing overflow-scroll functionality for iOS. When an async scroll is in process in the scroll thread (or UI process), we periodically message back to the web process main thread with scroll position updates. These can trigger post-scroll compositing updates, but we need to ensure that this update doesn't clobber the scroll position of the native layers, which would trigger stutters. To do this we have the notion of a scroll position "sync" (ScrollingLayerPositionAction::Sync) which pokes the new value into the GraphicsLayer (hence making visible rect computations work), but doesn't propagate it to the platform layer. This patch wires up syncs for macOS during async overflow scrolling, coming out of AsyncScrollingCoordinator::updateScrollPositionAfterAsyncScroll(). In RenderLayerBacking, m_scrollingContentsLayer is renamed to m_scrolledContentsLayer, and I added updateScrollOffset() and setLocationOfScrolledContents() to handle the set vs. sync, and to keep the iOS vs macOS differences in one function. This allows for more code sharing in RenderLayerBacking::updateGeometry(). There's a confusing bit in the m_childClippingMaskLayer code (trac.webkit.org/178029) where the setOffsetFromRenderer() just looks wrong; it should match m_scrollingLayer. This code is never hit for Cocoa, which never has m_childClippingMaskLayer. * page/scrolling/mac/ScrollingTreeOverflowScrollingNodeMac.mm: (WebCore::ScrollingTreeOverflowScrollingNodeMac::setScrollPosition): Logging (WebCore::ScrollingTreeOverflowScrollingNodeMac::setScrollLayerPosition): Logging * rendering/RenderLayer.cpp: (WebCore::RenderLayer::RenderLayer): (WebCore::RenderLayer::scrollTo): * rendering/RenderLayer.h: Rename m_requiresScrollBoundsOriginUpdate to m_requiresScrollPositionReconciliation and make it available on all platforms. Just reorder m_adjustForIOSCaretWhenScrolling to reduce #ifdef nesting confusion. * rendering/RenderLayerBacking.cpp: (WebCore::RenderLayerBacking::updateDebugIndicators): (WebCore::RenderLayerBacking::destroyGraphicsLayers): (WebCore::RenderLayerBacking::updateGeometry): (WebCore::RenderLayerBacking::setLocationOfScrolledContents): (WebCore::RenderLayerBacking::updateScrollOffset): (WebCore::RenderLayerBacking::updateDrawsContent): (WebCore::RenderLayerBacking::updateScrollingLayers): (WebCore::RenderLayerBacking::paintingPhaseForPrimaryLayer const): (WebCore::RenderLayerBacking::parentForSublayers const): (WebCore::RenderLayerBacking::setContentsNeedDisplay): (WebCore::RenderLayerBacking::setContentsNeedDisplayInRect): (WebCore::RenderLayerBacking::paintContents): (WebCore::RenderLayerBacking::backingStoreMemoryEstimate const): * rendering/RenderLayerBacking.h: 2019-02-02 Zalan Bujtas [LFC] Initialize ICB's style with fixed width/height. https://bugs.webkit.org/show_bug.cgi?id=194188 Reviewed by Antti Koivisto. Let's set ICB's logical width/height to Fixed so that it's available when we try to resolve a box's height in FormattingContext::Geometry::computedHeightValue() by using the containing block's height (ICB in this case). * layout/LayoutState.cpp: (WebCore::Layout::LayoutState::LayoutState): * layout/LayoutState.h: * layout/layouttree/LayoutTreeBuilder.cpp: (WebCore::Layout::TreeBuilder::createLayoutTree): 2019-02-02 Zalan Bujtas [LFC] Add missing case to out-of-flow non-replaced horizontal used margin value computation https://bugs.webkit.org/show_bug.cgi?id=194185 Reviewed by Antti Koivisto. If none of horizontal values (left, right, width, margin-left/right) are auto, then usedHorizontalMarginValues = computedHorizontalMarginValues. Test: fast/block/block-only/absolute-position-left-right-margin.html * layout/FormattingContextGeometry.cpp: (WebCore::Layout::FormattingContext::Geometry::outOfFlowNonReplacedHorizontalGeometry): 2018-12-16 Darin Adler Convert additional String::format clients to alternative approaches https://bugs.webkit.org/show_bug.cgi?id=192746 Reviewed by Alexey Proskuryakov. This round of conversions covers less-trivial cases such as floating point numerals and hexadecimal. Not yet taking on pointer serialization ("%p") or padding with spaces of zero digits, so call sites using those have been left untouched. In some cases these new idioms are a bit clumsy, and we could follow up with additional convenience functions to make them more elegant. * Modules/indexeddb/IDBKeyData.cpp: (WebCore::IDBKeyData::loggingString const): Use more ASCIILiteral and more appendLiteral for efficiency. Use upperNibbleToLowercaseASCIIHexDigit, lowerNibbleToLowercaseASCIIHexDigit, and also makeString and FormattedNumber. * css/MediaQueryEvaluator.cpp: (WebCore::aspectRatioValueAsString): Use makeString and FormattedNumber. Doing it this way makes it a little clearer that we have an unpleasant use of fixed 6-digit precision here. * html/FTPDirectoryDocument.cpp: (WebCore::processFilesizeString): Use makeString and FormattedNumber. * html/track/VTTCue.cpp: (WebCore::VTTCueBox::applyCSSProperties): Ditto. * page/CaptionUserPreferencesMediaAF.cpp: (WebCore::CaptionUserPreferencesMediaAF::windowRoundedCornerRadiusCSS const): Ditto. * page/History.cpp: (WebCore::History::stateObjectAdded): Ditto. * page/cocoa/ResourceUsageOverlayCocoa.mm: (WebCore::formatByteNumber): Ditto. (WebCore::gcTimerString): Use String::number. (WebCore::ResourceUsageOverlay::platformDraw): Use makeString and FormattedNumber. * page/scrolling/AxisScrollSnapOffsets.cpp: (WebCore::snapOffsetsToString): Removed some unnecessary copying in the for loop, use appendLiteral, and use appendFixedWidthNumber. (WebCore::snapOffsetRangesToString): Ditto. (WebCore::snapPortOrAreaToString): Use makeString and FormattedNumber. * platform/animation/TimingFunction.cpp: (WebCore::TimingFunction::cssText const): Use makeString. * platform/cocoa/KeyEventCocoa.mm: (WebCore::keyIdentifierForCharCode): Use makeString and the ASCIIHexDigit functions. * platform/graphics/Color.cpp: (WebCore::Color::nameForRenderTreeAsText const): Ditto. * platform/mock/MockRealtimeVideoSource.cpp: (WebCore::MockRealtimeVideoSource::drawText): Use makeString and FormattedNumber. * platform/text/PlatformLocale.cpp: (WebCore::DateTimeStringBuilder::visitField): Use String::numberToStringFixedWidth. 2019-02-01 Simon Fraser Remove the unused layerForScrolling() https://bugs.webkit.org/show_bug.cgi?id=194180 Reviewed by Zalan Bujtas. Remove ScrollableArea::layerForScrolling() and derivations. This was unused. * page/FrameView.cpp: (WebCore::FrameView::layerForScrolling const): Deleted. * page/FrameView.h: * page/scrolling/ScrollingCoordinator.cpp: (WebCore::ScrollingCoordinator::scrollLayerForScrollableArea): Deleted. * page/scrolling/ScrollingCoordinator.h: * platform/ScrollableArea.h: (WebCore::ScrollableArea::layerForScrolling const): Deleted. * rendering/RenderLayer.cpp: (WebCore::RenderLayer::calculateClipRects const): * rendering/RenderLayer.h: 2019-02-01 Zalan Bujtas [LFC] Fix statically positioned replaced out-of-flow horizontal geometry https://bugs.webkit.org/show_bug.cgi?id=194163 Reviewed by Simon Fraser. Fix a typo. * layout/FormattingContextGeometry.cpp: (WebCore::Layout::FormattingContext::Geometry::outOfFlowReplacedHorizontalGeometry): 2019-02-01 Chris Dumez REGRESSION: Flaky ASSERTION FAILED: m_uncommittedState.state == State::Committed on http/tests/cookies/same-site/fetch-after-top-level-navigation-initiated-from-iframe-in-cross-origin-page.html https://bugs.webkit.org/show_bug.cgi?id=193740 Reviewed by Alex Christensen. * loader/DocumentLoader.cpp: (WebCore::DocumentLoader::willSendRequest): (WebCore::DocumentLoader::continueAfterContentPolicy): * loader/FrameLoader.cpp: (WebCore::FrameLoader::loadURL): (WebCore::FrameLoader::loadWithDocumentLoader): (WebCore::FrameLoader::continueLoadAfterNavigationPolicy): * loader/FrameLoader.h: * loader/FrameLoaderTypes.h: * loader/PolicyChecker.cpp: (WebCore::PolicyChecker::checkNavigationPolicy): (WebCore::PolicyChecker::checkNewWindowPolicy): * loader/PolicyChecker.h: 2019-02-01 Antoine Quint Dispatch pointercancel events when content is panned or zoomed on iOS https://bugs.webkit.org/show_bug.cgi?id=193962 Reviewed by Dean Jackson. Expose two new methods on PointerCaptureController so that, given a pointer id, it can be established whether this pointer has been cancelled, which is important because a cancelled pointer should no longer dispatch any further pointer events, and to cancel a pointer. Tests: pointerevents/ios/touch-action-pointercancel-pan-x.html pointerevents/ios/touch-action-pointercancel-pan-y.html pointerevents/ios/touch-action-pointercancel-pinch-zoom.html * WebCore.xcodeproj/project.pbxproj: Make PointerCaptureController.h Private so that it can be imported from WebKit. * dom/PointerEvent.h: Remove an unnecessary #if ENABLE(POINTER_EVENTS) since the entire file is already contained in one. Then we add a new create() method that takes an event type, a pointer id and a pointer type (touch vs. pen) that we use to create pointercancel events in PointerCaptureController::cancelPointer(). * page/Page.cpp: (WebCore::Page::Page): Pass the Page as a parameter when creating the PointerCaptureController. * page/PointerCaptureController.cpp: (WebCore::PointerCaptureController::PointerCaptureController): Add a Page reference to the constructor since we'll need the page to access its main frame's EventHandler to perform hit testing in case we do not have a capture target override in cancelPointer(). (WebCore::PointerCaptureController::releasePointerCapture): Drive-by, remove the the implicit parameter since on iOS we don't need to differentiate. We'll bring this back for the macOS work. (WebCore::PointerCaptureController::hasCancelledPointerEventForIdentifier): New method we'll use when dispatching pointer events to identify whether a pointer id has already been cancelled which will allow for _not_ dispatching any further pointer events for this pointer id. (WebCore::PointerCaptureController::pointerEventWillBeDispatched): Keep track of the pointer type so we can preserve it when dispatching pointercancel events for a given pointer id. (WebCore::PointerCaptureController::cancelPointer): Dispatch a pointercancel for the provided pointer id, using the capture target override as the event's target, if there is one, and otherwise hit-testing at the provided location to figure out what the target should be. * page/PointerCaptureController.h: Switch the target overrides from Element* to RefPtr to ensure it may not be deleted while we still need them. Existing code already ensures these get set to nullptr. 2019-02-01 Jer Noble Make the WebKit default for media source based on the WebCore default. https://bugs.webkit.org/show_bug.cgi?id=194172 Reviewed by Eric Carlson. * page/SettingsBase.h: 2019-02-01 Joseph Pecoraro Web Inspector: Memory timeline starts from zero when both CPU and Memory timeline are enabled https://bugs.webkit.org/show_bug.cgi?id=194111 Rubber-stamped by Devin Rousso. * page/ResourceUsageThread.cpp: (WebCore::ResourceUsageThread::waitUntilObservers): (WebCore::ResourceUsageThread::threadBody): Wait a short period of time before the first listener registers and we start sampling. This will allow multiple listeners to register, each that wants different data. 2019-02-01 Antti Koivisto Don't use base layer() as the scroll layer in scrolling tree. https://bugs.webkit.org/show_bug.cgi?id=194160 Reviewed by Simon Fraser. Maintain scrollContainerLayer() and scrolledContentsLayer() separately in ScrollingTreeScrollingNode. * page/scrolling/AsyncScrollingCoordinator.cpp: (WebCore::AsyncScrollingCoordinator::frameViewRootLayerDidChange): (WebCore::AsyncScrollingCoordinator::setNodeLayers): * page/scrolling/AsyncScrollingCoordinator.h: * page/scrolling/ScrollingCoordinator.h: (WebCore::ScrollingCoordinator::setNodeLayers): Turn the long layer parameter list into a struct. * page/scrolling/ScrollingStateNode.cpp: (WebCore::ScrollingStateNode::ScrollingStateNode): (WebCore::ScrollingStateNode::setAllPropertiesChanged): (WebCore::ScrollingStateNode::setLayer): * page/scrolling/ScrollingStateNode.h: * page/scrolling/ScrollingStateScrollingNode.cpp: (WebCore::ScrollingStateScrollingNode::ScrollingStateScrollingNode): (WebCore::ScrollingStateScrollingNode::setAllPropertiesChanged): (WebCore::ScrollingStateScrollingNode::setScrollContainerLayer): (WebCore::ScrollingStateScrollingNode::dumpProperties const): * page/scrolling/ScrollingStateScrollingNode.h: (WebCore::ScrollingStateScrollingNode::scrollContainerLayer const): * page/scrolling/ScrollingTree.cpp: (WebCore::ScrollingTree::commitTreeState): * page/scrolling/ScrollingTreeScrollingNode.cpp: (WebCore::ScrollingTreeScrollingNode::commitStateBeforeChildren): * page/scrolling/ScrollingTreeScrollingNode.h: (WebCore::ScrollingTreeScrollingNode::scrollContainerLayer const): (WebCore::ScrollingTreeScrollingNode::scrolledContentsLayer const): * page/scrolling/ios/ScrollingTreeFrameScrollingNodeIOS.h: * page/scrolling/ios/ScrollingTreeFrameScrollingNodeIOS.mm: (WebCore::ScrollingTreeFrameScrollingNodeIOS::commitStateBeforeChildren): (WebCore::ScrollingTreeFrameScrollingNodeIOS::scrollPosition const): (WebCore::ScrollingTreeFrameScrollingNodeIOS::setScrollLayerPosition): (WebCore::ScrollingTreeFrameScrollingNodeIOS::scrollLayer const): Deleted. * page/scrolling/mac/ScrollingTreeFixedNode.mm: (WebCore::ScrollingTreeFixedNode::commitStateBeforeChildren): * page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.h: * page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.mm: (WebCore::ScrollingTreeFrameScrollingNodeMac::commitStateBeforeChildren): (WebCore::ScrollingTreeFrameScrollingNodeMac::commitStateAfterChildren): (WebCore::ScrollingTreeFrameScrollingNodeMac::scrollPosition const): (WebCore::ScrollingTreeFrameScrollingNodeMac::setScrollLayerPosition): (WebCore::ScrollingTreeFrameScrollingNodeMac::exposedUnfilledArea const): * page/scrolling/mac/ScrollingTreeOverflowScrollingNodeMac.h: * page/scrolling/mac/ScrollingTreeOverflowScrollingNodeMac.mm: (WebCore::ScrollingTreeOverflowScrollingNodeMac::commitStateBeforeChildren): (WebCore::ScrollingTreeOverflowScrollingNodeMac::scrollPosition const): (WebCore::ScrollingTreeOverflowScrollingNodeMac::setScrollLayerPosition): * page/scrolling/mac/ScrollingTreeStickyNode.mm: (WebCore::ScrollingTreeStickyNode::commitStateBeforeChildren): * rendering/RenderLayerCompositor.cpp: (WebCore::RenderLayerCompositor::didChangePlatformLayerForLayer): (WebCore::RenderLayerCompositor::updateScrollingNodeForViewportConstrainedRole): (WebCore::RenderLayerCompositor::updateScrollingNodeForScrollingRole): (WebCore::RenderLayerCompositor::updateScrollingNodeForFrameHostingRole): 2019-02-01 Simon Fraser REGRESSION (r240698): fast/scrolling/sticky-to-fixed.html can cause a crash https://bugs.webkit.org/show_bug.cgi?id=194134 rdar://problem/47721210 Reviewed by Daniel Bates. fast/scrolling/sticky-to-fixed.html changes the scrolling node type, which causes scrollingCoordinator->insertNode() to return a different ScrollingNodeID to the one passed in. We have to handle this, removing the node for the nodeID and unregistering the layer with the old nodeID. * rendering/RenderLayerCompositor.cpp: (WebCore::RenderLayerCompositor::attachScrollingNode): 2019-02-01 Carlos Garcia Campos REGRESSION(r239915): css3/font-feature-font-face-local.html failing on WPE https://bugs.webkit.org/show_bug.cgi?id=194008 Reviewed by Žan Doberšek. We need to replace control characters with zero width space too. * platform/graphics/freetype/GlyphPageTreeNodeFreeType.cpp: (WebCore::GlyphPage::fill): * platform/text/CharacterProperties.h: (WebCore::isControlCharacter): 2019-02-01 Carlos Garcia Campos ComplexText: Test fast/text/word-space-nbsp.html fails when using complex text path https://bugs.webkit.org/show_bug.cgi?id=193279 Reviewed by Michael Catanzaro. The fix applied in r135884 to WidthIterator should also be applied to ComplexTextController. * platform/graphics/ComplexTextController.cpp: (WebCore::ComplexTextController::adjustGlyphsAndAdvances): 2019-02-01 Zalan Bujtas [LFC] Adjust replaced element's intrinsic ratio https://bugs.webkit.org/show_bug.cgi?id=194154 Reviewed by Antti Koivisto. Decouple image and iframe replaced types and set intrinsic ratio accordingly. * layout/layouttree/LayoutBox.cpp: (WebCore::Layout::Box::Box): * layout/layouttree/LayoutBox.h: (WebCore::Layout::Box::isReplaced const): (WebCore::Layout::Box::isIFrame const): (WebCore::Layout::Box::isImage const): * layout/layouttree/LayoutReplaced.cpp: (WebCore::Layout::Replaced::hasIntrinsicRatio const): (WebCore::Layout::Replaced::intrinsicRatio const): (WebCore::Layout::Replaced::hasAspectRatio const): * layout/layouttree/LayoutReplaced.h: * layout/layouttree/LayoutTreeBuilder.cpp: (WebCore::Layout::TreeBuilder::createSubTree): 2019-02-01 Zalan Bujtas [LFC] Set intrinsic size on Layout::Replaced https://bugs.webkit.org/show_bug.cgi?id=194139 Reviewed by Antti Koivisto. Eventually Layout::Replaced will track intrinsic size internally until then let's query the RenderReplaced. * layout/layouttree/LayoutBox.h: (WebCore::Layout::Box::replaced): * layout/layouttree/LayoutReplaced.cpp: (WebCore::Layout::Replaced::hasIntrinsicWidth const): (WebCore::Layout::Replaced::hasIntrinsicHeight const): (WebCore::Layout::Replaced::intrinsicWidth const): (WebCore::Layout::Replaced::intrinsicHeight const): * layout/layouttree/LayoutReplaced.h: (WebCore::Layout::Replaced::setIntrinsicSize): (WebCore::Layout::Replaced::setIntrinsicRatio): * layout/layouttree/LayoutTreeBuilder.cpp: (WebCore::Layout::TreeBuilder::createSubTree): * rendering/RenderReplaced.h: 2019-02-01 Claudio Saavedra Race-condition during scrolling thread creation https://bugs.webkit.org/show_bug.cgi?id=194016 Reviewed by Saam Barati. There is a threading issue during the initialization of the scrolling thread caused by createThreadIfNeeded locking only on the creation of the thread but not on the initialization of the main loop, making it possible for a thread to try to spin the main loop before it's created. Fix this by unconditionally waiting on the main loop being created. This makes it necessary to always hold the lock, even when the thread is already created. * page/scrolling/ScrollingThread.cpp: (WebCore::ScrollingThread::createThreadIfNeeded): 2019-02-01 Simon Fraser Use ScrollingNodeID in more places, and improve the name of a ScrollableArea function that returns a ScrollingNodeID https://bugs.webkit.org/show_bug.cgi?id=194126 Reviewed by Frédéric Wang. Change uint64_t ScrollableArea::scrollLayerID() to ScrollingNodeID ScrollableArea::scrollingNodeID() and fix callers. * page/FrameView.cpp: (WebCore::FrameView::scrollingNodeID const): (WebCore::FrameView::scrollLayerID const): Deleted. * page/FrameView.h: * page/scrolling/AsyncScrollingCoordinator.cpp: (WebCore::AsyncScrollingCoordinator::frameViewLayoutUpdated): (WebCore::AsyncScrollingCoordinator::updateExpectsWheelEventTestTriggerWithFrameView): (WebCore::AsyncScrollingCoordinator::frameViewRootLayerDidChange): (WebCore::AsyncScrollingCoordinator::requestScrollPositionUpdate): (WebCore::AsyncScrollingCoordinator::frameViewForScrollingNode const): (WebCore::AsyncScrollingCoordinator::updateScrollPositionAfterAsyncScroll): (WebCore::AsyncScrollingCoordinator::reconcileScrollingState): (WebCore::AsyncScrollingCoordinator::scrollableAreaScrollbarLayerDidChange): (WebCore::AsyncScrollingCoordinator::ensureRootStateNodeForFrameView): (WebCore::AsyncScrollingCoordinator::setSynchronousScrollingReasons): (WebCore::AsyncScrollingCoordinator::setActiveScrollSnapIndices): (WebCore::AsyncScrollingCoordinator::updateScrollSnapPropertiesWithFrameView): * page/scrolling/ScrollingCoordinatorTypes.h: * platform/ScrollTypes.h: * platform/ScrollableArea.h: (WebCore::ScrollableArea::scrollingNodeID const): (WebCore::ScrollableArea::scrollLayerID const): Deleted. * rendering/RenderLayerCompositor.cpp: (WebCore::RenderLayerCompositor::parentFrameContentLayers): (WebCore::RenderLayerCompositor::detachRootLayer): 2019-01-31 Myles C. Maxfield [WHLSL] Expressions can't be copyable https://bugs.webkit.org/show_bug.cgi?id=194116 Reviewed by Keith Rollin. Expressions have UniqueRef members, which can't be copied. Describe this constraint explicitly rather than implicitly. No new tests because there is no behavior change. * Modules/webgpu/WHLSL/AST/WHLSLEnumerationMemberLiteral.h: * Modules/webgpu/WHLSL/AST/WHLSLExpression.h: 2019-01-31 Takashi Komori [Curl] Remove unnecessary member from NetworkStorageSession. https://bugs.webkit.org/show_bug.cgi?id=194137 Reviewed by Don Olmstead. No new tests since there is no behavior change. * platform/network/NetworkStorageSession.h: * platform/network/curl/NetworkStorageSessionCurl.cpp: (WebCore::NetworkStorageSession::NetworkStorageSession): (WebCore::NetworkStorageSession::context const): Deleted. 2019-01-31 Jer Noble NSInvalidArgumentException in [WebAVSampleBufferErrorListener observeValueForKeyPath:ofObject:change:context:] https://bugs.webkit.org/show_bug.cgi?id=194123 Reviewed by Eric Carlson. According to crash logs, AVSampleBufferDisplayLayer.error can go from an NSError* to nil; when such a change is KVO'd, the NSKeyValueChangeNewKey is a NSNull. Detect this state and bail out early. * platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm: (-[WebAVSampleBufferErrorListener observeValueForKeyPath:ofObject:change:context:]): 2019-01-31 Jer Noble [Cocoa][EME] AirPlaying a FairPlay-protected HLS stream fails to decrypt https://bugs.webkit.org/show_bug.cgi?id=194114 Reviewed by Eric Carlson. The AVAssetResourceLoaderDelegate must explicitly... delegate responsibility for FairPlay key requests to the AVContentKeySession. * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm: (WebCore::MediaPlayerPrivateAVFoundationObjC::shouldWaitForLoadingOfResource): 2019-01-31 Megan Gardner Don't insert spaces at the beginning of a newline when using smart-copy-paste https://bugs.webkit.org/show_bug.cgi?id=194070 Reviewed by Tim Horton. If our inserted content end is at the beginning of a paragraph, do not insert a space. Also, if our inserted content beginning is at the end of a paragraph, do not insert a space. Test: editing/pasteboard/mac/copy-smartpaste-first-line-in-textarea.html * editing/ReplaceSelectionCommand.cpp: (WebCore::ReplaceSelectionCommand::addSpacesForSmartReplace): 2019-01-31 Justin Fan [WebGPU] Build fix: disable MTLCopyAllDevices call on non-Mac platforms https://bugs.webkit.org/show_bug.cgi?id=194120 Unreviewed build fix. No new tests; no change in behavior. * platform/graphics/gpu/cocoa/GPUDeviceMetal.mm: (WebCore::GPUDevice::create): Wrap problem code in #if PLATFORM(MAC). 2019-01-31 Simon Fraser Basic scrollability for async overflow scrolling on macOS https://bugs.webkit.org/show_bug.cgi?id=194093 Reviewed by Antti Koivisto. Give a ScrollingTreeOverflowScrollingNodeMac a ScrollingTreeScrollingNodeDelegateMac and have it keep track of its layers so basic scrolling works for async overflow scroll. * page/scrolling/mac/ScrollingTreeOverflowScrollingNodeMac.h: * page/scrolling/mac/ScrollingTreeOverflowScrollingNodeMac.mm: (WebCore::ScrollingTreeOverflowScrollingNodeMac::create): (WebCore::ScrollingTreeOverflowScrollingNodeMac::ScrollingTreeOverflowScrollingNodeMac): (WebCore::ScrollingTreeOverflowScrollingNodeMac::commitStateBeforeChildren): (WebCore::ScrollingTreeOverflowScrollingNodeMac::commitStateAfterChildren): (WebCore::ScrollingTreeOverflowScrollingNodeMac::handleWheelEvent): (WebCore::ScrollingTreeOverflowScrollingNodeMac::scrollPosition const): (WebCore::ScrollingTreeOverflowScrollingNodeMac::setScrollPosition): (WebCore::ScrollingTreeOverflowScrollingNodeMac::setScrollPositionWithoutContentEdgeConstraints): (WebCore::ScrollingTreeOverflowScrollingNodeMac::setScrollLayerPosition): * rendering/RenderLayerBacking.cpp: (WebCore::RenderLayerBacking::updateScrollingLayers): 2019-01-31 Simon Fraser Generalize ScrollingTreeScrollingNodeDelegate for use in macOS too, add a macOS subclass for frame/overflow scrolling https://bugs.webkit.org/show_bug.cgi?id=194080 Reviewed by Antti Koivisto. To share code between ScrollingTreeFrameScrollingNodeMac and ScrollingTreeOverflowScrollingNodeMac, build ScrollingTreeScrollingNodeDelegate for macOS too, and add some helper functions to ScrollingTreeScrollingNodeDelegate. Add a macOS subclass, ScrollingTreeScrollingNodeDelegateMac, which takes over the basic scrolling, rubber-banding and scroll snapping functionality from ScrollingTreeFrameScrollingNodeMac. The delegate owns the ScrollController and implements ScrollControllerClient. ScrollingTreeFrameScrollingNodeMac now owns a ScrollingTreeScrollingNodeDelegateMac. A future patch will add one to ScrollingTreeOverflowScrollingNodeMac. No behavior change. * SourcesCocoa.txt: * WebCore.xcodeproj/project.pbxproj: * page/scrolling/ScrollingTreeFrameScrollingNode.cpp: (WebCore::ScrollingTreeFrameScrollingNode::scrollBy): Deleted. (WebCore::ScrollingTreeFrameScrollingNode::scrollByWithoutContentEdgeConstraints): Deleted. * page/scrolling/ScrollingTreeFrameScrollingNode.h: (WebCore::ScrollingTreeFrameScrollingNode::frameScaleFactor const): * page/scrolling/ScrollingTreeNode.cpp: (WebCore::ScrollingTreeNode::isRootNode const): * page/scrolling/ScrollingTreeNode.h: * page/scrolling/ScrollingTreeScrollingNode.cpp: (WebCore::ScrollingTreeScrollingNode::commitStateBeforeChildren): (WebCore::ScrollingTreeScrollingNode::scrollBy): (WebCore::ScrollingTreeScrollingNode::scrollByWithoutContentEdgeConstraints): * page/scrolling/ScrollingTreeScrollingNode.h: (WebCore::ScrollingTreeScrollingNode::expectsWheelEventTestTrigger const): * page/scrolling/ScrollingTreeScrollingNodeDelegate.cpp: * page/scrolling/ScrollingTreeScrollingNodeDelegate.h: (WebCore::ScrollingTreeScrollingNodeDelegate::scrollPosition const): (WebCore::ScrollingTreeScrollingNodeDelegate::minimumScrollPosition const): (WebCore::ScrollingTreeScrollingNodeDelegate::maximumScrollPosition const): (WebCore::ScrollingTreeScrollingNodeDelegate::scrollableAreaSize const): (WebCore::ScrollingTreeScrollingNodeDelegate::totalContentsSize const): (WebCore::ScrollingTreeScrollingNodeDelegate::hasEnabledHorizontalScrollbar const): (WebCore::ScrollingTreeScrollingNodeDelegate::hasEnabledVerticalScrollbar const): (WebCore::ScrollingTreeScrollingNodeDelegate::horizontalScrollElasticity const): (WebCore::ScrollingTreeScrollingNodeDelegate::verticalScrollElasticity const): * page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.h: * page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.mm: (WebCore::ScrollingTreeFrameScrollingNodeMac::ScrollingTreeFrameScrollingNodeMac): (WebCore::ScrollingTreeFrameScrollingNodeMac::commitStateBeforeChildren): (WebCore::ScrollingTreeFrameScrollingNodeMac::handleWheelEvent): (WebCore::ScrollingTreeFrameScrollingNodeMac::minimumScrollPosition const): (WebCore::ScrollingTreeFrameScrollingNodeMac::maximumScrollPosition const): (WebCore::newGestureIsStarting): Deleted. (WebCore::ScrollingTreeFrameScrollingNodeMac::isAlreadyPinnedInDirectionOfGesture): Deleted. (WebCore::ScrollingTreeFrameScrollingNodeMac::allowsHorizontalStretching): Deleted. (WebCore::ScrollingTreeFrameScrollingNodeMac::allowsVerticalStretching): Deleted. (WebCore::ScrollingTreeFrameScrollingNodeMac::stretchAmount): Deleted. (WebCore::ScrollingTreeFrameScrollingNodeMac::pinnedInDirection): Deleted. (WebCore::ScrollingTreeFrameScrollingNodeMac::canScrollHorizontally): Deleted. (WebCore::ScrollingTreeFrameScrollingNodeMac::canScrollVertically): Deleted. (WebCore::ScrollingTreeFrameScrollingNodeMac::shouldRubberBandInDirection): Deleted. (WebCore::ScrollingTreeFrameScrollingNodeMac::immediateScrollBy): Deleted. (WebCore::ScrollingTreeFrameScrollingNodeMac::immediateScrollByWithoutContentEdgeConstraints): Deleted. (WebCore::ScrollingTreeFrameScrollingNodeMac::stopSnapRubberbandTimer): Deleted. (WebCore::ScrollingTreeFrameScrollingNodeMac::adjustScrollPositionToBoundsIfNecessary): Deleted. (WebCore::ScrollingTreeFrameScrollingNodeMac::scrollOffset const): Deleted. (WebCore::ScrollingTreeFrameScrollingNodeMac::immediateScrollOnAxis): Deleted. (WebCore::ScrollingTreeFrameScrollingNodeMac::pageScaleFactor const): Deleted. (WebCore::ScrollingTreeFrameScrollingNodeMac::startScrollSnapTimer): Deleted. (WebCore::ScrollingTreeFrameScrollingNodeMac::stopScrollSnapTimer): Deleted. (WebCore::ScrollingTreeFrameScrollingNodeMac::scrollExtent const): Deleted. (WebCore::ScrollingTreeFrameScrollingNodeMac::viewportSize const): Deleted. (WebCore::ScrollingTreeFrameScrollingNodeMac::deferTestsForReason const): Deleted. (WebCore::ScrollingTreeFrameScrollingNodeMac::removeTestDeferralForReason const): Deleted. * page/scrolling/mac/ScrollingTreeScrollingNodeDelegateMac.h: Copied from Source/WebCore/page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.h. * page/scrolling/mac/ScrollingTreeScrollingNodeDelegateMac.mm: Added. (WebCore::ScrollingTreeScrollingNodeDelegateMac::ScrollingTreeScrollingNodeDelegateMac): (WebCore::ScrollingTreeScrollingNodeDelegateMac::updateScrollSnapPoints): (WebCore::ScrollingTreeScrollingNodeDelegateMac::setActiveScrollSnapIndexForAxis): (WebCore::ScrollingTreeScrollingNodeDelegateMac::activeScrollSnapIndexForAxis const): (WebCore::ScrollingTreeScrollingNodeDelegateMac::activeScrollSnapIndexDidChange const): (WebCore::ScrollingTreeScrollingNodeDelegateMac::handleWheelEvent): (WebCore::ScrollingTreeScrollingNodeDelegateMac::isScrollSnapInProgress const): (WebCore::newGestureIsStarting): (WebCore::ScrollingTreeScrollingNodeDelegateMac::isAlreadyPinnedInDirectionOfGesture): (WebCore::ScrollingTreeScrollingNodeDelegateMac::allowsHorizontalStretching): (WebCore::ScrollingTreeScrollingNodeDelegateMac::allowsVerticalStretching): (WebCore::ScrollingTreeScrollingNodeDelegateMac::stretchAmount): (WebCore::ScrollingTreeScrollingNodeDelegateMac::pinnedInDirection): (WebCore::ScrollingTreeScrollingNodeDelegateMac::canScrollHorizontally): (WebCore::ScrollingTreeScrollingNodeDelegateMac::canScrollVertically): (WebCore::ScrollingTreeScrollingNodeDelegateMac::shouldRubberBandInDirection): (WebCore::ScrollingTreeScrollingNodeDelegateMac::immediateScrollBy): (WebCore::ScrollingTreeScrollingNodeDelegateMac::immediateScrollByWithoutContentEdgeConstraints): (WebCore::ScrollingTreeScrollingNodeDelegateMac::stopSnapRubberbandTimer): (WebCore::ScrollingTreeScrollingNodeDelegateMac::adjustScrollPositionToBoundsIfNecessary): (WebCore::ScrollingTreeScrollingNodeDelegateMac::scrollOffset const): (WebCore::ScrollingTreeScrollingNodeDelegateMac::immediateScrollOnAxis): (WebCore::ScrollingTreeScrollingNodeDelegateMac::pageScaleFactor const): (WebCore::ScrollingTreeScrollingNodeDelegateMac::startScrollSnapTimer): (WebCore::ScrollingTreeScrollingNodeDelegateMac::stopScrollSnapTimer): (WebCore::ScrollingTreeScrollingNodeDelegateMac::scrollExtent const): (WebCore::ScrollingTreeScrollingNodeDelegateMac::viewportSize const): (WebCore::ScrollingTreeScrollingNodeDelegateMac::deferTestsForReason const): (WebCore::ScrollingTreeScrollingNodeDelegateMac::removeTestDeferralForReason const): 2019-01-31 Jer Noble [Mac] Requesting PiP from two different WebViews gets PiP window "stuck" https://bugs.webkit.org/show_bug.cgi?id=194099 Reviewed by Eric Carlson. When a different client requests the PiP window, the PiP framework will call -pipDidClose: without first calling -pipActionStop:. This leaves the internal fullscreen state in a confused state where the WebView will attempt to re-enter PiP once it gets focus, and can lead to a state where the two WebViews will constantly try to steal PiP from one another, ad infinitum. When receiving a notification that the PiP window closed when our internal state tells us that the close was not requested, notify the client that PiP mode was exited, allowing them to set their expected state to a correct and sane value. * platform/mac/VideoFullscreenInterfaceMac.mm: (-[WebVideoFullscreenInterfaceMacObjC pipDidClose:]): 2019-01-31 Keith Rollin WebCore::WHLSL::AST::Expression copy constructor needs to be be default, not delete https://bugs.webkit.org/show_bug.cgi?id=194055 Reviewed by Myles C. Maxfield. WebCore::WHLSL::AST::Expression has a deleted copy constructor. EnumerationMemberLiteral, a subclass, has a default copy constructor. Some compilers may complain that the latter's c'tor can't access the former's, because it doesn't exist. Fix this by marking Expression's c'tor as default. No new tests since there should be no observable behavior difference. * Modules/webgpu/WHLSL/AST/WHLSLExpression.h: 2019-01-31 Alex Christensen Revert r238819 which is unneeded and caused a performance regression. https://bugs.webkit.org/show_bug.cgi?id=192272 * loader/EmptyFrameLoaderClient.h: * loader/FrameLoader.cpp: (WebCore::FrameLoader::prepareForLoadStart): (WebCore::FrameLoader::continueLoadAfterNavigationPolicy): (WebCore::FrameLoader::loadProvisionalItemFromCachedPage): * loader/FrameLoader.h: * loader/FrameLoaderClient.h: 2019-01-31 Justin Fan [WebGPU] WebGPUAdapterDescriptor -> GPURequestAdapterOptions and take powerPreference into account https://bugs.webkit.org/show_bug.cgi?id=194068 Reviewed by Dean Jackson. Per the Web GPU IDL, WebGPUAdapterDescriptor is now known as GPURequestAdapterOptions and is optional. In addition, Web GPU now actually attempts to return an integrated GPU when a low-power adapter is requested. Test: adapter-options.html * Modules/webgpu/GPURequestAdapterOptions.idl: Renamed from Source/WebCore/Modules/webgpu/WebGPUAdapterDescriptor.idl. * Modules/webgpu/WebGPU.cpp: (WebCore::WebGPU::requestAdapter const): * Modules/webgpu/WebGPU.h: * Modules/webgpu/WebGPU.idl: * Modules/webgpu/WebGPUAdapter.cpp: (WebCore::WebGPUAdapter::create): (WebCore::WebGPUAdapter::WebGPUAdapter): * Modules/webgpu/WebGPUAdapter.h: (WebCore::WebGPUAdapter::options const): * Modules/webgpu/WebGPUDevice.cpp: (WebCore::WebGPUDevice::create): * platform/graphics/gpu/GPUDevice.h: * platform/graphics/gpu/GPURequestAdapterOptions.h: Renamed from Source/WebCore/Modules/webgpu/WebGPUAdapterDescriptor.h. * platform/graphics/gpu/cocoa/GPUDeviceMetal.mm: (WebCore::GPUDevice::create): 2019-01-31 Jiewen Tan Formalize WebKitAdditions mechanism of LoadOptimizer https://bugs.webkit.org/show_bug.cgi?id=193886 Reviewed by Brent Fulgham. Covered by existing tests. * platform/network/ResourceRequestBase.h: Export isolatedCopy(). 2019-01-31 Jer Noble [Cocoa][EME] Modern EME uses a different path for SecureStop data than Legacy EME https://bugs.webkit.org/show_bug.cgi?id=193988 Reviewed by Jon Lee. Modern EME is writing SecureStop data as a file at the same path as the directory used by Legacy EME; meaning, when Modern EME attempts to write to that file, it will fail because a directory exists at the same path. Add a migration step to take care of those instances where Modern EME Secure Stop data was already written to disk, and move that previously written data to the correct file path. * platform/graphics/avfoundation/objc/CDMInstanceFairPlayStreamingAVFObjC.h: * platform/graphics/avfoundation/objc/CDMInstanceFairPlayStreamingAVFObjC.mm: (WebCore::CDMInstanceFairPlayStreamingAVFObjC::initializeWithConfiguration): (WebCore::CDMInstanceFairPlayStreamingAVFObjC::setStorageDirectory): (WebCore::CDMInstanceSessionFairPlayStreamingAVFObjC::updateLicense): (WebCore::CDMInstanceSessionFairPlayStreamingAVFObjC::loadSession): (WebCore::CDMInstanceSessionFairPlayStreamingAVFObjC::removeSessionData): (WebCore::CDMInstanceSessionFairPlayStreamingAVFObjC::ensureSession): 2019-01-31 Antti Koivisto Call the frame main contents layer "rootContentsLayer" consistently. https://bugs.webkit.org/show_bug.cgi?id=194089 Reviewed by Simon Fraser. This is currently called "rootContentLayer" in the compositor and "scrolledContentsLayer" in the scrolling tree. We want to reserve term "scrolledContentsLayer" to mean the direct child layer of the scroll container layer without any positioning oddities (which this isn't). * page/scrolling/AsyncScrollingCoordinator.cpp: (WebCore::AsyncScrollingCoordinator::frameViewRootLayerDidChange): (WebCore::AsyncScrollingCoordinator::reconcileScrollingState): (WebCore::AsyncScrollingCoordinator::setNodeLayers): Set the rootContentsLayer for frame. It is only used by the Mac frame scrolling code. * page/scrolling/AsyncScrollingCoordinator.h: * page/scrolling/ScrollingCoordinator.cpp: (WebCore::ScrollingCoordinator::rootContentsLayerForFrameView): (WebCore::ScrollingCoordinator::rootContentLayerForFrameView): Deleted. * page/scrolling/ScrollingCoordinator.h: (WebCore::ScrollingCoordinator::setNodeLayers): * page/scrolling/ScrollingStateFrameScrollingNode.cpp: (WebCore::ScrollingStateFrameScrollingNode::ScrollingStateFrameScrollingNode): (WebCore::ScrollingStateFrameScrollingNode::setAllPropertiesChanged): (WebCore::ScrollingStateFrameScrollingNode::setRootContentsLayer): (WebCore::ScrollingStateFrameScrollingNode::dumpProperties const): * page/scrolling/ScrollingStateFrameScrollingNode.h: Introduce rootContentLayer for frames only. * page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.h: * page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.mm: (WebCore::ScrollingTreeFrameScrollingNodeMac::commitStateBeforeChildren): (WebCore::ScrollingTreeFrameScrollingNodeMac::setScrollLayerPosition): Switch to using rootContentsLayer. * rendering/RenderLayerCompositor.cpp: (WebCore::RenderLayerCompositor::didChangePlatformLayerForLayer): (WebCore::RenderLayerCompositor::updateCompositingLayers): (WebCore::RenderLayerCompositor::updateRootContentLayerClipping): (WebCore::RenderLayerCompositor::layerTreeAsText): (WebCore::RenderLayerCompositor::rootGraphicsLayer const): (WebCore::RenderLayerCompositor::updateRootLayerPosition): (WebCore::RenderLayerCompositor::updateLayerForTopOverhangArea): (WebCore::RenderLayerCompositor::updateLayerForBottomOverhangArea): (WebCore::RenderLayerCompositor::updateLayerForHeader): (WebCore::RenderLayerCompositor::updateLayerForFooter): (WebCore::RenderLayerCompositor::updateOverflowControlsLayers): (WebCore::RenderLayerCompositor::ensureRootLayer): (WebCore::RenderLayerCompositor::destroyRootLayer): (WebCore::RenderLayerCompositor::attachRootLayer): (WebCore::RenderLayerCompositor::detachRootLayer): (WebCore::RenderLayerCompositor::rootLayerAttachmentChanged): (WebCore::RenderLayerCompositor::updateScrollingNodeForScrollingRole): Pass rootContentsLayer separately for frames only. Pass null as frame scrolledContentsLayer until these are rearranged (it is not used). * rendering/RenderLayerCompositor.h: 2019-01-31 Keith Rollin GCGamepad is deprecated https://bugs.webkit.org/show_bug.cgi?id=194056 Reviewed by Brady Eidson. GCGamepad is deprecated, resulting in compiler warnings. Address this for now by employing ALLOW_DEPRECATED_DECLARATIONS_BEGIN/END. No new tests since there should be no observable behavior difference. * platform/gamepad/cocoa/GameControllerGamepad.mm: (WebCore::GameControllerGamepad::setupAsGamepad): 2019-01-31 Darin Adler Simplify and streamline code that creates an appropriate document based on MIME type https://bugs.webkit.org/show_bug.cgi?id=193756 Reviewed by Chris Dumez. * dom/DOMImplementation.cpp: (WebCore::DOMImplementation::createDocument): Use equalLettersIgnoringASCIICase rather than == for all the MIME type checks. Use MIMETypeRegistry::isSupportedImageMIMEType instead of Image::supportsType. Rearranged checks so that all the combinations that that take precedence over plug-ins are checked first, fixing some unimportant edge cases where the plug-in database is initialized and doesn't need to be. Straightened out the logic for various special types so that the checks are more independent from each other and hence easier to understand. 2019-01-31 Alicia Boya García [MSE][GStreamer] Unreviewed debug build fix, obsolete assert Since m_playerPrivate is now a reference, it no longer has a default cast to bool. But there is also no longer a need to assert it's non null, so just remove the assert. * platform/graphics/gstreamer/mse/MediaSourceClientGStreamerMSE.cpp: (WebCore::MediaSourceClientGStreamerMSE::append): 2019-01-31 Alicia Boya García [MSE][GStreamer] Use reference instead of pointer in m_playerPrivate https://bugs.webkit.org/show_bug.cgi?id=194091 Reviewed by Xabier Rodriguez-Calvar. Since the pointer is initialized with the class, it's never null and never changes, it's preferrable to use a reference instead of a pointer. * platform/graphics/gstreamer/mse/MediaSourceClientGStreamerMSE.cpp: (WebCore::MediaSourceClientGStreamerMSE::MediaSourceClientGStreamerMSE): (WebCore::MediaSourceClientGStreamerMSE::addSourceBuffer): (WebCore::MediaSourceClientGStreamerMSE::durationChanged): (WebCore::MediaSourceClientGStreamerMSE::abort): (WebCore::MediaSourceClientGStreamerMSE::resetParserState): (WebCore::MediaSourceClientGStreamerMSE::append): (WebCore::MediaSourceClientGStreamerMSE::markEndOfStream): (WebCore::MediaSourceClientGStreamerMSE::removedFromMediaSource): (WebCore::MediaSourceClientGStreamerMSE::flush): (WebCore::MediaSourceClientGStreamerMSE::enqueueSample): (WebCore::MediaSourceClientGStreamerMSE::allSamplesInTrackEnqueued): (WebCore::MediaSourceClientGStreamerMSE::webKitMediaSrc): * platform/graphics/gstreamer/mse/MediaSourceClientGStreamerMSE.h: 2019-01-31 Alexander Mikhaylenko [GTK] Momentum scrolling stops abruptly before websites end https://bugs.webkit.org/show_bug.cgi?id=193350 Reviewed by Carlos Garcia Campos. Don't immediately set velocity to 0 when position reaches upper or bottom limit. Instead, set it to the overshot distance, so that position exactly matches upper or lower limit on the next frame, and then clamp velocity to 0 using the existing mechanism. * platform/ScrollAnimationKinetic.cpp: (WebCore::ScrollAnimationKinetic::PerAxisData::animateScroll): 2019-01-31 Michael Catanzaro Unreviewed, fix incorrect string format https://bugs.webkit.org/show_bug.cgi?id=193907 * page/scrolling/ScrollingTree.cpp: (WebCore::ScrollingTree::commitTreeState): 2019-01-30 Simon Fraser [Mac] Implement basic hit testing in the scrolling tree https://bugs.webkit.org/show_bug.cgi?id=172917 Reviewed by Antti Koivisto. First steps to getting hit testing of scrolling nodes in the scrolling tree. Based on patch by Frédéric Wang. First we pipe the "async scrolling enabled" setting through to the ScrollingTree via the root node (like the other settings; weird, but that's how it's done). For now, we hit test in the scrolling tree if either async overflow or frame scrolling are enabled (it's hard to deal with one without the other). Nodes in the scrolling tree implement scrollingNodeForPoint() to implement hit testing. Two helper functions exist to simplify coordinate conversion: parentToLocalPoint() and localToContentsPoint(). Child nodes are hit-testing in reverse order to find nodes hightest in Z first. Only scrolling nodes are returned (not sure if we'll ever need to hit-test non-scrolling nodes). Nodes use parentRelativeScrollableRect and scroll positions to do these point mappings. handleWheelEvent() is changed to return a ScrollingEventResult. Latching is not correct with this change when async frame scrolling is enabled. That needs to be fixed separately. No tests yet; for ease of testing, I'd like to add an Internals API to hit-test the scrolling tree, rather than doing eventSender stuff everywhere. * page/scrolling/AsyncScrollingCoordinator.cpp: (WebCore::AsyncScrollingCoordinator::frameViewLayoutUpdated): (WebCore::AsyncScrollingCoordinator::asyncFrameOrOverflowScrollingEnabled const): * page/scrolling/AsyncScrollingCoordinator.h: * page/scrolling/ScrollingStateFrameScrollingNode.cpp: (WebCore::ScrollingStateFrameScrollingNode::ScrollingStateFrameScrollingNode): (WebCore::ScrollingStateFrameScrollingNode::setAllPropertiesChanged): (WebCore::ScrollingStateFrameScrollingNode::setAsyncFrameOrOverflowScrollingEnabled): * page/scrolling/ScrollingStateFrameScrollingNode.h: * page/scrolling/ScrollingTree.cpp: (WebCore::ScrollingTree::shouldHandleWheelEventSynchronously): (WebCore::ScrollingTree::handleWheelEvent): (WebCore::ScrollingTree::commitTreeState): (WebCore::ScrollingTree::setAsyncFrameOrOverflowScrollingEnabled): * page/scrolling/ScrollingTree.h: (WebCore::ScrollingTree::asyncFrameOrOverflowScrollingEnabled const): * page/scrolling/ScrollingTreeFrameHostingNode.cpp: (WebCore::ScrollingTreeFrameHostingNode::parentToLocalPoint const): * page/scrolling/ScrollingTreeFrameHostingNode.h: * page/scrolling/ScrollingTreeFrameScrollingNode.cpp: (WebCore::ScrollingTreeFrameScrollingNode::parentToLocalPoint const): (WebCore::ScrollingTreeFrameScrollingNode::localToContentsPoint const): * page/scrolling/ScrollingTreeFrameScrollingNode.h: * page/scrolling/ScrollingTreeNode.cpp: (WebCore::ScrollingTreeNode::scrollingNodeForPoint const): * page/scrolling/ScrollingTreeNode.h: (WebCore::ScrollingTreeNode::children const): (WebCore::ScrollingTreeNode::parentToLocalPoint const): (WebCore::ScrollingTreeNode::localToContentsPoint const): * page/scrolling/ScrollingTreeScrollingNode.cpp: (WebCore::ScrollingTreeScrollingNode::scrollLimitReached const): (WebCore::ScrollingTreeScrollingNode::parentToLocalPoint const): (WebCore::ScrollingTreeScrollingNode::localToContentsPoint const): (WebCore::ScrollingTreeScrollingNode::scrollingNodeForPoint const): * page/scrolling/ScrollingTreeScrollingNode.h: * page/scrolling/ThreadedScrollingTree.cpp: (WebCore::ThreadedScrollingTree::handleWheelEvent): * page/scrolling/ThreadedScrollingTree.h: * page/scrolling/ios/ScrollingTreeFrameScrollingNodeIOS.h: * page/scrolling/ios/ScrollingTreeFrameScrollingNodeIOS.mm: (WebCore::ScrollingTreeFrameScrollingNodeIOS::handleWheelEvent): * page/scrolling/ios/ScrollingTreeIOS.h: * page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.h: * page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.mm: (WebCore::ScrollingTreeFrameScrollingNodeMac::handleWheelEvent): * page/scrolling/mac/ScrollingTreeOverflowScrollingNodeMac.h: 2019-01-31 Alicia Boya García [MSE][GStreamer] Remove unused GstFlowReturn in AppendPipeline methods https://bugs.webkit.org/show_bug.cgi?id=194067 Reviewed by Xabier Rodriguez-Calvar. A couple methods in AppendPipeline were returning GstFlowReturn despite there being no codepath (sans assertions) where values other than GST_FLOW_OK are returned. Therefore, it makes sense to just make these methods return void. * platform/graphics/gstreamer/mse/AppendPipeline.cpp: (WebCore::AppendPipeline::pushNewBuffer): (WebCore::AppendPipeline::handleAppsinkNewSampleFromStreamingThread): * platform/graphics/gstreamer/mse/AppendPipeline.h: * platform/graphics/gstreamer/mse/MediaSourceClientGStreamerMSE.cpp: (WebCore::MediaSourceClientGStreamerMSE::append): * platform/graphics/gstreamer/mse/MediaSourceClientGStreamerMSE.h: * platform/graphics/gstreamer/mse/SourceBufferPrivateGStreamer.cpp: (WebCore::SourceBufferPrivateGStreamer::append): 2019-01-31 Alicia Boya García [MSE][GStreamer] Remove if (m_playerPrivate) from MediaSourceClientGStreamerMSE https://bugs.webkit.org/show_bug.cgi?id=194069 Reviewed by Xabier Rodriguez-Calvar. m_playerPrivate is non-NULL since MediaSourceClientGStreamerMSE creation well until its destruction. The only case that could make a NULL m_playerPrivate is clearPlayerPrivate() but that method is not used anymore. * platform/graphics/gstreamer/mse/MediaSourceClientGStreamerMSE.cpp: (WebCore::MediaSourceClientGStreamerMSE::addSourceBuffer): (WebCore::MediaSourceClientGStreamerMSE::durationChanged): (WebCore::MediaSourceClientGStreamerMSE::abort): (WebCore::MediaSourceClientGStreamerMSE::resetParserState): (WebCore::MediaSourceClientGStreamerMSE::markEndOfStream): (WebCore::MediaSourceClientGStreamerMSE::removedFromMediaSource): (WebCore::MediaSourceClientGStreamerMSE::flush): (WebCore::MediaSourceClientGStreamerMSE::enqueueSample): (WebCore::MediaSourceClientGStreamerMSE::allSamplesInTrackEnqueued): (WebCore::MediaSourceClientGStreamerMSE::webKitMediaSrc): (WebCore::MediaSourceClientGStreamerMSE::clearPlayerPrivate): Deleted. * platform/graphics/gstreamer/mse/MediaSourceClientGStreamerMSE.h: 2019-01-31 Thibault Saunier [GStreamer][WebRTC] Avoid returning FLUSHING when it is not the case in GStreamerMediaStreamSource https://bugs.webkit.org/show_bug.cgi?id=194087 Basically GstFlowCombiner was mostly designed for element that have 1 sinkpad and several srcpad meaning that it makes sense that when any of the downstream pad is returning flushing, you should return FLUSHING upstream. But in our case we have several sinkpads and FLUSHING should be returned *only* if the internally linked srcpad is FLUSHING otherwise we might end up setting the upstream source element task to PAUSED (because downstream returned flushing) on a branch that was not flushing! Reviewed by Philippe Normand. This is a theorical race we can't really cover with tests. * platform/mediastream/gstreamer/GStreamerMediaStreamSource.cpp: (WebCore::webkitMediaStreamSrcChain): 2019-01-31 Zalan Bujtas [LFC] Margin before/after/start/end initial value is 0 and not auto. https://bugs.webkit.org/show_bug.cgi?id=194090 Reviewed by Antti Koivisto. Don't treat it like auto. * layout/FormattingContextGeometry.cpp: (WebCore::Layout::FormattingContext::Geometry::outOfFlowReplacedVerticalGeometry): (WebCore::Layout::FormattingContext::Geometry::outOfFlowReplacedHorizontalGeometry): 2019-01-31 Zalan Bujtas [LFC] Use the used margin values in outOfFlowReplacedHorizontalGeometry consistently https://bugs.webkit.org/show_bug.cgi?id=194074 Reviewed by Antti Koivisto. Check the used margin variables whether we already computed start/end values. Test: fast/block/block-only/absolute-position-with-margin-auto-simple2.html * layout/FormattingContextGeometry.cpp: (WebCore::Layout::FormattingContext::Geometry::outOfFlowReplacedHorizontalGeometry): 2019-01-31 Zalan Bujtas [LFC][BFC] Add support for block level replaced box. https://bugs.webkit.org/show_bug.cgi?id=194071 Reviewed by Antti Koivisto. * layout/layouttree/LayoutBox.cpp: (WebCore::Layout::Box::Box): * layout/layouttree/LayoutBox.h: * layout/layouttree/LayoutTreeBuilder.cpp: (WebCore::Layout::TreeBuilder::createSubTree): (WebCore::Layout::outputLayoutBox): 2019-01-31 Chris Fleizach ASSERTION FAILED: cache under WebCore::AXObjectCache::postTextStateChangePlatformNotification https://bugs.webkit.org/show_bug.cgi?id=189094 Reviewed by Zalan Bujtas. Protect against access to objects and cache's that can be removed while an object is still in memory. Unskipped flaky tests on mac-wk2. * accessibility/mac/AXObjectCacheMac.mm: (WebCore::AXObjectCache::postTextStateChangePlatformNotification): * accessibility/mac/WebAccessibilityObjectWrapperMac.mm: (textMarkerForVisiblePosition): (textMarkerRangeFromVisiblePositions): 2019-01-30 Chris Dumez Regression(PSON) History navigations to twitter.com lead to a 403 HTTP error https://bugs.webkit.org/show_bug.cgi?id=194023 Reviewed by Geoffrey Garen. The issue was caused by the 'isTopSite' flag not getting properly set on the network request in case of a cross-site history navigation (with process-swap). As a result, twitter.com was not getting its same-site lax cookies. The 'isTopSite' flag normally gets set by FrameLoader::addExtraFieldsToRequest(), but we were bypassing this method entirely when continuing a load in a new process after a swap. This was intentional as the network request is normally already fully populated by the previous process and we do not want the new process to modify the request in any way (e.g. we would not want to add a Origin header back after it was removed by the previous process). However, in case of a History navigation, we do not actually pass a request along from one process to another. Instead, we pass a HistoryItem and then build a fresh new request from the HistoryItem in the new process. In this case, we *want* addExtraFieldsToRequest() to be called on the new request, even though we are technically continuing a load in a new process. We thus address the issue by bypassing FrameLoader::addExtraFieldsToRequest() only if we're continuing a load with a request and not when we're continuing a load with a HistoryItem. Test: http/tests/cookies/same-site/lax-samesite-cookie-after-cross-site-history-load.php * loader/FrameLoader.cpp: (WebCore::FrameLoader::load): (WebCore::FrameLoader::loadWithDocumentLoader): (WebCore::FrameLoader::addExtraFieldsToRequest): (WebCore::FrameLoader::loadDifferentDocumentItem): * loader/FrameLoader.h: (WebCore::FrameLoader::shouldTreatCurrentLoadAsContinuingLoad const): 2019-01-30 Justin Fan [WebGPU] Support GPUDepthStencilStateDescriptor https://bugs.webkit.org/show_bug.cgi?id=194048 Reviewed by Dean Jackson. Implement GPUDepthStencilStateDescriptor to specify a MTLDepthStencilState that is set on the command encoder. Existing tests cover changes to pipeline. Behavior does not change as DepthStencilState has no effect without a depth texture attached. New interface files added: * Modules/webgpu/GPUCompareFunction.idl: * Modules/webgpu/GPUDepthStencilStateDescriptor.idl: * platform/graphics/gpu/GPUCompareFunction.h: * platform/graphics/gpu/GPUDepthStencilStateDescriptor.h: Modifications: * Modules/webgpu/WebGPUDevice.cpp: Include depthStencilState when creating pipeline. (WebCore::WebGPUDevice::createRenderPipeline const): * Modules/webgpu/WebGPURenderPipelineDescriptor.h: Add depthStencilState to the descriptor. * Modules/webgpu/WebGPURenderPipelineDescriptor.idl: Ditto. * platform/graphics/gpu/GPURenderPipeline.h: Ditto. (WebCore::GPURenderPipeline::depthStencilState const): Getter. (WebCore::GPURenderPipeline::platformRenderPipeline const): * platform/graphics/gpu/GPURenderPipelineDescriptor.h: Update constructor to take depthStencilState. (WebCore::GPURenderPipelineDescriptor::GPURenderPipelineDescriptor): * platform/graphics/gpu/cocoa/GPURenderPassEncoderMetal.mm: Setting pipeline also sets the included depthStencilState. (WebCore::GPURenderPassEncoder::setPipeline): * platform/graphics/gpu/cocoa/GPURenderPipelineMetal.mm: Convert DepthStencilStateDescriptor to MTLDepthStencilState. (WebCore::validateAndConvertDepthCompareFunctionToMtl): (WebCore::tryCreateMtlDepthStencilState): (WebCore::tryCreateMtlRenderPipelineState): Refactored logic out of GPURenderPipeline::create. (WebCore::GPURenderPipeline::create): (WebCore::GPURenderPipeline::GPURenderPipeline): Added symbols for CompareFunction, DepthStencilStateDescriptor to the project: * CMakeLists.txt: * DerivedSources.make: * Sources.txt: * WebCore.xcodeproj/project.pbxproj: * Modules/webgpu/WebGPUDevice.idl: Cleaned up IDL to match current version. 2019-01-30 Jer Noble [Cocoa][EME] persistent-usage-record data not issued after MediaKeySession.remove() https://bugs.webkit.org/show_bug.cgi?id=193984 Reviewed by Eric Carlson. MediaKeySession.sessionId is empty during the CDMInstance->requestLicense success callback handler. The KVO notification that AVContentKeySession.contentProtectionSessionIdentifier changed isn't called until after the -[AVContentKeyRequest makeStreamingContentKeyRequestDataForApp:contentIdentifier:options:completionHandler:] completion handler is called. Explicitly ask for the -contentProtectionSessionIdentifier inside that handler, and just in case the sessionID changes after that, add a new client callback method to notify the MediaKeySession that the ID has changed. * Modules/encryptedmedia/MediaKeySession.cpp: (WebCore::MediaKeySession::sessionIdChanged): * Modules/encryptedmedia/MediaKeySession.h: * platform/encryptedmedia/CDMInstanceSession.h: * platform/graphics/avfoundation/objc/CDMInstanceFairPlayStreamingAVFObjC.mm: (WebCore::CDMInstanceSessionFairPlayStreamingAVFObjC::didProvideRequest): (WebCore::CDMInstanceSessionFairPlayStreamingAVFObjC::nextRequest): 2019-01-30 Keith Rollin FloatWithRect has invalid and inaccessible default constructor https://bugs.webkit.org/show_bug.cgi?id=194057 Reviewed by Zalan Bujtas. FloatWithRect has a default constructor declared as 'default'. This constructor is invalid because FloatWithRect has a data member that's a reference that will not get initialized with this constructor. Since it's invalid, and since it's private and not accessed by anything, remove this constructor. No new tests since there should be no observable behavior difference. * rendering/line/LineLayoutState.h: 2019-01-30 Daniel Bates [iOS] Keyups for non-modifier keys identified as "Dead" when not focused in a content-editable element https://bugs.webkit.org/show_bug.cgi?id=192824 Reviewed by Wenson Hsieh. When building with USE(UIKIT_KEYBOARD_ADDITIONS) enabled, normalize input strings for some more key codes now that hardware key events to non-editable elements use the same code path as for editable elements. * platform/ios/KeyEventIOS.mm: (WebCore::windowsKeyCodeForCharCode): Demarcate mappings that are only needed when building with !USE(UIKIT_KEYBOARD_ADDITIONS) in the hope that one day we can remove this code. (WebCore::isFunctionKey): Ditto. * platform/ios/WebEvent.mm: (normalizedStringWithAppKitCompatibilityMapping): Normalize some more input strings when building with USE(UIKIT_KEYBOARD_ADDITIONS) enabled. 2019-01-30 Jer Noble Ensure ENABLE_MEDIA_SOURCE is defined inside DerivedSources.make https://bugs.webkit.org/show_bug.cgi?id=194063 Reviewed by Jon Lee. * DerivedSources.make: 2019-01-30 Youenn Fablet Refactor ServiceWorkerJob management by ServiceWorkerContainer to make it more memory safe https://bugs.webkit.org/show_bug.cgi?id=193747 Reviewed by Chris Dumez. Make ServiceWorkerJob be no longer ref counted. Instead its lifetime is fully controlled by ServiceWorkerContainer. Make sure that a failing load will remove the job from ServiceWorkerContainer job map. This allows to ensure that these jobs do not stay forever. Before the patch, the jobs map was never cleared, which is creating a ref cycle whenever a job is not succesful. Before the patch, unsetPendingActivity was only called for successful jobs finishing. In case of failing loads, ServiceWorkerContainer would leak. Make sure that setPendingActivity/unsetPendingActivity is balanced by storing a pending activity in the job map next to the job. When ServiceWorkerContainer is stopped, notify that all jobs are cancelled to NetworkProcess. This makes these jobs in NetworkProcess-side to not stay until the corresponding WebProcess is gone. Simplify ServiceWorkerJob promise rejection handling so that it is clear when promise is rejected and when it is not. Update type of exception to be SecurityError when load fails due to AccessControl. Covered by existing tests. * workers/service/ServiceWorkerContainer.cpp: (WebCore::ServiceWorkerContainer::addRegistration): (WebCore::ServiceWorkerContainer::removeRegistration): (WebCore::ServiceWorkerContainer::updateRegistration): (WebCore::ServiceWorkerContainer::scheduleJob): (WebCore::ServiceWorkerContainer::jobFailedWithException): (WebCore::ServiceWorkerContainer::jobResolvedWithRegistration): (WebCore::ServiceWorkerContainer::jobResolvedWithUnregistrationResult): (WebCore::ServiceWorkerContainer::jobFailedLoadingScript): (WebCore::ServiceWorkerContainer::jobDidFinish): (WebCore::ServiceWorkerContainer::stop): (WebCore::ServiceWorkerContainer::job): * workers/service/ServiceWorkerContainer.h: * workers/service/ServiceWorkerJob.cpp: (WebCore::ServiceWorkerJob::failedWithException): (WebCore::ServiceWorkerJob::resolvedWithRegistration): (WebCore::ServiceWorkerJob::resolvedWithUnregistrationResult): (WebCore::ServiceWorkerJob::startScriptFetch): (WebCore::ServiceWorkerJob::didReceiveResponse): (WebCore::ServiceWorkerJob::notifyFinished): (WebCore::ServiceWorkerJob::cancelPendingLoad): * workers/service/ServiceWorkerJob.h: (WebCore::ServiceWorkerJob::hasPromise const): (WebCore::ServiceWorkerJob::takePromise): * workers/service/ServiceWorkerJobClient.h: * workers/service/server/SWServerJobQueue.cpp: (WebCore::SWServerJobQueue::scriptFetchFinished): 2019-01-30 Dean Jackson PointerEvents - tiltX and tiltY are reversed https://bugs.webkit.org/show_bug.cgi?id=194032 Reviewed by Jon Lee. I got tiltX and tiltY the wrong way around. * dom/ios/PointerEventIOS.cpp: Flip the values. 2019-01-30 Zalan Bujtas [LFC][IFC] nextBreakablePosition returns the same position on hyphen characters https://bugs.webkit.org/show_bug.cgi?id=194001 Reviewed by Antti Koivisto. Skip to the next position manually. This is exactly what we do in simple line layout. * layout/inlineformatting/InlineRunProvider.cpp: (WebCore::Layout::InlineRunProvider::moveToNextBreakablePosition): 2019-01-30 Simon Fraser Add some basic geometry information to the scrolling tree https://bugs.webkit.org/show_bug.cgi?id=194002 rdar://problem/47656294 Reviewed by Antti Koivisto. To allow hit-testing in the scrolling tree, store a parent-relative scrollable rect in "scrolling" and "frame hosting" nodes. This is a rect whose size is the size of the scrollable area, and whose origin is relative to the parent scrolling tree node. Frame hosting nodes need this rect because they take care of the geometry offset between an iframe and its scrolling tree ancestor in the parent document. Based on a patch by Frédéric Wang in bug 172917. * page/scrolling/AsyncScrollingCoordinator.cpp: (WebCore::AsyncScrollingCoordinator::setScrollingNodeGeometry): * page/scrolling/ScrollingStateFrameHostingNode.cpp: (WebCore::ScrollingStateFrameHostingNode::ScrollingStateFrameHostingNode): (WebCore::ScrollingStateFrameHostingNode::setAllPropertiesChanged): (WebCore::ScrollingStateFrameHostingNode::setParentRelativeScrollableRect): (WebCore::ScrollingStateFrameHostingNode::dumpProperties const): * page/scrolling/ScrollingStateFrameHostingNode.h: * page/scrolling/ScrollingTreeFrameHostingNode.cpp: (WebCore::ScrollingTreeFrameHostingNode::commitStateBeforeChildren): (WebCore::ScrollingTreeFrameHostingNode::dumpProperties const): * page/scrolling/ScrollingTreeFrameHostingNode.h: (WebCore::ScrollingTreeFrameHostingNode::parentRelativeScrollableRect const): * rendering/RenderLayer.h: * rendering/RenderLayerBacking.cpp: (WebCore::RenderLayerBacking::updateScrollingLayers): * rendering/RenderLayerCompositor.cpp: (WebCore::RenderLayerCompositor::computeFrameScrollingGeometry const): (WebCore::RenderLayerCompositor::computeFrameHostingGeometry const): (WebCore::RenderLayerCompositor::computeOverflowScrollingGeometry const): (WebCore::RenderLayerCompositor::updateScrollingNodeForScrollingRole): (WebCore::RenderLayerCompositor::updateScrollingNodeForFrameHostingRole): (WebCore::RenderLayerCompositor::updateScrollSnapPropertiesWithFrameView const): (WebCore::RenderLayerCompositor::updateScrollSnapPropertiesWithFrameView): Deleted. * rendering/RenderLayerCompositor.h: 2019-01-30 Zalan Bujtas [LFC] Use the used margin values in outOfFlowReplacedVerticalGeometry consistently https://bugs.webkit.org/show_bug.cgi?id=194020 Reviewed by Antti Koivisto. Check the used margin variables whether we already computed before/after values. Test: fast/block/block-only/absolute-position-with-margin-auto-simple.html * layout/FormattingContextGeometry.cpp: (WebCore::Layout::FormattingContext::Geometry::outOfFlowReplacedVerticalGeometry): 2019-01-30 Chris Fleizach AX: Support color well on iOS https://bugs.webkit.org/show_bug.cgi?id=194010 Reviewed by Joanmarie Diggs. Test: accessibility/ios-simulator/color-well.html Add support for color well on iOS. * accessibility/ios/WebAccessibilityObjectWrapperIOS.mm: (-[WebAccessibilityObjectWrapper accessibilityCanFuzzyHitTest]): (-[WebAccessibilityObjectWrapper determineIsAccessibilityElement]): (-[WebAccessibilityObjectWrapper accessibilityRoleDescription]): (-[WebAccessibilityObjectWrapper accessibilityColorStringValue]): * en.lproj/Localizable.strings: * platform/LocalizedStrings.cpp: (WebCore::AXColorWellText): * platform/LocalizedStrings.h: 2019-01-30 Chris Fleizach AX: Role=switch not returning correct accessibilityValue https://bugs.webkit.org/show_bug.cgi?id=194006 Reviewed by Joanmarie Diggs. Return the toggle state of a role=switch element. Test: accessibility/ios-simulator/role-switch.html * accessibility/ios/WebAccessibilityObjectWrapperIOS.mm: (-[WebAccessibilityObjectWrapper accessibilityValue]): 2019-01-29 Rob Buis Align with Fetch on data: URLs https://bugs.webkit.org/show_bug.cgi?id=182325 Reviewed by Alex Christensen. Implement most remaining steps for data: URL processing [1]. Serialization is still to be implemented. To make the code in DataURLDecoder::parseMediaType more efficient, refactor ParsedContentType so that validation and parsing is done in one pass. Test: web-platform-tests/fetch/data-urls/processing.any.js [1] https://fetch.spec.whatwg.org/#data-urls * Modules/encryptedmedia/CDM.cpp: (WebCore::CDM::getSupportedCapabilitiesForAudioVideoType): * platform/network/DataURLDecoder.cpp: (WebCore::DataURLDecoder::parseMediaType): (WebCore::DataURLDecoder::DecodeTask::process): * platform/network/MIMEHeader.cpp: (WebCore::MIMEHeader::parseHeader): * platform/network/ParsedContentType.cpp: (WebCore::containsNewline): (WebCore::ParsedContentType::parseContentType): (WebCore::ParsedContentType::create): (WebCore::isValidContentType): (WebCore::ParsedContentType::ParsedContentType): (WebCore::DummyParsedContentType::setContentType const): Deleted. (WebCore::DummyParsedContentType::setContentTypeParameter const): Deleted. (WebCore::parseContentType): Deleted. * platform/network/ParsedContentType.h: 2019-01-29 Eric Carlson [MSE] add more source buffer logging https://bugs.webkit.org/show_bug.cgi?id=193995 Reviewed by Jon Lee. No new tests, no functional change. * platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm: (WebCore::SourceBufferPrivateAVFObjC::resetParserState): (WebCore::SourceBufferPrivateAVFObjC::setReadyState): (WebCore::SourceBufferPrivateAVFObjC::trackDidChangeEnabled): (WebCore::SourceBufferPrivateAVFObjC::enqueueSample): (WebCore::SourceBufferPrivateAVFObjC::willSeek): (WebCore::SourceBufferPrivateAVFObjC::setDecompressionSession): 2019-01-29 Simon Fraser Add nodes to the scrolling tree in z-index order. https://bugs.webkit.org/show_bug.cgi?id=192529 Reviewed by Dean Jackson. We currently add nodes to the scrolling tree via RenderLayerBacking::updateGeometry() and some other places. This is sub-optimal, because we don't readily know the scrolling ancestor at these times, so have to do RenderLayer walks to find them. With this change we update the scrolling tree during the RenderLayerCompositor::updateBackingAndHierarchy() tree walk, storing state along the way so we always know our scrolling tree ancestor, and the sibling index (which makes it so that the scrolling tree correctly reflects layer z-order). The reattachSubframeScrollLayers() code path is removed, since we can now reliably parent frame nodes via FrameHosting nodes in their parent document. There is also some minor cleanup around RenderLayerBacking teardown; it used to be the case that cleanup in ~RenderLayerBacking was hard because the backing was already disconnected from its owning RenderLayer, so I added RenderLayerBacking::willBeDestroyed() to do work that requires that layer->backing() is still valid. This allows for fewer callsites for detachFromScrollingCoordinator(). updateScrollCoordinatedLayersAfterFlushIncludingSubframes() is now iOS-only because it's only relevant for iOS WK1, and m_scrollCoordinatedLayers can be moved to LegacyWebKitScrollingLayerCoordinator. Tests: scrollingcoordinator/scrolling-tree/overflow-in-fixed.html scrollingcoordinator/scrolling-tree/scrolling-tree-is-z-order.html * page/scrolling/ScrollingStateTree.cpp: (WebCore::ScrollingStateTree::insertNode): * page/scrolling/ScrollingTreeNode.cpp: (WebCore::ScrollingTreeNode::~ScrollingTreeNode): * platform/Logging.cpp: (WebCore::initializeLogChannelsIfNecessary): * rendering/RenderLayer.cpp: (WebCore::RenderLayer::setParent): (WebCore::RenderLayer::calculateClipRects const): * rendering/RenderLayerBacking.cpp: (WebCore::RenderLayerBacking::~RenderLayerBacking): (WebCore::RenderLayerBacking::willBeDestroyed): (WebCore::RenderLayerBacking::updateGeometry): (WebCore::RenderLayerBacking::updateBackgroundLayer): (WebCore::RenderLayerBacking::coordinatedScrollingRoles const): * rendering/RenderLayerBacking.h: * rendering/RenderLayerCompositor.cpp: (WebCore::RenderLayerCompositor::flushPendingLayerChanges): (WebCore::RenderLayerCompositor::updateScrollCoordinatedLayersAfterFlush): (WebCore::RenderLayerCompositor::didChangePlatformLayerForLayer): (WebCore::frameHostingNodeForFrame): (WebCore::RenderLayerCompositor::updateCompositingLayers): (WebCore::RenderLayerCompositor::updateBackingAndHierarchy): (WebCore::RenderLayerCompositor::updateBacking): (WebCore::RenderLayerCompositor::layerWillBeRemoved): (WebCore::RenderLayerCompositor::setIsInWindow): (WebCore::RenderLayerCompositor::clearBackingForLayerIncludingDescendants): (WebCore::RenderLayerCompositor::useCoordinatedScrollingForLayer const): (WebCore::RenderLayerCompositor::removeFromScrollCoordinatedLayers): (WebCore::RenderLayerCompositor::attachScrollingNode): (WebCore::RenderLayerCompositor::detachScrollCoordinatedLayerWithRole): (WebCore::RenderLayerCompositor::updateScrollCoordinationForLayer): (WebCore::RenderLayerCompositor::updateScrollingNodeForViewportConstrainedRole): (WebCore::RenderLayerCompositor::updateScrollingNodeForScrollingRole): (WebCore::RenderLayerCompositor::updateScrollingNodeForFrameHostingRole): (WebCore::RenderLayerCompositor::willRemoveScrollingLayerWithBacking): (WebCore::RenderLayerCompositor::didAddScrollingLayer): (WebCore::LegacyWebKitScrollingLayerCoordinator::registerAllViewportConstrainedLayers): (WebCore::LegacyWebKitScrollingLayerCoordinator::addScrollingLayer): (WebCore::LegacyWebKitScrollingLayerCoordinator::removeScrollingLayer): (WebCore::LegacyWebKitScrollingLayerCoordinator::removeLayer): (WebCore::LegacyWebKitScrollingLayerCoordinator::addViewportConstrainedLayer): (WebCore::LegacyWebKitScrollingLayerCoordinator::removeViewportConstrainedLayer): (WebCore::RenderLayerCompositor::updateCustomLayersAfterFlush): Deleted. (WebCore::RenderLayerCompositor::setCompositingParent): Deleted. This was always called with a null parentLayer, so was a no-op. (WebCore::RenderLayerCompositor::removeCompositedChildren): Deleted. (WebCore::RenderLayerCompositor::fixedRootBackgroundLayerChanged): Deleted. The work happens via didChangePlatformLayerForLayer() now. (WebCore::canCoordinateScrollingForLayer): Deleted. (WebCore::RenderLayerCompositor::updateScrollCoordinatedStatus): Deleted. (WebCore::enclosingScrollingNodeID): Deleted. (WebCore::scrollCoordinatedAncestorInParentOfFrame): Deleted. (WebCore::RenderLayerCompositor::reattachSubframeScrollLayers): Deleted. (WebCore::RenderLayerCompositor::updateScrollCoordinationForThisFrame): Deleted. (WebCore::RenderLayerCompositor::updateScrollCoordinatedLayer): Deleted. * rendering/RenderLayerCompositor.h: 2019-01-29 Brent Fulgham Make sure we have a frame before trying to access its loader https://bugs.webkit.org/show_bug.cgi?id=193985 Reviewed by Ryosuke Niwa. * loader/ResourceLoadObserver.cpp: (WebCore::ResourceLoadObserver::logUserInteractionWithReducedTimeResolution): 2019-01-29 Andy Estes Try to fix the watchOS build. * dom/Element.cpp: 2019-01-29 Simon Fraser REGRESSION(r240553): [iOS] Crash in ScrollingTree::updateTreeFromStateNode when attempting to log in to icloud.com https://bugs.webkit.org/show_bug.cgi?id=193907 rdar://problem/47604080 Reviewed by Frédéric Wang. Recent scrolling tree changes can trigger unparenting and reparenting of subtrees in the state tree. If a subframe's state tree nodes are unparented, a scrolling tree commit would show these as nodes being destroyed, which destroyed the tree nodes. When re-parented, the commit would re-create the tree node, but the state node would only have a subset of the change flags set, so the new tree node would fail to get all of the state (for example, it would be missing layers and scrolling geometry). Fix by ensuring that when we reparent state node subtrees, we set all the change flags so that the full set of data is sent to the scrolling tree (the UI process, in the case of iOS WK2). Annoyingly, virtual setAllPropertiesChanged() functions are needed so each state node subclass can set the right change flags. This patch also gets rid of m_nodesRemovedSinceLastCommit in the state tree. We can gain the same information by using copying all of the nodeIDs in m_nodeMap into a HashSet, and removing nodes as we encounter them in the tree walk. Rename m_latchedNode to m_latchedNodeID in ScrollingTree, since it's a nodeID, not a node pointer. Test: compositing/geometry/composited-frame-contents.html * page/scrolling/ScrollingStateFixedNode.cpp: (WebCore::ScrollingStateFixedNode::setAllPropertiesChanged): * page/scrolling/ScrollingStateFixedNode.h: * page/scrolling/ScrollingStateFrameScrollingNode.cpp: (WebCore::ScrollingStateFrameScrollingNode::setAllPropertiesChanged): * page/scrolling/ScrollingStateFrameScrollingNode.h: * page/scrolling/ScrollingStateNode.cpp: (WebCore::ScrollingStateNode::setPropertyChanged): (WebCore::ScrollingStateNode::setAllPropertiesChanged): * page/scrolling/ScrollingStateNode.h: (WebCore::ScrollingStateNode::setPropertyChangedBit): * page/scrolling/ScrollingStateScrollingNode.cpp: (WebCore::ScrollingStateScrollingNode::setAllPropertiesChanged): * page/scrolling/ScrollingStateScrollingNode.h: * page/scrolling/ScrollingStateStickyNode.cpp: (WebCore::ScrollingStateStickyNode::setAllPropertiesChanged): * page/scrolling/ScrollingStateStickyNode.h: * page/scrolling/ScrollingStateTree.cpp: (WebCore::ScrollingStateTree::insertNode): Add a RELEASE_ASSERT on the type of the node created if parentID == 0, since mistakes here can associate a ScrollingNodeType::MainFrame node with some other nodeID which can result in type confusion later. (WebCore::ScrollingStateTree::nodeWasReattachedRecursive): (WebCore::ScrollingStateTree::commit): (WebCore::ScrollingStateTree::willRemoveNode): (WebCore::ScrollingStateTree::setRemovedNodes): Deleted. * page/scrolling/ScrollingStateTree.h: (WebCore::ScrollingStateTree::removedNodes const): Deleted. * page/scrolling/ScrollingTree.cpp: (WebCore::ScrollingTree::shouldHandleWheelEventSynchronously): (WebCore::ScrollingTree::commitTreeState): (WebCore::ScrollingTree::updateTreeFromStateNode): (WebCore::ScrollingTree::latchedNode): (WebCore::ScrollingTree::setLatchedNode): (WebCore::ScrollingTree::clearLatchedNode): (WebCore::ScrollingTree::scrollingTreeAsText): (WebCore::ScrollingTree::removeDestroyedNodes): Deleted. * page/scrolling/ScrollingTree.h: (WebCore::ScrollingTree::hasLatchedNode const): * rendering/RenderLayerCompositor.cpp: (WebCore::RenderLayerCompositor::ensureRootLayer): The scroll layer needs a 0,0,0 anchor point so that setting its position doesn't offset it relative to the center. 2019-01-29 Justin Fan [WebGPU] Fix and add validation to WebGPURenderPipeline and MTLVertexDescriptor https://bugs.webkit.org/show_bug.cgi?id=193926 Reviewed by Myles C. Maxfield. Update vertex input to properly utilize inputSlot and shaderLocation fields, and add some validation. Test: webgpu/vertex-buffer-triangle-strip.html * Modules/webgpu/WebGPUVertexInputDescriptor.idl: * platform/graphics/gpu/GPUVertexInputDescriptor.h: * platform/graphics/gpu/cocoa/GPURenderPipelineMetal.mm: (WebCore::setInputStateForPipelineDescriptor): Properly retain Metal types. (WebCore::GPURenderPipeline::create): Provide error logging for MTLRenderPipelineState creation. 2019-01-29 Keith Rollin Add .xcfilelists to Run Script build phases https://bugs.webkit.org/show_bug.cgi?id=193792 Reviewed by Alex Christensen. As part of supporting XCBuild, update the necessary Run Script build phases in their Xcode projects to refer to their associated .xcfilelist files. Note that the addition of these files bumps the Xcode project version number to something that's Xcode 10 compatible. This change means that older versions of the Xcode IDE can't read these projects. Nor can it fully load workspaces that refer to these projects (the updated projects are shown as non-expandable placeholders). `xcodebuild` can still build these projects; it's just that the IDE can't open them. Make special accommodations for incorporating .xcfilelists from WebKitAdditions. No new tests since there should be no observable behavior difference. * Configurations/Base.xcconfig: * Configurations/DebugRelease.xcconfig: * WebCore.xcodeproj/project.pbxproj: 2019-01-29 John Wilander Add data abstraction and validation for Ad Click Attribution https://bugs.webkit.org/show_bug.cgi?id=193916 Reviewed by Daniel Bates, Brent Fulgham, and Alex Christensen. New API tests added. Ad click attribution has two steps. First, the storage of an ad campaign ID for a click that takes the user to a destination site. Second, a conversion on the destination site that can be attributed to the ad click. This patch adds a class that represents a request for ad click attribution. Validation makes sure that the bits of entropy reported through this mechanism is limited. This feature is experimental and off by default. * Sources.txt: Added loader/AdClickAttribution.cpp. * WebCore.xcodeproj/project.pbxproj: * loader/AdClickAttribution.cpp: Added. (WebCore::AdClickAttribution::isValid const): (WebCore::AdClickAttribution::setConversion): (WebCore::AdClickAttribution::url const): (WebCore::AdClickAttribution::referrer const): * loader/AdClickAttribution.h: Added. (WebCore::AdClickAttribution::Campaign::Campaign): (WebCore::AdClickAttribution::Campaign::isValid const): (WebCore::AdClickAttribution::Source::Source): (WebCore::AdClickAttribution::Destination::Destination): (WebCore::AdClickAttribution::Priority::Priority): (WebCore::AdClickAttribution::Conversion::Conversion): (WebCore::AdClickAttribution::Conversion::isValid const): (WebCore::AdClickAttribution::AdClickAttribution): (WebCore::AdClickAttribution::earliestTimeToSend const): * loader/DocumentLoader.cpp: Added missing #include "RuntimeEnabledFeatures.h". 2019-01-29 Zalan Bujtas [MathML] Move enum class ScriptType to MathMLScriptsElement. https://bugs.webkit.org/show_bug.cgi?id=193969 Reviewed by Antti Koivisto. * mathml/MathMLScriptsElement.cpp: (WebCore::scriptTypeOf): * mathml/MathMLScriptsElement.h: * rendering/mathml/RenderMathMLScripts.cpp: (WebCore::RenderMathMLScripts::scriptType const): (WebCore::RenderMathMLScripts::validateAndGetReferenceChildren): (WebCore::RenderMathMLScripts::computePreferredLogicalWidths): (WebCore::RenderMathMLScripts::verticalMetrics): (WebCore::RenderMathMLScripts::layoutBlock): * rendering/mathml/RenderMathMLScripts.h: * rendering/mathml/RenderMathMLUnderOver.cpp: (WebCore::RenderMathMLUnderOver::isValid const): (WebCore::RenderMathMLUnderOver::under const): (WebCore::RenderMathMLUnderOver::over const): (WebCore::RenderMathMLUnderOver::computePreferredLogicalWidths): (WebCore::RenderMathMLUnderOver::hasAccent const): (WebCore::RenderMathMLUnderOver::layoutBlock): 2019-01-29 Chris Dumez Make sure WTF::generateObjectIdentifier() internal counter does not get duplicated https://bugs.webkit.org/show_bug.cgi?id=193848 Reviewed by Youenn Fablet. * dom/Document.cpp: * dom/MessageChannel.cpp: (WebCore::MessageChannel::MessageChannel): * dom/ScriptExecutionContext.cpp: (WebCore::ScriptExecutionContext::contextIdentifier const): * history/HistoryItem.cpp: (WebCore::HistoryItem::HistoryItem): * loader/DocumentLoader.cpp: (WebCore::DocumentLoader::registerTemporaryServiceWorkerClient): * page/DOMWindow.cpp: (WebCore::DOMWindow::DOMWindow): * platform/Process.cpp: (WebCore::Process::identifier): * workers/service/ServiceWorkerJobData.cpp: (WebCore::ServiceWorkerJobData::ServiceWorkerJobData): * workers/service/server/RegistrationDatabase.cpp: (WebCore::RegistrationDatabase::importRecords): * workers/service/server/SWServer.cpp: (WebCore::SWServer::Connection::Connection): (WebCore::SWServer::updateWorker): * workers/service/server/SWServerRegistration.cpp: (WebCore::generateServiceWorkerRegistrationIdentifier): * workers/service/server/SWServerToContextConnection.cpp: (WebCore::generateServerToContextConnectionIdentifier): 2019-01-29 Alex Christensen Use lambdas instead of member pointer functions for TransactionOperationImpl https://bugs.webkit.org/show_bug.cgi?id=193933 Reviewed by Tim Horton. No change in behavior. This just makes it easier to add new parameters to these functions in a straightforward manner. * Modules/indexeddb/IDBObjectStore.cpp: (WebCore::IDBObjectStore::putOrAdd): * Modules/indexeddb/IDBTransaction.cpp: (WebCore::IDBTransaction::internalAbort): (WebCore::IDBTransaction::commit): (WebCore::IDBTransaction::createObjectStore): (WebCore::IDBTransaction::renameObjectStore): (WebCore::IDBTransaction::createIndex): (WebCore::IDBTransaction::renameIndex): (WebCore::IDBTransaction::doRequestOpenCursor): (WebCore::IDBTransaction::iterateCursor): (WebCore::IDBTransaction::requestGetAllObjectStoreRecords): (WebCore::IDBTransaction::requestGetAllIndexRecords): (WebCore::IDBTransaction::requestGetRecord): (WebCore::IDBTransaction::requestIndexRecord): (WebCore::IDBTransaction::requestCount): (WebCore::IDBTransaction::requestDeleteRecord): (WebCore::IDBTransaction::requestClearObjectStore): (WebCore::IDBTransaction::requestPutOrAdd): (WebCore::IDBTransaction::deleteObjectStore): (WebCore::IDBTransaction::deleteIndex): * Modules/indexeddb/IDBTransaction.h: * Modules/indexeddb/client/TransactionOperation.h: (WebCore::IDBClient::TransactionOperation::doComplete): (WebCore::IDBClient::createTransactionOperation): Deleted. 2019-01-29 Zalan Bujtas [LFC][BFC][MarginCollapsing] Remove incorrect downcast https://bugs.webkit.org/show_bug.cgi?id=193964 Reviewed by Antti Koivisto. * layout/blockformatting/BlockMarginCollapse.cpp: (WebCore::Layout::BlockFormattingContext::MarginCollapse::positiveNegativeMarginBefore): 2019-01-29 Zalan Bujtas [LFC][BFC] Do not ignore next sibling box while laying out BFC. https://bugs.webkit.org/show_bug.cgi?id=193954 Reviewed by Antti Koivisto. When a block box has no child (), we should not ignore the next sibling (move the container check to the function to keep layout logic simple) Also inFlowNonReplacedWidthAndMargin() is called through inFlowReplacedWidthAndMargin() to compute margins. * layout/blockformatting/BlockFormattingContext.cpp: (WebCore::Layout::BlockFormattingContext::layout const): (WebCore::Layout::BlockFormattingContext::placeInFlowPositionedChildren const): * layout/blockformatting/BlockFormattingContext.h: * layout/blockformatting/BlockFormattingContextGeometry.cpp: (WebCore::Layout::BlockFormattingContext::Geometry::inFlowNonReplacedWidthAndMargin): 2019-01-29 Zalan Bujtas [LFC][BFC][MarginCollapsing] Remove quirk from MarginCollapse::marginsCollapseThrough https://bugs.webkit.org/show_bug.cgi?id=193948 Reviewed by Antti Koivisto. This is now implemented in BlockFormattingContext::Quirks::stretchedInFlowHeight(). * layout/blockformatting/BlockMarginCollapse.cpp: (WebCore::Layout::BlockFormattingContext::MarginCollapse::marginsCollapseThrough): 2019-01-29 Zalan Bujtas [LFC][BFC][MarginCollapsing] Anonymous block container's margin before does not collapse with previous inflow sibling margin after. https://bugs.webkit.org/show_bug.cgi?id=193952 Reviewed by Antti Koivisto. * layout/blockformatting/BlockMarginCollapse.cpp: (WebCore::Layout::BlockFormattingContext::MarginCollapse::marginBeforeCollapsesWithPreviousSiblingMarginAfter): 2019-01-29 Frederic Wang Allow scrolling tree nodes to exist in a detached state https://bugs.webkit.org/show_bug.cgi?id=193754 Unreviewed build warning fix. * page/scrolling/ScrollingStateTree.cpp: (WebCore::ScrollingStateTree::unparentChildrenAndDestroyNode): Remove unused variable. 2019-01-28 Ryosuke Niwa User agent string override for navigator.userAgent should be site specific quirks https://bugs.webkit.org/show_bug.cgi?id=193950 Reviewed by Brent Fulgham. In order to make it possible to toggle the UA string override just for navigator.userAgent via Web Inspector, we need to put this override behind the site specific quirks. Because WebInspector overrides Page's setting without updating WKPreferences, there is no way for WKWebView client's to know whether the site specific quirks had been disabled or not. * loader/DocumentLoader.h: (WebCore::DocumentLoader::setCustomJavaScriptUserAgentAsSiteSpecificQuirks): (WebCore::DocumentLoader::customJavaScriptUserAgentAsSiteSpecificQuirks const): (WebCore::DocumentLoader::setCustomJavaScriptUserAgent): Deleted. (WebCore::DocumentLoader::customJavaScriptUserAgent const): Deleted. * loader/FrameLoader.cpp: (WebCore::FrameLoader::userAgentForJavaScript const): 2019-01-28 Devin Rousso Web Inspector: provide a way to edit page WebRTC settings on a remote target https://bugs.webkit.org/show_bug.cgi?id=193863 Reviewed by Joseph Pecoraro. Test: inspector/page/overrideSetting-ICECandidateFilteringEnabled.html inspector/page/overrideSetting-MockCaptureDevicesEnabled.html * inspector/agents/InspectorPageAgent.cpp: * page/Settings.yaml: * page/SettingsBase.h: * page/SettingsBase.cpp: (SettingsBase::iceCandidateFilteringEnabledChanged): Added. (SettingsBase::mockCaptureDevicesEnabledChanged): Added. * Scripts/GenerateSettings.rb: * Scripts/SettingsTemplates/Settings.cpp.erb: Add page-level settings for WebRTC preferences. * Modules/mediastream/UserMediaController.cpp: (WebCore::UserMediaController::canCallGetUserMedia): * testing/InternalSettings.cpp: (WebCore::InternalSettings::setMediaCaptureRequiresSecureConnection): * testing/Internals.h: * testing/Internals.cpp: (WebCore::Internals::Internals): (WebCore::Internals::setMockMediaCaptureDevicesEnabled): (WebCore::Internals::setMediaCaptureRequiresSecureConnection): Added. * page/DeprecatedGlobalSettings.h: * page/DeprecatedGlobalSettings.cpp: (WebCore::DeprecatedGlobalSettings::mockCaptureDevicesEnabled): Deleted. (WebCore::DeprecatedGlobalSettings::setMockCaptureDevicesEnabled): Deleted. (WebCore::DeprecatedGlobalSettings::mediaCaptureRequiresSecureConnection): Deleted. (WebCore::DeprecatedGlobalSettings::setMediaCaptureRequiresSecureConnection): Deleted. 2019-01-28 Jer Noble webkitcurrentplaybacktargetiswirelesschanged and webkitCurrentPlaybackIsWireless are non-deterministic. https://bugs.webkit.org/show_bug.cgi?id=193923 Reviewed by Eric Carlson. The value of webkitCurrentPlaybackTargetIsWireless can change in between when the event is scheduled and when it's actually dispatched. To make this more deterministic, use a GenericTaskQueue to enqueue setting m_isPlayingToWirelessTarget and dispatch the changed event in the same run-loop. * html/HTMLMediaElement.cpp: (WebCore::HTMLMediaElement::clearMediaPlayer): (WebCore::HTMLMediaElement::mediaPlayerCurrentPlaybackTargetIsWirelessChanged): (WebCore::HTMLMediaElement::setIsPlayingToWirelessTarget): (WebCore::HTMLMediaElement::dispatchEvent): * html/HTMLMediaElement.h: 2019-01-28 Ross Kirsling Remove unnecessary `using namespace WTF`s (or at least restrict their scope). https://bugs.webkit.org/show_bug.cgi?id=193941 Reviewed by Alex Christensen. * css/CSSBasicShapes.cpp: * css/CSSPrimitiveValue.cpp: * css/parser/CSSParser.cpp: * css/parser/CSSParserSelector.cpp: * css/parser/CSSPropertyParser.cpp: * dom/Document.cpp: * dom/EventListenerMap.cpp: * dom/EventTarget.cpp: * editing/Editor.cpp: * html/HTMLElement.cpp: * html/HTMLFontElement.cpp: * html/parser/HTMLTokenizer.cpp: * html/track/TrackBase.cpp: * loader/FTPDirectoryParser.cpp: * loader/TextResourceDecoder.cpp: * loader/cache/CachedResource.cpp: * page/ContextMenuController.cpp: * page/Navigator.cpp: * platform/Length.cpp: * platform/cocoa/KeyEventCocoa.mm: * platform/graphics/FontCascade.cpp: * platform/graphics/WidthIterator.cpp: * platform/graphics/opengl/GraphicsContext3DOpenGLCommon.cpp: * platform/ios/KeyEventIOS.mm: * platform/mac/KeyEventMac.mm: * platform/network/HTTPParsers.cpp: * platform/text/TextCodecUTF8.cpp: * platform/text/TextEncodingRegistry.cpp: * platform/win/KeyEventWin.cpp: * rendering/BidiRun.cpp: * rendering/FloatingObjects.cpp: * rendering/RenderBlock.cpp: * rendering/RenderListMarker.cpp: * rendering/RenderText.cpp: 2019-01-28 Fujii Hironori [Win] WebCore/platform/Process.h is conflicting with process.h https://bugs.webkit.org/show_bug.cgi?id=193944 Reviewed by Ross Kirsling. Windows has process.h. Rename Process.h to ProcessIdentifier.h. No new tests because there is no behavior change. * Sources.txt: * UnifiedSources-input.xcfilelist: * WebCore.xcodeproj/project.pbxproj: * dom/MessagePortIdentifier.h: * dom/messageports/MessagePortChannel.h: * dom/messageports/MessagePortChannelProvider.h: * dom/messageports/MessagePortChannelRegistry.h: * history/BackForwardItemIdentifier.h: * page/GlobalWindowIdentifier.h: * platform/ProcessIdentifier.cpp: Renamed from Source/WebCore/platform/Process.cpp. (WebCore::Process::setIdentifier): (WebCore::Process::identifier): * platform/ProcessIdentifier.h: Renamed from Source/WebCore/platform/Process.h. 2019-01-28 Antoine Quint Implement capture for Pointer Events on iOS https://bugs.webkit.org/show_bug.cgi?id=193917 Reviewed by Dean Jackson. We add a new PointerCaptureController object which gets notified upon dispatch of pointer events to implement implicit pointer capture, dispatch the gotpointercapture and lostpointercaptiure events, and implement the Element APIs for pointer capture: hasPointerCapture(), setPointerCapture() and releasePointerCapture(). Tests: pointerevents/ios/pointer-events-implicit-capture-has-pointer-capture-in-pointer-down.html pointerevents/ios/pointer-events-implicit-capture-release-exception.html pointerevents/ios/pointer-events-implicit-capture-release.html pointerevents/ios/pointer-events-implicit-capture.html pointerevents/ios/pointer-events-set-pointer-capture-exceptions.html * Sources.txt: * WebCore.xcodeproj/project.pbxproj: * dom/Element.cpp: (WebCore::Element::setPointerCapture): (WebCore::Element::releasePointerCapture): (WebCore::Element::hasPointerCapture): * dom/Element.h: * dom/Element.idl: * dom/EventNames.h: * dom/PointerEvent.h: * page/Page.cpp: (WebCore::Page::Page): * page/Page.h: (WebCore::Page::pointerCaptureController const): * page/PointerCaptureController.cpp: Added. (WebCore::PointerCaptureController::PointerCaptureController): (WebCore::PointerCaptureController::setPointerCapture): (WebCore::PointerCaptureController::releasePointerCapture): (WebCore::PointerCaptureController::hasPointerCapture): (WebCore::PointerCaptureController::pointerLockWasApplied): (WebCore::PointerCaptureController::touchEndedOrWasCancelledForIdentifier): (WebCore::PointerCaptureController::pointerEventWillBeDispatched): (WebCore::PointerCaptureController::pointerEventWasDispatched): (WebCore::PointerCaptureController::processPendingPointerCapture): * page/PointerCaptureController.h: Added. * page/PointerLockController.cpp: (WebCore::PointerLockController::requestPointerLock): * page/PointerLockController.h: 2019-01-28 Andy Estes [watchOS] Enable Parental Controls content filtering https://bugs.webkit.org/show_bug.cgi?id=193939 Reviewed by Ryosuke Niwa. * Configurations/FeatureDefines.xcconfig: 2019-01-28 Dean Jackson Produce "pen" Pointer Events if using a stylus (e.g. Apple Pencil) https://bugs.webkit.org/show_bug.cgi?id=193945 Reviewed by Antoine Quint. Calculate the pressure, tiltX and tiltY values for incoming Pointer Events, which have values when the PlatformTouchEvent originated from a stylus. Test: pointerevents/ios/pointer-events-dispatch-on-stylus.html * dom/PointerEvent.h: Default to "mouse". * dom/ios/PointerEventIOS.cpp: Calculate the values. 2019-01-28 Timothy Hatcher Make it easier for non-Apple ports to enable dark mode CSS support. https://bugs.webkit.org/show_bug.cgi?id=193882 Reviewed by Megan Gardner. * page/FrameView.cpp: (WebCore::FrameView::updateBackgroundRecursively): Limit use of system background color to the Mac platform. * rendering/RenderTheme.cpp: (WebCore::RenderTheme::purgeCaches): Purge m_darkColorCache. (WebCore::RenderTheme::platformColorsDidChange): Reset m_darkColorCache. (WebCore::RenderTheme::colorCache const): Added m_darkColorCache. * rendering/RenderTheme.h: (WebCore::RenderTheme::colorCache const): Deleted. * rendering/RenderThemeMac.h: * rendering/RenderThemeMac.mm: (WebCore::RenderThemeMac::purgeCaches): Removed m_darkColorCache. (WebCore::RenderThemeMac::platformColorsDidChange): Deleted. (WebCore::RenderThemeMac::colorCache const): Deleted. 2019-01-28 Simon Fraser svg/text/select-text-inside-non-static-position.html crashes under ScrollingStateTree::unparentChildrenAndDestroyNode() https://bugs.webkit.org/show_bug.cgi?id=193930 Reviewed by Tim Horton. ScrollingStateTree::unparentChildrenAndDestroyNode() should make a copy of the 'children' vector before iterating, since iteration mutates the array. Tested by ASan tests. * page/scrolling/ScrollingStateNode.h: (WebCore::ScrollingStateNode::takeChildren): * page/scrolling/ScrollingStateTree.cpp: (WebCore::ScrollingStateTree::unparentChildrenAndDestroyNode): 2019-01-28 Simon Fraser css3/filters/blur-filter-page-scroll-self.html crashes under WebCore::ScrollingStateNode::ScrollingStateNode https://bugs.webkit.org/show_bug.cgi?id=193925 Reviewed by Tim Horton. Some css3/filters/ tests disable accelerated compositing (which is crazy). Make these tests not crash by ensuring that unparentNode() and unparentChildrenAndDestroyNode() clears the root node if it's the node being unparented or destroyed. Tested by existing tests. * page/scrolling/ScrollingStateTree.cpp: (WebCore::ScrollingStateTree::unparentNode): (WebCore::ScrollingStateTree::unparentChildrenAndDestroyNode): 2019-01-28 Daniel Bates [iOS] Make Window virtual key code computation match Mac https://bugs.webkit.org/show_bug.cgi?id=193452 Reviewed by Ryosuke Niwa. Use the same approach for computing the Windows virtual key code on iOS as we do on Mac for web compatibility. On Mac, we prefer to compute the Windows virtual key code from the input strings of the key event and use the key event's keycode as a last resort. Test: fast/events/ios/key-events-meta-alt-combinations.html * platform/ios/PlatformEventFactoryIOS.h: * platform/ios/PlatformEventFactoryIOS.mm: (WebCore::isKeypadEvent): Added. (WebCore::windowsKeyCodeForKeyEvent): Added. (WebCore::PlatformKeyboardEventBuilder::PlatformKeyboardEventBuilder): Modified to call WebCore::windowsKeyCodeForKeyEvent() to compute the Windows virtual key code. 2019-01-28 Antoine Quint Limit user-agent interactions based on the touch-action property on iOS https://bugs.webkit.org/show_bug.cgi?id=193447 Unreviewed build fix. * dom/Element.cpp: (WebCore::parentCrossingFrameBoundaries): 2019-01-28 Eric Carlson AVStreamSession isn't always available, make a HAVE compile flag for it https://bugs.webkit.org/show_bug.cgi?id=193889 Reviewed by Jer Noble. No new tests, no functional change. * page/Settings.yaml: * page/SettingsBase.cpp: (WebCore::SettingsBase::platformDefaultMediaSourceEnabled): * page/SettingsBase.h: * page/cocoa/SettingsBaseCocoa.mm: (WebCore::SettingsBase::platformDefaultMediaSourceEnabled): * platform/graphics/avfoundation/CDMPrivateMediaSourceAVFObjC.mm: (WebCore::CDMPrivateMediaSourceAVFObjC::createSession): * platform/graphics/avfoundation/objc/CDMSessionAVStreamSession.h: * platform/graphics/avfoundation/objc/CDMSessionAVStreamSession.mm: * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.h: * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm: (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::durationChanged): Fix logging. (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::outputObscuredDueToInsufficientExternalProtectionChanged): * platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.h: * platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm: Use a HashMap to associate CMSampleBuffer with SourceBufferPrivateAVFObjC. (-[WebAVSampleBufferErrorListener observeValueForKeyPath:ofObject:change:context:]): isEqualTo -> isEqualToString. (WebCore::sourceBufferMap): (WebCore::nextMapID): (WebCore::bufferWasConsumedCallback): (WebCore::SourceBufferPrivateAVFObjC::SourceBufferPrivateAVFObjC): (WebCore::SourceBufferPrivateAVFObjC::~SourceBufferPrivateAVFObjC): (WebCore::SourceBufferPrivateAVFObjC::willProvideContentKeyRequestInitializationDataForTrackID): (WebCore::SourceBufferPrivateAVFObjC::didProvideContentKeyRequestInitializationDataForTrackID): (WebCore::SourceBufferPrivateAVFObjC::append): (WebCore::SourceBufferPrivateAVFObjC::destroyParser): (WebCore::SourceBufferPrivateAVFObjC::layerDidReceiveError): (WebCore::SourceBufferPrivateAVFObjC::enqueueSample): (WebCore::SourceBufferPrivateAVFObjC::bufferWasConsumed): (-[WebBufferConsumedContext initWithParent:]): Deleted. (-[WebBufferConsumedContext parent]): Deleted. 2019-01-28 Rob Buis Update MIME type parser https://bugs.webkit.org/show_bug.cgi?id=180526 Reviewed by Frédéric Wang. I overlooked step 11.9.3 [1], for Mimesniff we should not bail out on missing subtype, but keep trying. Note that Rfc2045 does require bailing out, as before. Test: ParsedContentType unittest [1] https://mimesniff.spec.whatwg.org/#parse-a-mime-type * platform/network/ParsedContentType.cpp: (WebCore::parseToken): (WebCore::parseContentType): 2019-01-28 Michael Catanzaro Unreviewed follow-up to r240557, restore a call to makeString https://bugs.webkit.org/show_bug.cgi?id=192742 It works if we add this #include that was missing. I got confused by the error messages and missed that there were two similarly-named headers. * rendering/RenderLayerCompositor.cpp: (WebCore::RenderLayerCompositor::logLayerInfo): 2019-01-28 Oriol Brufau [css-logical] Reject unitless length quirk in 'inset' shorthand https://bugs.webkit.org/show_bug.cgi?id=193773 Reviewed by Manuel Rego Casasnovas. Even though its longhands ('top', 'right', 'bottom', 'left') accept the unitless length quirk, the 'inset' shorthand is a new CSS property and should reject it. This was resolved by the CSS WG in https://github.com/w3c/csswg-drafts/issues/3525#issuecomment-456902648 Tests: imported/w3c/web-platform-tests/quirks/unitless-length/excluded-properties-001.html imported/w3c/web-platform-tests/quirks/unitless-length/excluded-properties-002.html imported/w3c/web-platform-tests/quirks/unitless-length/excluded-properties-003.html imported/w3c/web-platform-tests/quirks/unitless-length/limited-quirks.html imported/w3c/web-platform-tests/quirks/unitless-length/no-quirks.html imported/w3c/web-platform-tests/quirks/unitless-length/quirks.html * css/parser/CSSPropertyParser.cpp: (WebCore::CSSPropertyParser::parseSingleValue): 2019-01-28 Zalan Bujtas [LFC][MarginCollapsing][Quirks] Quirk margin values get propagated through margin collapsing https://bugs.webkit.org/show_bug.cgi?id=193896 Reviewed by Antti Koivisto. This patch implements quirk margin value collapsing. There are a few "quirk" rules when it comes to margin collapsing. 1. Collapsed quirk margin values are ignored on quirk containers

p elements have 1em vertical (top/bottom) quirk margin In quirk mode,

and (quirk container) collapses their vertical margins but

's quirk values(1qem -> 16px) are ignored. Used vertical margin values on the are top: 8px bottom: 8px. 2. Quirk margin values are turned into non-quirk values when collapsed with non-zero, non-quirk margins.

p elements have 1em vertical (top/bottom) quirk margin

When

's vertical margin collapses with the parent

, - the collapsed before value becomes 16px (max(1qem, 1px)) and this collapsed value is now considered as a non-quirk value - the collapsed after value stays 1qem quirk value. When
collapses with - the collapsed before value becomes 16px (max(16px, 8px)) - the
's quirk after value gets ignored and the collapsed after value stays 8px. Used vertical margin values on the are top: 16px (1em) bottom: 8px. * layout/MarginTypes.h: (WebCore::Layout::PositiveAndNegativeVerticalMargin::Values::isNonZero const): * layout/blockformatting/BlockFormattingContext.h: * layout/blockformatting/BlockFormattingContextQuirks.cpp: (WebCore::Layout::BlockFormattingContext::Quirks::shouldIgnoreCollapsedQuirkMargin): (WebCore::Layout::hasMarginBeforeQuirkValue): Deleted. (WebCore::Layout::BlockFormattingContext::Quirks::shouldIgnoreMarginBefore): Deleted. (WebCore::Layout::BlockFormattingContext::Quirks::shouldIgnoreMarginAfter): Deleted. * layout/blockformatting/BlockMarginCollapse.cpp: (WebCore::Layout::BlockFormattingContext::MarginCollapse::marginBeforeCollapsesWithPreviousSiblingMarginAfter): (WebCore::Layout::BlockFormattingContext::MarginCollapse::marginBeforeCollapsesWithFirstInFlowChildMarginBefore): (WebCore::Layout::BlockFormattingContext::MarginCollapse::marginAfterCollapsesWithLastInFlowChildMarginAfter): (WebCore::Layout::computedPositiveAndNegativeMargin): (WebCore::Layout::BlockFormattingContext::MarginCollapse::positiveNegativeMarginBefore): (WebCore::Layout::BlockFormattingContext::MarginCollapse::positiveNegativeMarginAfter): 2019-01-28 Zalan Bujtas [LFC][BFC] Remove redundant vertical positioning in BlockFormattingContext::computeFloatingPosition https://bugs.webkit.org/show_bug.cgi?id=193872 Reviewed by Antti Koivisto. This is taken care of by verticalPositionWithMargin() in BlockFormattingContext::computeHeightAndMargin(). * layout/blockformatting/BlockFormattingContext.cpp: (WebCore::Layout::BlockFormattingContext::computeFloatingPosition const): 2019-01-28 cathie chen Add missing #include in ScrollingTreeFrameScrollingNode.cpp https://bugs.webkit.org/show_bug.cgi?id=193905 Reviewed by Frédéric Wang. * page/scrolling/ScrollingTreeFrameScrollingNode.cpp: Add #include "ScrollingStateFrameScrollingNode.h" 2019-01-28 Zalan Bujtas [LFC][BFC][Quirk] Ignore collapsed(through) margin after when stretching body height. https://bugs.webkit.org/show_bug.cgi?id=193894 Reviewed by Antti Koivisto. * layout/blockformatting/BlockFormattingContextQuirks.cpp: (WebCore::Layout::BlockFormattingContext::Quirks::stretchedInFlowHeight): 2019-01-28 Antoine Quint Limit user-agent interactions based on the touch-action property on iOS https://bugs.webkit.org/show_bug.cgi?id=193447 Reviewed by Antti Koivisto and Simon Fraser. We now compile a list of elements with a non-auto touch-action property that is updated whenever an element has its style changed or is removed from its document. When the content of that list changes, we inform the scrolling coordinator such that it can compile a list of TouchActionData structures which hold the touch-action value, the ID of the nearest scroll node and the Region containing the bounds of each of those elements to send it up to the UI process along with touch regions. Computing the list of allowed touch actions for a given element accounts for not only the value specified directly on that element's style, but also in its hierarchy, crossing any frame boundary towards the top-level document's root node. Tests: pointerevents/ios/touch-action-none-in-overflow-scrolling-touch.html pointerevents/ios/touch-action-none-on-iframe.html pointerevents/ios/touch-action-none-on-parent.html pointerevents/ios/touch-action-none.html pointerevents/ios/touch-action-pan-x-pan-y.html pointerevents/ios/touch-action-pan-x.html pointerevents/ios/touch-action-pan-y.html pointerevents/ios/touch-action-pinch-zoom-allows-zooming.html pointerevents/ios/touch-action-pinch-zoom-prevents-scrolling.html * WebCore.xcodeproj/project.pbxproj: Update how certain headers are exposed such that they can be used from WebKit. * dom/Document.cpp: (WebCore::Document::invalidateRenderingDependentRegions): (WebCore::Document::nodeWillBeRemoved): Ensure a node that is being removed from this document is no longer listed in its list of elements with a non-auto touch-action property. (WebCore::Document::absoluteEventRegionForNode): (WebCore::Document::absoluteRegionForEventTargets): (WebCore::Document::updateTouchActionElements): Create a list of elements with a non-auto touch-action property if one doesn't exist yet and update it to add the given element if it contains a non-auto touch-action, or remove it if it doesn't. If the contents of that list changed as a result, the scrolling coordinator is informed. * dom/Document.h: (WebCore::Document:: const): * dom/Element.cpp: (WebCore::parentCrossingFrameBoundaries): (WebCore::Element::computedTouchActions const): Provide the list of allowed touch actions accounting for the "touch-action" property specified on this element and all of its hierarchy, crossing frame boundary. (WebCore::Element::nearestScrollingNodeIDUsingTouchOverflowScrolling const): Provide the ScrollingNodeID, if any, for the nearest scrolling node for that element. This will allow the UI process to identify which scroll view's behavior to customize to reflect the element's allowed touch actions. * dom/Element.h: * page/scrolling/ScrollingCoordinator.cpp: (WebCore::ScrollingCoordinator::absoluteEventTrackingRegionsForFrame const): Compute the region for all elements with a non-auto touch-action property throughout the provided frame and all of its subframes. * page/scrolling/ScrollingCoordinator.h: (WebCore::ScrollableAreaParameters::operator== const): Deleted. * page/scrolling/ScrollingCoordinatorTypes.h: Added. (WebCore::ScrollableAreaParameters::operator== const): * page/scrolling/ScrollingTree.cpp: (WebCore::ScrollingTree::touchActionDataAtPoint const): Query the list of TouchActionData objects for a match based on the provided point. Right now the logic is pretty crude, stopping at the first TouchActionData for which the region contains the provided point, but future patches will account for overlap and nesting. * page/scrolling/ScrollingTree.h: * page/scrolling/ScrollingTreeNode.h: * platform/EventTrackingRegions.cpp: (WebCore::operator==): * platform/EventTrackingRegions.h: (WebCore::operator!=): * style/StyleTreeResolver.cpp: (WebCore::Style::TreeResolver::resolveElement): Update the list of elements with a non-auto touch-action property when an element's style changes. 2019-01-27 Michael Catanzaro Unreviewed, fix WPE/GTK debug builds after r240557 https://bugs.webkit.org/show_bug.cgi?id=192742 Also fix an improper format string that was recently added in a different commit. * rendering/RenderLayerCompositor.cpp: (WebCore::RenderLayerCompositor::logLayerInfo): (WebCore::RenderLayerCompositor::reattachSubframeScrollLayers): 2018-12-15 Darin Adler Replace many uses of String::format with more type-safe alternatives https://bugs.webkit.org/show_bug.cgi?id=192742 Reviewed by Mark Lam. A while back, String::format was more efficient than string concatenation, but that is no longer true, and we should prefer String::number, makeString, or concatenation with the "+" operator to String::format for new code. This is not as good for programmers who are fond of printf formatting style, and in some cases it's a little harder to read the strings interspersed with variables rather than a format string, but it's better in a few ways: - more efficient (I didn't measure the difference, but it's definitely slower to use String::Format which calls vsnprintf twice than to use the WTF code) - works in a type-safe way without a need to use a format specifier such as "%" PRIu64 or "%tu" making it much easier to avoid problems due to subtle differences between platforms - allows us to use StringView in some cases to sidestep the need to allocate temporary WTF::String objects - does not require converting each WTF::String to a C string, allowing us to remove many cases of ".utf8().data()" and similar expressions, eliminating the allocation of temporary WTF::CString objects This patch covers a batch of easiest-to-convert call sites. Later patches will allow us to deprecate or remove String::format. * Modules/indexeddb/server/SQLiteIDBBackingStore.cpp: (WebCore::IDBServer::SQLiteIDBBackingStore::addRecord): Use makeString. * Modules/indexeddb/shared/IDBCursorInfo.cpp: (WebCore::IDBCursorInfo::loggingString const): Ditto. * Modules/indexeddb/shared/IDBGetAllRecordsData.cpp: (WebCore::IDBGetAllRecordsData::loggingString const): Ditto. * Modules/indexeddb/shared/IDBGetRecordData.cpp: (WebCore::IDBGetRecordData::loggingString const): Ditto. * Modules/indexeddb/shared/IDBIndexInfo.cpp: (WebCore::IDBIndexInfo::loggingString const): Ditto. (WebCore::IDBIndexInfo::condensedLoggingString const): Ditto. * Modules/indexeddb/shared/IDBIterateCursorData.cpp: (WebCore::IDBIterateCursorData::loggingString const): Ditto. * Modules/indexeddb/shared/IDBObjectStoreInfo.cpp: (WebCore::IDBObjectStoreInfo::condensedLoggingString const): Ditto. * Modules/indexeddb/shared/IDBResourceIdentifier.cpp: (WebCore::IDBResourceIdentifier::loggingString const): Ditto. * Modules/webdatabase/Database.cpp: (WebCore::formatErrorMessage): Ditto. * Modules/webdatabase/SQLError.h: (WebCore::SQLError::create): Ditto. * bindings/scripts/CodeGeneratorJS.pm: (GenerateImplementation): Use makeString. * bindings/scripts/test/JS/JSInterfaceName.cpp: * bindings/scripts/test/JS/JSMapLike.cpp: * bindings/scripts/test/JS/JSReadOnlyMapLike.cpp: * bindings/scripts/test/JS/JSTestActiveDOMObject.cpp: * bindings/scripts/test/JS/JSTestCEReactions.cpp: * bindings/scripts/test/JS/JSTestCEReactionsStringifier.cpp: * bindings/scripts/test/JS/JSTestCallTracer.cpp: * bindings/scripts/test/JS/JSTestClassWithJSBuiltinConstructor.cpp: * bindings/scripts/test/JS/JSTestCustomConstructorWithNoInterfaceObject.cpp: * bindings/scripts/test/JS/JSTestDOMJIT.cpp: * bindings/scripts/test/JS/JSTestEnabledBySetting.cpp: * bindings/scripts/test/JS/JSTestEventConstructor.cpp: * bindings/scripts/test/JS/JSTestEventTarget.cpp: * bindings/scripts/test/JS/JSTestException.cpp: * bindings/scripts/test/JS/JSTestGenerateIsReachable.cpp: * bindings/scripts/test/JS/JSTestGlobalObject.cpp: * bindings/scripts/test/JS/JSTestIndexedSetterNoIdentifier.cpp: * bindings/scripts/test/JS/JSTestIndexedSetterThrowingException.cpp: * bindings/scripts/test/JS/JSTestIndexedSetterWithIdentifier.cpp: * bindings/scripts/test/JS/JSTestInterface.cpp: * bindings/scripts/test/JS/JSTestInterfaceLeadingUnderscore.cpp: * bindings/scripts/test/JS/JSTestIterable.cpp: * bindings/scripts/test/JS/JSTestMediaQueryListListener.cpp: * bindings/scripts/test/JS/JSTestNamedAndIndexedSetterNoIdentifier.cpp: * bindings/scripts/test/JS/JSTestNamedAndIndexedSetterThrowingException.cpp: * bindings/scripts/test/JS/JSTestNamedAndIndexedSetterWithIdentifier.cpp: * bindings/scripts/test/JS/JSTestNamedConstructor.cpp: * bindings/scripts/test/JS/JSTestNamedDeleterNoIdentifier.cpp: * bindings/scripts/test/JS/JSTestNamedDeleterThrowingException.cpp: * bindings/scripts/test/JS/JSTestNamedDeleterWithIdentifier.cpp: * bindings/scripts/test/JS/JSTestNamedDeleterWithIndexedGetter.cpp: * bindings/scripts/test/JS/JSTestNamedGetterCallWith.cpp: * bindings/scripts/test/JS/JSTestNamedGetterNoIdentifier.cpp: * bindings/scripts/test/JS/JSTestNamedGetterWithIdentifier.cpp: * bindings/scripts/test/JS/JSTestNamedSetterNoIdentifier.cpp: * bindings/scripts/test/JS/JSTestNamedSetterThrowingException.cpp: * bindings/scripts/test/JS/JSTestNamedSetterWithIdentifier.cpp: * bindings/scripts/test/JS/JSTestNamedSetterWithIndexedGetter.cpp: * bindings/scripts/test/JS/JSTestNamedSetterWithIndexedGetterAndSetter.cpp: * bindings/scripts/test/JS/JSTestNamedSetterWithOverrideBuiltins.cpp: * bindings/scripts/test/JS/JSTestNamedSetterWithUnforgableProperties.cpp: * bindings/scripts/test/JS/JSTestNamedSetterWithUnforgablePropertiesAndOverrideBuiltins.cpp: * bindings/scripts/test/JS/JSTestNode.cpp: * bindings/scripts/test/JS/JSTestObj.cpp: * bindings/scripts/test/JS/JSTestOverloadedConstructors.cpp: * bindings/scripts/test/JS/JSTestOverloadedConstructorsWithSequence.cpp: * bindings/scripts/test/JS/JSTestOverrideBuiltins.cpp: * bindings/scripts/test/JS/JSTestPluginInterface.cpp: * bindings/scripts/test/JS/JSTestPromiseRejectionEvent.cpp: * bindings/scripts/test/JS/JSTestSerialization.cpp: * bindings/scripts/test/JS/JSTestSerializationIndirectInheritance.cpp: * bindings/scripts/test/JS/JSTestSerializationInherit.cpp: * bindings/scripts/test/JS/JSTestSerializationInheritFinal.cpp: * bindings/scripts/test/JS/JSTestSerializedScriptValueInterface.cpp: * bindings/scripts/test/JS/JSTestStringifier.cpp: * bindings/scripts/test/JS/JSTestStringifierAnonymousOperation.cpp: * bindings/scripts/test/JS/JSTestStringifierNamedOperation.cpp: * bindings/scripts/test/JS/JSTestStringifierOperationImplementedAs.cpp: * bindings/scripts/test/JS/JSTestStringifierOperationNamedToString.cpp: * bindings/scripts/test/JS/JSTestStringifierReadOnlyAttribute.cpp: * bindings/scripts/test/JS/JSTestStringifierReadWriteAttribute.cpp: * bindings/scripts/test/JS/JSTestTypedefs.cpp: Updated expected results. : * css/parser/CSSPropertyParserHelpers.cpp: (WebCore::CSSPropertyParserHelpers::parseHexColor): Use String::number and makeString. * html/HTMLSelectElement.cpp: (WebCore::HTMLSelectElement::setLength): Use makeString. * html/ImageDocument.cpp: (WebCore::ImageDocument::imageUpdated): Ditto. * html/parser/XSSAuditor.cpp: (WebCore::XSSAuditor::init): Ditto. * inspector/InspectorFrontendClientLocal.cpp: (WebCore::InspectorFrontendClientLocal::setDockingUnavailable): Ditto. (WebCore::InspectorFrontendClientLocal::setAttachedWindow): Ditto. (WebCore::InspectorFrontendClientLocal::setDebuggingEnabled): Ditto. (WebCore::InspectorFrontendClientLocal::setTimelineProfilingEnabled): Ditto. (WebCore::InspectorFrontendClientLocal::showMainResourceForFrame): Ditto. * inspector/agents/InspectorCSSAgent.cpp: Ditto. * inspector/agents/InspectorIndexedDBAgent.cpp: Ditto. * page/MemoryRelease.cpp: (WebCore::logMemoryStatisticsAtTimeOfDeath): Ditto. * page/cocoa/ResourceUsageOverlayCocoa.mm: (WebCore::formatByteNumber): Use String::number. (WebCore::ResourceUsageOverlay::platformDraw): Use string concatenation. * page/cocoa/ResourceUsageThreadCocoa.mm: (WebCore::logFootprintComparison): Use makeString. * platform/animation/TimingFunction.cpp: (WebCore::TimingFunction::cssText const): Ditto. * platform/graphics/avfoundation/AVTrackPrivateAVFObjCImpl.mm: (WebCore::AVTrackPrivateAVFObjCImpl::id const): Use AtomicString::number. * platform/graphics/avfoundation/objc/MediaSampleAVFObjC.h: (WebCore::MediaSampleAVFObjC::MediaSampleAVFObjC): Ditto. * platform/graphics/ca/GraphicsLayerCA.cpp: (WebCore::GraphicsLayerCA::setContentsToSolidColor): Use makeString. (WebCore::GraphicsLayerCA::updateContentsImage): Ditto. (WebCore::GraphicsLayerCA::updateContentsRects): Ditto. (WebCore::GraphicsLayerCA::createTransformAnimationsFromKeyframes): Ditto. * platform/mock/MockRealtimeVideoSource.cpp: (WebCore::MockRealtimeVideoSource::drawText): Ditto. * platform/mock/mediasource/MockSourceBufferPrivate.cpp: Use String::number. * platform/network/ParsedContentRange.cpp: (WebCore::ParsedContentRange::headerValue const): Use makeString. * platform/network/cf/NetworkStorageSessionCFNet.cpp: Removed some unnecessary compiler conditionals and reorganized the start/stop of namespaces. (WebCore::NetworkStorageSession::switchToNewTestingSession): Use makeString. * platform/sql/SQLiteDatabase.cpp: (WebCore::unauthorizedSQLFunction): Use makeString. * rendering/RenderLayerCompositor.cpp: (WebCore::RenderLayerCompositor::logLayerInfo): Ditto. * workers/service/server/RegistrationDatabase.cpp: (WebCore::RegistrationDatabase::ensureValidRecordsTable): Ditto. (WebCore::RegistrationDatabase::importRecords): Ditto. 2019-01-27 Wenson Hsieh Remove a couple of PLATFORM defines intended for watchOS https://bugs.webkit.org/show_bug.cgi?id=193888 Reviewed by Alexey Proskuryakov. Remove the use of !PLATFORM(WATCH), since this is true on every platform. * editing/cocoa/DictionaryLookup.mm: 2019-01-27 Jiewen Tan Use a load optimizer for some sites https://bugs.webkit.org/show_bug.cgi?id=193881 Reviewed by Brent Fulgham. Expose FormData::flatten to be used by the load optimizer. * WebCore.xcodeproj/project.pbxproj: * platform/network/FormData.h: 2019-01-26 Simon Fraser Have composited RenderIFrame layers make FrameHosting scrolling tree nodes to parent the iframe's scrolling node https://bugs.webkit.org/show_bug.cgi?id=193879 Reviewed by Antti Koivisto. Currently we parent iframe scrolling tree nodes by finding the closest ancestor layer with a scrolling tree node. This results in scrolling tree nodes being connected across iframe boundaries in some arbitrary ancestor. This makes updating scrolling tree geometry very error-prone, since changes in the parent document will need to trigger updates of the scrolling tree node in an iframe. To address this, I already added a new "FrameHosting" scrolling node type. This patch actually instantiates these nodes, which are owned by the RenderIFrame's composited layer. Connecting across frame boundaries is theforefore simply a case of getting the FrameHosting node from the ownerElement's renderer; this is very similar to how we connect GraphicsLayers together. RenderLayerBacking gains another scrolling role for FrameHosting and ScrollingNodeID. Tested by existing tests. * page/FrameView.h: * rendering/RenderLayer.cpp: (WebCore::outputPaintOrderTreeRecursive): * rendering/RenderLayerBacking.cpp: (WebCore::RenderLayerBacking::updateConfiguration): (WebCore::RenderLayerBacking::detachFromScrollingCoordinator): * rendering/RenderLayerCompositor.cpp: (WebCore::frameContentsRenderView): (WebCore::RenderLayerCompositor::frameContentsCompositor): (WebCore::RenderLayerCompositor::parentFrameContentLayers): (WebCore::RenderLayerCompositor::isLayerForIFrameWithScrollCoordinatedContents const): (WebCore::RenderLayerCompositor::detachRootLayer): (WebCore::RenderLayerCompositor::updateScrollCoordinatedStatus): (WebCore::RenderLayerCompositor::removeFromScrollCoordinatedLayers): (WebCore::scrollCoordinatedAncestorInParentOfFrame): (WebCore::RenderLayerCompositor::reattachSubframeScrollLayers): (WebCore::RenderLayerCompositor::attachScrollingNode): (WebCore::RenderLayerCompositor::updateScrollCoordinationForThisFrame): (WebCore::RenderLayerCompositor::updateScrollCoordinatedLayer): * rendering/RenderLayerCompositor.h: * testing/Internals.cpp: (WebCore::Internals::scrollingStateTreeAsText const): 2019-01-27 Chris Fleizach AX: Introduce a static accessibility tree https://bugs.webkit.org/show_bug.cgi?id=193348 Reviewed by Ryosuke Niwa. In order to improve performance when requesting the accessibility hierarchy, we introduce the idea of a "static accessibility tree" which could be accessed on a different thread by assistive technologies. That is accomplished by storing all the data needed to answer accessibility attribute queries in a static object that mirrors the "live" AccessibilityObjects (which interact with both DOM and Render trees). These static objects are generally created after layout is done and final tasks are being performed. They are then stored in the static tree representation and able to be read from anywhere. Tactically this is done with AXIsolatedTreeNodes inside of an AXIsolatedTree. The TreeNodes implement an AccessibilityObjectInterface shared with AccessibilityObject. This allows the wrappers to access either one depending on conditions and platforms without significant code duplication or re-organization. * CMakeLists.txt: * Configurations/FeatureDefines.xcconfig: * Sources.txt: * WebCore.xcodeproj/project.pbxproj: * accessibility/AXObjectCache.cpp: (WebCore::AXObjectCache::remove): (WebCore::AXObjectCache::createIsolatedAccessibilityTree): (WebCore::AXObjectCache::generateStaticAccessibilityTreeIfNeeded): * accessibility/AXObjectCache.h: * accessibility/AccessibilityObject.h: * accessibility/AccessibilityObjectInterface.h: Added. * accessibility/isolatedtree: Added. * accessibility/isolatedtree/AXIsolatedTree.cpp: Added. (WebCore::AXIsolatedTree::treeCache): (WebCore::AXIsolatedTree::AXIsolatedTree): (WebCore::AXIsolatedTree::create): (WebCore::AXIsolatedTree::treeForID): (WebCore::AXIsolatedTree::treeForPageID): (WebCore::AXIsolatedTree::nodeForID const): (WebCore::AXIsolatedTree::rootNode): (WebCore::AXIsolatedTree::removeNode): (WebCore::AXIsolatedTree::appendNodeChanges): (WebCore::AXIsolatedTree::applyPendingChanges): * accessibility/isolatedtree/AXIsolatedTree.h: Added. (WebCore::AXIsolatedTree::treeIdentifier const): * accessibility/isolatedtree/AXIsolatedTreeNode.cpp: Added. To note: we don't mark the attribute map const because even though attributes don't change after initial creation, we may copy an existing node and replace specific values. (WebCore::AXIsolatedTreeNode::AXIsolatedTreeNode): (WebCore::AXIsolatedTreeNode::create): (WebCore::AXIsolatedTreeNode::initializeAttributeData): (WebCore::AXIsolatedTreeNode::setProperty): (WebCore::AXIsolatedTreeNode::doubleAttributeValue const): (WebCore::AXIsolatedTreeNode::unsignedAttributeValue const): (WebCore::AXIsolatedTreeNode::boolAttributeValue const): (WebCore::AXIsolatedTreeNode::stringAttributeValue const): (WebCore::AXIsolatedTreeNode::intAttributeValue const): * accessibility/isolatedtree/AXIsolatedTreeNode.h: Added. * accessibility/mac/AXObjectCacheMac.mm: (WebCore::AXObjectCache::associateIsolatedTreeNode): * accessibility/mac/WebAccessibilityObjectWrapperBase.h: * accessibility/mac/WebAccessibilityObjectWrapperBase.mm: (-[WebAccessibilityObjectWrapperBase initWithAccessibilityObject:]): (-[WebAccessibilityObjectWrapperBase isolatedTreeNode]): (-[WebAccessibilityObjectWrapperBase detach]): (-[WebAccessibilityObjectWrapperBase updateObjectBackingStore]): (-[WebAccessibilityObjectWrapperBase axBackingObject]): (-[WebAccessibilityObjectWrapperBase baseAccessibilityDescription]): * accessibility/mac/WebAccessibilityObjectWrapperMac.mm: (-[WebAccessibilityObjectWrapper role]): (-[WebAccessibilityObjectWrapper subrole]): (-[WebAccessibilityObjectWrapper roleDescription]): (-[WebAccessibilityObjectWrapper accessibilityAttributeValue:]): * dom/Document.cpp: (WebCore::Document::pageID const): * dom/Document.h: 2019-01-26 Simon Fraser Allow scrolling tree nodes to exist in a detached state https://bugs.webkit.org/show_bug.cgi?id=193754 Reviewed by Zalan Bujtas. One of the (questionable?) design decisions of the scrolling tree is that the tree implementation is hidden behind the ScrollingCoordinator interface. That interface only allowed nodes to exist in a connected state; attachToStateTree() required a non-zero parent for any node that was not the root. This makes it impossible to coordinate the hookup of the scrolling tree across frame boundaries; the scrolling tree has to have been fully constructed in ancestor frames before subframe nodes can be attached. This is a significant difference from compositing, where a subframe can create GraphicsLayers which don't have to be parented right away, and actually get parented later via a compositing update in the parent frame. We want to be able to hook up the scrolling tree via the same code paths as GraphicsLayer connection (anything else is too confusing). So we need to be able to instantiate scrolling tree nodes in a disconnected state, and attach them later. To achieve this, add the notion of "unparented" nodes to ScrollingCoordinator and the ScrollingStateTree. Allow clients to create unparented nodes, which can be attached later. ScrollingCoordinator stores the roots of unparented subtrees in an owning HashMap. Nodes in unparented trees are still referenced by m_stateNodeMap, so it's possible to find them and set state on them. Clean up the ScrollingCoordinator interface to remove "state tree" terminology; the state vs. scrolling tree is really an implementation detail. This also removes the special-casing of ScrollingNodeType::Subframe nodes which ScrollingStateTree stored in m_orphanedSubframeNodes; now the unparenting is controlled by the client. Currently no code creates unparented nodes so there is no behavior change. * dom/Document.cpp: (WebCore::Document::setPageCacheState): * page/scrolling/AsyncScrollingCoordinator.cpp: (WebCore::AsyncScrollingCoordinator::createNode): (WebCore::AsyncScrollingCoordinator::insertNode): (WebCore::AsyncScrollingCoordinator::unparentNode): (WebCore::AsyncScrollingCoordinator::unparentChildrenAndDestroyNode): (WebCore::AsyncScrollingCoordinator::detachAndDestroySubtree): (WebCore::AsyncScrollingCoordinator::clearAllNodes): (WebCore::AsyncScrollingCoordinator::parentOfNode const): (WebCore::AsyncScrollingCoordinator::ensureRootStateNodeForFrameView): (WebCore::AsyncScrollingCoordinator::attachToStateTree): Deleted. (WebCore::AsyncScrollingCoordinator::detachFromStateTree): Deleted. (WebCore::AsyncScrollingCoordinator::clearStateTree): Deleted. * page/scrolling/AsyncScrollingCoordinator.h: * page/scrolling/ScrollingCoordinator.h: (WebCore::ScrollingCoordinator::handleWheelEvent): (WebCore::ScrollingCoordinator::createNode): (WebCore::ScrollingCoordinator::insertNode): (WebCore::ScrollingCoordinator::unparentNode): (WebCore::ScrollingCoordinator::unparentChildrenAndDestroyNode): (WebCore::ScrollingCoordinator::detachAndDestroySubtree): (WebCore::ScrollingCoordinator::clearAllNodes): (WebCore::ScrollingCoordinator::parentOfNode const): (WebCore::ScrollingCoordinator::childrenOfNode const): (WebCore::ScrollingCoordinator::attachToStateTree): Deleted. (WebCore::ScrollingCoordinator::detachFromStateTree): Deleted. (WebCore::ScrollingCoordinator::clearStateTree): Deleted. * page/scrolling/ScrollingStateNode.cpp: (WebCore::ScrollingStateNode::removeFromParent): (WebCore::ScrollingStateNode::removeChild): * page/scrolling/ScrollingStateNode.h: * page/scrolling/ScrollingStateTree.cpp: (WebCore::ScrollingStateTree::ScrollingStateTree): (WebCore::ScrollingStateTree::createUnparentedNode): (WebCore::ScrollingStateTree::insertNode): (WebCore::ScrollingStateTree::unparentNode): (WebCore::ScrollingStateTree::unparentChildrenAndDestroyNode): (WebCore::ScrollingStateTree::detachAndDestroySubtree): (WebCore::ScrollingStateTree::clear): (WebCore::ScrollingStateTree::commit): (WebCore::ScrollingStateTree::removeNodeAndAllDescendants): (WebCore::ScrollingStateTree::recursiveNodeWillBeRemoved): (showScrollingStateTree): (WebCore::ScrollingStateTree::attachNode): Deleted. (WebCore::ScrollingStateTree::detachNode): Deleted. * page/scrolling/ScrollingStateTree.h: (WebCore::ScrollingStateTree::nodeCount const): * rendering/RenderLayerBacking.cpp: (WebCore::RenderLayerBacking::detachFromScrollingCoordinator): * rendering/RenderLayerCompositor.cpp: (WebCore::RenderLayerCompositor::reattachSubframeScrollLayers): (WebCore::RenderLayerCompositor::attachScrollingNode): 2019-01-26 Devin Rousso Web Inspector: provide a way to edit the user agent of a remote target https://bugs.webkit.org/show_bug.cgi?id=193862 Reviewed by Joseph Pecoraro. Test: inspector/page/overrideUserAgent.html * loader/FrameLoader.cpp: (WebCore::FrameLoader::userAgent const): (WebCore::FrameLoader::userAgentForJavaScript const): * inspector/InspectorInstrumentation.h: (WebCore::InspectorInstrumentation::applyUserAgentOverride): Added. * inspector/InspectorInstrumentation.cpp: (WebCore::InspectorInstrumentation::applyUserAgentOverrideImpl): Added. * inspector/agents/InspectorPageAgent.h: * inspector/agents/InspectorPageAgent.cpp: (WebCore::InspectorPageAgent::disable): (WebCore::InspectorPageAgent::overrideUserAgent): Added. (WebCore::InspectorPageAgent::applyUserAgentOverride): Added. 2019-01-26 Zalan Bujtas [LFC] The initial values for top/bottom in contentHeightForFormattingContextRoot should not be 0. https://bugs.webkit.org/show_bug.cgi?id=193867 Reviewed by Antti Koivisto. The initial content top/bottom value is the border top + padding top. This is only a problem when the box has float children only. While computing the height using the bottom-most float, we call "top = std::min(floatTop, top)". With 0 initial top value, this returns an incorrect result when the box has (top)border/padding. Test: fast/block/block-only/abs-pos-with-border-padding-and-float-child.html * layout/FormattingContextGeometry.cpp: (WebCore::Layout::contentHeightForFormattingContextRoot): 2019-01-26 Zalan Bujtas [LFC][BFC] Ignore last inflow child's collapsed through margin after when computing containing block's height. https://bugs.webkit.org/show_bug.cgi?id=193865 Reviewed by Antti Koivisto. Height computation -> // 10.6.3 Block-level non-replaced elements in normal flow when 'overflow' computes to 'visible' // ...the bottom edge of the bottom (possibly collapsed) margin of its last in-flow child, if the child's bottom // margin does not collapse with the element's bottom margin
When the child vertical margins collapse through (margin-top = margin-bottom = 100px), the bottom edge of the bottom margin is the same as the bottom edge of the top margin which is alredy taken into use while positioning so technically the bottom margin value should be ignored. Test: fast/block/margin-collapse/collapsed-through-child-simple.html * layout/MarginTypes.h: (WebCore::Layout::UsedVerticalMargin::isCollapsedThrough const): * layout/blockformatting/BlockFormattingContextGeometry.cpp: (WebCore::Layout::BlockFormattingContext::Geometry::inFlowNonReplacedHeightAndMargin): * layout/displaytree/DisplayBox.h: (WebCore::Display::Box::hasCollapsedThroughMargin const): 2019-01-26 Zalan Bujtas [LFC][BFC][MarginCollapsing] marginAfterCollapsesWithParentMarginAfter/marginAfterCollapsesWithLastInFlowChildMarginAfter should check for border/padding after values. https://bugs.webkit.org/show_bug.cgi?id=193864 Reviewed by Antti Koivisto. * layout/blockformatting/BlockMarginCollapse.cpp: (WebCore::Layout::BlockFormattingContext::MarginCollapse::marginAfterCollapsesWithParentMarginAfter): (WebCore::Layout::BlockFormattingContext::MarginCollapse::marginAfterCollapsesWithLastInFlowChildMarginAfter): 2019-01-26 Zalan Bujtas [LFC] Box::nextInFlowOrFloatingSibling() should always return sibling floats as well. https://bugs.webkit.org/show_bug.cgi?id=193855 Reviewed by Antti Koivisto. Use iterative algorithm to find next/previous siblings. * layout/layouttree/LayoutBox.cpp: (WebCore::Layout::Box::nextInFlowOrFloatingSibling const): 2019-01-25 Ryosuke Niwa Need a mechanism to override navigator.userAgent https://bugs.webkit.org/show_bug.cgi?id=193762 Reviewed by Brent Fulgham. Added the ability to specify user agent string just for navigator.userAgent via DocumentLoader. * loader/DocumentLoader.h: (WebCore::DocumentLoader::setCustomJavaScriptUserAgent): (WebCore::DocumentLoader::customJavaScriptUserAgent const): * loader/FrameLoader.cpp: (WebCore::FrameLoader::userAgentForJavaScript const): * loader/FrameLoader.h: * page/Navigator.cpp: (WebCore::Navigator::userAgent const): 2019-01-25 Devin Rousso Web Inspector: provide a way to edit page settings on a remote target https://bugs.webkit.org/show_bug.cgi?id=193813 Reviewed by Joseph Pecoraro. Test: inspector/page/overrideSetting.html * page/Settings.yaml: * Scripts/GenerateSettings.rb: * Scripts/SettingsTemplates/Settings.cpp.erb: * Scripts/SettingsTemplates/Settings.h.erb: Add support for an `inspectorOverride` boolean value for each setting that will take precedence over the actual `Setting`'s value when set. * inspector/agents/InspectorPageAgent.h: * inspector/agents/InspectorPageAgent.cpp: (WebCore::InspectorPageAgent::disable): (WebCore::InspectorPageAgent::overrideSetting): Added. * inspector/InspectorFrontendHost.idl: * inspector/InspectorFrontendHost.h: * inspector/InspectorFrontendHost.cpp: (WebCore::InspectorFrontendHost::isRemote const): Added. * inspector/InspectorFrontendClient.h: (WebCore::InspectorFrontendClient::isRemote const): Added. * inspector/InspectorFrontendClientLocal.h: (WebCore::InspectorFrontendClientLocal::isRemote const): Added. 2019-01-25 Wenson Hsieh Document::updateMainArticleElementAfterLayout() should be a no-op when no client depends on knowing the main article element https://bugs.webkit.org/show_bug.cgi?id=193843 Reviewed by Zalan Bujtas. * dom/Document.cpp: (WebCore::Document::updateMainArticleElementAfterLayout): This function currently does a bit of wasted work after every layout, on clients that don't listen to the "significant rendered text" layout milestone and therefore don't need to guess the main article element. Simply don't bother keeping the main article element up to date in this scenario by bailing from FrameView::updateHasReachedSignificantRenderedTextThreshold if the client doesn't care about the significant rendered text milestone. * page/FrameView.cpp: (WebCore::FrameView::updateHasReachedSignificantRenderedTextThreshold): 2019-01-25 Jer Noble