2020-10-20 Alan Coon <alancoon@apple.com> Cherry-pick r268712. rdar://problem/70488953 Fix crash in RenderLayerBacking::updateClippingStackLayerGeometry() https://bugs.webkit.org/show_bug.cgi?id=217940 <rdar://problem/70316952> Reviewed by Tim Horton. Crash data suggest that entry.clipData.clippingLayer (which is a WeakRef<RenderLayer>) can be null, so check it. * rendering/RenderLayerBacking.cpp: (WebCore::RenderLayerBacking::updateClippingStackLayerGeometry): git-svn-id: https://svn.webkit.org/repository/webkit/trunk@268712 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-10-19 Simon Fraser <simon.fraser@apple.com> Fix crash in RenderLayerBacking::updateClippingStackLayerGeometry() https://bugs.webkit.org/show_bug.cgi?id=217940 <rdar://problem/70316952> Reviewed by Tim Horton. Crash data suggest that entry.clipData.clippingLayer (which is a WeakRef<RenderLayer>) can be null, so check it. * rendering/RenderLayerBacking.cpp: (WebCore::RenderLayerBacking::updateClippingStackLayerGeometry): 2020-10-20 Alan Coon <alancoon@apple.com> Cherry-pick r268701. rdar://problem/70488900 Fix possible crash in GraphicsLayerCA::computeVisibleAndCoverageRect() https://bugs.webkit.org/show_bug.cgi?id=217930 <rdar://problem/70316943> Reviewed by Tim Horton. If we made a m_overflowControlsHostLayerAncestorClippingStack, make sure we unparent its layers when tearing down the RenderLayerBacking, and when we determine that we longer need a m_ancestorClippingStack (having a m_overflowControlsHostLayerAncestorClippingStack implies that we have a m_ancestorClippingStack). * rendering/RenderLayerBacking.cpp: (WebCore::RenderLayerBacking::destroyGraphicsLayers): (WebCore::RenderLayerBacking::updateAncestorClipping): git-svn-id: https://svn.webkit.org/repository/webkit/trunk@268701 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-10-19 Simon Fraser <simon.fraser@apple.com> Fix possible crash in GraphicsLayerCA::computeVisibleAndCoverageRect() https://bugs.webkit.org/show_bug.cgi?id=217930 <rdar://problem/70316943> Reviewed by Tim Horton. If we made a m_overflowControlsHostLayerAncestorClippingStack, make sure we unparent its layers when tearing down the RenderLayerBacking, and when we determine that we longer need a m_ancestorClippingStack (having a m_overflowControlsHostLayerAncestorClippingStack implies that we have a m_ancestorClippingStack). * rendering/RenderLayerBacking.cpp: (WebCore::RenderLayerBacking::destroyGraphicsLayers): (WebCore::RenderLayerBacking::updateAncestorClipping): 2020-10-19 Kocsen Chung <kocsen_chung@apple.com> Cherry-pick r266787. rdar://problem/70447326 AccessibilityMenuList and MenuListPopup notifications need to be posted asynchronously. https://bugs.webkit.org/show_bug.cgi?id=216309 <rdar://problem/68108824> Reviewed by Chris Fleizach. MenuList notifications were posted synchronously which triggers a DOM layout and style update in the middle of an ongoing DOM mutation update. This is unnecessary and, furthermore, causes crashes since the DOM layout update cannot be re-entrant. This change makes these notifications asynchronous. * accessibility/AccessibilityMenuList.cpp: (WebCore::AccessibilityMenuList::didUpdateActiveOption): * accessibility/AccessibilityMenuListPopup.cpp: (WebCore::AccessibilityMenuListPopup::didUpdateActiveOption): git-svn-id: https://svn.webkit.org/repository/webkit/trunk@266787 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-09-09 Andres Gonzalez <andresg_22@apple.com> AccessibilityMenuList and MenuListPopup notifications need to be posted asynchronously. https://bugs.webkit.org/show_bug.cgi?id=216309 <rdar://problem/68108824> Reviewed by Chris Fleizach. MenuList notifications were posted synchronously which triggers a DOM layout and style update in the middle of an ongoing DOM mutation update. This is unnecessary and, furthermore, causes crashes since the DOM layout update cannot be re-entrant. This change makes these notifications asynchronous. * accessibility/AccessibilityMenuList.cpp: (WebCore::AccessibilityMenuList::didUpdateActiveOption): * accessibility/AccessibilityMenuListPopup.cpp: (WebCore::AccessibilityMenuListPopup::didUpdateActiveOption): 2020-10-14 Alan Coon <alancoon@apple.com> Cherry-pick r268308. rdar://problem/70321631 [Mac] AirPlay menu does not show up when AirPlay button is clicked https://bugs.webkit.org/show_bug.cgi?id=217536 <rdar://problem/69973777> Reviewed by Eric Carlson. Source/WebCore: PAL tries to soft-link the AVRoutePickerView from the AVFoundation framework, rather than the (correct) AVKit framework. Remove AVRoutePickerView from AVFoundationSoftLink.h and use the already declared version inside AVRoutePickerViewTargetPicker.mm. * platform/graphics/avfoundation/objc/AVRoutePickerViewTargetPicker.mm: (WebCore::AVRoutePickerViewTargetPicker::isAvailable): Source/WebCore/PAL: * pal/cocoa/AVFoundationSoftLink.h: * pal/cocoa/AVFoundationSoftLink.mm: git-svn-id: https://svn.webkit.org/repository/webkit/trunk@268308 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-10-09 Jer Noble <jer.noble@apple.com> [Mac] AirPlay menu does not show up when AirPlay button is clicked https://bugs.webkit.org/show_bug.cgi?id=217536 <rdar://problem/69973777> Reviewed by Eric Carlson. PAL tries to soft-link the AVRoutePickerView from the AVFoundation framework, rather than the (correct) AVKit framework. Remove AVRoutePickerView from AVFoundationSoftLink.h and use the already declared version inside AVRoutePickerViewTargetPicker.mm. * platform/graphics/avfoundation/objc/AVRoutePickerViewTargetPicker.mm: (WebCore::AVRoutePickerViewTargetPicker::isAvailable): 2020-10-12 Babak Shafiei <bshafiei@apple.com> Cherry-pick r268330. rdar://problem/70189394 Strip patch version from TARGET_MAC_OS_X_VERSION_MAJOR when building for macOS Big Sur or later https://bugs.webkit.org/show_bug.cgi?id=217594 rdar://70188497 Patch by Luming Yin <luming_yin@apple.com> on 2020-10-11 Reviewed by Darin Adler. To ensure successful Mac Catalyst WebKit builds, strip the patch version from TARGET_MAC_OS_X_VERSION_MAJOR by using two `base:`s on MACOSX_DEPLOYMENT_TARGET. * Configurations/Base.xcconfig: git-svn-id: https://svn.webkit.org/repository/webkit/trunk@268330 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-10-11 Luming Yin <luming_yin@apple.com> Strip patch version from TARGET_MAC_OS_X_VERSION_MAJOR when building for macOS Big Sur or later https://bugs.webkit.org/show_bug.cgi?id=217594 rdar://70188497 Reviewed by Darin Adler. To ensure successful Mac Catalyst WebKit builds, strip the patch version from TARGET_MAC_OS_X_VERSION_MAJOR by using two `base:`s on MACOSX_DEPLOYMENT_TARGET. * Configurations/Base.xcconfig: 2020-10-12 Babak Shafiei <bshafiei@apple.com> Cherry-pick r268327. rdar://problem/70189401 Ignore deployment suffix and identifier when computing major OS version for macOS Big Sur and newer https://bugs.webkit.org/show_bug.cgi?id=217584 rdar://70168426 Patch by Luming Yin <luming_yin@apple.com> on 2020-10-11 Reviewed by Darin Adler. Stop using MACOSX_DEPLOYMENT_TARGET:suffix:identifier to compute major OS versions. Only use the deployment target base for macOS Big Sur and newer. Keep the manual definitions for legacy versions of macOS. * Configurations/Base.xcconfig: git-svn-id: https://svn.webkit.org/repository/webkit/trunk@268327 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-10-11 Luming Yin <luming_yin@apple.com> Ignore deployment suffix and identifier when computing major OS version for macOS Big Sur and newer https://bugs.webkit.org/show_bug.cgi?id=217584 rdar://70168426 Reviewed by Darin Adler. Stop using MACOSX_DEPLOYMENT_TARGET:suffix:identifier to compute major OS versions. Only use the deployment target base for macOS Big Sur and newer. Keep the manual definitions for legacy versions of macOS. * Configurations/Base.xcconfig: 2020-10-09 Russell Epstein <repstein@apple.com> Cherry-pick r268003. rdar://problem/70142496 Make NetscapePlugInStreamLoaderClient a weak pointer on NetscapePlugInStreamLoader <https://webkit.org/b/217237> <rdar://problem/69776714> Reviewed by Alex Christensen. Source/WebCore: Could not write a test since reproducing a crash requires rapidly reloading a URL to a PDF at random points during the previous load. Make NetscapePlugInStreamLoaderClient a WeakPtr on NetscapePlugInStreamLoader, and add nullptr checks for NetscapePlugInStreamLoader.m_client as needed. * loader/NetscapePlugInStreamLoader.cpp: (WebCore::NetscapePlugInStreamLoader::NetscapePlugInStreamLoader): (WebCore::NetscapePlugInStreamLoader::willSendRequest): (WebCore::NetscapePlugInStreamLoader::didReceiveResponse): (WebCore::NetscapePlugInStreamLoader::didReceiveDataOrBuffer): (WebCore::NetscapePlugInStreamLoader::didFinishLoading): (WebCore::NetscapePlugInStreamLoader::didFail): (WebCore::NetscapePlugInStreamLoader::willCancel): * loader/NetscapePlugInStreamLoader.h: Source/WebKit: Making NetscapePlugInStreamLoaderClient inherit from CanMakeWeakPtr<> caused PDFPlugin to fail to compile because one of its parent classes already inherited from CanMakeWeakPtr<>. To fix this, extract a PDFPluginStreamLoaderClient class from PDFPlugin and link the lifetime of PDFPluginStreamLoaderClient to PDFPlugin. After moving the NetscapePlugInStreamLoaderClient virtual methods from PDFPlugin to PDFPluginStreamLoaderClient, add some simple methods to PDFPlugin so that PDFPluginStreamLoaderClient doesn't access the instance variables directly. Also make use of these new methods in other parts of PDFPlugin. * WebProcess/Plugins/PDF/PDFPlugin.h: (WebKit::PDFPlugin::documentFinishedLoading): Add. (WebKit::PDFPlugin::identifierForLoader): Add. (WebKit::PDFPlugin::removeOutstandingByteRangeRequest): Add. (WebKit::PDFPlugin::PDFPluginStreamLoaderClient): Add class. * WebProcess/Plugins/PDF/PDFPlugin.mm: (WebKit::PDFPlugin::PDFPlugin): (WebKit::PDFPlugin::receivedNonLinearizedPDFSentinel): (WebKit::PDFPlugin::getResourceBytesAtPosition): (WebKit::PDFPlugin::PDFPluginStreamLoaderClient::willSendRequest): Move from PDFPlugin. (WebKit::PDFPlugin::PDFPluginStreamLoaderClient::didReceiveResponse): Ditto. (WebKit::PDFPlugin::PDFPluginStreamLoaderClient::didReceiveData): Ditto. (WebKit::PDFPlugin::PDFPluginStreamLoaderClient::didFail): Ditto. (WebKit::PDFPlugin::PDFPluginStreamLoaderClient::didFinishLoading): Ditto. (WebKit::PDFPlugin::byteRangeRequestForLoader): (WebKit::PDFPlugin::forgetLoader): (WebKit::PDFPlugin::willSendRequest): Move to PDFPluginStreamLoaderClient. (WebKit::PDFPlugin::didReceiveResponse): Ditto. (WebKit::PDFPlugin::didReceiveData): Ditto. (WebKit::PDFPlugin::didFail): Ditto. (WebKit::PDFPlugin::didFinishLoading): Ditto. git-svn-id: https://svn.webkit.org/repository/webkit/trunk@268003 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-10-05 David Kilzer <ddkilzer@apple.com> Make NetscapePlugInStreamLoaderClient a weak pointer on NetscapePlugInStreamLoader <https://webkit.org/b/217237> <rdar://problem/69776714> Reviewed by Alex Christensen. Could not write a test since reproducing a crash requires rapidly reloading a URL to a PDF at random points during the previous load. Make NetscapePlugInStreamLoaderClient a WeakPtr on NetscapePlugInStreamLoader, and add nullptr checks for NetscapePlugInStreamLoader.m_client as needed. * loader/NetscapePlugInStreamLoader.cpp: (WebCore::NetscapePlugInStreamLoader::NetscapePlugInStreamLoader): (WebCore::NetscapePlugInStreamLoader::willSendRequest): (WebCore::NetscapePlugInStreamLoader::didReceiveResponse): (WebCore::NetscapePlugInStreamLoader::didReceiveDataOrBuffer): (WebCore::NetscapePlugInStreamLoader::didFinishLoading): (WebCore::NetscapePlugInStreamLoader::didFail): (WebCore::NetscapePlugInStreamLoader::willCancel): * loader/NetscapePlugInStreamLoader.h: 2020-10-08 Russell Epstein <repstein@apple.com> Cherry-pick r266909. rdar://problem/69101091 Source/WebCore: Text replacements at the beginning of a second line are replaced too early https://bugs.webkit.org/show_bug.cgi?id=216327 <rdar://problem/68170353> Reviewed by Darin Adler. In the changes in r258871, using SimpleRanges instead of Range causing some side effects when the replacements at the beginning of lines. The ranges that we are counting are backwards and the return characters are being counted instead of being ignored. There is almost certainly a better fix than this, but this patch restores the original logic that was present when Range was being used, until a better fix can be worked out. Test: editing/spelling/text-replacement-first-word-second-line.html * editing/Editor.cpp: (WebCore::Editor::markAndReplaceFor): * editing/TextCheckingHelper.cpp: (WebCore::TextCheckingParagraph::automaticReplacementStart const): (WebCore::TextCheckingParagraph::automaticReplacementLength const): * editing/TextCheckingHelper.h: LayoutTests: Overlapping text replacements at the beginning of a line are replaced too early https://bugs.webkit.org/show_bug.cgi?id=216327 Reviewed by Darin Adler. * editing/spelling/text-replacement-first-word-second-line-expected.txt: Added. * editing/spelling/text-replacement-first-word-second-line.html: Added. git-svn-id: https://svn.webkit.org/repository/webkit/trunk@266909 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-09-10 Megan Gardner <megan_gardner@apple.com> Text replacements at the beginning of a second line are replaced too early https://bugs.webkit.org/show_bug.cgi?id=216327 <rdar://problem/68170353> Reviewed by Darin Adler. In the changes in r258871, using SimpleRanges instead of Range causing some side effects when the replacements at the beginning of lines. The ranges that we are counting are backwards and the return characters are being counted instead of being ignored. There is almost certainly a better fix than this, but this patch restores the original logic that was present when Range was being used, until a better fix can be worked out. Test: editing/spelling/text-replacement-first-word-second-line.html * editing/Editor.cpp: (WebCore::Editor::markAndReplaceFor): * editing/TextCheckingHelper.cpp: (WebCore::TextCheckingParagraph::automaticReplacementStart const): (WebCore::TextCheckingParagraph::automaticReplacementLength const): * editing/TextCheckingHelper.h: 2020-10-08 Russell Epstein <repstein@apple.com> Cherry-pick r268162. rdar://problem/70097353 REGRESSION: Safari unable to load PDF in <embed> (docs.legalconnect.com) https://bugs.webkit.org/show_bug.cgi?id=217451 <rdar://problem/69767043> Reviewed by Alex Christensen. Source/WebCore: Test: fast/replaced/pdf-as-embed-with-no-mime-type-is-not-blank.html If plugins are enabled, we'll always let the request go through, and WebKit will guess that files with PDFPlugin-handled extensions should instantiate PDFPlugin, even if no other plugins are available. However, if plugins are disabled, requestPlugin() will early return if the explicitly specified MIME type is not handled by an application plugin (even though the downstream WebKit code would have happily instantiated an application plugin for us). Application plugins shouldn't depend on the plugin enablement setting. To fix this, have SubframeLoader guess the MIME type if not explicitly specified (matching WebKit's behavior), and allow the request if it matches an application plugin. * loader/SubframeLoader.cpp: (WebCore::findPluginMIMETypeFromURL): Improve this previously logging-only function to use the lastPathComponent of the URL instead of randomly looking at the end of the URL, to ignore query strings and fragments when looking for the file extension. (WebCore::FrameLoader::SubframeLoader::requestPlugin): Make use of findPluginMIMETypeFromURL to guess the MIME type if it's not explicitly specified. If the guessed MIME type is one that is handled by application plugins, allow the request to go out to WebKit (which may then instantiate a PDFPlugin, for example). (WebCore::logPluginRequest): (WebCore::FrameLoader::SubframeLoader::requestObject): (WebCore::FrameLoader::SubframeLoader::createJavaAppletWidget): Pass the URL instead of stringifying it, so we can lastPathComponent as above. LayoutTests: * fast/replaced/pdf-as-embed-with-no-mime-type-is-not-blank-expected-mismatch.html: Added. * fast/replaced/pdf-as-embed-with-no-mime-type-is-not-blank.html: Added. Add a test ensuring that <embed> with no specified MIME type still renders the PDF. git-svn-id: https://svn.webkit.org/repository/webkit/trunk@268162 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-10-07 Tim Horton <timothy_horton@apple.com> REGRESSION: Safari unable to load PDF in <embed> (docs.legalconnect.com) https://bugs.webkit.org/show_bug.cgi?id=217451 <rdar://problem/69767043> Reviewed by Alex Christensen. Test: fast/replaced/pdf-as-embed-with-no-mime-type-is-not-blank.html If plugins are enabled, we'll always let the request go through, and WebKit will guess that files with PDFPlugin-handled extensions should instantiate PDFPlugin, even if no other plugins are available. However, if plugins are disabled, requestPlugin() will early return if the explicitly specified MIME type is not handled by an application plugin (even though the downstream WebKit code would have happily instantiated an application plugin for us). Application plugins shouldn't depend on the plugin enablement setting. To fix this, have SubframeLoader guess the MIME type if not explicitly specified (matching WebKit's behavior), and allow the request if it matches an application plugin. * loader/SubframeLoader.cpp: (WebCore::findPluginMIMETypeFromURL): Improve this previously logging-only function to use the lastPathComponent of the URL instead of randomly looking at the end of the URL, to ignore query strings and fragments when looking for the file extension. (WebCore::FrameLoader::SubframeLoader::requestPlugin): Make use of findPluginMIMETypeFromURL to guess the MIME type if it's not explicitly specified. If the guessed MIME type is one that is handled by application plugins, allow the request to go out to WebKit (which may then instantiate a PDFPlugin, for example). (WebCore::logPluginRequest): (WebCore::FrameLoader::SubframeLoader::requestObject): (WebCore::FrameLoader::SubframeLoader::createJavaAppletWidget): Pass the URL instead of stringifying it, so we can lastPathComponent as above. 2020-10-08 Russell Epstein <repstein@apple.com> Cherry-pick r268117. rdar://problem/70104128 Presidential Executive Order pages not accessible with Safari. https://bugs.webkit.org/show_bug.cgi?id=217415 Reviewed by Chris Fleizach. Source/WebCore: Test: accessibility/aria-modal.html. These pages have a dialog modal element of the form <div class="popover" role="dialog" aria-modal="true"> with style visible and a display value different from none. This makes WebCore/accessibility to treat it as if the dialog were always visible, and thus do not convey the content of the page outside the dialog to VoiceOver. The author controls the visibility of the dialog using the style opacity. This patch adds the check for the opacity to determine whether an element is visible or not. * accessibility/AXObjectCache.cpp: (WebCore::AXObjectCache::isNodeVisible const): LayoutTests: Expanded this test to cover the case whether the modal dialog visibility is controlled by its opacity. Cleaned up JS code and made it work in isolated tree mode. * accessibility/aria-modal-expected.txt: * accessibility/aria-modal.html: git-svn-id: https://svn.webkit.org/repository/webkit/trunk@268117 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-10-06 Andres Gonzalez <andresg_22@apple.com> Presidential Executive Order pages not accessible with Safari. https://bugs.webkit.org/show_bug.cgi?id=217415 Reviewed by Chris Fleizach. Test: accessibility/aria-modal.html. These pages have a dialog modal element of the form <div class="popover" role="dialog" aria-modal="true"> with style visible and a display value different from none. This makes WebCore/accessibility to treat it as if the dialog were always visible, and thus do not convey the content of the page outside the dialog to VoiceOver. The author controls the visibility of the dialog using the style opacity. This patch adds the check for the opacity to determine whether an element is visible or not. * accessibility/AXObjectCache.cpp: (WebCore::AXObjectCache::isNodeVisible const): 2020-10-05 Alan Coon <alancoon@apple.com> Cherry-pick r267869. rdar://problem/69904332 [iOS WK1] Crashes when using ANGLE WebGL from another thread https://bugs.webkit.org/show_bug.cgi?id=216106 <rdar://problem/68602452> Patch by Kimmo Kinnunen <kkinnunen@apple.com> on 2020-10-02 Reviewed by Kenneth Russell. Source/ThirdParty/ANGLE: Add two extensions for EAGL and CGL backends to declare the underlying platform context being "volatile". It means that the thread-global current context is being modified behind ANGLE. If ANGLE context is marked volatile for a particular API, it will sync the underlying context for every EGL function that needs the context. Most intuitive use is for the client to call eglMakeCurrent before calling any gl function if the client knowns the platform state might be dirty. Implement eglReleaseThread for EAGL and CGL backends. Releasing thread will unset the platform current context. Fix a bug of omitting EGL_ANGLE_device_eagl from being advertised. * extensions/EGL_ANGLE_platform_angle_device_context_volatile_cgl.txt: Added. * extensions/EGL_ANGLE_platform_angle_device_context_volatile_eagl.txt: Added. * include/EGL/eglext_angle.h: * src/libANGLE/Caps.cpp: (egl::DeviceExtensions::getStrings const): (egl::ClientExtensions::getStrings const): * src/libANGLE/Caps.h: * src/libANGLE/Display.cpp: (egl::Display::prepareForCall): (egl::Display::releaseThread): (egl::GenerateClientExtensions): * src/libANGLE/Display.h: * src/libANGLE/renderer/DisplayImpl.cpp: (rx::DisplayImpl::prepareForCall): (rx::DisplayImpl::releaseThread): * src/libANGLE/renderer/DisplayImpl.h: * src/libANGLE/renderer/gl/cgl/DisplayCGL.h: * src/libANGLE/renderer/gl/cgl/DisplayCGL.mm: (rx::DisplayCGL::initialize): (rx::DisplayCGL::terminate): (rx::DisplayCGL::prepareForCall): (rx::DisplayCGL::releaseThread): (rx::DisplayCGL::makeCurrent): * src/libANGLE/renderer/gl/eagl/DisplayEAGL.h: * src/libANGLE/renderer/gl/eagl/DisplayEAGL.mm: (rx::DisplayEAGL::initialize): (rx::DisplayEAGL::terminate): (rx::DisplayEAGL::prepareForCall): (rx::DisplayEAGL::releaseThread): * src/libANGLE/validationEGL.cpp: * src/libGLESv2/entry_points_egl.cpp: * src/libGLESv2/entry_points_egl_ext.cpp: Source/WebCore: Source of the bug comes from following: - WK1 might run WebKit code in client main thread. - WK1 might run Webkit code in web thread. - WebKit code might run WebGL payload, notably access GraphicsContextGL classes. Client is able to modify EAGL/CGL current context. The change to ANGLE incurred two distinct behavior changes compared to raw EAGL / CGL: 1) Before: context was set current before any GL call After: context was set current only if EGL current context had been changed. (Explicit code as well as ANGLE implementation optimization.) 2) Before: context being used was able to be current in multiple threads at the same time. (EAGL/CGL feature) After: context cannot be current in multiple threads at the same time. (EGL feature) Change in behavior 1) caused ANGLE to sometimes use the EAGL/CGL context of the client instead of the real context that ANGLE created. Fix this by introducing EGL_ANGLE_platform_angle_device_context_volatile_eagl and EGL_ANGLE_platform_angle_device_context_volatile_cgl which make ANGLE sync the context on each eglMakeCurrent eglReleaseThread and eglTerminate. Change in behavior 2) caused ANGLE to use uninitialized context object from one thread, if the real context object was current in another thread. Fix this by considering "GraphicsContextGLOpenGL current context" as part of "data that is owned by WebCoreThread lock". The current context is set with lock held, implicitly. The current context is released when lock is released. When the lock is not held, GraphicsContextGLOpenGL current context is nullptr. Adds soft linking for EAGL for the purpose of testing this in TestWebKitAPI. The case of Apple Silicon Mac may sometimes use CGL and sometimes EAGL, and the test should test that client overriding both contexts will not cause problems. Fix ANGLE header include path: - Do not include ANGLE in the path, as files are included with ANGLE/ - Add WK_ALTERNATE_FRAMEWORKS_DIR so that SDK_VARIANT=iosmac e.g. maccatalyst builds work Previously the ANGLE was not included from ThirdParty/ANGLE, rather "WebKit SDK". * Configurations/WebCore.xcconfig: * platform/graphics/cocoa/GraphicsContextGLOpenGLCocoa.mm: (WebCore::GraphicsContextGLOpenGL::GraphicsContextGLOpenGL): (WebCore::GraphicsContextGLOpenGL::~GraphicsContextGLOpenGL): (WebCore::GraphicsContextGLOpenGL::makeContextCurrent): (WebCore::GraphicsContextGLOpenGL::releaseCurrentContext): (WebCore::GraphicsContextGLOpenGL::checkGPUStatus): (WebCore::GraphicsContextGLOpenGL::allowOfflineRenderers const): * platform/graphics/opengl/GraphicsContextGLOpenGL.h: * platform/ios/wak/WebCoreThread.mm: (WebThreadUnlockFromAnyThread): (_WebThreadUnlock): Tools: Add a WK1 test which runs WebGL code both in client main thread and in web thread. This tests the case where ANGLE EGL context is not being held current in one thread while the other thread runs WebGL and thus ANGLE EGL code. * TestWebKitAPI/Configurations/TestWebKitAPI.xcconfig: * TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj: * TestWebKitAPI/Tests/WebKitLegacy/ios/WebGLNoCrashOnOtherThreadAccess.mm: Added. (-[WebGLNoCrashOnOtherThreadAccessWebViewDelegate webViewDidFinishLoad:]): (-[WebGLNoCrashOnOtherThreadAccessWebViewDelegate webView:shouldStartLoadWithRequest:navigationType:]): (TestWebKitAPI::TEST): git-svn-id: https://svn.webkit.org/repository/webkit/trunk@267869 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-10-02 Kimmo Kinnunen <kkinnunen@apple.com> [iOS WK1] Crashes when using ANGLE WebGL from another thread https://bugs.webkit.org/show_bug.cgi?id=216106 <rdar://problem/68602452> Reviewed by Kenneth Russell. Source of the bug comes from following: - WK1 might run WebKit code in client main thread. - WK1 might run Webkit code in web thread. - WebKit code might run WebGL payload, notably access GraphicsContextGL classes. Client is able to modify EAGL/CGL current context. The change to ANGLE incurred two distinct behavior changes compared to raw EAGL / CGL: 1) Before: context was set current before any GL call After: context was set current only if EGL current context had been changed. (Explicit code as well as ANGLE implementation optimization.) 2) Before: context being used was able to be current in multiple threads at the same time. (EAGL/CGL feature) After: context cannot be current in multiple threads at the same time. (EGL feature) Change in behavior 1) caused ANGLE to sometimes use the EAGL/CGL context of the client instead of the real context that ANGLE created. Fix this by introducing EGL_ANGLE_platform_angle_device_context_volatile_eagl and EGL_ANGLE_platform_angle_device_context_volatile_cgl which make ANGLE sync the context on each eglMakeCurrent eglReleaseThread and eglTerminate. Change in behavior 2) caused ANGLE to use uninitialized context object from one thread, if the real context object was current in another thread. Fix this by considering "GraphicsContextGLOpenGL current context" as part of "data that is owned by WebCoreThread lock". The current context is set with lock held, implicitly. The current context is released when lock is released. When the lock is not held, GraphicsContextGLOpenGL current context is nullptr. Adds soft linking for EAGL for the purpose of testing this in TestWebKitAPI. The case of Apple Silicon Mac may sometimes use CGL and sometimes EAGL, and the test should test that client overriding both contexts will not cause problems. Fix ANGLE header include path: - Do not include ANGLE in the path, as files are included with ANGLE/ - Add WK_ALTERNATE_FRAMEWORKS_DIR so that SDK_VARIANT=iosmac e.g. maccatalyst builds work Previously the ANGLE was not included from ThirdParty/ANGLE, rather "WebKit SDK". * Configurations/WebCore.xcconfig: * platform/graphics/cocoa/GraphicsContextGLOpenGLCocoa.mm: (WebCore::GraphicsContextGLOpenGL::GraphicsContextGLOpenGL): (WebCore::GraphicsContextGLOpenGL::~GraphicsContextGLOpenGL): (WebCore::GraphicsContextGLOpenGL::makeContextCurrent): (WebCore::GraphicsContextGLOpenGL::releaseCurrentContext): (WebCore::GraphicsContextGLOpenGL::checkGPUStatus): (WebCore::GraphicsContextGLOpenGL::allowOfflineRenderers const): * platform/graphics/opengl/GraphicsContextGLOpenGL.h: * platform/ios/wak/WebCoreThread.mm: (WebThreadUnlockFromAnyThread): (_WebThreadUnlock): 2020-10-05 Alan Coon <alancoon@apple.com> Cherry-pick r267602. rdar://problem/69904386 WebGL should use GLES in iOS apps running on Apple Silicon https://bugs.webkit.org/show_bug.cgi?id=216722 <rdar://problem/68976337> Reviewed by Tim Horton and Ken Russell. Source/ThirdParty/ANGLE: Change ANGLE to dynamically load either EAGL (OpenGLES) or CGL (OpenGL) depending on both compile and runtime configurations. Intel Mac -> CGL Intel Mac Catalyst -> CGL Intel iOS Simulator -> EAGL iOS Device -> EAGL Apple Silicon Mac -> CGL Apple Silicon Mac Catalyst (with Mac app) -> CGL Apple Silicon Mac Catalyst (with iOS app) -> EAGL The trickiest bit is Apple Silicon Mac Catalyst, which depends on the type of the application it is attempting to run. In that case ANGLE must compile both the CGL and EAGL interfaces and then pick one to use after launch. * ANGLE.xcodeproj/project.pbxproj: Add new files. * Configurations/ANGLE-dynamic.xcconfig: Remove all the OpenGL* linking. * Configurations/ANGLE-static.xcconfig: * GLESv2.cmake: New files. * src/common/platform.h: New definitions for CPU type on Apple Systems. * src/gpu_info_util/SystemInfo.h: Split SystemInfo for Apple into two files, for iOS and Mac. Added a field for isiOSAppOnMac that will only be true when running an iOS binary on Apple Silicon. * src/gpu_info_util/SystemInfo_apple.mm: Added. Decides which SystemInfo to call. (angle::GetSystemInfo): * src/gpu_info_util/SystemInfo_ios.cpp: (angle::GetSystemInfo_ios): (angle::GetSystemInfo): Deleted. * src/gpu_info_util/SystemInfo_macos.mm: (angle::GetSystemInfo_mac): (angle::GetSystemInfo): Deleted. * src/libANGLE/Caps.cpp: Can no longer just check for PLATFORM_IOS. This might still need a runtime check. (gl::DetermineDepthTextureANGLESupport): (gl::DetermineDepthTextureOESSupport): * src/libANGLE/Display.cpp: This is the main initialization point for ANGLE, which decides at compile/runtime which variant of Display to create. * src/libANGLE/formatutils.cpp: Add the correct formats. (gl::BuildInternalFormatInfoMap): * src/libANGLE/renderer/gl/SoftLinking_apple.h: Added. Macros to help soft-link functions and ObjC classes. * src/libANGLE/renderer/gl/cgl/CGLFunctions.cpp: Added. Where we soft-link all the OpenGL/CGL API. * src/libANGLE/renderer/gl/cgl/CGLFunctions.h: Added. * src/libANGLE/renderer/gl/cgl/DisplayCGL.mm: Use the soft-linked methods. * src/libANGLE/renderer/gl/cgl/IOSurfaceSurfaceCGL.cpp: * src/libANGLE/renderer/gl/cgl/WindowSurfaceCGL.h: * src/libANGLE/renderer/gl/cgl/WindowSurfaceCGL.mm: Rename WebSwapLayer to WebSwapLayerCGL otherwise it clashes with the EAGL version. (rx::WindowSurfaceCGL::initialize): (-[WebSwapLayer initWithSharedState:withContext:withFunctions:]): Deleted. (-[WebSwapLayer copyCGLPixelFormatForDisplayMask:]): Deleted. (-[WebSwapLayer copyCGLContextForPixelFormat:]): Deleted. (-[WebSwapLayer canDrawInCGLContext:pixelFormat:forLayerTime:displayTime:]): Deleted. (-[WebSwapLayer drawInCGLContext:pixelFormat:forLayerTime:displayTime:]): Deleted. * src/libANGLE/renderer/gl/eagl/DeviceEAGL.cpp: Similar changes to the CGL implementation. * src/libANGLE/renderer/gl/eagl/DeviceEAGL.h: * src/libANGLE/renderer/gl/eagl/DisplayEAGL.h: * src/libANGLE/renderer/gl/eagl/DisplayEAGL.mm: (rx::DisplayEAGL::initialize): (rx::DisplayEAGL::terminate): (rx::WorkerContextEAGL::~WorkerContextEAGL): (rx::WorkerContextEAGL::makeCurrent): (rx::WorkerContextEAGL::unmakeCurrent): (rx::DisplayEAGL::createWorkerContext): * src/libANGLE/renderer/gl/eagl/EAGLFunctions.h: Added. * src/libANGLE/renderer/gl/eagl/EAGLFunctions.mm: Added. * src/libANGLE/renderer/gl/eagl/IOSurfaceSurfaceEAGL.mm: * src/libANGLE/renderer/gl/eagl/PbufferSurfaceEAGL.cpp: * src/libANGLE/renderer/gl/eagl/RendererEAGL.cpp: * src/libANGLE/renderer/gl/eagl/WindowSurfaceEAGL.h: * src/libANGLE/renderer/gl/eagl/WindowSurfaceEAGL.mm: (-[WebSwapLayerEAGL display]): (rx::WindowSurfaceEAGL::initialize): (-[WebSwapLayer initWithSharedState:withContext:withFunctions:]): Deleted. (-[WebSwapLayer display]): Deleted. * src/libANGLE/renderer/gl/renderergl_utils.cpp: Runtime check. (rx::nativegl_gl::GenerateCaps): Source/WebCore: * Configurations/WebCore.xcconfig: Remove all OpenGL/OpenGLES linking. * WebCore.xcodeproj/project.pbxproj: * platform/graphics/GraphicsContextGL.h: Change the ANGLE IOSurface texture binding enums into functions, because they have to be calculated at run-time. * platform/graphics/cocoa/GraphicsContextGLOpenGLCocoa.mm: Use the new soft-linked functions from PAL. Also implement the IOSurface texture binding helpers that were previously enums. * platform/mac/PlatformScreenMac.mm: * platform/mac/WebGLBlocklist.mm: Source/WebCore/PAL: Add soft-linking content for OpenGL/OpenGLES. * PAL.xcodeproj/project.pbxproj: * pal/PlatformMac.cmake: * pal/cocoa/OpenGLSoftLinkCocoa.h: Added. * pal/cocoa/OpenGLSoftLinkCocoa.mm: Added. Source/WebKit: * Configurations/WebKit.xcconfig: Remove OpenGL linking. * UIProcess/mac/HighPerformanceGPUManager.mm: Renamed to .mm. Use the PAL soft-linked OpenGL API. git-svn-id: https://svn.webkit.org/repository/webkit/trunk@267602 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-09-24 Dean Jackson <dino@apple.com> WebGL should use GLES in iOS apps running on Apple Silicon https://bugs.webkit.org/show_bug.cgi?id=216722 <rdar://problem/68976337> Reviewed by Tim Horton. * Configurations/WebCore.xcconfig: Remove all OpenGL/OpenGLES linking. * WebCore.xcodeproj/project.pbxproj: * platform/graphics/GraphicsContextGL.h: Change the ANGLE IOSurface texture binding enums into functions, because they have to be calculated at run-time. * platform/graphics/cocoa/GraphicsContextGLOpenGLCocoa.mm: Use the new soft-linked functions from PAL. Also implement the IOSurface texture binding helpers that were previously enums. * platform/mac/PlatformScreenMac.mm: * platform/mac/WebGLBlocklist.mm: 2020-10-02 Alan Coon <alancoon@apple.com> Cherry-pick r267753. rdar://problem/69904353 IndexedDB Index Corruption after upgrade from iOS 13 to iOS 14 https://bugs.webkit.org/show_bug.cgi?id=216962 <rdar://problem/69587004> Reviewed by Brady Eidson. Source/WebCore: There is an implementation error in r255318, which updated index ID in database IndexInfo and IndexRecords tables: it made changes to original table while iterating records of it. This means modified records can be modified again, which leads to that two indices have the same index ID. As index ID is supposed to be unique, some indices and index records cannot be populated and clients will find some indices are missing. To fix this, we need to change the implementation of ID update and deal with already corrupted tables. For index ID update, now we create a temporary table for storing the updated records, and replace the original table with temporary table at the end of iteration. For the corruption issue, we check if IndexInfo table has duplicate index IDs. If it has, we try recovering IndexInfo and IndexRecords table by removing records with duplicate index IDs, assigning new IDs to duplicate indices, and adding records with updated index IDs. API tests: IndexedDB.IndexUpgradeToV2WithMultipleIndices IndexedDB.IndexUpgradeToV2WithMultipleIndicesHaveSameID * Modules/indexeddb/server/SQLiteIDBBackingStore.cpp: (WebCore::IDBServer::indexInfoTableSchema): (WebCore::IDBServer::SQLiteIDBBackingStore::createAndPopulateInitialDatabaseInfo): (WebCore::IDBServer::SQLiteIDBBackingStore::migrateIndexInfoTableForIDUpdate): (WebCore::IDBServer::SQLiteIDBBackingStore::migrateIndexRecordsTableForIDUpdate): (WebCore::IDBServer::SQLiteIDBBackingStore::removeExistingIndex): (WebCore::IDBServer::SQLiteIDBBackingStore::addExistingIndex): (WebCore::IDBServer::SQLiteIDBBackingStore::handleDuplicateIndexIDs): (WebCore::IDBServer::SQLiteIDBBackingStore::extractExistingDatabaseInfo): (WebCore::IDBServer::SQLiteIDBBackingStore::createIndex): (WebCore::IDBServer::SQLiteIDBBackingStore::updateOneIndexForAddRecord): * Modules/indexeddb/server/SQLiteIDBBackingStore.h: * Modules/indexeddb/shared/IDBIndexInfo.h: (WebCore::IDBIndexInfo::setIdentifier): * Modules/indexeddb/shared/IDBObjectStoreInfo.cpp: (WebCore::IDBObjectStoreInfo::addExistingIndex): Tools: * TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj: * TestWebKitAPI/Tests/WebKitCocoa/IDBIndexUpgradeToV2.mm: (runMultipleIndicesTestWithDatabase): (TEST): * TestWebKitAPI/Tests/WebKitCocoa/IDBIndexUpgradeToV2WithMultipleIndices.html: Added. * TestWebKitAPI/Tests/WebKitCocoa/IndexUpgradeWithMultipleIndices.sqlite3: Added. * TestWebKitAPI/Tests/WebKitCocoa/IndexUpgradeWithMultipleIndicesHaveSameID.sqlite3: Added. git-svn-id: https://svn.webkit.org/repository/webkit/trunk@267753 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-09-29 Sihui Liu <sihui_liu@apple.com> IndexedDB Index Corruption after upgrade from iOS 13 to iOS 14 https://bugs.webkit.org/show_bug.cgi?id=216962 <rdar://problem/69587004> Reviewed by Brady Eidson. There is an implementation error in r255318, which updated index ID in database IndexInfo and IndexRecords tables: it made changes to original table while iterating records of it. This means modified records can be modified again, which leads to that two indices have the same index ID. As index ID is supposed to be unique, some indices and index records cannot be populated and clients will find some indices are missing. To fix this, we need to change the implementation of ID update and deal with already corrupted tables. For index ID update, now we create a temporary table for storing the updated records, and replace the original table with temporary table at the end of iteration. For the corruption issue, we check if IndexInfo table has duplicate index IDs. If it has, we try recovering IndexInfo and IndexRecords table by removing records with duplicate index IDs, assigning new IDs to duplicate indices, and adding records with updated index IDs. API tests: IndexedDB.IndexUpgradeToV2WithMultipleIndices IndexedDB.IndexUpgradeToV2WithMultipleIndicesHaveSameID * Modules/indexeddb/server/SQLiteIDBBackingStore.cpp: (WebCore::IDBServer::indexInfoTableSchema): (WebCore::IDBServer::SQLiteIDBBackingStore::createAndPopulateInitialDatabaseInfo): (WebCore::IDBServer::SQLiteIDBBackingStore::migrateIndexInfoTableForIDUpdate): (WebCore::IDBServer::SQLiteIDBBackingStore::migrateIndexRecordsTableForIDUpdate): (WebCore::IDBServer::SQLiteIDBBackingStore::removeExistingIndex): (WebCore::IDBServer::SQLiteIDBBackingStore::addExistingIndex): (WebCore::IDBServer::SQLiteIDBBackingStore::handleDuplicateIndexIDs): (WebCore::IDBServer::SQLiteIDBBackingStore::extractExistingDatabaseInfo): (WebCore::IDBServer::SQLiteIDBBackingStore::createIndex): (WebCore::IDBServer::SQLiteIDBBackingStore::updateOneIndexForAddRecord): * Modules/indexeddb/server/SQLiteIDBBackingStore.h: * Modules/indexeddb/shared/IDBIndexInfo.h: (WebCore::IDBIndexInfo::setIdentifier): * Modules/indexeddb/shared/IDBObjectStoreInfo.cpp: (WebCore::IDBObjectStoreInfo::addExistingIndex): 2020-10-02 Alan Coon <alancoon@apple.com> Cherry-pick r267612. rdar://problem/69904365 Crunchyroll playback controls do not work on iPad with trackpad https://bugs.webkit.org/show_bug.cgi?id=217000 <rdar://problem/66362029> Reviewed by Wenson Hsieh. Source/WebCore: * platform/RuntimeApplicationChecks.h: * platform/cocoa/RuntimeApplicationChecksCocoa.mm: (WebCore::IOSApplication::isCrunchyroll): Source/WebKit: * UIProcess/ios/WKContentViewInteraction.mm: (applicationIsKnownToIgnoreMouseEvents): Add it to the list. git-svn-id: https://svn.webkit.org/repository/webkit/trunk@267612 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-09-25 Tim Horton <timothy_horton@apple.com> Crunchyroll playback controls do not work on iPad with trackpad https://bugs.webkit.org/show_bug.cgi?id=217000 <rdar://problem/66362029> Reviewed by Wenson Hsieh. * platform/RuntimeApplicationChecks.h: * platform/cocoa/RuntimeApplicationChecksCocoa.mm: (WebCore::IOSApplication::isCrunchyroll): 2020-10-02 Alan Coon <alancoon@apple.com> Cherry-pick r266028. rdar://problem/69904377 Move node geometry functions from Range to RenderObject https://bugs.webkit.org/show_bug.cgi?id=215677 Reviewed by Zalan Bujtas. Source/WebCore: Moved functions that return quads and rectangles out of Range into RenderObject. We could find another home for them, but for now they make sense as static member functions there since RenderObject has the non-static member functions that they call on multiple nodes. Mostly did not change the design of these functions much, and was careful not to change behavior at all. But did change a few things: - Got rid of the functions that return a single unioned rectangle. Instead callers call unionRect at each call site. - Changed the "use selection height" boolean to a BoundingRectBehavior flag. * accessibility/AccessibilityRenderObject.cpp: (WebCore::boundsForRects): Call unionRect(RenderObject::absoluteTextRects) instead of Range::absoluteBoundingBox. * dom/DocumentMarkerController.cpp: (WebCore::updateRenderedRectsForMarker): Instead of passing "true", pass "RenderObject::BoundingRectBehavior::UseSelectionHeight". * dom/Range.cpp: (WebCore::Range::absoluteBoundingBox const): Deleted. (WebCore::Range::absoluteRectsForRangeInText const): Deleted. (WebCore::Range::absoluteTextRects const): Deleted. (WebCore::Range::getClientRects const): Call RenderObject::clientBorderAndTextRects. (WebCore::Range::getBoundingClientRect const): Call unionRect(RenderObject::clientBorderAndTextRects). (WebCore::Range::borderAndTextRects const): Deleted. (WebCore::Range::boundingRect const): Deleted. (WebCore::Range::absoluteBoundingRect const): Deleted. * dom/Range.h: Updated for above. * dom/SimpleRange.cpp: (WebCore::IntersectingNodeIterator::IntersectingNodeIterator): Fix bug affecting empty ranges by calling enforceEndInvariant. (WebCore::IntersectingNodeIterator::advance): Refactor to call enforceEndInvariant. (WebCore::IntersectingNodeIterator::advanceSkippingChildren): Ditto. (WebCore::IntersectingNodeIterator::enforceEndInvariant): Added. * dom/SimpleRange.h: Added enforceEndInvariant. * editing/FrameSelection.cpp: (WebCore::FrameSelection::getClippedVisibleTextRectangles const): Instead of passing a useSelectionHeight boolean, pass BoundingRectBehavior. * page/TextIndicator.cpp: (WebCore::absoluteBoundingRectForRange): Call unionRectIgnoringZeroRects(RenderObject::absoluteBorderAndTextRects). (WebCore::initializeIndicator): Call RenderObject::absoluteTextRects. * platform/graphics/GeometryUtilities.cpp: (WebCore::unionRectIgnoringZeroRects): Added. * platform/graphics/GeometryUtilities.h: Updated for above. * rendering/RenderLineBreak.h: Marked a lot of functions final. Added a default value for the absoluteQuads out argument. * rendering/RenderObject.cpp: (WebCore::RenderObject::addPDFURLRect): Tweaked code style a bit. (WebCore::RenderObject::absoluteTextQuads): Replaced boolean useSelectionHeight argument with a BoundingRectBehavior argument. Also added a downcast so the call to RenderLineBreak::absoluteQuads is a non-virtual function call. (WebCore::absoluteRectsForRangeInText): Added. (WebCore::RenderObject::absoluteTextRects): Replaced boolean useSelectionHeight argument with a BoundingRectBehavior argument. (WebCore::nodeBefore): Added. (WebCore::borderAndTextRects): Added. (WebCore::RenderObject::absoluteBorderAndTextRects): Added. (WebCore::RenderObject::clientBorderAndTextRects): Added. * rendering/RenderObject.h: Updated for above. Source/WebKit: * WebProcess/InjectedBundle/DOM/InjectedBundleRangeHandle.cpp: (WebKit::InjectedBundleRangeHandle::boundingRectInWindowCoordinates const): Call unionRectIgnoringZeroRects(RenderObject::absoluteBorderAndTextRects). (WebKit::InjectedBundleRangeHandle::renderedImage): Call unionRectIgnoringZeroRects(RenderObject::absoluteBorderAndTextRects). * WebProcess/WebPage/ios/WebPageIOS.mm: (WebKit::WebPage::requestEvasionRectsAboveSelection): Call unionRect(RenderObject::absoluteTextRects). (WebKit::WebPage::requestDocumentEditingContext): Call unionRect(RenderObject::absoluteTextRects). Source/WebKitLegacy/mac: * DOM/DOM.mm: (-[DOMRange boundingBox]): Call unionRect(RenderObject::absoluteTextRects). Source/WebKitLegacy/win: * AccessibleTextImpl.cpp: (AccessibleText::scrollSubstringTo): Call unionRect(RenderObject::absoluteTextRects) instead of Range::absoluteBoundingBox. LayoutTests: * fast/dom/Range/scale-page-bounding-client-rect.html: Fix this test that accidentally depended on getting rects for an empty range (the contents of a div element with no text inside it) to instead get rects for a non-empty element (the div element, not just its contents). Test now works correctly, but results don't need to change. * fast/dom/Range/scale-page-client-rects.html: Ditto. git-svn-id: https://svn.webkit.org/repository/webkit/trunk@266028 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-08-20 Darin Adler <darin@apple.com> Move node geometry functions from Range to RenderObject https://bugs.webkit.org/show_bug.cgi?id=215677 Reviewed by Zalan Bujtas. Moved functions that return quads and rectangles out of Range into RenderObject. We could find another home for them, but for now they make sense as static member functions there since RenderObject has the non-static member functions that they call on multiple nodes. Mostly did not change the design of these functions much, and was careful not to change behavior at all. But did change a few things: - Got rid of the functions that return a single unioned rectangle. Instead callers call unionRect at each call site. - Changed the "use selection height" boolean to a BoundingRectBehavior flag. * accessibility/AccessibilityRenderObject.cpp: (WebCore::boundsForRects): Call unionRect(RenderObject::absoluteTextRects) instead of Range::absoluteBoundingBox. * dom/DocumentMarkerController.cpp: (WebCore::updateRenderedRectsForMarker): Instead of passing "true", pass "RenderObject::BoundingRectBehavior::UseSelectionHeight". * dom/Range.cpp: (WebCore::Range::absoluteBoundingBox const): Deleted. (WebCore::Range::absoluteRectsForRangeInText const): Deleted. (WebCore::Range::absoluteTextRects const): Deleted. (WebCore::Range::getClientRects const): Call RenderObject::clientBorderAndTextRects. (WebCore::Range::getBoundingClientRect const): Call unionRect(RenderObject::clientBorderAndTextRects). (WebCore::Range::borderAndTextRects const): Deleted. (WebCore::Range::boundingRect const): Deleted. (WebCore::Range::absoluteBoundingRect const): Deleted. * dom/Range.h: Updated for above. * dom/SimpleRange.cpp: (WebCore::IntersectingNodeIterator::IntersectingNodeIterator): Fix bug affecting empty ranges by calling enforceEndInvariant. (WebCore::IntersectingNodeIterator::advance): Refactor to call enforceEndInvariant. (WebCore::IntersectingNodeIterator::advanceSkippingChildren): Ditto. (WebCore::IntersectingNodeIterator::enforceEndInvariant): Added. * dom/SimpleRange.h: Added enforceEndInvariant. * editing/FrameSelection.cpp: (WebCore::FrameSelection::getClippedVisibleTextRectangles const): Instead of passing a useSelectionHeight boolean, pass BoundingRectBehavior. * page/TextIndicator.cpp: (WebCore::absoluteBoundingRectForRange): Call unionRectIgnoringZeroRects(RenderObject::absoluteBorderAndTextRects). (WebCore::initializeIndicator): Call RenderObject::absoluteTextRects. * platform/graphics/GeometryUtilities.cpp: (WebCore::unionRectIgnoringZeroRects): Added. * platform/graphics/GeometryUtilities.h: Updated for above. * rendering/RenderLineBreak.h: Marked a lot of functions final. Added a default value for the absoluteQuads out argument. * rendering/RenderObject.cpp: (WebCore::RenderObject::addPDFURLRect): Tweaked code style a bit. (WebCore::RenderObject::absoluteTextQuads): Replaced boolean useSelectionHeight argument with a BoundingRectBehavior argument. Also added a downcast so the call to RenderLineBreak::absoluteQuads is a non-virtual function call. (WebCore::absoluteRectsForRangeInText): Added. (WebCore::RenderObject::absoluteTextRects): Replaced boolean useSelectionHeight argument with a BoundingRectBehavior argument. (WebCore::nodeBefore): Added. (WebCore::borderAndTextRects): Added. (WebCore::RenderObject::absoluteBorderAndTextRects): Added. (WebCore::RenderObject::clientBorderAndTextRects): Added. * rendering/RenderObject.h: Updated for above. 2020-09-29 Alan Coon <alancoon@apple.com> Cherry-pick r267722. rdar://problem/69586659 Cherry-pick r266899. rdar://problem/69586659 Integrator's note: as some of the symbols present on trunk are not available on branch, special modifications had to be made to this cherry-pick to build. Address a post-commit review comment after r266887 https://bugs.webkit.org/show_bug.cgi?id=216257 Reviewed by Darin Adler. Remove a check that currently makes us conditionally set `IsComputedStyleInvalidFlag` if there is a computed style in rare data. There should be no change in behavior; this just makes the code a bit simpler. * dom/Element.cpp: (WebCore::Element::invalidateStyle): (WebCore::Element::storeDisplayContentsStyle): git-svn-id: https://svn.webkit.org/repository/webkit/trunk@266899 268f45cc-cd09-0410-ab3c-d52691b4dbfc git-svn-id: https://svn.webkit.org/repository/webkit/branches/safari-610-branch@267722 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-09-28 Alan Coon <alancoon@apple.com> Cherry-pick r266899. rdar://problem/69586659 Integrator's note: as some of the symbols present on trunk are not available on branch, special modifications had to be made to this cherry-pick to build. Address a post-commit review comment after r266887 https://bugs.webkit.org/show_bug.cgi?id=216257 Reviewed by Darin Adler. Remove a check that currently makes us conditionally set `IsComputedStyleInvalidFlag` if there is a computed style in rare data. There should be no change in behavior; this just makes the code a bit simpler. * dom/Element.cpp: (WebCore::Element::invalidateStyle): (WebCore::Element::storeDisplayContentsStyle): git-svn-id: https://svn.webkit.org/repository/webkit/trunk@266899 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-09-10 Wenson Hsieh <wenson_hsieh@apple.com> Integrator's note: as some of the symbols present on trunk are not available on branch, special modifications had to be made to this cherry-pick. Address a post-commit review comment after r266887 https://bugs.webkit.org/show_bug.cgi?id=216257 Reviewed by Darin Adler. Remove a check that currently makes us conditionally set `IsComputedStyleInvalidFlag` if there is a computed style in rare data. There should be no change in behavior; this just makes the code a bit simpler. * dom/Element.cpp: (WebCore::Element::invalidateStyle): (WebCore::Element::storeDisplayContentsStyle): 2020-09-29 Alan Coon <alancoon@apple.com> Cherry-pick r267721. rdar://problem/69586659 Cherry-pick r266887. rdar://problem/69586659 Integrator's note: as some of the symbols present on trunk are not available on branch, special modifications had to be made to this cherry-pick to build. REGRESSION (r257839): clickpay.com - password placeholder text cannot be replaced https://bugs.webkit.org/show_bug.cgi?id=216257 <rdar://problem/68150686> Reviewed by Antti Koivisto. Source/WebCore: On clickpay.com, the field in the login form that contains the text "Password" is actually a plain text input, referred to by the site's script as the "null text input". The page adds a focus event listener to this null text input, and inside of this focus event listener, it reveals a hidden password field by removing an inline `display: none;` style rule on the real password input element, programmatically focuses it, and then hides the null text input by setting it to `display: none;` via inline style. However, after the changes in r257839, we no longer attempt to do a style update upon programmatic focus in the case where the programmatically focused element does not have a renderer yet (this applies to the password field in this scenario, because it previously had `display: none;`). When we determine whether the newly displayed password field is focusable using `Element::isVisibleWithoutResolvingFullStyle`, we then attempt to use either the existing computed `RenderStyle` on the element, or perform a partial computed style resolution using the `ResolveComputedStyleMode::RenderedOnly` flag. But in the case where `ElementRareData`'s computed style exists, it is not guaranteed to be up to date if the inline style changed since the computed style was last set. In the context of this bug, it's actually Safari's AutoFill logic (embedded in the injected bundle) that ends up asking for the computed style of the password input, forcing it to be created and set (though, as demonstrated in the layout test, simply grabbing the computed style is sufficient to replicate the bug outside of Safari). The end result is that we'll use this stale computed style, which still believes that the password input is not displayed, and we end up not focusing the element due to believing that the password input is hidden. To fix this, we would need to either check whether the element has an invalid style (i.e. `needsStyleRecalc()`) before attempting to use the existing computed style, or clear out the `ElementRareData` computed style anytime the element's style is invalidated. However, both of these approaches will cause us to perform partial style resolution much more aggressively, leading to a 2-3% regression in Speedometer. To address the bug without hampering our performance wins from r257839, we add a new node flag so that we can remember when computed styles are no longer valid due to style invalidation, and consult this flag in `Element::isVisibleWithoutResolvingFullStyle` to avoid using the existing computed style. Test: fast/forms/programmatic-focus-after-display.html * dom/Element.cpp: (WebCore::Element::invalidateStyle): (WebCore::Element::resolveComputedStyle): (WebCore::Element::isVisibleWithoutResolvingFullStyle const): * dom/Node.h: (WebCore::Node::setHasValidStyle): LayoutTests: Add a new layout test to verify that the bug does not occur. See WebCore/ChangeLog for more details. * fast/forms/programmatic-focus-after-display-expected.txt: Added. * fast/forms/programmatic-focus-after-display.html: Added. git-svn-id: https://svn.webkit.org/repository/webkit/trunk@266887 268f45cc-cd09-0410-ab3c-d52691b4dbfc git-svn-id: https://svn.webkit.org/repository/webkit/branches/safari-610-branch@267721 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-09-28 Alan Coon <alancoon@apple.com> Cherry-pick r266887. rdar://problem/69586659 Integrator's note: as some of the symbols present on trunk are not available on branch, special modifications had to be made to this cherry-pick to build. REGRESSION (r257839): clickpay.com - password placeholder text cannot be replaced https://bugs.webkit.org/show_bug.cgi?id=216257 <rdar://problem/68150686> Reviewed by Antti Koivisto. Source/WebCore: On clickpay.com, the field in the login form that contains the text "Password" is actually a plain text input, referred to by the site's script as the "null text input". The page adds a focus event listener to this null text input, and inside of this focus event listener, it reveals a hidden password field by removing an inline `display: none;` style rule on the real password input element, programmatically focuses it, and then hides the null text input by setting it to `display: none;` via inline style. However, after the changes in r257839, we no longer attempt to do a style update upon programmatic focus in the case where the programmatically focused element does not have a renderer yet (this applies to the password field in this scenario, because it previously had `display: none;`). When we determine whether the newly displayed password field is focusable using `Element::isVisibleWithoutResolvingFullStyle`, we then attempt to use either the existing computed `RenderStyle` on the element, or perform a partial computed style resolution using the `ResolveComputedStyleMode::RenderedOnly` flag. But in the case where `ElementRareData`'s computed style exists, it is not guaranteed to be up to date if the inline style changed since the computed style was last set. In the context of this bug, it's actually Safari's AutoFill logic (embedded in the injected bundle) that ends up asking for the computed style of the password input, forcing it to be created and set (though, as demonstrated in the layout test, simply grabbing the computed style is sufficient to replicate the bug outside of Safari). The end result is that we'll use this stale computed style, which still believes that the password input is not displayed, and we end up not focusing the element due to believing that the password input is hidden. To fix this, we would need to either check whether the element has an invalid style (i.e. `needsStyleRecalc()`) before attempting to use the existing computed style, or clear out the `ElementRareData` computed style anytime the element's style is invalidated. However, both of these approaches will cause us to perform partial style resolution much more aggressively, leading to a 2-3% regression in Speedometer. To address the bug without hampering our performance wins from r257839, we add a new node flag so that we can remember when computed styles are no longer valid due to style invalidation, and consult this flag in `Element::isVisibleWithoutResolvingFullStyle` to avoid using the existing computed style. Test: fast/forms/programmatic-focus-after-display.html * dom/Element.cpp: (WebCore::Element::invalidateStyle): (WebCore::Element::resolveComputedStyle): (WebCore::Element::isVisibleWithoutResolvingFullStyle const): * dom/Node.h: (WebCore::Node::setHasValidStyle): LayoutTests: Add a new layout test to verify that the bug does not occur. See WebCore/ChangeLog for more details. * fast/forms/programmatic-focus-after-display-expected.txt: Added. * fast/forms/programmatic-focus-after-display.html: Added. git-svn-id: https://svn.webkit.org/repository/webkit/trunk@266887 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-09-10 Wenson Hsieh <wenson_hsieh@apple.com> REGRESSION (r257839): clickpay.com - password placeholder text cannot be replaced https://bugs.webkit.org/show_bug.cgi?id=216257 <rdar://problem/68150686> Reviewed by Antti Koivisto. On clickpay.com, the field in the login form that contains the text "Password" is actually a plain text input, referred to by the site's script as the "null text input". The page adds a focus event listener to this null text input, and inside of this focus event listener, it reveals a hidden password field by removing an inline `display: none;` style rule on the real password input element, programmatically focuses it, and then hides the null text input by setting it to `display: none;` via inline style. However, after the changes in r257839, we no longer attempt to do a style update upon programmatic focus in the case where the programmatically focused element does not have a renderer yet (this applies to the password field in this scenario, because it previously had `display: none;`). When we determine whether the newly displayed password field is focusable using `Element::isVisibleWithoutResolvingFullStyle`, we then attempt to use either the existing computed `RenderStyle` on the element, or perform a partial computed style resolution using the `ResolveComputedStyleMode::RenderedOnly` flag. But in the case where `ElementRareData`'s computed style exists, it is not guaranteed to be up to date if the inline style changed since the computed style was last set. In the context of this bug, it's actually Safari's AutoFill logic (embedded in the injected bundle) that ends up asking for the computed style of the password input, forcing it to be created and set (though, as demonstrated in the layout test, simply grabbing the computed style is sufficient to replicate the bug outside of Safari). The end result is that we'll use this stale computed style, which still believes that the password input is not displayed, and we end up not focusing the element due to believing that the password input is hidden. To fix this, we would need to either check whether the element has an invalid style (i.e. `needsStyleRecalc()`) before attempting to use the existing computed style, or clear out the `ElementRareData` computed style anytime the element's style is invalidated. However, both of these approaches will cause us to perform partial style resolution much more aggressively, leading to a 2-3% regression in Speedometer. To address the bug without hampering our performance wins from r257839, we add a new node flag so that we can remember when computed styles are no longer valid due to style invalidation, and consult this flag in `Element::isVisibleWithoutResolvingFullStyle` to avoid using the existing computed style. Test: fast/forms/programmatic-focus-after-display.html * dom/Element.cpp: (WebCore::Element::invalidateStyle): (WebCore::Element::resolveComputedStyle): (WebCore::Element::isVisibleWithoutResolvingFullStyle const): * dom/Node.h: (WebCore::Node::setHasValidStyle): 2020-09-28 Alan Coon <alancoon@apple.com> Apply patch. rdar://problem/69594082 2020-09-28 Dean Jackson <dino@apple.com> Cherry-pick r266809. rdar://problem/68421590 2020-09-09 Dean Jackson <dino@apple.com> CrashTracer: com.apple.WebKit.WebContent at WebCore: WebCore::WebGLRenderingContext::getExtension https://bugs.webkit.org/show_bug.cgi?id=216337 <rdar://problem/68421590> Reviewed by Sam Weinig. Bug 215599 added IsoHeap storage to WebGLExtension, but didn't add it to any of the subclasses. This causes a crash in ::getExtension because allocation of the new instance fails. Add WTF_MAKE_ISO_ALLOCATED_IMPL to the .cpp files, and WTF_MAKE_ISO_ALLOCATED to the .h files. This should have been detected by on-device testing, since a debug build would have asserted because the size passed into the constructor was different from the actual size of the class. * html/canvas/ANGLEInstancedArrays.cpp: * html/canvas/ANGLEInstancedArrays.h: * html/canvas/EXTBlendMinMax.cpp: * html/canvas/EXTBlendMinMax.h: * html/canvas/EXTColorBufferFloat.cpp: * html/canvas/EXTColorBufferFloat.h: * html/canvas/EXTColorBufferHalfFloat.cpp: * html/canvas/EXTColorBufferHalfFloat.h: * html/canvas/EXTFragDepth.cpp: * html/canvas/EXTFragDepth.h: * html/canvas/EXTShaderTextureLOD.cpp: * html/canvas/EXTShaderTextureLOD.h: * html/canvas/EXTTextureFilterAnisotropic.cpp: * html/canvas/EXTTextureFilterAnisotropic.h: * html/canvas/EXTsRGB.cpp: * html/canvas/EXTsRGB.h: * html/canvas/OESElementIndexUint.cpp: * html/canvas/OESElementIndexUint.h: * html/canvas/OESStandardDerivatives.cpp: * html/canvas/OESStandardDerivatives.h: * html/canvas/OESTextureFloat.cpp: * html/canvas/OESTextureFloat.h: * html/canvas/OESTextureFloatLinear.cpp: * html/canvas/OESTextureFloatLinear.h: * html/canvas/OESTextureHalfFloat.cpp: * html/canvas/OESTextureHalfFloat.h: * html/canvas/OESTextureHalfFloatLinear.cpp: * html/canvas/OESTextureHalfFloatLinear.h: * html/canvas/OESVertexArrayObject.cpp: * html/canvas/OESVertexArrayObject.h: * html/canvas/WebGLColorBufferFloat.cpp: * html/canvas/WebGLColorBufferFloat.h: * html/canvas/WebGLCompressedTextureASTC.cpp: * html/canvas/WebGLCompressedTextureASTC.h: * html/canvas/WebGLCompressedTextureATC.cpp: * html/canvas/WebGLCompressedTextureATC.h: * html/canvas/WebGLCompressedTextureETC.cpp: * html/canvas/WebGLCompressedTextureETC.h: * html/canvas/WebGLCompressedTextureETC1.cpp: * html/canvas/WebGLCompressedTextureETC1.h: * html/canvas/WebGLCompressedTexturePVRTC.cpp: * html/canvas/WebGLCompressedTexturePVRTC.h: * html/canvas/WebGLCompressedTextureS3TC.cpp: * html/canvas/WebGLCompressedTextureS3TC.h: * html/canvas/WebGLCompressedTextureS3TCsRGB.cpp: * html/canvas/WebGLCompressedTextureS3TCsRGB.h: * html/canvas/WebGLDebugRendererInfo.cpp: * html/canvas/WebGLDebugRendererInfo.h: * html/canvas/WebGLDebugShaders.cpp: * html/canvas/WebGLDebugShaders.h: * html/canvas/WebGLDepthTexture.cpp: * html/canvas/WebGLDepthTexture.h: * html/canvas/WebGLDrawBuffers.cpp: * html/canvas/WebGLDrawBuffers.h: * html/canvas/WebGLLoseContext.cpp: * html/canvas/WebGLLoseContext.h: 2020-09-27 Alan Coon <alancoon@apple.com> Cherry-pick r267530. rdar://problem/69594070 Regression(r265280) Web Audio sources malfunction when disconnected from the audio graph https://bugs.webkit.org/show_bug.cgi?id=216703 <rdar://problem/69158436> Reviewed by Eric Carlson. In case of an audio source that stops producing data, but does not end or mute the track, we would continuously try to read the data until getting to the end of the data. When reaching the end of the data, we would return silence and go back in time a little bit to restart playing with some margin. This allows to read just one chunk of audio until we are back to the end of data. We fix this by storing the end of the data counter when reaching it. When trying to pull some more data, we will go back in time a little bit only if some more data was added in the meantime. Otherwise, we just output silence. Covered by manual test. * platform/audio/mac/AudioSampleDataSource.h: * platform/audio/mac/AudioSampleDataSource.mm: (WebCore::AudioSampleDataSource::pullSamplesInternal): git-svn-id: https://svn.webkit.org/repository/webkit/trunk@267530 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-09-24 Youenn Fablet <youenn@apple.com> Regression(r265280) Web Audio sources malfunction when disconnected from the audio graph https://bugs.webkit.org/show_bug.cgi?id=216703 <rdar://problem/69158436> Reviewed by Eric Carlson. In case of an audio source that stops producing data, but does not end or mute the track, we would continuously try to read the data until getting to the end of the data. When reaching the end of the data, we would return silence and go back in time a little bit to restart playing with some margin. This allows to read just one chunk of audio until we are back to the end of data. We fix this by storing the end of the data counter when reaching it. When trying to pull some more data, we will go back in time a little bit only if some more data was added in the meantime. Otherwise, we just output silence. Covered by manual test. * platform/audio/mac/AudioSampleDataSource.h: * platform/audio/mac/AudioSampleDataSource.mm: (WebCore::AudioSampleDataSource::pullSamplesInternal): 2020-09-27 Alan Coon <alancoon@apple.com> Cherry-pick r267394. rdar://problem/69593980 paper.io ad close buttons cannot be iteracted with via trackpad on iPad https://bugs.webkit.org/show_bug.cgi?id=216812 <rdar://problem/68738585> Reviewed by Wenson Hsieh. Source/WebCore: * platform/RuntimeApplicationChecks.h: * platform/cocoa/RuntimeApplicationChecksCocoa.mm: (WebCore::IOSApplication::isPaperIO): Source/WebKit: * UIProcess/ios/WKContentViewInteraction.mm: (applicationIsKnownToIgnoreMouseEvents): git-svn-id: https://svn.webkit.org/repository/webkit/trunk@267394 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-09-21 Tim Horton <timothy_horton@apple.com> paper.io ad close buttons cannot be iteracted with via trackpad on iPad https://bugs.webkit.org/show_bug.cgi?id=216812 <rdar://problem/68738585> Reviewed by Wenson Hsieh. * platform/RuntimeApplicationChecks.h: * platform/cocoa/RuntimeApplicationChecksCocoa.mm: (WebCore::IOSApplication::isPaperIO): 2020-09-27 Alan Coon <alancoon@apple.com> Cherry-pick r267369. rdar://problem/69594300 [WebAuthn] Don't set the UV option if the authenticator doesn't support it https://bugs.webkit.org/show_bug.cgi?id=215836 <rdar://problem/67817359> Reviewed by Darin Adler. Source/WebCore: Covered by new API tests. UV in the the CTAP 2.0 spec only means internal UV: https://fidoalliance.org/specs/fido-v2.0-ps-20190130/fido-client-to-authenticator-protocol-v2.0-ps-20190130.html#authenticatorGetInfo If an authenticator supports ClientPin, it can set the uv bit in the responses to true but it will not advertise itself supporting internal UV, which is the uv in the options. https://fidoalliance.org/specs/fido-v2.0-ps-20190130/fido-client-to-authenticator-protocol-v2.0-ps-20190130.html#authenticatorMakeCredential Hence, setting it to true could result in error if the authenticator doesn't support internal UV even if it supports ClientPin. It's not a way to ask the authenticator to set the uv bit in the response. * Modules/webauthn/fido/DeviceRequestConverter.cpp: (fido::encodeMakeCredenitalRequestAsCBOR): (fido::encodeGetAssertionRequestAsCBOR): Tools: * TestWebKitAPI/Tests/WebCore/CtapRequestTest.cpp: (TestWebKitAPI::TEST): LayoutTests: * http/wpt/webauthn/public-key-credential-create-failure-hid-silent.https.html: * http/wpt/webauthn/public-key-credential-create-failure-hid.https.html: * http/wpt/webauthn/public-key-credential-get-failure-hid-silent.https.html: * http/wpt/webauthn/public-key-credential-get-failure-hid.https.html: git-svn-id: https://svn.webkit.org/repository/webkit/trunk@267369 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-09-21 Jiewen Tan <jiewen_tan@apple.com> [WebAuthn] Don't set the UV option if the authenticator doesn't support it https://bugs.webkit.org/show_bug.cgi?id=215836 <rdar://problem/67817359> Reviewed by Darin Adler. Covered by new API tests. UV in the the CTAP 2.0 spec only means internal UV: https://fidoalliance.org/specs/fido-v2.0-ps-20190130/fido-client-to-authenticator-protocol-v2.0-ps-20190130.html#authenticatorGetInfo If an authenticator supports ClientPin, it can set the uv bit in the responses to true but it will not advertise itself supporting internal UV, which is the uv in the options. https://fidoalliance.org/specs/fido-v2.0-ps-20190130/fido-client-to-authenticator-protocol-v2.0-ps-20190130.html#authenticatorMakeCredential Hence, setting it to true could result in error if the authenticator doesn't support internal UV even if it supports ClientPin. It's not a way to ask the authenticator to set the uv bit in the response. * Modules/webauthn/fido/DeviceRequestConverter.cpp: (fido::encodeMakeCredenitalRequestAsCBOR): (fido::encodeGetAssertionRequestAsCBOR): 2020-09-27 Alan Coon <alancoon@apple.com> Cherry-pick r267287. rdar://problem/69594243 Crash under WebCore::shouldResetFocusNavigationStartingNode() https://bugs.webkit.org/show_bug.cgi?id=216714 <rdar://problem/68132047> Reviewed by Darin Adler. Protect anchorElement in FrameView::scrollToFragmentInternal() to make sure it stays alive until the time we pass it to setFocusNavigationStartingNode(). * page/FrameView.cpp: (WebCore::FrameView::scrollToFragmentInternal): git-svn-id: https://svn.webkit.org/repository/webkit/trunk@267287 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-09-18 Chris Dumez <cdumez@apple.com> Crash under WebCore::shouldResetFocusNavigationStartingNode() https://bugs.webkit.org/show_bug.cgi?id=216714 <rdar://problem/68132047> Reviewed by Darin Adler. Protect anchorElement in FrameView::scrollToFragmentInternal() to make sure it stays alive until the time we pass it to setFocusNavigationStartingNode(). * page/FrameView.cpp: (WebCore::FrameView::scrollToFragmentInternal): 2020-09-27 Alan Coon <alancoon@apple.com> Cherry-pick r267198. rdar://problem/69594065 [iOS] YouTube does not route video to AirPlay the first time https://bugs.webkit.org/show_bug.cgi?id=216626 <rdar://problem/62222846> Reviewed by Eric Carlson. Difficult to test this, since it requires an live AppleTV device. During a refactor, the order of a couple calls changed. A MediaPlaybackTarget needs to be in place before the MediaPlayer can be told to start playing to that target. Once the target is in-place, subsequent requests to start playing to that target succeed, which explains the "only initial AirPlay fails" behavior. * platform/audio/ios/MediaSessionManagerIOS.mm: (WebCore::MediaSessionManageriOS::activeVideoRouteDidChange): git-svn-id: https://svn.webkit.org/repository/webkit/trunk@267198 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-09-17 Jer Noble <jer.noble@apple.com> [iOS] YouTube does not route video to AirPlay the first time https://bugs.webkit.org/show_bug.cgi?id=216626 <rdar://problem/62222846> Reviewed by Eric Carlson. Difficult to test this, since it requires an live AppleTV device. During a refactor, the order of a couple calls changed. A MediaPlaybackTarget needs to be in place before the MediaPlayer can be told to start playing to that target. Once the target is in-place, subsequent requests to start playing to that target succeed, which explains the "only initial AirPlay fails" behavior. * platform/audio/ios/MediaSessionManagerIOS.mm: (WebCore::MediaSessionManageriOS::activeVideoRouteDidChange): 2020-09-27 Alan Coon <alancoon@apple.com> Cherry-pick r267148. rdar://problem/69594002 [macOS] Limit reported macOS release to 10.15 series https://bugs.webkit.org/show_bug.cgi?id=216593 <rdar://problem/68937905> Reviewed by Maciej Stachowiak. If the reported system OS is 11.0 (or beyond) report the last stable release of macOS. * platform/mac/UserAgentMac.mm: (WebCore::standardUserAgentWithApplicationName): git-svn-id: https://svn.webkit.org/repository/webkit/trunk@267148 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-09-16 Brent Fulgham <bfulgham@apple.com> [macOS] Limit reported macOS release to 10.15 series https://bugs.webkit.org/show_bug.cgi?id=216593 <rdar://problem/68937905> Reviewed by Maciej Stachowiak. If the reported system OS is 11.0 (or beyond) report the last stable release of macOS. * platform/mac/UserAgentMac.mm: (WebCore::standardUserAgentWithApplicationName): 2020-09-27 Alan Coon <alancoon@apple.com> Cherry-pick r267002. rdar://problem/69594199 Overflow:scroll rubberbanding is interrupted by post-layout scrolling https://bugs.webkit.org/show_bug.cgi?id=216463 <rdar://problem/67095741> Reviewed by Darin Adler. When rubberbanding overflow:scroll RenderLayer has an overscrolled scroll offset. If RenderLayer::updateScrollInfoAfterLayout() happens when in this state, it can clamp the scroll offset, causing the rubberband to collapse which interferes with the user interaction. This happend on Gmail when composing a reply. Fix by tracking the rubberbanding state in the scrolling tree, and having RenderLayer query this state via the ScrollingCoordinator. RenderLayer::updateScrollInfoAfterLayout() already tested isRubberBandInProgress(). This is similar to how isUserScrollInProgress() and isScrollSnapInProgress() work. This patch also fixes the tracking of rubberbanding state. Previously setMainFrameIsRubberBanding() was just based on when the timer was started and stopped, which did not match the implementation of ScrollController::isRubberBandInProgress(). Now ScrollController correctly notifies its clients when the rubberbanding state changes by updating that state whenever any of the conditions consulted in isRubberBandInProgressInternal() change. Source/WebCore: I tried to make tests for this, but the timing of wheel and scroll event delivery makes reliable detection of interrupted rubberbands impossible in WebKitTestRunner. * page/FrameView.cpp: (WebCore::FrameView::isRubberBandInProgress const): * page/scrolling/AsyncScrollingCoordinator.cpp: (WebCore::AsyncScrollingCoordinator::isRubberBandInProgress const): * page/scrolling/AsyncScrollingCoordinator.h: * page/scrolling/ScrollingCoordinator.h: (WebCore::ScrollingCoordinator::isRubberBandInProgress const): * page/scrolling/ScrollingTree.cpp: (WebCore::ScrollingTree::isRubberBandInProgressForNode): (WebCore::ScrollingTree::setRubberBandingInProgressForNode): (WebCore::ScrollingTree::isRubberBandInProgress): Deleted. (WebCore::ScrollingTree::setMainFrameIsRubberBanding): Deleted. * page/scrolling/ScrollingTree.h: * page/scrolling/ScrollingTreeScrollingNode.cpp: (WebCore::ScrollingTreeScrollingNode::commitStateBeforeChildren): * page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.mm: (WebCore::ScrollingTreeFrameScrollingNodeMac::currentScrollPositionChanged): (WebCore::ScrollingTreeFrameScrollingNodeMac::updateMainFramePinAndRubberbandState): * page/scrolling/mac/ScrollingTreeOverflowScrollingNodeMac.h: * page/scrolling/mac/ScrollingTreeOverflowScrollingNodeMac.mm: (WebCore::ScrollingTreeOverflowScrollingNodeMac::currentScrollPositionChanged): * page/scrolling/mac/ScrollingTreeScrollingNodeDelegateMac.h: * page/scrolling/mac/ScrollingTreeScrollingNodeDelegateMac.mm: (WebCore::ScrollingTreeScrollingNodeDelegateMac::currentScrollPositionChanged): (WebCore::ScrollingTreeScrollingNodeDelegateMac::isRubberBandInProgress const): (WebCore::ScrollingTreeScrollingNodeDelegateMac::didStopRubberbandSnapAnimation): (WebCore::ScrollingTreeScrollingNodeDelegateMac::rubberBandingStateChanged): * platform/ScrollAnimator.cpp: (WebCore::ScrollAnimator::notifyPositionChanged): * platform/cocoa/ScrollController.h: (WebCore::ScrollControllerClient::rubberBandingStateChanged): * platform/cocoa/ScrollController.mm: (WebCore::ScrollController::handleWheelEvent): (WebCore::ScrollController::snapRubberBandTimerFired): (WebCore::ScrollController::scrollPositionChanged): (WebCore::ScrollController::isRubberBandInProgress const): (WebCore::ScrollController::stopSnapRubberbandTimer): (WebCore::ScrollController::isRubberBandInProgressInternal const): (WebCore::ScrollController::updateRubberBandingState): (WebCore::ScrollController::updateGestureInProgressState): * rendering/RenderLayer.cpp: (WebCore::RenderLayer::isRubberBandInProgress const): (WebCore::RenderLayer::updateScrollInfoAfterLayout): Source/WebKit: * WebProcess/WebPage/RemoteLayerTree/RemoteScrollingCoordinator.h: * WebProcess/WebPage/RemoteLayerTree/RemoteScrollingCoordinator.mm: (WebKit::RemoteScrollingCoordinator::isRubberBandInProgress const): (WebKit::RemoteScrollingCoordinator::scrollingStateInUIProcessChanged): git-svn-id: https://svn.webkit.org/repository/webkit/trunk@267002 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-09-13 Simon Fraser <simon.fraser@apple.com> Overflow:scroll rubberbanding is interrupted by post-layout scrolling https://bugs.webkit.org/show_bug.cgi?id=216463 <rdar://problem/67095741> Reviewed by Darin Adler. When rubberbanding overflow:scroll RenderLayer has an overscrolled scroll offset. If RenderLayer::updateScrollInfoAfterLayout() happens when in this state, it can clamp the scroll offset, causing the rubberband to collapse which interferes with the user interaction. This happend on Gmail when composing a reply. Fix by tracking the rubberbanding state in the scrolling tree, and having RenderLayer query this state via the ScrollingCoordinator. RenderLayer::updateScrollInfoAfterLayout() already tested isRubberBandInProgress(). This is similar to how isUserScrollInProgress() and isScrollSnapInProgress() work. This patch also fixes the tracking of rubberbanding state. Previously setMainFrameIsRubberBanding() was just based on when the timer was started and stopped, which did not match the implementation of ScrollController::isRubberBandInProgress(). Now ScrollController correctly notifies its clients when the rubberbanding state changes by updating that state whenever any of the conditions consulted in isRubberBandInProgressInternal() change. I tried to make tests for this, but the timing of wheel and scroll event delivery makes reliable detection of interrupted rubberbands impossible in WebKitTestRunner. * page/FrameView.cpp: (WebCore::FrameView::isRubberBandInProgress const): * page/scrolling/AsyncScrollingCoordinator.cpp: (WebCore::AsyncScrollingCoordinator::isRubberBandInProgress const): * page/scrolling/AsyncScrollingCoordinator.h: * page/scrolling/ScrollingCoordinator.h: (WebCore::ScrollingCoordinator::isRubberBandInProgress const): * page/scrolling/ScrollingTree.cpp: (WebCore::ScrollingTree::isRubberBandInProgressForNode): (WebCore::ScrollingTree::setRubberBandingInProgressForNode): (WebCore::ScrollingTree::isRubberBandInProgress): Deleted. (WebCore::ScrollingTree::setMainFrameIsRubberBanding): Deleted. * page/scrolling/ScrollingTree.h: * page/scrolling/ScrollingTreeScrollingNode.cpp: (WebCore::ScrollingTreeScrollingNode::commitStateBeforeChildren): * page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.mm: (WebCore::ScrollingTreeFrameScrollingNodeMac::currentScrollPositionChanged): (WebCore::ScrollingTreeFrameScrollingNodeMac::updateMainFramePinAndRubberbandState): * page/scrolling/mac/ScrollingTreeOverflowScrollingNodeMac.h: * page/scrolling/mac/ScrollingTreeOverflowScrollingNodeMac.mm: (WebCore::ScrollingTreeOverflowScrollingNodeMac::currentScrollPositionChanged): * page/scrolling/mac/ScrollingTreeScrollingNodeDelegateMac.h: * page/scrolling/mac/ScrollingTreeScrollingNodeDelegateMac.mm: (WebCore::ScrollingTreeScrollingNodeDelegateMac::currentScrollPositionChanged): (WebCore::ScrollingTreeScrollingNodeDelegateMac::isRubberBandInProgress const): (WebCore::ScrollingTreeScrollingNodeDelegateMac::didStopRubberbandSnapAnimation): (WebCore::ScrollingTreeScrollingNodeDelegateMac::rubberBandingStateChanged): * platform/ScrollAnimator.cpp: (WebCore::ScrollAnimator::notifyPositionChanged): * platform/cocoa/ScrollController.h: (WebCore::ScrollControllerClient::rubberBandingStateChanged): * platform/cocoa/ScrollController.mm: (WebCore::ScrollController::handleWheelEvent): (WebCore::ScrollController::snapRubberBandTimerFired): (WebCore::ScrollController::scrollPositionChanged): (WebCore::ScrollController::isRubberBandInProgress const): (WebCore::ScrollController::stopSnapRubberbandTimer): (WebCore::ScrollController::isRubberBandInProgressInternal const): (WebCore::ScrollController::updateRubberBandingState): (WebCore::ScrollController::updateGestureInProgressState): * rendering/RenderLayer.cpp: (WebCore::RenderLayer::isRubberBandInProgress const): (WebCore::RenderLayer::updateScrollInfoAfterLayout): 2020-09-27 Alan Coon <alancoon@apple.com> Cherry-pick r266611. rdar://problem/69594191 MediaRecorder timeslice parameter causing internal error on longer videos https://bugs.webkit.org/show_bug.cgi?id=216076 <rdar://problem/68209422> Reviewed by Eric Carlson. Source/WebCore: Test: http/wpt/fetch/blob-range.html * platform/network/BlobResourceHandle.cpp: (WebCore::BlobResourceHandle::readDataAsync): Source/WebKit: Test: http/wpt/fetch/blob-range.html * NetworkProcess/NetworkDataTaskBlob.cpp: (WebKit::NetworkDataTaskBlob::readData): readData can be re-entrant so we need to reset m_currentItemReadSize before consuming data. LayoutTests: * http/wpt/fetch/blob-range-expected.txt: Added. * http/wpt/fetch/blob-range.html: Added. git-svn-id: https://svn.webkit.org/repository/webkit/trunk@266611 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-09-04 Youenn Fablet <youenn@apple.com> MediaRecorder timeslice parameter causing internal error on longer videos https://bugs.webkit.org/show_bug.cgi?id=216076 <rdar://problem/68209422> Reviewed by Eric Carlson. Test: http/wpt/fetch/blob-range.html * platform/network/BlobResourceHandle.cpp: (WebCore::BlobResourceHandle::readDataAsync): 2020-09-27 Alan Coon <alancoon@apple.com> Cherry-pick r266312. rdar://problem/69594218 [macOS] AirPlay device name is wrong when playing to multiple devices https://bugs.webkit.org/show_bug.cgi?id=215952 <rdar://problem/66930799> Reviewed by Jer Noble. Tested manually because this requires a specific hardware setup. * platform/graphics/avfoundation/MediaPlaybackTargetCocoa.mm: (WebCore::MediaPlaybackTargetCocoa::deviceName const): If the AVOutputContext supports multiple output devices, create the device name by concatenating the names of all of the active output devices. git-svn-id: https://svn.webkit.org/repository/webkit/trunk@266312 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-08-28 Eric Carlson <eric.carlson@apple.com> [macOS] AirPlay device name is wrong when playing to multiple devices https://bugs.webkit.org/show_bug.cgi?id=215952 <rdar://problem/66930799> Reviewed by Jer Noble. Tested manually because this requires a specific hardware setup. * platform/graphics/avfoundation/MediaPlaybackTargetCocoa.mm: (WebCore::MediaPlaybackTargetCocoa::deviceName const): If the AVOutputContext supports multiple output devices, create the device name by concatenating the names of all of the active output devices. 2020-09-25 Alan Coon <alancoon@apple.com> Cherry-pick r267067. rdar://problem/69586680 REGRESSION (Async overflow scroll): Code snippets on getkirby.com appear and disappear as content is scrolled https://bugs.webkit.org/show_bug.cgi?id=216490 <rdar://problem/67018073> Reviewed by Zalan Bujtas. Source/WebCore: The content in question had a z-order layer tree like this: A (0,0) width=997 height=829 (layerID 20) {sc 2} RenderView + B (0,0) width=997 height=8 RenderBlock HTML class='no-js' + C (0,0) width=997 height=829 RenderFlexibleBox MAIN n D (0,0) width=256 height=829 RenderFlexibleBox NAV class='left panel' n E (0,0) width=256 height=829 (layerID 25) {sc 3} RenderBlock DIV class='scroller' n F (256,0) width=741 height=829 RenderFlexibleBox ARTICLE class='main panel' n G (0,0) width=741 height=829 (layerID 26) {sc 4} RenderBlock DIV class='scroller' n H (0,-816) width=741 height=2810 RenderBlock DIV class='article-content' + I (0,0) width=256 height=1000 (layerID 27) overlap RenderBlock (relative positioned) DIV class='content' + J (10,300) width=721 height=202 (layerID 28) overlap RenderBlock (relative positioned) DIV class='relative-box' + K (10,802) width=721 height=202 (layerID 29) overlap RenderBlock (relative positioned) DIV class='relative-box' + L (10,1304) width=721 height=202 (layerID 30) overlap RenderBlock (relative positioned) DIV class='relative-box' + M (10,1806) width=721 height=202 (layerID 31) overlap RenderBlock (relative positioned) DIV class='relative-box' + M (10,2308) width=721 height=202 (layerID 32) overlap RenderBlock (relative positioned) DIV class='relative-box' When layer 'G' is scrolled, the code would find the paint-order parent, F, which is normal-flow because it has overflow:hidden, and would call setDescendantsNeedUpdateBackingAndHierarchyTraversal() on it. However, that doesn't go high enough, because we need to update J-M since their ancestor clipping stacks have geometry that relies on the scroll position of G. If we don't update that geometry, GraphicsLayers have an incorrect notion of what's visible, and we don't attach backing store. The fix is to climb up to the stacking context B and call setDescendantsNeedUpdateBackingAndHierarchyTraversal() on it. Test: compositing/scrolling/async-overflow-scrolling/nested-scrollers-backing-attachment.html * rendering/RenderLayer.cpp: (WebCore::RenderLayer::scrollTo): LayoutTests: * compositing/scrolling/async-overflow-scrolling/nested-scrollers-backing-attachment-expected.txt: Added. * compositing/scrolling/async-overflow-scrolling/nested-scrollers-backing-attachment.html: Added. git-svn-id: https://svn.webkit.org/repository/webkit/trunk@267067 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-09-14 Simon Fraser <simon.fraser@apple.com> REGRESSION (Async overflow scroll): Code snippets on getkirby.com appear and disappear as content is scrolled https://bugs.webkit.org/show_bug.cgi?id=216490 <rdar://problem/67018073> Reviewed by Zalan Bujtas. The content in question had a z-order layer tree like this: A (0,0) width=997 height=829 (layerID 20) {sc 2} RenderView + B (0,0) width=997 height=8 RenderBlock HTML class='no-js' + C (0,0) width=997 height=829 RenderFlexibleBox MAIN n D (0,0) width=256 height=829 RenderFlexibleBox NAV class='left panel' n E (0,0) width=256 height=829 (layerID 25) {sc 3} RenderBlock DIV class='scroller' n F (256,0) width=741 height=829 RenderFlexibleBox ARTICLE class='main panel' n G (0,0) width=741 height=829 (layerID 26) {sc 4} RenderBlock DIV class='scroller' n H (0,-816) width=741 height=2810 RenderBlock DIV class='article-content' + I (0,0) width=256 height=1000 (layerID 27) overlap RenderBlock (relative positioned) DIV class='content' + J (10,300) width=721 height=202 (layerID 28) overlap RenderBlock (relative positioned) DIV class='relative-box' + K (10,802) width=721 height=202 (layerID 29) overlap RenderBlock (relative positioned) DIV class='relative-box' + L (10,1304) width=721 height=202 (layerID 30) overlap RenderBlock (relative positioned) DIV class='relative-box' + M (10,1806) width=721 height=202 (layerID 31) overlap RenderBlock (relative positioned) DIV class='relative-box' + M (10,2308) width=721 height=202 (layerID 32) overlap RenderBlock (relative positioned) DIV class='relative-box' When layer 'G' is scrolled, the code would find the paint-order parent, F, which is normal-flow because it has overflow:hidden, and would call setDescendantsNeedUpdateBackingAndHierarchyTraversal() on it. However, that doesn't go high enough, because we need to update J-M since their ancestor clipping stacks have geometry that relies on the scroll position of G. If we don't update that geometry, GraphicsLayers have an incorrect notion of what's visible, and we don't attach backing store. The fix is to climb up to the stacking context B and call setDescendantsNeedUpdateBackingAndHierarchyTraversal() on it. Test: compositing/scrolling/async-overflow-scrolling/nested-scrollers-backing-attachment.html * rendering/RenderLayer.cpp: (WebCore::RenderLayer::scrollTo): 2020-09-25 Alan Coon <alancoon@apple.com> Cherry-pick r266923. rdar://problem/69586712 REGRESSION (Async overflow scroll): Mouse wheel scrolling over an "always-on" overflow scrollbar doesn't work https://bugs.webkit.org/show_bug.cgi?id=216381 <rdar://problem/68593743> Reviewed by Antti Koivisto. Source/WebCore: The scrollbar and scroll corner layers need event regions and scrollingNodeIDs so that we hit-test them via CA layers and find the right scrolling node. Test: fast/scrolling/mac/mousewheel-over-scrollbar.html * rendering/RenderLayerBacking.cpp: (WebCore::RenderLayerBacking::updateAfterDescendants): (WebCore::RenderLayerBacking::updateEventRegion): (WebCore::RenderLayerBacking::detachFromScrollingCoordinator): (WebCore::RenderLayerBacking::setScrollingNodeIDForRole): LayoutTests: * fast/scrolling/mac/border-radius-event-region-expected.txt: * fast/scrolling/mac/event-region-scrolled-contents-layer-expected.txt: * fast/scrolling/mac/event-region-subscroller-overflow-expected.txt: * fast/scrolling/mac/event-region-visibility-hidden-expected.txt: * fast/scrolling/mac/mousewheel-over-scrollbar-expected.txt: Added. * fast/scrolling/mac/mousewheel-over-scrollbar.html: Added. * fast/scrolling/mac/negative-z-index-overflow-scroll-expected.txt: git-svn-id: https://svn.webkit.org/repository/webkit/trunk@266923 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-09-11 Simon Fraser <simon.fraser@apple.com> REGRESSION (Async overflow scroll): Mouse wheel scrolling over an "always-on" overflow scrollbar doesn't work https://bugs.webkit.org/show_bug.cgi?id=216381 <rdar://problem/68593743> Reviewed by Antti Koivisto. The scrollbar and scroll corner layers need event regions and scrollingNodeIDs so that we hit-test them via CA layers and find the right scrolling node. Test: fast/scrolling/mac/mousewheel-over-scrollbar.html * rendering/RenderLayerBacking.cpp: (WebCore::RenderLayerBacking::updateAfterDescendants): (WebCore::RenderLayerBacking::updateEventRegion): (WebCore::RenderLayerBacking::detachFromScrollingCoordinator): (WebCore::RenderLayerBacking::setScrollingNodeIDForRole): 2020-09-25 Alan Coon <alancoon@apple.com> Cherry-pick r266884. rdar://problem/69583178 Revert accidental hard-coding of compositing logging from r266825. * platform/Logging.cpp: (WebCore::initializeLogChannelsIfNecessary): git-svn-id: https://svn.webkit.org/repository/webkit/trunk@266884 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-09-10 Simon Fraser <simon.fraser@apple.com> Revert accidental hard-coding of compositing logging from r266825. * platform/Logging.cpp: (WebCore::initializeLogChannelsIfNecessary): 2020-09-25 Alan Coon <alancoon@apple.com> Cherry-pick r266825. rdar://problem/69583178 REGRESSION (Async overflow scroll): Truncated scrollbars in facebook chat https://bugs.webkit.org/show_bug.cgi?id=216294 <rdar://problem/61918702> Reviewed by Antti Koivisto. Source/WebCore: When both async overflow scroll and overlay scrollbars are enabled, it's possible for composited layers that are later in z-order than the overflow to overlap the scrollbars (overflow does not create stacking context, so they are later siblings to the overflow). To fix this we have to hoist the layer that hosts the overflow controls above all later layers which belong to contents scrolled by this overflow. We know which layers these are; they have ancestor clippings stacks that reference the overflow layer. This overflow controls layer hoisting happens in the context of the enclosing composited layer. So to fix this RenderLayerCompositor::updateBackingAndHierarchy() tracks these layers that belong to an overflow scroll. RenderLayerCompositor::adjustOverflowScrollbarContainerLayers() uses them to find the overflow scroll layers whose controls need hoisting, and where to insert those overflow controls hosting layers in the sublayers list of the enclosing composited layer. An additional source of complexity occurs with overflow scroll nested inside another scroller or overflow:hidden (in the same composited stacking context): the overflow controls reparenting is hoisting that layer up, so that layer itself needs additional layers to clip it (essentially the overflow control layer behaves like a later sibling that needs its own ancestor clipping stack). When this occurs, RenderLayerBacking creates an additional "ancestor clipping stack" in m_overflowControlsHostLayerAncestorClippingStack which is a parallel stack to m_ancestorClippingStack, but with its own set of clipping layers. At some point this will also need scrolling tree nodes created for it. Some minor refactoring helps share code for the two LayerAncestorClippingStacks. This new code all runs late in the compositing update for a given layer, which is not ideal; we replicate some code from updateGeometry() and updateInternalHierarchy(). Ideally we'd be able to know at computeCompositingRequirements() time if we need to do layer hoisting and ancestor clipping stack duplication, but that proves hard because of ordering dependencies. Tests: compositing/scrolling/async-overflow-scrolling/overlapped-overlay-scrollbar-dynamic.html compositing/scrolling/async-overflow-scrolling/overlapped-overlay-scrollbar-inside-hidden.html compositing/scrolling/async-overflow-scrolling/overlapped-overlay-scrollbar-nested.html compositing/scrolling/async-overflow-scrolling/overlapped-overlay-scrollbar.html compositing/scrolling/async-overflow-scrolling/transform-change-scrollbar-position.html * rendering/LayerAncestorClippingStack.cpp: (WebCore::LayerAncestorClippingStack::compositedClipData const): * rendering/LayerAncestorClippingStack.h: * rendering/RenderLayerBacking.cpp: (WebCore::RenderLayerBacking::updateConfiguration): (WebCore::RenderLayerBacking::updateGeometry): (WebCore::RenderLayerBacking::adjustOverflowControlsPositionRelativeToAncestor): (WebCore::RenderLayerBacking::updateInternalHierarchy): (WebCore::RenderLayerBacking::updateAncestorClippingStack): (WebCore::RenderLayerBacking::ensureOverflowControlsHostLayerAncestorClippingStack): (WebCore::RenderLayerBacking::ensureClippingStackLayers): (WebCore::RenderLayerBacking::removeClippingStackLayers): (WebCore::RenderLayerBacking::connectClippingStackLayers): (WebCore::RenderLayerBacking::updateClippingStackLayerGeometry): (WebCore::RenderLayerBacking::updateAncestorClipping): (WebCore::RenderLayerBacking::offsetRelativeToRendererOriginForDescendantLayers const): * rendering/RenderLayerBacking.h: * rendering/RenderLayerCompositor.cpp: (WebCore::RenderLayerCompositor::UpdateBackingTraversalState::UpdateBackingTraversalState): (WebCore::RenderLayerCompositor::UpdateBackingTraversalState::stateForDescendants const): (WebCore::RenderLayerCompositor::updateBackingAndHierarchy): (WebCore::RenderLayerCompositor::adjustOverflowScrollbarContainerLayers): (WebCore::RenderLayerCompositor::updateScrollingNodeForScrollingProxyRole): * rendering/RenderLayerCompositor.h: LayoutTests: Some new tests, and new baselines for tests that have different layer trees now. * compositing/layer-creation/clipping-scope/nested-scroller-overlap-expected.txt: * compositing/layer-creation/clipping-scope/overlap-constrained-inside-scroller-expected.txt: * compositing/layer-creation/clipping-scope/scroller-with-negative-z-children-expected.txt: * compositing/overflow/scrolling-content-clip-to-viewport-expected.txt: * compositing/rtl/rtl-scrolling-with-transformed-descendants-expected.txt: * compositing/scrolling/async-overflow-scrolling/clipped-layer-in-overflow-clipped-by-scroll-expected.txt: * compositing/scrolling/async-overflow-scrolling/clipped-layer-in-overflow-expected.txt: * compositing/scrolling/async-overflow-scrolling/clipped-layer-in-overflow-nested-expected.txt: * compositing/scrolling/async-overflow-scrolling/layer-for-negative-z-in-scroller-expected.txt: * compositing/scrolling/async-overflow-scrolling/layer-in-overflow-clip-to-hidden-expected.txt: * compositing/scrolling/async-overflow-scrolling/layer-in-overflow-clip-to-visible-expected.txt: * compositing/scrolling/async-overflow-scrolling/layer-in-overflow-expected.txt: * compositing/scrolling/async-overflow-scrolling/layer-in-overflow-gain-clipping-layer-expected.txt: * compositing/scrolling/async-overflow-scrolling/layer-in-overflow-in-clipped-expected.txt: * compositing/scrolling/async-overflow-scrolling/layer-in-overflow-lose-clipping-layer-expected.txt: * compositing/scrolling/async-overflow-scrolling/overlapped-overlay-scrollbar-dynamic-expected.txt: Added. * compositing/scrolling/async-overflow-scrolling/overlapped-overlay-scrollbar-dynamic.html: Added. * compositing/scrolling/async-overflow-scrolling/overlapped-overlay-scrollbar-expected.txt: Added. * compositing/scrolling/async-overflow-scrolling/overlapped-overlay-scrollbar-inside-hidden-expected.txt: Added. * compositing/scrolling/async-overflow-scrolling/overlapped-overlay-scrollbar-inside-hidden.html: Added. * compositing/scrolling/async-overflow-scrolling/overlapped-overlay-scrollbar-nested-expected.txt: Added. * compositing/scrolling/async-overflow-scrolling/overlapped-overlay-scrollbar-nested.html: Added. * compositing/scrolling/async-overflow-scrolling/overlapped-overlay-scrollbar.html: Added. * compositing/scrolling/async-overflow-scrolling/transform-change-scrollbar-position-expected.txt: Added. * compositing/scrolling/async-overflow-scrolling/transform-change-scrollbar-position.html: Added. * compositing/shared-backing/overflow-scroll/composited-absolute-in-absolute-in-relative-in-scroller-expected.txt: * compositing/shared-backing/overflow-scroll/previous-sibling-prevents-inclusiveness-expected.txt: git-svn-id: https://svn.webkit.org/repository/webkit/trunk@266825 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-09-10 Simon Fraser <simon.fraser@apple.com> REGRESSION (Async overflow scroll): Truncated scrollbars in facebook chat https://bugs.webkit.org/show_bug.cgi?id=216294 <rdar://problem/61918702> Reviewed by Antti Koivisto. When both async overflow scroll and overlay scrollbars are enabled, it's possible for composited layers that are later in z-order than the overflow to overlap the scrollbars (overflow does not create stacking context, so they are later siblings to the overflow). To fix this we have to hoist the layer that hosts the overflow controls above all later layers which belong to contents scrolled by this overflow. We know which layers these are; they have ancestor clippings stacks that reference the overflow layer. This overflow controls layer hoisting happens in the context of the enclosing composited layer. So to fix this RenderLayerCompositor::updateBackingAndHierarchy() tracks these layers that belong to an overflow scroll. RenderLayerCompositor::adjustOverflowScrollbarContainerLayers() uses them to find the overflow scroll layers whose controls need hoisting, and where to insert those overflow controls hosting layers in the sublayers list of the enclosing composited layer. An additional source of complexity occurs with overflow scroll nested inside another scroller or overflow:hidden (in the same composited stacking context): the overflow controls reparenting is hoisting that layer up, so that layer itself needs additional layers to clip it (essentially the overflow control layer behaves like a later sibling that needs its own ancestor clipping stack). When this occurs, RenderLayerBacking creates an additional "ancestor clipping stack" in m_overflowControlsHostLayerAncestorClippingStack which is a parallel stack to m_ancestorClippingStack, but with its own set of clipping layers. At some point this will also need scrolling tree nodes created for it. Some minor refactoring helps share code for the two LayerAncestorClippingStacks. This new code all runs late in the compositing update for a given layer, which is not ideal; we replicate some code from updateGeometry() and updateInternalHierarchy(). Ideally we'd be able to know at computeCompositingRequirements() time if we need to do layer hoisting and ancestor clipping stack duplication, but that proves hard because of ordering dependencies. Tests: compositing/scrolling/async-overflow-scrolling/overlapped-overlay-scrollbar-dynamic.html compositing/scrolling/async-overflow-scrolling/overlapped-overlay-scrollbar-inside-hidden.html compositing/scrolling/async-overflow-scrolling/overlapped-overlay-scrollbar-nested.html compositing/scrolling/async-overflow-scrolling/overlapped-overlay-scrollbar.html compositing/scrolling/async-overflow-scrolling/transform-change-scrollbar-position.html * rendering/LayerAncestorClippingStack.cpp: (WebCore::LayerAncestorClippingStack::compositedClipData const): * rendering/LayerAncestorClippingStack.h: * rendering/RenderLayerBacking.cpp: (WebCore::RenderLayerBacking::updateConfiguration): (WebCore::RenderLayerBacking::updateGeometry): (WebCore::RenderLayerBacking::adjustOverflowControlsPositionRelativeToAncestor): (WebCore::RenderLayerBacking::updateInternalHierarchy): (WebCore::RenderLayerBacking::updateAncestorClippingStack): (WebCore::RenderLayerBacking::ensureOverflowControlsHostLayerAncestorClippingStack): (WebCore::RenderLayerBacking::ensureClippingStackLayers): (WebCore::RenderLayerBacking::removeClippingStackLayers): (WebCore::RenderLayerBacking::connectClippingStackLayers): (WebCore::RenderLayerBacking::updateClippingStackLayerGeometry): (WebCore::RenderLayerBacking::updateAncestorClipping): (WebCore::RenderLayerBacking::offsetRelativeToRendererOriginForDescendantLayers const): * rendering/RenderLayerBacking.h: * rendering/RenderLayerCompositor.cpp: (WebCore::RenderLayerCompositor::UpdateBackingTraversalState::UpdateBackingTraversalState): (WebCore::RenderLayerCompositor::UpdateBackingTraversalState::stateForDescendants const): (WebCore::RenderLayerCompositor::updateBackingAndHierarchy): (WebCore::RenderLayerCompositor::adjustOverflowScrollbarContainerLayers): (WebCore::RenderLayerCompositor::updateScrollingNodeForScrollingProxyRole): * rendering/RenderLayerCompositor.h: 2020-09-25 Alan Coon <alancoon@apple.com> Cherry-pick r266148. rdar://problem/69583151 Font loads quickly followed by navigations may fail indefinitely <rdar://problem/65560550> and https://bugs.webkit.org/show_bug.cgi?id=215435 Reviewed by Myles C. Maxfield. Source/WebCore: Second take at this. Myles took the first swipe at this, but a conflict with SuspendableTimer caused issues in the form of layout test asserts with http/tests/security/navigate-when-restoring-cached-page.html His original ChangeLog entry: Font loads are coalesced using a zero-delay timer. However, that zero-delay timer can fire while the page is in the middle of a navigation, which will cause the font loads to fail. Then, the second page can request those same fonts, which are marked as failed, and as such will never actually load/use the desired web font. This patch just stops the zero-delay timer during navigations, and resumes it when resuming the document. This means: 1. The second page in the above story will not see that the font has failed, or even started, and will then re-request the font and load it successfully 2. If the user goes "back" to the previous page, the zero-delay timer is restarted, the CachedFont realizes it's already succeeded, and the previous page is rendered as expected. Test: fast/loader/font-load-timer.html --- Now the explanation of the failure it caused: The font loading timer was a SuspendableTimer, which is an ActiveDOMObject. An ActiveDOMObject was used to make sure the delayed font loads play well with the page cache, which is still necessary. But we also still need to suspend the timer manually when "stopLoading()" is called, which doesn't play well with ActiveDOMObject's automatic suspend/resume. My solution: - Make the timer "just a normal timer" - Make CSSFontSelector itself the ActiveDOMObject - Let DocumentLoader explicitly pause the font load timer - Rely on ActiveDOMObject to resume the timer These keep the bug fixed and resolve the layout test ASSERT seen with http/tests/security/navigate-when-restoring-cached-page.html * css/CSSFontSelector.cpp: (WebCore::CSSFontSelector::CSSFontSelector): (WebCore::CSSFontSelector::clearDocument): (WebCore::CSSFontSelector::beginLoadingFontSoon): (WebCore::CSSFontSelector::suspendFontLoadingTimer): (WebCore::CSSFontSelector::fontLoadingTimerFired): (WebCore::CSSFontSelector::stop): (WebCore::CSSFontSelector::suspend): (WebCore::CSSFontSelector::resume): (WebCore::CSSFontSelector::beginLoadTimerFired): Deleted. * css/CSSFontSelector.h: * loader/DocumentLoader.cpp: (WebCore::DocumentLoader::stopLoading): LayoutTests: 1) The page has some content that has “font-family: WebFont” but there are no @font-face blocks on the page 2) In script, after the page has loaded, add an @font-face rule to the page with “font-family: WebFont” and some valid font URL 3) Synchronously, within the same turn of the run loop, trigger a synchronous layout of the element (using offsetWidth or something). This will add the font to the 0-delay time work list. 4) Synchronously, within the same turn of the run loop, navigate to a second page that doesn’t use the web font. 5) The second page waits some small-but-positive amount of time. This will cause the 0-delay timer to fire, but because the page is in the middle of navigating, the font load should fail. 6) The second page adds the same @font-face rule to itself using script. This should pull the same (failed) CachedResource object out of the memory cache. 7) Use the CSS Font Loading API to wait for the font load to complete 8) Make sure that the font is used on the second page (as a reference test). Today, the second page’s font load will fail because it pulled the failed font out of the memory cache. The test makes sure the second page’s font load succeeds. * fast/loader/font-load-timer-expected.html: Added. * fast/loader/font-load-timer.html: Added. * fast/loader/resources/font-load-timer-navigation-destination.html: Added. git-svn-id: https://svn.webkit.org/repository/webkit/trunk@266148 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-08-25 Brady Eidson <beidson@apple.com> Font loads quickly followed by navigations may fail indefinitely <rdar://problem/65560550> and https://bugs.webkit.org/show_bug.cgi?id=215435 Reviewed by Myles C. Maxfield. Second take at this. Myles took the first swipe at this, but a conflict with SuspendableTimer caused issues in the form of layout test asserts with http/tests/security/navigate-when-restoring-cached-page.html His original ChangeLog entry: Font loads are coalesced using a zero-delay timer. However, that zero-delay timer can fire while the page is in the middle of a navigation, which will cause the font loads to fail. Then, the second page can request those same fonts, which are marked as failed, and as such will never actually load/use the desired web font. This patch just stops the zero-delay timer during navigations, and resumes it when resuming the document. This means: 1. The second page in the above story will not see that the font has failed, or even started, and will then re-request the font and load it successfully 2. If the user goes "back" to the previous page, the zero-delay timer is restarted, the CachedFont realizes it's already succeeded, and the previous page is rendered as expected. Test: fast/loader/font-load-timer.html --- Now the explanation of the failure it caused: The font loading timer was a SuspendableTimer, which is an ActiveDOMObject. An ActiveDOMObject was used to make sure the delayed font loads play well with the page cache, which is still necessary. But we also still need to suspend the timer manually when "stopLoading()" is called, which doesn't play well with ActiveDOMObject's automatic suspend/resume. My solution: - Make the timer "just a normal timer" - Make CSSFontSelector itself the ActiveDOMObject - Let DocumentLoader explicitly pause the font load timer - Rely on ActiveDOMObject to resume the timer These keep the bug fixed and resolve the layout test ASSERT seen with http/tests/security/navigate-when-restoring-cached-page.html * css/CSSFontSelector.cpp: (WebCore::CSSFontSelector::CSSFontSelector): (WebCore::CSSFontSelector::clearDocument): (WebCore::CSSFontSelector::beginLoadingFontSoon): (WebCore::CSSFontSelector::suspendFontLoadingTimer): (WebCore::CSSFontSelector::fontLoadingTimerFired): (WebCore::CSSFontSelector::stop): (WebCore::CSSFontSelector::suspend): (WebCore::CSSFontSelector::resume): (WebCore::CSSFontSelector::beginLoadTimerFired): Deleted. * css/CSSFontSelector.h: * loader/DocumentLoader.cpp: (WebCore::DocumentLoader::stopLoading): 2020-09-22 Alan Coon <alancoon@apple.com> Cherry-pick r267106. rdar://problem/69381319 CRASH: Exception thrown from -[AVContentKeyRequest makeStreamingContentKeyRequestDataForApp:contentIdentifier:options:completionHandler:] https://bugs.webkit.org/show_bug.cgi?id=216580 <rdar://problem/68866834> Reviewed by Eric Carlson. Protect against undocumented exceptions thrown from AVContentKeySession (and related) APIs by wrapping in @try/@catch blocks and firing the correct failure callbacks if an exception is encountered. * platform/graphics/avfoundation/objc/CDMInstanceFairPlayStreamingAVFObjC.mm: (WebCore::CDMInstanceSessionFairPlayStreamingAVFObjC::didProvideRequest): (WebCore::CDMInstanceSessionFairPlayStreamingAVFObjC::didProvideRequests): (WebCore::CDMInstanceSessionFairPlayStreamingAVFObjC::didProvideRenewingRequest): git-svn-id: https://svn.webkit.org/repository/webkit/trunk@267106 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-09-15 Jer Noble <jer.noble@apple.com> CRASH: Exception thrown from -[AVContentKeyRequest makeStreamingContentKeyRequestDataForApp:contentIdentifier:options:completionHandler:] https://bugs.webkit.org/show_bug.cgi?id=216580 <rdar://problem/68866834> Reviewed by Eric Carlson. Protect against undocumented exceptions thrown from AVContentKeySession (and related) APIs by wrapping in @try/@catch blocks and firing the correct failure callbacks if an exception is encountered. * platform/graphics/avfoundation/objc/CDMInstanceFairPlayStreamingAVFObjC.mm: (WebCore::CDMInstanceSessionFairPlayStreamingAVFObjC::didProvideRequest): (WebCore::CDMInstanceSessionFairPlayStreamingAVFObjC::didProvideRequests): (WebCore::CDMInstanceSessionFairPlayStreamingAVFObjC::didProvideRenewingRequest): 2020-09-22 Alan Coon <alancoon@apple.com> Cherry-pick r266689. rdar://problem/69382883 [MotionMark - Multiply] Web process spends ~1% of total samples in PropertyCascade::resolveDirectionAndWritingMode https://bugs.webkit.org/show_bug.cgi?id=216223 Reviewed by Darin Adler. A few subtests in MotionMark (Leaves, Focus, Design, and especially Multiply) spend large amounts of time in style resolution (`Document::resolveStyle`) due to constant style changes across many elements during every frame. In Multiply, ~3-4% of the time underneath `Document::resolveStyle` is spent resolving direction and writing modes inside `PropertyCascade::resolveDirectionAndWritingMode` (i.e., ~2.3 million invocations). This helper function is responsible for computing the text direction and CSS writing mode that is used to resolve direction-aware CSS properties (which are enumerated in `CSSProperty::isDirectionAwareProperty`). Resolving the direction and writing mode involves iterating over all of the matched CSS properties (`m_matchResult`) in the property cascade in search of CSS properties for writing and direction, which can be relatively expensive when there are lots of properties in the cascade. However, if there are no direction-aware CSS properties in the cascade, this work can actually be elided; to achieve this, we can store the inherited `Direction` in `m_direction`, and then lazily resolve it if needed. I measured this locally to yield a little under ~1% in the Multiply subtest in MotionMark. Otherwise, there is no change in behavior; see below for more details. * style/PropertyCascade.cpp: (WebCore::Style::PropertyCascade::PropertyCascade): (WebCore::Style::PropertyCascade::set): If we encounter a direction-aware CSS property, then use `direction()` to ensure that the direction and writing mode are resolved. (WebCore::Style::PropertyCascade::direction const): Make this getter call `resolveDirectionAndWritingMode` if needed. * style/PropertyCascade.h: Add a new `bool` member to keep track of whether or not the CSS direction has not yet been resolved. Note that since this member variable fits within the padding after `Direction m_direction;`, this class is still the same size. (WebCore::Style::PropertyCascade::direction const): Deleted. git-svn-id: https://svn.webkit.org/repository/webkit/trunk@266689 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-09-06 Wenson Hsieh <wenson_hsieh@apple.com> [MotionMark - Multiply] Web process spends ~1% of total samples in PropertyCascade::resolveDirectionAndWritingMode https://bugs.webkit.org/show_bug.cgi?id=216223 Reviewed by Darin Adler. A few subtests in MotionMark (Leaves, Focus, Design, and especially Multiply) spend large amounts of time in style resolution (`Document::resolveStyle`) due to constant style changes across many elements during every frame. In Multiply, ~3-4% of the time underneath `Document::resolveStyle` is spent resolving direction and writing modes inside `PropertyCascade::resolveDirectionAndWritingMode` (i.e., ~2.3 million invocations). This helper function is responsible for computing the text direction and CSS writing mode that is used to resolve direction-aware CSS properties (which are enumerated in `CSSProperty::isDirectionAwareProperty`). Resolving the direction and writing mode involves iterating over all of the matched CSS properties (`m_matchResult`) in the property cascade in search of CSS properties for writing and direction, which can be relatively expensive when there are lots of properties in the cascade. However, if there are no direction-aware CSS properties in the cascade, this work can actually be elided; to achieve this, we can store the inherited `Direction` in `m_direction`, and then lazily resolve it if needed. I measured this locally to yield a little under ~1% in the Multiply subtest in MotionMark. Otherwise, there is no change in behavior; see below for more details. * style/PropertyCascade.cpp: (WebCore::Style::PropertyCascade::PropertyCascade): (WebCore::Style::PropertyCascade::set): If we encounter a direction-aware CSS property, then use `direction()` to ensure that the direction and writing mode are resolved. (WebCore::Style::PropertyCascade::direction const): Make this getter call `resolveDirectionAndWritingMode` if needed. * style/PropertyCascade.h: Add a new `bool` member to keep track of whether or not the CSS direction has not yet been resolved. Note that since this member variable fits within the padding after `Direction m_direction;`, this class is still the same size. (WebCore::Style::PropertyCascade::direction const): Deleted. 2020-09-22 Alan Coon <alancoon@apple.com> Cherry-pick r266353. rdar://problem/69382920 Optimize the implementation of TransformationMatrix::rotate(double) https://bugs.webkit.org/show_bug.cgi?id=215994 Reviewed by Tim Horton. TransformationMatrix::rotate(angle) currently just calls TransformationMatrix::rotate3d(0, 0, 1, angle), which has a fast path for the case where we're rotating about the z-axis. However, we can make this *slightly* faster by omitting the hypotenuse computation, several floating point comparisons, and several assignments in this case because we already know that we're just rotating about the z-axis. This is a small (but measurable) improvement on the Multiply subtest of MotionMark, which applies a little over 3 million rotation transformations over the course of 30 seconds. * platform/graphics/transforms/RotateTransformOperation.h: Instead of calling `rotate3d`, just have `rotate` directly call `multiply` with the following `TransformationMatrix`: ``` [[ cos(z) sin(z) 0 0 ] [ -sin(z) cos(z) 0 0 ] [ 0 0 1 0 ] [ 0 0 0 1 ]] ``` ...where `z` is the angle of rotation, in radians. * platform/graphics/transforms/TransformationMatrix.cpp: (WebCore::TransformationMatrix::rotate): * platform/graphics/transforms/TransformationMatrix.h: (WebCore::TransformationMatrix::rotate): Deleted. git-svn-id: https://svn.webkit.org/repository/webkit/trunk@266353 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-08-31 Wenson Hsieh <wenson_hsieh@apple.com> Optimize the implementation of TransformationMatrix::rotate(double) https://bugs.webkit.org/show_bug.cgi?id=215994 Reviewed by Tim Horton. TransformationMatrix::rotate(angle) currently just calls TransformationMatrix::rotate3d(0, 0, 1, angle), which has a fast path for the case where we're rotating about the z-axis. However, we can make this *slightly* faster by omitting the hypotenuse computation, several floating point comparisons, and several assignments in this case because we already know that we're just rotating about the z-axis. This is a small (but measurable) improvement on the Multiply subtest of MotionMark, which applies a little over 3 million rotation transformations over the course of 30 seconds. * platform/graphics/transforms/RotateTransformOperation.h: Instead of calling `rotate3d`, just have `rotate` directly call `multiply` with the following `TransformationMatrix`: ``` [[ cos(z) sin(z) 0 0 ] [ -sin(z) cos(z) 0 0 ] [ 0 0 1 0 ] [ 0 0 0 1 ]] ``` ...where `z` is the angle of rotation, in radians. * platform/graphics/transforms/TransformationMatrix.cpp: (WebCore::TransformationMatrix::rotate): * platform/graphics/transforms/TransformationMatrix.h: (WebCore::TransformationMatrix::rotate): Deleted. 2020-09-22 Alan Coon <alancoon@apple.com> Cherry-pick r266198. rdar://problem/69382901 Avoid unnecessarily copying a Vector in WebCore::transformsForValue https://bugs.webkit.org/show_bug.cgi?id=215858 Reviewed by Tim Horton. Avoid copying the `Vector` of `TransformOperation`s in this helper function by directly appending newly created transform operations to the given `TransformOperations`. This does, however, mean that we need to clear these items in the case where conversion fails and we return false. * css/TransformFunctions.cpp: (WebCore::transformsForValue): git-svn-id: https://svn.webkit.org/repository/webkit/trunk@266198 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-08-26 Wenson Hsieh <wenson_hsieh@apple.com> Avoid unnecessarily copying a Vector in WebCore::transformsForValue https://bugs.webkit.org/show_bug.cgi?id=215858 Reviewed by Tim Horton. Avoid copying the `Vector` of `TransformOperation`s in this helper function by directly appending newly created transform operations to the given `TransformOperations`. This does, however, mean that we need to clear these items in the case where conversion fails and we return false. * css/TransformFunctions.cpp: (WebCore::transformsForValue): 2020-09-18 Alan Coon <alancoon@apple.com> Cherry-pick r266619. rdar://problem/69101154 Add a fast path in TransformationMatrix::mapRect(const FloatRect&) for affine transformations https://bugs.webkit.org/show_bug.cgi?id=216139 Reviewed by Tim Horton. Add a fast path when mapping 2D points through affine transformation matrices that takes advantage of both: 1. The predetermined 0 and 1 values in affine transformation matrices. 2. The fact that points in the FloatRect are aligned with x and y axes (as opposed to a FloatQuad of 4 arbitrary points), which allows us to avoid mapping all 4 corners of the rect through the matrix. The current implementation of this method maps each of the 4 corners through the transformation matrix, creates a FloatQuad using these 4 transformed points, and then asks the FloatQuad for its bounding box. This requires a total of 26 floating point additions, 24 multiplications and 20 comparisons, as well as a small (but measurable) amount of overhead when creating the FloatPoints and FloatQuad and asking for the bounding rect. We can pare this down to just 8 additions, 8 multiplications, and 4 comparisons by using a different strategy that instead branches on the 4 relevant matrix coefficients `a, b, c, d` (rather than the each of the final x and y coordinates) to determine which of the min or max x and y values to multiply in order to compute the min and max x and y coordinates in the final bounding rect. In a quick microbenchmark that maps FloatRects through an affine TransformationMatrix, this roughly halves the time spent in `TransformationMatrix::mapRect`; on the Multiply subtest of MotionMark (which invokes this method ~17 million times, almost entirely with affine transformation matrices), I measured a ~1% improvement. * platform/graphics/transforms/TransformationMatrix.cpp: (WebCore::TransformationMatrix::mapRect const): git-svn-id: https://svn.webkit.org/repository/webkit/trunk@266619 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-09-04 Wenson Hsieh <wenson_hsieh@apple.com> Add a fast path in TransformationMatrix::mapRect(const FloatRect&) for affine transformations https://bugs.webkit.org/show_bug.cgi?id=216139 Reviewed by Tim Horton. Add a fast path when mapping 2D points through affine transformation matrices that takes advantage of both: 1. The predetermined 0 and 1 values in affine transformation matrices. 2. The fact that points in the FloatRect are aligned with x and y axes (as opposed to a FloatQuad of 4 arbitrary points), which allows us to avoid mapping all 4 corners of the rect through the matrix. The current implementation of this method maps each of the 4 corners through the transformation matrix, creates a FloatQuad using these 4 transformed points, and then asks the FloatQuad for its bounding box. This requires a total of 26 floating point additions, 24 multiplications and 20 comparisons, as well as a small (but measurable) amount of overhead when creating the FloatPoints and FloatQuad and asking for the bounding rect. We can pare this down to just 8 additions, 8 multiplications, and 4 comparisons by using a different strategy that instead branches on the 4 relevant matrix coefficients `a, b, c, d` (rather than the each of the final x and y coordinates) to determine which of the min or max x and y values to multiply in order to compute the min and max x and y coordinates in the final bounding rect. In a quick microbenchmark that maps FloatRects through an affine TransformationMatrix, this roughly halves the time spent in `TransformationMatrix::mapRect`; on the Multiply subtest of MotionMark (which invokes this method ~17 million times, almost entirely with affine transformation matrices), I measured a ~1% improvement. * platform/graphics/transforms/TransformationMatrix.cpp: (WebCore::TransformationMatrix::mapRect const): 2020-09-18 Alan Coon <alancoon@apple.com> Cherry-pick r266513. rdar://problem/69153717 Make TransformationMatrix::inverse() faster in the case of affine transformation matrices https://bugs.webkit.org/show_bug.cgi?id=216101 Reviewed by Tim Horton. The Multiply subtest of MotionMark places a large number of elements that are all rotated by some angle; when painting these, we currently spend about 7% of the time under `RenderLayer::paintLayerByApplyingTransform` just inverting the transformation matrix (underneath `TransformationMatrix::inverse()`) so that we can map the bounds of the dirty rect through this inverse. `TransformationMatrix::inverse()` currently has a fast path for identity and translation matrices that avoids having to fall back to the generalized 4-by-4 matrix inverse equation; this generalized algorithm works by dividing the entire adjoint matrix by the determinant, a process that involves nearly 1000 floating point additions and multiplications. However, in this case, all of the matrices are a combination of translations and rotations, which all result in affine transformations. As such, there's no need to fall back to the generalized algorithm for computing the inverse; instead, we can bail early with simpler strategy that only requires 15 floating point additions and multiplications. We can also take advantange of the fact that we currently go through most of the entries in the 4x4 matrix to determine whether the matrix is an identity or translation matrix, by introducing a new helper method that returns not only whether the matrix is the identity matrix or translation, but also whether the matrix is affine (by the definition of `TransformationMatrix::isAffine()`). Since most of the entries that need to be 1 or 0 in order for a matrix to be a translation matrix vs. just an affine transformation matrix are the same, this helps avoid some redundant checks in `TransformationMatrix::inverse()`. We also apply a similar optimization to `TransformationMatrix::isInvertible()`, reducing the multiplications and additions from roughly 200 to just 3. I measured this locally to be a (statistically significant) 2% improvement on Multiply. * platform/graphics/transforms/TransformationMatrix.cpp: (WebCore::TransformationMatrix::isInvertible const): (WebCore::TransformationMatrix::inverse const): * platform/graphics/transforms/TransformationMatrix.h: (WebCore::TransformationMatrix::type const): git-svn-id: https://svn.webkit.org/repository/webkit/trunk@266513 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-09-03 Wenson Hsieh <wenson_hsieh@apple.com> Make TransformationMatrix::inverse() faster in the case of affine transformation matrices https://bugs.webkit.org/show_bug.cgi?id=216101 Reviewed by Tim Horton. The Multiply subtest of MotionMark places a large number of elements that are all rotated by some angle; when painting these, we currently spend about 7% of the time under `RenderLayer::paintLayerByApplyingTransform` just inverting the transformation matrix (underneath `TransformationMatrix::inverse()`) so that we can map the bounds of the dirty rect through this inverse. `TransformationMatrix::inverse()` currently has a fast path for identity and translation matrices that avoids having to fall back to the generalized 4-by-4 matrix inverse equation; this generalized algorithm works by dividing the entire adjoint matrix by the determinant, a process that involves nearly 1000 floating point additions and multiplications. However, in this case, all of the matrices are a combination of translations and rotations, which all result in affine transformations. As such, there's no need to fall back to the generalized algorithm for computing the inverse; instead, we can bail early with simpler strategy that only requires 15 floating point additions and multiplications. We can also take advantange of the fact that we currently go through most of the entries in the 4x4 matrix to determine whether the matrix is an identity or translation matrix, by introducing a new helper method that returns not only whether the matrix is the identity matrix or translation, but also whether the matrix is affine (by the definition of `TransformationMatrix::isAffine()`). Since most of the entries that need to be 1 or 0 in order for a matrix to be a translation matrix vs. just an affine transformation matrix are the same, this helps avoid some redundant checks in `TransformationMatrix::inverse()`. We also apply a similar optimization to `TransformationMatrix::isInvertible()`, reducing the multiplications and additions from roughly 200 to just 3. I measured this locally to be a (statistically significant) 2% improvement on Multiply. * platform/graphics/transforms/TransformationMatrix.cpp: (WebCore::TransformationMatrix::isInvertible const): (WebCore::TransformationMatrix::inverse const): * platform/graphics/transforms/TransformationMatrix.h: (WebCore::TransformationMatrix::type const): 2020-09-17 Alan Coon <alancoon@apple.com> Cherry-pick r266834. rdar://problem/69101124 REGRESSION (r260360): Ionic modal dialog doesn't animate correctly when dragged and released https://bugs.webkit.org/show_bug.cgi?id=216308 <rdar://problem/68567444> Reviewed by Simon Fraser. Source/WebCore: We fixed seeking for animations with a reversed playback rate in r261637, the fix for bug 204717, but only looked at the animation's playback rate. However, an animation can also play in reverse using the "direction" property of the timing object passed to updateTiming(), so we should also check that it's playing forwards in order to be seeked. Test: webanimations/accelerated-animation-easing-and-direction-update.html * platform/graphics/ca/GraphicsLayerCA.cpp: (WebCore::GraphicsLayerCA::animationCanBeAccelerated const): LayoutTests: Add a new test that updates the "easing" and "direction" timing properties of a playing animation and checks that it matches the display of another animation with similar timing properties from the start. * platform/win/TestExpectations: * webanimations/accelerated-animation-easing-and-direction-update-expected.html: Added. * webanimations/accelerated-animation-easing-and-direction-update.html: Added. git-svn-id: https://svn.webkit.org/repository/webkit/trunk@266834 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-09-10 Antoine Quint <graouts@webkit.org> REGRESSION (r260360): Ionic modal dialog doesn't animate correctly when dragged and released https://bugs.webkit.org/show_bug.cgi?id=216308 <rdar://problem/68567444> Reviewed by Simon Fraser. We fixed seeking for animations with a reversed playback rate in r261637, the fix for bug 204717, but only looked at the animation's playback rate. However, an animation can also play in reverse using the "direction" property of the timing object passed to updateTiming(), so we should also check that it's playing forwards in order to be seeked. Test: webanimations/accelerated-animation-easing-and-direction-update.html * platform/graphics/ca/GraphicsLayerCA.cpp: (WebCore::GraphicsLayerCA::animationCanBeAccelerated const): 2020-09-17 Alan Coon <alancoon@apple.com> Cherry-pick r266789. rdar://problem/69101080 REGRESSION (r264856): updating easing on accelerated animation results in incorrect playback https://bugs.webkit.org/show_bug.cgi?id=215853 <rdar://problem/67815853> Reviewed by Simon Fraser. Source/WebCore: Stop accelerated animations if the timing function has changed in a way that makes it so that it should no longer play accelerated, but otherwise simply update their timing properties such that may keep playing. Test: webanimations/accelerated-animation-easing-update-after-pause.html webanimations/accelerated-animation-easing-update-steps-after-pause.html * animation/KeyframeEffect.cpp: (WebCore::KeyframeEffect::canBeAccelerated const): (WebCore::KeyframeEffect::updateAcceleratedActions): (WebCore::KeyframeEffect::animationDidChangeTimingProperties): * animation/KeyframeEffect.h: LayoutTests: Add new tests that check that updating an animation's easing does not stop it. * platform/win/TestExpectations: * webanimations/accelerated-animation-easing-update-after-pause-expected.html: Added. * webanimations/accelerated-animation-easing-update-after-pause.html: Added. * webanimations/accelerated-animation-easing-update-steps-after-pause-expected.html: Addded. * webanimations/accelerated-animation-easing-update-steps-after-pause.html: Addded. git-svn-id: https://svn.webkit.org/repository/webkit/trunk@266789 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-09-09 Antoine Quint <graouts@webkit.org> REGRESSION (r264856): updating easing on accelerated animation results in incorrect playback https://bugs.webkit.org/show_bug.cgi?id=215853 <rdar://problem/67815853> Reviewed by Simon Fraser. Stop accelerated animations if the timing function has changed in a way that makes it so that it should no longer play accelerated, but otherwise simply update their timing properties such that may keep playing. Test: webanimations/accelerated-animation-easing-update-after-pause.html webanimations/accelerated-animation-easing-update-steps-after-pause.html * animation/KeyframeEffect.cpp: (WebCore::KeyframeEffect::canBeAccelerated const): (WebCore::KeyframeEffect::updateAcceleratedActions): (WebCore::KeyframeEffect::animationDidChangeTimingProperties): * animation/KeyframeEffect.h: 2020-09-17 Alan Coon <alancoon@apple.com> Cherry-pick r266846. rdar://problem/68740511 Don't create event regions when the page has no subscrollers https://bugs.webkit.org/show_bug.cgi?id=216355 <rdar://problem/67900642> Reviewed by Simon Fraser. Source/WebCore: Tests: fast/scrolling/mac/event-region-subscroller-frame.html fast/scrolling/mac/event-region-subscroller-overflow.html Unless the page uses features like touch-action we don't need event regions for plain main frame scrolling. * page/scrolling/AsyncScrollingCoordinator.cpp: (WebCore::AsyncScrollingCoordinator::hasSubscrollers const): * page/scrolling/AsyncScrollingCoordinator.h: * page/scrolling/ScrollingCoordinator.h: (WebCore::ScrollingCoordinator::hasSubscrollers const): * page/scrolling/ScrollingStateScrollingNode.cpp: (WebCore::ScrollingStateScrollingNode::ScrollingStateScrollingNode): (WebCore::ScrollingStateScrollingNode::~ScrollingStateScrollingNode): * page/scrolling/ScrollingStateTree.h: (WebCore::ScrollingStateTree::scrollingNodeCount const): (WebCore::ScrollingStateTree::scrollingNodeAdded): (WebCore::ScrollingStateTree::scrollingNodeRemoved): Count scrolling nodes in the state tree. It is updated during updateCompositingLayers, before event region generation. * rendering/RenderLayerBacking.cpp: (WebCore::RenderLayerBacking::maintainsEventRegion const): Don't maintain event region if there are no subscrollers and none of the other reasons were hit. * rendering/RenderLayerCompositor.cpp: (WebCore::RenderLayerCompositor::updateCompositingLayers): Invalidate event regions if a subscroller appears. (WebCore::RenderLayerCompositor::invalidateEventRegionForAllFrames): * rendering/RenderLayerCompositor.h: LayoutTests: Add overflow scrollers to some existing tests so they still generate event regions. * fast/scrolling/ios/border-radius-event-region-expected.txt: * fast/scrolling/ios/border-radius-event-region.html: * fast/scrolling/ios/event-region-float-expected.txt: * fast/scrolling/ios/event-region-float.html: * fast/scrolling/ios/event-region-pointer-events-expected.txt: * fast/scrolling/ios/event-region-pointer-events.html: * fast/scrolling/ios/event-region-scale-transform-shared-expected.txt: * fast/scrolling/ios/event-region-scale-transform-shared.html: * fast/scrolling/ios/event-region-translate-transform-shared-expected.txt: * fast/scrolling/ios/event-region-translate-transform-shared.html: * fast/scrolling/ios/event-region-visibility-hidden-expected.txt: * fast/scrolling/ios/event-region-visibility-hidden.html: * fast/scrolling/mac/border-radius-event-region-expected.txt: * fast/scrolling/mac/border-radius-event-region.html: * fast/scrolling/mac/event-region-subscroller-frame-expected.txt: Added. * fast/scrolling/mac/event-region-subscroller-frame.html: Added. * fast/scrolling/mac/event-region-subscroller-overflow-expected.txt: Added. * fast/scrolling/mac/event-region-subscroller-overflow.html: Copied from LayoutTests/fast/scrolling/ios/event-region-visibility-hidden.html. * fast/scrolling/mac/event-region-visibility-hidden-expected.txt: * fast/scrolling/mac/event-region-visibility-hidden.html: git-svn-id: https://svn.webkit.org/repository/webkit/trunk@266846 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-09-10 Antti Koivisto <antti@apple.com> Don't create event regions when the page has no subscrollers https://bugs.webkit.org/show_bug.cgi?id=216355 <rdar://problem/67900642> Reviewed by Simon Fraser. Tests: fast/scrolling/mac/event-region-subscroller-frame.html fast/scrolling/mac/event-region-subscroller-overflow.html Unless the page uses features like touch-action we don't need event regions for plain main frame scrolling. * page/scrolling/AsyncScrollingCoordinator.cpp: (WebCore::AsyncScrollingCoordinator::hasSubscrollers const): * page/scrolling/AsyncScrollingCoordinator.h: * page/scrolling/ScrollingCoordinator.h: (WebCore::ScrollingCoordinator::hasSubscrollers const): * page/scrolling/ScrollingStateScrollingNode.cpp: (WebCore::ScrollingStateScrollingNode::ScrollingStateScrollingNode): (WebCore::ScrollingStateScrollingNode::~ScrollingStateScrollingNode): * page/scrolling/ScrollingStateTree.h: (WebCore::ScrollingStateTree::scrollingNodeCount const): (WebCore::ScrollingStateTree::scrollingNodeAdded): (WebCore::ScrollingStateTree::scrollingNodeRemoved): Count scrolling nodes in the state tree. It is updated during updateCompositingLayers, before event region generation. * rendering/RenderLayerBacking.cpp: (WebCore::RenderLayerBacking::maintainsEventRegion const): Don't maintain event region if there are no subscrollers and none of the other reasons were hit. * rendering/RenderLayerCompositor.cpp: (WebCore::RenderLayerCompositor::updateCompositingLayers): Invalidate event regions if a subscroller appears. (WebCore::RenderLayerCompositor::invalidateEventRegionForAllFrames): * rendering/RenderLayerCompositor.h: 2020-09-17 Alan Coon <alancoon@apple.com> Cherry-pick r266677. rdar://problem/68740521 [MotionMark] RenderLayer::paintLayerContents spends ~5% of the time in MonotonicTime::now() in Multiply https://bugs.webkit.org/show_bug.cgi?id=216190 Reviewed by Darin Adler. Source/WebCore: In several of MotionMark's subtests (for instance, Multiply), we spent a large amount of time underneath `RenderLayer::paintLayerContents` due to both the large number of layers and the need to frequently repaint each layer (all of which are constantly being animated). Underneath this method, a nontrivial amount of time (~5%) is then spent grabbing the system time via `MonotonicTime::now()`. We can avoid this extra work by instead using the timestamp of the last rendering update (before we started painting), which we keep track of using a new member variable on `Page`. See below for more details, as well as the WebKit2 ChangeLog. * page/ChromeClient.h: (WebCore::ChromeClient::timestampForPaintFrequencyTracking const): Add a client hook to fetch the timestamp to use when tracking painting frequency. See the WebKit2 ChangeLog for more details. * page/Page.cpp: (WebCore::Page::updateRendering): Update `m_lastRenderingUpdateTimestamp`. * page/Page.h: (WebCore::Page::lastRenderingUpdateTimestamp const): * rendering/PaintFrequencyTracker.h: Drive-by cleanup: narrow the `PaintFrequency` enum to `bool` width. (WebCore::PaintFrequencyTracker::begin): (WebCore::SinglePaintFrequencyTracking::SinglePaintFrequencyTracking): * rendering/RenderLayer.cpp: (WebCore::RenderLayer::paintLayerContents): Call out to the client layer to return a timestamp for tracking painting frequency. By default, this is simply the current time (`MonotonicTime::now()`), but ports (namely, WebKit2) may opt for a coarser granularity. (WebCore::RenderLayer::simulateFrequentPaint): * rendering/RenderLayer.h: Source/WebKit: * WebProcess/WebCoreSupport/WebChromeClient.cpp: (WebKit::WebChromeClient::timestampForPaintFrequencyTracking const): In WebKit2, we can assume (with the exception of SVG pages) that we must've performed a rendering update prior to tracking painting frequencies. As such, we can use the page's rendering update timestamp instead of the real current time (`MonotonicTime::now()`). Note that in WebKit1, it is possible for any client to force a synchronous paint of the page before the page has performed a rendering update, which triggers assertions in `SinglePaintFrequencyTracking::end()`. As such, we stick with `MonotonicTime::now()` in WebKit1. * WebProcess/WebCoreSupport/WebChromeClient.h: git-svn-id: https://svn.webkit.org/repository/webkit/trunk@266677 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-09-05 Wenson Hsieh <wenson_hsieh@apple.com> [MotionMark] RenderLayer::paintLayerContents spends ~5% of the time in MonotonicTime::now() in Multiply https://bugs.webkit.org/show_bug.cgi?id=216190 Reviewed by Darin Adler. In several of MotionMark's subtests (for instance, Multiply), we spent a large amount of time underneath `RenderLayer::paintLayerContents` due to both the large number of layers and the need to frequently repaint each layer (all of which are constantly being animated). Underneath this method, a nontrivial amount of time (~5%) is then spent grabbing the system time via `MonotonicTime::now()`. We can avoid this extra work by instead using the timestamp of the last rendering update (before we started painting), which we keep track of using a new member variable on `Page`. See below for more details, as well as the WebKit2 ChangeLog. * page/ChromeClient.h: (WebCore::ChromeClient::timestampForPaintFrequencyTracking const): Add a client hook to fetch the timestamp to use when tracking painting frequency. See the WebKit2 ChangeLog for more details. * page/Page.cpp: (WebCore::Page::updateRendering): Update `m_lastRenderingUpdateTimestamp`. * page/Page.h: (WebCore::Page::lastRenderingUpdateTimestamp const): * rendering/PaintFrequencyTracker.h: Drive-by cleanup: narrow the `PaintFrequency` enum to `bool` width. (WebCore::PaintFrequencyTracker::begin): (WebCore::SinglePaintFrequencyTracking::SinglePaintFrequencyTracking): * rendering/RenderLayer.cpp: (WebCore::RenderLayer::paintLayerContents): Call out to the client layer to return a timestamp for tracking painting frequency. By default, this is simply the current time (`MonotonicTime::now()`), but ports (namely, WebKit2) may opt for a coarser granularity. (WebCore::RenderLayer::simulateFrequentPaint): * rendering/RenderLayer.h: 2020-09-17 Alan Coon <alancoon@apple.com> Cherry-pick r266232. rdar://problem/68178664 Step animations invalidate style on every rendering update whether or not they need to https://bugs.webkit.org/show_bug.cgi?id=215229 <rdar://problem/66636153> Reviewed by Antoine Quint. Source/WebCore: Step timing functions with transforms try and fail to start accelerated which causes them to repeatedly schedule unnecessary rendering updates. * animation/KeyframeEffect.cpp: (WebCore::KeyframeEffect::updateAcceleratedActions): Step timing functions are never accelerated so don't bother trying to start them in accelerated state. This is similar to treatmeant of unaccelerated properties. LayoutTests: * animations/steps-transform-rendering-updates-expected.txt: git-svn-id: https://svn.webkit.org/repository/webkit/trunk@266232 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-08-27 Antti Koivisto <antti@apple.com> Step animations invalidate style on every rendering update whether or not they need to https://bugs.webkit.org/show_bug.cgi?id=215229 <rdar://problem/66636153> Reviewed by Antoine Quint. Step timing functions with transforms try and fail to start accelerated which causes them to repeatedly schedule unnecessary rendering updates. * animation/KeyframeEffect.cpp: (WebCore::KeyframeEffect::updateAcceleratedActions): Step timing functions are never accelerated so don't bother trying to start them in accelerated state. This is similar to treatmeant of unaccelerated properties. 2020-09-17 Alan Coon <alancoon@apple.com> Cherry-pick r267057. rdar://problem/69101182 [Cocoa,HDR] HLS streams with HDR variants will not select HDR. https://bugs.webkit.org/show_bug.cgi?id=216203 <rdar://problem/67438626> Reviewed by Darin Adler. Source/WebCore: Test: http/tests/media/hls/hls-hdr-switch.html In r264710, we adopted a new API to set the preferred HDR mode for every AVPlayer created by an HTMLMediaElement. The MediaPlayerPrivateAVFoundationObjC object will query its parent when it creates an AVPlayer, or the MediaPlayer will tell the MediaPlayerPrivate... that the HDR mode changes if the AVPlayer is already created. However, in r264710, we neglected to cache the new value of the preferred HDR mode, so subsequent queries will just return "Standard". This means HDR mode will correctly be applied if it changes after the AVPlayer has been created, but not initially. * platform/graphics/MediaPlayer.cpp: (WebCore::MediaPlayer::setPreferredDynamicRangeMode): LayoutTests: * http/tests/media/hls/hls-hdr-switch-expected.txt: Added. * http/tests/media/hls/hls-hdr-switch.html: Added. * http/tests/media/resources/hls/green-bip.ts: Added. * http/tests/media/resources/hls/hdr.m3u8: Added. * http/tests/media/resources/hls/red-bip.ts: Added. * http/tests/media/resources/hls/test-live.php: git-svn-id: https://svn.webkit.org/repository/webkit/trunk@267057 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-09-14 Jer Noble <jer.noble@apple.com> [Cocoa,HDR] HLS streams with HDR variants will not select HDR. https://bugs.webkit.org/show_bug.cgi?id=216203 <rdar://problem/67438626> Reviewed by Darin Adler. Test: http/tests/media/hls/hls-hdr-switch.html In r264710, we adopted a new API to set the preferred HDR mode for every AVPlayer created by an HTMLMediaElement. The MediaPlayerPrivateAVFoundationObjC object will query its parent when it creates an AVPlayer, or the MediaPlayer will tell the MediaPlayerPrivate... that the HDR mode changes if the AVPlayer is already created. However, in r264710, we neglected to cache the new value of the preferred HDR mode, so subsequent queries will just return "Standard". This means HDR mode will correctly be applied if it changes after the AVPlayer has been created, but not initially. * platform/graphics/MediaPlayer.cpp: (WebCore::MediaPlayer::setPreferredDynamicRangeMode): 2020-09-17 Alan Coon <alancoon@apple.com> Cherry-pick r266972. rdar://problem/69101020 REGRESSION (r255383): Transition from email to password field on login.live.com stutters after going back and forth https://bugs.webkit.org/show_bug.cgi?id=216368 <rdar://problem/67019460> Reviewed by Simon Fraser. Source/WebCore: Ensure we repaint before disconnecting from the backing provider layer. Test: compositing/animation/repaint-after-clearing-shared-backing.html * rendering/RenderLayerCompositor.cpp: (WebCore::RenderLayerCompositor::updateBacking): LayoutTests: * compositing/animation/repaint-after-clearing-shared-backing-expected.html: Added. * compositing/animation/repaint-after-clearing-shared-backing.html: Added. git-svn-id: https://svn.webkit.org/repository/webkit/trunk@266972 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-09-11 Antoine Quint <graouts@webkit.org> REGRESSION (r255383): Transition from email to password field on login.live.com stutters after going back and forth https://bugs.webkit.org/show_bug.cgi?id=216368 <rdar://problem/67019460> Reviewed by Simon Fraser. Ensure we repaint before disconnecting from the backing provider layer. Test: compositing/animation/repaint-after-clearing-shared-backing.html * rendering/RenderLayerCompositor.cpp: (WebCore::RenderLayerCompositor::updateBacking): 2020-09-17 Alan Coon <alancoon@apple.com> Cherry-pick r266827. rdar://problem/69101047 [CG] REGRESSION (Big Sur): A GIF image with a finite loopCount loops an extra cycle https://bugs.webkit.org/show_bug.cgi?id=216018 <rdar://problem/68304035> Patch by Said Abou-Hallawa <sabouhallawa@apple.com> on 2020-09-10 Reviewed by Tim Horton. Source/WebCore: Remove the extra 'one' we used to add to the GIF loopCount since it is now added by the underlying frameworks. But make sure we are compatible with the older versions of macOS and iOS. * platform/graphics/cg/ImageDecoderCG.cpp: (WebCore::ImageDecoderCG::repetitionCount const): Source/WTF: Add a new macro for the new accurate behavior of CGImageSource. Unrelated change: Fix the conditions for enabling the WebP images. * wtf/PlatformHave.h: LayoutTests: * platform/mac/TestExpectations: git-svn-id: https://svn.webkit.org/repository/webkit/trunk@266827 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-09-10 Said Abou-Hallawa <sabouhallawa@apple.com> [CG] REGRESSION (Big Sur): A GIF image with a finite loopCount loops an extra cycle https://bugs.webkit.org/show_bug.cgi?id=216018 <rdar://problem/68304035> Reviewed by Tim Horton. Remove the extra 'one' we used to add to the GIF loopCount since it is now added by the underlying frameworks. But make sure we are compatible with the older versions of macOS and iOS. * platform/graphics/cg/ImageDecoderCG.cpp: (WebCore::ImageDecoderCG::repetitionCount const): 2020-09-17 Alan Coon <alancoon@apple.com> Cherry-pick r266752. rdar://problem/69101201 Web process crashes at WebCore::HTMLMediaElement::prepareForVideoFullscreenStandby https://bugs.webkit.org/show_bug.cgi?id=216283 Reviewed by Alex Christensen. * html/HTMLMediaElement.cpp: (WebCore::HTMLMediaElement::prepareForVideoFullscreenStandby): git-svn-id: https://svn.webkit.org/repository/webkit/trunk@266752 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-09-08 Peng Liu <peng.liu6@apple.com> Web process crashes at WebCore::HTMLMediaElement::prepareForVideoFullscreenStandby https://bugs.webkit.org/show_bug.cgi?id=216283 Reviewed by Alex Christensen. * html/HTMLMediaElement.cpp: (WebCore::HTMLMediaElement::prepareForVideoFullscreenStandby): 2020-09-17 Alan Coon <alancoon@apple.com> Cherry-pick r266745. rdar://problem/69100985 Tighten checks when creating an audio buffer list https://bugs.webkit.org/show_bug.cgi?id=216237 <rdar://problem/68271376> Reviewed by Geoffrey Garen. Source/WebCore: Add a routine to check there is no multiplication integer overflow. * platform/audio/cocoa/WebAudioBufferList.cpp: (WebCore::computeBufferSize): (WebCore::WebAudioBufferList::isSupportedDescription): (WebCore::WebAudioBufferList::setSampleCount): * platform/audio/cocoa/WebAudioBufferList.h: Source/WebKit: Add message checks to verify that no message integer overflows happen when processing audio buffer list messages. * GPUProcess/GPUConnectionToWebProcess.cpp: (WebKit::GPUConnectionToWebProcess::audioTrackRendererManager): * GPUProcess/webrtc/RemoteAudioMediaStreamTrackRenderer.cpp: (WebKit::RemoteAudioMediaStreamTrackRenderer::RemoteAudioMediaStreamTrackRenderer): (WebKit::RemoteAudioMediaStreamTrackRenderer::audioSamplesStorageChanged): (WebKit::RemoteAudioMediaStreamTrackRenderer::audioSamplesAvailable): * GPUProcess/webrtc/RemoteAudioMediaStreamTrackRenderer.h: * GPUProcess/webrtc/RemoteAudioMediaStreamTrackRendererManager.cpp: (WebKit::RemoteAudioMediaStreamTrackRendererManager::RemoteAudioMediaStreamTrackRendererManager): (WebKit::RemoteAudioMediaStreamTrackRendererManager::createRenderer): * GPUProcess/webrtc/RemoteAudioMediaStreamTrackRendererManager.h: * GPUProcess/webrtc/RemoteMediaRecorder.cpp: (WebKit::RemoteMediaRecorder::audioSamplesStorageChanged): (WebKit::RemoteMediaRecorder::audioSamplesAvailable): * GPUProcess/webrtc/RemoteMediaRecorder.h: * WebProcess/cocoa/RemoteCaptureSampleManager.cpp: (WebKit::RemoteCaptureSampleManager::RemoteAudio::audioSamplesAvailable): git-svn-id: https://svn.webkit.org/repository/webkit/trunk@266745 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-09-08 Youenn Fablet <youenn@apple.com> Tighten checks when creating an audio buffer list https://bugs.webkit.org/show_bug.cgi?id=216237 <rdar://problem/68271376> Reviewed by Geoffrey Garen. Add a routine to check there is no multiplication integer overflow. * platform/audio/cocoa/WebAudioBufferList.cpp: (WebCore::computeBufferSize): (WebCore::WebAudioBufferList::isSupportedDescription): (WebCore::WebAudioBufferList::setSampleCount): * platform/audio/cocoa/WebAudioBufferList.h: 2020-09-17 Alan Coon <alancoon@apple.com> Cherry-pick r266375. rdar://problem/69101035 Avoid computing metadata for idempotent text autosizing on macOS https://bugs.webkit.org/show_bug.cgi?id=216011 Reviewed by Darin Adler. Avoids an unnecessary call to `adjustForTextAutosizing` during style resolution on macOS, where idempotent text autosizing is disabled. This function call populates the `AutosizeStatus` fields on `RenderStyle` that are used by the idempotent text autosizing heuristic. This function call appears consistently in traces taken while running the Multiply subtest of MotionMark, if only for a relatively small number of samples. While `AutosizeStatus::computeStatus` is designed to be very cheap, it ends up being called around 1.6 million times over the course of the subtest. * style/StyleAdjuster.cpp: (WebCore::Style::Adjuster::adjust const): git-svn-id: https://svn.webkit.org/repository/webkit/trunk@266375 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-08-31 Wenson Hsieh <wenson_hsieh@apple.com> Avoid computing metadata for idempotent text autosizing on macOS https://bugs.webkit.org/show_bug.cgi?id=216011 Reviewed by Darin Adler. Avoids an unnecessary call to `adjustForTextAutosizing` during style resolution on macOS, where idempotent text autosizing is disabled. This function call populates the `AutosizeStatus` fields on `RenderStyle` that are used by the idempotent text autosizing heuristic. This function call appears consistently in traces taken while running the Multiply subtest of MotionMark, if only for a relatively small number of samples. While `AutosizeStatus::computeStatus` is designed to be very cheap, it ends up being called around 1.6 million times over the course of the subtest. * style/StyleAdjuster.cpp: (WebCore::Style::Adjuster::adjust const): 2020-09-17 Alan Coon <alancoon@apple.com> Cherry-pick r266344. rdar://problem/69101085 Make StyleRareNonInheritedData::mask and StyleBackgroundData::background DataRefs https://bugs.webkit.org/show_bug.cgi?id=215942 Reviewed by Darin Adler. A significant amount of time in MotionMark's Multiply subtest is spent underneath the copy constructor `StyleRareNonInheritedData`, and a significant amount of time underneath this copy constructor is spent copying the rare non-inherited data's mask (a `FillLayer`). This `FillLayer` is currently inline data in `StyleRareNonInheritedData`; to reduce the cost of copying rare non-inherited data, we can instead make this a `DataRef<FillLayer>`, such that copying rare data will only copy the reference to the `FillLayer` rather than the `FillLayer` itself. Upon mutating the `FillLayer`, we now use `DataRef::access()` to ensure that these `FillLayer`s are copied before writing. See below for more details. * css/makeprop.pl: (generateFillLayerPropertyInheritValueSetter): (generateFillLayerPropertyValueSetter): * rendering/style/FillLayer.cpp: (WebCore::FillLayer::create): (WebCore::FillLayer::FillLayer): Deeply copy the `FillLayer`'s linked list of `FillLayer`s. This preserves existing behavior, which currently uses `std::unique_ptr` to store the pointer to the next `FillLayer` (and therefore, requires a deep copy of the linked list when copying `FillLayer`). In a future patch, we could probably further optimize this as well to behave in a copy-on-write way, by turning the `RefPtr<FillLayer> m_next;` into an `Optional<DataRef<FillLayer>>` instead (and then use `access()` to copy the next `FillLayer` prior to writing). (WebCore::FillLayer::~FillLayer): (WebCore::FillLayer::operator=): * rendering/style/FillLayer.h: Make `FillLayer` ref-counted, and introduce new `create` methods for constructing `FillLayer`s. Use these methods in several places where we currently call the constructors directly, via `makeUnique`. (WebCore::FillLayer::copy const): (WebCore::FillLayer::setNext): * rendering/style/RenderStyle.h: (WebCore::RenderStyle::hasBackgroundImage const): (WebCore::RenderStyle::hasFixedBackgroundImage const): (WebCore::RenderStyle::backgroundRepeatX const): (WebCore::RenderStyle::backgroundRepeatY const): (WebCore::RenderStyle::backgroundComposite const): (WebCore::RenderStyle::backgroundAttachment const): (WebCore::RenderStyle::backgroundClip const): (WebCore::RenderStyle::backgroundOrigin const): (WebCore::RenderStyle::backgroundXPosition const): (WebCore::RenderStyle::backgroundYPosition const): (WebCore::RenderStyle::backgroundSizeType const): (WebCore::RenderStyle::backgroundSizeLength const): (WebCore::RenderStyle::ensureBackgroundLayers): (WebCore::RenderStyle::maskImage const): (WebCore::RenderStyle::maskRepeatX const): (WebCore::RenderStyle::maskRepeatY const): (WebCore::RenderStyle::maskComposite const): (WebCore::RenderStyle::maskClip const): (WebCore::RenderStyle::maskOrigin const): (WebCore::RenderStyle::maskXPosition const): (WebCore::RenderStyle::maskYPosition const): (WebCore::RenderStyle::maskSizeType const): (WebCore::RenderStyle::maskSizeLength const): (WebCore::RenderStyle::ensureMaskLayers): (WebCore::RenderStyle::hasMask const): (WebCore::RenderStyle::setBackgroundXPosition): (WebCore::RenderStyle::setBackgroundYPosition): (WebCore::RenderStyle::setBackgroundSize): (WebCore::RenderStyle::setBackgroundSizeLength): (WebCore::RenderStyle::clearBackgroundLayers): (WebCore::RenderStyle::inheritBackgroundLayers): (WebCore::RenderStyle::clearMaskLayers): (WebCore::RenderStyle::inheritMaskLayers): (WebCore::RenderStyle::setMaskImage): (WebCore::RenderStyle::setMaskXPosition): (WebCore::RenderStyle::setMaskYPosition): (WebCore::RenderStyle::setMaskSize): * rendering/style/StyleBackgroundData.cpp: (WebCore::StyleBackgroundData::StyleBackgroundData): (WebCore::StyleBackgroundData::dump const): * rendering/style/StyleBackgroundData.h: Since `FillLayer` is now ref-counted, `StyleBackgroundData::background` needs to be a `DataRef` as well. * rendering/style/StyleRareNonInheritedData.cpp: (WebCore::StyleRareNonInheritedData::StyleRareNonInheritedData): * rendering/style/StyleRareNonInheritedData.h: git-svn-id: https://svn.webkit.org/repository/webkit/trunk@266344 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-08-30 Wenson Hsieh <wenson_hsieh@apple.com> Make StyleRareNonInheritedData::mask and StyleBackgroundData::background DataRefs https://bugs.webkit.org/show_bug.cgi?id=215942 Reviewed by Darin Adler. A significant amount of time in MotionMark's Multiply subtest is spent underneath the copy constructor `StyleRareNonInheritedData`, and a significant amount of time underneath this copy constructor is spent copying the rare non-inherited data's mask (a `FillLayer`). This `FillLayer` is currently inline data in `StyleRareNonInheritedData`; to reduce the cost of copying rare non-inherited data, we can instead make this a `DataRef<FillLayer>`, such that copying rare data will only copy the reference to the `FillLayer` rather than the `FillLayer` itself. Upon mutating the `FillLayer`, we now use `DataRef::access()` to ensure that these `FillLayer`s are copied before writing. See below for more details. * css/makeprop.pl: (generateFillLayerPropertyInheritValueSetter): (generateFillLayerPropertyValueSetter): * rendering/style/FillLayer.cpp: (WebCore::FillLayer::create): (WebCore::FillLayer::FillLayer): Deeply copy the `FillLayer`'s linked list of `FillLayer`s. This preserves existing behavior, which currently uses `std::unique_ptr` to store the pointer to the next `FillLayer` (and therefore, requires a deep copy of the linked list when copying `FillLayer`). In a future patch, we could probably further optimize this as well to behave in a copy-on-write way, by turning the `RefPtr<FillLayer> m_next;` into an `Optional<DataRef<FillLayer>>` instead (and then use `access()` to copy the next `FillLayer` prior to writing). (WebCore::FillLayer::~FillLayer): (WebCore::FillLayer::operator=): * rendering/style/FillLayer.h: Make `FillLayer` ref-counted, and introduce new `create` methods for constructing `FillLayer`s. Use these methods in several places where we currently call the constructors directly, via `makeUnique`. (WebCore::FillLayer::copy const): (WebCore::FillLayer::setNext): * rendering/style/RenderStyle.h: (WebCore::RenderStyle::hasBackgroundImage const): (WebCore::RenderStyle::hasFixedBackgroundImage const): (WebCore::RenderStyle::backgroundRepeatX const): (WebCore::RenderStyle::backgroundRepeatY const): (WebCore::RenderStyle::backgroundComposite const): (WebCore::RenderStyle::backgroundAttachment const): (WebCore::RenderStyle::backgroundClip const): (WebCore::RenderStyle::backgroundOrigin const): (WebCore::RenderStyle::backgroundXPosition const): (WebCore::RenderStyle::backgroundYPosition const): (WebCore::RenderStyle::backgroundSizeType const): (WebCore::RenderStyle::backgroundSizeLength const): (WebCore::RenderStyle::ensureBackgroundLayers): (WebCore::RenderStyle::maskImage const): (WebCore::RenderStyle::maskRepeatX const): (WebCore::RenderStyle::maskRepeatY const): (WebCore::RenderStyle::maskComposite const): (WebCore::RenderStyle::maskClip const): (WebCore::RenderStyle::maskOrigin const): (WebCore::RenderStyle::maskXPosition const): (WebCore::RenderStyle::maskYPosition const): (WebCore::RenderStyle::maskSizeType const): (WebCore::RenderStyle::maskSizeLength const): (WebCore::RenderStyle::ensureMaskLayers): (WebCore::RenderStyle::hasMask const): (WebCore::RenderStyle::setBackgroundXPosition): (WebCore::RenderStyle::setBackgroundYPosition): (WebCore::RenderStyle::setBackgroundSize): (WebCore::RenderStyle::setBackgroundSizeLength): (WebCore::RenderStyle::clearBackgroundLayers): (WebCore::RenderStyle::inheritBackgroundLayers): (WebCore::RenderStyle::clearMaskLayers): (WebCore::RenderStyle::inheritMaskLayers): (WebCore::RenderStyle::setMaskImage): (WebCore::RenderStyle::setMaskXPosition): (WebCore::RenderStyle::setMaskYPosition): (WebCore::RenderStyle::setMaskSize): * rendering/style/StyleBackgroundData.cpp: (WebCore::StyleBackgroundData::StyleBackgroundData): (WebCore::StyleBackgroundData::dump const): * rendering/style/StyleBackgroundData.h: Since `FillLayer` is now ref-counted, `StyleBackgroundData::background` needs to be a `DataRef` as well. * rendering/style/StyleRareNonInheritedData.cpp: (WebCore::StyleRareNonInheritedData::StyleRareNonInheritedData): * rendering/style/StyleRareNonInheritedData.h: 2020-09-17 Alan Coon <alancoon@apple.com> Cherry-pick r266290. rdar://problem/69101142 [iOS] Vertical text's logical width calculation is stale from the previous height of the WKWebView https://bugs.webkit.org/show_bug.cgi?id=215910 Reviewed by Simon Fraser. Source/WebCore: When there is vertical text (really: orthogonal flows) in the content, the available width of the vertical text is the height of its containing block. However, the height of the containing block (indeed: all ancestors) may be "auto", in which case the CSS spec says the available width of the element should be "the initial containing block's size."[1] Previously, we were using the FrameView's visibleHeight as this metric. However, the visibleHeight is calculated asynchronously, after layout, after a round-trip from the Web Process to the UI Process and back to the Web Process. Therefore, if content changes the WKWebView's size and the web view immediatey re-lays-out, this visibleHeight metric is stale from whatever the previous height of the WKWebView was. In addition, the visibleHeight metric isn't even supposed to be used inside layout; it's instead only supposed to be used for things like position: fixed elements. Instead, we should use FrameView::layoutSize(), which is set before layout to the size of the WKWebView. The name even indicates that it should be used for layout purposes. [1] https://drafts.csswg.org/css-writing-modes-4/#orthogonal-auto Test: WebKit.OrthogonalFlowAvailableSize * rendering/RenderBox.cpp: (WebCore::RenderBox::perpendicularContainingBlockLogicalHeight const): * rendering/RenderView.cpp: (WebCore::RenderView::availableLogicalHeight const): Tools: * TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj: * TestWebKitAPI/Tests/WebKit/OrthogonalFlowAvailableSize.mm: Added. (TEST): * TestWebKitAPI/Tests/WebKit/orthogonal-flow-available-size.html: Added. git-svn-id: https://svn.webkit.org/repository/webkit/trunk@266290 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-08-28 Myles C. Maxfield <mmaxfield@apple.com> [iOS] Vertical text's logical width calculation is stale from the previous height of the WKWebView https://bugs.webkit.org/show_bug.cgi?id=215910 Reviewed by Simon Fraser. When there is vertical text (really: orthogonal flows) in the content, the available width of the vertical text is the height of its containing block. However, the height of the containing block (indeed: all ancestors) may be "auto", in which case the CSS spec says the available width of the element should be "the initial containing block's size."[1] Previously, we were using the FrameView's visibleHeight as this metric. However, the visibleHeight is calculated asynchronously, after layout, after a round-trip from the Web Process to the UI Process and back to the Web Process. Therefore, if content changes the WKWebView's size and the web view immediatey re-lays-out, this visibleHeight metric is stale from whatever the previous height of the WKWebView was. In addition, the visibleHeight metric isn't even supposed to be used inside layout; it's instead only supposed to be used for things like position: fixed elements. Instead, we should use FrameView::layoutSize(), which is set before layout to the size of the WKWebView. The name even indicates that it should be used for layout purposes. [1] https://drafts.csswg.org/css-writing-modes-4/#orthogonal-auto Test: WebKit.OrthogonalFlowAvailableSize * rendering/RenderBox.cpp: (WebCore::RenderBox::perpendicularContainingBlockLogicalHeight const): * rendering/RenderView.cpp: (WebCore::RenderView::availableLogicalHeight const): 2020-09-17 Alan Coon <alancoon@apple.com> Cherry-pick r266244. rdar://problem/69101147 REGRESSION (r264790): IndexedDB may abort transactions of in-memory databases https://bugs.webkit.org/show_bug.cgi?id=215855 <rdar://problem/67418574> Reviewed by Youenn Fablet. Source/WebCore: We don't abort transactions on in-memory database before process suspension because they don't hold database file lock. Before r264790, only ephemeral session would use in-memory databases, so we only checked session. Now persistent session also uses in-memory databases for third-party storage, so we need to add another check. API test: IndexedDB.SuspendImminentlyForThirdPartyDatabases * Modules/indexeddb/server/IDBServer.cpp: (WebCore::IDBServer::IDBServer::stopDatabaseActivitiesOnMainThread): Tools: * TestWebKitAPI/Tests/WebKitCocoa/IndexedDBSuspendImminently.mm: (postResult): (catch): git-svn-id: https://svn.webkit.org/repository/webkit/trunk@266244 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-08-27 Sihui Liu <sihui_liu@apple.com> REGRESSION (r264790): IndexedDB may abort transactions of in-memory databases https://bugs.webkit.org/show_bug.cgi?id=215855 <rdar://problem/67418574> Reviewed by Youenn Fablet. We don't abort transactions on in-memory database before process suspension because they don't hold database file lock. Before r264790, only ephemeral session would use in-memory databases, so we only checked session. Now persistent session also uses in-memory databases for third-party storage, so we need to add another check. API test: IndexedDB.SuspendImminentlyForThirdPartyDatabases * Modules/indexeddb/server/IDBServer.cpp: (WebCore::IDBServer::IDBServer::stopDatabaseActivitiesOnMainThread): 2020-09-15 Russell Epstein <repstein@apple.com> Cherry-pick r266121. rdar://problem/68949237 [macOS] Update audio arbitration manager when audio transport changes https://bugs.webkit.org/show_bug.cgi?id=215781 <rdar://problem/65920613> Reviewed by Jer Noble. Source/WebCore: No new tests, updated AudioRoutingArbitration API test. * platform/audio/AudioSession.cpp: (WebCore::AudioSession::audioOutputDeviceChanged): Add empty method. (WebCore::setIsPlayingToBluetoothOverride): Ditto. * platform/audio/AudioSession.h: * platform/audio/cocoa/MediaSessionManagerCocoa.h: * platform/audio/cocoa/MediaSessionManagerCocoa.mm: (WebCore::MediaSessionManagerCocoa::audioOutputDeviceChanged): Call AudioSession::audioOutputDeviceChanged. * platform/audio/mac/AudioSessionMac.mm: (WebCore::defaultDeviceTransportIsBluetooth): New. (WebCore::AudioSession::audioOutputDeviceChanged): Clear m_private->playingToBluetooth if bluetooth transport has changed since the last arbitration update. (WebCore::AudioSession::setIsPlayingToBluetoothOverride): Allow override of bluetooth transport for testing. (WebCore::AudioSession::setCategory): Update routing arbitration if audio session category or bluetooth transport changes. * testing/Internals.cpp: (WebCore::Internals::setIsPlayingToBluetoothOverride): * testing/Internals.h: * testing/Internals.idl: Source/WebKit: * UIProcess/API/Cocoa/WKWebViewPrivateForTesting.h: * UIProcess/API/Cocoa/WKWebViewTesting.mm: (-[WKWebView _audioRoutingArbitrationUpdateTime]): * UIProcess/Media/AudioSessionRoutingArbitratorProxy.h: (WebKit::AudioSessionRoutingArbitratorProxy::arbitrationUpdateTime const): * UIProcess/Media/cocoa/AudioSessionRoutingArbitratorProxyCocoa.mm: (WebKit::AudioSessionRoutingArbitratorProxy::beginRoutingArbitrationWithCategory): Tools: * TestWebKitAPI/Tests/WebKitCocoa/AudioRoutingArbitration.mm: (AudioRoutingArbitration::statusShouldBecomeEqualTo): Add message string to help debugging when the test fails. * TestWebKitAPI/Tests/WebKitLegacy/ios/video-with-audio.html: git-svn-id: https://svn.webkit.org/repository/webkit/trunk@266121 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-08-25 Eric Carlson <eric.carlson@apple.com> [macOS] Update audio arbitration manager when audio transport changes https://bugs.webkit.org/show_bug.cgi?id=215781 <rdar://problem/65920613> Reviewed by Jer Noble. No new tests, updated AudioRoutingArbitration API test. * platform/audio/AudioSession.cpp: (WebCore::AudioSession::audioOutputDeviceChanged): Add empty method. (WebCore::setIsPlayingToBluetoothOverride): Ditto. * platform/audio/AudioSession.h: * platform/audio/cocoa/MediaSessionManagerCocoa.h: * platform/audio/cocoa/MediaSessionManagerCocoa.mm: (WebCore::MediaSessionManagerCocoa::audioOutputDeviceChanged): Call AudioSession::audioOutputDeviceChanged. * platform/audio/mac/AudioSessionMac.mm: (WebCore::defaultDeviceTransportIsBluetooth): New. (WebCore::AudioSession::audioOutputDeviceChanged): Clear m_private->playingToBluetooth if bluetooth transport has changed since the last arbitration update. (WebCore::AudioSession::setIsPlayingToBluetoothOverride): Allow override of bluetooth transport for testing. (WebCore::AudioSession::setCategory): Update routing arbitration if audio session category or bluetooth transport changes. * testing/Internals.cpp: (WebCore::Internals::setIsPlayingToBluetoothOverride): * testing/Internals.h: * testing/Internals.idl: 2020-09-14 Alan Coon <alancoon@apple.com> Cherry-pick r266901. rdar://problem/68881000 [Repaint] RenderLayerModelObject::styleWillChange may issue redundant repaint https://bugs.webkit.org/show_bug.cgi?id=216374 <rdar://problem/68657490> Reviewed by Simon Fraser. Source/WebCore: Move the repaintIncludingDescendants() calls to repaintBeforeStyleChange() to avoid redundant repaints on the same renderer. * rendering/RenderElement.cpp: (WebCore::RenderElement::repaintBeforeStyleChange): * rendering/RenderLayerModelObject.cpp: (WebCore::RenderLayerModelObject::styleWillChange): LayoutTests: * css3/blending/repaint/blend-mode-isolate-stacking-context-expected.txt: * platform/ios/css3/blending/repaint/blend-mode-isolate-stacking-context-expected.txt: git-svn-id: https://svn.webkit.org/repository/webkit/trunk@266901 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-09-10 Zalan Bujtas <zalan@apple.com> [Repaint] RenderLayerModelObject::styleWillChange may issue redundant repaint https://bugs.webkit.org/show_bug.cgi?id=216374 <rdar://problem/68657490> Reviewed by Simon Fraser. Move the repaintIncludingDescendants() calls to repaintBeforeStyleChange() to avoid redundant repaints on the same renderer. * rendering/RenderElement.cpp: (WebCore::RenderElement::repaintBeforeStyleChange): * rendering/RenderLayerModelObject.cpp: (WebCore::RenderLayerModelObject::styleWillChange): 2020-09-14 Alan Coon <alancoon@apple.com> Cherry-pick r266844. rdar://problem/68880990 [Cocoa] PERF: Don't instantiate AVPlayer-based audio decoders or renderers if an element is initially muted. https://bugs.webkit.org/show_bug.cgi?id=216299 Reviewed by Eric Carlson. Source/WebCore: When an AVPlayer is created, even if muted, it will still instantiate an audio decoder and renderer if the AVAsset in the current player item has an audio track. Ostensibly, this is so that an unmute operation is instantaneous, as it's merely applying a zero gain to the decoded audio. However for web content, there's many autoplaying, muted <video> elements which may never be un-muted before being destroyed. Implement a policy where, if an AVPlayer is initially muted, we adopt AVFoundation SPI to forcibly prevent audio decoding and rendering until the first time the AVPlayer is unmuted. This means the first un-mute may not be instantaneous, as an audio decoder will have to be created and fed before any audio is rendered. There's some incorrect caching of mute state at the MediaPlayer level; so MediaPlayer and MPPAVFoundationObjC can get their respective m_muted states out of sync. Make sure that HTMLMediaElement always sets muted state after creating a MediaPlayer and that, respectively, MPPAVFoundationObjC always queries it's parent MediaPlayer's mute state when it in turn is created. * html/HTMLMediaElement.cpp: (WebCore::HTMLMediaElement::createMediaPlayer): * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm: (WebCore::MediaPlayerPrivateAVFoundationObjC::MediaPlayerPrivateAVFoundationObjC): (WebCore::MediaPlayerPrivateAVFoundationObjC::createAVPlayer): (WebCore::MediaPlayerPrivateAVFoundationObjC::setMuted): Source/WebCore/PAL: * pal/spi/cocoa/AVFoundationSPI.h: Source/WTF: * wtf/PlatformHave.h: git-svn-id: https://svn.webkit.org/repository/webkit/trunk@266844 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-09-10 Jer Noble <jer.noble@apple.com> [Cocoa] PERF: Don't instantiate AVPlayer-based audio decoders or renderers if an element is initially muted. https://bugs.webkit.org/show_bug.cgi?id=216299 Reviewed by Eric Carlson. When an AVPlayer is created, even if muted, it will still instantiate an audio decoder and renderer if the AVAsset in the current player item has an audio track. Ostensibly, this is so that an unmute operation is instantaneous, as it's merely applying a zero gain to the decoded audio. However for web content, there's many autoplaying, muted <video> elements which may never be un-muted before being destroyed. Implement a policy where, if an AVPlayer is initially muted, we adopt AVFoundation SPI to forcibly prevent audio decoding and rendering until the first time the AVPlayer is unmuted. This means the first un-mute may not be instantaneous, as an audio decoder will have to be created and fed before any audio is rendered. There's some incorrect caching of mute state at the MediaPlayer level; so MediaPlayer and MPPAVFoundationObjC can get their respective m_muted states out of sync. Make sure that HTMLMediaElement always sets muted state after creating a MediaPlayer and that, respectively, MPPAVFoundationObjC always queries it's parent MediaPlayer's mute state when it in turn is created. * html/HTMLMediaElement.cpp: (WebCore::HTMLMediaElement::createMediaPlayer): * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm: (WebCore::MediaPlayerPrivateAVFoundationObjC::MediaPlayerPrivateAVFoundationObjC): (WebCore::MediaPlayerPrivateAVFoundationObjC::createAVPlayer): (WebCore::MediaPlayerPrivateAVFoundationObjC::setMuted): 2020-09-14 Alan Coon <alancoon@apple.com> Cherry-pick r266818. rdar://problem/68881035 [Repaint] RenderElement::setStyle may issue redundant repaint https://bugs.webkit.org/show_bug.cgi?id=216324 <rdar://problem/68595896> Reviewed by Simon Fraser. Source/WebCore: If we issue a repaint in ::styleWillChange, we should not need to re-issue it again in RenderElement::setStyle (see r266803 for details). * rendering/RenderElement.cpp: (WebCore::RenderElement::repaintBeforeStyleChange): (WebCore::RenderElement::setStyle): * rendering/RenderElement.h: LayoutTests: * compositing/masks/compositing-clip-path-change-no-repaint-expected.txt: * compositing/shared-backing/overflow-scroll/shared-layer-repaint-expected.txt: * fast/css-custom-paint/delay-repaint-expected.txt: * fast/images/async-image-multiple-clients-repaint-expected.txt: * fast/repaint/horizontal-bt-overflow-child-expected.txt: * fast/repaint/horizontal-bt-overflow-parent-expected.txt: * fast/repaint/horizontal-bt-overflow-same-expected.txt: * fast/repaint/mutate-non-visible-expected.txt: * fast/repaint/negative-text-indent-with-overflow-hidden-expected.txt: * fast/repaint/overflow-flipped-writing-mode-table-expected.txt: * fast/repaint/spanner-with-margin-expected.txt: * fast/repaint/table-row-repaint-expected.txt: * fast/repaint/vertical-overflow-child-expected.txt: * fast/repaint/vertical-overflow-parent-expected.txt: * fast/repaint/vertical-overflow-same-expected.txt: * svg/transforms/svg-transform-foreign-object-repaint-expected.txt: git-svn-id: https://svn.webkit.org/repository/webkit/trunk@266818 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-09-10 Zalan Bujtas <zalan@apple.com> [Repaint] RenderElement::setStyle may issue redundant repaint https://bugs.webkit.org/show_bug.cgi?id=216324 <rdar://problem/68595896> Reviewed by Simon Fraser. If we issue a repaint in ::styleWillChange, we should not need to re-issue it again in RenderElement::setStyle (see r266803 for details). * rendering/RenderElement.cpp: (WebCore::RenderElement::repaintBeforeStyleChange): (WebCore::RenderElement::setStyle): * rendering/RenderElement.h: 2020-09-14 Alan Coon <alancoon@apple.com> Cherry-pick r266803. rdar://problem/68881014 [Repaint] styleWillChange may call repaint on the same renderer multiple times. https://bugs.webkit.org/show_bug.cgi?id=216295 <rdar://problem/68538666> Reviewed by Simon Fraser. Source/WebCore: RenderElement::styleWillChange is a virtual function. This function is called whenever the associated RenderStyle changes. The subclass implementation (e.g. RenderBox::styleWillChange) calls the parent class to make sure the style change is covered properly. Now in certain cases, 1. this may trigger multiple calls to repaint() (e.g one in each ::styleWillChange implementation) 2. paint invalidation requires absolute coordinates 3. geometry does not change during styleWillChange it could end up being redundant/unnecessarily expensive. This patch moves all the style-will-change-requires-repaint logic to one single function so that we can limit the number of repaints. * rendering/RenderBox.cpp: (WebCore::RenderBox::styleWillChange): * rendering/RenderElement.cpp: (WebCore::RenderElement::issueRepaintBeforeStyleChange): (WebCore::RenderElement::initializeStyle): (WebCore::RenderElement::setStyle): (WebCore::RenderElement::styleWillChange): * rendering/RenderElement.h: * rendering/RenderLayerModelObject.cpp: (WebCore::RenderLayerModelObject::styleWillChange): LayoutTests: * compositing/masks/compositing-clip-path-change-no-repaint-expected.txt: * compositing/shared-backing/overflow-scroll/shared-layer-repaint-expected.txt: * fast/css-custom-paint/delay-repaint-expected.txt: * fast/images/async-image-multiple-clients-repaint-expected.txt: * fast/repaint/focus-ring-repaint-expected.txt: * fast/repaint/horizontal-bt-overflow-child-expected.txt: * fast/repaint/horizontal-bt-overflow-parent-expected.txt: * fast/repaint/horizontal-bt-overflow-same-expected.txt: * fast/repaint/mutate-non-visible-expected.txt: * fast/repaint/negative-text-indent-with-overflow-hidden-expected.txt: * fast/repaint/overflow-flipped-writing-mode-table-expected.txt: * fast/repaint/table-row-repaint-expected.txt: * fast/repaint/vertical-overflow-child-expected.txt: * fast/repaint/vertical-overflow-parent-expected.txt: * fast/repaint/vertical-overflow-same-expected.txt: * svg/transforms/svg-transform-foreign-object-repaint-expected.txt: git-svn-id: https://svn.webkit.org/repository/webkit/trunk@266803 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-09-09 Zalan Bujtas <zalan@apple.com> [Repaint] styleWillChange may call repaint on the same renderer multiple times. https://bugs.webkit.org/show_bug.cgi?id=216295 <rdar://problem/68538666> Reviewed by Simon Fraser. RenderElement::styleWillChange is a virtual function. This function is called whenever the associated RenderStyle changes. The subclass implementation (e.g. RenderBox::styleWillChange) calls the parent class to make sure the style change is covered properly. Now in certain cases, 1. this may trigger multiple calls to repaint() (e.g one in each ::styleWillChange implementation) 2. paint invalidation requires absolute coordinates 3. geometry does not change during styleWillChange it could end up being redundant/unnecessarily expensive. This patch moves all the style-will-change-requires-repaint logic to one single function so that we can limit the number of repaints. * rendering/RenderBox.cpp: (WebCore::RenderBox::styleWillChange): * rendering/RenderElement.cpp: (WebCore::RenderElement::issueRepaintBeforeStyleChange): (WebCore::RenderElement::initializeStyle): (WebCore::RenderElement::setStyle): (WebCore::RenderElement::styleWillChange): * rendering/RenderElement.h: * rendering/RenderLayerModelObject.cpp: (WebCore::RenderLayerModelObject::styleWillChange): 2020-09-14 Alan Coon <alancoon@apple.com> Cherry-pick r266797. rdar://problem/68881018 Move lazy DisplayLink tear down logic from the WebProcess to the UIProcess https://bugs.webkit.org/show_bug.cgi?id=216195 Reviewed by Simon Fraser. Move lazy DisplayLink tear down logic from the WebProcess to the UIProcess, now that the DisplayLink has been moved to the UIProcess due to sandboxing. After a DisplayLink no longer has any clients, we keep it firing up to 20 times without any clients in case a new client gets added shortly after. The idea was to avoid killing and respawning too many threads when adding and removing clients in quick succession. However, now that the DisplayLink lives in the UIProcess side and sends IPC to the WebProcesses every time it fires, it makes a lot more sense to implement this logic in the UIProcess side, to avoid sending unnecessary IPC to processes that do not care about it. Source/WebCore: * platform/graphics/DisplayRefreshMonitor.cpp: (WebCore::DisplayRefreshMonitor::displayDidRefresh): * platform/graphics/DisplayRefreshMonitor.h: (WebCore::DisplayRefreshMonitor::shouldBeTerminated const): Source/WebKit: * UIProcess/mac/DisplayLink.cpp: (WebKit::DisplayLink::addObserver): (WebKit::DisplayLink::removeObserver): (WebKit::DisplayLink::removeObservers): (WebKit::DisplayLink::displayLinkCallback): (WebKit::DisplayLink::hasObservers const): Deleted. * UIProcess/mac/DisplayLink.h: git-svn-id: https://svn.webkit.org/repository/webkit/trunk@266797 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-09-09 Chris Dumez <cdumez@apple.com> Move lazy DisplayLink tear down logic from the WebProcess to the UIProcess https://bugs.webkit.org/show_bug.cgi?id=216195 Reviewed by Simon Fraser. Move lazy DisplayLink tear down logic from the WebProcess to the UIProcess, now that the DisplayLink has been moved to the UIProcess due to sandboxing. After a DisplayLink no longer has any clients, we keep it firing up to 20 times without any clients in case a new client gets added shortly after. The idea was to avoid killing and respawning too many threads when adding and removing clients in quick succession. However, now that the DisplayLink lives in the UIProcess side and sends IPC to the WebProcesses every time it fires, it makes a lot more sense to implement this logic in the UIProcess side, to avoid sending unnecessary IPC to processes that do not care about it. * platform/graphics/DisplayRefreshMonitor.cpp: (WebCore::DisplayRefreshMonitor::displayDidRefresh): * platform/graphics/DisplayRefreshMonitor.h: (WebCore::DisplayRefreshMonitor::shouldBeTerminated const): 2020-09-11 Russell Epstein <repstein@apple.com> Cherry-pick r266743. rdar://problem/68652752 iOS: <attachment>'s QuickLook thumbnails can appear squished https://bugs.webkit.org/show_bug.cgi?id=216209 <rdar://problem/67817706> Reviewed by Wenson Hsieh. Source/WebCore: Test: fast/attachment/attachment-thumbnail-preserves-aspect-ratio.html * html/HTMLAttachmentElement.idl: * testing/Internals.cpp: (WebCore::Internals::attachmentThumbnailInfo): * testing/Internals.h: * testing/Internals.idl: Expose the attachment thumbnail size via Internals. * rendering/RenderThemeIOS.mm: (WebCore::RenderAttachmentInfo::RenderAttachmentInfo): Allow the thumbnail aspect ratio to vary, instead of assuming it is always square. Source/WebKit: * UIProcess/Cocoa/WebPageProxyCocoa.mm: (WebKit::convertPlatformImageToBitmap): Propagate an image of the same aspect ratio that QuickLook provided, instead of squishing it to square. * UIProcess/QuickLookThumbnailLoader.mm: (-[WKQLThumbnailLoadOperation start]): Only request full thumbnails; we do not want the icon form, since <attachment> already has one without QuickLook's help; if we can't get a full thumbnail, we'll just leave it alone. Tools: * TestRunnerShared/UIScriptContext/Bindings/UIScriptController.idl: * TestRunnerShared/UIScriptContext/UIScriptController.h: (WTR::UIScriptController::insertAttachmentForFilePath): * WebKitTestRunner/TestController.cpp: (WTR::TestController::currentTestURL const): * WebKitTestRunner/TestController.h: * WebKitTestRunner/cocoa/UIScriptControllerCocoa.h: * WebKitTestRunner/cocoa/UIScriptControllerCocoa.mm: (WTR::UIScriptControllerCocoa::insertAttachmentForFilePath): Make it possible to insert an attachment wrapping a file on disk via UIScriptController. LayoutTests: * fast/attachment/attachment-thumbnail-preserves-aspect-ratio-expected.txt: Added. * fast/attachment/attachment-thumbnail-preserves-aspect-ratio.html: Added. * fast/attachment/resources/400x200-circle.png: Added. * platform/ios/fast/attachment/attachment-thumbnail-preserves-aspect-ratio-expected.txt: Added. * resources/ui-helper.js: (window.UIHelper.insertAttachmentForFilePath): Add a test that dumps the thumbnail size for a 400x200 attachment. We only run it on iOS, because on macOS, QuickLook always returns an image of the size we ask for (400x400), padded with whitespace, so the problem does not reproduce and the test doesn't work right there. On iOS, the result used to be 400x400 and now is 400x200. I tried and failed to make a more useful test (a ref test, actually testing the presentation) because it's quite hard to match the native <attachment> painting. git-svn-id: https://svn.webkit.org/repository/webkit/trunk@266743 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-09-08 Tim Horton <timothy_horton@apple.com> iOS: <attachment>'s QuickLook thumbnails can appear squished https://bugs.webkit.org/show_bug.cgi?id=216209 <rdar://problem/67817706> Reviewed by Wenson Hsieh. Test: fast/attachment/attachment-thumbnail-preserves-aspect-ratio.html * html/HTMLAttachmentElement.idl: * testing/Internals.cpp: (WebCore::Internals::attachmentThumbnailInfo): * testing/Internals.h: * testing/Internals.idl: Expose the attachment thumbnail size via Internals. * rendering/RenderThemeIOS.mm: (WebCore::RenderAttachmentInfo::RenderAttachmentInfo): Allow the thumbnail aspect ratio to vary, instead of assuming it is always square. 2020-09-10 Alan Coon <alancoon@apple.com> Cherry-pick r266717. rdar://problem/68652576 Comparing styles with large but identical custom property maps is slow https://bugs.webkit.org/show_bug.cgi?id=216241 <rdar://problem/67946605> Reviewed by Darin Adler. In a full style rebuild we lose sharing of equal StyleCustomPropertyDatas between the old and the new style. Custom properties are usually defined in document element and this lack of sharing inherits to all elements. Without sharing equality comparisons end up requiring deep comparisons, which can be slow if there are thousands of properties. Fix by deduplicating identical property maps between the old the new style. All the descendants that inherit the properties will now be cheap to compare. The patch also contains some other basic custom property optimizations. Going to full screen and back on youtube, this patch reduces time in the longest style update from ~460ms to ~90ms. * css/CSSCustomPropertyValue.cpp: (WebCore::CSSCustomPropertyValue::equals const): Check for pointer equality first. * rendering/style/RenderStyle.cpp: (WebCore::RenderStyle::deduplicateInheritedCustomProperties): Deduplicate if the properties are equal but not shared. (WebCore::RenderStyle::setInheritedCustomPropertyValue): (WebCore::RenderStyle::setNonInheritedCustomPropertyValue): Check if the value is already in the map before triggering copy-on-write. * rendering/style/RenderStyle.h: (WebCore::RenderStyle::setInheritedCustomPropertyValue): Deleted. (WebCore::RenderStyle::setNonInheritedCustomPropertyValue): Deleted. * style/StyleBuilder.cpp: (WebCore::Style::Builder::applyCustomProperty): Don't create unnecesary copies of CSSCustomPropertyValue. * style/StyleTreeResolver.cpp: (WebCore::Style::TreeResolver::createAnimatedElementUpdate): Try to deduplicate before comparing the styles. git-svn-id: https://svn.webkit.org/repository/webkit/trunk@266717 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-09-08 Antti Koivisto <antti@apple.com> Comparing styles with large but identical custom property maps is slow https://bugs.webkit.org/show_bug.cgi?id=216241 <rdar://problem/67946605> Reviewed by Darin Adler. In a full style rebuild we lose sharing of equal StyleCustomPropertyDatas between the old and the new style. Custom properties are usually defined in document element and this lack of sharing inherits to all elements. Without sharing equality comparisons end up requiring deep comparisons, which can be slow if there are thousands of properties. Fix by deduplicating identical property maps between the old the new style. All the descendants that inherit the properties will now be cheap to compare. The patch also contains some other basic custom property optimizations. Going to full screen and back on youtube, this patch reduces time in the longest style update from ~460ms to ~90ms. * css/CSSCustomPropertyValue.cpp: (WebCore::CSSCustomPropertyValue::equals const): Check for pointer equality first. * rendering/style/RenderStyle.cpp: (WebCore::RenderStyle::deduplicateInheritedCustomProperties): Deduplicate if the properties are equal but not shared. (WebCore::RenderStyle::setInheritedCustomPropertyValue): (WebCore::RenderStyle::setNonInheritedCustomPropertyValue): Check if the value is already in the map before triggering copy-on-write. * rendering/style/RenderStyle.h: (WebCore::RenderStyle::setInheritedCustomPropertyValue): Deleted. (WebCore::RenderStyle::setNonInheritedCustomPropertyValue): Deleted. * style/StyleBuilder.cpp: (WebCore::Style::Builder::applyCustomProperty): Don't create unnecesary copies of CSSCustomPropertyValue. * style/StyleTreeResolver.cpp: (WebCore::Style::TreeResolver::createAnimatedElementUpdate): Try to deduplicate before comparing the styles. 2020-09-10 Alan Coon <alancoon@apple.com> Cherry-pick r266705. rdar://problem/68652668 Add memory cache with/without validation to logResourceResponseSource https://bugs.webkit.org/show_bug.cgi?id=216244 <rdar://problem/64184239> Patch by Alex Christensen <achristensen@webkit.org> on 2020-09-07 Reviewed by Darin Adler. * loader/ResourceLoader.cpp: (WebCore::logResourceResponseSource): * page/DiagnosticLoggingKeys.cpp: (WebCore::DiagnosticLoggingKeys::memoryCacheKey): (WebCore::DiagnosticLoggingKeys::memoryCacheAfterValidationKey): * page/DiagnosticLoggingKeys.h: git-svn-id: https://svn.webkit.org/repository/webkit/trunk@266705 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-09-07 Alex Christensen <achristensen@webkit.org> Add memory cache with/without validation to logResourceResponseSource https://bugs.webkit.org/show_bug.cgi?id=216244 <rdar://problem/64184239> Reviewed by Darin Adler. * loader/ResourceLoader.cpp: (WebCore::logResourceResponseSource): * page/DiagnosticLoggingKeys.cpp: (WebCore::DiagnosticLoggingKeys::memoryCacheKey): (WebCore::DiagnosticLoggingKeys::memoryCacheAfterValidationKey): * page/DiagnosticLoggingKeys.h: 2020-09-10 Alan Coon <alancoon@apple.com> Cherry-pick r266664. rdar://problem/68652524 REGRESSION (r260571): Scrolling on weather.com in Safari causes the gradient background to flicker (fixed backgrounds) https://bugs.webkit.org/show_bug.cgi?id=216192 <rdar://problem/68192010> Reviewed by Tim Horton. If a page has slow-scrolling reasons, like background-attachment:fixed on a non-root element, then we should never update layer positions on the scrolling thread, since this results in scroll position being out of sync with the painted background position. * page/scrolling/ThreadedScrollingTree.cpp: (WebCore::ThreadedScrollingTree::canUpdateLayersOnScrollingThread const): (WebCore::ThreadedScrollingTree::waitForRenderingUpdateCompletionOrTimeout): (WebCore::ThreadedScrollingTree::delayedRenderingUpdateDetectionTimerFired): (WebCore::ThreadedScrollingTree::displayDidRefreshOnScrollingThread): * page/scrolling/ThreadedScrollingTree.h: git-svn-id: https://svn.webkit.org/repository/webkit/trunk@266664 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-09-04 Simon Fraser <simon.fraser@apple.com> REGRESSION (r260571): Scrolling on weather.com in Safari causes the gradient background to flicker (fixed backgrounds) https://bugs.webkit.org/show_bug.cgi?id=216192 <rdar://problem/68192010> Reviewed by Tim Horton. If a page has slow-scrolling reasons, like background-attachment:fixed on a non-root element, then we should never update layer positions on the scrolling thread, since this results in scroll position being out of sync with the painted background position. * page/scrolling/ThreadedScrollingTree.cpp: (WebCore::ThreadedScrollingTree::canUpdateLayersOnScrollingThread const): (WebCore::ThreadedScrollingTree::waitForRenderingUpdateCompletionOrTimeout): (WebCore::ThreadedScrollingTree::delayedRenderingUpdateDetectionTimerFired): (WebCore::ThreadedScrollingTree::displayDidRefreshOnScrollingThread): * page/scrolling/ThreadedScrollingTree.h: 2020-09-10 Alan Coon <alancoon@apple.com> Cherry-pick r266635. rdar://problem/68652685 [Cocoa,EME] -outputObscuredDueToInsufficientExternalProtection KVO will set OutputObscured for all attached MediaKeySessions. https://bugs.webkit.org/show_bug.cgi?id=216185 Reviewed by Eric Carlson. When EME clients add licenses that have, for instance, different HDCP level requirements, the keyStatus for each key in the Session (and indeed all attached MediaKeySessions) will be marked as OutputRestricted, since it is impossible to tell from that KVO which key or session was responsible for creating the violation. On platforms where the more granular -willOutputBeObscuredDueToInsufficientExternalProtectionForDisplays: query is available, ignore the KVO from AVSampleBufferDisplayLayer, and rely entirely on the per-request query to determine key status. Drive-by fix: add logging when we receive the -outputObscuredDueToInsufficientExternalProtection KVO notification, and include keyIDs in the keyStatus logging. * platform/graphics/avfoundation/objc/CDMInstanceFairPlayStreamingAVFObjC.mm: (WTF::LogArgument<WebCore::CDMInstanceFairPlayStreamingAVFObjC::Keys>::toString): (WebCore::CDMInstanceSessionFairPlayStreamingAVFObjC::keyStatuses const): (WebCore::CDMInstanceSessionFairPlayStreamingAVFObjC::outputObscuredDueToInsufficientExternalProtectionChanged): (WebCore::CDMInstanceSessionFairPlayStreamingAVFObjC::keyRequestHasInsufficientProtectionForDisplayID const): git-svn-id: https://svn.webkit.org/repository/webkit/trunk@266635 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-09-04 Jer Noble <jer.noble@apple.com> [Cocoa,EME] -outputObscuredDueToInsufficientExternalProtection KVO will set OutputObscured for all attached MediaKeySessions. https://bugs.webkit.org/show_bug.cgi?id=216185 Reviewed by Eric Carlson. When EME clients add licenses that have, for instance, different HDCP level requirements, the keyStatus for each key in the Session (and indeed all attached MediaKeySessions) will be marked as OutputRestricted, since it is impossible to tell from that KVO which key or session was responsible for creating the violation. On platforms where the more granular -willOutputBeObscuredDueToInsufficientExternalProtectionForDisplays: query is available, ignore the KVO from AVSampleBufferDisplayLayer, and rely entirely on the per-request query to determine key status. Drive-by fix: add logging when we receive the -outputObscuredDueToInsufficientExternalProtection KVO notification, and include keyIDs in the keyStatus logging. * platform/graphics/avfoundation/objc/CDMInstanceFairPlayStreamingAVFObjC.mm: (WTF::LogArgument<WebCore::CDMInstanceFairPlayStreamingAVFObjC::Keys>::toString): (WebCore::CDMInstanceSessionFairPlayStreamingAVFObjC::keyStatuses const): (WebCore::CDMInstanceSessionFairPlayStreamingAVFObjC::outputObscuredDueToInsufficientExternalProtectionChanged): (WebCore::CDMInstanceSessionFairPlayStreamingAVFObjC::keyRequestHasInsufficientProtectionForDisplayID const): 2020-09-10 Alan Coon <alancoon@apple.com> Cherry-pick r266526. rdar://problem/68652615 Consecutive requestAnimationFrame callbacks may be passed the same timestamp https://bugs.webkit.org/show_bug.cgi?id=216122 <rdar://problem/68269445> Reviewed by Simon Fraser. Source/WebCore: Test: fast/animation/request-animation-frame-unique-timestamp.html Ensure that the page only sees increasing timestamps in requestAnimationFrame() callbacks. * dom/ScriptedAnimationController.cpp: (WebCore::ScriptedAnimationController::shouldRescheduleRequestAnimationFrame const): LayoutTests: Add a test that two subsequent animation frames as identified via requestAnimationFrame() callbacks are provided increasing timestamps. Also removing flaky expectation for two WPT animations tests which pass reliably after this fix. * fast/animation/request-animation-frame-unique-timestamp-expected.txt: Added. * fast/animation/request-animation-frame-unique-timestamp.html: Added. * platform/mac-wk2/TestExpectations: git-svn-id: https://svn.webkit.org/repository/webkit/trunk@266526 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-09-03 Antoine Quint <graouts@webkit.org> Consecutive requestAnimationFrame callbacks may be passed the same timestamp https://bugs.webkit.org/show_bug.cgi?id=216122 <rdar://problem/68269445> Reviewed by Simon Fraser. Test: fast/animation/request-animation-frame-unique-timestamp.html Ensure that the page only sees increasing timestamps in requestAnimationFrame() callbacks. * dom/ScriptedAnimationController.cpp: (WebCore::ScriptedAnimationController::shouldRescheduleRequestAnimationFrame const): 2020-09-10 Alan Coon <alancoon@apple.com> Cherry-pick r266485. rdar://problem/68652729 iPad + Trackpad: JW Library highlighting and edit menus don't appear https://bugs.webkit.org/show_bug.cgi?id=216086 Reviewed by Wenson Hsieh. Source/WebCore: * platform/RuntimeApplicationChecks.h: * platform/cocoa/RuntimeApplicationChecksCocoa.mm: (WebCore::IOSApplication::isJWLibrary): Source/WebKit: * UIProcess/ios/WKContentViewInteraction.mm: (applicationIsKnownToIgnoreMouseEvents): Add JW Library to the list. git-svn-id: https://svn.webkit.org/repository/webkit/trunk@266485 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-09-02 Timothy Horton <timothy_horton@apple.com> iPad + Trackpad: JW Library highlighting and edit menus don't appear https://bugs.webkit.org/show_bug.cgi?id=216086 Reviewed by Wenson Hsieh. * platform/RuntimeApplicationChecks.h: * platform/cocoa/RuntimeApplicationChecksCocoa.mm: (WebCore::IOSApplication::isJWLibrary): 2020-09-10 Alan Coon <alancoon@apple.com> Cherry-pick r266470. rdar://problem/68652453 REGRESSION (r264661): Crashes in WebCore::wrap<WebCore::Blob> in CloneDeserializer https://bugs.webkit.org/show_bug.cgi?id=215835 Reviewed by Youenn Fablet. Partially revert r264661 as there are cases, other than our previous IDB, where we may not use JSDOMGlobalObject for serialization and deserialization, like the one showed in the crashlog. Therefore, we still need the check for JSDOMGlobalObject. API Test: WebKit.EvaluateJavaScriptThatCreatesBlob * bindings/js/SerializedScriptValue.cpp: (WebCore::CloneDeserializer::CloneDeserializer): (WebCore::CloneDeserializer::readFile): (WebCore::CloneDeserializer::readRTCCertificate): (WebCore::CloneDeserializer::readTerminal): git-svn-id: https://svn.webkit.org/repository/webkit/trunk@266470 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-09-02 Sihui Liu <sihui_liu@apple.com> REGRESSION (r264661): Crashes in WebCore::wrap<WebCore::Blob> in CloneDeserializer https://bugs.webkit.org/show_bug.cgi?id=215835 Reviewed by Youenn Fablet. Partially revert r264661 as there are cases, other than our previous IDB, where we may not use JSDOMGlobalObject for serialization and deserialization, like the one showed in the crashlog. Therefore, we still need the check for JSDOMGlobalObject. API Test: WebKit.EvaluateJavaScriptThatCreatesBlob * bindings/js/SerializedScriptValue.cpp: (WebCore::CloneDeserializer::CloneDeserializer): (WebCore::CloneDeserializer::readFile): (WebCore::CloneDeserializer::readRTCCertificate): (WebCore::CloneDeserializer::readTerminal): 2020-09-10 Alan Coon <alancoon@apple.com> Cherry-pick r266454. rdar://problem/68652810 Safari is not able to hear audio when using WebRTC in multiple tabs https://bugs.webkit.org/show_bug.cgi?id=215270 <rdar://problem/66736746> Reviewed by Eric Carlson. Covered by manually testing that audio continues when two pages in the same process create a peer connection, one plays audio with WebRTC and the second one is closed. Before the patch, the closing page would stop the audio device module, even though the first page would like the module to continue playing. Fix this by creating an audio module per page instead of process wide. * platform/mediastream/libwebrtc/LibWebRTCAudioModule.h: * platform/mediastream/libwebrtc/LibWebRTCProvider.cpp: (WebCore::initializePeerConnectionFactoryAndThreads): (WebCore::LibWebRTCProvider::factory): (WebCore::LibWebRTCProvider::createPeerConnectionFactory): * platform/mediastream/libwebrtc/LibWebRTCProvider.h: git-svn-id: https://svn.webkit.org/repository/webkit/trunk@266454 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-09-02 Youenn Fablet <youenn@apple.com> Safari is not able to hear audio when using WebRTC in multiple tabs https://bugs.webkit.org/show_bug.cgi?id=215270 <rdar://problem/66736746> Reviewed by Eric Carlson. Covered by manually testing that audio continues when two pages in the same process create a peer connection, one plays audio with WebRTC and the second one is closed. Before the patch, the closing page would stop the audio device module, even though the first page would like the module to continue playing. Fix this by creating an audio module per page instead of process wide. * platform/mediastream/libwebrtc/LibWebRTCAudioModule.h: * platform/mediastream/libwebrtc/LibWebRTCProvider.cpp: (WebCore::initializePeerConnectionFactoryAndThreads): (WebCore::LibWebRTCProvider::factory): (WebCore::LibWebRTCProvider::createPeerConnectionFactory): * platform/mediastream/libwebrtc/LibWebRTCProvider.h: 2020-09-10 Alan Coon <alancoon@apple.com> Cherry-pick r266443. rdar://problem/68652756 REGRESSION(r262366): MotionMark1.1 | macOS | Some devices | 1-3% overall regression https://bugs.webkit.org/show_bug.cgi?id=215989 <rdar://problem/66845937> Reviewed by Darin Adler. Source/WebCore: The new approach to compositing WebGL caused a slowdown in some canvas performance tests. They were notifying the Document of all drawing commands, even on 2d canvases that didn't need to prepare before compositing. The solution is to only add the Document as an observer when necessary. This recovers the performance hit - measured using the Canvas Lines MotionMark test. Tests: fast/canvas/webgl/move-canvas-in-document-while-clean.html fast/canvas/webgl/move-canvas-in-document.html * dom/Document.cpp: (WebCore::Document::prepareCanvasesForDisplayIfNeeded): Leave a FIXME indicating that we should try to avoid the copyToVector if we can ensure that the prepareForDisplay call will not mutate the HashSet. * html/CanvasBase.cpp: Remove some copyToVector calls. It should be fine to iterate over the HashSet for these notification functions. (WebCore::CanvasBase::notifyObserversCanvasChanged): (WebCore::CanvasBase::notifyObserversCanvasResized): * html/HTMLCanvasElement.cpp: (WebCore::HTMLCanvasElement::HTMLCanvasElement): Don't add the Document as a canvas observer. Wait until we know it is a context that needs observing. (WebCore::HTMLCanvasElement::createContextWebGL): Now we can add it as an observer. (WebCore::HTMLCanvasElement::didMoveToNewDocument): Swap observation to the new Document. (WebCore::HTMLCanvasElement::insertedIntoAncestor): Ditto, but also be aware that we might be in a "dirty" state, and thus need to immediately tell the new document that the canvas needs preparation. (WebCore::HTMLCanvasElement::removedFromAncestor): Remove the observer. (WebCore::HTMLCanvasElement::needsPreparationForDisplay): Use a virtual function on the context instead of checking the type. (WebCore::HTMLCanvasElement::prepareForDisplay): Ditto. * html/canvas/CanvasRenderingContext.h: New virtual functions to avoid type checking in HTMLCanvasElement. (WebCore::CanvasRenderingContext::compositingResultsNeedUpdating const): (WebCore::CanvasRenderingContext::needsPreparationForDisplay const): (WebCore::CanvasRenderingContext::prepareForDisplay): * html/canvas/WebGLRenderingContextBase.cpp: Implementations of the virtual functions that tell HTMLCanvasElement that it needs to prepareForDisplay. (WebCore::WebGLRenderingContextBase::markContextChanged): (WebCore::WebGLRenderingContextBase::markContextChangedAndNotifyCanvasObserver): (WebCore::WebGLRenderingContextBase::didComposite): * html/canvas/WebGLRenderingContextBase.h: LayoutTests: * fast/canvas/webgl/move-canvas-in-document-expected.html: Added. * fast/canvas/webgl/move-canvas-in-document-while-clean-expected.html: Added. * fast/canvas/webgl/move-canvas-in-document-while-clean.html: Added. * fast/canvas/webgl/move-canvas-in-document.html: Added. git-svn-id: https://svn.webkit.org/repository/webkit/trunk@266443 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-09-01 Dean Jackson <dino@apple.com> REGRESSION(r262366): MotionMark1.1 | macOS | Some devices | 1-3% overall regression https://bugs.webkit.org/show_bug.cgi?id=215989 <rdar://problem/66845937> Reviewed by Darin Adler. The new approach to compositing WebGL caused a slowdown in some canvas performance tests. They were notifying the Document of all drawing commands, even on 2d canvases that didn't need to prepare before compositing. The solution is to only add the Document as an observer when necessary. This recovers the performance hit - measured using the Canvas Lines MotionMark test. Tests: fast/canvas/webgl/move-canvas-in-document-while-clean.html fast/canvas/webgl/move-canvas-in-document.html * dom/Document.cpp: (WebCore::Document::prepareCanvasesForDisplayIfNeeded): Leave a FIXME indicating that we should try to avoid the copyToVector if we can ensure that the prepareForDisplay call will not mutate the HashSet. * html/CanvasBase.cpp: Remove some copyToVector calls. It should be fine to iterate over the HashSet for these notification functions. (WebCore::CanvasBase::notifyObserversCanvasChanged): (WebCore::CanvasBase::notifyObserversCanvasResized): * html/HTMLCanvasElement.cpp: (WebCore::HTMLCanvasElement::HTMLCanvasElement): Don't add the Document as a canvas observer. Wait until we know it is a context that needs observing. (WebCore::HTMLCanvasElement::createContextWebGL): Now we can add it as an observer. (WebCore::HTMLCanvasElement::didMoveToNewDocument): Swap observation to the new Document. (WebCore::HTMLCanvasElement::insertedIntoAncestor): Ditto, but also be aware that we might be in a "dirty" state, and thus need to immediately tell the new document that the canvas needs preparation. (WebCore::HTMLCanvasElement::removedFromAncestor): Remove the observer. (WebCore::HTMLCanvasElement::needsPreparationForDisplay): Use a virtual function on the context instead of checking the type. (WebCore::HTMLCanvasElement::prepareForDisplay): Ditto. * html/canvas/CanvasRenderingContext.h: New virtual functions to avoid type checking in HTMLCanvasElement. (WebCore::CanvasRenderingContext::compositingResultsNeedUpdating const): (WebCore::CanvasRenderingContext::needsPreparationForDisplay const): (WebCore::CanvasRenderingContext::prepareForDisplay): * html/canvas/WebGLRenderingContextBase.cpp: Implementations of the virtual functions that tell HTMLCanvasElement that it needs to prepareForDisplay. (WebCore::WebGLRenderingContextBase::markContextChanged): (WebCore::WebGLRenderingContextBase::markContextChangedAndNotifyCanvasObserver): (WebCore::WebGLRenderingContextBase::didComposite): * html/canvas/WebGLRenderingContextBase.h: 2020-09-10 Alan Coon <alancoon@apple.com> Cherry-pick r266410. rdar://problem/68652625 <video> element prevents screen from sleeping even after playback finishes https://bugs.webkit.org/show_bug.cgi?id=216017 <rdar://problem/66665846> Reviewed by Darin Adler. When video playback would finish (due to reaching end of file), HTMLMediaElement::mediaPlayerRateChanged() would get called, which would call updateSleepDisabling(). The idea was that updateSleepDisabling() would destroy the SleepDisabler to allow the display to sleep again. However, updateSleepDisabling() would not destroy the SleepDisabler because it does not know yet that the media has been paused. We only learned about it later on, when MediaPlayerPrivateAVFoundationObjC::timeControlStatusDidChange() gets called. To address the problem, we now call updateSleepDisabling() when MediaPlayerPrivateAVFoundationObjC::timeControlStatusDidChange() is called too. * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm: (WebCore::MediaPlayerPrivateAVFoundationObjC::timeControlStatusDidChange): git-svn-id: https://svn.webkit.org/repository/webkit/trunk@266410 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-09-01 Chris Dumez <cdumez@apple.com> <video> element prevents screen from sleeping even after playback finishes https://bugs.webkit.org/show_bug.cgi?id=216017 <rdar://problem/66665846> Reviewed by Darin Adler. When video playback would finish (due to reaching end of file), HTMLMediaElement::mediaPlayerRateChanged() would get called, which would call updateSleepDisabling(). The idea was that updateSleepDisabling() would destroy the SleepDisabler to allow the display to sleep again. However, updateSleepDisabling() would not destroy the SleepDisabler because it does not know yet that the media has been paused. We only learned about it later on, when MediaPlayerPrivateAVFoundationObjC::timeControlStatusDidChange() gets called. To address the problem, we now call updateSleepDisabling() when MediaPlayerPrivateAVFoundationObjC::timeControlStatusDidChange() is called too. * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm: (WebCore::MediaPlayerPrivateAVFoundationObjC::timeControlStatusDidChange): 2020-09-10 Alan Coon <alancoon@apple.com> Cherry-pick r266407. rdar://problem/68652645 Some apps linked beyond iOS 13.4 don't respect mouse events, only touch events https://bugs.webkit.org/show_bug.cgi?id=216021 <rdar://problem/64830335> Reviewed by Wenson Hsieh. Source/WebCore: * platform/RuntimeApplicationChecks.h: * platform/cocoa/RuntimeApplicationChecksCocoa.mm: (WebCore::IOSApplication::isFIFACompanion): (WebCore::IOSApplication::isNoggin): (WebCore::IOSApplication::isOKCupid): Add some more bundle checks. Source/WebKit: * UIProcess/Cocoa/VersionChecks.h: * UIProcess/ios/WKContentViewInteraction.mm: (applicationIsKnownToIgnoreMouseEvents): (-[WKContentView shouldUseMouseGestureRecognizer]): Remove Feedly from the list, they are no longer affected. Add a once-per-app-launch error-level log message to warn developers of the impending behavior change. Add three new apps with a later linked-on target. git-svn-id: https://svn.webkit.org/repository/webkit/trunk@266407 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-09-01 Tim Horton <timothy_horton@apple.com> Some apps linked beyond iOS 13.4 don't respect mouse events, only touch events https://bugs.webkit.org/show_bug.cgi?id=216021 <rdar://problem/64830335> Reviewed by Wenson Hsieh. * platform/RuntimeApplicationChecks.h: * platform/cocoa/RuntimeApplicationChecksCocoa.mm: (WebCore::IOSApplication::isFIFACompanion): (WebCore::IOSApplication::isNoggin): (WebCore::IOSApplication::isOKCupid): Add some more bundle checks. 2020-09-10 Alan Coon <alancoon@apple.com> Cherry-pick r266405. rdar://problem/68652679 Crashtracer in SubresourceLoader::didCancel. <rdar://problem/32831629> and https://bugs.webkit.org/show_bug.cgi?id=216020 Reviewed by Alex Christensen. No new tests (Despite spotting theoretical ways this is possible, unable to construct a reproduction) It's possible for a newly created SubresourceLoader to be cancelled right after creation. In this case, m_resource will be null inside of SubresourceLoader::didCancel. Other parts of SubresourceLoader null check m_resource, so it's reasonable to state ::didCancel should as well. * loader/SubresourceLoader.cpp: (WebCore::SubresourceLoader::didCancel): Early return if reachedTerminalState(), and ASSERT(m_resource) after. git-svn-id: https://svn.webkit.org/repository/webkit/trunk@266405 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-09-01 Brady Eidson <beidson@apple.com> Crashtracer in SubresourceLoader::didCancel. <rdar://problem/32831629> and https://bugs.webkit.org/show_bug.cgi?id=216020 Reviewed by Alex Christensen. No new tests (Despite spotting theoretical ways this is possible, unable to construct a reproduction) It's possible for a newly created SubresourceLoader to be cancelled right after creation. In this case, m_resource will be null inside of SubresourceLoader::didCancel. Other parts of SubresourceLoader null check m_resource, so it's reasonable to state ::didCancel should as well. * loader/SubresourceLoader.cpp: (WebCore::SubresourceLoader::didCancel): Early return if reachedTerminalState(), and ASSERT(m_resource) after. 2020-09-10 Alan Coon <alancoon@apple.com> Cherry-pick r266403. rdar://problem/68652439 EventRegion paint should respect layer's foreground and background painting phases https://bugs.webkit.org/show_bug.cgi?id=216031 <rdar://problem/67282372> Reviewed by Simon Fraser. Source/WebCore: We are currently painting event region for the box background to the foreground layer, which can cause foreground layer to wrongly catch scroll events. Similarly we are unnecessarily painting foreground for layers that don't need it. Test: fast/scrolling/mac/negative-z-index-overflow-scroll.html * rendering/PaintPhase.h: Add two new event region specific PaintBehaviors for foreground and background paint. This essentially duplicates foreground/background PaintPhases but since event region paint is itself a paint phase we can't use those. This should be reconciled at some point. * rendering/RenderBlock.cpp: (WebCore::RenderBlock::paintContents): Add the background flag when painting contents as the descendant backgrounds are part of the layer foreground. (WebCore::RenderBlock::paintObject): Respect the new flags. * rendering/RenderLayer.cpp: (WebCore::RenderLayer::paintLayerContents): Setup the flags based on what we are supposed to be painting on this layer. (WebCore::RenderLayer::collectEventRegionForFragments): Flag filtering moves to paintLayerContents. LayoutTests: * editing/editable-region/text-field-inside-composited-negative-z-index-layer-expected.txt: * fast/scrolling/mac/negative-z-index-overflow-scroll-expected.txt: Added. * fast/scrolling/mac/negative-z-index-overflow-scroll.html: Added. * pointerevents/ios/touch-action-none-relative-inside-composited-negative-z-index-layer-expected.txt: * pointerevents/ios/touch-action-region-backing-sharing-expected.txt: git-svn-id: https://svn.webkit.org/repository/webkit/trunk@266403 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-09-01 Antti Koivisto <antti@apple.com> EventRegion paint should respect layer's foreground and background painting phases https://bugs.webkit.org/show_bug.cgi?id=216031 <rdar://problem/67282372> Reviewed by Simon Fraser. We are currently painting event region for the box background to the foreground layer, which can cause foreground layer to wrongly catch scroll events. Similarly we are unnecessarily painting foreground for layers that don't need it. Test: fast/scrolling/mac/negative-z-index-overflow-scroll.html * rendering/PaintPhase.h: Add two new event region specific PaintBehaviors for foreground and background paint. This essentially duplicates foreground/background PaintPhases but since event region paint is itself a paint phase we can't use those. This should be reconciled at some point. * rendering/RenderBlock.cpp: (WebCore::RenderBlock::paintContents): Add the background flag when painting contents as the descendant backgrounds are part of the layer foreground. (WebCore::RenderBlock::paintObject): Respect the new flags. * rendering/RenderLayer.cpp: (WebCore::RenderLayer::paintLayerContents): Setup the flags based on what we are supposed to be painting on this layer. (WebCore::RenderLayer::collectEventRegionForFragments): Flag filtering moves to paintLayerContents. 2020-09-10 Alan Coon <alancoon@apple.com> Cherry-pick r266336. rdar://problem/68652585 REGRESSION (r266262): Scroll latching fails when scrolling into a preventDefault() region https://bugs.webkit.org/show_bug.cgi?id=215988 <rdar://problem/68034716> Reviewed by Tim Horton. Source/WebCore: In r266262 ScrollingTreeLatchingController started to consult the "last handled wheel event" time when deciding whether to use the latched node, but we didn't update this timestamp when handling an event on the latched node, on the scrolling thread. So fix that. Test: fast/scrolling/latching/latched-scroll-into-nonfast-region.html * page/scrolling/ScrollingTree.cpp: (WebCore::ScrollingTree::handleWheelEvent): LayoutTests: * fast/scrolling/latching/latched-scroll-into-nonfast-region-expected.txt: Added. * fast/scrolling/latching/latched-scroll-into-nonfast-region.html: Added. git-svn-id: https://svn.webkit.org/repository/webkit/trunk@266336 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-08-30 Simon Fraser <simon.fraser@apple.com> REGRESSION (r266262): Scroll latching fails when scrolling into a preventDefault() region https://bugs.webkit.org/show_bug.cgi?id=215988 <rdar://problem/68034716> Reviewed by Tim Horton. In r266262 ScrollingTreeLatchingController started to consult the "last handled wheel event" time when deciding whether to use the latched node, but we didn't update this timestamp when handling an event on the latched node, on the scrolling thread. So fix that. Test: fast/scrolling/latching/latched-scroll-into-nonfast-region.html * page/scrolling/ScrollingTree.cpp: (WebCore::ScrollingTree::handleWheelEvent): 2020-09-10 Alan Coon <alancoon@apple.com> Cherry-pick r266329. rdar://problem/68652477 [Cocoa] MediaSample JSON strings are created for logging to disabled channels https://bugs.webkit.org/show_bug.cgi?id=215980 <rdar://problem/68004132> Reviewed by Simon Fraser. On platforms that USE(OS_LOG), DEBUG_LOG() evaluates its arguments even in production builds. In SourceBufferPrivateAVFObjC::didProvideMediaDataForTrackID(), one DEBUG_LOG() call involved creating a non-trivial JSON object describing a MediaSample then converting that to a JSON string. This string was created even when debug logging was disabled at runtime. Profiles showed this cost half a millisecond per second of video playback on netflix.com in Safari on a MacBook Pro. * platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm: (WebCore::SourceBufferPrivateAVFObjC::didProvideMediaDataForTrackID): Rather than calling MediaSample::toJSONString() directly, let the LogArgument<MediaSample> specialization call toJSONString() iff the log channel is enabled. git-svn-id: https://svn.webkit.org/repository/webkit/trunk@266329 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-08-29 Andy Estes <aestes@apple.com> [Cocoa] MediaSample JSON strings are created for logging to disabled channels https://bugs.webkit.org/show_bug.cgi?id=215980 <rdar://problem/68004132> Reviewed by Simon Fraser. On platforms that USE(OS_LOG), DEBUG_LOG() evaluates its arguments even in production builds. In SourceBufferPrivateAVFObjC::didProvideMediaDataForTrackID(), one DEBUG_LOG() call involved creating a non-trivial JSON object describing a MediaSample then converting that to a JSON string. This string was created even when debug logging was disabled at runtime. Profiles showed this cost half a millisecond per second of video playback on netflix.com in Safari on a MacBook Pro. * platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm: (WebCore::SourceBufferPrivateAVFObjC::didProvideMediaDataForTrackID): Rather than calling MediaSample::toJSONString() directly, let the LogArgument<MediaSample> specialization call toJSONString() iff the log channel is enabled. 2020-09-09 Alan Coon <alancoon@apple.com> Cherry-pick r266616. rdar://problem/68584190 REGRESSION(macOS Big Sur) https://magenta.github.io/lofi-player/ is broken https://bugs.webkit.org/show_bug.cgi?id=216163 <rdar://problem/68198173> Reviewed by Eric Carlson. Source/WebCore: Address a crash and a backward-compatibility issue on https://magenta.github.io/lofi-player/. Test: webaudio/webkitofflineaudiocontext-startRendering-crash.html * Modules/webaudio/AudioBufferSourceNode.idl: * Modules/webaudio/AudioListener.idl: * Modules/webaudio/OscillatorNode.idl: Even after fixing the crash, the game would fail to load because it expected window.OscillatorNode to exist. When we started working on modern Web Audio, we renamed the non-standard oscillator node to WebKitOscillatorNode and added a new standards compliant OscillatorNode behind a runtime flag (off by default). As a result, window.OscillatorNode no longer existed on Big Sur, which is not backward compatible. To address the issue, we now expose window.OscillatorNode even if modern unprefixed WebAudio is not enabled and we merely disable its constructor at runtime. The same policy applies to AudioBufferSourceNode & AudioListener because we did the exact same thing for these interfaces. * Modules/webaudio/BaseAudioContext.cpp: (WebCore::BaseAudioContext::startRendering): Make sure we call lazyInitialize() before we start offline rendering. The context may not be initialized yet if no audio nodes were created for this context. This is similar to what is done in our modern Web Audio code in OfflineAudioContext::startOfflineRendering(), which is why the crash was not reproducible when enabling the Modern Web Audio experimental feature. LayoutTests: Add layout test that was reproducing the crash on https://magenta.github.io/lofi-player/. * webaudio/webkitofflineaudiocontext-startRendering-crash-expected.txt: Added. * webaudio/webkitofflineaudiocontext-startRendering-crash.html: Added. git-svn-id: https://svn.webkit.org/repository/webkit/trunk@266616 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-09-04 Chris Dumez <cdumez@apple.com> REGRESSION(macOS Big Sur) https://magenta.github.io/lofi-player/ is broken https://bugs.webkit.org/show_bug.cgi?id=216163 <rdar://problem/68198173> Reviewed by Eric Carlson. Address a crash and a backward-compatibility issue on https://magenta.github.io/lofi-player/. Test: webaudio/webkitofflineaudiocontext-startRendering-crash.html * Modules/webaudio/AudioBufferSourceNode.idl: * Modules/webaudio/AudioListener.idl: * Modules/webaudio/OscillatorNode.idl: Even after fixing the crash, the game would fail to load because it expected window.OscillatorNode to exist. When we started working on modern Web Audio, we renamed the non-standard oscillator node to WebKitOscillatorNode and added a new standards compliant OscillatorNode behind a runtime flag (off by default). As a result, window.OscillatorNode no longer existed on Big Sur, which is not backward compatible. To address the issue, we now expose window.OscillatorNode even if modern unprefixed WebAudio is not enabled and we merely disable its constructor at runtime. The same policy applies to AudioBufferSourceNode & AudioListener because we did the exact same thing for these interfaces. * Modules/webaudio/BaseAudioContext.cpp: (WebCore::BaseAudioContext::startRendering): Make sure we call lazyInitialize() before we start offline rendering. The context may not be initialized yet if no audio nodes were created for this context. This is similar to what is done in our modern Web Audio code in OfflineAudioContext::startOfflineRendering(), which is why the crash was not reproducible when enabling the Modern Web Audio experimental feature. 2020-09-03 Alan Coon <alancoon@apple.com> Cherry-pick r266265. rdar://problem/68168939 [iOS] provide a way to get previously inserted alternatives for the selected text https://bugs.webkit.org/show_bug.cgi?id=215816 <rdar://problem/66646042> Reviewed by Darin Adler. Source/WebCore: * editing/cocoa/AlternativeTextUIController.h: * editing/cocoa/AlternativeTextUIController.mm: (WebCore::AlternativeTextUIController::alternativesForContext): Return the raw `NSTextAlternatives *` and let the caller create the `Vector<String>` if they need to so that callers that don't can use the actual `NSTextAlternatives *`. * editing/Editor.h: * editing/Editor.cpp: (WebCore::Editor::applyDictationAlternative): Added. (WebCore::Editor::applyDictationAlternativelternative): Deleted. * page/ContextMenuController.cpp: (WebCore::ContextMenuController::contextMenuItemSelected): Drive-by: fix typo. Source/WebKit: * UIProcess/ios/WKContentViewInteraction.mm: (-[WKContentView alternativesForSelectedText]): * UIProcess/WebPageProxy.h: * UIProcess/Cocoa/WebPageProxyCocoa.mm: (WebKit::WebPageProxy::platformDictationAlternatives): Added. * UIProcess/PageClient.h: * UIProcess/Cocoa/PageClientImplCocoa.h: * UIProcess/Cocoa/PageClientImplCocoa.mm: (WebKit::PageClientImplCocoa::dictationAlternatives): (WebKit::PageClientImplCocoa::platformDictationAlternatives): Added. Provide a way to get the raw `NSTextAlternatives *` for a given `WebCore::DictationContext`. * Shared/EditorState.h: * Shared/EditorState.cpp: (WebKit::EditorState::PostLayoutData::encode const): (WebKit::EditorState::PostLayoutData::decode): * WebProcess/WebPage/ios/WebPageIOS.mm: (WebKit::WebPage::getPlatformEditorState const): Include a `Vector<WebCore::DictationContext>` as part of the `EditorState` that contains all of the `WebCore::DictationContext` that exist in the currently selected range (or the range of the word containing the cursor if nothing is selected). * Platform/spi/ios/UIKitSPI.h: Source/WebKitLegacy/mac: * WebView/WebView.mm: (-[WebView _dictationAlternatives:]): Create a `Vector<String>` from the returned `NSTextAlternatives *` now that the member `WebCore::AlternativeTextUIController::alternativesForContext` returns it. Tools: * TestWebKitAPI/Tests/WebKitCocoa/InsertTextAlternatives.mm: (InsertTextAlternatives.Simple): * TestWebKitAPI/ios/UIKitSPI.h: git-svn-id: https://svn.webkit.org/repository/webkit/trunk@266265 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-08-27 Devin Rousso <drousso@apple.com> [iOS] provide a way to get previously inserted alternatives for the selected text https://bugs.webkit.org/show_bug.cgi?id=215816 <rdar://problem/66646042> Reviewed by Darin Adler. * editing/cocoa/AlternativeTextUIController.h: * editing/cocoa/AlternativeTextUIController.mm: (WebCore::AlternativeTextUIController::alternativesForContext): Return the raw `NSTextAlternatives *` and let the caller create the `Vector<String>` if they need to so that callers that don't can use the actual `NSTextAlternatives *`. * editing/Editor.h: * editing/Editor.cpp: (WebCore::Editor::applyDictationAlternative): Added. (WebCore::Editor::applyDictationAlternativelternative): Deleted. * page/ContextMenuController.cpp: (WebCore::ContextMenuController::contextMenuItemSelected): Drive-by: fix typo. 2020-09-03 Alan Coon <alancoon@apple.com> Cherry-pick r266218. rdar://problem/68168930 REGRESSION: touchbar controls don't reflect video state in fullscreen https://bugs.webkit.org/show_bug.cgi?id=215873 <rdar://problem/66723354> Reviewed by Eric Carlson. * platform/mac/WebPlaybackControlsManager.h: * platform/mac/WebPlaybackControlsManager.mm: (-[WebPlaybackControlsManager setPlaying:]): (-[WebPlaybackControlsManager isPlaying]): Create an actual ivar `_playing` for holding the play/pause state. This is needed because `AVTouchBarScrubber` uses KVO to update the state of the play/pause button whenever the related video controller (in this case `AVTouchBarPlaybackControlsControlling`) changes using an `NSValueBinding`. KVO needs an actual ivar in order to function properly. git-svn-id: https://svn.webkit.org/repository/webkit/trunk@266218 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-08-26 Devin Rousso <drousso@apple.com> REGRESSION: touchbar controls don't reflect video state in fullscreen https://bugs.webkit.org/show_bug.cgi?id=215873 <rdar://problem/66723354> Reviewed by Eric Carlson. * platform/mac/WebPlaybackControlsManager.h: * platform/mac/WebPlaybackControlsManager.mm: (-[WebPlaybackControlsManager setPlaying:]): (-[WebPlaybackControlsManager isPlaying]): Create an actual ivar `_playing` for holding the play/pause state. This is needed because `AVTouchBarScrubber` uses KVO to update the state of the play/pause button whenever the related video controller (in this case `AVTouchBarPlaybackControlsControlling`) changes using an `NSValueBinding`. KVO needs an actual ivar in order to function properly. 2020-09-03 Alan Coon <alancoon@apple.com> Cherry-pick r266156. rdar://problem/68168945 Facebook post with lots of comments has cut off scrollbar, and can't scroll fully to the bottom (sticky) https://bugs.webkit.org/show_bug.cgi?id=215719 <rdar://problem/66411757> Reviewed by Simon Fraser. Source/WebCore: While computing the scrollable overflow for inflow positioned (or transformed) renderers, we need to take their paint geometry into account so that scrolling matches their final positions. e.g. <div style="width: 100px; height: 100px;"></div> <div style="position: relative; top: -20; width: 50px; height: 50px;"></div> While the inflow positioned block box is placed right below the previous sibling div, visually they overlap each other. If these boxes happen to be in a scrollable container, the scrolling should be driven by the overlapping state (paint geometry) and not by the layout geometry (where the 2 boxes are placed vertically after each other). While stickily positioned boxes are also considered inflow positioned, their initial inflow layout positions contribute to the scrollable overflow as they are not stationary boxes. Test: fast/css/scrollable-overflow-with-sticky-positioning.html * rendering/RenderBox.cpp: (WebCore::RenderBox::layoutOverflowRectForPropagation const): LayoutTests: * fast/css/scrollable-overflow-with-sticky-positioning-expected.html: Added. * fast/css/scrollable-overflow-with-sticky-positioning.html: Added. git-svn-id: https://svn.webkit.org/repository/webkit/trunk@266156 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-08-25 Zalan Bujtas <zalan@apple.com> Facebook post with lots of comments has cut off scrollbar, and can't scroll fully to the bottom (sticky) https://bugs.webkit.org/show_bug.cgi?id=215719 <rdar://problem/66411757> Reviewed by Simon Fraser. While computing the scrollable overflow for inflow positioned (or transformed) renderers, we need to take their paint geometry into account so that scrolling matches their final positions. e.g. <div style="width: 100px; height: 100px;"></div> <div style="position: relative; top: -20; width: 50px; height: 50px;"></div> While the inflow positioned block box is placed right below the previous sibling div, visually they overlap each other. If these boxes happen to be in a scrollable container, the scrolling should be driven by the overlapping state (paint geometry) and not by the layout geometry (where the 2 boxes are placed vertically after each other). While stickily positioned boxes are also considered inflow positioned, their initial inflow layout positions contribute to the scrollable overflow as they are not stationary boxes. Test: fast/css/scrollable-overflow-with-sticky-positioning.html * rendering/RenderBox.cpp: (WebCore::RenderBox::layoutOverflowRectForPropagation const): 2020-09-03 Alan Coon <alancoon@apple.com> Cherry-pick r266144. rdar://problem/68168942 When using airplay with Youtube, the Youtube tab becomes completely empty and is unresponsive for an extended period of time if we switch the tab https://bugs.webkit.org/show_bug.cgi?id=215821 Reviewed by Eric Carlson. We should ignore the request to paint the current video frame when we are using airplay. It is not necessary to do so, and -[AVAssetImageGenerator copyCGImageAtTime:actualTime:error:] will block the web process for a long time if the video is airplaying. * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm: (WebCore::MediaPlayerPrivateAVFoundationObjC::paintCurrentFrameInContext): git-svn-id: https://svn.webkit.org/repository/webkit/trunk@266144 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-08-25 Peng Liu <peng.liu6@apple.com> When using airplay with Youtube, the Youtube tab becomes completely empty and is unresponsive for an extended period of time if we switch the tab https://bugs.webkit.org/show_bug.cgi?id=215821 Reviewed by Eric Carlson. We should ignore the request to paint the current video frame when we are using airplay. It is not necessary to do so, and -[AVAssetImageGenerator copyCGImageAtTime:actualTime:error:] will block the web process for a long time if the video is airplaying. * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm: (WebCore::MediaPlayerPrivateAVFoundationObjC::paintCurrentFrameInContext): 2020-09-03 Alan Coon <alancoon@apple.com> Cherry-pick r266158. rdar://problem/67812825 Web Share API Level 2 functions even when its experimental feature flag is disabled https://bugs.webkit.org/show_bug.cgi?id=215831 <rdar://problem/67760687> Reviewed by Darin Adler. Source/WebCore: Tests: fast/web-share/canShare-with-files-feature-disabled.html fast/web-share/share-with-files-feature-disabled.html We had a feature flag for Web Share API Level 2, but it isn't actually consulted anywhere in the implementation. * page/Navigator.cpp: (WebCore::Navigator::canShare): Rewrite canShare to be a bit more readable, and also to consult the Level 2 feature flag. (WebCore::Navigator::share): Since canShare (per the spec) will return true if we have files and other content, even if files are not shareable, check the feature flag again before loading the files. Source/WebKit: * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::showShareSheet): If the Web Content process sends us files, but the Level 2 feature flag is disabled, something fishy is happening, so fire a MESSAGE_CHECK. LayoutTests: * fast/web-share/canShare-with-files-feature-disabled-expected.txt: Added. * fast/web-share/canShare-with-files-feature-disabled.html: Added. * fast/web-share/share-with-files-feature-disabled-expected.txt: Added. * fast/web-share/share-with-files-feature-disabled.html: Added. Add some tests that ensure that disabling the feature actually works. git-svn-id: https://svn.webkit.org/repository/webkit/trunk@266158 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-08-25 Tim Horton <timothy_horton@apple.com> Web Share API Level 2 functions even when its experimental feature flag is disabled https://bugs.webkit.org/show_bug.cgi?id=215831 <rdar://problem/67760687> Reviewed by Darin Adler. Tests: fast/web-share/canShare-with-files-feature-disabled.html fast/web-share/share-with-files-feature-disabled.html We had a feature flag for Web Share API Level 2, but it isn't actually consulted anywhere in the implementation. * page/Navigator.cpp: (WebCore::Navigator::canShare): Rewrite canShare to be a bit more readable, and also to consult the Level 2 feature flag. (WebCore::Navigator::share): Since canShare (per the spec) will return true if we have files and other content, even if files are not shareable, check the feature flag again before loading the files. 2020-09-03 Alan Coon <alancoon@apple.com> Cherry-pick r266151. rdar://problem/67812825 Web Share API can share non-HTTP(S) URLs https://bugs.webkit.org/show_bug.cgi?id=215823 <rdar://problem/62083130> Reviewed by Wenson Hsieh. Source/WebCore: Test: fast/web-share/share-disallows-file-urls.html * page/Navigator.cpp: (WebCore::shareableURLForShareData): (WebCore::Navigator::canShare): (WebCore::Navigator::share): Factor out the code to complete and check the scheme of the URL. Make canShare() return NO and share() fail for non-HTTP(S) or data: URLs. Source/WebKit: * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::showShareSheet): Ensure that only HTTP family or data: URLs are shared. LayoutTests: * fast/web-share/share-disallows-file-urls-expected.txt: Added. * fast/web-share/share-disallows-file-urls.html: Added. * fast/web-share/share-transient-activation-expired.html: * fast/web-share/share-transient-activation.html: * fast/web-share/share.html: Add a test that ensures that sharing a non-HTTP-family URL fails, and fix the existing tests to share HTTP-family URLs. git-svn-id: https://svn.webkit.org/repository/webkit/trunk@266151 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-08-25 Tim Horton <timothy_horton@apple.com> Web Share API can share non-HTTP(S) URLs https://bugs.webkit.org/show_bug.cgi?id=215823 <rdar://problem/62083130> Reviewed by Wenson Hsieh. Test: fast/web-share/share-disallows-file-urls.html * page/Navigator.cpp: (WebCore::shareableURLForShareData): (WebCore::Navigator::canShare): (WebCore::Navigator::share): Factor out the code to complete and check the scheme of the URL. Make canShare() return NO and share() fail for non-HTTP(S) or data: URLs. 2020-09-03 Alan Coon <alancoon@apple.com> Cherry-pick r266292. rdar://problem/67963525 Vertical scrolling gets stuck when a horizontal scroller is under the mouse (google search results) https://bugs.webkit.org/show_bug.cgi?id=215641 <rdar://problem/67430532> Reviewed by Tim Horton. Source/WebCore: There are two parts to this fix. First, findEnclosingScrollableContainer() needs to use the same vertical-biasing delta fixup that we use in other places, to bias towards vertical scrolling. Second, when we've determined that the main frame should perform the scroll and dispatch the wheel event to the scrolling thread, we used to hit-test from scratch on the scrolling thread and and try to send the event to a scroller which we already know should not handle it. So pass along a target ScrollingNodeID, and start the scrolling thread handling from that node. Test: fast/scrolling/mac/horizontal-overflow-trapping-small-deltas.html * page/FrameView.cpp: (WebCore::FrameView::wheelEvent): * page/mac/EventHandlerMac.mm: (WebCore::findEnclosingScrollableContainer): * page/scrolling/ScrollingCoordinator.h: (WebCore::ScrollingCoordinator::handleWheelEvent): * page/scrolling/ScrollingTree.cpp: (WebCore::ScrollingTree::handleWheelEvent): (WebCore::ScrollingTree::handleWheelEventWithNode): * page/scrolling/ScrollingTree.h: * page/scrolling/ThreadedScrollingTree.cpp: (WebCore::ThreadedScrollingTree::handleWheelEventAfterMainThread): * page/scrolling/ThreadedScrollingTree.h: * page/scrolling/mac/ScrollingCoordinatorMac.h: * page/scrolling/mac/ScrollingCoordinatorMac.mm: (WebCore::ScrollingCoordinatorMac::handleWheelEvent): * page/scrolling/nicosia/ScrollingCoordinatorNicosia.cpp: (WebCore::ScrollingCoordinatorNicosia::handleWheelEvent): * page/scrolling/nicosia/ScrollingCoordinatorNicosia.h: LayoutTests: After this change iframe-latch-small-deltas.html would time-out because WheelEventTestMonitor would get stuck with a "content scrolling" defer region, due to begin/end wheel events not getting both sent to the iframe. But the test was actually broken; logging shows that it reset latching state anyway, and it's not testing the shipping configuration of async iframe scrolling. So fix the test to use async iframe scrolling, and to avoid rubber-banding, so that latching is not cleared due to elapsed time. * fast/scrolling/latching/iframe-latch-small-deltas-expected.txt: * fast/scrolling/latching/iframe-latch-small-deltas.html: * fast/scrolling/mac/horizontal-overflow-trapping-small-deltas-expected.txt: Added. * fast/scrolling/mac/horizontal-overflow-trapping-small-deltas.html: Added. git-svn-id: https://svn.webkit.org/repository/webkit/trunk@266292 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-08-27 Simon Fraser <simon.fraser@apple.com> Vertical scrolling gets stuck when a horizontal scroller is under the mouse (google search results) https://bugs.webkit.org/show_bug.cgi?id=215641 <rdar://problem/67430532> Reviewed by Tim Horton. There are two parts to this fix. First, findEnclosingScrollableContainer() needs to use the same vertical-biasing delta fixup that we use in other places, to bias towards vertical scrolling. Second, when we've determined that the main frame should perform the scroll and dispatch the wheel event to the scrolling thread, we used to hit-test from scratch on the scrolling thread and and try to send the event to a scroller which we already know should not handle it. So pass along a target ScrollingNodeID, and start the scrolling thread handling from that node. Test: fast/scrolling/mac/horizontal-overflow-trapping-small-deltas.html * page/FrameView.cpp: (WebCore::FrameView::wheelEvent): * page/mac/EventHandlerMac.mm: (WebCore::findEnclosingScrollableContainer): * page/scrolling/ScrollingCoordinator.h: (WebCore::ScrollingCoordinator::handleWheelEvent): * page/scrolling/ScrollingTree.cpp: (WebCore::ScrollingTree::handleWheelEvent): (WebCore::ScrollingTree::handleWheelEventWithNode): * page/scrolling/ScrollingTree.h: * page/scrolling/ThreadedScrollingTree.cpp: (WebCore::ThreadedScrollingTree::handleWheelEventAfterMainThread): * page/scrolling/ThreadedScrollingTree.h: * page/scrolling/mac/ScrollingCoordinatorMac.h: * page/scrolling/mac/ScrollingCoordinatorMac.mm: (WebCore::ScrollingCoordinatorMac::handleWheelEvent): * page/scrolling/nicosia/ScrollingCoordinatorNicosia.cpp: (WebCore::ScrollingCoordinatorNicosia::handleWheelEvent): * page/scrolling/nicosia/ScrollingCoordinatorNicosia.h: 2020-09-03 Alan Coon <alancoon@apple.com> Cherry-pick r266262. rdar://problem/67963581 Scrolling on select element doesn't work after scrolling the page https://bugs.webkit.org/show_bug.cgi?id=215900 Source/WebCore: <rdar://problem/67766032> Reviewed by Tim Horton. The scrolling thread could use a node that was latched some time ago; we need to check the freshness of the latched node before using it. Test: fast/scrolling/latching/latching-stuck-to-main-page.html * page/scrolling/ScrollingTreeLatchingController.cpp: (WebCore::ScrollingTreeLatchingController::receivedWheelEvent): (WebCore::ScrollingTreeLatchingController::latchedNodeForEvent const): (WebCore::ScrollingTreeLatchingController::latchedNodeIsRelevant const): * page/scrolling/ScrollingTreeLatchingController.h: LayoutTests: Reviewed by Tim Horton. * fast/scrolling/latching/latching-stuck-to-main-page-expected.txt: Added. * fast/scrolling/latching/latching-stuck-to-main-page.html: Added. git-svn-id: https://svn.webkit.org/repository/webkit/trunk@266262 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-08-27 Simon Fraser <simon.fraser@apple.com> Scrolling on select element doesn't work after scrolling the page https://bugs.webkit.org/show_bug.cgi?id=215900 <rdar://problem/67766032> Reviewed by Tim Horton. The scrolling thread could use a node that was latched some time ago; we need to check the freshness of the latched node before using it. Test: fast/scrolling/latching/latching-stuck-to-main-page.html * page/scrolling/ScrollingTreeLatchingController.cpp: (WebCore::ScrollingTreeLatchingController::receivedWheelEvent): (WebCore::ScrollingTreeLatchingController::latchedNodeForEvent const): (WebCore::ScrollingTreeLatchingController::latchedNodeIsRelevant const): * page/scrolling/ScrollingTreeLatchingController.h: 2020-09-03 Alan Coon <alancoon@apple.com> Cherry-pick r266248. rdar://problem/67963541 Occasional crashes when restoring replaced text under Editor::changeBackToReplacedString https://bugs.webkit.org/show_bug.cgi?id=215892 <rdar://problem/67731156> Reviewed by Tim Horton. Source/WebCore: While reverting the replaced string in `Editor::changeBackToReplacedString`, it's possible for text replacement (`Editor::replaceSelectionWithText`) to cause the text checking paragraph range to become orphaned (if for no reason other than the fact that arbitrary script can run in between). If this happens, then our attempts to expand the checking range to paragraph boundaries underneath `TextCheckingParagraph::paragraphRange` will result in a null dereference, since the boundary points computed underneath the `expandToParagraphBoundary` helper will be `nullopt`. Mitigate this (and any other potentially similar crashes) by making `expandToParagraphBoundary` robust in the case where expanding to the start and end fails, and just fall back to returning the original text checking range instead. Test: editing/mac/input/change-back-to-replaced-string.html * editing/Editor.h: * editing/TextCheckingHelper.cpp: (WebCore::expandToParagraphBoundary): See above for more details. * testing/Internals.cpp: (WebCore::Internals::changeBackToReplacedString): * testing/Internals.h: * testing/Internals.idl: Add a simple internal testing hook to change the currently selected text back to the given replaced string. LayoutTests: Add a layout test to exercise the crash. * editing/mac/input/change-back-to-replaced-string-expected.txt: Added. * editing/mac/input/change-back-to-replaced-string.html: Added. git-svn-id: https://svn.webkit.org/repository/webkit/trunk@266248 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-08-27 Wenson Hsieh <wenson_hsieh@apple.com> Occasional crashes when restoring replaced text under Editor::changeBackToReplacedString https://bugs.webkit.org/show_bug.cgi?id=215892 <rdar://problem/67731156> Reviewed by Tim Horton. While reverting the replaced string in `Editor::changeBackToReplacedString`, it's possible for text replacement (`Editor::replaceSelectionWithText`) to cause the text checking paragraph range to become orphaned (if for no reason other than the fact that arbitrary script can run in between). If this happens, then our attempts to expand the checking range to paragraph boundaries underneath `TextCheckingParagraph::paragraphRange` will result in a null dereference, since the boundary points computed underneath the `expandToParagraphBoundary` helper will be `nullopt`. Mitigate this (and any other potentially similar crashes) by making `expandToParagraphBoundary` robust in the case where expanding to the start and end fails, and just fall back to returning the original text checking range instead. Test: editing/mac/input/change-back-to-replaced-string.html * editing/Editor.h: * editing/TextCheckingHelper.cpp: (WebCore::expandToParagraphBoundary): See above for more details. * testing/Internals.cpp: (WebCore::Internals::changeBackToReplacedString): * testing/Internals.h: * testing/Internals.idl: Add a simple internal testing hook to change the currently selected text back to the given replaced string. 2020-09-03 Alan Coon <alancoon@apple.com> Cherry-pick r266239. rdar://problem/67963562 REGRESSION (r258215): Title preview movie isn't displayed at www.thismmalife.com https://bugs.webkit.org/show_bug.cgi?id=215774 <rdar://problem/67707957> Reviewed by Eric Carlson. Source/WebCore: Test: media/video-as-img-output-pts.html Use CMSampleBufferGetOutputPresentationTimeStamp() for sample PTS. * platform/graphics/avfoundation/objc/ImageDecoderAVFObjC.mm: (WebCore::ImageDecoderAVFObjC::storeSampleBuffer): LayoutTests: * media/content/video-as-img.mp4: Added. * media/video-as-img-output-pts-expected.txt: Added. * media/video-as-img-output-pts.html: Added. git-svn-id: https://svn.webkit.org/repository/webkit/trunk@266239 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-08-27 Jer Noble <jer.noble@apple.com> REGRESSION (r258215): Title preview movie isn't displayed at www.thismmalife.com https://bugs.webkit.org/show_bug.cgi?id=215774 <rdar://problem/67707957> Reviewed by Eric Carlson. Test: media/video-as-img-output-pts.html Use CMSampleBufferGetOutputPresentationTimeStamp() for sample PTS. * platform/graphics/avfoundation/objc/ImageDecoderAVFObjC.mm: (WebCore::ImageDecoderAVFObjC::storeSampleBuffer): 2020-09-03 Alan Coon <alancoon@apple.com> Cherry-pick r266189. rdar://problem/68145721 Flickering on sedona.dev https://bugs.webkit.org/show_bug.cgi?id=215141 Reviewed by Darin Adler. Source/WebCore: Test: fast/canvas/webgl/compositing-without-drawing.html Our logic to determine if a canvas needs to be "repainted" was over-zealous for WebGL. We were marking any context that called draw commands as dirty, but they could in fact be rendering to an offscreen texture/framebuffer. Then, when it came time to composite, we'd happily swap buffers and show something that had never been rendered to. The fix is simply to ignore any of the dirtying notifications when we are not bound to the default (canvas) framebuffer. * html/canvas/WebGLRenderingContextBase.cpp: (WebCore::WebGLRenderingContextBase::markContextChangedAndNotifyCanvasObserver): Only mark if we're rendering to the default framebuffer. LayoutTests: Test that serves an animation frame that touches WebGL, but not in a way that requires a recomposite. * fast/canvas/webgl/compositing-without-drawing-expected.html: Added. * fast/canvas/webgl/compositing-without-drawing.html: Added. git-svn-id: https://svn.webkit.org/repository/webkit/trunk@266189 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-08-26 Dean Jackson <dino@apple.com> Flickering on sedona.dev https://bugs.webkit.org/show_bug.cgi?id=215141 Reviewed by Darin Adler. Test: fast/canvas/webgl/compositing-without-drawing.html Our logic to determine if a canvas needs to be "repainted" was over-zealous for WebGL. We were marking any context that called draw commands as dirty, but they could in fact be rendering to an offscreen texture/framebuffer. Then, when it came time to composite, we'd happily swap buffers and show something that had never been rendered to. The fix is simply to ignore any of the dirtying notifications when we are not bound to the default (canvas) framebuffer. * html/canvas/WebGLRenderingContextBase.cpp: (WebCore::WebGLRenderingContextBase::markContextChangedAndNotifyCanvasObserver): Only mark if we're rendering to the default framebuffer. 2020-09-02 Alan Coon <alancoon@apple.com> Cherry-pick r266363. rdar://problem/68229370 Wheel event region code is not fully disabled https://bugs.webkit.org/show_bug.cgi?id=216008 <rdar://problem/68086333> Reviewed by Simon Fraser. * rendering/RenderBlock.cpp: (WebCore::RenderBlock::paintObject): * rendering/RenderLayerBacking.cpp: (WebCore::RenderLayerBacking::maintainsEventRegion const): Use the relevant ENABLE flag rather than !PLATFORM_IOS to compile out the code. git-svn-id: https://svn.webkit.org/repository/webkit/trunk@266363 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-08-31 Antti Koivisto <antti@apple.com> Wheel event region code is not fully disabled https://bugs.webkit.org/show_bug.cgi?id=216008 <rdar://problem/68086333> Reviewed by Simon Fraser. * rendering/RenderBlock.cpp: (WebCore::RenderBlock::paintObject): * rendering/RenderLayerBacking.cpp: (WebCore::RenderLayerBacking::maintainsEventRegion const): Use the relevant ENABLE flag rather than !PLATFORM_IOS to compile out the code. 2020-09-01 Alan Coon <alancoon@apple.com> Cherry-pick r266280. rdar://problem/68177624 REGRESSION (r263506): scale transform transitions won't overshoot https://bugs.webkit.org/show_bug.cgi?id=215826 <rdar://problem/67759310> Reviewed by Simon Fraser. Source/WebCore: Test: webanimations/accelerated-css-transition-with-easing-y-axis-above-1.html In r263506 we made a change where accelerated animations would set their animation-wide timing functions using PlatformCAAnimation::setTimingFunction() instead of setting it on individual keyframes. This change was required to support the unique ability of JS-originated animations to specify both an animation-wide timing function as well as per-keyframe timing functions. In the case of CSS Transitions, this meant that instead of setting a per-keyframe timing function, this change would set the animation-wide timing function since CSS Transitions should map the transition-timing-function property to the "easing" property of the Animation object exposed by the Web Animations API, not as the timing function of the single keyframe interval. However, this change surfaced a bug in Core Animation on macOS and iOS where a cubic-bezier() timing function with y values above 1 get clipped when applied to a CAKeyframeAnimation using the timingFunction property (singular) instead of the timingFunctions property (plural). To work around this issue, we set Animation::property() on the generated Animation object passed to GraphicsLayerCA to make it possible to detect when we're dealing with a CSS Transition and set the timing function on the keyframe interval rather than on the animation itself. Alas, this does not fix the case where a JS-originated animation will specify an animation-wide timing function with a cubic-bezier() timing function with y values above 1. There is no known workaround at this time for this case and this is covered by bug 215918. * animation/KeyframeEffect.cpp: (WebCore::KeyframeEffect::backingAnimationForCompositedRenderer const): * platform/graphics/ca/GraphicsLayerCA.cpp: (WebCore::GraphicsLayerCA::createTransformAnimationsFromKeyframes): LayoutTests: Add a new test that checks that a CSS Transition using a cubic-bezier() timing function with a y value beyond 1 does not get clipped. * platform/win/TestExpectations: * webanimations/accelerated-css-transition-with-easing-y-axis-above-1-expected.html: Added. * webanimations/accelerated-css-transition-with-easing-y-axis-above-1.html: Added. git-svn-id: https://svn.webkit.org/repository/webkit/trunk@266280 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-08-28 Antoine Quint <graouts@webkit.org> REGRESSION (r263506): scale transform transitions won't overshoot https://bugs.webkit.org/show_bug.cgi?id=215826 <rdar://problem/67759310> Reviewed by Simon Fraser. Test: webanimations/accelerated-css-transition-with-easing-y-axis-above-1.html In r263506 we made a change where accelerated animations would set their animation-wide timing functions using PlatformCAAnimation::setTimingFunction() instead of setting it on individual keyframes. This change was required to support the unique ability of JS-originated animations to specify both an animation-wide timing function as well as per-keyframe timing functions. In the case of CSS Transitions, this meant that instead of setting a per-keyframe timing function, this change would set the animation-wide timing function since CSS Transitions should map the transition-timing-function property to the "easing" property of the Animation object exposed by the Web Animations API, not as the timing function of the single keyframe interval. However, this change surfaced a bug in Core Animation on macOS and iOS where a cubic-bezier() timing function with y values above 1 get clipped when applied to a CAKeyframeAnimation using the timingFunction property (singular) instead of the timingFunctions property (plural). To work around this issue, we set Animation::property() on the generated Animation object passed to GraphicsLayerCA to make it possible to detect when we're dealing with a CSS Transition and set the timing function on the keyframe interval rather than on the animation itself. Alas, this does not fix the case where a JS-originated animation will specify an animation-wide timing function with a cubic-bezier() timing function with y values above 1. There is no known workaround at this time for this case and this is covered by bug 215918. * animation/KeyframeEffect.cpp: (WebCore::KeyframeEffect::backingAnimationForCompositedRenderer const): * platform/graphics/ca/GraphicsLayerCA.cpp: (WebCore::GraphicsLayerCA::createTransformAnimationsFromKeyframes): 2020-09-01 Alan Coon <alancoon@apple.com> Cherry-pick r266241. rdar://problem/68177624 REGRESSION (r263506): timing of CSS Animation on https://animate.style is incorrect https://bugs.webkit.org/show_bug.cgi?id=215807 <rdar://problem/66770136> Reviewed by Simon Fraser. Source/WebCore: Test: webanimations/accelerated-css-animation-with-easing.html In r263506, we added a way for accelerated animations to adhere to both a timing function set on the animation, affecting the timing of the entire animation, as well as a timing function set on individual keyframes, affecting the timing of the animation in a given interval. Alas, this change broke handling of timing functions with implicit animation-timing-function on keyframes. That code change assumed that the Animation object ultimately passed to GraphicsLayerCA::setupAnimation() would return the animation-wide timing function through Animation::timingFunction(). This was correct for JS-originated animations, but not for CSS Animations, since that value was set based on the computed CSS property animation-timing-function for the target element. However, that CSS property does not specify the animation-wide timing function, but rather the default timing function to use for keyframes should they fail to specify an explicit timing function. To fix this, first, we ensure that the animation-wide timing function is set on the Animation object, changing KeyframeEffect::backingAnimationForCompositedRenderer() to always generate an Animation object based on the effect, divorcing itself from the Animation object created through CSS. Then, we add a new member to Animation to specify the default timing function for keyframes, allowing GraphicsLayerCA to use it to determine the timing function when building keyframes. * animation/KeyframeEffect.cpp: (WebCore::KeyframeEffect::backingAnimationForCompositedRenderer const): Always generate an Animation object based on the effect's properties, also setting the new defaultTimingFunctionForKeyframes in the case of a CSS Animation object. * platform/animation/Animation.h: (WebCore::Animation::defaultTimingFunctionForKeyframes const): (WebCore::Animation::setDefaultTimingFunctionForKeyframes): * platform/graphics/ca/GraphicsLayerCA.cpp: (WebCore::animationHasStepsTimingFunction): Use the optional defaultTimingFunctionForKeyframes to determine whether a keyframe uses a steps timing function. (WebCore::GraphicsLayerCA::timingFunctionForAnimationValue): Use the optional defaultTimingFunctionForKeyframes to determine the timing function for a keyframe. LayoutTests: Add a new test that checks that a CSS Animation with implicit and explicit animation-timing-function values behave the same when running accelerated. * webanimations/accelerated-css-animation-with-easing-expected.html: Added. * webanimations/accelerated-css-animation-with-easing.html: Added. git-svn-id: https://svn.webkit.org/repository/webkit/trunk@266241 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-08-27 Antoine Quint <graouts@webkit.org> REGRESSION (r263506): timing of CSS Animation on https://animate.style is incorrect https://bugs.webkit.org/show_bug.cgi?id=215807 <rdar://problem/66770136> Reviewed by Simon Fraser. Test: webanimations/accelerated-css-animation-with-easing.html In r263506, we added a way for accelerated animations to adhere to both a timing function set on the animation, affecting the timing of the entire animation, as well as a timing function set on individual keyframes, affecting the timing of the animation in a given interval. Alas, this change broke handling of timing functions with implicit animation-timing-function on keyframes. That code change assumed that the Animation object ultimately passed to GraphicsLayerCA::setupAnimation() would return the animation-wide timing function through Animation::timingFunction(). This was correct for JS-originated animations, but not for CSS Animations, since that value was set based on the computed CSS property animation-timing-function for the target element. However, that CSS property does not specify the animation-wide timing function, but rather the default timing function to use for keyframes should they fail to specify an explicit timing function. To fix this, first, we ensure that the animation-wide timing function is set on the Animation object, changing KeyframeEffect::backingAnimationForCompositedRenderer() to always generate an Animation object based on the effect, divorcing itself from the Animation object created through CSS. Then, we add a new member to Animation to specify the default timing function for keyframes, allowing GraphicsLayerCA to use it to determine the timing function when building keyframes. * animation/KeyframeEffect.cpp: (WebCore::KeyframeEffect::backingAnimationForCompositedRenderer const): Always generate an Animation object based on the effect's properties, also setting the new defaultTimingFunctionForKeyframes in the case of a CSS Animation object. * platform/animation/Animation.h: (WebCore::Animation::defaultTimingFunctionForKeyframes const): (WebCore::Animation::setDefaultTimingFunctionForKeyframes): * platform/graphics/ca/GraphicsLayerCA.cpp: (WebCore::animationHasStepsTimingFunction): Use the optional defaultTimingFunctionForKeyframes to determine whether a keyframe uses a steps timing function. (WebCore::GraphicsLayerCA::timingFunctionForAnimationValue): Use the optional defaultTimingFunctionForKeyframes to determine the timing function for a keyframe. 2020-09-01 Alan Coon <alancoon@apple.com> Cherry-pick r266291. rdar://problem/68177666 No need to run full can-use-for (fast inline layout codepath) check on every style change. https://bugs.webkit.org/show_bug.cgi?id=215937 <rdar://problem/67951360> Reviewed by Antti Koivisto. Let's use the StyleDifference to figure out how extensive the can-use-for check should be. We can certainly skip some relatively expensive content checks when we know that the style change only triggers repaint or positioned-movement-only changes. * layout/integration/LayoutIntegrationLineLayout.cpp: (WebCore::LayoutIntegration::LineLayout::canUseForAfterStyleChange): * layout/integration/LayoutIntegrationLineLayout.h: * rendering/RenderBlockFlow.cpp: (WebCore::RenderBlockFlow::styleDidChange): * rendering/SimpleLineLayout.cpp: (WebCore::SimpleLineLayout::canUseForAfterStyleChange): * rendering/SimpleLineLayout.h: git-svn-id: https://svn.webkit.org/repository/webkit/trunk@266291 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-08-28 Zalan Bujtas <zalan@apple.com> No need to run full can-use-for (fast inline layout codepath) check on every style change. https://bugs.webkit.org/show_bug.cgi?id=215937 <rdar://problem/67951360> Reviewed by Antti Koivisto. Let's use the StyleDifference to figure out how extensive the can-use-for check should be. We can certainly skip some relatively expensive content checks when we know that the style change only triggers repaint or positioned-movement-only changes. * layout/integration/LayoutIntegrationLineLayout.cpp: (WebCore::LayoutIntegration::LineLayout::canUseForAfterStyleChange): * layout/integration/LayoutIntegrationLineLayout.h: * rendering/RenderBlockFlow.cpp: (WebCore::RenderBlockFlow::styleDidChange): * rendering/SimpleLineLayout.cpp: (WebCore::SimpleLineLayout::canUseForAfterStyleChange): * rendering/SimpleLineLayout.h: 2020-09-01 Alan Coon <alancoon@apple.com> Cherry-pick r266281. rdar://problem/68177575 Remove adopted node from TextManipulationController https://bugs.webkit.org/show_bug.cgi?id=215914 Reviewed by Wenson Hsieh. Remove Node from TextManipulationController when it gets adopted to a new document. * dom/Node.cpp: (WebCore::Node::moveNodeToNewDocument): git-svn-id: https://svn.webkit.org/repository/webkit/trunk@266281 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-08-28 Ryosuke Niwa <rniwa@webkit.org> Remove adopted node from TextManipulationController https://bugs.webkit.org/show_bug.cgi?id=215914 Reviewed by Wenson Hsieh. Remove Node from TextManipulationController when it gets adopted to a new document. * dom/Node.cpp: (WebCore::Node::moveNodeToNewDocument): 2020-09-01 Alan Coon <alancoon@apple.com> Cherry-pick r266214. rdar://problem/68164557 Resource Load Statistics data summary does not report data which is held up in the web content process. https://bugs.webkit.org/show_bug.cgi?id=215822 <rdar://problem/66682044> Reviewed by Chris Dumez. Source/WebCore: Send empty lambda when calling updateCentralStatisticsStore() because in these cases we don't care about timing. * loader/ResourceLoadObserver.h: (WebCore::ResourceLoadObserver::updateCentralStatisticsStore): * page/DOMWindow.cpp: (WebCore::DOMWindow::close): * testing/Internals.cpp: (WebCore::Internals::notifyResourceLoadObserver): Source/WebKit: No new tests, this fixes a timing bug that is flaky to reproduce, so I was unable to write a test case. Non-regressed behavior is confirmed with existing API testing. * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp: (WebKit::WebResourceLoadStatisticsStore::resourceLoadStatisticsUpdated): Most of the time, the completion handler will be an empty function, but we should handle it in the network process so we fix the case where we wait to send the full data summary until the update has finished. (WebKit::WebResourceLoadStatisticsStore::aggregatedThirdPartyData): Delete extra space. * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.h: * NetworkProcess/NetworkConnectionToWebProcess.cpp: (WebKit::NetworkConnectionToWebProcess::resourceLoadStatisticsUpdated): * NetworkProcess/NetworkConnectionToWebProcess.h: * NetworkProcess/NetworkConnectionToWebProcess.messages.in: * UIProcess/WebProcessPool.cpp: (WebKit::WebProcessPool::sendResourceLoadStatisticsDataImmediately): * UIProcess/WebProcessPool.h: * UIProcess/WebsiteData/WebsiteDataStore.cpp: (WebKit::WebsiteDataStore::getResourceLoadStatisticsDataSummary): Don't ask the network process for data until any lingering data in the web content process has been sent first. * WebProcess/InjectedBundle/API/c/WKBundle.cpp: (WKBundleResourceLoadStatisticsNotifyObserver): * WebProcess/WebCoreSupport/WebResourceLoadObserver.cpp: (WebKit::WebResourceLoadObserver::WebResourceLoadObserver): (WebKit::WebResourceLoadObserver::~WebResourceLoadObserver): (WebKit::WebResourceLoadObserver::updateCentralStatisticsStore): * WebProcess/WebCoreSupport/WebResourceLoadObserver.h: * WebProcess/WebProcess.cpp: (WebKit::WebProcess::flushResourceLoadStatistics): (WebKit::WebProcess::sendResourceLoadStatisticsDataImmediately): * WebProcess/WebProcess.h: * WebProcess/WebProcess.messages.in: git-svn-id: https://svn.webkit.org/repository/webkit/trunk@266214 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-08-26 Kate Cheney <katherine_cheney@apple.com> Resource Load Statistics data summary does not report data which is held up in the web content process. https://bugs.webkit.org/show_bug.cgi?id=215822 <rdar://problem/66682044> Reviewed by Chris Dumez. Send empty lambda when calling updateCentralStatisticsStore() because in these cases we don't care about timing. * loader/ResourceLoadObserver.h: (WebCore::ResourceLoadObserver::updateCentralStatisticsStore): * page/DOMWindow.cpp: (WebCore::DOMWindow::close): * testing/Internals.cpp: (WebCore::Internals::notifyResourceLoadObserver): 2020-09-01 Alan Coon <alancoon@apple.com> Cherry-pick r266140. rdar://problem/68164582 Fix read-after-free introduced in r266087 https://bugs.webkit.org/show_bug.cgi?id=215671 * Modules/fetch/FetchBodyConsumer.cpp: (WebCore::packageFormData): Keep the CString in scope while we are using it. git-svn-id: https://svn.webkit.org/repository/webkit/trunk@266140 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-08-25 Alex Christensen <achristensen@webkit.org> Fix read-after-free introduced in r266087 https://bugs.webkit.org/show_bug.cgi?id=215671 * Modules/fetch/FetchBodyConsumer.cpp: (WebCore::packageFormData): Keep the CString in scope while we are using it. 2020-09-01 Alan Coon <alancoon@apple.com> Cherry-pick r266268. rdar://problem/68107183 Remove the feature flag for capped cookies set in 3rd-party CNAME cloaked HTTP responses and add ITP debug logging https://bugs.webkit.org/show_bug.cgi?id=215902 <rdar://problem/66699731> Reviewed by Brent Fulgham. This change removes the feature flag, effectively turning the feature on. It also adds log output of cookie names that have been capped when ITP Debug Mode is enabled. Source/WebCore: WebCore::NetworkStorageSession now has a member flag for ITP debug logging. No new tests. This feature already has tests. * page/Settings.yaml: * platform/network/NetworkStorageSession.cpp: (WebCore::NetworkStorageSession::setResourceLoadStatisticsDebugLoggingEnabled): (WebCore::NetworkStorageSession::resourceLoadStatisticsDebugLoggingEnabled const): New function to be able to conditionalize log output in the new feature. * platform/network/NetworkStorageSession.h: Source/WebKit: * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp: (WebKit::WebResourceLoadStatisticsStore::setResourceLoadStatisticsDebugMode): Now sets the flag in WebCore::NetworkStorageSession through the new function WebCore::NetworkStorageSession::setResourceLoadStatisticsDebugLoggingEnabled(). * NetworkProcess/NetworkProcess.cpp: (WebKit::NetworkProcess::resetParametersToDefaultValues): (WebKit::NetworkProcess::setIsRunningResourceLoadStatisticsTest): * NetworkProcess/NetworkSession.cpp: (WebKit::NetworkSession::NetworkSession): (WebKit::NetworkSession::setFirstPartyHostCNAMEDomain): (WebKit::NetworkSession::firstPartyHostCNAMEDomain): * NetworkProcess/NetworkSession.h: (WebKit::NetworkSession::setCNAMECloakingMitigationEnabled): Deleted. (WebKit::NetworkSession::cnameCloakingMitigationEnabled const): Deleted. * NetworkProcess/cocoa/NetworkDataTaskCocoa.mm: (WebKit::NetworkDataTaskCocoa::updateFirstPartyInfoForSession): (WebKit::NetworkDataTaskCocoa::applyCookiePolicyForThirdPartyCNAMECloaking): * Shared/ResourceLoadStatisticsParameters.h: (WebKit::ResourceLoadStatisticsParameters::encode const): (WebKit::ResourceLoadStatisticsParameters::decode): * Shared/WebPreferences.yaml: * UIProcess/WebProcessPool.cpp: (WebKit::WebProcessPool::ensureNetworkProcess): * UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm: (WebKit::WebsiteDataStore::platformSetNetworkParameters): * UIProcess/WebsiteData/WebsiteDataStore.cpp: (WebKit::WebsiteDataStore::parameters): git-svn-id: https://svn.webkit.org/repository/webkit/trunk@266268 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-08-27 John Wilander <wilander@apple.com> Remove the feature flag for capped cookies set in 3rd-party CNAME cloaked HTTP responses and add ITP debug logging https://bugs.webkit.org/show_bug.cgi?id=215902 <rdar://problem/66699731> Reviewed by Brent Fulgham. This change removes the feature flag, effectively turning the feature on. It also adds log output of cookie names that have been capped when ITP Debug Mode is enabled. WebCore::NetworkStorageSession now has a member flag for ITP debug logging. No new tests. This feature already has tests. * page/Settings.yaml: * platform/network/NetworkStorageSession.cpp: (WebCore::NetworkStorageSession::setResourceLoadStatisticsDebugLoggingEnabled): (WebCore::NetworkStorageSession::resourceLoadStatisticsDebugLoggingEnabled const): New function to be able to conditionalize log output in the new feature. * platform/network/NetworkStorageSession.h: 2020-09-01 Alan Coon <alancoon@apple.com> Cherry-pick r266229. rdar://problem/68161195 Animation are invalidating too much https://bugs.webkit.org/show_bug.cgi?id=215849 Reviewed by Antoine Quint. * animation/KeyframeEffect.cpp: (WebCore::invalidateElement): Changes due to animations can't affect sibling elements so we can use internal invalidation. git-svn-id: https://svn.webkit.org/repository/webkit/trunk@266229 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-08-27 Antti Koivisto <antti@apple.com> Animation are invalidating too much https://bugs.webkit.org/show_bug.cgi?id=215849 Reviewed by Antoine Quint. * animation/KeyframeEffect.cpp: (WebCore::invalidateElement): Changes due to animations can't affect sibling elements so we can use internal invalidation. 2020-09-01 Russell Epstein <repstein@apple.com> Cherry-pick r266118. rdar://problem/68160083 Fonts lie about being monospaced https://bugs.webkit.org/show_bug.cgi?id=162546 <rdar://problem/28494654> Reviewed by Darin Adler. Source/WebCore: When a font reports itself to be monospace, we use this as a signal that we can perform width computations by assuming all characters have the same width as the space character. However, some fonts erroneously claim to be monospaced. We can't know this ahead of time without measuring a bunch of characters at font load time, which would be too slow, so even though the optimization would be nice there is no practical way to do it correctly. Firefox and Chrome both do not use this signal, so therefore they both correctly render these fonts. We should ignore this bit in the font as well. Also, CJK fonts generally do not have this bit set (because they usually have at least one character which is not fullwidth) so this isn't a concern there. Our Page Load Test shows this is not a performance regression. Tests: fast/text/font-erroneous-monospace.html fast/text/font-monospaced-lie.html * rendering/RenderText.cpp: (WebCore::RenderText::widthFromCache const): LayoutTests: Add two tests for fonts which claim to be monospaced but actually aren't. * fast/text/font-erroneous-monospace-expected.html: Added. * fast/text/font-erroneous-monospace.html: Added. * fast/text/font-monospaced-lie-expected.txt: Added. * fast/text/font-monospaced-lie.html: Added. * fast/text/line-break-after-question-mark-expected.txt: * fast/text/line-break-after-question-mark.html: * fast/text/resources/Ahem-fixed-pitch.ttf: Added. * fast/text/resources/AhemErroneousMonospace.ttf: Added. git-svn-id: https://svn.webkit.org/repository/webkit/trunk@266118 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-08-25 Myles C. Maxfield <mmaxfield@apple.com> Fonts lie about being monospaced https://bugs.webkit.org/show_bug.cgi?id=162546 <rdar://problem/28494654> Reviewed by Darin Adler. When a font reports itself to be monospace, we use this as a signal that we can perform width computations by assuming all characters have the same width as the space character. However, some fonts erroneously claim to be monospaced. We can't know this ahead of time without measuring a bunch of characters at font load time, which would be too slow, so even though the optimization would be nice there is no practical way to do it correctly. Firefox and Chrome both do not use this signal, so therefore they both correctly render these fonts. We should ignore this bit in the font as well. Also, CJK fonts generally do not have this bit set (because they usually have at least one character which is not fullwidth) so this isn't a concern there. Our Page Load Test shows this is not a performance regression. Tests: fast/text/font-erroneous-monospace.html fast/text/font-monospaced-lie.html * rendering/RenderText.cpp: (WebCore::RenderText::widthFromCache const): 2020-08-26 Alan Coon <alancoon@apple.com> Cherry-pick r266168. rdar://problem/67836301 REGRESSION (r265908): Crash under Blob::arrayBuffer() / Blob::text() in stress GC https://bugs.webkit.org/show_bug.cgi?id=215832 <rdar://problem/67741677> Reviewed by Ryosuke Niwa. Source/WebCore: r265908 added support for Blob::arrayBuffer() / Blob::text() which are asynchronous operations returning promises. The crash is due to the fact that the Blob's JS wrapper may get garbage collected before the promise is settled. To address the issue, this patch makes Blob an ActiveDOMObject and creates an ActiveDOMObject::pendingActivity whenever there is a pending promise so that the JS wrapper does not get garbage collected too early. Test: fast/files/blob-text-gc.html * Modules/async-clipboard/Clipboard.cpp: (WebCore::Clipboard::getType): * Modules/async-clipboard/ClipboardImageReader.h: (WebCore::ClipboardImageReader::ClipboardImageReader): * Modules/async-clipboard/ClipboardItem.cpp: (WebCore::ClipboardItem::blobFromString): * Modules/async-clipboard/ClipboardItem.h: * Modules/async-clipboard/ClipboardItemBindingsDataSource.cpp: (WebCore::ClipboardItemBindingsDataSource::getType): * Modules/async-clipboard/ios/ClipboardImageReaderIOS.mm: (WebCore::ClipboardImageReader::readBuffer): * Modules/async-clipboard/mac/ClipboardImageReaderMac.mm: (WebCore::ClipboardImageReader::readBuffer): * Modules/entriesapi/DOMFileSystem.cpp: (WebCore::DOMFileSystem::getFile): * Modules/entriesapi/DOMFileSystem.h: * Modules/entriesapi/FileSystemFileEntry.cpp: (WebCore::FileSystemFileEntry::file): * Modules/entriesapi/FileSystemFileEntry.h: * Modules/entriesapi/FileSystemFileEntry.idl: * Modules/fetch/FetchBody.cpp: (WebCore::FetchBody::fromFormData): * Modules/fetch/FetchBody.h: * Modules/fetch/FetchBodyConsumer.cpp: (WebCore::blobFromData): (WebCore::packageFormData): (WebCore::resolveWithTypeAndData): (WebCore::FetchBodyConsumer::resolve): (WebCore::FetchBodyConsumer::takeAsBlob): * Modules/fetch/FetchBodyConsumer.h: * Modules/fetch/FetchBodyOwner.cpp: (WebCore::FetchBodyOwner::blob): * Modules/mediarecorder/MediaRecorder.cpp: (WebCore::MediaRecorder::stopRecording): (WebCore::MediaRecorder::requestData): * Modules/mediastream/RTCDataChannel.cpp: (WebCore::RTCDataChannel::didReceiveRawData): * Modules/websockets/WebSocket.cpp: (WebCore::WebSocket::didReceiveBinaryData): * Modules/websockets/WorkerThreadableWebSocketChannel.cpp: (WebCore::WorkerThreadableWebSocketChannel::Bridge::send): * bindings/js/SerializedScriptValue.cpp: (WebCore::CloneDeserializer::readFile): (WebCore::CloneDeserializer::readTerminal): * dom/DataTransfer.cpp: (WebCore::DataTransfer::updateFileList): (WebCore::DataTransfer::items): (WebCore::DataTransfer::filesFromPasteboardAndItemList const): (WebCore::DataTransfer::files const): * dom/DataTransfer.h: * dom/DataTransfer.idl: * dom/DataTransferItemList.cpp: (WebCore::DataTransferItemList::DataTransferItemList): (WebCore::DataTransferItemList::remove): (WebCore::DataTransferItemList::clear): (WebCore::DataTransferItemList::ensureItems const): (WebCore::DataTransferItemList::document const): * dom/DataTransferItemList.h: * dom/DataTransferItemList.idl: * editing/WebCorePasteboardFileReader.cpp: (WebCore::WebCorePasteboardFileReader::readFilename): (WebCore::WebCorePasteboardFileReader::readBuffer): * editing/WebCorePasteboardFileReader.h: * editing/cocoa/WebContentReaderCocoa.mm: (WebCore::createFragmentForImageAttachment): (WebCore::replaceRichContentWithAttachments): (WebCore::createFragmentAndAddResources): (WebCore::sanitizeMarkupWithArchive): (WebCore::WebContentReader::readImage): (WebCore::attachmentForFilePath): (WebCore::attachmentForData): * editing/markup.cpp: (WebCore::restoreAttachmentElementsInFragment): * fileapi/Blob.cpp: (WebCore::Blob::Blob): (WebCore::Blob::loadBlob): (WebCore::Blob::activeDOMObjectName const): * fileapi/Blob.h: (WebCore::Blob::create): (WebCore::Blob::deserialize): (WebCore::Blob::slice const): * fileapi/Blob.idl: * fileapi/File.cpp: (WebCore::File::createWithRelativePath): (WebCore::File::create): (WebCore::File::File): (WebCore::File::activeDOMObjectName const): * fileapi/File.h: * fileapi/File.idl: * html/DOMFormData.cpp: (WebCore::DOMFormData::createFileEntry): * html/DirectoryFileListCreator.cpp: (WebCore::FileInformation::isolatedCopy const): (WebCore::appendDirectoryFiles): (WebCore::gatherFileInformation): (WebCore::toFileList): (WebCore::DirectoryFileListCreator::start): * html/DirectoryFileListCreator.h: * html/FileInputType.cpp: (WebCore::FileInputType::appendFormData const): (WebCore::FileInputType::filesChosen): * html/HTMLAttachmentElement.cpp: (WebCore::HTMLAttachmentElement::updateEnclosingImageWithData): * html/HTMLCanvasElement.cpp: (WebCore::HTMLCanvasElement::toBlob): * testing/Internals.cpp: (WebCore::Internals::createFile): * testing/ServiceWorkerInternals.cpp: (WebCore::ServiceWorkerInternals::createOpaqueWithBlobBodyResponse): * workers/service/context/ServiceWorkerFetch.cpp: (WebCore::ServiceWorkerFetch::dispatchFetchEvent): * xml/XMLHttpRequest.cpp: (WebCore::XMLHttpRequest::createResponseBlob): Source/WebKit: * WebProcess/Automation/WebAutomationSessionProxy.cpp: (WebKit::WebAutomationSessionProxy::setFilesForInputFileUpload): LayoutTests: Add better test coverage. * fast/files/blob-text-gc-expected.txt: Added. * fast/files/blob-text-gc.html: Added. git-svn-id: https://svn.webkit.org/repository/webkit/trunk@266168 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-08-26 Chris Dumez <cdumez@apple.com> REGRESSION (r265908): Crash under Blob::arrayBuffer() / Blob::text() in stress GC https://bugs.webkit.org/show_bug.cgi?id=215832 <rdar://problem/67741677> Reviewed by Ryosuke Niwa. r265908 added support for Blob::arrayBuffer() / Blob::text() which are asynchronous operations returning promises. The crash is due to the fact that the Blob's JS wrapper may get garbage collected before the promise is settled. To address the issue, this patch makes Blob an ActiveDOMObject and creates an ActiveDOMObject::pendingActivity whenever there is a pending promise so that the JS wrapper does not get garbage collected too early. Test: fast/files/blob-text-gc.html * Modules/async-clipboard/Clipboard.cpp: (WebCore::Clipboard::getType): * Modules/async-clipboard/ClipboardImageReader.h: (WebCore::ClipboardImageReader::ClipboardImageReader): * Modules/async-clipboard/ClipboardItem.cpp: (WebCore::ClipboardItem::blobFromString): * Modules/async-clipboard/ClipboardItem.h: * Modules/async-clipboard/ClipboardItemBindingsDataSource.cpp: (WebCore::ClipboardItemBindingsDataSource::getType): * Modules/async-clipboard/ios/ClipboardImageReaderIOS.mm: (WebCore::ClipboardImageReader::readBuffer): * Modules/async-clipboard/mac/ClipboardImageReaderMac.mm: (WebCore::ClipboardImageReader::readBuffer): * Modules/entriesapi/DOMFileSystem.cpp: (WebCore::DOMFileSystem::getFile): * Modules/entriesapi/DOMFileSystem.h: * Modules/entriesapi/FileSystemFileEntry.cpp: (WebCore::FileSystemFileEntry::file): * Modules/entriesapi/FileSystemFileEntry.h: * Modules/entriesapi/FileSystemFileEntry.idl: * Modules/fetch/FetchBody.cpp: (WebCore::FetchBody::fromFormData): * Modules/fetch/FetchBody.h: * Modules/fetch/FetchBodyConsumer.cpp: (WebCore::blobFromData): (WebCore::packageFormData): (WebCore::resolveWithTypeAndData): (WebCore::FetchBodyConsumer::resolve): (WebCore::FetchBodyConsumer::takeAsBlob): * Modules/fetch/FetchBodyConsumer.h: * Modules/fetch/FetchBodyOwner.cpp: (WebCore::FetchBodyOwner::blob): * Modules/mediarecorder/MediaRecorder.cpp: (WebCore::MediaRecorder::stopRecording): (WebCore::MediaRecorder::requestData): * Modules/mediastream/RTCDataChannel.cpp: (WebCore::RTCDataChannel::didReceiveRawData): * Modules/websockets/WebSocket.cpp: (WebCore::WebSocket::didReceiveBinaryData): * Modules/websockets/WorkerThreadableWebSocketChannel.cpp: (WebCore::WorkerThreadableWebSocketChannel::Bridge::send): * bindings/js/SerializedScriptValue.cpp: (WebCore::CloneDeserializer::readFile): (WebCore::CloneDeserializer::readTerminal): * dom/DataTransfer.cpp: (WebCore::DataTransfer::updateFileList): (WebCore::DataTransfer::items): (WebCore::DataTransfer::filesFromPasteboardAndItemList const): (WebCore::DataTransfer::files const): * dom/DataTransfer.h: * dom/DataTransfer.idl: * dom/DataTransferItemList.cpp: (WebCore::DataTransferItemList::DataTransferItemList): (WebCore::DataTransferItemList::remove): (WebCore::DataTransferItemList::clear): (WebCore::DataTransferItemList::ensureItems const): (WebCore::DataTransferItemList::document const): * dom/DataTransferItemList.h: * dom/DataTransferItemList.idl: * editing/WebCorePasteboardFileReader.cpp: (WebCore::WebCorePasteboardFileReader::readFilename): (WebCore::WebCorePasteboardFileReader::readBuffer): * editing/WebCorePasteboardFileReader.h: * editing/cocoa/WebContentReaderCocoa.mm: (WebCore::createFragmentForImageAttachment): (WebCore::replaceRichContentWithAttachments): (WebCore::createFragmentAndAddResources): (WebCore::sanitizeMarkupWithArchive): (WebCore::WebContentReader::readImage): (WebCore::attachmentForFilePath): (WebCore::attachmentForData): * editing/markup.cpp: (WebCore::restoreAttachmentElementsInFragment): * fileapi/Blob.cpp: (WebCore::Blob::Blob): (WebCore::Blob::loadBlob): (WebCore::Blob::activeDOMObjectName const): * fileapi/Blob.h: (WebCore::Blob::create): (WebCore::Blob::deserialize): (WebCore::Blob::slice const): * fileapi/Blob.idl: * fileapi/File.cpp: (WebCore::File::createWithRelativePath): (WebCore::File::create): (WebCore::File::File): (WebCore::File::activeDOMObjectName const): * fileapi/File.h: * fileapi/File.idl: * html/DOMFormData.cpp: (WebCore::DOMFormData::createFileEntry): * html/DirectoryFileListCreator.cpp: (WebCore::FileInformation::isolatedCopy const): (WebCore::appendDirectoryFiles): (WebCore::gatherFileInformation): (WebCore::toFileList): (WebCore::DirectoryFileListCreator::start): * html/DirectoryFileListCreator.h: * html/FileInputType.cpp: (WebCore::FileInputType::appendFormData const): (WebCore::FileInputType::filesChosen): * html/HTMLAttachmentElement.cpp: (WebCore::HTMLAttachmentElement::updateEnclosingImageWithData): * html/HTMLCanvasElement.cpp: (WebCore::HTMLCanvasElement::toBlob): * testing/Internals.cpp: (WebCore::Internals::createFile): * testing/ServiceWorkerInternals.cpp: (WebCore::ServiceWorkerInternals::createOpaqueWithBlobBodyResponse): * workers/service/context/ServiceWorkerFetch.cpp: (WebCore::ServiceWorkerFetch::dispatchFetchEvent): * xml/XMLHttpRequest.cpp: (WebCore::XMLHttpRequest::createResponseBlob): 2020-08-26 Alan Coon <alancoon@apple.com> Cherry-pick r266087. rdar://problem/67836301 Implement Request/Response consuming as FormData https://bugs.webkit.org/show_bug.cgi?id=215671 Patch by Alex Christensen <achristensen@webkit.org> on 2020-08-24 Reviewed by Darin Adler. LayoutTests/imported/w3c: * web-platform-tests/fetch/api/abort/general.any-expected.txt: * web-platform-tests/fetch/api/abort/general.any.worker-expected.txt: * web-platform-tests/fetch/api/request/request-consume-empty-expected.txt: This remaining failing test now fails similarly in all browsers. * web-platform-tests/fetch/api/request/request-consume-expected.txt: * web-platform-tests/fetch/api/request/request-init-002-expected.txt: * web-platform-tests/fetch/api/response/response-consume-empty-expected.txt: This remaining failing test now fails similarly in all browsers. * web-platform-tests/fetch/api/response/response-consume-expected.txt: * web-platform-tests/fetch/api/response/response-error-from-stream-expected.txt: This change makes the formData failures in this file look like all the other failures in this file, which should be fixed together in a separate patch. * web-platform-tests/fetch/api/response/response-init-002-expected.txt: * web-platform-tests/url/urlencoded-parser.any-expected.txt: * web-platform-tests/url/urlencoded-parser.any.worker-expected.txt: * web-platform-tests/service-workers/service-worker/fetch-event-respond-with-custom-response.https-expected.txt: Source/WebCore: Covered by many newly passing WPT tests, for most of which Safari was the only failing browser. * Modules/fetch/FetchBody.cpp: (WebCore::FetchBody::formData): (WebCore::FetchBody::consume): (WebCore::FetchBody::consumeFormData): * Modules/fetch/FetchBody.h: * Modules/fetch/FetchBodyConsumer.cpp: (WebCore::formDataFromData): (WebCore::resolveWithTypeAndData): (WebCore::FetchBodyConsumer::resolve): * Modules/fetch/FetchBodyConsumer.h: Source/WebKit: * WebProcess/Storage/WebServiceWorkerFetchTaskClient.cpp: (WebKit::WebServiceWorkerFetchTaskClient::didReceiveFormDataAndFinish): Add a fast path that allows non-blob FormData responses from service workers to not hang. This part is covered by this layout test: imported/w3c/web-platform-tests/service-workers/service-worker/fetch-event-respond-with-custom-response.https.html Source/WTF: In order to be compatible with other browsers, we need a verson of String::fromUTF8 that uses U8_NEXT_OR_FFFD instead of U8_NEXT, but changing that across the board will break other things. Leave everything else as it is, use templates and constexpr to not add any branches, but add String::fromUTF8ReplacingInvalidSequences to allow me to make our FormData consuming compatible with other browsers. * wtf/text/WTFString.cpp: (WTF::fromUTF8Helper): (WTF::String::fromUTF8): (WTF::String::fromUTF8ReplacingInvalidSequences): * wtf/text/WTFString.h: * wtf/unicode/UTF8Conversion.cpp: (WTF::Unicode::convertUTF8ToUTF16Impl): (WTF::Unicode::convertUTF8ToUTF16): (WTF::Unicode::convertUTF8ToUTF16ReplacingInvalidSequences): * wtf/unicode/UTF8Conversion.h: git-svn-id: https://svn.webkit.org/repository/webkit/trunk@266087 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-08-24 Alex Christensen <achristensen@webkit.org> Implement Request/Response consuming as FormData https://bugs.webkit.org/show_bug.cgi?id=215671 Reviewed by Darin Adler. Covered by many newly passing WPT tests, for most of which Safari was the only failing browser. * Modules/fetch/FetchBody.cpp: (WebCore::FetchBody::formData): (WebCore::FetchBody::consume): (WebCore::FetchBody::consumeFormData): * Modules/fetch/FetchBody.h: * Modules/fetch/FetchBodyConsumer.cpp: (WebCore::formDataFromData): (WebCore::resolveWithTypeAndData): (WebCore::FetchBodyConsumer::resolve): * Modules/fetch/FetchBodyConsumer.h: 2020-08-26 Alan Coon <alancoon@apple.com> Cherry-pick r266176. rdar://problem/67836292 [Mac,EME] Netflix.com shows HDCP error for all streams https://bugs.webkit.org/show_bug.cgi?id=215825 Reviewed by Eric Carlson. New API added to AVContentKeySession hits a sandbox restriction when run in the WebContent process, and the default behavior when an error checking HDCP status is to report that the output is restricted, regardless of the displays actual capabilities. To work around this behavior for now, pass in an empty displayID array, rather than the actual displayID. This causes AVFoundation to do a "lowest common level of support" rather than a specific display check. The upside is that this call no longer requires a connection to the WindowServer. The downside is that the AVContentKeyRequest will report that its output is restricted if any non-HDCP compliant display is attached. * WebCore.xcodeproj/project.pbxproj: * platform/graphics/avfoundation/objc/CDMInstanceFairPlayStreamingAVFObjC.h: * platform/graphics/avfoundation/objc/CDMInstanceFairPlayStreamingAVFObjC.mm: (WebCore::CDMInstanceSessionFairPlayStreamingAVFObjC::keyStatuses const): (WebCore::CDMInstanceSessionFairPlayStreamingAVFObjC::keyRequestHasInsufficientProtectionForDisplayID const): (WebCore::CDMInstanceSessionFairPlayStreamingAVFObjC::updateProtectionStatusForDisplayID): git-svn-id: https://svn.webkit.org/repository/webkit/trunk@266176 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-08-26 Jer Noble <jer.noble@apple.com> [Mac,EME] Netflix.com shows HDCP error for all streams https://bugs.webkit.org/show_bug.cgi?id=215825 Reviewed by Eric Carlson. New API added to AVContentKeySession hits a sandbox restriction when run in the WebContent process, and the default behavior when an error checking HDCP status is to report that the output is restricted, regardless of the displays actual capabilities. To work around this behavior for now, pass in an empty displayID array, rather than the actual displayID. This causes AVFoundation to do a "lowest common level of support" rather than a specific display check. The upside is that this call no longer requires a connection to the WindowServer. The downside is that the AVContentKeyRequest will report that its output is restricted if any non-HDCP compliant display is attached. * WebCore.xcodeproj/project.pbxproj: * platform/graphics/avfoundation/objc/CDMInstanceFairPlayStreamingAVFObjC.h: * platform/graphics/avfoundation/objc/CDMInstanceFairPlayStreamingAVFObjC.mm: (WebCore::CDMInstanceSessionFairPlayStreamingAVFObjC::keyStatuses const): (WebCore::CDMInstanceSessionFairPlayStreamingAVFObjC::keyRequestHasInsufficientProtectionForDisplayID const): (WebCore::CDMInstanceSessionFairPlayStreamingAVFObjC::updateProtectionStatusForDisplayID): 2020-08-21 Simon Fraser <simon.fraser@apple.com> Add some FIXMEs in the EventHandler wheel event handling code for all the things that are wrong https://bugs.webkit.org/show_bug.cgi?id=215741 Reviewed by Wenson Hsieh. There is much confusing code here. Trying to document the issues I've found. * page/EventHandler.cpp: (WebCore::EventHandler::handleWheelEvent): * page/mac/EventHandlerMac.mm: (WebCore::findEnclosingScrollableContainer): (WebCore::EventHandler::determineWheelEventTarget): (WebCore::EventHandler::processWheelEventForScrolling): * page/scrolling/mac/ScrollingCoordinatorMac.mm: (WebCore::ScrollingCoordinatorMac::handleWheelEvent): 2020-08-21 Rob Buis <rbuis@igalia.com> Merge two DOMURL constructors https://bugs.webkit.org/show_bug.cgi?id=215734 Reviewed by Darin Adler. Merge two DOMURL constructors to make it match the relevant WebIDL: https://url.spec.whatwg.org/#dom-url-url-url-base-base * html/DOMURL.cpp: (WebCore::DOMURL::create): * html/DOMURL.h: * html/DOMURL.idl: 2020-08-21 Kimmo Kinnunen <kkinnunen@apple.com> Fix USE_ANGLE=0 build after "WebGLLayer clobbers TEXTURE_2D binding on iOS" https://bugs.webkit.org/show_bug.cgi?id=211758 Reviewed by Kenneth Russell. No new tests, build fix. * html/canvas/WebGL2RenderingContext.cpp: (WebCore::WebGL2RenderingContext::getUniformIndices): Mark parameters unused when USE_ANGLE=0 * platform/graphics/cocoa/WebGLLayer.mm: Define scoped binding restorer only for USE_ANGLE=1, since it's not used otherwise and it is implemented in terms of ANGLE gl::... API. * platform/graphics/opengl/GraphicsContextGLOpenGLBase.cpp: Include Logging.h to make RELEASE_LOG(WebGL, ...) work. Presumably this file is not compiled with USE_ANGLE=1 or the unified build mechanism hides the error. 2020-08-21 Andres Gonzalez <andresg_22@apple.com> Range::contains does not work correctly when the common ancestor node is a Document. https://bugs.webkit.org/show_bug.cgi?id=215714 Reviewed by Darin Adler. Test: accessibility/mac/selected-visible-position-range.html. For a Range with a Document object as common ancestor, Range::contains(otherRange) would return false for any given other range in the same document. This causes problems in VoiceOver navigation and Braille functionality in the MacOS Mail.app. * accessibility/AccessibilityRenderObject.cpp: (WebCore::AccessibilityRenderObject::setSelectedVisiblePositionRange const): Use SimpleRange::isNull instead of repeating its implementation. * dom/Range.cpp: (WebCore::Range::contains const): Compare the Documents of the ranges' common ancesstor nodes instead of their ownerDocuments. 2020-08-20 Carlos Garcia Campos <cgarcia@igalia.com> [GTK][WPE] Debug crashes in backdrop filter tests https://bugs.webkit.org/show_bug.cgi?id=215209 Reviewed by Adrian Perez de Castro. This only happens in WKTR because RenderLayerCompositor::flushPendingLayerChanges() is called from RenderLayerCompositor::layerTreeAsText(), so the coordinator doesn't know layers are being flushed and we don't return early from notifyFlushRequired(). We don't really need to have a coordinator associated to the backdrop layer, we just need to attach the layer to the coordinator to ensure it's updated. * platform/graphics/nicosia/NicosiaAnimation.cpp: (Nicosia::Animation::applyInternal): Handle AnimatedPropertyWebkitBackdropFilter. * platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp: (WebCore::CoordinatedGraphicsLayer::~CoordinatedGraphicsLayer): Detach also the backdrop layer. (WebCore::CoordinatedGraphicsLayer::flushCompositingStateForThisLayerOnly): Attach the backdrop layer to the coordinator if there's one. (WebCore::CoordinatedGraphicsLayer::syncPendingStateChangesIncludingSubLayers): Do not call this for the backdrop layer. (WebCore::CoordinatedGraphicsLayer::invalidateCoordinator): Set coordinator to nullptr. (WebCore::CoordinatedGraphicsLayer::setCoordinatorIncludingSubLayersIfNeeded): Set the coordinator and attach the layer. Also attach the backdrop layer. (WebCore::CoordinatedGraphicsLayer::setCoordinator): Deleted. * platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.h: 2020-08-20 Wenson Hsieh <wenson_hsieh@apple.com> REGRESSION (r263729): Carousel freezes on "fourth page"/fourth click on right arrow on netflix.com https://bugs.webkit.org/show_bug.cgi?id=215655 <rdar://problem/65845979> Reviewed by Dean Jackson. On netflix.com, when clicking on the left and right arrows in each movie or TV show carousel, the page attempts to animate to the next page of the carousel using a CSS transform transition. The logic applies `transform` and `transition` CSS properties to a container `div`, and adds a `transitionend` event listener which the page expects to be invoked when the animation is complete. While waiting for this `transitionend` event, the script also sets a boolean flag that prevents the carousel from being advanced to any other page. However, after the changes in r263729, the carousel gets into a state where `transition` and `transform` styles are set, but the animation never begins, and thus, no subsequent `transitionend` event is observed. This causes the page to believe that the carousel is indefinitely animating, so it never unsets the boolean flag, which results in the carousel being permanently stuck. This occurs because we now have logic in `AnimationTimeline::updateCSSTransitionsForElementAndProperty` that moves the `CSSTransition` from the element's map of running transitions to the map of completed transitions in the case where the corresponding `WebAnimation` is already in `Finished` state. However, consider the case where there is no matching backing animation (i.e. `matchingBackingAnimation` is `nullptr`); for instance, this can happen if the transition CSS property is set to none in the middle of the `transitionend` event, as demonstrated in the new layout test. Before the change, we would've removed the `CSSTransition` from the map of running transitions and canceled it, but now, we instead move it to the map of completed transitions, where it remains until the next CSS transition update is triggered (which would potentially be indefinitely long!). On netflix.com, this next CSS transition update happens the page attempts to advance the carousel. Since the old `CSSTransition` is still in the "completed" transitions map, we end up returning `true` when checking `propertyInStyleMatchesValueForTransitionInMap`, and consequently never attempt to create a new `CSSTransition` and add it to the map of running transitions in step 1 of the algorithm. As described above, this causes the carousel to get stuck in a bad state. To fix this, we simply revert to pre-r263729 behavior in the case where the matching backing animation was already removed, and allow step 3 of the algorithm to cancel the running animation and remove it altogether instead of moving it into the element's completed transitions map. Test: animations/animation-followed-by-two-transitions.html * animation/AnimationTimeline.cpp: (WebCore::AnimationTimeline::updateCSSTransitionsForElementAndProperty): 2020-08-20 Chris Dumez <cdumez@apple.com> AudioBufferSourceNode should use "final" values for playbackRate and detune https://bugs.webkit.org/show_bug.cgi?id=215669 Reviewed by Eric Carlson. AudioBufferSourceNode should use "final" values for playbackRate and detune to take into account changes to the AudioParamTimeline (for example, when AudioBufferSourceNode.playbackRate.setValueAtTime() is called). No new tests, rebaselined existing test. * Modules/webaudio/AudioBufferSourceNode.cpp: (WebCore::AudioBufferSourceNode::totalPitchRate): 2020-08-20 Chris Dumez <cdumez@apple.com> AudioParam.automationRate attribute is missing https://bugs.webkit.org/show_bug.cgi?id=215710 Reviewed by Darin Adler. Add initial support for AudioParam.automationRate: - https://www.w3.org/TR/webaudio/#dom-audioparam-automationrate No new tests, rebaselined existing tests. * Modules/webaudio/AudioBufferSourceNode.cpp: (WebCore::AudioBufferSourceNode::AudioBufferSourceNode): * Modules/webaudio/AudioListener.cpp: (WebCore::AudioListener::AudioListener): * Modules/webaudio/AudioParam.cpp: (WebCore::AudioParam::AudioParam): (WebCore::AudioParam::setAutomationRate): (WebCore::AudioParam::calculateSampleAccurateValues): * Modules/webaudio/AudioParam.h: * Modules/webaudio/AudioParam.idl: * Modules/webaudio/BiquadDSPKernel.cpp: (WebCore::BiquadDSPKernel::updateCoefficientsIfNecessary): * Modules/webaudio/BiquadProcessor.cpp: (WebCore::BiquadProcessor::BiquadProcessor): * Modules/webaudio/ConstantSourceNode.cpp: (WebCore::ConstantSourceNode::ConstantSourceNode): (WebCore::ConstantSourceNode::process): * Modules/webaudio/DelayDSPKernel.cpp: (WebCore::DelayDSPKernel::process): * Modules/webaudio/DelayProcessor.cpp: (WebCore::DelayProcessor::DelayProcessor): * Modules/webaudio/DynamicsCompressorNode.cpp: (WebCore::DynamicsCompressorNode::DynamicsCompressorNode): * Modules/webaudio/GainNode.cpp: (WebCore::GainNode::GainNode): (WebCore::GainNode::process): * Modules/webaudio/OscillatorNode.cpp: (WebCore::OscillatorNode::OscillatorNode): (WebCore::OscillatorNode::calculateSampleAccuratePhaseIncrements): * Modules/webaudio/PannerNode.cpp: (WebCore::PannerNode::PannerNode): (WebCore::PannerNode::distanceConeGain): * Modules/webaudio/PannerNode.h: * Modules/webaudio/StereoPannerNode.cpp: (WebCore::StereoPannerNode::StereoPannerNode): (WebCore::StereoPannerNode::process): * Modules/webaudio/WebKitAudioBufferSourceNode.h: * Modules/webaudio/WebKitAudioPannerNode.cpp: (WebCore::WebKitAudioPannerNode::WebKitAudioPannerNode): (WebCore::WebKitAudioPannerNode::distanceConeGain): * Modules/webaudio/WebKitAudioPannerNode.h: * Modules/webaudio/WebKitDynamicsCompressorNode.h: 2020-08-20 Kenneth Russell <kbr@chromium.org> [WebGL2] Pass context-lost-restored.html test https://bugs.webkit.org/show_bug.cgi?id=215599 Reviewed by Dean Jackson. Support losing extensions, and restoring them via WEBGL_lose_context. Necessarily changed WebGLExtensions to be RefCounted rather than managed via unique_ptr. Multiple instances of the same WebGLExtension subclass can now be vended from a WebGL rendering context, and WebGLExtensions can now outlive their rendering context - they do not ref their context. Extensions now hold a weak pointer to their WebGLRenderingContextBase rather than a C++ reference. When an extension's parent context is lost, that pointer is nulled out. Extensions are forcibly lost upon WebGL context destruction. WebGL extensions' IDLs still use GenerateIsReachable=ImplWebGLRenderingContext, so that if the context is still alive, the JavaScript wrappers for the extension objects will be preserved. (If the extension is lost, the bindings will fetch nullptr for the context, which won't be in the opaque root set, so the JavaScript wrapper won't be artificially kept alive.) Covered by existing WebGL conformance tests. * html/canvas/ANGLEInstancedArrays.cpp: (WebCore::ANGLEInstancedArrays::drawArraysInstancedANGLE): (WebCore::ANGLEInstancedArrays::drawElementsInstancedANGLE): (WebCore::ANGLEInstancedArrays::vertexAttribDivisorANGLE): * html/canvas/OESVertexArrayObject.cpp: (WebCore::OESVertexArrayObject::createVertexArrayOES): (WebCore::OESVertexArrayObject::deleteVertexArrayOES): (WebCore::OESVertexArrayObject::isVertexArrayOES): (WebCore::OESVertexArrayObject::bindVertexArrayOES): * html/canvas/WebGL2RenderingContext.cpp: (WebCore::WebGL2RenderingContext::getExtension): * html/canvas/WebGLDebugShaders.cpp: (WebCore::WebGLDebugShaders::getTranslatedShaderSource): * html/canvas/WebGLDrawBuffers.cpp: (WebCore::WebGLDrawBuffers::drawBuffersWEBGL): * html/canvas/WebGLExtension.cpp: (WebCore::WebGLExtension::WebGLExtension): (WebCore::WebGLExtension::loseParentContext): * html/canvas/WebGLExtension.h: (WebCore::WebGLExtension::context): (WebCore::WebGLExtension::isLost): (WebCore::WebGLExtension::ref): Deleted. (WebCore::WebGLExtension::deref): Deleted. * html/canvas/WebGLLoseContext.cpp: (WebCore::WebGLLoseContext::loseContext): (WebCore::WebGLLoseContext::restoreContext): (WebCore::WebGLLoseContext::loseParentContext): * html/canvas/WebGLLoseContext.h: * html/canvas/WebGLRenderingContext.cpp: (WebCore::WebGLRenderingContext::getExtension): * html/canvas/WebGLRenderingContextBase.cpp: (WebCore::WebGLRenderingContextBase::~WebGLRenderingContextBase): (WebCore::WebGLRenderingContextBase::loseContextImpl): (WebCore::WebGLRenderingContextBase::loseExtensions): * html/canvas/WebGLRenderingContextBase.h: 2020-08-20 Aditya Keerthi <akeerthi@apple.com> Add runtime setting for editable components in date/time inputs https://bugs.webkit.org/show_bug.cgi?id=215705 Reviewed by Wenson Hsieh. This setting controls the ability to edit individual components of date and time input types. For example, <input type=date> will have three editable components - year, month, and day. * page/Settings.yaml: 2020-08-20 Rob Buis <rbuis@igalia.com> XMLHttpRequest.open should use USVString https://bugs.webkit.org/show_bug.cgi?id=215704 Reviewed by Chris Dumez. XMLHttpRequest.open should use USVString as mentioned in the FIXMEs and the spec [1]. Test: imported/w3c/web-platform-tests/xhr/open-url-encoding.html [1] https://xhr.spec.whatwg.org/#ref-for-dom-xmlhttprequest-open * xml/XMLHttpRequest.idl: 2020-08-20 Clark Wang <clark_wang@apple.com> Introduce StereoPannerNode Interface https://bugs.webkit.org/show_bug.cgi?id=215518 Reviewed by Darin Adler. Added StereoPannerNode according to spec: https://www.w3.org/TR/webaudio/#stereopannernode. Used Chromium implementation for guidance: https://source.chromium.org/chromium/chromium/src/ +/master:third_party/blink/renderer/modules/webaudio/stereo_panner_node.cc. Added in StereoPannerOptions and StereoPanner files as well. The latter used Chromium implementation for guidance: https://source.chromium.org/chromium/chromium/src/+ /master:third_party/blink/renderer/platform/audio/stereo_panner.cc Re-baselined existing tests. Some now fail due to missing automation rate. * CMakeLists.txt: * DerivedSources-input.xcfilelist: * DerivedSources-output.xcfilelist: * DerivedSources.make: * Modules/webaudio/AudioNode.cpp: (WebCore::convertEnumerationToString): * Modules/webaudio/AudioNode.h: * Modules/webaudio/BaseAudioContext.cpp: (WebCore::BaseAudioContext::createStereoPanner): * Modules/webaudio/BaseAudioContext.h: * Modules/webaudio/BaseAudioContext.idl: * Modules/webaudio/StereoPannerNode.cpp: Added. (WebCore::StereoPannerNode::create): (WebCore::StereoPannerNode::StereoPannerNode): (WebCore::StereoPannerNode::~StereoPannerNode): (WebCore::StereoPannerNode::process): (WebCore::StereoPannerNode::initialize): (WebCore::StereoPannerNode::uninitialize): (WebCore::StereoPannerNode::listener): (WebCore::StereoPannerNode::setChannelCount): (WebCore::StereoPannerNode::setChannelCountMode): * Modules/webaudio/StereoPannerNode.h: Added. * Modules/webaudio/StereoPannerNode.idl: Added. * Modules/webaudio/StereoPannerOptions.h: Added. * Modules/webaudio/StereoPannerOptions.idl: Added. * Sources.txt: * WebCore.xcodeproj/project.pbxproj: * bindings/js/WebCoreBuiltinNames.h: * platform/audio/StereoPanner.cpp: Added. (WebCore::StereoPanner::create): (WebCore::StereoPanner::StereoPanner): (WebCore::StereoPanner::panWithSampleAccurateValues): (WebCore::StereoPanner::panToTargetValue): * platform/audio/StereoPanner.h: Added. (WebCore::StereoPanner::~StereoPanner): * platform/graphics/cocoa/SourceBufferParserWebM.cpp: 2020-08-20 Sergio Villar Senin <svillar@igalia.com> Unreviewed, reverting r265850. Tests crash on debug builds Reverted changeset: "[WebXR] Make "in parallel" code run really in parallel" https://bugs.webkit.org/show_bug.cgi?id=215642 https://trac.webkit.org/changeset/265850 2020-08-20 Chris Dumez <cdumez@apple.com> Sandbox violation when calling [NSHTTPCookieStorage sharedHTTPCookieStorage] from the WebProcess https://bugs.webkit.org/show_bug.cgi?id=215701 <rdar://problem/67069826> Reviewed by Geoffrey Garen. The sandbox does not allow calling [NSHTTPCookieStorage sharedHTTPCookieStorage] from the WebProcess. createPrivateStorageSession() was calling [NSHTTPCookieStorage sharedHTTPCookieStorage] to retrieve the cookieAcceptPolicy and createPrivateStorageSession() is used by the cookie cache in the WebProcess. To address the issue, we now allow the caller of createPrivateStorageSession() to provide the cookieAcceptPolicy and we have the cookie cache retrieve the cookieAcceptPolicy from the NetworkProcessConnection. * platform/network/NetworkStorageSession.h: * platform/network/cf/NetworkStorageSessionCFNetWin.cpp: (WebCore::createPrivateStorageSession): * platform/network/cocoa/NetworkStorageSessionCocoa.mm: (WebCore::createPrivateStorageSession): 2020-08-19 Kate Cheney <katherine_cheney@apple.com> Third party domains are not stored in the case of back/forward navigations https://bugs.webkit.org/show_bug.cgi?id=215595 <rdar://problem/66642893> Reviewed by Chris Dumez. Add a FrameLoaderClient function to store loaded third party domains in a CachedPage in the case of back/forward navigations. * history/CachedPage.cpp: (WebCore::CachedPage::CachedPage): (WebCore::CachedPage::restore): (WebCore::CachedPage::clear): * history/CachedPage.h: * loader/FrameLoaderClient.h: 2020-08-19 Chris Dumez <cdumez@apple.com> Blob is missing text() & arrayBuffer() operations https://bugs.webkit.org/show_bug.cgi?id=215663 Reviewed by Geoff Garen. Implementation support for Blob.text() & Blob.arrayBuffer() as per specification: - https://w3c.github.io/FileAPI/#blob-section The implementation relies on the pre-existing BlobLoader class but the following changes were made: - Stop calling start() in the BlobLoader constructor and have the caller call start() explicitly after constructing the BlobLoader. This is important because the load may fail synchronously in some cases. - Add support for reading Blob as text. Previously, BlobLoader would only support reading the blob as an ArrayBuffer. - Use a CompletionHandler instead of a Function and make sure that it is always called. No new tests, rebaselined existing tests. * fileapi/Blob.cpp: (WebCore::Blob::~Blob): (WebCore::Blob::loadBlob): (WebCore::Blob::text): (WebCore::Blob::arrayBuffer): * fileapi/Blob.h: * fileapi/Blob.idl: * fileapi/BlobLoader.h: (WebCore::BlobLoader::BlobLoader): (WebCore::BlobLoader::~BlobLoader): (WebCore::BlobLoader::cancel): (WebCore::BlobLoader::start): (WebCore::BlobLoader::didFinishLoading): (WebCore::BlobLoader::didFail): (WebCore::BlobLoader::complete): Deleted. * fileapi/NetworkSendQueue.cpp: (WebCore::NetworkSendQueue::enqueue): (WebCore::NetworkSendQueue::clear): (WebCore::NetworkSendQueue::processMessages): * page/ShareDataReader.cpp: (WebCore::ShareDataReader::start): (WebCore::ShareDataReader::didFinishLoading): (WebCore::ShareDataReader::cancel): 2020-08-19 Alexey Shvayka <shvaikalesh@gmail.com> Introduce OpIsCallable bytecode and intrinsic https://bugs.webkit.org/show_bug.cgi?id=215572 Reviewed by Ross Kirsling and Saam Barati. No new tests, no behavior change. * bindings/js/JSDOMWindowCustom.cpp: (WebCore::JSDOMWindow::openDatabase const): 2020-08-19 Peng Liu <peng.liu6@apple.com> A PiP window is closed when the video element is removed from DOM https://bugs.webkit.org/show_bug.cgi?id=215594 Reviewed by Eric Carlson. Test: media/remove-video-element-in-pip-from-document.html * html/HTMLMediaElement.cpp: (WebCore::HTMLMediaElement::pauseAfterDetachedTask): When a video is playing in the picture-in-picture mode, do not pause it or exit the picture-in-picture mode when detaching the video element from the DOM. (WebCore::HTMLMediaElement::mediaPlayerRenderingCanBeAccelerated): Always return true when the video is playing in the picture-in-picture mode. * rendering/RenderVideo.cpp: (WebCore::RenderVideo::willBeDestroyed): Don't hide the player when destroying the renderer of an inline video. 2020-08-19 Wenson Hsieh <wenson_hsieh@apple.com> [iOS] Restore a 10_15_* user-agent string when requesting desktop site https://bugs.webkit.org/show_bug.cgi?id=215657 <rdar://problem/67376157> Reviewed by Tim Horton. Reporting a major version of `11_0` causes numerous compatibility issues on websites that attempt to parse major and minor versions from the user agent string. This partially reverts r263970, and replaces the string with `10_15_6`, which matches the UA string of the latest shipped macOS version. * platform/ios/UserAgentIOS.mm: (WebCore::standardUserAgentWithApplicationName): 2020-08-18 Ryosuke Niwa <rniwa@webkit.org> REGRESSION(r265092): delegatesFocus causes WebKit to crash https://bugs.webkit.org/show_bug.cgi?id=215622 Reviewed by Youenn Fablet. The bug was caused by a missing nullptr check. Added it. Test: fast/shadow-dom/delegates-focus-unsuccessfully-by-activation.html * page/EventHandler.cpp: (WebCore::EventHandler::dispatchMouseEvent): Added a nullptr check. 2020-08-19 Aditya Keerthi <akeerthi@apple.com> Remove use of ControlSize in ThemeMac https://bugs.webkit.org/show_bug.cgi?id=215651 Reviewed by Sam Weinig. ThemeMac contains incorrectly mixes the use of Carbon's ControlSize and AppKit's NSControlSize. This inconsistency went unnoticed as ControlSize is a UInt16, and NSControlSize is an NSUInteger. No new tests as there is no change in behavior. * platform/mac/ThemeMac.mm: (WebCore::controlSizeFromPixelSize): This method always returns an NSControlSize, but it's declared return type is a ControlSize. Correct the declared return type. (WebCore::setControlSize): (WebCore::paintStepper): (WebCore::ThemeMac::inflateControlPaintRect const): 2020-08-19 Aditya Keerthi <akeerthi@apple.com> [macOS] Move stepper painting code off of Carbon API https://bugs.webkit.org/show_bug.cgi?id=215619 <rdar://problem/41936617> Reviewed by Darin Adler. Use CoreUI and AppKit SPI to paint steppers. There are two benefits to this new approach. 1. The stepper now has an appropriate appearance in dark mode. 2. We move away from using the outdated Carbon API. Note that we still cannot use NSStepperCell to paint steppers, since it is not possible to draw one with the up button highlighted. However, the approach used in this patch is shared by NSStepperCell. Test: fast/forms/number/number-dark-appearance.html * platform/mac/ThemeMac.mm: (WebCore::paintStepper): 2020-08-19 Lauro Moura <lmoura@igalia.com> [WebXR] Remove uneeded assert Rubber-stamped by Sergio Villar Senin context being a Document is tracked by the downcast when capturing. Fixes debug build error complaining about not capturing context. Covered by existing tests. * Modules/webxr/WebXRSession.cpp: (WebCore::WebXRSession::requestReferenceSpace): 2020-08-17 Sergio Villar Senin <svillar@igalia.com> [css-flexbox] min-height:auto not updated after an image loads when the image has a specified height and width. https://bugs.webkit.org/show_bug.cgi?id=210475 Reviewed by Javier Fernandez. The flex layout algorithm needs the item's intrinsic size even if it has a specified size, that's why the flex item size should be recomputed in the event of changes in its intrinsic size. * rendering/RenderReplaced.cpp: (WebCore::RenderReplaced::setNeedsLayoutIfNeededAfterIntrinsicSizeChange): set the needs layout flag also for replaced elements which happen to be flex items. 2020-08-17 Sergio Villar Senin <svillar@igalia.com> [css-flexbox] Apply aspect ratios when computing flex-basis https://bugs.webkit.org/show_bug.cgi?id=215570 Reviewed by Javier Fernandez. Aspect ratios (clamped by min/max restrictions) should be considered when computing flex-basis. Based on Blink's crrev.com/c/1525444 & crrev.com/c/1672014 by <cbiesinger@chromium.org> * rendering/RenderFlexibleBox.cpp: (WebCore::RenderFlexibleBox::computeInnerFlexBaseSizeForChild): 2020-08-19 Youenn Fablet <youenn@apple.com> Optimise resolution of promises with values in ReadableStream implementation https://bugs.webkit.org/show_bug.cgi?id=215557 <rdar://problem/66828616> Reviewed by Yusuke Suzuki. Instead of going through the slow @Promise.@resolve, we can directly use @fulfillPromise which is faster. To make things consistent, we move from @newPromiseCapability to @newPromise. Test: streams/readableStream-then.html * Modules/streams/ReadableByteStreamInternals.js: (readableByteStreamControllerPull): (readableStreamFulfillReadIntoRequest): (readableByteStreamControllerPullInto): * Modules/streams/ReadableStreamInternals.js: (readableStreamDefaultControllerPull): (readableStreamClose): (readableStreamFulfillReadRequest): (readableStreamDefaultReaderRead): * Modules/streams/StreamInternals.js: (createFulfilledPromise): 2020-08-18 Sergio Villar Senin <svillar@igalia.com> <button> should support display:inline-grid/grid/inline-flex/flex correctly https://bugs.webkit.org/show_bug.cgi?id=209656 Reviewed by Javier Fernandez. Button elements with display type (inline-) flex or grid should be laid out as their display type states and not as buttons. That's mentioned in the HTML spec here https://html.spec.whatwg.org/multipage/rendering.html#button-layout. * html/HTMLButtonElement.cpp: (WebCore::HTMLButtonElement::createElementRenderer): let HTMLFormControlElement create a renderer instead of using a RenderButton whenever display is (inline-)grid/flex. 2020-08-19 Sergio Villar Senin <svillar@igalia.com> [WebXR] Make "in parallel" code run really in parallel https://bugs.webkit.org/show_bug.cgi?id=215642 Reviewed by Carlos Garcia Campos. As the HTML spec mentions https://html.spec.whatwg.org/multipage/infrastructure.html#in-parallel "in parallel" means that the task should be run in parallel to the event loop using any available mechanism (threads, processess...). We were instead queueing those tasks to be run in the main thread causing freezes while initializing the whole OpenXR machinery. * Modules/webxr/WebXRSession.cpp: (WebCore::WebXRSession::WebXRSession): create a WorkQueue. (WebCore::WebXRSession::requestReferenceSpace): Dispatch to the work queue. * Modules/webxr/WebXRSession.h: * Modules/webxr/WebXRSystem.cpp: (WebCore::WebXRSystem::WebXRSystem): create a WorkQueue. (WebCore::WebXRSystem::isSessionSupported): Dispatch to the work queue. (WebCore::WebXRSystem::requestSession): Ditto. * Modules/webxr/WebXRSystem.h: 2020-08-18 Chris Dumez <cdumez@apple.com> AudioBuffer.duration should use double precision https://bugs.webkit.org/show_bug.cgi?id=215632 Reviewed by Darin Adler. AudioBuffer.duration should use double precision: - https://www.w3.org/TR/webaudio/#AudioBuffer No new tests, rebaselined existing test. * Modules/webaudio/AudioBuffer.h: (WebCore::AudioBuffer::duration const): * Modules/webaudio/AudioBuffer.idl: 2020-08-18 Ryosuke Niwa <rniwa@webkit.org> Rename replaceAllChildren to replaceAllChildrenWithNewText https://bugs.webkit.org/show_bug.cgi?id=215634 Reviewed by Darin Adler. Renamed ContainerNode::replaceAllChildren to replaceAllChildrenWithNewText and changed the type of Argument from Ref<Node>&& to const String&. * dom/ContainerNode.cpp: (WebCore::ContainerNode::replaceAllChildrenWithNewText): * dom/ContainerNode.h: * dom/Node.cpp: (WebCore::Node::setTextContent): * html/HTMLElement.cpp: (WebCore::HTMLElement::setInnerText): 2020-08-18 Andres Gonzalez <andresg_22@apple.com> Fix for accessibility/mac/aria-expanded-notifications.html in isolated tree mode. https://bugs.webkit.org/show_bug.cgi?id=215613 Reviewed by Darin Adler. Test: accessibility/mac/aria-expanded-notifications.html. Refactored AXObjectCache::handleAriaExpandedChange so that it doesn't call into AccessibilityObject to handle the notification, to then call into AXObjectCache again. The new implementation is cleaner and more straightforward. * accessibility/AXObjectCache.cpp: (WebCore::AXObjectCache::handleAriaExpandedChange): (WebCore::AXObjectCache::updateIsolatedTree): Updates the isolated tree on the row expanded/collapsed-related notifications. * accessibility/AccessibilityObject.cpp: (WebCore::AccessibilityObject::supportsRowCountChange const): Added. * accessibility/AccessibilityObject.h: * accessibility/AccessibilityObjectInterface.h: * accessibility/AccessibilityRenderObject.cpp: (WebCore::AccessibilityRenderObject::handleAriaExpandedChanged): Deleted, not needed any longer since it is handled in AXObjectCache where it should. * accessibility/AccessibilityRenderObject.h: * accessibility/isolatedtree/AXIsolatedObject.cpp: (WebCore::AXIsolatedObject::initializeAttributeData): Caches the supportsRowCountChange property. (WebCore::AXIsolatedObject::handleAriaExpandedChanged): Deleted, not needed any longer. * accessibility/isolatedtree/AXIsolatedObject.h: 2020-08-18 James Darpinian <jdarpinian@chromium.org> [WebGL2] Various parameters should be non-nullable in IDL https://bugs.webkit.org/show_bug.cgi?id=215616 Reviewed by Kenneth Russell. Fixes 5 conformance tests: conformance/misc/error-reporting.html conformance/misc/null-object-behaviour.html conformance/misc/bad-arguments-test.html conformance/textures/misc/tex-sub-image-2d-bad-args.html conformance/programs/get-active-test.html * html/canvas/WebGLRenderingContextBase.cpp: (WebCore::WebGLRenderingContextBase::attachShader): (WebCore::WebGLRenderingContextBase::bindAttribLocation): (WebCore::WebGLRenderingContextBase::compileShader): (WebCore::WebGLRenderingContextBase::detachShader): (WebCore::WebGLRenderingContextBase::getActiveAttrib): (WebCore::WebGLRenderingContextBase::getActiveUniform): (WebCore::WebGLRenderingContextBase::getAttachedShaders): (WebCore::WebGLRenderingContextBase::getAttribLocation): (WebCore::WebGLRenderingContextBase::getProgramParameter): (WebCore::WebGLRenderingContextBase::getProgramInfoLog): (WebCore::WebGLRenderingContextBase::getShaderParameter): (WebCore::WebGLRenderingContextBase::getShaderInfoLog): (WebCore::WebGLRenderingContextBase::getShaderSource): (WebCore::WebGLRenderingContextBase::getUniform): (WebCore::WebGLRenderingContextBase::getUniformLocation): (WebCore::WebGLRenderingContextBase::linkProgram): (WebCore::WebGLRenderingContextBase::shaderSource): (WebCore::WebGLRenderingContextBase::validateProgram): * html/canvas/WebGLRenderingContextBase.h: * html/canvas/WebGLRenderingContextBase.idl: * inspector/InspectorShaderProgram.cpp: (WebCore::InspectorShaderProgram::updateShader): 2020-08-18 Chris Dumez <cdumez@apple.com> PannerNode's rolloffFactor should be clamped to [0, 1] internally when distanceModel is "linear" https://bugs.webkit.org/show_bug.cgi?id=215625 Reviewed by Darin Adler. PannerNode's rolloffFactor should be clamped to [0, 1] internally when distanceModel is "linear": - https://www.w3.org/TR/webaudio/#dom-pannernode-rollofffactor No new tests, rebaselined existing test. * Modules/webaudio/PannerNode.cpp: (WebCore::PannerNode::setRolloffFactor): * platform/audio/Distance.cpp: (WebCore::DistanceEffect::linearGain): 2020-08-18 Chris Dumez <cdumez@apple.com> ScriptProcessNode should only run script asynchronously if the audio context is not an OfflineAudioContext https://bugs.webkit.org/show_bug.cgi?id=215624 Reviewed by Eric Carlson. ScriptProcessNode should only run script asynchronously if the audio context is not an OfflineAudioContext. If the context is an OfflineAudioContext, then it should pause processing until the script has finished execution. This aligns our behavior with Blink and helps us pass more WPT tests. No new tests, rebaselined existing test. * Modules/webaudio/ScriptProcessorNode.cpp: (WebCore::ScriptProcessorNode::ScriptProcessorNode): (WebCore::ScriptProcessorNode::process): 2020-08-18 Eric Carlson <eric.carlson@apple.com> [Catalyst] Video should pause automatically when switching desktops https://bugs.webkit.org/show_bug.cgi?id=215620 Reviewed by Jer Noble. * platform/audio/ios/MediaSessionManagerIOS.h: * platform/audio/ios/MediaSessionManagerIOS.mm: Don't override resetRestrictions on Catalyst so we don't pause video in the background. 2020-08-18 Kenneth Russell <kbr@chromium.org> [WebGL2] Pass user-defined-properties-on-context.html layout test https://bugs.webkit.org/show_bug.cgi?id=215433 Reviewed by Yusuke Suzuki. Keep the canvas' rendering context alive from the canvas itself by adding a custom mark function for HTMLCanvasElement, and adding a new GenerateIsReachable=ImplCanvasBase extended IDL attribute, used from all rendering context types (2D, WebGL, and WebGPU). This patch does not touch OffscreenCanvas since the implementation there seems to be incomplete and there are no associated tests of GC behavior. Tests: fast/canvas/2d.context.expando.html webgpu/expando-properties.html * Modules/webgpu/GPUCanvasContext.idl: * Sources.txt: * WebCore.xcodeproj/project.pbxproj: * bindings/js/JSHTMLCanvasElementCustom.cpp: Copied from Source/WebCore/html/canvas/WebGLRenderingContext.idl. (WebCore::JSHTMLCanvasElement::visitAdditionalChildren): * bindings/scripts/CodeGeneratorJS.pm: (GenerateImplementation): * bindings/scripts/IDLAttributes.json: * html/HTMLCanvasElement.idl: * html/canvas/WebGL2RenderingContext.idl: * html/canvas/WebGLRenderingContext.idl: 2020-08-18 Chris Dumez <cdumez@apple.com> WaveShaperNode.curve setter should create a copy of the input array https://bugs.webkit.org/show_bug.cgi?id=215615 Reviewed by Eric Carlson. WaveShaperNode.curve setter should create a copy of the input array, so that follow-up modifications of the array by the JS do not impact audio processing: - https://www.w3.org/TR/webaudio/#dom-waveshapernode-curve No new tests, rebaselined existing test. * Modules/webaudio/WaveShaperNode.cpp: (WebCore::WaveShaperNode::setCurve): 2020-08-17 Ryosuke Niwa <rniwa@webkit.org> REGRESSION(r262381): replaceChildren should not use DeferChildrenChanged::No https://bugs.webkit.org/show_bug.cgi?id=215600 Reviewed by Antti Koivisto. It's not correct to use DeferChildrenChanged::No when the new node may have an old parent. Use DeferChildrenChanged::Yes instead. * dom/ContainerNode.cpp: (WebCore::ContainerNode::replaceAllChildren): Added a release assertion to make sure people don't start using this function incorrectly in the future. (WebCore::ContainerNode::replaceChildren): Fixed the bug. 2020-08-18 Simon Fraser <simon.fraser@apple.com> Turn off wheel event regions until we need them https://bugs.webkit.org/show_bug.cgi?id=215586 Reviewed by Darin Adler. Leave ENABLE_WHEEL_EVENT_REGIONS off because it's currently unused, and adds extra region building overhead on macOS. * page/scrolling/ScrollingTree.cpp: * page/scrolling/ScrollingTree.h: * page/scrolling/mac/ScrollingTreeMac.h: * page/scrolling/mac/ScrollingTreeMac.mm: 2020-08-18 Youenn Fablet <youenn@apple.com> Update platform/mac/webrtc/captureCanvas-webrtc-software-encoder.html to account for low latency code path https://bugs.webkit.org/show_bug.cgi?id=215601 Reviewed by Eric Carlson. Covered by existing/updated test. * testing/Internals.cpp: (WebCore::Internals::supportsVCPEncoder): In case low latency code path is enabled, supportsVCPEncoder should return true. 2020-08-18 Simon Fraser <simon.fraser@apple.com> REGRESSION (Async overflow scrolling): No rubberbanding in overflow:scroll in the wheel event region https://bugs.webkit.org/show_bug.cgi?id=215598 <rdar://problem/64895442> Reviewed by Darin Adler. Scrolling in overflow:scroll inside the non-fast event region (e.g. inside an ancestor with a wheel event handler) happens via ScrollAnimatorMac::handleWheelEvent() which calls ScrollableArea::setScrollOffsetFromAnimation() which bounces to the scrolling thread via RenderLayer::requestScrollPositionUpdate(). We were clamping the scroll offset here, thus disallowing the overscrolled offsets required for rubberbanding. Fix is to allow clamping for user scrolls. Also add more logging. Test: fast/scrolling/mac/rubberband-overflow-in-wheel-region.html * dom/Element.cpp: (WebCore::Element::dispatchWheelEvent): * page/scrolling/mac/ScrollingCoordinatorMac.mm: (WebCore::ScrollingCoordinatorMac::handleWheelEvent): * platform/ScrollableArea.cpp: (WebCore::ScrollableArea::handleWheelEvent): (WebCore::ScrollableArea::setScrollOffsetFromAnimation): 2020-08-18 Chris Dumez <cdumez@apple.com> Unreviewed, null-deref fix after r265797. MockAudioDestinationCocoa::tick() is calling AudioDestinationCocoa::inputProc() with a null AudioTimeStamp struct so we need to deal with this. * platform/audio/cocoa/AudioDestinationCocoa.cpp: (WebCore::AudioDestinationCocoa::render): 2020-08-18 Antti Koivisto <antti@apple.com> The CSS specificity of :host() pseudo-classes is wrong https://bugs.webkit.org/show_bug.cgi?id=202494 <rdar://problem/66292568> Reviewed by Anders Carlsson. https://drafts.csswg.org/css-scoping/#host-selector “The specificity of :host() is that of a pseudo-class, plus the specificity of its argument.” * css/CSSSelector.cpp: (WebCore::simpleSelectorSpecificityInternal): 2020-08-18 Youenn Fablet <youenn@apple.com> Add a JS built-in routine to mark a promise as handled https://bugs.webkit.org/show_bug.cgi?id=215558 Reviewed by Darin Adler. Wrap long line of code inside a method to ease code readability. No change of behavior. * Modules/streams/ReadableStream.js: (pipeThrough): * Modules/streams/ReadableStreamInternals.js: (readableStreamError): (readableStreamReaderGenericRelease): * Modules/streams/StreamInternals.js: (markPromiseAsHandled): (shieldingPromiseResolve): * Modules/streams/WritableStreamInternals.js: (setUpWritableStreamDefaultWriter): (writableStreamRejectCloseAndClosedPromiseIfNeeded): (writableStreamDefaultWriterEnsureClosedPromiseRejected): (writableStreamDefaultWriterEnsureReadyPromiseRejected): 2020-08-17 Chris Dumez <cdumez@apple.com> AudioContext.getOutputTimestamp() is missing https://bugs.webkit.org/show_bug.cgi?id=215591 Reviewed by Darin Adler. AudioContext.getOutputTimestamp() is missing: - https://www.w3.org/TR/webaudio/#dom-audiocontext-getoutputtimestamp No new tests, rebaselined existing tests. * CMakeLists.txt: * DerivedSources-input.xcfilelist: * DerivedSources-output.xcfilelist: * DerivedSources.make: * Modules/webaudio/AudioContext.cpp: (WebCore::AudioContext::getOutputTimestamp): * Modules/webaudio/AudioContext.h: * Modules/webaudio/AudioContext.idl: * Modules/webaudio/AudioDestinationNode.cpp: (WebCore::AudioDestinationNode::render): * Modules/webaudio/AudioDestinationNode.h: * Modules/webaudio/AudioTimestamp.h: Copied from Source/WebCore/Modules/webaudio/AudioContext.h. * Modules/webaudio/AudioTimestamp.idl: Copied from Source/WebCore/Modules/webaudio/AudioContext.h. * Modules/webaudio/BaseAudioContext.cpp: (WebCore::BaseAudioContext::handlePreRenderTasks): (WebCore::BaseAudioContext::outputPosition): * Modules/webaudio/BaseAudioContext.h: * Modules/webaudio/OfflineAudioDestinationNode.cpp: (WebCore::OfflineAudioDestinationNode::offlineRender): * Sources.txt: * WebCore.xcodeproj/project.pbxproj: * platform/audio/AudioIOCallback.h: (WebCore::AudioIOPosition::encode const): (WebCore::AudioIOPosition::decode): * platform/audio/cocoa/AudioDestinationCocoa.cpp: (WebCore::machAbsoluteTimeToMonotonicTime): (WebCore::AudioDestinationCocoa::render): (WebCore::AudioDestinationCocoa::inputProc): * platform/audio/cocoa/AudioDestinationCocoa.h: 2020-08-17 Chris Dumez <cdumez@apple.com> Improve channel mixing support in AudioBus https://bugs.webkit.org/show_bug.cgi?id=215597 Reviewed by Darin Adler. Improve channel mixing support in AudioBus to match the specification: - https://www.w3.org/TR/webaudio/#channel-up-mixing-and-down-mixing Our implementation also matches Blink's: - https://github.com/chromium/chromium/blob/master/third_party/blink/renderer/platform/audio/audio_bus.cc No new tests, rebaselined existing test. * platform/audio/AudioBus.cpp: (WebCore::AudioBus::copyFrom): (WebCore::AudioBus::sumFrom): (WebCore::AudioBus::speakersSumFromByUpMixing): (WebCore::AudioBus::speakersSumFromByDownMixing): * platform/audio/AudioBus.h: 2020-08-17 Karl Rackler <rackler@apple.com> Unreviewed, reverting r265603. Reverting per commiter because commit caused consisent crash with test. Reverted changeset: "Font loads quickly followed by navigations may fail indefinitely" https://bugs.webkit.org/show_bug.cgi?id=215435 https://trac.webkit.org/changeset/265603 2020-08-17 Chris Dumez <cdumez@apple.com> AudioNode.disconnect() does not match the specification https://bugs.webkit.org/show_bug.cgi?id=215578 Reviewed by Eric Carlson. AudioNode.disconnect() did not match the specification. There were a lot of overloads in the specification that we did not support: - https://www.w3.org/TR/webaudio/#dom-audionode-disconnect No new tests, rebaselined existing tests. * Modules/webaudio/AudioBasicInspectorNode.cpp: (WebCore::AudioBasicInspectorNode::connect): Deleted. (WebCore::AudioBasicInspectorNode::disconnect): Deleted. * Modules/webaudio/AudioBasicInspectorNode.h: * Modules/webaudio/AudioNode.cpp: (WebCore::AudioNode::connect): (WebCore::AudioNode::disconnect): * Modules/webaudio/AudioNode.h: (WebCore::AudioNode::updatePullStatus): * Modules/webaudio/AudioNode.idl: * Modules/webaudio/AudioNodeOutput.h: (WebCore::AudioNodeOutput::isConnectedTo const): 2020-08-17 Chris Dumez <cdumez@apple.com> WaveShaperNode should not output silence when it has no input or when input is silence https://bugs.webkit.org/show_bug.cgi?id=215574 Reviewed by Eric Carlson. WaveShaperNode should not output silence when it has no input or when input is silence. It should still apply its curve to the silent input. No new tests, rebaselined existing test. * Modules/webaudio/AudioNode.cpp: (WebCore::AudioNode::disableOutputsIfNecessary): Do not disable the WaveShaperNode's output when its has no input. The WaveShaperNode may still provide non-silent output when it has no input. * Modules/webaudio/WaveShaperNode.cpp: (WebCore::WaveShaperNode::propagatesSilence const): * Modules/webaudio/WaveShaperNode.h: Override propagatesSilence() to return false when the WaveShaperNode has a curve to apply, so that we ask the node to process the input even when it is silence. 2020-08-17 David Kilzer <ddkilzer@apple.com> Clean up DragApplicationFlags after switch to OptionSet<> <https://webkit.org/b/215349> Reviewed by Darin Adler. Change WebCore::DragApplicationFlags to an enum class. No new tests since no change in behavior. * page/gtk/DragControllerGtk.cpp: (WebCore::DragController::isCopyKeyDown): * page/mac/DragControllerMac.mm: (WebCore::DragController::isCopyKeyDown): (WebCore::DragController::dragOperation): * platform/DragData.h: 2020-08-17 Yusuke Suzuki <ysuzuki@apple.com> JSDOMConstructorNotConstructable should be a constructor https://bugs.webkit.org/show_bug.cgi?id=215554 <rdar://problem/65770688> Reviewed by Darin Adler. Test: js/dom/window-is-constructor.html While JSDOMConstructorNotConstructable throws an error, still it should be a constructor, which means, `IsConstructor(JSDOMConstructorNotConstructable)` should be true. To fix it, we add getConstructData which configures a function throwing an error. * bindings/js/JSDOMConstructorNotConstructable.h: 2020-08-17 Youenn Fablet <youenn@apple.com> Make sure writableStreamDefaultWriterEnsureClosedPromiseRejected overwrite the closedPromise if needed https://bugs.webkit.org/show_bug.cgi?id=215540 Reviewed by Darin Adler. Covered by rebased tests. * Modules/streams/WritableStreamInternals.js: (writableStreamDefaultWriterEnsureClosedPromiseRejected): As per spec, if promise is already settled, we overwrite it to reject it. 2020-08-17 Youenn Fablet <youenn@apple.com> Check WritableStream underlyingSink methods https://bugs.webkit.org/show_bug.cgi?id=215539 Reviewed by Darin Adler. Covered by updated tests. * Modules/streams/WritableStream.js: (initializeWritableStream): 2020-08-16 Simon Fraser <simon.fraser@apple.com> Fix some spelling and editorial issues https://bugs.webkit.org/show_bug.cgi?id=215553 Reviewed by Darin Adler. "Stretches" has a t in the middle, and "padding" is singular. * inspector/InspectorOverlay.cpp: (WebCore::buildRendererHighlight): * layout/FormattingContext.cpp: (WebCore::Layout::FormattingContext::geometryForBox const): * layout/FormattingContext.h: * layout/blockformatting/BlockFormattingContextQuirks.cpp: (WebCore::Layout::BlockFormattingContext::Quirks::stretchedInFlowHeight): * layout/inlineformatting/InlineFormattingContext.cpp: (WebCore::Layout::InlineFormattingContext::layoutInFlowContent): (WebCore::Layout::InlineFormattingContext::computedIntrinsicWidthConstraints): * layout/inlineformatting/InlineLineBuilder.cpp: (WebCore::Layout::LineBuilder::adjustBaselineAndLineHeight): * layout/tableformatting/TableFormattingContext.cpp: (WebCore::Layout::TableFormattingContext::setUsedGeometryForCells): * rendering/RenderTable.cpp: (WebCore::RenderTable::convertStyleLogicalWidthToComputedWidth): * rendering/RenderTableCell.cpp: * rendering/RenderTextControlSingleLine.cpp: (WebCore::RenderTextControlSingleLine::layout): 2020-08-14 Simon Fraser <simon.fraser@apple.com> Scrolling sync changes in r261985 regressed CPU usage by ~2 ms/s https://bugs.webkit.org/show_bug.cgi?id=215529 <rdar://problem/66866163> Reviewed by Geoff Garen. r261985 added two code paths that wake up the scrolling thread on every rendering update (triggered by displayDidRefresh()). One is a ping from the EventDispatcher thread, the other is a wake-and-block from the main thread. If the scrolling thread isn't active (no wheel events received recently), we can avoid both of these to reduce the number of CPU core wakeups. * page/scrolling/ScrollingTree.cpp: (WebCore::ScrollingTree::isRecentlyActive): (WebCore::ScrollingTree::setRecentlyActive): * page/scrolling/ScrollingTree.h: * page/scrolling/ThreadedScrollingTree.cpp: (WebCore::ThreadedScrollingTree::willStartRenderingUpdate): (WebCore::ThreadedScrollingTree::displayDidRefresh): 2020-08-16 Dean Jackson <dino@apple.com> [AS Layout Tests] 6 WPT css-backgrounds tests consistently failing https://bugs.webkit.org/show_bug.cgi?id=215533 rdar://66660924 Reviewed by Youenn Fablet. A static_cast from float to int, where the float value is larger than MAX_INT, produces different results on x86_64 and arm64e. Unfortunately, fixing this exposed the fact that we were accidentally passing the tests below on Intel. This commit addresses the casting issue and marks the tests as now accurately failing. Details on the new bug at: webkit.org/b/206753 Covered by: imported/w3c/web-platform-tests/css/css-backgrounds/background-size/vector/tall--contain--height.html imported/w3c/web-platform-tests/css/css-backgrounds/background-size/vector/tall--contain--width.html imported/w3c/web-platform-tests/css/css-backgrounds/background-size/vector/wide--contain--height.html imported/w3c/web-platform-tests/css/css-backgrounds/background-size/vector/wide--contain--width.html * svg/graphics/SVGImage.cpp: (WebCore::SVGImage::containerSize const): Don't static_cast from float to int. Rather, use the explicit IntSize constructor. 2020-08-15 Andres Gonzalez <andresg_22@apple.com> Revert unnecessary change for https://bugs.webkit.org/show_bug.cgi?id=215521. https://bugs.webkit.org/show_bug.cgi?id=215541 Reviewed by Chris Fleizach. These additional checks are no longer necessary since makeSimpleRange returns a null Optional if any of the VisiblePosition parameters is null. Darin Adler already fixed the crasher in https://bugs.webkit.org/show_bug.cgi?id=215521 with the patch https://trac.webkit.org/changeset/265044/webkit. * accessibility/AXObjectCache.cpp: (WebCore::AXObjectCache::rangeMatchesTextNearRange): 2020-08-15 Youenn Fablet <youenn@apple.com> WritableStream rejected promises should be marked as handled as per spec https://bugs.webkit.org/show_bug.cgi?id=215501 Reviewed by Darin Adler. Marking promises that got rejected as handled to ensure onunhandledrejection handler is not called erroneously. Covered by rebased tests. * Modules/streams/WritableStreamInternals.js: (setUpWritableStreamDefaultWriter): (writableStreamRejectCloseAndClosedPromiseIfNeeded): (writableStreamDefaultWriterEnsureClosedPromiseRejected): (writableStreamDefaultWriterEnsureReadyPromiseRejected): 2020-08-14 Brady Eidson <beidson@apple.com> Crash inside FrameLoader::defaultRequestCachingPolicy (null DocumentLoader) <rdar://problem/42167093> and https://bugs.webkit.org/show_bug.cgi?id=215527 Reviewed by Darin Adler. We have CrashTracer data, but despite my best efforts no way of reproducing. * loader/FrameLoader.cpp: (WebCore::FrameLoader::defaultRequestCachingPolicy): If a PingLoader is sending a CSP violation report sometime after part of the Document's lifecycle, the FrameLoader as a null DocumentLoader here. Like everywhere else in FrameLoader, null check it. 2020-08-14 Zalan Bujtas <zalan@apple.com> RenderTextControlSingleLine::scroll* functions should not call Element::scroll* on the inner text content https://bugs.webkit.org/show_bug.cgi?id=215516 <rdar://problem/64739768> Reviewed by Simon Fraser. Normally the RenderBox::content*, border*, padding* and scroll* functions grab the geometry information from the renderer itself. The clients of these functions expect the geometry data to be consistent with the rest of the rendering context (e.g coordinates are in the coordinate system of the containing block, paint time operations are not applied etc). Also these functions are supposed to be const. They should not mutate the geometry or the render tree itself. Forwarding ::scroll* calls to Element::scroll* can't guarantee neither of these above. * rendering/RenderTextControlSingleLine.cpp: (WebCore::RenderTextControlSingleLine::scrollWidth const): (WebCore::RenderTextControlSingleLine::scrollHeight const): (WebCore::RenderTextControlSingleLine::scrollLeft const): (WebCore::RenderTextControlSingleLine::scrollTop const): 2020-08-14 Chris Dumez <cdumez@apple.com> OfflineAudioContext.destination has incorrect number of channels & channel count mode https://bugs.webkit.org/show_bug.cgi?id=215522 Reviewed by Eric Carlson. OfflineAudioContext.destination currently always has a number of channels that is 0, no matter the numberOfChannels provided when constructing the OfflineAudioContext. The channel count mode is also "max" instead of "explicit" (as per [1]). [1] https://www.w3.org/TR/webaudio/#AudioDestinationNode No new tests, rebaselined existing tests. * Modules/webaudio/OfflineAudioDestinationNode.cpp: (WebCore::OfflineAudioDestinationNode::OfflineAudioDestinationNode): (WebCore::OfflineAudioDestinationNode::maxChannelCount const): * Modules/webaudio/OfflineAudioDestinationNode.h: 2020-08-14 James Darpinian <jdarpinian@chromium.org> [WebGL2] releaseShaderCompiler is not allowed to be supported in WebGL https://bugs.webkit.org/show_bug.cgi?id=215432 Reviewed by Dean Jackson. Fixes WebGL conformance tests methods.html and methods-2.html * html/canvas/WebGLRenderingContextBase.cpp: (WebCore::WebGLRenderingContextBase::releaseShaderCompiler): Deleted. * html/canvas/WebGLRenderingContextBase.h: * html/canvas/WebGLRenderingContextBase.idl: * platform/graphics/angle/GraphicsContextGLANGLE.cpp: (WebCore::GraphicsContextGLOpenGL::releaseShaderCompiler): Deleted. * platform/graphics/opengl/GraphicsContextGLOpenGL.h: * platform/graphics/opengl/GraphicsContextGLOpenGLBase.cpp: (WebCore::GraphicsContextGLOpenGL::releaseShaderCompiler): Deleted. * platform/graphics/opengl/GraphicsContextGLOpenGLES.cpp: (WebCore::GraphicsContextGLOpenGL::releaseShaderCompiler): Deleted. 2020-08-14 Devin Rousso <drousso@apple.com> RTL: volume slider and icons are backwards https://bugs.webkit.org/show_bug.cgi?id=215482 <rdar://problem/65730749> Reviewed by Eric Carlson. * Modules/modern-media-controls/controls/inline-media-controls.js: (InlineMediaControls.prototype.layout): Flip the inline volume button when not in LTR. * Modules/modern-media-controls/controls/macos-fullscreen-media-controls.js: (MacOSFullscreenMediaControls.prototype.layout): (MacOSFullscreenMediaControls.prototype._volumeControlsForCurrentDirection): Added. Reverse the order of the fullscreen volume controls when not in LTR. * Modules/modern-media-controls/controls/macos-fullscreen-media-controls.css: (.media-controls.mac.fullscreen:not(.uses-ltr-user-interface-layout-direction) :is(.volume-down, .volume.slider, .volume-up)): Added. (.media-controls.mac.fullscreen:not(.uses-ltr-user-interface-layout-direction) .volume.slider): Deleted. Also flip the fullscreen volume up and volume down buttons. 2020-08-14 Kenneth Russell <kbr@chromium.org> [WebGL2] expando-loss and expando-loss-2 conformance tests are failing https://bugs.webkit.org/show_bug.cgi?id=214765 Reviewed by Yusuke Suzuki. Re-land with locking fixes ysuzuki@ pointed out as necessary, and advised heavily on. Use JSWebGLRenderingContext's and JSWebGL2RenderingContext's existing visitAdditionalChildren hook, via JSCustomMarkFunction in their IDL, to add opaque roots for all WebGLObjects latched in to the context state, and all WebGLObjects they refer to. Extensions were already previously handled. In order to support JSC's concurrent marking, grab a per-WebGL-context lock in visitAdditionalChildren, and in all WebGL context- and object-related methods which modify compound data structures like HashMaps and Vectors that are traversed by visitAdditionalChildren and its callees. Add "const AbstractLocker&" throughout WebGL's call hierarchy to guarantee that this lock is held where needed. Add needed exception in WebGLObjects' destructors to avoid recursive locking, and in WebGLContextGroup destruction to avoid mutating objects that GC might be traversing when a lock is no longer available on the application's thread. Add "GenerateIsReachable=Impl" to the IDL files of needed WebGL objects (WebGLBuffer, WebGLTexture, etc.) so that they pay attention to the opaque root state when determining liveness of their JavaScript wrappers. Add a FIXME to objectGraphLock in WebGLRenderingContextBase to consider rewriting this in a lock-free manner. Covered by existing WebGL conformance tests. * bindings/js/JSWebGL2RenderingContextCustom.cpp: (WebCore::JSWebGL2RenderingContext::visitAdditionalChildren): * bindings/js/JSWebGLRenderingContextCustom.cpp: (WebCore::JSWebGLRenderingContext::visitAdditionalChildren): * html/canvas/OESVertexArrayObject.cpp: (WebCore::OESVertexArrayObject::deleteVertexArrayOES): (WebCore::OESVertexArrayObject::bindVertexArrayOES): * html/canvas/WebGL2RenderingContext.cpp: (WebCore::WebGL2RenderingContext::validateAndCacheBufferBinding): (WebCore::WebGL2RenderingContext::bindFramebuffer): (WebCore::WebGL2RenderingContext::deleteFramebuffer): (WebCore::WebGL2RenderingContext::deleteQuery): (WebCore::WebGL2RenderingContext::beginQuery): (WebCore::WebGL2RenderingContext::endQuery): (WebCore::WebGL2RenderingContext::deleteSampler): (WebCore::WebGL2RenderingContext::bindSampler): (WebCore::WebGL2RenderingContext::deleteSync): (WebCore::WebGL2RenderingContext::deleteTransformFeedback): (WebCore::WebGL2RenderingContext::bindTransformFeedback): (WebCore::WebGL2RenderingContext::beginTransformFeedback): (WebCore::WebGL2RenderingContext::setIndexedBufferBinding): (WebCore::WebGL2RenderingContext::deleteVertexArray): (WebCore::WebGL2RenderingContext::bindVertexArray): (WebCore::WebGL2RenderingContext::addMembersToOpaqueRoots): (WebCore::WebGL2RenderingContext::uncacheDeletedBuffer): * html/canvas/WebGL2RenderingContext.h: * html/canvas/WebGLBuffer.cpp: (WebCore::WebGLBuffer::~WebGLBuffer): (WebCore::WebGLBuffer::deleteObjectImpl): * html/canvas/WebGLBuffer.h: * html/canvas/WebGLBuffer.idl: * html/canvas/WebGLContextGroup.cpp: (WebCore::WebGLContextGroup::hasAContext const): (WebCore::WebGLContextGroup::objectGraphLockForAContext): (WebCore::WebGLContextGroup::detachAndRemoveAllObjects): * html/canvas/WebGLContextGroup.h: * html/canvas/WebGLContextObject.cpp: (WebCore::WebGLContextObject::detachContext): (WebCore::WebGLContextObject::objectGraphLockForContext): * html/canvas/WebGLContextObject.h: * html/canvas/WebGLFramebuffer.cpp: (WebCore::WebGLFramebuffer::~WebGLFramebuffer): (WebCore::WebGLFramebuffer::removeAttachmentFromBoundFramebuffer): (WebCore::WebGLFramebuffer::deleteObjectImpl): (WebCore::WebGLFramebuffer::initializeAttachments): (WebCore::WebGLFramebuffer::addMembersToOpaqueRoots): (WebCore::WebGLFramebuffer::setAttachmentInternal): (WebCore::WebGLFramebuffer::removeAttachmentInternal): * html/canvas/WebGLFramebuffer.h: * html/canvas/WebGLFramebuffer.idl: * html/canvas/WebGLObject.cpp: (WebCore::WebGLObject::runDestructor): (WebCore::WebGLObject::deleteObject): * html/canvas/WebGLObject.h: * html/canvas/WebGLProgram.cpp: (WebCore::WebGLProgram::~WebGLProgram): (WebCore::WebGLProgram::deleteObjectImpl): (WebCore::WebGLProgram::attachShader): (WebCore::WebGLProgram::detachShader): (WebCore::WebGLProgram::addMembersToOpaqueRoots): * html/canvas/WebGLProgram.h: * html/canvas/WebGLProgram.idl: * html/canvas/WebGLQuery.cpp: (WebCore::WebGLQuery::~WebGLQuery): (WebCore::WebGLQuery::deleteObjectImpl): * html/canvas/WebGLQuery.h: * html/canvas/WebGLQuery.idl: * html/canvas/WebGLRenderbuffer.cpp: (WebCore::WebGLRenderbuffer::~WebGLRenderbuffer): (WebCore::WebGLRenderbuffer::deleteObjectImpl): * html/canvas/WebGLRenderbuffer.h: * html/canvas/WebGLRenderbuffer.idl: * html/canvas/WebGLRenderingContextBase.cpp: (WebCore::WebGLRenderingContextBase::attachShader): (WebCore::WebGLRenderingContextBase::validateAndCacheBufferBinding): (WebCore::WebGLRenderingContextBase::bindBuffer): (WebCore::WebGLRenderingContextBase::bindFramebuffer): (WebCore::WebGLRenderingContextBase::bindRenderbuffer): (WebCore::WebGLRenderingContextBase::bindTexture): (WebCore::WebGLRenderingContextBase::deleteObject): (WebCore::WebGLRenderingContextBase::uncacheDeletedBuffer): (WebCore::WebGLRenderingContextBase::setBoundVertexArrayObject): (WebCore::WebGLRenderingContextBase::deleteBuffer): (WebCore::WebGLRenderingContextBase::deleteFramebuffer): (WebCore::WebGLRenderingContextBase::deleteProgram): (WebCore::WebGLRenderingContextBase::deleteRenderbuffer): (WebCore::WebGLRenderingContextBase::deleteShader): (WebCore::WebGLRenderingContextBase::deleteTexture): (WebCore::WebGLRenderingContextBase::detachShader): (WebCore::WebGLRenderingContextBase::useProgram): (WebCore::WebGLRenderingContextBase::vertexAttribPointer): (WebCore::WebGLRenderingContextBase::detachAndRemoveAllObjects): (WebCore::WebGLRenderingContextBase::setFramebuffer): (WebCore::WebGLRenderingContextBase::addMembersToOpaqueRoots): (WebCore::WebGLRenderingContextBase::objectGraphLock): * html/canvas/WebGLRenderingContextBase.h: (WebCore::WebGLRenderingContextBase::setBoundVertexArrayObject): Deleted. * html/canvas/WebGLSampler.cpp: (WebCore::WebGLSampler::~WebGLSampler): (WebCore::WebGLSampler::deleteObjectImpl): * html/canvas/WebGLSampler.h: * html/canvas/WebGLSampler.idl: * html/canvas/WebGLShader.cpp: (WebCore::WebGLShader::~WebGLShader): (WebCore::WebGLShader::deleteObjectImpl): * html/canvas/WebGLShader.h: * html/canvas/WebGLShader.idl: * html/canvas/WebGLSharedObject.cpp: (WebCore::WebGLSharedObject::detachContextGroup): (WebCore::WebGLSharedObject::detachContextGroupWithoutDeletingObject): (WebCore::WebGLSharedObject::hasGroupOrContext const): (WebCore::WebGLSharedObject::objectGraphLockForContext): * html/canvas/WebGLSharedObject.h: * html/canvas/WebGLSync.cpp: (WebCore::WebGLSync::~WebGLSync): (WebCore::WebGLSync::deleteObjectImpl): * html/canvas/WebGLSync.h: * html/canvas/WebGLTexture.cpp: (WebCore::WebGLTexture::~WebGLTexture): (WebCore::WebGLTexture::deleteObjectImpl): * html/canvas/WebGLTexture.h: * html/canvas/WebGLTexture.idl: * html/canvas/WebGLTransformFeedback.cpp: (WebCore::WebGLTransformFeedback::~WebGLTransformFeedback): (WebCore::WebGLTransformFeedback::deleteObjectImpl): (WebCore::WebGLTransformFeedback::setProgram): (WebCore::WebGLTransformFeedback::setBoundIndexedTransformFeedbackBuffer): (WebCore::WebGLTransformFeedback::addMembersToOpaqueRoots): (WebCore::WebGLTransformFeedback::unbindBuffer): * html/canvas/WebGLTransformFeedback.h: * html/canvas/WebGLTransformFeedback.idl: * html/canvas/WebGLVertexArrayObject.cpp: (WebCore::WebGLVertexArrayObject::~WebGLVertexArrayObject): (WebCore::WebGLVertexArrayObject::deleteObjectImpl): * html/canvas/WebGLVertexArrayObject.h: * html/canvas/WebGLVertexArrayObject.idl: * html/canvas/WebGLVertexArrayObjectBase.cpp: (WebCore::WebGLVertexArrayObjectBase::setElementArrayBuffer): (WebCore::WebGLVertexArrayObjectBase::setVertexAttribState): (WebCore::WebGLVertexArrayObjectBase::unbindBuffer): (WebCore::WebGLVertexArrayObjectBase::addMembersToOpaqueRoots): * html/canvas/WebGLVertexArrayObjectBase.h: * html/canvas/WebGLVertexArrayObjectOES.cpp: (WebCore::WebGLVertexArrayObjectOES::~WebGLVertexArrayObjectOES): (WebCore::WebGLVertexArrayObjectOES::deleteObjectImpl): * html/canvas/WebGLVertexArrayObjectOES.h: * html/canvas/WebGLVertexArrayObjectOES.idl: 2020-08-14 Andres Gonzalez <andresg_22@apple.com> Crash in WebCore::AXObjectCache::rangeMatchesTextNearRange. https://bugs.webkit.org/show_bug.cgi?id=215521 <rdar://problem/64773177> Reviewed by Chris Fleizach. The test accessibility/ios-simulator/text-marker-range-matches-text.html exercises this code path, but doesn't reproduce this crash. Added a check for nullity of the VisiblePositions before creating the SimpleRange. * accessibility/AXObjectCache.cpp: (WebCore::AXObjectCache::rangeMatchesTextNearRange): 2020-08-14 Chris Dumez <cdumez@apple.com> Add support for suspending / resuming an OfflineAudioContext https://bugs.webkit.org/show_bug.cgi?id=215417 Reviewed by Eric Carlson. Add support for suspending / resuming an OfflineAudioContext, as per: - https://www.w3.org/TR/webaudio/#dom-offlineaudiocontext-suspend - https://www.w3.org/TR/webaudio/#dom-offlineaudiocontext-resume Tests: webaudio/offlineaudiocontext-suspend-resume-basic.html webaudio/offlineaudiocontext-suspend-resume-eventhandler.html webaudio/offlineaudiocontext-suspend-resume-graph-manipulation.html webaudio/offlineaudiocontext-suspend-resume-promise.html webaudio/offlineaudiocontext-suspend-resume-sequence.html * Modules/webaudio/BaseAudioContext.cpp: (WebCore::BaseAudioContext::didSuspendRendering): * Modules/webaudio/BaseAudioContext.h: (WebCore::BaseAudioContext::shouldSuspend): * Modules/webaudio/OfflineAudioContext.cpp: (WebCore::OfflineAudioContext::uninitialize): (WebCore::OfflineAudioContext::startOfflineRendering): (WebCore::OfflineAudioContext::suspendOfflineRendering): (WebCore::OfflineAudioContext::resumeOfflineRendering): (WebCore::OfflineAudioContext::shouldSuspend): (WebCore::OfflineAudioContext::didSuspendRendering): (WebCore::OfflineAudioContext::didFinishOfflineRendering): * Modules/webaudio/OfflineAudioContext.h: * Modules/webaudio/OfflineAudioContext.idl: * Modules/webaudio/OfflineAudioDestinationNode.cpp: (WebCore::OfflineAudioDestinationNode::OfflineAudioDestinationNode): (WebCore::OfflineAudioDestinationNode::startRendering): (WebCore::OfflineAudioDestinationNode::offlineRender): * Modules/webaudio/OfflineAudioDestinationNode.h: 2020-08-14 Peng Liu <peng.liu6@apple.com> The PiP button on the fullscreen youtube player disappears after starting a new video in a playlist https://bugs.webkit.org/show_bug.cgi?id=215488 Reviewed by Eric Carlson. When a fullscreen video player (e.g., YouTube.com) completes the current video and starts the next one in a playlist, it may reuse the video element, so m_mediaElement of the PlaybackSessionModelMediaElement instance won't change. However, the video element will exit video fullscreen standby and then enter video fullscreen standby. Those transitions are invisible to users. But the corresponding PlaybackSessionModelContext instance will be destroyed and a new instance will be created. By default, the member variable m_pictureInPictureSupported of the PlaybackSessionModelContext instance is "false". After a new video starts to play, the function PlaybackSessionModelMediaElement::setMediaElement() won't ask the PlaybackSessionManager to send a PlaybackSessionManagerProxy::PictureInPictureSupportedChanged message (because we don't change m_mediaElement) to notify the PlaybackSessionModelContext instance in the UI process that m_pictureInPictureSupported should be "true". Therefore, the PlaybackSessionModelContext instance will tell the WKFullScreenViewController instance that picture-in-picture is not supported, which in turn will hide the picture-in-picture button. With this patch, PlaybackSessionModelMediaElement::setMediaElement() will ask the PlaybackSessionManager instance to send an IPC message if m_mediaElement is not nullptr even we don't change the media element. So that the PlaybackSessionModelContext instance in the UI process will always have a consistent state as the PlaybackSessionModelMediaElement instance in the Web process. * platform/cocoa/PlaybackSessionModelMediaElement.mm: (WebCore::PlaybackSessionModelMediaElement::setMediaElement): 2020-08-14 Clark Wang <clark_wang@apple.com> Introduce ConstantSourceNode Interface https://bugs.webkit.org/show_bug.cgi?id=215377 Reviewed by Chris Dumez. Introduced new ConstantSourceNode interface according to spec: https://www.w3.org/TR/webaudio/#ConstantSourceNode and with guidance from Chromium implementation: https://source.chromium.org/chromium/chromium/src/+/master:third_party/blink/renderer/modules/webaudio/constant_source_node.cc. Re-baselined existing tests. Some fail further, mainly due to lack of support for automation rate in AudioParam. * CMakeLists.txt: * DerivedSources-input.xcfilelist: * DerivedSources-output.xcfilelist: * DerivedSources.make: * Modules/webaudio/AudioNode.cpp: (WebCore::convertEnumerationToString): * Modules/webaudio/AudioNode.h: * Modules/webaudio/BaseAudioContext.cpp: (WebCore::BaseAudioContext::createConstantSource): * Modules/webaudio/BaseAudioContext.h: * Modules/webaudio/BaseAudioContext.idl: * Modules/webaudio/ConstantSourceNode.cpp: Added. (WebCore::ConstantSourceNode::create): (WebCore::ConstantSourceNode::ConstantSourceNode): (WebCore::ConstantSourceNode::~ConstantSourceNode): (WebCore::ConstantSourceNode::process): (WebCore::ConstantSourceNode::propagatesSilence const): * Modules/webaudio/ConstantSourceNode.h: Added. * Modules/webaudio/ConstantSourceNode.idl: Added. * Modules/webaudio/ConstantSourceOptions.h: Added. * Modules/webaudio/ConstantSourceOptions.idl: Added. * Sources.txt: * WebCore.xcodeproj/project.pbxproj: * bindings/js/WebCoreBuiltinNames.h: 2020-08-14 Rob Buis <rbuis@igalia.com> Simplify FrameLoader::open https://bugs.webkit.org/show_bug.cgi?id=215505 Reviewed by Darin Adler. There is no need to set m_isComplete to false since the started() call a few lines below does the same thing. * loader/FrameLoader.cpp: (WebCore::FrameLoader::open): 2020-08-14 Rob Buis <rbuis@igalia.com> Simplify HTMLFrameElementBase::openURL https://bugs.webkit.org/show_bug.cgi?id=215504 Reviewed by Darin Adler. The expression effectively uses the indirection document -> frame -> document, but we can just use the document directly. * html/HTMLFrameElementBase.cpp: (WebCore::HTMLFrameElementBase::openURL): 2020-08-14 Chris Dumez <cdumez@apple.com> Make sure OfflineAudioContext::startOfflineRendering() does lazy initialization https://bugs.webkit.org/show_bug.cgi?id=215481 Reviewed by Eric Carlson. Make sure OfflineAudioContext::startOfflineRendering() does lazy initialization before actually starting rendering. If lazy initialization has not happened yet (because no audio nodes were created for this context yet), then rendering would fail with an InvalidStateError, due to lack on initialization. No new tests, rebaselined existing tests. * Modules/webaudio/OfflineAudioContext.cpp: (WebCore::OfflineAudioContext::startOfflineRendering): * Modules/webaudio/OfflineAudioDestinationNode.cpp: (WebCore::OfflineAudioDestinationNode::offlineRender): 2020-08-14 Chris Dumez <cdumez@apple.com> Fix bad check in AudioBufferSourceNode::renderFromBuffer() https://bugs.webkit.org/show_bug.cgi?id=215513 Reviewed by Darin Adler. Fix bad check in AudioBufferSourceNode::renderFromBuffer() that is causing us to incorrectly output silence and failing many WPT tests. No new tests, rebaselined existing tests. * Modules/webaudio/AudioBufferSourceNode.cpp: (WebCore::AudioBufferSourceNode::renderFromBuffer): 2020-08-14 Chris Dumez <cdumez@apple.com> AudioBufferSourceNode.buffer setter should throw when the buffer was already set https://bugs.webkit.org/show_bug.cgi?id=215510 Reviewed by Darin Adler. AudioBufferSourceNode.buffer setter should throw when the buffer was already set: - https://www.w3.org/TR/webaudio/#dom-audiobuffersourcenode-buffer Note that the setter for the WebKit-prefixed AudioBufferSourceNode still does not throw, to ensure backward-compatibility. No new tests, rebaselined existing test. * Modules/webaudio/AudioBufferSourceNode.cpp: (WebCore::AudioBufferSourceNode::setBuffer): * Modules/webaudio/AudioBufferSourceNode.h: (WebCore::AudioBufferSourceNode::isWebKitAudioBufferSourceNode const): * Modules/webaudio/WebKitAudioBufferSourceNode.h: 2020-08-14 Wenson Hsieh <wenson_hsieh@apple.com> REGRESSION (r259184): Typing -- then Return into an email moves the selection by two lines https://bugs.webkit.org/show_bug.cgi?id=215491 <rdar://problem/66938121> Reviewed by Darin Adler. When inserting a newline after text that is about to be replaced (e.g. using smart dashes, or a system-wide text replacement), logic in `Editor::markAndReplaceFor` attempts to detect the fact that we've just inserted a new paragraph (setting `adjustSelectionForParagraphBoundaries` to `true`), and subsequently causes us to advance the selection forward by 1 character after we're done handling the text replacement. This logic appears to have been added to deal with the fact that prior to r259184, `TextIterator::subrange()` with a range that ended in a line break would not include the line break as a part of the resulting subrange. For instance, suppose we're inserting a newline after "--", text replacement has just run and replaced the two hyphens with a single dash (—), and there is a newline after the dash. The extended paragraph range consists of the dash, followed by the line break after it ("—\n"), with a `selectionOffset` of 2. The following code: `auto selectionRange = extendedParagraph.subrange({ 0, selectionOffset });` ...would compute a `selectionRange` that encompasses only the "—", despite a selection offset of 2, causing the following code to only move the selection to the end of the "—": `m_document.selection().moveTo(createLegacyEditingPosition(selectionRange.end), DOWNSTREAM);` This requires the logic in the `adjustSelectionForParagraphBoundaries` to subsequently move the selection to the line break, as the user would expect. However, after the changes in r259184, the subrange now (correctly) returns a range that starts before the "—" and ends at the following line break. However, this also means that the subsequent adjustment logic will cause us to advance unnecessarily! To fix this, we remove the `adjustSelectionForParagraphBoundaries` case altogether, since its only (apparent) purpose is to work around the fact that `TextIterator::subrange` didn't include trailing line breaks before r259184. Test: editing/spelling/text-replacement-after-typing-to-word.html * editing/Editor.cpp: (WebCore::Editor::markAndReplaceFor): 2020-08-14 Takeshi Kurosawa <taken.spc@gmail.com> @font-face font-weight descriptor should reject bolder and lighter https://bugs.webkit.org/show_bug.cgi?id=215359 Reviewed by Darin Adler. Both bolder and lighter are not allowed in font-weight descriptor. This patch splits font-weight descriptor parsers from font-weight property parsers. Tested by existing (formerly failing) test: web-platform-tests/css/css-fonts/variations/at-font-face-descriptors.html: * css/parser/CSSPropertyParser.cpp: (WebCore::consumeFontWeightAbsoluteKeywordValue): (WebCore::consumeFontWeightAbsoluteRange): (WebCore::consumeFontWeightAbsolute): (WebCore::CSSPropertyParser::parseFontFaceDescriptor): (WebCore::consumeFontWeightRange): Deleted. 2020-08-14 Youenn Fablet <youenn@apple.com> WritableStreamDefaultWriterEnsureReadyPromiseRejected should create a new readPromise if the current readyPromise is not pending https://bugs.webkit.org/show_bug.cgi?id=215500 Reviewed by Geoffrey Garen. Create new promise if current is not pending. Also mark it as handled so that it does not end up call onunhandledrejection. Covered by rebased tests. * Modules/streams/WritableStreamInternals.js: (writableStreamDefaultWriterEnsureClosedPromiseRejected): 2020-08-13 Sergio Villar Senin <svillar@igalia.com> [WebXR] Implement WebXRSession::updateRenderState() https://bugs.webkit.org/show_bug.cgi?id=213555 Reviewed by Darin Adler. Added an implementation which matches the current specs. The updateRenderState() is specially useful to set the base layer in the session where WebXR contents would be rendered. Authors would normally do: glCanvas.getContext("webgl").makeXRCompatible().then(() => { xrSession.updateRenderState({ baseLayer: new XRWebGLLayer(xrSession, gl) }); }); The XRRenderStateInit has also been updated to the latest version of specs. * Modules/webxr/WebXRRenderState.cpp: (WebCore::WebXRRenderState::WebXRRenderState): (WebCore::WebXRRenderState::depthNear const): Inlined. (WebCore::WebXRRenderState::depthFar const): Ditto. (WebCore::WebXRRenderState::inlineVerticalFieldOfView const): Ditto. (WebCore::WebXRRenderState::baseLayer const): Ditto. * Modules/webxr/WebXRRenderState.h: (WebCore::WebXRRenderState::depthNear const): Inlined. (WebCore::WebXRRenderState::setDepthNear): Ditto. (WebCore::WebXRRenderState::depthFar const): Ditto. (WebCore::WebXRRenderState::setDepthFar): Ditto. (WebCore::WebXRRenderState::inlineVerticalFieldOfView const): Added. (WebCore::WebXRRenderState::setInlineVerticalFieldOfView): Ditto. (WebCore::WebXRRenderState::baseLayer const): Ditto. (WebCore::WebXRRenderState::setBaseLayer): Ditto. * Modules/webxr/WebXRSession.cpp: (WebCore::isImmersive): (WebCore::WebXRSession::updateRenderState): Implemented. (WebCore::WebXRSession::referenceSpaceIsSupported const): * Modules/webxr/WebXRSession.h: updateRenderState may throw exception. * Modules/webxr/WebXRSession.idl: Ditto. * Modules/webxr/WebXRWebGLLayer.h: (WebCore::WebXRWebGLLayer::session): Added. * Modules/webxr/XRRenderStateInit.h: Added layers and made many attributes optional. * Modules/webxr/XRRenderStateInit.idl: Ditto. 2020-08-13 Carlos Garcia Campos <cgarcia@igalia.com> REGRESSION(r254506): [Freetype] Spektra variable font does not work properly https://bugs.webkit.org/show_bug.cgi?id=215214 <rdar://problem/66984524> Reviewed by Adrian Perez de Castro. This regressed in r254506, when a font smoothing mode is passed to drawGlyphsToContext() a new cairo font options is set, using the default font options and changing the antialiasing. This means the font options from the font (the ones containing the variation settings) set in the context by cairo_set_scaled_font() are lost. We should copy the scaled font options instead, then set the antialiasing and apply them. * platform/graphics/cairo/CairoOperations.cpp: (WebCore::Cairo::drawGlyphsToContext): Use cairo_scaled_font_get_font_options() instead of getDefaultCairoFontOptions(). 2020-08-13 Carlos Garcia Campos <cgarcia@igalia.com> Crash in WebCore::StyledMarkupAccumulator::traverseNodesForSerialization https://bugs.webkit.org/show_bug.cgi?id=199224 Reviewed by Michael Catanzaro. The crash happens in StyledMarkupAccumulator::traverseNodesForSerialization() when we can't enter the node and nextSkippingChildren() returns nullptr. Test: editing/pasteboard/copy-across-shadow-boundaries-crash.html * editing/markup.cpp: (WebCore::StyledMarkupAccumulator::traverseNodesForSerialization): Set next to pastEnd if nextSkippingChildren() returns nullptr. 2020-08-13 Andres Gonzalez <andresg_22@apple.com> VoiceOver not able to invoke play button on some web sites. https://bugs.webkit.org/show_bug.cgi?id=215484 <rdar://problem/62729643> Reviewed by Chris Fleizach. Test: accessibility/ios-simulator/has-touch-event-listener.html. We were checking for the presence of listeners for touchstart and touchend events only. Now we check for the presence of any touch-related event listener. * accessibility/ios/AccessibilityObjectIOS.mm: (WebCore::AccessibilityObject::hasTouchEventListener const): 2020-08-13 Dean Jackson <dino@apple.com> Pocket City game play area is blank (WebGL is broken in Catalyst) https://bugs.webkit.org/show_bug.cgi?id=215251 Follow-up review comments from Darin Adler. * platform/graphics/cocoa/GraphicsContextGLOpenGLCocoa.mm: (WebCore::GraphicsContextGLOpenGL::GraphicsContextGLOpenGL): 2020-08-13 Zalan Bujtas <zalan@apple.com> Add RenderTreeMutationDisallowedScope to track intrusive render tree mutations https://bugs.webkit.org/show_bug.cgi?id=215463 <rdar://problem/67012831> Reviewed by Simon Fraser. RenderLayer::enclosingScrollableLayer should not mutate the render tree accidentally. This is related to <rdar://problem/64739768>. * Sources.txt: * WebCore.xcodeproj/project.pbxproj: * rendering/RenderTreeMutationDisallowedScope.cpp: Added. * rendering/RenderTreeMutationDisallowedScope.h: Added. (WebCore::RenderTreeMutationDisallowedScope::RenderTreeMutationDisallowedScope): (WebCore::RenderTreeMutationDisallowedScope::~RenderTreeMutationDisallowedScope): (WebCore::RenderTreeMutationDisallowedScope::isMutationAllowed): * rendering/updating/RenderTreeBuilder.cpp: (WebCore::RenderTreeBuilder::destroy): 2020-08-13 Chris Dumez <cdumez@apple.com> REGRESSION (r260684): Messages YouTube inline video: after Multitasking away and Back, Audio is heard but icon indicates "muted" https://bugs.webkit.org/show_bug.cgi?id=215453 <rdar://problem/66136673> Reviewed by Tim Horton. r260684 silenced all JS events during the snapshot sequence that occurs whenever the user homes out of Safari. This was meant to address compatibility with websites that did not expect various resize/orientationchange events when homing out. However, the snapshot sequence is fairly long and this was causing us to silence JS events which have nothing to do with the snapshot sequence, like window.postMessage()'s message events. This is what caused this regression. To address the issue, this patch basically reverts r260684 and deals with websites-compatibility issues via less risky site-specific and event-specific quirks: - We silence Window resize events on nytimes.com to address <rdar://problem/59763843>. - We silence Window resize events and MediaQueryList change events on twitter.com to address <rdar://problem/58804852> and <rdar://problem/61731801>. * css/MediaQueryMatcher.cpp: (WebCore::MediaQueryMatcher::evaluateAll): * dom/EventTarget.cpp: (WebCore::EventTarget::fireEventListeners): * page/FrameView.cpp: (WebCore::FrameView::sendResizeEventIfNeeded): * page/Page.h: (WebCore::Page::isTakingSnapshotsForApplicationSuspension const): (WebCore::Page::setIsTakingSnapshotsForApplicationSuspension): (WebCore::Page::shouldFireEvents const): Deleted. (WebCore::Page::setShouldFireEvents): Deleted. * page/Quirks.cpp: (WebCore::Quirks::shouldSilenceWindowResizeEvents const): (WebCore::Quirks::shouldSilenceMediaQueryListChangeEvents const): * page/Quirks.h: 2020-08-13 Aditya Keerthi <akeerthi@apple.com> [macOS] Zoomed-in search field is clipped out https://bugs.webkit.org/show_bug.cgi?id=215428 <rdar://problem/66161781> Reviewed by Darin Adler. r257150 added support for painting large form controls using NSControlSizeLarge. However, RenderThemeMac::searchFieldSizes() still returned a height corresponding to NSControlSizeRegular rather than NSControlSizeLarge. This behavior causes the height of the layout rect to be smaller than the height of the painted cell, resulting in clipping. Returning the correct height in searchFieldSizes is not enough to solve the issue. Currently, the height of the layout rect is set before adjusting the font size of the corresponding RenderStyle. This is problematic as the initial font size could correspond to NSControlSizeRegular, but when adjusted for zoom, the font size could correspond to NSControlSizeLarge. To ensure that the font size and height correspond to the same control size, the font size is now adjusted prior to adjusting the height. Test: fast/forms/search/search-zoom-computed-style-height.html * rendering/RenderThemeMac.mm: (WebCore::RenderThemeMac::searchFieldSizes const): Correct height for NSControlSizeLarge. (WebCore::RenderThemeMac::adjustSearchFieldStyle const): 2020-08-12 Myles C. Maxfield <mmaxfield@apple.com> Font loads quickly followed by navigations may fail indefinitely https://bugs.webkit.org/show_bug.cgi?id=215435 <rdar://problem/65560550> Reviewed by Darin Adler. Font loads are coalesced using a zero-delay timer. However, that zero-delay timer can fire while the page is in the middle of a navigation, which will cause the font loads to fail. Then, the second page can request those same fonts, which are marked as failed, and as such will never actually load/use the desired web font. This patch just stops the zero-delay timer during navigations, and resumes it when resuming the document. This means: 1. The second page in the above story will not see that the font has failed, or even started, and will then re-request the font and load it successfully 2. If the user goes "back" to the previous page, the zero-delay timer is restarted, the CachedFont realizes it's already succeeded, and the previous page is rendered as expected. Test: fast/loader/font-load-timer.html * css/CSSFontSelector.cpp: (WebCore::CSSFontSelector::suspendFontLoadingTimer): (WebCore::CSSFontSelector::restartFontLoadingTimer): * css/CSSFontSelector.h: * dom/Document.cpp: (WebCore::Document::resume): * loader/DocumentLoader.cpp: (WebCore::DocumentLoader::stopLoading): 2020-08-12 Lauro Moura <lmoura@igalia.com> Highpass Biquads use old formulas https://bugs.webkit.org/show_bug.cgi?id=181191 Reviewed by Darin Adler. Like r265517, but for the highpass filter. Spec: https://www.w3.org/TR/webaudio/#dom-biquadfiltertype-highpass Covered by existing tests * platform/audio/Biquad.cpp: (WebCore::Biquad::setHighpassParams): 2020-08-12 Dean Jackson <dino@apple.com> First search on Google Maps shows black bar at top of map and blank strips through the middle https://bugs.webkit.org/show_bug.cgi?id=214945 <rdar://problem/63374422> Reviewed by Tim Horton. On iOS with an attached keyboard, Google Maps appears to calculate the viewport it will use for map display at a time when the Unified Control Bar (keyboard accessories) is visible. If it then changes the map location via the user submitting a search form, the resulting map will be using the incorrect viewport as the control bar has disappeared. This causes parts of the map display to get the wrong stencil masks, leaving blank strips. This fixes itself as soon as you force the map to recalculate its viewport (e.g. by rotating the device). Rather than have Google Maps update its code to detect these viewport changes, we're adding a Quirk to not use the control bar in these calculations. * page/Quirks.cpp: (WebCore::Quirks::shouldAvoidResizingWhenInputViewBoundsChange const): Return true for "*.google.com/maps/". 2020-08-12 Ryosuke Niwa <rniwa@webkit.org> Add my new Twitter handle to the feature status page https://bugs.webkit.org/show_bug.cgi?id=215429 Reviewed by Chris Dumez. rniwa_dev is my new Twitter handle. * features.json: 2020-08-12 Stephan Szabo <stephan.szabo@sony.com> [PlayStation] Build fix for !ENABLE(ACCESSIBILITY) after r265514 https://bugs.webkit.org/show_bug.cgi?id=215426 AXObjectCache::getOrCreate(AccessibilityRole) changed names in the above, but the short definition for !ENABLE(ACCESSIBILITY) didn't update. Unreviewed build fix. * accessibility/AXObjectCache.h: Update name to match new name 2020-08-12 Peng Liu <peng.liu6@apple.com> Add the support to return to element fullscreen from picture-in-picture https://bugs.webkit.org/show_bug.cgi?id=215305 Reviewed by Jer Noble. When a container element enters fullscreen (with the fullscreen API), a descendant video element will enter the video fullscreen standby state so that it can enter picture-in-picture on application suspend (r226217). But we cannot restore to that state from the picture-in-picture mode when we click the "restore" button on the top-right corner of the PiP window. Instead, the video element will return to the inline mode. However, when a video element enters video fullscreen first and then enters picture-in-picture, we can let the video restore to fullscreen by clicking the "restore" button on the top-right corner of the picture-in-picture window. The inconsistent behaviors may confuse users who are not aware of the difference between the fullscreen API (or element fullscreen) and video fullscreen. This patch enables the support to restore to element fullscreen from picture-in-picture mode so that users can have a consistent experience on element fullscreen and video fullscreen. * dom/FullscreenManager.h: Export requestFullscreenForElement() so that we can use it in WebKit code. * html/HTMLMediaElement.cpp: (WebCore::HTMLMediaElement::enterFullscreen): (WebCore::HTMLMediaElement::prepareForVideoFullscreenStandby): * html/HTMLMediaElement.h: * page/ChromeClient.h: (WebCore::ChromeClient::prepareForVideoFullscreen): Add the interface to request a video element to be prepared for the video fullscreen standby state. * platform/cocoa/VideoFullscreenChangeObserver.h: Add prepareToExitFullscreen() and fullscreenWillReturnToInline(). * platform/cocoa/VideoFullscreenModel.h: (WebCore::VideoFullscreenModelClient::hasVideoChanged): (WebCore::VideoFullscreenModelClient::videoDimensionsChanged): (WebCore::VideoFullscreenModelClient::prepareToExitPictureInPicture): Some minor clean-ups and add function prepareToExitPictureInPicture(). * platform/ios/VideoFullscreenInterfaceAVKit.h: * platform/ios/VideoFullscreenInterfaceAVKit.mm: (VideoFullscreenInterfaceAVKit::cleanupFullscreen): (VideoFullscreenInterfaceAVKit::prepareForPictureInPictureStop): (VideoFullscreenInterfaceAVKit::didStartPictureInPicture): (VideoFullscreenInterfaceAVKit::willStopPictureInPicture): (VideoFullscreenInterfaceAVKit::prepareForPictureInPictureStopWithCompletionHandler): (VideoFullscreenInterfaceAVKit::setReadyToStopPictureInPicture): (VideoFullscreenInterfaceAVKit::willEnterStandbyFromPictureInPicture): (VideoFullscreenInterfaceAVKit::setWillEnterStandbyFromPictureInPicture): (VideoFullscreenInterfaceAVKit::fullscreenMayReturnToInline): Deleted. When we enter picture-in-picture, we need to save the state and be prepared to restore to element fullscreen if needed. Before we exit picture-in-picture, if the "restore" button is clicked, we need to notify the client to prepare for the picture-in-picture stop, and call VideoFullscreenInterfaceAVKit::setReadyToStopPictureInPicture(true) when the client is ready. Based on those changes, a client (e.g., WKFullScreenWindowControllerVideoFullscreenModelClient) can coordinate with WKFullScreenWindowController to implement the "restore to element fullscreen" feature. * platform/ios/WebVideoFullscreenControllerAVKit.mm: (VideoFullscreenControllerContext::fullscreenWillReturnToInline): (VideoFullscreenControllerContext::fullscreenMayReturnToInline): Deleted. 2020-08-12 Wenson Hsieh <wenson_hsieh@apple.com> Broken formatting in price table on yandex.ru after translating to English https://bugs.webkit.org/show_bug.cgi?id=215416 <rdar://problem/66354018> Reviewed by Tim Horton. Extend the behavior added in r265188 so that it applies to all elements that have `display: table-cell;`, rather than only table data cell elements. * editing/TextManipulationController.cpp: (WebCore::isEnclosingItemBoundaryElement): 2020-08-12 Adrian Perez de Castro <aperez@igalia.com> Unreviewed non-unified build fix. No new tests needed. * accessibility/AccessibilityMenuListOption.cpp: Add missing inclusion of HTMLSelectElement.h. * page/Quirks.h: Add mising forward declaration of HTMLVideoElement. * page/UndoItem.cpp: Add missing inclusion of Document.h. 2020-08-12 Chris Dumez <cdumez@apple.com> Unreviewed, address post-landing review comment from Sam Weinig for r265536. * Modules/webaudio/WaveShaperDSPKernel.cpp: (WebCore::WaveShaperDSPKernel::processCurve): 2020-08-12 Sergio Villar Senin <svillar@igalia.com> Unreviewed build fix after r265546. The <Ref.h> include should be now in the header now that we've inlined the create() function. * Modules/webxr/WebXRInputSourceArray.cpp: Removed include. * Modules/webxr/WebXRInputSourceArray.h: Added include 2020-08-12 Youenn Fablet <youenn@apple.com> Refresh WritableStream up to spec https://bugs.webkit.org/show_bug.cgi?id=215267 Reviewed by Geoff Garen. Update according latest spec, including WebIDL, controller and writer. Covered by rebased tests. * CMakeLists.txt: * DerivedSources-input.xcfilelist: * DerivedSources-output.xcfilelist: * DerivedSources.make: * Modules/streams/StreamInternals.js: * Modules/streams/WritableStream.idl: * Modules/streams/WritableStream.js: * Modules/streams/WritableStreamDefaultController.idl: Added. * Modules/streams/WritableStreamDefaultController.js: Added. * Modules/streams/WritableStreamDefaultWriter.idl: Added. * Modules/streams/WritableStreamDefaultWriter.js: Added. * Modules/streams/WritableStreamInternals.js: * Sources.txt: * WebCore.xcodeproj/project.pbxproj: * bindings/js/WebCoreBuiltinNames.h: 2020-08-06 Sergio Villar Senin <svillar@igalia.com> [WebXR] Update WebXR WPT directory https://bugs.webkit.org/show_bug.cgi?id=215224 Reviewed by Youenn Fablet. The update of the WebXR WPT directory helped us to unveil a couple of mistakes in the current code. First of all the Events defined in the WebXR spec had to be iso allocated as the Event base class. Secondly the WebXRInputSourceArray must have a ::create() method. Finally the m_inputSources attribute of the WebXRSession must be a Ref instead of a RefPtr because the specs mention that the initial value is an empty array. Tests: imported/w3c/web-platform-tests/webxr/anchors/ar_anchor_freefloating_create_move.https.html imported/w3c/web-platform-tests/webxr/anchors/ar_anchor_freefloating_delay_creation.https.html imported/w3c/web-platform-tests/webxr/anchors/ar_anchor_freefloating_failure.https.html imported/w3c/web-platform-tests/webxr/anchors/ar_anchor_freefloating_pause_resume_stop.https.html imported/w3c/web-platform-tests/webxr/anchors/ar_anchor_states.https.html imported/w3c/web-platform-tests/webxr/anchors/idlharness.https.window.html imported/w3c/web-platform-tests/webxr/dom-overlay/ar_dom_overlay_hit_test.https.html imported/w3c/web-platform-tests/webxr/dom-overlay/idlharness.https.window.html imported/w3c/web-platform-tests/webxr/hit-test/ar_hittest_subscription_inputSources.https.html imported/w3c/web-platform-tests/webxr/hit-test/ar_hittest_subscription_states_regular.https.html imported/w3c/web-platform-tests/webxr/hit-test/ar_hittest_subscription_states_transient.https.html imported/w3c/web-platform-tests/webxr/hit-test/ar_hittest_subscription_transientInputSources.https.html imported/w3c/web-platform-tests/webxr/hit-test/idlharness.https.html imported/w3c/web-platform-tests/webxr/render_state_update.https.html imported/w3c/web-platform-tests/webxr/webGLCanvasContext_makecompatible_reentrant.https.html imported/w3c/web-platform-tests/webxr/xrReferenceSpace_relationships.https.html * Modules/webxr/WebXRInputSourceArray.cpp: (WebCore::WebXRInputSourceArray::create): Added. * Modules/webxr/WebXRInputSourceArray.h: * Modules/webxr/WebXRSession.cpp: (WebCore::WebXRSession::WebXRSession): Initialize the m_inputSources. (WebCore::WebXRSession::inputSources const): Return a const reference. * Modules/webxr/WebXRSession.h: * Modules/webxr/XRInputSourcesChangeEvent.cpp: Make it iso allocated. * Modules/webxr/XRInputSourcesChangeEvent.h: Ditto. * Modules/webxr/XRSessionEvent.cpp: Ditto. * Modules/webxr/XRSessionEvent.h: Ditto. 2020-08-12 Antti Koivisto <antti@apple.com> REGRESSION (r259805): Not able to scroll vertically after scrolling horizontally without leaving message and coming back https://bugs.webkit.org/show_bug.cgi?id=215374 <rdar://problem/65269837> Reviewed by Darin Adler. The content has a horizontally scrolling overflow. While rubberbanding it we mark a wheel event unhandled which causes Mail to take over event handling and leaves us semi-permanently in stretched state. * platform/cocoa/ScrollController.mm: (WebCore::ScrollController::handleWheelEvent): Dissallowed vertical stretch would mark the event unhandled even though we are rubberbanding in horizontal direction. Only mark a wheel event unhandled if it actually concerns the tested direction. 2020-08-12 Chris Lord <clord@igalia.com> Implement Canvas.transferControlToOffscreen and OffscreenCanvasRenderingContext2D.commit https://bugs.webkit.org/show_bug.cgi?id=202797 Reviewed by Dean Jackson. Implement HTMLCanvasElement.transferControlToOffscreen and OffscreenCanvasRenderingContext2D.commit. This allows for (synchronous) display of asynchronously rendered OffscreenCanvas content. No new tests. Covered by existing tests. * html/HTMLCanvasElement.cpp: (WebCore::HTMLCanvasElement::setHeight): (WebCore::HTMLCanvasElement::setWidth): (WebCore::HTMLCanvasElement::reset): (WebCore::HTMLCanvasElement::transferControlToOffscreen): (WebCore::HTMLCanvasElement::setImageBufferAndMarkDirty): (WebCore::HTMLCanvasElement::isControlledByOffscreen const): * html/HTMLCanvasElement.h: * html/HTMLCanvasElement.idl: * html/OffscreenCanvas.cpp: (WebCore::DetachedOffscreenCanvas::takePlaceholderCanvas): (WebCore::OffscreenCanvas::create): (WebCore::OffscreenCanvas::getContext): (WebCore::OffscreenCanvas::didDraw): (WebCore::OffscreenCanvas::detach): (WebCore::OffscreenCanvas::setPlaceholderCanvas): (WebCore::OffscreenCanvas::pushBufferToPlaceholder): (WebCore::OffscreenCanvas::commitToPlaceholderCanvas): (WebCore::OffscreenCanvas::scheduleCommitToPlaceholderCanvas): (WebCore::OffscreenCanvas::reset): * html/OffscreenCanvas.h: * html/canvas/OffscreenCanvasRenderingContext2D.cpp: (WebCore::OffscreenCanvasRenderingContext2D::commit): * html/canvas/OffscreenCanvasRenderingContext2D.h: * html/canvas/OffscreenCanvasRenderingContext2D.idl: * html/canvas/PlaceholderRenderingContext.cpp: (WebCore::PlaceholderRenderingContext::canvas const): * html/canvas/PlaceholderRenderingContext.h: 2020-08-12 Carlos Garcia Campos <cgarcia@igalia.com> REGRESSION(r261570): [GTK] Fails to send drop event to JavaScript https://bugs.webkit.org/show_bug.cgi?id=215032 Reviewed by Darin Adler. Add support for custom data in drag and drop operations too. * platform/gtk/PasteboardGtk.cpp: (WebCore::Pasteboard::write): Se custom data on m_selectionData. (WebCore::Pasteboard::read): Initialize the content origin also for drag and drop pasteboards. (WebCore::Pasteboard::hasData): For drag and drop pasteboards return true also if m_selectionData has custom data. (WebCore::Pasteboard::typesSafeForBindings): Implement this for drag and drop pasteboards. (WebCore::Pasteboard::readOrigin): Ditto. (WebCore::Pasteboard::readStringInCustomData): Ditto. (WebCore::Pasteboard::writeCustomData): Ditto. 2020-08-11 James Darpinian <jdarpinian@chromium.org> [WebGL2] Depth formats can have mipmaps in WebGL 2 https://bugs.webkit.org/show_bug.cgi?id=215404 Reviewed by Kenneth Russell. Fixes 150 WebGL 2 conformance tests. * html/canvas/WebGLRenderingContextBase.cpp: (WebCore::WebGLRenderingContextBase::validateTexFuncFormatAndType): 2020-08-11 Chris Dumez <cdumez@apple.com> Unreviewed, address post-landing review comment from Darin for r265536. * Modules/webaudio/WaveShaperDSPKernel.cpp: (WebCore::WaveShaperDSPKernel::processCurve): 2020-08-11 Chris Dumez <cdumez@apple.com> Fix WaveShapperNode's waveshaping curve implementation https://bugs.webkit.org/show_bug.cgi?id=215391 Reviewed by Darin Adler. Fix WaveShapperNode's waveshaping curve implementation using the algorithm in the specification: - https://www.w3.org/TR/webaudio/#dom-waveshapernode-curve No new tests, rebaselined existing tests. * Modules/webaudio/WaveShaperDSPKernel.cpp: (WebCore::WaveShaperDSPKernel::processCurve): 2020-08-11 Simon Fraser <simon.fraser@apple.com> Have render tree dumps show overflow information https://bugs.webkit.org/show_bug.cgi?id=215385 Reviewed by Zalan Bujtas. Add code to RenderObject::outputRenderObject() to show layout/visual overflow, as we do for render tree dumps. * rendering/RenderObject.cpp: (WebCore::RenderObject::outputRenderObject const): 2020-08-11 Brady Eidson <beidson@apple.com> Add a "use stored credentials" setting to WKWebView. <rdar://problem/63308019> and https://bugs.webkit.org/show_bug.cgi?id=215388 Reviewed by Geoff Garen. Covered by Preconnect API tests. This setting is to allow apps to explicitly deny using the credential storage for network operations. (e.g. to make sure the Keychain UI doesn't pop up for an offscreen load) * loader/ResourceLoader.cpp: (WebCore::ResourceLoader::shouldUseCredentialStorage): * page/Page.h: (WebCore::Page::setCanUseCredentialStorage): (WebCore::Page::canUseCredentialStorage const): 2020-08-11 Commit Queue <commit-queue@webkit.org> Unreviewed, reverting r265502. https://bugs.webkit.org/show_bug.cgi?id=215396 Needs locking to avoid flaky GC-related crashes Reverted changeset: "[WebGL2] expando-loss and expando-loss-2 conformance tests are failing" https://bugs.webkit.org/show_bug.cgi?id=214765 https://trac.webkit.org/changeset/265502 2020-08-11 Jon Davis <jond@apple.com> Add privacy and security keywords to feature status entries https://bugs.webkit.org/show_bug.cgi?id=215203 Reviewed by Youenn Fablet. * features.json: 2020-08-11 Chris Dumez <cdumez@apple.com> Fix BiquadFilterNode's lowpass filter https://bugs.webkit.org/show_bug.cgi?id=215381 Reviewed by Darin Adler. Fix BiquadFilterNode's lowpass filter as it was causing us to fail a WPT test: - https://www.w3.org/TR/webaudio/#dom-biquadfiltertype-lowpass No new tests, rebaselined existing test. * Modules/webaudio/BiquadProcessor.cpp: (WebCore::BiquadProcessor::BiquadProcessor): * platform/audio/Biquad.cpp: (WebCore::Biquad::setLowpassParams): 2020-08-11 Darin Adler <darin@apple.com> LayoutTest accessibility/mac/select-element-selection-with-optgroups.html is a flaky failure https://bugs.webkit.org/show_bug.cgi?id=175341 Reviewed by Chris Fleizach. Failures were due to new AX objects being created for HTMLOptionElement. Unlike most other AX objects, these were not cached in the AXObjectCache and multiple objects could be created for the same underlying option. Fixed this by changing it to track the option element in the cache in the conventional way. * WebCore.xcodeproj/project.pbxproj: Remove AccessibilityMediaControls.h/cpp. The source files were removed back in April. * accessibility/AXObjectCache.cpp: (WebCore::AXObjectCache::getOrCreate): Added code for HTMLOptionElement and HTMLOptGroupElement so AccessibilityMenuListOption and AccessibilityListBoxOption can be created in this function. (WebCore::AXObjectCache::create): Renamed the version of this that takes an AccessibilityRole to not claim that it ever gets the value from the cache, because it never does. Also removed the cases for ListBoxOption and MenuListOption. * accessibility/AXObjectCache.h: Updated for above. * accessibility/AccessibilityARIAGrid.cpp: (WebCore::AccessibilityARIAGrid::addChildren): Use create. * accessibility/AccessibilityListBox.cpp: (WebCore::AccessibilityListBox::addChildren): Removed super-old comment that mentions the long-ago-removed WML. (WebCore::AccessibilityListBox::listBoxOptionAccessibilityObject const): Use the element to get the list box option rather than creating a new one every time. No longer any need to special case <hr> elements since the getOrCreate function will return nil for non-option elements that don't have a renderer. * accessibility/AccessibilityListBoxOption.cpp: (WebCore::AccessibilityListBoxOption::AccessibilityListBoxOption): Take the element in the constructor instead of using a separate function to associate it. (WebCore::AccessibilityListBoxOption::create): Ditto. (WebCore::AccessibilityListBoxOption::isEnabled const): Update for WeakPtr. (WebCore::AccessibilityListBoxOption::isSelected const): Ditto. (WebCore::AccessibilityListBoxOption::canSetSelectedAttribute const): Ditto. (WebCore::AccessibilityListBoxOption::actionElement const): Update for WeakPtr. (WebCore::AccessibilityListBoxOption::node const): Added. For some reason the AccessibilityMenuListOption class had this function and this one did not. They should both have it. * accessibility/AccessibilityListBoxOption.h: Updated for above. Made most functions private and final. Fixed includes and forward declarations. Removed the setHTMLElement function. Changed m_optionElement from HTMLElement* to WeakPtr<HTMLElement>. * accessibility/AccessibilityMenuList.cpp: (WebCore::AccessibilityMenuList::addChildren): Use create. * accessibility/AccessibilityMenuListOption.cpp: (WebCore::AccessibilityMenuListOption::AccessibilityMenuListOption): Take the element in the constructor instead of using a separate function to associate it. (WebCore::AccessibilityMenuListOption::create): Ditto. (WebCore::AccessibilityMenuListOption::setElement): Deleted. (WebCore::AccessibilityMenuListOption::node const): Moved here from the header. (WebCore::AccessibilityMenuListOption::isEnabled const): Removed unneeded cast now that m_element has a more specific type, and added a null check. (WebCore::AccessibilityMenuListOption::isVisible const): Removed dependency on m_parent pointer, which does not exist now that we don't derive from AccessibilityMockObject. (WebCore::AccessibilityMenuListOption::isSelected const): Removed unneeded cast now that m_element has a more specific type, and added a null check. (WebCore::AccessibilityMenuListOption::setSelected): Ditto, but no null check needed because canSetSelectedAttribute takes care of that. (WebCore::AccessibilityMenuListOption::stringValue const): Ditto. * accessibility/AccessibilityMenuListOption.h: Updated for above. Marked functions final instead of override. Changed m_element from RefPtr<HTMLElement> to WeakPtr<HTMLOptionElement> to avoid reference cycles that could leak to memory leaks. Derive from AccessibilityObject instead of AccessibilityMockObject, since the latter class has nothing to offer us. * accessibility/AccessibilityMenuListPopup.cpp: (WebCore::AccessibilityMenuListPopup::menuListOptionAccessibilityObject const): Use the element to get the menu list option rather than creating a new one every time. No longer any need to check that the type is HTMLOptionElement because that's the responsibility of the code in the cache now. (WebCore::AccessibilityMenuListPopup::addChildren): Removed unneeded call to setParent since the menu list option objects no longer hold parent pointers. * accessibility/AccessibilityNodeObject.cpp: (WebCore::accessibleNameForNode): Added a special case for HTMLOptionElement like the one for HTMLInputElement. The code worked for fairly well for option elements before, almost by accident, and the way it worked was perturbed by the change to whether we cache those objects. This newer code path works in a more straightforward way, keeps our existing tests psasing, and likely gets some edge cases handled more correctly (should add new tests for those). * accessibility/AccessibilityRenderObject.cpp: (WebCore::AccessibilityRenderObject::documentLinks): Use create. (WebCore::AccessibilityRenderObject::addImageMapChildren): Ditto. (WebCore::AccessibilityRenderObject::addTextFieldChildren): Ditto. * accessibility/AccessibilitySlider.cpp: (WebCore::AccessibilitySlider::addChildren): Ditto. * accessibility/AccessibilitySpinButton.cpp: (WebCore::AccessibilitySpinButton::addChildren): Ditto. * accessibility/AccessibilityTable.cpp: (WebCore::AccessibilityTable::addChildren): Ditto. (WebCore::AccessibilityTable::headerContainer): Ditto. * accessibility/atk/WebKitAccessible.cpp: (fallbackObject): Deleted. (webkitAccessibleGetName): Added null check. (webkitAccessibleGetDescription): Ditto. (webkitAccessibleGetParent): Ditto. (webkitAccessibleGetNChildren): Ditto. (webkitAccessibleRefChild): Ditto. (webkitAccessibleGetIndexInParent): Ditto. (webkitAccessibleGetAttributes): Ditto. (webkitAccessibleGetRole): Ditto. (webkitAccessibleRefStateSet): Ditto. (webkitAccessibleRefRelationSet): Ditto. (webkitAccessibleGetObjectLocale): Ditto. (webkitAccessibleGetAccessibilityObject): Ditto. (webkitAccessibleDetach): Use nullptr instead of fallbackObject. (webkitAccessibleIsDetached): Ditto. * html/HTMLOptionElement.cpp: (WebCore::HTMLOptionElement::selected const): Made this const. An earlier version of the patch required this; the latest version doesn't, but it's more logical and better for it to be const. * html/HTMLOptionElement.h: Updated for above. 2020-08-11 Timothy Hatcher <timothy@apple.com> Deferred WKUserScripts are exponentially injected on preloaded pages with frames. https://bugs.webkit.org/show_bug.cgi?id=215382 rdar://problem/66837802 Reviewed by Sam Weinig. When defering a script in a frame it was previously added to a vector per-page. Later when notified to inject the defered scripts, the page would iterate over all the frames and evaluate the scripts on each frame. Since this vector had all the frame's scripts the evaluations would be multiplied by the number of frames. Now the defered scripts are stored per-frame and the page asks each frame to inject the defered scripts. * page/Frame.cpp: (WebCore::Frame::injectUserScripts): (WebCore::Frame::addUserScriptAwaitingNotification): (WebCore::Frame::injectUserScriptsAwaitingNotification): * page/Frame.h: * page/Page.cpp: (WebCore::Page::notifyToInjectUserScripts): (WebCore::Page::addUserScriptAwaitingNotification): Deleted. * page/Page.h: * page/Quirks.cpp: (WebCore::Quirks::triggerOptionalStorageAccessQuirk const): 2020-08-11 Wenson Hsieh <wenson_hsieh@apple.com> Text input autocorrect="off" attribute ignored on Mac https://bugs.webkit.org/show_bug.cgi?id=151019 <rdar://problem/65061700> Reviewed by Simon Fraser. Add support for the `autocorrect` attribute on macOS, by not showing the automatic spell checking popup or automatically correcting misspelled words if the root editable element has `autocorrect="off"`. Tests: editing/input/cocoa/autocorrect-off.html editing/input/cocoa/autocorrect-on.html * editing/AlternativeTextController.cpp: (WebCore::AlternativeTextController::isAutomaticSpellingCorrectionEnabled): 2020-08-11 Sihui Liu <sihui_liu@apple.com> Text manipulation crashes when replacing element with img role https://bugs.webkit.org/show_bug.cgi?id=215344 Reviewed by Wenson Hsieh. positionInParentAfterNode and positionInParentBeforeNode do not return Position with Nodes that are ignored by editing. Element with img role is one of such Nodes. However, TextManipulationController can manipulate content of children of the ignored Nodes (see the newly added test). Therefore, we'd better not use positionInParentBeforeNode or positionInParentBeforeNode in TextManipulationController::replace, because insertion position can be inside a ignored Node. API Test: TextManipulation.CompleteTextManipulationShouldReplaceContentIgnoredByEditing * editing/TextManipulationController.cpp: (WebCore::TextManipulationController::replace): 2020-08-11 Kenneth Russell <kbr@chromium.org> [WebGL2] expando-loss and expando-loss-2 conformance tests are failing https://bugs.webkit.org/show_bug.cgi?id=214765 Reviewed by Darin Adler. Use JSWebGLRenderingContext's and JSWebGL2RenderingContext's existing visitAdditionalChildren hook (via JSCustomMarkFunction in their IDL) to add opaque roots for all WebGLObjects latched in to the context state, and all WebGLObjects they refer to. (Extensions were already previously handled.) Add "GenerateIsReachable=Impl" to the IDL files for all such objects (WebGLBuffer, WebGLTexture, etc.) so that they pay attention to the opaque root state when determining liveness of their JavaScript wrappers. Thanks to ysuzuki@ for pointing out the need for this. * bindings/js/JSWebGL2RenderingContextCustom.cpp: (WebCore::JSWebGL2RenderingContext::visitAdditionalChildren): * bindings/js/JSWebGLRenderingContextCustom.cpp: (WebCore::JSWebGLRenderingContext::visitAdditionalChildren): * html/canvas/WebGL2RenderingContext.cpp: (WebCore::WebGL2RenderingContext::visitReferencedJSWrappers): * html/canvas/WebGL2RenderingContext.h: * html/canvas/WebGLBuffer.idl: * html/canvas/WebGLFramebuffer.cpp: (WebCore::WebGLFramebuffer::visitReferencedJSWrappers): * html/canvas/WebGLFramebuffer.h: * html/canvas/WebGLFramebuffer.idl: * html/canvas/WebGLProgram.cpp: (WebCore::WebGLProgram::visitReferencedJSWrappers): * html/canvas/WebGLProgram.h: * html/canvas/WebGLProgram.idl: * html/canvas/WebGLQuery.idl: * html/canvas/WebGLRenderbuffer.idl: * html/canvas/WebGLRenderingContextBase.cpp: (WebCore::WebGLRenderingContextBase::visitReferencedJSWrappers): * html/canvas/WebGLRenderingContextBase.h: * html/canvas/WebGLSampler.idl: * html/canvas/WebGLShader.idl: * html/canvas/WebGLTexture.idl: * html/canvas/WebGLTransformFeedback.cpp: (WebCore::WebGLTransformFeedback::visitReferencedJSWrappers): * html/canvas/WebGLTransformFeedback.h: * html/canvas/WebGLTransformFeedback.idl: * html/canvas/WebGLVertexArrayObject.idl: * html/canvas/WebGLVertexArrayObjectBase.cpp: (WebCore::WebGLVertexArrayObjectBase::visitReferencedJSWrappers): * html/canvas/WebGLVertexArrayObjectBase.h: * html/canvas/WebGLVertexArrayObjectOES.idl: 2020-08-11 Youenn Fablet <youenn@apple.com> Add JS console log message in case of capture failure https://bugs.webkit.org/show_bug.cgi?id=215370 Reviewed by Eric Carlson. Covered by rebased test. * Modules/mediastream/MediaStreamTrack.cpp: (WebCore::MediaStreamTrack::trackEnded): 2020-08-11 Zalan Bujtas <zalan@apple.com> [AutoTableLayout] REGRESSION(r263855) Paypal email is rendered right aligned on Safari https://bugs.webkit.org/show_bug.cgi?id=215340 <rdar://problem/66540254> Reviewed by Simon Fraser. Prior to r263855, these zero-length, non-empty columns had the preferred width value of 1px and the available space got distributed based on this made-up 1px value. In this patch, we distribute the available horizontal space evenly among these zero-length, 'width: auto' columns. Test: fast/table/zero-length-non-empty-columns-with-auto-width.html * rendering/AutoTableLayout.cpp: (WebCore::AutoTableLayout::layout): 2020-08-11 Sergio Villar Senin <svillar@igalia.com> [css-flexbox] Only update the intrinsic height if we don't have an override height https://bugs.webkit.org/show_bug.cgi?id=215369 Reviewed by Javier Fernandez. If we do have an override height, children will size themselves relative to the override height (e.g. flexbox flexing/stretching, percentage heights). Because flex intrinsic height is based on its children, it would then store an incorrect intrinsic height. This is specially problematic with min-height:auto is nested column flexboxes where flexboxes are flex items at the same time. Based on Blink's https://crrev.com/c/1283482 by <cbiesinger@chromium.org> * rendering/RenderBox.cpp: (WebCore::RenderBox::cacheIntrinsicContentLogicalHeightForFlexItem const): Early return if there is an override height. 2020-08-11 Andres Gonzalez <andresg_22@apple.com> Update the isolated tree on element language changes. https://bugs.webkit.org/show_bug.cgi?id=215354 <rdar://problem/65583698> Reviewed by Chris Fleizach. Test: accessibility/language-attribute-change.html * accessibility/AXObjectCache.cpp: (WebCore::AXObjectCache::handleAttributeChange): Added handling of AXLanguageChanged notifications. (WebCore::AXObjectCache::updateIsolatedTree): Update the isolated tree for ASLanguage notifications. * accessibility/AXObjectCache.h: 2020-08-11 Alicia Boya García <aboya@igalia.com> [MSE][GStreamer] Remove m_sourceBufferPrivateClient checks in SourceBufferPrivateGStreamer https://bugs.webkit.org/show_bug.cgi?id=215263 Reviewed by Xabier Rodriguez-Calvar. m_sourceBufferPrivateClient is only reset to NULL from SourceBuffer's destructor. At this point SourceBufferPrivateGStreamer is about to receive its last unref by SourceBuffer and therefore be destroyed. Similarly, there is no need to check for m_mediaSource being null. m_mediaSource is only reset when the SourceBuffer is removed, and at that point SourceBufferPrivate shouldn't receive any calls. This is a clean-up and doesn't introduce new behavior. Asserts have been added checking the precondition above. * platform/graphics/gstreamer/mse/SourceBufferPrivateGStreamer.cpp: (WebCore::SourceBufferPrivateGStreamer::removedFromMediaSource): (WebCore::SourceBufferPrivateGStreamer::didReceiveInitializationSegment): (WebCore::SourceBufferPrivateGStreamer::didReceiveSample): (WebCore::SourceBufferPrivateGStreamer::didReceiveAllPendingSamples): (WebCore::SourceBufferPrivateGStreamer::appendParsingFailed): 2020-08-11 Philippe Normand <pnormand@igalia.com> [GStreamer] gst-full standalone library support https://bugs.webkit.org/show_bug.cgi?id=215262 Reviewed by Xabier Rodriguez-Calvar. A new CMake option is introduced to enable gst-full support: USE_GSTREAMER_FULL. By default this option is disabled. WebKit distributors might want to enable this if they distribute GStreamer through gst-build's gst-full library. In gst-build the following options can be used to produce a usable libgstreamer-full-1.0.so: -Dpython=disabled -Dges=disabled -Ddevtools=disabled -Dintrospection=disabled -Ddefault_library=static Once enabled in our build, the dynamic library libgstreamer-full-1.0.so will be loaded instead of all the other GStreamer libraries. Plugins are statically registered in this library as well. This can be useful when deploying WebKit in controlled embedded platform where disk space is limited. One of the goals of gst-full is to enable full customization of the plugins to be included in the library. Static registration can also reduce GStreamer initialization time. * platform/GStreamer.cmake: * platform/graphics/gstreamer/GStreamerCommon.cpp: (WebCore::initializeGStreamer): (WebCore::initializeGStreamerAndRegisterWebKitElements): * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp: (WebCore::MediaPlayerPrivateGStreamer::handleMessage): Disable missing-plugins handling when gst-full is in use. The plugin installer doesn't make much sense for this scenario. 2020-08-10 Myles C. Maxfield <mmaxfield@apple.com> Fix bad merge in r265488 https://bugs.webkit.org/show_bug.cgi?id=214769 Unreviewed. This is something that got dropped in a bad merge from r265488. * platform/graphics/FontCascade.cpp: (WebCore::FontCascade::layoutSimpleText const): * platform/graphics/GlyphBuffer.h: (WebCore::GlyphBuffer::originAt const): (WebCore::GlyphBuffer::expandInitialAdvance): 2020-08-10 Myles C. Maxfield <mmaxfield@apple.com> Spacing of Chinese characters is inconsistent in macOS 11/Safari 14 beta https://bugs.webkit.org/show_bug.cgi?id=214769 Reviewed by Darin Adler. This is in preparation for https://bugs.webkit.org/show_bug.cgi?id=206208.. In the general case, text shaping is Turing-complete. In order for it to work properly, we need to feed the text shaping virtual machine the correct inputs so that it can produce correct outputs. The input to text shaping is supposed to be the raw glyph advances straight from CTFontGetAdvancesForGlyphs(). Previously, we were applying letter-spacing, word-spacing, justification, and tab stops before shaping. Most fonts don't care about this and still produce the correct results. However, Ping Fang on macOS Big Sur and iOS 14 _does_ care about this, and its shaping rules operate incorrectly when fed these pre-expanded glyph widths. The solution is to apply this extra spacing after shaping occurs. However, because shaping is Turing-complete, it is free to add or remove glyphs willy-nilly. This means we need some way of tracing back which character in the input string correspond to which output glyphs, so we know which glyphs to add additional spacing to. This is what https://bugs.webkit.org/show_bug.cgi?id=215059 does: It switches from using CTFontTransformGlyphsWithLanguage() to CTFontShapeGlyphs(), which outputs this glyph-character tracing info. Then, once we have this tracing info, we can apply spacing properly after shaping has completed. That's what this patch does. Tests: fast/text/letter-spacing-shaping.html fast/text/tab-letter-space.html * platform/graphics/FontCascade.cpp: Clients of WidthIterator::advance() need to call WidthIterator::finalize() (see below). (WebCore::FontCascade::widthOfTextRange const): (WebCore::FontCascade::layoutSimpleText const): (WebCore::FontCascade::floatWidthForSimpleText const): (WebCore::FontCascade::adjustSelectionRectForSimpleText const): (WebCore::FontCascade::offsetForPositionForSimpleText const): * platform/graphics/GlyphBuffer.h: (WebCore::GlyphBuffer::expandInitialAdvance): (WebCore::GlyphBuffer::expandAdvance): * platform/graphics/WidthIterator.cpp: (WebCore::WidthIterator::WidthIterator): (WebCore::WidthIterator::hasExtraSpacing const): (WebCore::WidthIterator::advanceInternal): Delete the code that used to apply spacing before shaping. Instead, it gets moved to applyExtraSpacingAfterShaping(). (WebCore::WidthIterator::calculateAdditionalWidth const): This is a refactoring of the additional space calculation code. This is a const function, and has no side-effects. It outputs 4 floats: - How much space needs to be added to the left of the current character - How much space needs to be added to the right of the current character - How much space needs to be added to the left of the current character due to justification - How much space needs to be added to the right of the current character due to justification We need these last two values because one of the outputs of WidthIterator::advance() is a bool which represents whether or not we are ending on a justification space, so that the next WidthIterator that gets created for the next thing on the line can forbid/require a leading justification appropriately. (WebCore::WidthIterator::applyAdditionalWidth): Given the 4 values calculated in calculateAdditionalWidth(), apply them. We're operating in logical order, so this function has to do some translation from visual order to logical order (hence all the m_run.ltr() calls). If we're trying to add size to the left of the first character in LTR, we can't directly do that, because advances can only add space to the right side of a character, and there is no character to the left of the first character to expand. Therefore, we do this by increasing the initial advance of the GlyphBuffer, which is a special advance created just to solve this problem. In RTL, the problem is a bit more complicated - we don't know whether advance() will be called again, thereby delivering a glyph which we _can_ expand, so we instead store what would have been expanded inside m_leftoverJustificationWidth, and wait for the next call to advance(). If none comes, clients have to call finalize() instead, which will apply m_leftoverJustificationWidth to the GlyphBuffer's initial advance. (WebCore::WidthIterator::applyExtraSpacingAfterShaping): (WebCore::WidthIterator::finalize): (WebCore::WidthIterator::advance): * platform/graphics/WidthIterator.h: * rendering/svg/SVGTextMetricsBuilder.cpp: (WebCore::SVGTextMetricsBuilder::measureTextRenderer): 2020-08-10 Myles C. Maxfield <mmaxfield@apple.com> [Cocoa] Migrate from CTFontTransformGlyphsWithLanguage() to CTFontShapeGlyphs() https://bugs.webkit.org/show_bug.cgi?id=215059 Reviewed by Darin Adler. This is in preparation for https://bugs.webkit.org/show_bug.cgi?id=214769 and https://bugs.webkit.org/show_bug.cgi?id=206208. The solution for https://bugs.webkit.org/show_bug.cgi?id=214769 requires applying letter-spacing after text shaping. Today, we apply letter-spacing before text shaping which is wrong. However, if we want to apply letter-spacing after text shaping, we need to use CTFontShapeGlyphs(), which returns the glyph -> string mapping, which allows us to determine which glyphs to add letter-spacing to. Updates existing tests. Tests: fast/text/international/kana-voiced-sound-marks-1.html fast/text/international/kana-voiced-sound-marks-2.html * platform/graphics/Font.cpp: (WebCore::Font::applyTransforms const): * platform/graphics/Font.h: * platform/graphics/FontCascade.cpp: (WebCore::FontCascade::widthForSimpleText const): (WebCore::FontCascade::characterRangeCodePath): (WebCore::FontCascade::layoutSimpleText const): * platform/graphics/FontCascade.h: * platform/graphics/SurrogatePairAwareTextIterator.cpp: (WebCore::SurrogatePairAwareTextIterator::consumeSlowCase): Now that we're using CTFontShapeGlyphs(), the shaping routine can and does look at the underlying character string to perform character composition. This means that the glyph buffer needs to match exactly what is in the string. We can't do any shenanigans where we pretend the string has characters that aren't actually there. * platform/graphics/SurrogatePairAwareTextIterator.h: (WebCore::SurrogatePairAwareTextIterator::consume): * platform/graphics/WidthIterator.cpp: (WebCore::WidthIterator::shouldApplyFontTransforms const): (WebCore::WidthIterator::applyFontTransforms): Reversing the glyph buffer for rtl content needs to be done inside platform-specific code, because its behavior depends on which platform shaping routine is being used. (WebCore::WidthIterator::commitCurrentFontRange): (WebCore::WidthIterator::advanceInternal): * platform/graphics/WidthIterator.h: * platform/graphics/cocoa/FontCocoa.mm: (WebCore::Font::applyTransforms const): * platform/graphics/mac/SimpleFontDataCoreText.cpp: (WebCore::Font::getCFStringAttributes const): 2020-08-10 Devin Rousso <drousso@apple.com> Add quirk to force touch events on mail.yahoo.com https://bugs.webkit.org/show_bug.cgi?id=215329 <rdar://problem/59824469> Reviewed by Darin Adler and Tim Horton. <https://mail.yahoo.com/> serves a mobile site even in desktop browsing "mode", meaning that certain actions, such as selecting an aufotill contact, expect mobile behaviors, such as mouse events being dispatched after touch events rather than instantly (in the case of a connected trackpad with an iPad). This quirk ensures always mobile behavior for those actions, matching the expectations of <https://mail.yahoo.com/>. * page/Quirks.h: * page/Quirks.cpp: (WebCore::isYahooMail): Added. (WebCore::Quirks::shouldSynthesizeTouchEvents const): Added. (WebCore::Quirks::shouldAvoidPastingImagesAsWebContent const): * loader/DocumentLoader.h: * loader/DocumentLoader.cpp: (WebCore::DocumentLoader::mouseEventPolicy const): 2020-08-10 Chris Dumez <cdumez@apple.com> AuxiliaryProcess::didReceiveInvalidMessage() for WebPage::PerformDragControllerAction IPC https://bugs.webkit.org/show_bug.cgi?id=215341 <rdar://problem/59344091> Reviewed by Alex Christensen. Consistently use OptionSet<DragApplicationFlags> instead of DragApplicationFlags. * page/gtk/DragControllerGtk.cpp: (WebCore::DragController::isCopyKeyDown): * page/mac/DragControllerMac.mm: (WebCore::DragController::isCopyKeyDown): (WebCore::DragController::dragOperation): * platform/DragData.cpp: (WebCore::DragData::DragData): * platform/DragData.h: (WebCore::DragData::flags const): * platform/cocoa/DragDataCocoa.mm: (WebCore::DragData::DragData): * platform/win/DragDataWin.cpp: (WebCore::DragData::DragData): 2020-08-10 Peng Liu <peng.liu6@apple.com> MobileSafari crashes at WebCore: -[WebAVPlayerController seekToTime:toleranceBefore:toleranceAfter:] https://bugs.webkit.org/show_bug.cgi?id=215332 Reviewed by Eric Carlson. Add a NULL pointer check to fix a crash. * platform/ios/WebAVPlayerController.mm: (-[WebAVPlayerController seekToTime:toleranceBefore:toleranceAfter:]): 2020-08-10 Myles C. Maxfield <mmaxfield@apple.com> Shaping can be performed on glyphIDs from the wrong font https://bugs.webkit.org/show_bug.cgi?id=215333 Reviewed by Darin Adler. The problem is this line: if (font != lastFontData && width) This means we will only trigger shaping code if width is non-zero. However, even if width is non-zero, we will still happily add glyphs to the glyph buffer, and when we do eventually get around to shaping, we shape all yet-unshaped glyphs, regardless of which font they came from. Test: fast/text/zero-width-shaping-font-mismatch.html * platform/graphics/WidthIterator.cpp: (WebCore::WidthIterator::commitCurrentFontRange): (WebCore::WidthIterator::advanceInternal): * platform/graphics/WidthIterator.h: 2020-08-10 Clark Wang <clark_wang@apple.com> Add AudioProcessingEvent Constructor https://bugs.webkit.org/show_bug.cgi?id=215237 Reviewed by Chris Dumez. Added constructor according to spec: https://bugs.webkit.org/show_bug.cgi?id=215237. Added in AudioProcessingEventInit files. Test: webaudio/audioprocessingevent-constructor.html * CMakeLists.txt: * DerivedSources-input.xcfilelist: * DerivedSources-output.xcfilelist: * DerivedSources.make: * Modules/webaudio/AudioProcessingEvent.cpp: (WebCore::AudioProcessingEvent::create): (WebCore::AudioProcessingEvent::AudioProcessingEvent): * Modules/webaudio/AudioProcessingEvent.h: * Modules/webaudio/AudioProcessingEvent.idl: * Modules/webaudio/AudioProcessingEventInit.h: Added. * Modules/webaudio/AudioProcessingEventInit.idl: Added. * Sources.txt: * WebCore.xcodeproj/project.pbxproj: 2020-08-10 Chris Dumez <cdumez@apple.com> Align existing AudioParam API with the specification https://bugs.webkit.org/show_bug.cgi?id=215301 Reviewed by Sam Weinig. Align existing AudioParam API with the specification: - https://www.w3.org/TR/webaudio/#AudioParam In particular, the following changes were made: - Use float instead of unrestricted float where appropriate, so that we properly throw when provided non-finite values. - Use double instead of float where appropriate - A lot of the operations were previously returning nothing but they should return the AudioParam itself to allow chaining. - Throw an exceptions when passed invalid values (e.g. negative times) - Throw exceptions when events overlap. This part is based on Chromium's implementation here: - https://github.com/chromium/chromium/blob/master/third_party/blink/renderer/modules/webaudio/audio_param_timeline.cc#L513 and is specification is here: - https://webaudio.github.io/web-audio-api/#dfn-automation-event This allows us to pass some more WPT webaudio tests. No new tests, rebaselined existing tests. * Modules/webaudio/AudioParam.cpp: * Modules/webaudio/AudioParam.h: * Modules/webaudio/AudioParam.idl: * Modules/webaudio/AudioParamTimeline.cpp: (WebCore::AudioParamTimeline::setValueAtTime): (WebCore::AudioParamTimeline::linearRampToValueAtTime): (WebCore::AudioParamTimeline::exponentialRampToValueAtTime): (WebCore::AudioParamTimeline::setTargetAtTime): (WebCore::AudioParamTimeline::setValueCurveAtTime): (WebCore::AudioParamTimeline::insertEvent): (WebCore::AudioParamTimeline::cancelScheduledValues): (WebCore::AudioParamTimeline::valuesForTimeRangeImpl): * Modules/webaudio/AudioParamTimeline.h: (WebCore::AudioParamTimeline::ParamEvent::ParamEvent): (WebCore::AudioParamTimeline::ParamEvent::time const): (WebCore::AudioParamTimeline::ParamEvent::duration const): (WebCore::AudioParamTimeline::ParamEvent::curve): 2020-08-10 Eric Carlson <eric.carlson@apple.com> r262456 broke sites that expect webkitDisplayingFullscreen to be true almost immediately https://bugs.webkit.org/show_bug.cgi?id=215240 <rdar://problem/66284042> Reviewed by Darin Adler. Add a quirk for sites that use the Akamai Media Player, which begins polling `webkitDisplayingFullscreen` every 100ms immediately after entering video fullscreen mode and exits fullscreen as soon as it returns false. r262456 changed the HTMLMediaPlayer state machine so `webkitDisplayingFullscreen` doesn't return `true` until the fullscreen window has been opened in the UI process. This was done to fix bugs triggered by rapidly entering and exiting fullscreen and PiP and make our own fullscreen/PiP tests less flakey, so instead of reverting the change universally do it as a quirk for sites using the Akamai Media Player. * html/HTMLVideoElement.cpp: (WebCore::HTMLVideoElement::webkitDisplayingFullscreen): * page/Quirks.cpp: (WebCore::Quirks::needsAkamaiMediaPlayerQuirk const): * page/Quirks.h: 2020-08-10 Antti Koivisto <antti@apple.com> Return values of FontDatabase::collectionForFamily are not thread safe https://bugs.webkit.org/show_bug.cgi?id=215320 <rdar://problem/66502539> Reviewed by Anders Carlsson. Font prewarming can add new entries to m_familyNameToFontDescriptors while lookups are being made. Access to it is protected by a lock. However if the hashmap ends up rehashing, the pointer returned from collectionForFamily may end up becoming invalid. This can result in a crash later under findClosestFont. * platform/graphics/cocoa/FontCacheCoreText.cpp: (WebCore::FontDatabase::collectionForFamily): Heap allocate the hashmap values so they stay valid over hashtable mutations. 2020-08-09 Said Abou-Hallawa <sabouhallawa@apple.com> [macOS] Drag/drop an image of a unsupported format to an file input element should convert it to a supported format https://bugs.webkit.org/show_bug.cgi?id=212482 <rdar://problem/63731672> Reviewed by Darin Adler. Although the list of the dropped files are sent from the UI process to the Web process through the WebPage channel, the file input settings are only known by the Web process. So we have to do the image transcoding in WebCore. Tests: fast/forms/file/entries-api/image-no-transcode-drag-drop.html fast/forms/file/entries-api/image-transcode-drag-drop.html * SourcesCocoa.txt: * WebCore.xcodeproj/project.pbxproj: * html/FileInputType.cpp: (WebCore::FileInputType::handleDOMActivateEvent): (WebCore::FileInputType::fileChooserSettings const): Move filling FileChooserSettings to the function: fileChooserSettings(). (WebCore::FileInputType::applyFileChooserSettings): Call fileChooserSettings() instead of receiving FileChooserSettings as an argument. (WebCore::FileInputType::filesChosen): Add this function which can be called from receiveDroppedFiles() or receiveDroppedFilesWithImageTranscoding(). (WebCore::FileInputType::receiveDroppedFilesWithImageTranscoding): Finds out whether image transcoding is needed for the dropped files. If it is needed, it will be done in a WorkQueue and call filesChosen() when it is done. Otherwise it will call filesChosen() immediately. (WebCore::FileInputType::receiveDroppedFiles): * html/FileInputType.h: * platform/graphics/ImageUtilities.h: Added. * platform/graphics/cg/ImageUtilitiesCG.cpp: Added. (WebCore::sharedImageTranscodingQueue): Provide a shared WorkQueue which can be used by WebCore and WebKit. (WebCore::transcodeImage): (WebCore::findImagesForTranscoding): (WebCore::transcodeImages): 2020-08-09 Wenson Hsieh <wenson_hsieh@apple.com> REGRESSION (r260831): Web process crashes under Editor::setComposition() after navigating with marked text https://bugs.webkit.org/show_bug.cgi?id=215315 <rdar://problem/64740092> Reviewed by Darin Adler. To address a variety of crashes due to frames changing (or otherwise losing) their document while executing editing commands, r260831 refactored the Editor class such that it extends the functionality of the Document class, rather than the Frame class. In nearly all scenarios, this either leads to no behavior change or prevents null pointer crashes, since a document is almost always attached to a frame when applying any editing commands. However, there is one scenario where a document that has not yet been attached to its frame (and therefore does not have a browsing context) will cause a null deref when trying to confirm an existing IME composition. The logic added in <https://trac.webkit.org/r150291> will try and confirm any existing composition range on a document right before committing provisional navigation. In the case where we are navigating back to a previously visited page, `m_frame`'s document in `FrameLoader::commitProvisionalLoad()` will not be attached until the cached page's mainframe is opened underneath `CachedPage::restore()`. Since the call to `Editor::confirmComposition()` currently happens before this step, we end up crashing while attempting to create a `UserTypingGestureIndicator`. Note that even if we avoid this with a null check, we'll still end up crashing shortly thereafter, underneath `Editor::insertTextForConfirmedComposition`. And even if this second crash is avoided with another null check, we'll just end up with some version of webkit.org/b/59121, where the composition range is present after navigation, but is out of sync with platform UI. To fix the crash (and also not bring back bug #59121), we refactor this composition confirmation logic so that it lives in Editor, and is also robust against the case where the document is not attached to a frame; we then invoke this call after we're done committing the provisional load, so that any frame that is not yet attached before commiting the load still has a chance to confirm its composition. Test: WKWebViewMacEditingTests.ProcessSwapAfterSettingMarkedText * editing/Editor.cpp: (WebCore::Editor::confirmCompositionAndNotifyClient): Move functionality from `willTransitionToCommitted` to `confirmCompositionAndNotifyClient`, a helper method that will bail if the document is not attached, but otherwise confirm the active composition (if it exists). * editing/Editor.h: * loader/FrameLoader.cpp: (WebCore::FrameLoader::commitProvisionalLoad): Add a call to confirm the editor's current composition after we're done committing the load. Note that in the case where we had a composition before committing the load, we'll end up confirming the composition earlier (in the first call site), rather than confirming after the load has been committed. This means that this second call will be a no-op, due to the editor not having any composition. (WebCore::FrameLoader::willTransitionToCommitted): Deleted. * loader/FrameLoader.h: 2020-08-09 Ben Nham <nham@apple.com> Preload graphics drivers in Mac WebProcess https://bugs.webkit.org/show_bug.cgi?id=215183 Reviewed by Darin Adler. In newer versions of Mac OS, graphics drivers are no longer part of the shared cache due to size restrictions. This can cause first render to be blocked by ~10 ms when we dlopen those drivers. To work around this, we preload the drivers when prewarming the WebProcess. * page/ProcessWarming.cpp: (WebCore::ProcessWarming::prewarmGlobally): 2020-08-09 Youenn Fablet <youenn@apple.com> Always resolve ReadableStream's tee()'s cancel promise after the stream closes or errors https://bugs.webkit.org/show_bug.cgi?id=215197 Reviewed by Darin Adler. Make sure to resolve the cancel promise if the source gets closed or errored. Test: imported/w3c/web-platform-tests/streams/queuing-strategies-size-function-per-global.window.html * Modules/streams/ReadableStreamInternals.js: (readableStreamTee): (readableStreamTeePullFunction): 2020-08-08 Myles C. Maxfield <mmaxfield@apple.com> Update OriginalAdvancesForCharacterTreatedAsSpace to work correctly in the presence of inserted or removed glyphs https://bugs.webkit.org/show_bug.cgi?id=215302 Reviewed by Darin Adler. OriginalAdvancesForCharacterTreatedAsSpace is trying to make sure that shaping doesn't cause spaces to get wider or thinner. However, the way it was doing that is, for all the space characters, overwrite that glyph index's advance after shaping to be what it was before shaping. However, this is wrong, because shaping can insert or delete glyphs. Instead, now that we have explicit string indices for each glyph, we can use those to determine which glyphs come from space characters. These glyphs are the ones which should be overwritten. * platform/graphics/WidthIterator.cpp: (WebCore::WidthIterator::applyFontTransforms): (WebCore::WidthIterator::advanceInternal): * platform/graphics/WidthIterator.h: 2020-08-08 Myles C. Maxfield <mmaxfield@apple.com> Fix bad merge in r265241 https://bugs.webkit.org/show_bug.cgi?id=215051 Unreviewed. This is something that got dropped in a bad merge from r265241. * platform/graphics/FontCascade.cpp: (WebCore::FontCascade::widthForSimpleText const): 2020-08-08 Myles C. Maxfield <mmaxfield@apple.com> Make GlyphBuffers required in the fast text codepath https://bugs.webkit.org/show_bug.cgi?id=215052 Reviewed by Darin Adler. This is in preparation for https://bugs.webkit.org/show_bug.cgi?id=214769 and https://bugs.webkit.org/show_bug.cgi?id=206208. Performing shaping affects the width of strings; indeed, that is one of its purposes for existence. Shaping can only happen when we have a GlyphBuffer to shape. We can't just arbitrarily decide to disable shaping for various functions just because those functions don't ever inspect the exact glyphs. No new tests. This is a preparation step toward https://bugs.webkit.org/show_bug.cgi?id=214769 and https://bugs.webkit.org/show_bug.cgi?id=206208, and I couldn't come up with a test case that was broken here. * platform/graphics/FontCascade.cpp: (WebCore::FontCascade::widthOfTextRange const): (WebCore::FontCascade::widthForSimpleText const): (WebCore::FontCascade::layoutSimpleText const): (WebCore::FontCascade::floatWidthForSimpleText const): (WebCore::FontCascade::adjustSelectionRectForSimpleText const): * platform/graphics/WidthIterator.cpp: (WebCore::WidthIterator::shouldApplyFontTransforms const): (WebCore::WidthIterator::applyFontTransforms): (WebCore::WidthIterator::advanceInternal): (WebCore::WidthIterator::advance): (WebCore::WidthIterator::advanceOneCharacter): * platform/graphics/WidthIterator.h: * rendering/svg/SVGTextMetricsBuilder.cpp: (WebCore::SVGTextMetricsBuilder::advanceSimpleText): 2020-08-08 Myles C. Maxfield <mmaxfield@apple.com> WidthIterator::m_finalRoundingWidth is always 0 https://bugs.webkit.org/show_bug.cgi?id=215307 Reviewed by Darin Adler. There's no reason for it to exist. No new tests because there is no behavior change. * platform/graphics/FontCascade.cpp: (WebCore::FontCascade::layoutSimpleText const): * platform/graphics/WidthIterator.cpp: (WebCore::WidthIterator::advanceInternal): * platform/graphics/WidthIterator.h: (WebCore::WidthIterator::runWidthSoFar const): (WebCore::WidthIterator::finalRoundingWidth const): Deleted. 2020-08-08 Myles C. Maxfield <mmaxfield@apple.com> Use references instead of pointers for GlyphBuffer::add()'s Font argument https://bugs.webkit.org/show_bug.cgi?id=215309 Reviewed by Darin Adler. They're not allowed to be null. No new tests because there is no behavior change. * platform/graphics/ComplexTextController.cpp: (WebCore::ComplexTextController::advance): * platform/graphics/FontCascade.cpp: (WebCore::FontCascade::widthForSimpleText const): (WebCore::FontCascade::drawGlyphBuffer const): (WebCore::offsetToMiddleOfGlyph): (WebCore::FontCascade::drawEmphasisMarks const): (WebCore::GlyphToPathTranslator::GlyphToPathTranslator): (WebCore::GlyphToPathTranslator::advance): (WebCore::FontCascade::dashesForIntersectionsWithRect const): * platform/graphics/GlyphBuffer.h: (WebCore::GlyphBuffer::fontAt const): (WebCore::GlyphBuffer::add): * platform/graphics/WidthIterator.cpp: (WebCore::WidthIterator::advanceInternal): * platform/graphics/displaylists/DisplayListItems.cpp: (WebCore::DisplayList::DrawGlyphs::generateGlyphBuffer const): * rendering/mathml/MathOperator.cpp: (WebCore::MathOperator::paintGlyph): (WebCore::MathOperator::paint): * rendering/mathml/RenderMathMLToken.cpp: (WebCore::RenderMathMLToken::paint): 2020-08-07 Chris Dumez <cdumez@apple.com> AudioContext / OfflineAudioContext should support a wider sample rate range https://bugs.webkit.org/show_bug.cgi?id=215289 Reviewed by Eric Carlson. AudioContext / OfflineAudioContext should support a wider sample rate range. We only supported sample rates in the [44100, 96000] range, which is much smaller than other browsers and would cause us to fail a LOT of web-platform-tests. We now support sample rates in the range [3000, 384000], which is the same range as Chromium. No new tests, rebaselined existing tests. * Modules/webaudio/AudioBuffer.cpp: (WebCore::AudioBuffer::create): * Modules/webaudio/BaseAudioContext.cpp: (WebCore::BaseAudioContext::isSampleRateRangeGood): * Modules/webaudio/BaseAudioContext.h: * Modules/webaudio/OfflineAudioContext.cpp: (WebCore::OfflineAudioContext::create): * platform/audio/FFTFrame.h: * platform/audio/HRTFPanner.cpp: (WebCore::HRTFPanner::fftSizeForSampleRate): Update fftSizeForSampleRate() to support wider sample rate range. This implementation is based on Chromium's: https://github.com/chromium/chromium/blob/master/third_party/blink/renderer/platform/audio/hrtf_panner.cc#L70 * platform/audio/gstreamer/FFTFrameGStreamer.cpp: (WebCore::FFTFrame::minFFTSize): (WebCore::FFTFrame::maxFFTSize): * platform/audio/mac/FFTFrameMac.cpp: (WebCore::FFTFrame::minFFTSize): (WebCore::FFTFrame::maxFFTSize): 2020-08-07 James Darpinian <jdarpinian@chromium.org> [WebGL2] Missing validation for sampler unit index https://bugs.webkit.org/show_bug.cgi?id=215303 Reviewed by Dean Jackson. Test: webgl/2.0.0/deqp/functional/gles3/negativeshaderapi.html * html/canvas/WebGL2RenderingContext.cpp: (WebCore::WebGL2RenderingContext::bindSampler): 2020-08-07 James Darpinian <jdarpinian@chromium.org> Off by one error in transform feedback buffer binding https://bugs.webkit.org/show_bug.cgi?id=215298 Reviewed by Dean Jackson. Caught by conformance test deqp/functional/gles3/negativebufferapi.html * html/canvas/WebGL2RenderingContext.cpp: (WebCore::WebGL2RenderingContext::setIndexedBufferBinding): 2020-08-07 Alexey Shvayka <shvaikalesh@gmail.com> {Intersection,Resize,Performance}Observer callbacks get incorrect `this` value https://bugs.webkit.org/show_bug.cgi?id=215162 Reviewed by Geoffrey Garen. This change utilizes CallbackThisObject] IDL attribute to invoke a callback of IntersectionObserver [1], ResizeObserver [2], and PerformanceObserver [3] with correct `this` value of its observer, aligning WebKit with Blink and Gecko. Tests: imported/w3c/web-platform-tests/intersection-observer/observer-callback-arguments.html imported/w3c/web-platform-tests/resize-observer/observe.html imported/w3c/web-platform-tests/performance-timeline/po-observe.any.js [1] https://w3c.github.io/IntersectionObserver/#notify-intersection-observers-algo (step 3.4) [2] https://github.com/w3c/csswg-drafts/pull/5383 [3] https://w3c.github.io/performance-timeline/#queue-the-performanceobserver-task (step 3.3.5) * html/LazyLoadImageObserver.cpp: * page/IntersectionObserver.cpp: (WebCore::IntersectionObserver::notify): * page/IntersectionObserverCallback.h: * page/IntersectionObserverCallback.idl: * page/PerformanceObserver.cpp: (WebCore::PerformanceObserver::deliver): * page/PerformanceObserverCallback.h: * page/PerformanceObserverCallback.idl: * page/ResizeObserver.cpp: (WebCore::ResizeObserver::deliverObservations): * page/ResizeObserverCallback.h: * page/ResizeObserverCallback.idl: 2020-08-07 Chris Dumez <cdumez@apple.com> baseLatency attribute is missing on AudioContext interface https://bugs.webkit.org/show_bug.cgi?id=215277 Reviewed by Eric Carlson. baseLatency attribute is missing on AudioContext interface: - https://www.w3.org/TR/webaudio/#dom-audiocontext-baselatency Test: webaudio/audiocontext-baselatency.html * Modules/webaudio/AudioContext.cpp: (WebCore::AudioContext::baseLatency): (WebCore::AudioContext::destination): * Modules/webaudio/AudioContext.h: * Modules/webaudio/AudioContext.idl: * Modules/webaudio/DefaultAudioDestinationNode.cpp: (WebCore::DefaultAudioDestinationNode::framesPerBuffer const): * Modules/webaudio/DefaultAudioDestinationNode.h: * platform/audio/AudioDestination.h: * platform/audio/cocoa/AudioDestinationCocoa.cpp: (WebCore::AudioDestinationCocoa::framesPerBuffer const): * platform/audio/cocoa/AudioDestinationCocoa.h: * platform/audio/gstreamer/AudioDestinationGStreamer.cpp: (WebCore::AudioDestinationGStreamer::framesPerBuffer const): * platform/audio/gstreamer/AudioDestinationGStreamer.h: 2020-08-07 Rob Buis <rbuis@igalia.com> Implement PerfomanceObserverInit.buffered https://bugs.webkit.org/show_bug.cgi?id=214883 Reviewed by Darin Adler. Implement PerfomanceObserverInit.buffered IDL and functionality [1]. Behavior matches Chrome and Firefox. Tests: imported/w3c/web-platform-tests/resource-timing/buffered-flag.any.html imported/w3c/web-platform-tests/resource-timing/buffered-flag.any.worker.html imported/w3c/web-platform-tests/user-timing/buffered-flag.any.html imported/w3c/web-platform-tests/user-timing/buffered-flag.any.worker.html imported/w3c/web-platform-tests/performance-timeline/case-sensitivity.any.html imported/w3c/web-platform-tests/performance-timeline/case-sensitivity.any.worker.html [1] https://w3c.github.io/performance-timeline/#performanceobserverinit-dictionary * page/Performance.cpp: (WebCore::Performance::appendBufferedEntriesByType const): * page/Performance.h: * page/PerformanceObserver.cpp: (WebCore::PerformanceObserver::observe): * page/PerformanceObserver.h: * page/PerformanceObserver.idl: 2020-08-07 John Wilander <wilander@apple.com> Experimental: Cap the expiry of persistent cookies set in 3rd-party CNAME cloaked HTTP responses https://bugs.webkit.org/show_bug.cgi?id=215201 <rdar://problem/57454633> Reviewed by Brent Fulgham. Also reviewed and commented on by Chris Dumez, Jiten Mehta, Sam Weinig, and Alex Christensen. Tests: http/tests/resourceLoadStatistics/cname-cloaking-top-cname-sub-1p-cname.html http/tests/resourceLoadStatistics/cname-cloaking-top-cname-sub-3p-cname.html http/tests/resourceLoadStatistics/cname-cloaking-top-cname-sub-matching-cname.html http/tests/resourceLoadStatistics/cname-cloaking-top-cname-sub-no-cname.html http/tests/resourceLoadStatistics/cname-cloaking-top-no-cname-sub-1p-cname.html http/tests/resourceLoadStatistics/cname-cloaking-top-no-cname-sub-3p-cname.html http/tests/resourceLoadStatistics/cname-cloaking-top-no-cname-sub-no-cname.html * page/Settings.yaml: Added the off-by-default flag isCNAMECloakingMitigationEnabled. * platform/network/NetworkStorageSession.cpp: (WebCore::NetworkStorageSession::resourceLoadStatisticsEnabled const): New getter for the ITP setting. * platform/network/NetworkStorageSession.h: * platform/network/cocoa/NetworkStorageSessionCocoa.mm: (WebCore::NetworkStorageSession::capExpiryOfPersistentCookie): Broke this function out so that it can be reused. (WebCore::parseDOMCookie): Here's from where the function above was broken out. The existing functionality has a test case. 2020-08-07 Chris Dumez <cdumez@apple.com> length attribute is missing on OfflineAudioContext https://bugs.webkit.org/show_bug.cgi?id=215287 Reviewed by Geoffrey Garen. length attribute is missing on OfflineAudioContext: - https://www.w3.org/TR/webaudio/#dom-offlineaudiocontext-length Test: webaudio/offlineaudiocontext-length.html * Modules/webaudio/BaseAudioContext.h: (WebCore::BaseAudioContext::renderTarget const): * Modules/webaudio/OfflineAudioContext.cpp: (WebCore::OfflineAudioContext::length const): * Modules/webaudio/OfflineAudioContext.h: * Modules/webaudio/OfflineAudioContext.idl: 2020-08-07 Alexey Shvayka <shvaikalesh@gmail.com> Reduce the amount of custom binding code for JSXPathNSResolver https://bugs.webkit.org/show_bug.cgi?id=161030 Reviewed by Darin Adler. This patch introduces CustomXPathNSResolver callback interface, cleaning up CodeGeneratorJS.pm and removing custom binding code. XPathNSResolver is kept as a wrapper for NativeXPathNSResolver, preserving common case performance via IDL interface converter, and because a callback interface can't be returned from a function without substantial code generator change. Also, improves non-callable method error message and fixes 2 spec incompatibilities: a) no "lookupNamespaceURI" method lookup on functions [1]; b) resolver's "prefix" parameter is required [2]. Since C++ methods can't be overload based on return type, this patch adds [ImplementedAs] IDL attribute support for callback interface methods. Because XPathNSResolver wrappers are always temporary (no reference is kept), [IsWeakCallback] IDL attribute isn't added, preserving strong reference. [1]: https://heycam.github.io/webidl/#call-a-user-objects-operation (step 10.1) [2]: https://dom.spec.whatwg.org/#dom-xpathnsresolver-lookupnamespaceuri Tests: imported/w3c/web-platform-tests/dom/idlharness.window.js imported/w3c/web-platform-tests/domxpath/callback-interface.html * CMakeLists.txt: * DerivedSources-input.xcfilelist: * DerivedSources-output.xcfilelist: * DerivedSources.make: * Headers.cmake: * Sources.txt: * WebCore.xcodeproj/project.pbxproj: * bindings/IDLTypes.h: * bindings/js/JSCallbackData.cpp: (WebCore::JSCallbackData::invokeCallback): * bindings/js/JSCustomXPathNSResolver.cpp: Removed. * bindings/js/JSCustomXPathNSResolver.h: Removed. * bindings/js/JSDOMConvertXPathNSResolver.h: (WebCore::Converter<IDLInterface<XPathNSResolver>>::convert): (WebCore::Converter<IDLXPathNSResolver<T>>::convert): Deleted. (WebCore::JSConverter<IDLXPathNSResolver<T>>::convert): Deleted. (WebCore::JSConverter<IDLXPathNSResolver<T>>::convertNewlyCreated): Deleted. * bindings/scripts/CodeGenerator.pm: (IsBuiltinType): (IsWrapperType): * bindings/scripts/CodeGeneratorJS.pm: (AddToIncludesForIDLType): (GenerateHeader): (GenerateCallbackHeaderContent): (GenerateCallbackImplementationContent): (GetBaseIDLType): (NativeToJSValueDOMConvertNeedsState): (NativeToJSValueDOMConvertNeedsGlobalObject): * bindings/scripts/test/JS/JSTestObj.cpp: (WebCore::jsTestObjPrototypeFunctionMethodWithXPathNSResolverParameterBody): (WebCore::jsTestObjPrototypeFunctionMethodWithOptionalXPathNSResolverBody): * xml/CustomXPathNSResolver.cpp: Copied from Source/WebCore/bindings/js/JSXPathNSResolverCustom.cpp. (WebCore::CustomXPathNSResolver::lookupNamespaceURI): * xml/CustomXPathNSResolver.h: Copied from Source/WebCore/bindings/js/JSXPathNSResolverCustom.cpp. * xml/CustomXPathNSResolver.idl: Renamed from Source/WebCore/bindings/js/JSXPathNSResolverCustom.cpp. * xml/XPathNSResolver.idl: 2020-08-07 Antti Koivisto <antti@apple.com> REGRESSION (r260276): instructure.com custom PDF viewer stops scrolling / loading after switching to another tab then switching back https://bugs.webkit.org/show_bug.cgi?id=215215 <rdar://problem/65743028> Reviewed by Simon Fraser. Test: scrollingcoordinator/overflow-proxy-reattach.html * page/scrolling/ScrollingStateOverflowScrollProxyNode.cpp: (WebCore::ScrollingStateOverflowScrollProxyNode::setPropertyChangedBitsAfterReattach): We need to reset OverflowScrollingNode after reattach. * page/scrolling/ScrollingStateOverflowScrollProxyNode.h: * testing/Internals.cpp: (WebCore::Internals::setPageIsInWindow): * testing/Internals.h: * testing/Internals.idl: Add direct testing support for background tab state. 2020-08-07 Chris Dumez <cdumez@apple.com> Stop storing the sampleRate on AudioNode and get it from the AudioContext instead https://bugs.webkit.org/show_bug.cgi?id=215246 Reviewed by Eric Carlson. Stop storing the sampleRate on AudioNode and get it from the AudioContext instead. This avoids having to pass the sampleRate everywhere when we construct nodes. No new tests, no behavior change. * Modules/webaudio/AnalyserNode.cpp: (WebCore::AnalyserNode::AnalyserNode): * Modules/webaudio/AudioBasicInspectorNode.cpp: (WebCore::AudioBasicInspectorNode::AudioBasicInspectorNode): * Modules/webaudio/AudioBasicInspectorNode.h: * Modules/webaudio/AudioBasicProcessorNode.cpp: (WebCore::AudioBasicProcessorNode::AudioBasicProcessorNode): * Modules/webaudio/AudioBasicProcessorNode.h: * Modules/webaudio/AudioBufferSourceNode.cpp: (WebCore::AudioBufferSourceNode::AudioBufferSourceNode): * Modules/webaudio/AudioDestinationNode.cpp: (WebCore::AudioDestinationNode::AudioDestinationNode): * Modules/webaudio/AudioDestinationNode.h: * Modules/webaudio/AudioNode.cpp: (WebCore::AudioNode::AudioNode): (WebCore::AudioNode::sampleRate const): (WebCore::AudioNode::processIfNecessary): * Modules/webaudio/AudioNode.h: * Modules/webaudio/AudioScheduledSourceNode.cpp: (WebCore::AudioScheduledSourceNode::AudioScheduledSourceNode): * Modules/webaudio/AudioScheduledSourceNode.h: * Modules/webaudio/BaseAudioContext.cpp: (WebCore::BaseAudioContext::createScriptProcessor): * Modules/webaudio/BiquadFilterNode.cpp: (WebCore::BiquadFilterNode::BiquadFilterNode): * Modules/webaudio/ChannelMergerNode.cpp: (WebCore::ChannelMergerNode::create): (WebCore::ChannelMergerNode::ChannelMergerNode): * Modules/webaudio/ChannelMergerNode.h: * Modules/webaudio/ChannelSplitterNode.cpp: (WebCore::ChannelSplitterNode::create): (WebCore::ChannelSplitterNode::ChannelSplitterNode): * Modules/webaudio/ChannelSplitterNode.h: * Modules/webaudio/ConvolverNode.cpp: (WebCore::ConvolverNode::ConvolverNode): * Modules/webaudio/DefaultAudioDestinationNode.cpp: (WebCore::DefaultAudioDestinationNode::DefaultAudioDestinationNode): (WebCore::DefaultAudioDestinationNode::sampleRate const): * Modules/webaudio/DefaultAudioDestinationNode.h: * Modules/webaudio/DelayNode.cpp: (WebCore::DelayNode::DelayNode): * Modules/webaudio/DynamicsCompressorNode.cpp: (WebCore::DynamicsCompressorNode::DynamicsCompressorNode): * Modules/webaudio/GainNode.cpp: (WebCore::GainNode::GainNode): * Modules/webaudio/MediaElementAudioSourceNode.cpp: (WebCore::MediaElementAudioSourceNode::MediaElementAudioSourceNode): * Modules/webaudio/MediaStreamAudioDestinationNode.cpp: (WebCore::MediaStreamAudioDestinationNode::MediaStreamAudioDestinationNode): * Modules/webaudio/MediaStreamAudioSourceNode.cpp: (WebCore::MediaStreamAudioSourceNode::MediaStreamAudioSourceNode): * Modules/webaudio/OfflineAudioDestinationNode.cpp: (WebCore::OfflineAudioDestinationNode::OfflineAudioDestinationNode): * Modules/webaudio/OfflineAudioDestinationNode.h: * Modules/webaudio/OscillatorNode.cpp: (WebCore::OscillatorNode::OscillatorNode): * Modules/webaudio/PannerNode.cpp: * Modules/webaudio/PannerNode.h: * Modules/webaudio/ScriptProcessorNode.cpp: (WebCore::ScriptProcessorNode::create): (WebCore::ScriptProcessorNode::ScriptProcessorNode): * Modules/webaudio/ScriptProcessorNode.h: * Modules/webaudio/WaveShaperNode.cpp: (WebCore::WaveShaperNode::WaveShaperNode): * Modules/webaudio/WebKitAudioContext.cpp: (WebCore::WebKitAudioContext::createWebKitPanner): * Modules/webaudio/WebKitAudioPannerNode.cpp: (WebCore::WebKitAudioPannerNode::WebKitAudioPannerNode): * Modules/webaudio/WebKitAudioPannerNode.h: 2020-08-07 Dean Jackson <dino@apple.com> Pocket City game play area is blank (WebGL is broken in Catalyst) https://bugs.webkit.org/show_bug.cgi?id=215251 Reviewed by Tim Horton. Our configuration for WebGL under Catalyst was incorrect. Since it uses "desktop" OpenGL, it had to use the normal macOS setup (enabling texture rectangle extension, and the correct target). * platform/graphics/GraphicsContextGL.h: Add PLATFORM(MACCATALYST). * platform/graphics/cocoa/GraphicsContextGLOpenGLCocoa.mm: Ditto. (WebCore::GraphicsContextGLOpenGL::GraphicsContextGLOpenGL): 2020-08-07 Rob Buis <rbuis@igalia.com> Fix warnings related to unsigned >=0 ASSERTs https://bugs.webkit.org/show_bug.cgi?id=215223 Reviewed by Sergio Villar Senin. Fix warnings related to unsigned >=0 ASSERTs by removing the expressions. Example warning: TextCheckingHelper.cpp:425:39: warning: comparison of unsigned expression >= 0 is always true [-Wtype-limits] * editing/Editor.cpp: (WebCore::Editor::markAndReplaceFor): * editing/TextCheckingHelper.cpp: (WebCore::TextCheckingHelper::findFirstMisspelledWordOrUngrammaticalPhrase const): (WebCore::TextCheckingHelper::findUngrammaticalPhrases const): (WebCore::TextCheckingHelper::guessesForMisspelledWordOrUngrammaticalPhrase const): 2020-08-06 Sihui Liu <sihui_liu@apple.com> Text manipulation: leading and trailing spaces should be ignored when comparing content https://bugs.webkit.org/show_bug.cgi?id=214878 <rdar://problem/63735024> Reviewed by Ryosuke Niwa. TextIterator does not emit collapsed space if there is no text emitted before or the last emitted character is collapsed space. When TextManipulationController starts observing paragraphs, it iterates the whole document and the range of TextIterator is the range of document. For some text node A in the document, if TextIterator emits text for some other text node B before it, the collapsed space at the beginning of A will be emitted, and TextManipulationController would think the emitted space is part of A's content. When TextManipulationController replaces content for A, and the range of TextIterator is set to the range of A, the collapsed space is not emitted. The check to ensure A's content is unchanged would fail. To solve this issue, for first and last token in the paragraph, TextManipulationController checks content after removing leading and trailing spaces. API test: TextManipulation.CompleteTextManipulationParagraphsContainCollapsedSpaces * editing/TextManipulationController.cpp: (WebCore::areEqualIgnoringLeadingAndTrailingWhitespaces): (WebCore::TextManipulationController::replace): 2020-08-06 Kenneth Russell <kbr@chromium.org> Implement createImageBitmap(ImageData) https://bugs.webkit.org/show_bug.cgi?id=183438 Reviewed by Dean Jackson. Implement createImageBitmap(ImageData), including scaling, flipping and alpha premultiplication, and fix bugs in createImageBitmap(ImageBitmap). Support copying unpremultiplied-alpha data to the unpremultiplied-alpha format in ImageBuffer::putImageData. Plumb this change through all ImageBuffer backends and display lists. Handle error cases exposed by W3C WPT tests now that createImageBitmap(ImageData) is working. * bindings/js/SerializedScriptValue.cpp: (WebCore::CloneSerializer::dumpImageBitmap): (WebCore::CloneDeserializer::readImageBitmap): * html/ImageBitmap.cpp: (WebCore::ImageBitmap::create): (WebCore::ImageBitmap::detachBitmaps): (WebCore::alphaPremultiplicationForPremultiplyAlpha): (WebCore::ImageBitmap::resolveWithBlankImageBuffer): (WebCore::ImageBitmap::createPromise): (WebCore::ImageBitmap::createFromBuffer): * html/ImageBitmap.h: * html/OffscreenCanvas.cpp: (WebCore::OffscreenCanvas::transferToImageBitmap): * html/canvas/WebGLRenderingContextBase.cpp: (WebCore::WebGLRenderingContextBase::texImageSourceHelper): (WebCore::WebGLRenderingContextBase::texImageImpl): * html/canvas/WebGLRenderingContextBase.h: * platform/graphics/ConcreteImageBuffer.h: (WebCore::ConcreteImageBuffer::putImageData): * platform/graphics/ImageBuffer.h: (WebCore::ImageBuffer::putImageData): * platform/graphics/ImageBufferBackend.cpp: (WebCore::ImageBufferBackend::convertToLuminanceMask): (WebCore::copyUnpremultipliedToUnpremultiplied): (WebCore::ImageBufferBackend::copyImagePixels const): (WebCore::ImageBufferBackend::putImageData): * platform/graphics/ImageBufferBackend.h: * platform/graphics/cairo/GraphicsContextGLCairo.cpp: (WebCore::GraphicsContextGLOpenGL::ImageExtractor::extractImage): * platform/graphics/cairo/ImageBufferCairoSurfaceBackend.cpp: (WebCore::ImageBufferCairoSurfaceBackend::putImageData): * platform/graphics/cairo/ImageBufferCairoSurfaceBackend.h: * platform/graphics/cg/GraphicsContextGLCG.cpp: (WebCore::GraphicsContextGLOpenGL::ImageExtractor::extractImage): * platform/graphics/cg/ImageBufferCGBackend.cpp: (WebCore::copyImagePixelsAccelerated): * platform/graphics/cg/ImageBufferCGBitmapBackend.cpp: (WebCore::ImageBufferCGBitmapBackend::putImageData): * platform/graphics/cg/ImageBufferCGBitmapBackend.h: * platform/graphics/cg/ImageBufferIOSurfaceBackend.cpp: (WebCore::ImageBufferIOSurfaceBackend::putImageData): * platform/graphics/cg/ImageBufferIOSurfaceBackend.h: * platform/graphics/displaylists/DisplayListItems.cpp: (WebCore::DisplayList::PutImageData::PutImageData): (WebCore::DisplayList::operator<<): * platform/graphics/displaylists/DisplayListItems.h: (WebCore::DisplayList::PutImageData::create): (WebCore::DisplayList::PutImageData::destFormat const): (WebCore::DisplayList::PutImageData::encode const): (WebCore::DisplayList::PutImageData::decode): * platform/graphics/displaylists/DisplayListRecorder.cpp: (WebCore::DisplayList::Recorder::putImageData): * platform/graphics/displaylists/DisplayListRecorder.h: * platform/graphics/opengl/GraphicsContextGLOpenGL.cpp: (WebCore::GraphicsContextGLOpenGL::ImageExtractor::ImageExtractor): * platform/graphics/opengl/GraphicsContextGLOpenGL.h: * platform/graphics/win/GraphicsContextGLDirect2D.cpp: (WebCore::GraphicsContextGLOpenGL::ImageExtractor::extractImage): * platform/graphics/win/ImageBufferDirect2DBackend.cpp: (WebCore::ImageBufferDirect2DBackend::putImageData): * platform/graphics/win/ImageBufferDirect2DBackend.h: 2020-08-06 Simon Fraser <simon.fraser@apple.com> Avoid triggering redundant compositing updates when trying ot run a steps() animation on transform https://bugs.webkit.org/show_bug.cgi?id=215241 <rdar://problem/62737868> Reviewed by Zalan Bujtas. With a steps() timing function and keyframes animating the transform property, KeyframeEffect::applyPendingAcceleratedActions() tries to restart the animation every time because the GraphicsLayer reports that it didn't start an accelerated animation. r264856 patched some of this, but we still call animationFinished() every time, and this triggers a compositing update via the m_owningLayer.setNeeds* calls in RenderLayerBacking::animationFinished(). So don't try to remove the animation if wasn't running. This makes those compositing updates a no-op, which is important because these animations still invalidate style on every frame (webkit.org/b/215229). Test: animations/steps-transform-compositing-updates.html * animation/KeyframeEffect.cpp: (WebCore::KeyframeEffect::applyPendingAcceleratedActions): 2020-08-06 Peng Liu <peng.liu6@apple.com> Web process crashes at WebCore::FullscreenManager::didExitFullscreen https://bugs.webkit.org/show_bug.cgi?id=215243 Reviewed by Eric Carlson. No new tests, no functional change. * dom/FullscreenManager.cpp: (WebCore::FullscreenManager::didExitFullscreen): m_fullscreenElement might be nullptr when fullscreenOrPendingElement() is not nullptr. 2020-08-06 Wenson Hsieh <wenson_hsieh@apple.com> WeakPtr threading assertion on editing/undo-manager/undo-manager-delete-stale-undo-items.html https://bugs.webkit.org/show_bug.cgi?id=215221 <rdar://problem/66632111> Reviewed by Devin Rousso. Refactors `UndoItem` to avoid dereferencing its `m_undoManager` underneath `UndoItem::document`, which is consulted when computing its JS wrapper's opaque roots. Instead of going through `m_undoManager` to grab the document, store a `WeakPtr` to the `Document` upon setting the `UndoManager` and return its pointer value directly in `document()`. * page/UndoItem.cpp: (WebCore::UndoItem::setUndoManager): (WebCore::UndoItem::invalidate): (WebCore::UndoItem::document const): * page/UndoItem.h: 2020-08-06 Myles C. Maxfield <mmaxfield@apple.com> Use references instead of pointers for WidthIterator's fonts https://bugs.webkit.org/show_bug.cgi?id=215186 Reviewed by Zalan Bujtas. They can never be null. No new tests because there is no behavior change. * platform/graphics/FontCascade.cpp: (WebCore::FontCascade::widthOfTextRange const): (WebCore::FontCascade::layoutSimpleText const): (WebCore::FontCascade::floatWidthForSimpleText const): (WebCore::FontCascade::adjustSelectionRectForSimpleText const): (WebCore::FontCascade::offsetForPositionForSimpleText const): * platform/graphics/WidthIterator.cpp: (WebCore::WidthIterator::WidthIterator): (WebCore::WidthIterator::applyFontTransforms): (WebCore::WidthIterator::advanceInternal): * platform/graphics/WidthIterator.h: * rendering/svg/SVGTextMetricsBuilder.cpp: (WebCore::SVGTextMetricsBuilder::initializeMeasurementWithTextRenderer): 2020-08-06 Chris Dumez <cdumez@apple.com> BaseAudioContext.decodeAudioData() should return a Promise https://bugs.webkit.org/show_bug.cgi?id=215242 Reviewed by Eric Carlson. BaseAudioContext.decodeAudioData() should return a Promise as per: - https://webaudio.github.io/web-audio-api/#dom-baseaudiocontext-decodeaudiodata Behavior is unchanged for prefixed WebKitAudioContext.decodeAudioData() to ensure backward compatibility. No new tests, rebaselined existing tests. * Modules/webaudio/AsyncAudioDecoder.cpp: (WebCore::AsyncAudioDecoder::decodeAsync): (WebCore::AsyncAudioDecoder::DecodingTask::DecodingTask): (WebCore::AsyncAudioDecoder::DecodingTask::notifyComplete): * Modules/webaudio/AsyncAudioDecoder.h: * Modules/webaudio/BaseAudioContext.cpp: (WebCore::BaseAudioContext::decodeAudioData): * Modules/webaudio/BaseAudioContext.h: * Modules/webaudio/BaseAudioContext.idl: * Modules/webaudio/WebKitAudioContext.idl: 2020-08-06 Chris Dumez <cdumez@apple.com> Drop non-standard createBuffer(ArrayBuffer, boolean) overload from AudioContext https://bugs.webkit.org/show_bug.cgi?id=215238 Reviewed by Darin Adler. Drop non-standard createBuffer(ArrayBuffer, boolean) overload from AudioContext: - https://webaudio.github.io/web-audio-api/#BaseAudioContext This overload is kept on WebKitAudioContext for backward-compatibility when the page is still using the prefixed API. No new tests, rebaselined existing test. * Modules/webaudio/BaseAudioContext.cpp: * Modules/webaudio/BaseAudioContext.h: * Modules/webaudio/BaseAudioContext.idl: * Modules/webaudio/WebKitAudioContext.cpp: (WebCore::WebKitAudioContext::createLegacyBuffer): * Modules/webaudio/WebKitAudioContext.h: * Modules/webaudio/WebKitAudioContext.idl: 2020-08-06 Chris Dumez <cdumez@apple.com> MediaStreamAudioDestinationNode should have a constructor https://bugs.webkit.org/show_bug.cgi?id=215233 Reviewed by Geoffrey Garen. MediaStreamAudioDestinationNode should have a constructor: - https://webaudio.github.io/web-audio-api/#mediastreamaudiodestinationnode No new tests, rebaselined existing tests. * Modules/webaudio/AnalyserNode.cpp: (WebCore::AnalyserNode::AnalyserNode): * Modules/webaudio/AudioBasicInspectorNode.cpp: (WebCore::AudioBasicInspectorNode::AudioBasicInspectorNode): (WebCore::AudioBasicInspectorNode::pullInputs): (WebCore::AudioBasicInspectorNode::checkNumberOfChannelsForInput): (WebCore::AudioBasicInspectorNode::updatePullStatus): * Modules/webaudio/AudioBasicInspectorNode.h: * Modules/webaudio/AudioContext.cpp: (WebCore::AudioContext::createMediaStreamDestination): * Modules/webaudio/MediaStreamAudioDestinationNode.cpp: (WebCore::MediaStreamAudioDestinationNode::create): (WebCore::MediaStreamAudioDestinationNode::MediaStreamAudioDestinationNode): * Modules/webaudio/MediaStreamAudioDestinationNode.h: * Modules/webaudio/MediaStreamAudioDestinationNode.idl: * Modules/webaudio/WebKitAudioContext.cpp: (WebCore::WebKitAudioContext::createMediaStreamDestination): 2020-08-06 Said Abou-Hallawa <sabouhallawa@apple.com> [CG] Avoid creating a sub-image when drawing a small scaled sub-rect from a native image https://bugs.webkit.org/show_bug.cgi?id=215015 <rdar://problem/63845893> Reviewed by Simon Fraser. The reason for creating the sub-image in GraphicsContext::drawNativeImage() is to have a better image interpolation for the scaled sub-rect. For small destRect, the interpolation on the original image is almost the same as the interpolation on the sub-image. So we should avoid creating the sub- image if destRect.area() is less than some minimum value. Creating many sub-images can affect the rendering performance. * platform/graphics/cg/GraphicsContextCG.cpp: (WebCore::GraphicsContext::drawNativeImage): 2020-08-06 David Kilzer <ddkilzer@apple.com> WTF::makeString() should handle enum values <https://webkit.org/b/214906> Reviewed by Sam Weinig. * Modules/webgpu/WHLSL/Metal/WHLSLMangledNames.h: (WTF::MangledNameAdaptor::length): (WTF::MangledNameAdaptor::writeTo): - Update for function renames. 2020-08-06 Chris Dumez <cdumez@apple.com> MediaStreamAudioSourceNode should have a constructor https://bugs.webkit.org/show_bug.cgi?id=215225 Reviewed by Eric Carlson. MediaStreamAudioSourceNode should have a constructor: - https://webaudio.github.io/web-audio-api/#mediastreamaudiosourcenode No new tests, rebaselined existing tests. * CMakeLists.txt: * DerivedSources-input.xcfilelist: * DerivedSources-output.xcfilelist: * DerivedSources.make: * Modules/webaudio/AudioContext.cpp: (WebCore::AudioContext::createMediaStreamSource): * Modules/webaudio/MediaStreamAudioSourceNode.cpp: (WebCore::MediaStreamAudioSourceNode::create): * Modules/webaudio/MediaStreamAudioSourceNode.h: * Modules/webaudio/MediaStreamAudioSourceNode.idl: * Modules/webaudio/MediaStreamAudioSourceOptions.h: Copied from Source/WebCore/Modules/webaudio/MediaStreamAudioSourceNode.idl. * Modules/webaudio/MediaStreamAudioSourceOptions.idl: Copied from Source/WebCore/Modules/webaudio/MediaStreamAudioSourceNode.idl. * Modules/webaudio/WebKitAudioContext.cpp: (WebCore::WebKitAudioContext::createMediaStreamSource): * Sources.txt: * WebCore.xcodeproj/project.pbxproj: 2020-08-06 Myles C. Maxfield <mmaxfield@apple.com> Rename LeadingExpansion and TrailingExpansion to LeftExpansion and RightExpansion https://bugs.webkit.org/show_bug.cgi?id=215211 Reviewed by Darin Adler. "Leading" and "Trailing" are terms-of-art which represent logical order. However, the behavior of these flags operates in visual order. Instead, we should rename them to their visual order analogues: left and right. No new tests because there is no behavior change. * html/canvas/CanvasRenderingContext2D.cpp: (WebCore::CanvasRenderingContext2D::measureText): (WebCore::CanvasRenderingContext2D::drawTextInternal): * layout/inlineformatting/InlineLineBuilder.cpp: (WebCore::Layout::LineBuilder::justifyRuns): (WebCore::Layout::LineBuilder::Run::expand): (WebCore::Layout::LineBuilder::Run::visuallyCollapseTrailingWhitespace): * platform/graphics/ComplexTextController.cpp: (WebCore::expansionLocation): (WebCore::ComplexTextController::adjustGlyphsAndAdvances): * platform/graphics/FontCascade.cpp: (WebCore::FontCascade::expansionOpportunityCountInternal): (WebCore::FontCascade::leftExpansionOpportunity): (WebCore::FontCascade::rightExpansionOpportunity): (WebCore::FontCascade::leadingExpansionOpportunity): Deleted. (WebCore::FontCascade::trailingExpansionOpportunity): Deleted. * platform/graphics/FontCascade.h: * platform/graphics/WidthIterator.cpp: (WebCore::WidthIterator::WidthIterator): (WebCore::expansionLocation): (WebCore::WidthIterator::advanceInternal): * platform/text/TextFlags.h: * rendering/ComplexLineLayout.cpp: (WebCore::expansionBehaviorForInlineTextBox): (WebCore::applyExpansionBehavior): * rendering/EllipsisBox.cpp: (WebCore::EllipsisBox::paint): (WebCore::EllipsisBox::selectionRect): (WebCore::EllipsisBox::paintSelection): * rendering/InlineBox.h: (WebCore::InlineBox::setCanHaveLeftExpansion): (WebCore::InlineBox::setCanHaveRightExpansion): (WebCore::InlineBox::setForceRightExpansion): (WebCore::InlineBox::setForceLeftExpansion): (WebCore::InlineBox::InlineBoxBitfields::InlineBoxBitfields): (WebCore::InlineBox::hasSelectedChildren const): (WebCore::InlineBox::setHasSelectedChildren): (WebCore::InlineBox::canHaveLeftExpansion const): (WebCore::InlineBox::canHaveRightExpansion const): (WebCore::InlineBox::forceRightExpansion const): (WebCore::InlineBox::forceLeftExpansion const): (WebCore::InlineBox::setCanHaveLeadingExpansion): Deleted. (WebCore::InlineBox::setCanHaveTrailingExpansion): Deleted. (WebCore::InlineBox::setForceTrailingExpansion): Deleted. (WebCore::InlineBox::setForceLeadingExpansion): Deleted. (WebCore::InlineBox::canHaveLeadingExpansion const): Deleted. (WebCore::InlineBox::canHaveTrailingExpansion const): Deleted. (WebCore::InlineBox::forceTrailingExpansion const): Deleted. (WebCore::InlineBox::forceLeadingExpansion const): Deleted. * rendering/InlineTextBox.cpp: (WebCore::InlineTextBox::expansionBehavior const): * rendering/InlineTextBox.h: * rendering/RenderFileUploadControl.cpp: (WebCore::RenderFileUploadControl::paintObject): (WebCore::RenderFileUploadControl::computeIntrinsicLogicalWidths const): * rendering/RenderListBox.cpp: (WebCore::RenderListBox::updateFromElement): (WebCore::RenderListBox::paintItemForeground): * rendering/RenderTextControl.cpp: (WebCore::RenderTextControl::getAverageCharWidth): * rendering/SimpleLineLayout.cpp: (WebCore::SimpleLineLayout::expansionBehavior): * rendering/SimpleLineLayout.h: * rendering/SimpleLineLayoutFunctions.cpp: (WebCore::SimpleLineLayout::initializeInlineTextBox): * rendering/svg/SVGInlineTextBox.cpp: (WebCore::SVGInlineTextBox::constructTextRun const): * rendering/svg/SVGTextMetrics.cpp: (WebCore::SVGTextMetrics::constructTextRun): 2020-08-06 Chris Dumez <cdumez@apple.com> DynamicsCompressorNode.reduction attribute should be a float, not an AudioParam https://bugs.webkit.org/show_bug.cgi?id=215195 Reviewed by Youenn Fablet. DynamicsCompressorNode.reduction attribute should be a float, not an AudioParam: - https://webaudio.github.io/web-audio-api/#dynamicscompressornode Backward-compatibility is maintained for the prefixed WebAudio API. No new tests, rebaselined existing tests. * CMakeLists.txt: * DerivedSources-input.xcfilelist: * DerivedSources-output.xcfilelist: * DerivedSources.make: * Modules/webaudio/DynamicsCompressorNode.cpp: (WebCore::DynamicsCompressorNode::DynamicsCompressorNode): (WebCore::DynamicsCompressorNode::process): * Modules/webaudio/DynamicsCompressorNode.h: (WebCore::DynamicsCompressorNode::reduction const): (WebCore::DynamicsCompressorNode::DynamicsCompressorNode): (WebCore::DynamicsCompressorNode::setReduction): * Modules/webaudio/DynamicsCompressorNode.idl: * Modules/webaudio/WebKitAudioContext.cpp: (WebCore::WebKitAudioContext::createWebKitDynamicsCompressor): * Modules/webaudio/WebKitAudioContext.h: * Modules/webaudio/WebKitAudioContext.idl: * Modules/webaudio/WebKitDynamicsCompressorNode.h: Copied from Source/WebCore/Modules/webaudio/DynamicsCompressorNode.idl. * Modules/webaudio/WebKitDynamicsCompressorNode.idl: Copied from Source/WebCore/Modules/webaudio/DynamicsCompressorNode.idl. * Sources.txt: * WebCore.xcodeproj/project.pbxproj: 2020-08-06 Truitt Savell <tsavell@apple.com> Unreviewed, reverting r265328. Broke 17 MediaRecorder tests. Reverted changeset: "Add support for MediaRecorder bitrate options" https://bugs.webkit.org/show_bug.cgi?id=214973 https://trac.webkit.org/changeset/265328 2020-08-06 Chris Dumez <cdumez@apple.com> MediaElementAudioSourceNode interface should have a constructor https://bugs.webkit.org/show_bug.cgi?id=215200 Reviewed by Youenn Fablet. MediaElementAudioSourceNode interface should have a constructor: - https://webaudio.github.io/web-audio-api/#mediaelementaudiosourcenode Test: webaudio/mediaelementaudiosourcenode-constructor.html * CMakeLists.txt: * DerivedSources-input.xcfilelist: * DerivedSources-output.xcfilelist: * DerivedSources.make: * Modules/webaudio/AudioContext.cpp: (WebCore::AudioContext::createMediaElementSource): * Modules/webaudio/AudioContext.idl: * Modules/webaudio/MediaElementAudioSourceNode.cpp: (WebCore::MediaElementAudioSourceNode::create): (WebCore::MediaElementAudioSourceNode::MediaElementAudioSourceNode): * Modules/webaudio/MediaElementAudioSourceNode.h: * Modules/webaudio/MediaElementAudioSourceNode.idl: * Modules/webaudio/MediaElementAudioSourceOptions.h: Copied from Source/WebCore/Modules/webaudio/MediaElementAudioSourceNode.idl. * Modules/webaudio/MediaElementAudioSourceOptions.idl: Copied from Source/WebCore/Modules/webaudio/MediaElementAudioSourceNode.idl. * Modules/webaudio/WebKitAudioContext.cpp: (WebCore::WebKitAudioContext::createMediaElementSource): * Sources.txt: * WebCore.xcodeproj/project.pbxproj: 2020-08-06 Youenn Fablet <youenn@apple.com> Add support for MediaRecorder bitrate options https://bugs.webkit.org/show_bug.cgi?id=214973 Reviewed by Eric Carlson. Pipe options to MediaRecorderPrivate constructor. For the actual implementation, pass it down to VideoSampleBufferCompressor and AudioSampleBufferCompressor. For AudioSampleBufferCompressor, we do not handle well some bit rates, so for now, we limit to specific values. Tests: http/wpt/mediarecorder/MediaRecorder-audio-bitrate.html http/wpt/mediarecorder/MediaRecorder-video-bitrate.html * Modules/mediarecorder/MediaRecorder.cpp: (WebCore::MediaRecorder::create): (WebCore::MediaRecorder::createMediaRecorderPrivate): (WebCore::MediaRecorder::MediaRecorder): (WebCore::MediaRecorder::startRecording): * Modules/mediarecorder/MediaRecorder.h: * Modules/mediarecorder/MediaRecorderProvider.cpp: (WebCore::MediaRecorderProvider::createMediaRecorderPrivate): * Modules/mediarecorder/MediaRecorderProvider.h: * WebCore.xcodeproj/project.pbxproj: * loader/EmptyClients.cpp: * platform/mediarecorder/MediaRecorderPrivate.h: * platform/mediarecorder/MediaRecorderPrivateAVFImpl.cpp: (WebCore::MediaRecorderPrivateAVFImpl::create): * platform/mediarecorder/MediaRecorderPrivateAVFImpl.h: * platform/mediarecorder/cocoa/AudioSampleBufferCompressor.h: * platform/mediarecorder/cocoa/AudioSampleBufferCompressor.mm: (WebCore::AudioSampleBufferCompressor::setBitsPerSecond): (WebCore::AudioSampleBufferCompressor::outputBitRate const): (WebCore::AudioSampleBufferCompressor::initAudioConverterForSourceFormatDescription): Do not exit when not able to set bitrate as we still want to set m_maxOutputPacketSize. In case of error in setting up the converter, clean it up so that we do not use a partially set up converter. * platform/mediarecorder/cocoa/MediaRecorderPrivateWriterCocoa.h: * platform/mediarecorder/cocoa/MediaRecorderPrivateWriterCocoa.mm: (WebCore::MediaRecorderPrivateWriter::create): (WebCore::MediaRecorderPrivateWriter::setOptions): * platform/mediarecorder/cocoa/VideoSampleBufferCompressor.h: * platform/mediarecorder/cocoa/VideoSampleBufferCompressor.mm: (WebCore::VideoSampleBufferCompressor::setBitsPerSecond): (WebCore::setCompressionSessionProperty): (WebCore::VideoSampleBufferCompressor::initCompressionSession): * testing/Internals.cpp: (WebCore::createRecorderMockSource): 2020-08-06 Simon Fraser <simon.fraser@apple.com> Scrolling tree nodes sometimes don't match layer z-order https://bugs.webkit.org/show_bug.cgi?id=215210 Reviewed by Antti Koivisto. When adding nodes to the scrolling state tree during compositing layer traversal, we would sometimes add then in the wrong order. For example, if the composited layer tree was: + Root + Stacking context Fixed layer 1 Fixed layer 2 we would build a scrolling tree like: + Root scrolling node Node for layer 2 Node for layer 1 This happened because RenderLayerCompositor::updateBackingAndHierarchy() failed to propagate up scrollingTreeState.nextChildIndex. This is generally benign, but inserting node 1 followed by node 2 would be seen as a scrolling tree mutation, causing us to re-commit the scrolling tree when it hadn't really changed, triggering extra CPU usage. Part of <rdar://problem/62737868>: higher CPU usage on instagram.com. Test: scrollingcoordinator/scrolling-tree/sibling-node-order.html * rendering/RenderLayerCompositor.cpp: (WebCore::RenderLayerCompositor::updateBackingAndHierarchy): 2020-08-05 Rob Buis <rbuis@igalia.com> Remove the StyleResolver-specific evaluate function in MediaQueryEvaluator https://bugs.webkit.org/show_bug.cgi?id=152089 Reviewed by Darin Adler. The function mentioned in the bug is already gone (see r252736), also remove the StyleResolver reference. * css/MediaQueryEvaluator.h: 2020-08-05 Simon Fraser <simon.fraser@apple.com> Add some more Animations logging https://bugs.webkit.org/show_bug.cgi?id=215181 Reviewed by Zalan Bujtas. Add logging that shows when DeclarativeAnimation::tick() runs and when it invalidates style. * animation/DeclarativeAnimation.cpp: (WebCore::DeclarativeAnimation::tick): * animation/DocumentTimelinesController.cpp: (WebCore::DocumentTimelinesController::updateAnimationsAndSendEvents): * animation/KeyframeEffect.cpp: (WebCore::KeyframeEffect::invalidate): 2020-08-05 Peng Liu <peng.liu6@apple.com> Netflix.com shows a scrubber that doesn't work https://bugs.webkit.org/show_bug.cgi?id=215199 Reviewed by Eric Carlson. The "contentDuration" property of WebPlaybackControlsManager needs to be infinite when the video is not seekable. Otherwise, AVKit will show a scrubber that doesn't work on the Touch Bar. * platform/mac/WebPlaybackControlsManager.mm: (-[WebPlaybackControlsManager contentDuration]): (-[WebPlaybackControlsManager setContentDuration:]): 2020-08-05 James Darpinian <jdarpinian@chromium.org> [WebGL2] Upgrade vertexAttribPointer with new supported types https://bugs.webkit.org/show_bug.cgi?id=215036 Reviewed by Dean Jackson. Tested by updated WebGL conformance tests webgl/2.0.0/conformance/attribs/gl-vertexattribpointer-offsets.html and webgl/2.0.0/conformance/attribs/gl-vertexattribpointer.html * html/canvas/WebGLRenderingContextBase.cpp: (WebCore::WebGLRenderingContextBase::sizeInBytes): (WebCore::WebGLRenderingContextBase::vertexAttribPointer): 2020-08-05 Tim Horton <timothy_horton@apple.com> Remove all references to non-existent 10.16 https://bugs.webkit.org/show_bug.cgi?id=215202 Reviewed by Wenson Hsieh. * Configurations/Base.xcconfig: * Configurations/DebugRelease.xcconfig: * Configurations/Version.xcconfig: * Configurations/WebKitTargetConditionals.xcconfig: 2020-08-05 Andres Gonzalez <andresg_22@apple.com> Crash in com.apple.WebKit.WebContent at com.apple.AppKit: _NSAccessibilityRemoveAllObserversAndSendDestroyedNotification https://bugs.webkit.org/show_bug.cgi?id=215189 <rdar://problem/66561167> Reviewed by Chris Fleizach. AXIsolatedObject::detachPlatformWrapper was calling the wrapper's detach method that in turn calls the system NSAccessibilityUnregisterUniqueIdForUIElement on the secondary thread. This function is not thread safe and hence the random crashes. This changes AXIsolatedObject::detachPlatformWrapper to call the wrapper's detachIsolatedObject, avoiding the above problem altogether. The wrapper's detach remains the same that it was before isolated tree mode was introduced, and should only run on the main thread. * accessibility/AccessibilityObjectInterface.h: * accessibility/isolatedtree/AXIsolatedTree.cpp: (WebCore::AXIsolatedTree::applyPendingChanges): * accessibility/isolatedtree/mac/AXIsolatedObjectMac.mm: (WebCore::AXIsolatedObject::detachPlatformWrapper): * accessibility/mac/WebAccessibilityObjectWrapperBase.h: * accessibility/mac/WebAccessibilityObjectWrapperBase.mm: (-[WebAccessibilityObjectWrapperBase detach]): (-[WebAccessibilityObjectWrapperBase detachIsolatedObject:]): (-[WebAccessibilityObjectWrapperBase detachAXObject]): Merged back into detach. (-[WebAccessibilityObjectWrapperBase detachIsolatedObject]): Deleted. * accessibility/mac/WebAccessibilityObjectWrapperMac.mm: (-[WebAccessibilityObjectWrapper unregisterUniqueIdForUIElement]): 2020-08-05 Chris Dumez <cdumez@apple.com> Add constructor for DynamicsCompressorNode https://bugs.webkit.org/show_bug.cgi?id=215180 Reviewed by Geoffrey Garen. Add constructor for DynamicsCompressorNode: - https://webaudio.github.io/web-audio-api/#dynamicscompressornode This patch also add a new handleAudioNodeOptions() member function to AudioNode to avoid code duplication and every node constructor. No new tests, rebaselined existing tests. * CMakeLists.txt: * DerivedSources-input.xcfilelist: * DerivedSources-output.xcfilelist: * DerivedSources.make: * Modules/webaudio/AnalyserNode.cpp: (WebCore::AnalyserNode::create): * Modules/webaudio/AudioNode.cpp: (WebCore::AudioNode::AudioNode): (WebCore::AudioNode::initializeDefaultNodeOptions): (WebCore::AudioNode::handleAudioNodeOptions): * Modules/webaudio/AudioNode.h: * Modules/webaudio/BaseAudioContext.cpp: (WebCore::BaseAudioContext::createDynamicsCompressor): * Modules/webaudio/BiquadFilterNode.cpp: (WebCore::BiquadFilterNode::create): * Modules/webaudio/ChannelMergerNode.cpp: (WebCore::ChannelMergerNode::create): * Modules/webaudio/ChannelSplitterNode.cpp: (WebCore::ChannelSplitterNode::create): * Modules/webaudio/ConvolverNode.cpp: (WebCore::ConvolverNode::create): (WebCore::ConvolverNode::ConvolverNode): * Modules/webaudio/DefaultAudioDestinationNode.cpp: (WebCore::DefaultAudioDestinationNode::DefaultAudioDestinationNode): * Modules/webaudio/DelayNode.cpp: (WebCore::DelayNode::create): * Modules/webaudio/DynamicsCompressorNode.cpp: (WebCore::DynamicsCompressorNode::create): (WebCore::DynamicsCompressorNode::DynamicsCompressorNode): (WebCore::DynamicsCompressorNode::setChannelCount): (WebCore::DynamicsCompressorNode::setChannelCountMode): * Modules/webaudio/DynamicsCompressorNode.h: * Modules/webaudio/DynamicsCompressorNode.idl: * Modules/webaudio/DynamicsCompressorOptions.h: Copied from Source/WebCore/Modules/webaudio/DynamicsCompressorNode.idl. * Modules/webaudio/DynamicsCompressorOptions.idl: Copied from Source/WebCore/Modules/webaudio/DynamicsCompressorNode.idl. * Modules/webaudio/GainNode.cpp: (WebCore::GainNode::create): * Modules/webaudio/OscillatorNode.cpp: (WebCore::OscillatorNode::create): * Modules/webaudio/PannerNode.cpp: (WebCore::PannerNode::create): (WebCore::PannerNode::PannerNode): * Modules/webaudio/WaveShaperNode.cpp: (WebCore::WaveShaperNode::create): * Modules/webaudio/WebKitAudioPannerNode.cpp: (WebCore::WebKitAudioPannerNode::WebKitAudioPannerNode): * Sources.txt: * WebCore.xcodeproj/project.pbxproj: 2020-08-05 Chris Dumez <cdumez@apple.com> Add constructor to ConvolverNode https://bugs.webkit.org/show_bug.cgi?id=215169 Reviewed by Eric Carlson. Add constructor to ConvolverNode, as per specification: - https://webaudio.github.io/web-audio-api/#ConvolverNode No new tests, rebaselined existing tests. * CMakeLists.txt: * DerivedSources-input.xcfilelist: * DerivedSources-output.xcfilelist: * DerivedSources.make: * Modules/webaudio/BaseAudioContext.cpp: (WebCore::BaseAudioContext::createConvolver): * Modules/webaudio/ConvolverNode.cpp: (WebCore::ConvolverNode::create): (WebCore::ConvolverNode::ConvolverNode): (WebCore::ConvolverNode::setBuffer): (WebCore::ConvolverNode::setChannelCount): (WebCore::ConvolverNode::setChannelCountMode): * Modules/webaudio/ConvolverNode.h: * Modules/webaudio/ConvolverNode.idl: * Modules/webaudio/ConvolverOptions.h: Copied from Source/WebCore/Modules/webaudio/ConvolverNode.idl. * Modules/webaudio/ConvolverOptions.idl: Copied from Source/WebCore/Modules/webaudio/ConvolverNode.idl. * Sources.txt: * WebCore.xcodeproj/project.pbxproj: 2020-08-05 Chris Dumez <cdumez@apple.com> REGRESSION (r265266) DumpRenderTree crash at WebKitAudioListener::dopplerFactor https://bugs.webkit.org/show_bug.cgi?id=215171 <rdar://problem/66556999> Reviewed by Eric Carlson. We were calling the isWebKitAudioContext() virtual function from the BaseAudioContext constructor, which was not OK. We now initialize the listener lazily so that we can know if we are a WebKitAudioContext or not at the time of creation. Also use downcast<> instead of static_cast<> to cast from AudioListener to WebKitAudioListener for extra safety. Finally, AudioListener was missing a virtual destructor even though we were using polymorphism. No new tests, covered by existing tests that are crashing on the bots. * Modules/webaudio/AudioListener.h: (WebCore::AudioListener::isWebKitAudioListener const): * Modules/webaudio/AudioListener.idl: * Modules/webaudio/BaseAudioContext.cpp: (WebCore::BaseAudioContext::constructCommon): (WebCore::WebCore::BaseAudioContext::listener): * Modules/webaudio/BaseAudioContext.h: (WebCore::BaseAudioContext::listener): Deleted. * Modules/webaudio/PannerNode.cpp: (WebCore::PannerNode::listener): (WebCore::PannerNode::getAzimuthElevation): (WebCore::PannerNode::distanceConeGain): * Modules/webaudio/PannerNode.h: * Modules/webaudio/WebKitAudioContext.h: (WebCore::WebKitAudioContext::listener): * Modules/webaudio/WebKitAudioListener.h: (isType): * Modules/webaudio/WebKitAudioListener.idl: * Modules/webaudio/WebKitAudioPannerNode.cpp: (WebCore::WebKitAudioPannerNode::listener): (WebCore::WebKitAudioPannerNode::getAzimuthElevation): (WebCore::WebKitAudioPannerNode::dopplerRate): (WebCore::WebKitAudioPannerNode::distanceConeGain): * Modules/webaudio/WebKitAudioPannerNode.h: 2020-08-05 Chris Dumez <cdumez@apple.com> Align BiquadFilterNode.getFrequencyResponse() with the specification https://bugs.webkit.org/show_bug.cgi?id=215148 Reviewed by Eric Carlson. Align BiquadFilterNode.getFrequencyResponse() with the specification: - https://webaudio.github.io/web-audio-api/#dom-biquadfilternode-getfrequencyresponse In particular, the 3 argument arrays should not be nullable and we should throw if they have different lengths. No new tests, rebaselined existing tests. * Modules/webaudio/BiquadFilterNode.cpp: (WebCore::BiquadFilterNode::getFrequencyResponse): * Modules/webaudio/BiquadFilterNode.h: * Modules/webaudio/BiquadFilterNode.idl: 2020-08-05 Chris Dumez <cdumez@apple.com> Add constructor to BiquadFilterNode https://bugs.webkit.org/show_bug.cgi?id=215144 Reviewed by Eric Carlson. Add constructor to BiquadFilterNode: - https://webaudio.github.io/web-audio-api/#biquadfilternode No new tests, rebaselined existing tests.. * CMakeLists.txt: * DerivedSources-input.xcfilelist: * DerivedSources-output.xcfilelist: * DerivedSources.make: * Modules/webaudio/BaseAudioContext.cpp: (WebCore::BaseAudioContext::createBiquadFilter): * Modules/webaudio/BiquadDSPKernel.cpp: (WebCore::BiquadDSPKernel::updateCoefficientsIfNecessary): * Modules/webaudio/BiquadFilterNode.cpp: (WebCore::BiquadFilterNode::create): (WebCore::BiquadFilterNode::BiquadFilterNode): * Modules/webaudio/BiquadFilterNode.h: * Modules/webaudio/BiquadFilterNode.idl: * Modules/webaudio/BiquadFilterOptions.h: Copied from Source/WebCore/Modules/webaudio/BiquadFilterNode.idl. * Modules/webaudio/BiquadFilterOptions.idl: Copied from Source/WebCore/Modules/webaudio/BiquadFilterNode.idl. * Modules/webaudio/BiquadFilterType.h: Copied from Source/WebCore/Modules/webaudio/BiquadFilterNode.idl. * Modules/webaudio/BiquadFilterType.idl: Copied from Source/WebCore/Modules/webaudio/BiquadFilterNode.idl. * Modules/webaudio/BiquadProcessor.cpp: (WebCore::BiquadProcessor::BiquadProcessor): * Modules/webaudio/BiquadProcessor.h: * Sources.txt: * WebCore.xcodeproj/project.pbxproj: 2020-08-04 Simon Fraser <simon.fraser@apple.com> Update event regions only once per frame https://bugs.webkit.org/show_bug.cgi?id=215132 <rdar://problem/66533779> Reviewed by Darin Adler. Event regions (for touch-action, editable areas etc) were updated as part of compositing updates, but we only need their output once per rendering update, so move their computation out of RenderLayerCompositor::updateBackingAndHierarchy() and into a new RenderLayer tree walk that is called from Page::doAfterUpdateRendering(). RenderLayerBacking stores a dirty bit to track when regions need to be updated. Reduces the amount of time spent in rendering updates when scrolling on facebook.com on iPad, which has lots of discontiguous touch-action regions. * dom/Document.cpp: (WebCore::Document::updateEventRegions): * dom/Document.h: * page/Frame.cpp: (WebCore::Frame::layerTreeAsText const): * page/Page.cpp: (WebCore::Page::doAfterUpdateRendering): * rendering/RenderLayer.cpp: (WebCore::RenderLayer::calculateClipRects const): * rendering/RenderLayerBacking.cpp: (WebCore::RenderLayerBacking::maintainsEventRegion const): (WebCore::RenderLayerBacking::updateEventRegion): * rendering/RenderLayerBacking.h: * rendering/RenderLayerCompositor.cpp: (WebCore::RenderLayerCompositor::updateEventRegions): (WebCore::RenderLayerCompositor::updateBackingAndHierarchy): * rendering/RenderLayerCompositor.h: 2020-08-05 Adrian Perez de Castro <aperez@igalia.com> Unreviewed non-unified build fix. No new tests needed. * Modules/webaudio/AudioListener.h: Add forward declaration for BaseAudioSharedUnit. 2020-08-05 Sihui Liu <sihui_liu@appe.com> TextManipulationController should observe newly inserted or displayed text https://bugs.webkit.org/show_bug.cgi?id=215157 Reviewed by Wenson Hsieh. TextManipulationController already tracks renderer state of Element, but the case where Text children of an Element is newly inserted and displayed is not covered. Therefore, TextManipulationController also needs to know when render of Text is created. API test: TextManipulation.CompleteTextManipulationForNewlyDisplayedText * editing/TextManipulationController.cpp: (WebCore::TextManipulationController::didCreateRendererForTextNode): (WebCore::TextManipulationController::scheduleObservationUpdate): (WebCore::TextManipulationController::removeNode): * editing/TextManipulationController.h: * rendering/updating/RenderTreeUpdater.cpp: (WebCore::RenderTreeUpdater::createTextRenderer): 2020-08-05 Youenn Fablet <youenn@apple.com> RegistrationDatabase::openSQLiteDatabase can spin https://bugs.webkit.org/show_bug.cgi?id=215120 <rdar://problem/64850347> Reviewed by Geoffrey Garen. In case we fail opening the database when importing, we delete the database, the file and retry. We do not need to retry in that case since there is nothing to import. Update the code to proceed with sending an import failure to SWServer. In case of pushing changes to the database, it might be useful to retry but it is best to do this asynchronously. For instance, there might be a script deleting the files/folders where is stored the database. In that case, we check the result of pushing changes. If they succeed, we call the completion handler and stop. Otherwise, we will retry pushing the changes if changes were not pushed again in the meantime. We introduce a push counter for that purpose. * workers/service/server/RegistrationDatabase.cpp: (WebCore::RegistrationDatabase::postTaskToWorkQueue): (WebCore::RegistrationDatabase::openSQLiteDatabase): (WebCore::RegistrationDatabase::importRecordsIfNecessary): (WebCore::RegistrationDatabase::pushChanges): (WebCore::RegistrationDatabase::schedulePushChanges): (WebCore::RegistrationDatabase::doPushChanges): * workers/service/server/RegistrationDatabase.h: * workers/service/server/SWServer.cpp: (WebCore::SWServer::registrationStoreDatabaseFailedToOpen): 2020-08-05 Youenn Fablet <youenn@apple.com> SWServerJobQueue::didResolveRegistrationPromise should not assume its registration key relates to an existing worker https://bugs.webkit.org/show_bug.cgi?id=215123 <rdar://problem/65096786> Reviewed by Geoffrey Garen. We know that in some cases, the registration is null in SWServerJobQueue::didResolveRegistrationPromise. This might happen for instance in case a worker gets terminated, thus removing a job and the next job is clearing the registration. Also, SWServerJobQueue::didResolveRegistrationPromise is not checking that the job identifier is the same in SWServerJobQueue::install and SWServerJobQueue::didResolveRegistrationPromise while other code paths do. A future refactoring might allow to call SWServerJobQueue::didResolveRegistrationPromise code synchronously from SWServerJobQueue::install. In the meantime, let's add a null check and add release logging for that case. * workers/service/server/SWServerJobQueue.cpp: (WebCore::SWServerJobQueue::install): (WebCore::SWServerJobQueue::didResolveRegistrationPromise): 2020-08-05 Rob Buis <rbuis@igalia.com> Allow multiple calls to PerformanceObserver.observe with different types https://bugs.webkit.org/show_bug.cgi?id=214884 Reviewed by Darin Adler. Allow multiple calls to PerformanceObserver.observe with different type, but throw an exception if the observer type is changed [1]. Behavior matches Firefox and Chrome. Test: imported/web-platform-tests/performance-timeline/po-observe-type.any.html [1] https://w3c.github.io/performance-timeline/#observe-method * page/PerformanceObserver.cpp: (WebCore::PerformanceObserver::observe): * page/PerformanceObserver.h: 2020-08-05 Youenn Fablet <youenn@apple.com> Update AudioSampleDataSource offset computation https://bugs.webkit.org/show_bug.cgi?id=215127 <rdar://problem/65938265> Reviewed by Eric Carlson. As per logs, it sometimes happens that the offset is so big that the timestamp is below the start of the window. In that case, our logic is not able to catch up and reduce the offset. To handle this, we special case if the timestamp is below the start frame and do as if we were starting from scratch. Otherwise, we continue our logic to fine tune the offset by slowly making it bigger to not hit the end of the window but still be close to it. Updated logging to help further debugging this issue if needed. * platform/audio/mac/AudioSampleDataSource.h: * platform/audio/mac/AudioSampleDataSource.mm: (WebCore::AudioSampleDataSource::pushSamplesInternal): (WebCore::computeOffsetDelay): (WebCore::AudioSampleDataSource::pullSamplesInternal): (WebCore::AudioSampleDataSource::pullAvalaibleSamplesAsChunks): * platform/mediastream/mac/RealtimeIncomingAudioSourceCocoa.cpp: (WebCore::RealtimeIncomingAudioSourceCocoa::OnData): 2020-08-05 Eric Liang <ericliang@apple.com> AX: WebCore should provide a way to get raw role for accessibility objects https://bugs.webkit.org/show_bug.cgi?id=215149 Reviewed by Chris Fleizach. Added a conversion from WebRole to string for accessibility. This allows us to get it in the WebKit bundle. * accessibility/AXLogger.cpp: (WebCore::operator<<): * accessibility/AccessibilityObjectInterface.h: (WebCore::accessibilityRoleToString): * accessibility/ios/WebAccessibilityObjectWrapperIOS.mm: (-[WebAccessibilityObjectWrapper accessibilityElementCount]): (-[WebAccessibilityObjectWrapper _accessibilityWebRoleAsString]): (-[WebAccessibilityObjectWrapper accessibilityTraits]): 2020-08-04 Devin Rousso <drousso@apple.com> "DoubleDown Casino" respin button stops working with trackpad https://bugs.webkit.org/show_bug.cgi?id=215146 <rdar://problem/64668138> Reviewed by Tim Horton. * platform/RuntimeApplicationChecks.h: * platform/cocoa/RuntimeApplicationChecksCocoa.mm: (WebCore::IOSApplication::isDoubleDown): Added. 2020-08-04 Chris Dumez <cdumez@apple.com> Align AudioListener with the W3C specification https://bugs.webkit.org/show_bug.cgi?id=215134 Reviewed by Geoffrey Garen. Align AudioListener with the W3C specification: - https://webaudio.github.io/web-audio-api/#audiolistener Note that the prefixed API still behaves the way it used to. I have maintained the old version of the AudioListener API by moving it to a new WebKitAudioListener interface. No new tests, rebaselined existing tests. * CMakeLists.txt: * DerivedSources-input.xcfilelist: * DerivedSources-output.xcfilelist: * DerivedSources.make: * Modules/webaudio/AudioListener.cpp: (WebCore::AudioListener::AudioListener): (WebCore::AudioListener::setPosition): (WebCore::AudioListener::position const): (WebCore::AudioListener::setOrientation): (WebCore::AudioListener::orientation const): (WebCore::AudioListener::upVector const): * Modules/webaudio/AudioListener.h: (WebCore::AudioListener::create): (WebCore::AudioListener::positionX): (WebCore::AudioListener::positionY): (WebCore::AudioListener::positionZ): (WebCore::AudioListener::forwardX): (WebCore::AudioListener::forwardY): (WebCore::AudioListener::forwardZ): (WebCore::AudioListener::upX): (WebCore::AudioListener::upY): (WebCore::AudioListener::upZ): * Modules/webaudio/AudioListener.idl: * Modules/webaudio/BaseAudioContext.cpp: (WebCore::BaseAudioContext::constructCommon): * Modules/webaudio/PannerNode.cpp: (WebCore::PannerNode::dopplerRate): * Modules/webaudio/WebKitAudioContext.h: (WebCore::WebKitAudioContext::listener): * Modules/webaudio/WebKitAudioContext.idl: * Modules/webaudio/WebKitAudioListener.h: Copied from Source/WebCore/Modules/webaudio/AudioListener.h. * Modules/webaudio/WebKitAudioListener.idl: Copied from Source/WebCore/Modules/webaudio/AudioListener.idl. * Modules/webaudio/WebKitAudioPannerNode.cpp: (WebCore::WebKitAudioPannerNode::listener): * Modules/webaudio/WebKitAudioPannerNode.h: * Sources.txt: * WebCore.xcodeproj/project.pbxproj: * bindings/js/WebCoreBuiltinNames.h: 2020-08-04 Myles C. Maxfield <mmaxfield@apple.com> Add glyph origins member to GlyphBuffer https://bugs.webkit.org/show_bug.cgi?id=215057 Reviewed by Darin Adler. This is in preparation for https://bugs.webkit.org/show_bug.cgi?id=214769 and https://bugs.webkit.org/show_bug.cgi?id=206208. The solution for https://bugs.webkit.org/show_bug.cgi?id=214769 requires applying letter-spacing after text shaping. Today, we apply letter-spacing before text shaping, which is wrong. However, if we want to apply letter-spacing after text shaping, we need to use CTFontShapeGlyphs(), which outputs glyph origins in addition to glyph advances. Adding a glyph origins field to GlyphBuffer allows us to flatten these origins at the appropriate places. This patch is meant to be applied on top of https://bugs.webkit.org/show_bug.cgi?id=215051, which decreases the inline sizes of these vector members from 2048 to 1024. I measured the median and mean of these strings in our Page Load Test to be 6 and 7.4, which indicates we were being wildly inefficient with the members of GlyphBuffer. Decreasing these inline sizes means we're now using less memory than we were before. No new tests becasue there is no behavior change yet. This patch just adds the field. The next patch will hook up CTFontShapeGlyphs() itself. * platform/graphics/FontCascade.cpp: (WebCore::FontCascade::drawText const): (WebCore::FontCascade::drawEmphasisMarks const): (WebCore::FontCascade::displayListForTextRun const): (WebCore::FontCascade::drawGlyphBuffer const): * platform/graphics/GlyphBuffer.h: (WebCore::GlyphBufferAdvance::GlyphBufferAdvance): (WebCore::GlyphBufferOrigin::GlyphBufferOrigin): (WebCore::GlyphBufferOrigin::operator FloatPoint): (WebCore::GlyphBufferOrigin::setX): (WebCore::GlyphBufferOrigin::setY): (WebCore::GlyphBufferOrigin::x const): (WebCore::GlyphBufferOrigin::y const): (WebCore::GlyphBufferOrigin::encode const): (WebCore::GlyphBufferOrigin::decode): (WebCore::GlyphBuffer::clear): (WebCore::GlyphBuffer::origins): (WebCore::GlyphBuffer::origins const): (WebCore::GlyphBuffer::add): (WebCore::GlyphBuffer::remove): (WebCore::GlyphBuffer::makeHole): (WebCore::GlyphBuffer::shrink): (WebCore::GlyphBuffer::flatten): (WebCore::GlyphBuffer::isFlattened const): (WebCore::GlyphBuffer::swap): * platform/graphics/GraphicsContext.cpp: (WebCore::GraphicsContext::drawGlyphs): * platform/graphics/displaylists/DisplayListItems.cpp: (WebCore::DisplayList::DrawGlyphs::generateGlyphBuffer const): 2020-08-04 Chris Fleizach <cfleizach@apple.com> AX: VoiceOver needs access to font styling at insertion point https://bugs.webkit.org/show_bug.cgi?id=215129 <rdar://problem/65114972> Reviewed by Darin Adler. Give access to relevant font styling properties at the insertion point so that VoiceOver can speak them when text commands alter styling. Test: accessibility/mac/resolved-text-editing.html * accessibility/AccessibilityObject.cpp: (WebCore::AccessibilityObject::resolvedEditingStyles const): * accessibility/AccessibilityObject.h: * accessibility/AccessibilityObjectInterface.h: * accessibility/ios/WebAccessibilityObjectWrapperIOS.mm: (-[WebAccessibilityObjectWrapper _accessibilityResolvedEditingStyles]): * accessibility/isolatedtree/AXIsolatedObject.cpp: (WebCore::AXIsolatedObject::resolvedEditingStyles const): * accessibility/isolatedtree/AXIsolatedObject.h: * accessibility/mac/WebAccessibilityObjectWrapperBase.h: * accessibility/mac/WebAccessibilityObjectWrapperBase.mm: (-[WebAccessibilityObjectWrapperBase baseAccessibilityResolvedEditingStyles]): * accessibility/mac/WebAccessibilityObjectWrapperMac.mm: (-[WebAccessibilityObjectWrapper ALLOW_DEPRECATED_IMPLEMENTATIONS_END]): (-[WebAccessibilityObjectWrapper accessibilityAttributeValue:]): 2020-08-04 Peng Liu <peng.liu6@apple.com> REGRESSION (r265019): ASSERTION FAILED: !m_impl || m_impl->wasConstructedOnMainThread() == isMainThread() under WebCore::PlaybackSessionInterfaceAVKit::invalidate() https://bugs.webkit.org/show_bug.cgi?id=215118 Reviewed by Jer Noble. Revert the change about using a WeakPtr of PlaybackSessionModel in r265019. On WK1, a VideoFullscreenControllerContext (a subclass of PlaybackSessionModel) object is created on the main thread, so we cannot use a WeakPtr of it on the UI thread. No new tests, fix an API test failure: WebKitLegacy.AudioSessionCategoryIOS. * platform/ios/PlaybackSessionInterfaceAVKit.h: * platform/ios/PlaybackSessionInterfaceAVKit.mm: (WebCore::PlaybackSessionInterfaceAVKit::PlaybackSessionInterfaceAVKit): (WebCore::PlaybackSessionInterfaceAVKit::playbackSessionModel const): 2020-08-04 Chris Dumez <cdumez@apple.com> Align AudioBufferSourceNode's start() / stop() with the specification https://bugs.webkit.org/show_bug.cgi?id=215130 Reviewed by Darin Adler. Align AudioBufferSourceNode's start() / stop() with the specification: - https://www.w3.org/TR/webaudio/#dom-audiobuffersourcenode-start - https://www.w3.org/TR/webaudio/#dom-audioscheduledsourcenode-stop In particular, we should throw a RangeError when the parameters are invalid, not an InvalidStateError. Also, we should not return early if there is no buffer. No new tests, rebaselined existing tests. * Modules/webaudio/AudioBufferSourceNode.cpp: (WebCore::AudioBufferSourceNode::startPlaying): * Modules/webaudio/AudioScheduledSourceNode.cpp: (WebCore::AudioScheduledSourceNode::startLater): (WebCore::AudioScheduledSourceNode::stopLater): 2020-08-04 Andres Gonzalez <andresg_22@apple.com> Add the ability of comparing the accessibility tree with isolated tree mode on and off. https://bugs.webkit.org/show_bug.cgi?id=215000 Reviewed by Chris Fleizach. Test: accessibility/mac/isolated-tree-mode-on-off.html Added [WebAccessibilityObjectWrapper isIsolatedObject] for testing purposes, so that layout tests can determine whether an object is isolated or not. It should not be used by real clients since there should be no difference in behavior of a WebAccessibilityObjectWrapper from a client point of view, regardless the underlying object being isolated or not. * accessibility/mac/WebAccessibilityObjectWrapperBase.mm: (-[WebAccessibilityObjectWrapperBase isIsolatedObject]): 2020-08-04 Chris Dumez <cdumez@apple.com> Move non standard AudioBufferSourceNode API to new WebKitAudioBufferSourceNode interface https://bugs.webkit.org/show_bug.cgi?id=215106 Reviewed by Eric Carlson. Move non standard AudioBufferSourceNode API to new WebKitAudioBufferSourceNode interface to maintain backward compatibility while having an unprefixed API that matches the specification: - https://www.w3.org/TR/webaudio/#AudioBufferSourceNode In particular the 'playbackState' and 'gain' attributes should not part of the standard. Test: webaudio/audiobuffersourcenode-legacy-api.html * CMakeLists.txt: * DerivedSources-input.xcfilelist: * DerivedSources-output.xcfilelist: * DerivedSources.make: * Modules/webaudio/AudioBufferSourceNode.cpp: (WebCore::AudioBufferSourceNode::AudioBufferSourceNode): (WebCore::AudioBufferSourceNode::process): (WebCore::AudioBufferSourceNode::reset): * Modules/webaudio/AudioBufferSourceNode.h: (WebCore::AudioBufferSourceNode::legacyGainValue const): * Modules/webaudio/AudioBufferSourceNode.idl: * Modules/webaudio/WebKitAudioBufferSourceNode.h: Copied from Source/WebCore/Modules/webaudio/AudioBufferSourceNode.idl. * Modules/webaudio/WebKitAudioBufferSourceNode.idl: Copied from Source/WebCore/Modules/webaudio/AudioBufferSourceNode.idl. * Modules/webaudio/WebKitAudioContext.cpp: (WebCore::WebKitAudioContext::createWebKitBufferSource): * Modules/webaudio/WebKitAudioContext.h: * Modules/webaudio/WebKitAudioContext.idl: * Sources.txt: * WebCore.xcodeproj/project.pbxproj: * bindings/js/WebCoreBuiltinNames.h: 2020-08-04 Youenn Fablet <youenn@apple.com> Remove AudioSampleDataSource::setPaused https://bugs.webkit.org/show_bug.cgi?id=215125 Reviewed by Geoffrey Garen. m_paused is unused except for setting m_transitioningFromPaused. setPaused is only used in AudioMediaStreamTrackRenderCocoa at creation of the source. We can remove the call for setPaused(true) and remove setPaused/m_paused. * platform/audio/mac/AudioSampleDataSource.h: * platform/audio/mac/AudioSampleDataSource.mm: (WebCore::AudioSampleDataSource::setPaused): Deleted. * platform/mediastream/mac/AudioMediaStreamTrackRendererCocoa.cpp: (WebCore::AudioMediaStreamTrackRendererCocoa::pushSamples): 2020-08-04 Rob Buis <rbuis@igalia.com> Performance.getEntriesByName/Type should match case sensitive https://bugs.webkit.org/show_bug.cgi?id=214960 Reviewed by Youenn Fablet. Performance.getEntriesByName/Type should match case sensitive [1]. Behavior matches Firefox and Chrome. Tests: imported/w3c/web-platform-tests/performance-timeline/case-sensitivity.any.html imported/w3c/web-platform-tests/performance-timeline/case-sensitivity.any.worker.html [1] https://w3c.github.io/performance-timeline/#getentriesbytype-method * page/Performance.cpp: (WebCore::Performance::getEntriesByType const): (WebCore::Performance::getEntriesByName const): 2020-08-03 Simon Fraser <simon.fraser@apple.com> m_isEditableRegionEnabled should be reset in didCommitLoad, not didFinishLoad https://bugs.webkit.org/show_bug.cgi?id=215115 Reviewed by Wenson Hsieh. Resetting m_isEditableRegionEnabled in didFinishLoad() is too late because inline script at the end of the <body> (e.g. in a layout test) will have already run before the reset. Fix by adding Page::didCommitLoad() and resetting m_isEditableRegionEnabled there. * loader/FrameLoader.cpp: (WebCore::FrameLoader::dispatchDidCommitLoad): * page/Page.cpp: (WebCore::Page::didCommitLoad): (WebCore::Page::didFinishLoad): * page/Page.h: 2020-08-03 Myles C. Maxfield <mmaxfield@apple.com> Unconditionally record string offsets in the fast text codepath https://bugs.webkit.org/show_bug.cgi?id=215051 Reviewed by Darin Adler. This is in preparation for https://bugs.webkit.org/show_bug.cgi?id=214769 and https://bugs.webkit.org/show_bug.cgi?id=206208. The solution for https://bugs.webkit.org/show_bug.cgi?id=214769 requires applying letter-spacing after text shaping. Today, we apply letter-spacing before text shaping, which is wrong. However, if we want to apply letter-spacing after text shaping, we will need a way of mapping back which shaped glyphs correspond to which characters in the string, so we can apply letter-spacing to the correct glyphs. Therefore, we need to record string offsets any time letter-spacing can be applied (which is all the time - letter spacing can be applied on any element). This also helps on the path toward https://bugs.webkit.org/show_bug.cgi?id=214769. When we move off the complex text codepath, we will need these string offsets to calculate things like what the text range of a selection is when the user has selected some glyphs on the page. There is no performance change because these string offsets were already being calculated; the difference is just that we're storing them now. Also, we were being wildly inefficient with the members of GlyphBuffer, giving them inline sizes of 2048. I measured the median and mean of these strings in our Page Load Test to be 6 and 7.4. So, I cut down the inline sizes down to 1024, so now we're using less memory than we were before. No new tests because there is no behavior change. The additional string offsets are unused (for now). A subsequent patch will start using them. * platform/graphics/FontCascade.cpp: (WebCore::FontCascade::layoutText const): (WebCore::FontCascade::drawEmphasisMarks const): (WebCore::computeUnderlineType): (WebCore::FontCascade::layoutSimpleText const): (WebCore::FontCascade::layoutComplexText const): (WebCore::FontCascade::dashesForIntersectionsWithRect const): * platform/graphics/FontCascade.h: * platform/graphics/GlyphBuffer.h: (WebCore::GlyphBuffer::clear): (WebCore::GlyphBuffer::fonts): (WebCore::GlyphBuffer::offsetsInString): (WebCore::GlyphBuffer::fonts const): (WebCore::GlyphBuffer::offsetsInString const): (WebCore::GlyphBuffer::glyphAt const): (WebCore::GlyphBuffer::advanceAt const): (WebCore::GlyphBuffer::stringOffsetAt const): (WebCore::GlyphBuffer::add): (WebCore::GlyphBuffer::remove): (WebCore::GlyphBuffer::makeHole): (WebCore::GlyphBuffer::expandLastAdvance): (WebCore::GlyphBuffer::shrink): (WebCore::GlyphBuffer::swap): (WebCore::GlyphBuffer::saveOffsetsInString): Deleted. (WebCore::GlyphBuffer::offsetInString const): Deleted. 2020-08-03 Myles C. Maxfield <mmaxfield@apple.com> Rename WidthIterator::m_currentCharacter to WidthIterator::m_currentCharacterIndex https://bugs.webkit.org/show_bug.cgi?id=215056 Reviewed by Darin Adler. It represents an index, not a character. No new tests because there is no behavior change. This is in preparation for https://bugs.webkit.org/show_bug.cgi?id=214769 and https://bugs.webkit.org/show_bug.cgi?id=206208. * platform/graphics/FontCascade.cpp: (WebCore::FontCascade::offsetForPositionForSimpleText const): * platform/graphics/WidthIterator.cpp: (WebCore::WidthIterator::advanceInternal): (WebCore::WidthIterator::advance): (WebCore::WidthIterator::advanceOneCharacter): * platform/graphics/WidthIterator.h: (WebCore::WidthIterator::currentCharacterIndex const): (WebCore::WidthIterator::currentCharacter const): Deleted. 2020-08-03 Youenn Fablet <youenn@apple.com> Move user gesture propagation over promise behind a feature flag https://bugs.webkit.org/show_bug.cgi?id=215014 Reviewed by Eric Carlson. If runtime flag is false, disable user gesture propagation to the next micro task. * bindings/js/JSDOMWindowBase.cpp: (WebCore::JSDOMWindowBase::queueMicrotaskToEventLoop): * page/RuntimeEnabledFeatures.h: (WebCore::RuntimeEnabledFeatures::userGesturePromisePropagationEnabled const): (WebCore::RuntimeEnabledFeatures::setUserGesturePromisePropagationEnabled): 2020-08-03 Chris Dumez <cdumez@apple.com> Add constructor for AudioBufferSourceNode https://bugs.webkit.org/show_bug.cgi?id=215096 Reviewed by Darin Adler. Add constructor for AudioBufferSourceNode as per: - https://www.w3.org/TR/webaudio/#DelayNode This patch also adds support for the detune attribute on AudioBufferSourceNode, which gets initialized by the constructor. No new tests, rebaselined existing tests. * CMakeLists.txt: * DerivedSources-input.xcfilelist: * DerivedSources-output.xcfilelist: * DerivedSources.make: * Modules/webaudio/AudioBufferSourceNode.cpp: (WebCore::AudioBufferSourceNode::create): (WebCore::AudioBufferSourceNode::AudioBufferSourceNode): (WebCore::AudioBufferSourceNode::process): (WebCore::AudioBufferSourceNode::reset): (WebCore::AudioBufferSourceNode::totalPitchRate): * Modules/webaudio/AudioBufferSourceNode.h: * Modules/webaudio/AudioBufferSourceNode.idl: * Modules/webaudio/AudioBufferSourceOptions.h: Copied from Source/WebCore/Modules/webaudio/AudioBufferSourceNode.idl. * Modules/webaudio/AudioBufferSourceOptions.idl: Copied from Source/WebCore/Modules/webaudio/AudioBufferSourceNode.idl. * Modules/webaudio/BaseAudioContext.cpp: (WebCore::BaseAudioContext::createBufferSource): * Sources.txt: * WebCore.xcodeproj/project.pbxproj: 2020-08-03 Simon Fraser <simon.fraser@apple.com> Add an EventRegions log channel https://bugs.webkit.org/show_bug.cgi?id=215092 Reviewed by Daniel Bates. Add a log channel for EventRegions, add logging in some interesting places. * platform/Logging.h: * rendering/EventRegion.cpp: (WebCore::EventRegion::unite): (WebCore::EventRegion::uniteTouchActions): (WebCore::EventRegion::uniteEventListeners): * rendering/RenderBlock.cpp: (WebCore::RenderBlock::paintObject): * rendering/RenderLayer.cpp: (WebCore::RenderLayer::calculateClipRects const): * rendering/RenderLayerBacking.cpp: (WebCore::RenderLayerBacking::updateEventRegion): 2020-08-03 Myles C. Maxfield <mmaxfield@apple.com> Make FontCascade.drawText() return a FloatSize instead of a float https://bugs.webkit.org/show_bug.cgi?id=215055 Reviewed by Darin Adler. Advances are philosophically two-dimensional data structures. This is in preparation for https://bugs.webkit.org/show_bug.cgi?id=214769 and https://bugs.webkit.org/show_bug.cgi?id=206208. No new tests because there shouldn't be any behavior change. But in the weird rare case where there might be, we should be defensive and handle it correctly. I've never seen one of these cases, though. * inspector/InspectorOverlay.cpp: (WebCore::InspectorOverlay::drawElementTitle): * page/DebugPageOverlays.cpp: (WebCore::drawRightAlignedText): * platform/graphics/FontCascade.cpp: (WebCore::FontCascade::drawText const): * platform/graphics/FontCascade.h: * platform/graphics/GraphicsContext.cpp: (WebCore::GraphicsContext::drawText): (WebCore::GraphicsContext::drawBidiText): * platform/graphics/GraphicsContext.h: 2020-08-03 Tim Horton <timothy_horton@apple.com> Occasional crashes when running nested runloops while using UIWebView https://bugs.webkit.org/show_bug.cgi?id=213067 <rdar://problem/64239727> Reviewed by Darin Adler. New test: WebKitLegacy.NestedRunLoopUnderRunLoopObserverDoubleUnlock * platform/ios/wak/WebCoreThread.mm: (MainRunLoopAutoUnlock): (_WebThreadAutoLock): Under certain circumstances, a CFRunLoopObserver that is already removed can fire again (e.g. when removed in a nested runloop, it can be fired again in the main runloop). The WebThread code assumes that the auto-unlock observer is called exactly once after being installed. If this is not the case, the main thread lock count can underflow, wreaking havoc the next time we try to lock. Instead of depending on CFRunLoop to do this for us, make it explicit with a global boolean. This leaves in place the somewhat-odd behavior that running a nested runloop can cause the main runloop's WebThread lock to be dropped, because a great deal of code (and tests) depend on this behavior (keeping the lock held until the outer runloop spins would result in deadlock if the inner runloop's loop condition depends on the WebThread being able to execute code). However, this is not unique to this underflow case, and appears to be extremely long-standing behavior, so maintaining it seems the best course of action. 2020-08-03 Wenson Hsieh <wenson_hsieh@apple.com> Remove the ENABLE_DATA_INTERACTION feature flag https://bugs.webkit.org/show_bug.cgi?id=215091 Reviewed by Megan Gardner. `ENABLE(DATA_INTERACTION)` is an alias for `PLATFORM(IOS_FAMILY) && ENABLE(DRAG_SUPPORT)`. It was used early on when bringing drag and drop support to iPad in order to hide the feature from open source WebKit code, and has not been necessary for several years. * page/DragController.cpp: (WebCore::DragController::shouldUseCachedImageForDragImage const): * page/DragController.h: (WebCore::DragController::canLoadDataFromDraggingPasteboard const): * page/EventHandler.cpp: (WebCore::EventHandler::dragCancelled): (WebCore::EventHandler::didStartDrag): * page/FocusController.cpp: (WebCore::shouldClearSelectionWhenChangingFocusedElement): * page/mac/DragControllerMac.mm: * platform/DragImage.cpp: * platform/ios/WebItemProviderPasteboard.mm: 2020-08-03 Chris Dumez <cdumez@apple.com> Add constructor for GainNode https://bugs.webkit.org/show_bug.cgi?id=215093 Reviewed by Eric Carlson. Add constructor for GainNode as per: - https://www.w3.org/TR/webaudio/#gainnode No new tests, rebaselined existing tests. * CMakeLists.txt: * DerivedSources-input.xcfilelist: * DerivedSources-output.xcfilelist: * DerivedSources.make: * Modules/webaudio/BaseAudioContext.cpp: (WebCore::BaseAudioContext::createGain): * Modules/webaudio/GainNode.cpp: (WebCore::GainNode::create): (WebCore::GainNode::GainNode): (WebCore::GainNode::process): (WebCore::GainNode::reset): * Modules/webaudio/GainNode.h: * Modules/webaudio/GainNode.idl: * Modules/webaudio/GainOptions.h: Copied from Source/WebCore/Modules/webaudio/GainNode.idl. * Modules/webaudio/GainOptions.idl: Copied from Source/WebCore/Modules/webaudio/GainNode.idl. * Sources.txt: * WebCore.xcodeproj/project.pbxproj: 2020-08-03 Chris Dumez <cdumez@apple.com> Add constructor to DelayNode https://bugs.webkit.org/show_bug.cgi?id=215083 Reviewed by Eric Carlson. Add constructor to DelayNode: - https://www.w3.org/TR/webaudio/#DelayNode No new tests, rebaselined existing tests. * CMakeLists.txt: * DerivedSources-input.xcfilelist: * DerivedSources-output.xcfilelist: * DerivedSources.make: * Modules/webaudio/BaseAudioContext.cpp: (WebCore::BaseAudioContext::createDelay): * Modules/webaudio/DelayDSPKernel.cpp: (WebCore::DelayDSPKernel::process): * Modules/webaudio/DelayNode.cpp: (WebCore::DelayNode::DelayNode): (WebCore::DelayNode::create): (WebCore::DelayNode::delayTime): * Modules/webaudio/DelayNode.h: * Modules/webaudio/DelayNode.idl: * Modules/webaudio/DelayOptions.h: Copied from Source/WebCore/Modules/webaudio/DelayNode.idl. * Modules/webaudio/DelayOptions.idl: Copied from Source/WebCore/Modules/webaudio/DelayNode.idl. * Modules/webaudio/DelayProcessor.cpp: (WebCore::DelayProcessor::DelayProcessor): * Modules/webaudio/DelayProcessor.h: * Sources.txt: * WebCore.xcodeproj/project.pbxproj: 2020-08-03 Myles C. Maxfield <mmaxfield@apple.com> Make WidthIterator::advance() return void https://bugs.webkit.org/show_bug.cgi?id=215053 Reviewed by Darin Adler. This is in preparation for https://bugs.webkit.org/show_bug.cgi?id=214769 and https://bugs.webkit.org/show_bug.cgi?id=206208. This is a small simplification in the fast text codepath. It used to return how many characters were consumed. However, this information is already exposed by just calling currentCharacter() on the width iterator before and after calling advance(). No new tests because there is no behavior change. * platform/graphics/FontCascade.cpp: (WebCore::FontCascade::drawText const): (WebCore::FontCascade::displayListForTextRun const): (WebCore::FontCascade::layoutSimpleText const): (WebCore::FontCascade::adjustSelectionRectForSimpleText const): * platform/graphics/WidthIterator.cpp: (WebCore::WidthIterator::advanceInternal): (WebCore::WidthIterator::advance): * platform/graphics/WidthIterator.h: * rendering/svg/SVGTextMetricsBuilder.cpp: (WebCore::SVGTextMetricsBuilder::advanceSimpleText): 2020-08-03 Youenn Fablet <youenn@apple.com> MediaRecorderPrivateWriter should ensure its writer input is ready for more data before appending new samples https://bugs.webkit.org/show_bug.cgi?id=215081 Reviewed by Eric Carlson. After r265192, we were checking whether the writer input was ready. If so, we were pushing pending samples and then the new sample. The issue is that pushing pending samples might make the writer input no longer ready. Update the code to enqueue the sample if its writer input is not ready. Add an ASSERT in appendCompressedVideoSampleBuffer to make sure this is the case. Also make sure that we only enqueue the end of segment sample if video writer input is ready. Make sure flushCompressedSampleBuffers is called directly by stopRecording only if not already flushing samples. If we are not flushing, we proceed with the stop steps. If not, we wait for the end of flushCompressedSampleBuffers to proceed with the stop steps. * platform/mediarecorder/cocoa/MediaRecorderPrivateWriterCocoa.h: * platform/mediarecorder/cocoa/MediaRecorderPrivateWriterCocoa.mm: (WebCore::MediaRecorderPrivateWriter::appendCompressedAudioSampleBufferIfPossible): (WebCore::MediaRecorderPrivateWriter::appendCompressedVideoSampleBufferIfPossible): (WebCore::MediaRecorderPrivateWriter::appendCompressedVideoSampleBuffer): (WebCore::MediaRecorderPrivateWriter::flushCompressedSampleBuffers): (WebCore::MediaRecorderPrivateWriter::stopRecording): (WebCore::MediaRecorderPrivateWriter::finishedFlushingSamples): (WebCore::MediaRecorderPrivateWriter::doStopRecording): 2020-08-03 Clark Wang <clark_wang@apple.com> Added AudioBuffer Constructor https://bugs.webkit.org/show_bug.cgi?id=214990 Reviewed by Chris Dumez. Added AudioBuffer constructor according to spec: https://www.w3.org/TR/webaudio/#AudioBuffer-constructors. Added in AudioBufferOptions files. Updated BaseAudioContext::createBuffer to use new constructor. Re-baselined existing tests. Some fail now due to unsupported sampleRate. * CMakeLists.txt: * DerivedSources-input.xcfilelist: * DerivedSources-output.xcfilelist: * DerivedSources.make: * Modules/webaudio/AudioBuffer.cpp: (WebCore::AudioBuffer::create): (WebCore::AudioBuffer::AudioBuffer): * Modules/webaudio/AudioBuffer.h: * Modules/webaudio/AudioBuffer.idl: * Modules/webaudio/AudioBufferOptions.h: Added. * Modules/webaudio/AudioBufferOptions.idl: Added. * Modules/webaudio/BaseAudioContext.cpp: (WebCore::BaseAudioContext::createBuffer): * Modules/webaudio/BaseAudioContext.h: * Sources.txt: * WebCore.xcodeproj/project.pbxproj: 2020-08-03 Kenneth Russell <kbr@chromium.org> [WebGL2] webgl/2.0.0/conformance[2]/textures/image_bitmap* failures https://bugs.webkit.org/show_bug.cgi?id=211484 Reviewed by Dean Jackson. Implement ImageBitmapOptions' ImageOrientation and PremultiplyAlpha settings. ImageOrientation="flipY" is supported directly while constructing ImageBitmap's representation, ImageBuffer. PremultiplyAlpha="premultiply" can not be supported via ImageBuffer's graphics operations, so this attribute is stored on ImageBitmap, serialized and deserialized when ImageBitmap is transferred, and handled in the WebGL implementation. * bindings/js/SerializedScriptValue.cpp: (WebCore::CloneSerializer::dumpImageBitmap): (WebCore::CloneDeserializer::deserialize): (WebCore::CloneDeserializer::CloneDeserializer): (WebCore::CloneDeserializer::readImageBitmap): (WebCore::SerializedScriptValue::SerializedScriptValue): * bindings/js/SerializedScriptValue.h: (WebCore::SerializedScriptValue::SerializedScriptValue): * html/ImageBitmap.cpp: (WebCore::ImageBitmap::create): (WebCore::ImageBitmap::detachBitmaps): (WebCore::imageOrientationForOrientation): (WebCore::ImageBitmap::createPromise): (WebCore::ImageBitmap::createFromBuffer): * html/ImageBitmap.h: * html/OffscreenCanvas.cpp: (WebCore::OffscreenCanvas::transferToImageBitmap): * html/canvas/WebGLRenderingContextBase.cpp: (WebCore::WebGLRenderingContextBase::texImageSourceHelper): * platform/graphics/ImageBuffer.h: 2020-08-03 Brian Burg <bburg@apple.com> [WebDriver] window.print should not invoke native UI https://bugs.webkit.org/show_bug.cgi?id=215084 Reviewed by Devin Rousso. This could be handled at a higher level if there is a valid use case to allow printing, but I'm not aware of one. For now, this fixes a script evaluation hang on Mac and iOS. * page/DOMWindow.cpp: (WebCore::DOMWindow::print): Don't call out to print delegates if this is a WebDriver-controlled page. 2020-08-03 Rob Buis <rbuis@igalia.com> Remove unused API in HighlightMap https://bugs.webkit.org/show_bug.cgi?id=215078 Reviewed by Sam Weinig. Remove unused API in HighlightMap, this is probably not needed anymore since the maplike code changed at some point. * Modules/highlight/HighlightMap.cpp: (WebCore::HighlightMap::getGroupForKey): Deleted. * Modules/highlight/HighlightMap.h: 2020-08-03 James Darpinian <jdarpinian@chromium.org> [WebGL2] Assert when restoring lost context https://bugs.webkit.org/show_bug.cgi?id=214999 Reviewed by Darin Adler. Remove an assert that was wrong when restoring a lost context. * html/canvas/WebGL2RenderingContext.cpp: (WebCore::WebGL2RenderingContext::initializeVertexArrayObjects): 2020-08-03 Adrian Perez de Castro <aperez@igalia.com> Non-unified build fixes, early August 20202 edition https://bugs.webkit.org/show_bug.cgi?id=215082 Unreviewed build fix. No new tests needed. * accessibility/AccessibilityRenderObject.cpp: Add missing inclusion of Range.h. * dom/RadioButtonGroups.cpp: Ditto. * editing/Editing.cpp: Ditto. * editing/EditingStyle.cpp: Ditto. * editing/EditorCommand.cpp: Ditto. * editing/FrameSelection.cpp: Ditto. * editing/TypingCommand.cpp: Ditto. * editing/VisiblePosition.cpp: Add missing inclusion of SimpleRange.h. * rendering/HitTestResult.cpp: Add missing inclusion of Range.h. 2020-08-03 Antti Koivisto <antti@apple.com> REGRESSION(r259585) Text decoration color with value currentColor miscomputed in some cases https://bugs.webkit.org/show_bug.cgi?id=215079 Reviewed by Zalan Bujtas. r259585 did some refactoring that broke a special case where text decoration color comes from '-webkit-text-fill-color' property. Test: fast/text/text-decoration-currentcolor-fill-color.html * rendering/TextDecorationPainter.cpp: (WebCore::TextDecorationPainter::decorationColor): Move resolving currentColor to RenderStyle. * rendering/style/RenderStyle.cpp: (WebCore::RenderStyle::colorResolvingCurrentColor const): Handle CSSPropertyTextDecorationColor as a special case here. (WebCore::RenderStyle::visitedDependentColor const): 2020-08-03 Clark Wang <clark_wang@apple.com> Added Constructor to AnalyserNode https://bugs.webkit.org/show_bug.cgi?id=215040 Reviewed by Chris Dumez. Introduced AnalyserNode constructor and AnalyserOptions according to spec: https://www.w3.org/TR/webaudio/#AnalyserNode-constructors. Re-baselined existing tests. * CMakeLists.txt: * DerivedSources-input.xcfilelist: * DerivedSources-output.xcfilelist: * DerivedSources.make: * Modules/webaudio/AnalyserNode.cpp: (WebCore::AnalyserNode::create): (WebCore::AnalyserNode::AnalyserNode): (WebCore::AnalyserNode::setFftSize): (WebCore::AnalyserNode::setMinMaxDecibels): (WebCore::AnalyserNode::setMinDecibels): (WebCore::AnalyserNode::setMaxDecibels): * Modules/webaudio/AnalyserNode.h: * Modules/webaudio/AnalyserNode.idl: * Modules/webaudio/AnalyserOptions.h: Added. * Modules/webaudio/AnalyserOptions.idl: Added. * Modules/webaudio/BaseAudioContext.cpp: (WebCore::BaseAudioContext::createAnalyser): * Sources.txt: * WebCore.xcodeproj/project.pbxproj: 2020-08-03 Youenn Fablet <youenn@apple.com> MediaRecorderPrivateWriter::appendEndOfVideoSampleDurationIfNeeded should only call requestMediaDataWhenReadyOnQueue once https://bugs.webkit.org/show_bug.cgi?id=214972 Reviewed by Eric Carlson. When processing a compressed sample, pass it to the writer if its ready. Otherwise buffer it and retry passing it to the writer next time we have a sample. When finishing a write, we call requestMediaDataWhenReadyOnQueue to finish passing samples that are still enqueued. Covered by existing tests no longer triggering ObjC exception. * platform/mediarecorder/cocoa/MediaRecorderPrivateWriterCocoa.h: * platform/mediarecorder/cocoa/MediaRecorderPrivateWriterCocoa.mm: (WebCore::MediaRecorderPrivateWriter::appendCompressedAudioSampleBuffer): (WebCore::MediaRecorderPrivateWriter::appendCompressedVideoSampleBufferIfPossible): (WebCore::MediaRecorderPrivateWriter::appendCompressedVideoSampleBuffer): (WebCore::MediaRecorderPrivateWriter::appendCompressedSampleBuffers): (WebCore::MediaRecorderPrivateWriter::finishAppendingCompressedAudioSampleBuffers): (WebCore::MediaRecorderPrivateWriter::finishAppendingCompressedVideoSampleBuffers): (WebCore::MediaRecorderPrivateWriter::flushCompressedSampleBuffers): 2020-08-02 Darin Adler <darin@apple.com> Remove some member functions of Range and many calls to createLiveRange https://bugs.webkit.org/show_bug.cgi?id=215070 Reviewed by Sam Weinig. * accessibility/AXObjectCache.cpp: (WebCore::AXObjectCache::nextBoundary): Remove createLiveRange. (WebCore::AXObjectCache::previousBoundary): Ditto. * accessibility/ios/WebAccessibilityObjectWrapperIOS.mm: (-[WebAccessibilityObjectWrapper _convertToNSRange:]): Take SimpleRange. (-[WebAccessibilityObjectWrapper positionForTextMarker:]): Remove createLiveRange. (-[WebAccessibilityObjectWrapper textRectsFromMarkers:withText:]): Ditto. * accessibility/mac/WebAccessibilityObjectWrapperMac.mm: (-[WebAccessibilityObjectWrapper _convertToNSRange:]): Take SimpleRange. (-[WebAccessibilityObjectWrapper _indexForTextMarker:]): Remove createLiveRange. (-[WebAccessibilityObjectWrapper _textMarkerForIndex:]): Ditto. * dom/DocumentMarkerController.cpp: (WebCore::updateRenderedRectsForMarker): Renamed range to makeSimpleRange. (WebCore::makeSimpleRange): Ditto. * dom/DocumentMarkerController.h: Update for the above. * dom/Range.cpp: (WebCore::Range::text const): Use makeSimpleRange. (WebCore::Range::shadowRoot const): Deleted. (WebCore::intervalsSufficientlyOverlap): Deleted. (WebCore::adjustLineHeightOfSelectionRects): Deleted. (WebCore::coalesceSelectionRects): Deleted. (WebCore::Range::collectSelectionRectsWithoutUnionInteriorLines const): Deleted. (WebCore::Range::collectSelectionRects const): Deleted. * dom/Range.h: Update for the above. Also make pastLastNode private since it is only used inside the Range class's implementation. * dom/SimpleRange.cpp: (WebCore::SimpleRange::SimpleRange): Removed overload that takes a Range. * dom/SimpleRange.h: Update for the above. Removed both constructor overloads that take a Range. * editing/AlternativeTextController.cpp: (WebCore::AlternativeTextController::timerFired): Remove createLiveRange. (WebCore::AlternativeTextController::respondToMarkerAtEndOfWord): Use makeSimpleRange. (WebCore::AlternativeTextController::applyAlternativeTextToRange): Remove createLiveRange. * editing/EditingStyle.cpp: (WebCore::EditingStyle::styleAtSelectionStart): Remove createLiveRange. * editing/Editor.cpp: (WebCore::Editor::performCutOrCopy): Ditto. (WebCore::Editor::markAllMisspellingsAndBadGrammarInRanges): Ditto. (WebCore::Editor::replaceRangeForSpellChecking): Ditto. (WebCore::correctSpellcheckingPreservingTextCheckingParagraph): Ditto. (WebCore::Editor::changeBackToReplacedString): Ditto. (WebCore::Editor::countMatchesForText): Ditto. * editing/InsertListCommand.cpp: (WebCore::InsertListCommand::doApply): Ditto. (WebCore::InsertListCommand::doApplyForSingleParagraph): Change out argument type to SimpleRange. * editing/InsertListCommand.h: Update for above. * editing/SpellChecker.cpp: (WebCore::SpellChecker::isCheckable const): Rewrite questionable logic to use intersectingNodes instead of firstNode. * editing/TextCheckingHelper.cpp: (WebCore::TextCheckingHelper::findUngrammaticalPhrases const): Remove createLiveRange. * editing/TypingCommand.cpp: (WebCore::TypingCommand::deleteKeyPressed): Ditto. (WebCore::TypingCommand::forwardDeleteKeyPressed): Ditto. * editing/markup.cpp: (WebCore::createFragmentFromText): Ditto. * editing/ios/EditorIOS.mm: (WebCore::Editor::setTextAsChildOfElement): Use makeRangeSelectingNodeContents. * editing/win/EditorWin.cpp: (WebCore::Editor::pasteWithPasteboard): Remove createLiveRange. * page/DOMSelection.cpp: (WebCore::DOMSelection::addRange): Use makeSimpleRange. (WebCore::DOMSelection::deleteFromDocument): Remove createLiveRange. * page/DragController.cpp: (WebCore::documentFragmentFromDragData): Take SimpleRange. (WebCore::DragController::concludeEditDrag): Remove createLiveRange. (WebCore::DragController::startDrag): Ditto. * page/TextIndicator.cpp: (WebCore::selectionRects): Deleted. (WebCore::initializeIndicator): Call collectSelectionRects directly here, avoiding createLiveRange and using map to convert from Vector<SelectionRect> to Vector<FloatRect>. * page/ios/FrameIOS.mm: (WebCore::Frame::interpretationsForCurrentRoot const): Use makeSimpleRange. * platform/DragImage.cpp: (WebCore::createDragImageForRange): Take SimpleRange. * platform/DragImage.h: Update createDragImageForRange to take SimpleRange. * platform/Pasteboard.h: Updated Windows-only layering-violating functions to take SimpleRange. * platform/ios/DragImageIOS.mm: (WebCore::createDragImageForRange): Take SimpleRange. * platform/win/PasteboardWin.cpp: (WebCore::Pasteboard::writeRangeToDataObject): Take SimpleRange. (WebCore::Pasteboard::writeSelection): Ditto. (WebCore::Pasteboard::documentFragment): Ditto. * rendering/RenderObject.cpp: (WebCore::intervalsSufficientlyOverlap): Added. Moved from Range. Mostly unchanged but uses SimpleRange now instead of a live range, and intersectingNodes instead of a loop using firstNode and pastLastNode. (WebCore::adjustLineHeightOfSelectionRects): Ditto. (WebCore::coalesceSelectionRects): Ditto. (WebCore::RenderObject::collectSelectionRectsWithoutUnionInteriorLines): Ditto. (WebCore::RenderObject::collectSelectionRectsInternal): Ditto. (WebCore::RenderObject::collectSelectionRects): Ditto. * rendering/RenderObject.h: Update for above. * testing/Internals.cpp: (WebCore::Internals::markerRangeForNode): Use makeSimplRange. (WebCore::Internals::locationFromRange): Ditto. (WebCore::Internals::lengthFromRange): Ditto. (WebCore::Internals::rangeAsTextUsingBackwardsTextIterator): Ditto. (WebCore::Internals::subrange): Ditto. (WebCore::Internals::rangeOfStringNearLocation): Ditto. (WebCore::Internals::textIndicatorForRange): Ditto. 2020-08-02 Wenson Hsieh <wenson_hsieh@apple.com> Table data is incorrectly translated in some articles on en.wikipedia.org https://bugs.webkit.org/show_bug.cgi?id=215071 <rdar://problem/66354013> Reviewed by Darin Adler. Text in table cells sometimes end up in adjacent cells after translation, since adjacent cells are currently extracted as different tokens in a single item; mitigate this by splitting text in table cells into different text manipulation items instead. Test: TextManipulation.StartTextManipulationExtractsTableCellsAsSeparateItems * editing/TextManipulationController.cpp: (WebCore::isEnclosingItemBoundaryElement): 2020-08-01 Rob Buis <rbuis@igalia.com> Remove superfluous ResourceTiming constructor overload https://bugs.webkit.org/show_bug.cgi?id=215063 Reviewed by Sam Weinig. Remove superfluous ResourceTiming constructor overload, we can just call another overload from ResourceTiming::fromLoad. * loader/ResourceTiming.cpp: (WebCore::ResourceTiming::fromLoad): * loader/ResourceTiming.h: 2020-08-01 Brady Eidson <beidson@apple.com> Special HID mapping for the Logitech F310/F710 controllers. https://bugs.webkit.org/show_bug.cgi?id=215050 Reviewed by Tim Horton. Covered by API test. These two controllers match the standard mapping perfectly. Easy to support. * SourcesCocoa.txt: * WebCore.xcodeproj/project.pbxproj: * platform/gamepad/KnownGamepads.h: * platform/gamepad/mac/GamepadConstantsMac.h: * platform/gamepad/mac/HIDGamepad.cpp: (WebCore::HIDGamepad::create): * platform/gamepad/mac/HIDGamepadElement.cpp: (WebCore::HIDGamepadElement::HIDGamepadElement): * platform/gamepad/mac/HIDGamepadElement.h: (WebCore::HIDGamepadElement::isAxis const): * platform/gamepad/mac/LogitechGamepad.cpp: Added. (WebCore::LogitechGamepadHatswitch::gamepadValueChanged): (WebCore::LogitechGamepad::LogitechGamepad): * platform/gamepad/mac/LogitechGamepad.h: 2020-08-01 Joonghun Park <jh718.park@samsung.com> Unreviewed. Remove the build warnings below since r265150. warning: unused parameter ‘foo’ [-Wunused-parameter] No new tests, no new behaviors. * workers/service/server/SWServerJobQueue.cpp: (WebCore::doCertificatesMatch): 2020-08-01 Brady Eidson <beidson@apple.com> Special HID mapping for the Google Stadia controller https://bugs.webkit.org/show_bug.cgi?id=215061 Reviewed by Tim Horton. New API test coverage. * SourcesCocoa.txt: * WebCore.xcodeproj/project.pbxproj: * platform/gamepad/GamepadConstants.h: * platform/gamepad/KnownGamepads.h: * platform/gamepad/mac/GamepadConstantsMac.h: * platform/gamepad/mac/HIDGamepad.cpp: (WebCore::HIDGamepad::create): * platform/gamepad/mac/HIDGamepadElement.cpp: (WebCore::HIDGamepadElement::HIDGamepadElement): (WebCore::HIDGamepadHatswitch::gamepadValueChanged): (WebCore::HIDGamepadHatswitch::normalizedValue): * platform/gamepad/mac/HIDGamepadElement.h: (WebCore::HIDGamepadElement::isAxis const): (WebCore::HIDGamepadHatswitch::HIDGamepadHatswitch): * platform/gamepad/mac/StadiaHIDGamepad.cpp: Added. (WebCore::StadiaHIDGamepad::StadiaHIDGamepad): * platform/gamepad/mac/StadiaHIDGamepad.h: 2020-08-01 Sam Weinig <weinig@apple.com> Convert LinkHeader to use StringParsingBuffer https://bugs.webkit.org/show_bug.cgi?id=215017 Reviewed by Darin Adler. Update LinkHeader parsing to use StringParsingBuffer and do some light cleanup. * loader/LinkHeader.cpp: (WebCore::isSpaceOrTab): (WebCore::isNotURLTerminatingChar): (WebCore::isValidParameterNameChar): (WebCore::isParameterValueEnd): (WebCore::isParameterValueChar): (WebCore::findURLBoundaries): (WebCore::invalidParameterDelimiter): (WebCore::validFieldEnd): (WebCore::parseParameterDelimiter): (WebCore::paramterNameFromString): (WebCore::parseParameterName): (WebCore::skipQuotesIfNeeded): (WebCore::parseParameterValue): (WebCore::findNextHeader): (WebCore::LinkHeader::LinkHeader): (WebCore::LinkHeaderSet::LinkHeaderSet): (WebCore::LinkHeaderSet::init): Deleted. * loader/LinkHeader.h: 2020-08-01 Darin Adler <darin@apple.com> Remove Range::create and many more uses of live ranges https://bugs.webkit.org/show_bug.cgi?id=215004 Reviewed by Sam Weinig. * accessibility/AccessibilityRenderObject.cpp: (WebCore::AccessibilityRenderObject::boundsForVisiblePositionRange const): Use makeSimpleRange. * accessibility/atk/AXObjectCacheAtk.cpp: (WebCore::AXObjectCache::nodeTextChangePlatformNotification): Use SimpleRange. * accessibility/atk/WebKitAccessibleHyperlink.cpp: (rangeLengthForObject): Take SimpleRange. (webkitAccessibleHyperlinkGetStartIndex): Use makeSimpleRange. (webkitAccessibleHyperlinkGetEndIndex): Ditto. * accessibility/atk/WebKitAccessibleInterfaceText.cpp: (getSelectionOffsetsForObject): Ditto. * accessibility/atk/WebKitAccessibleUtil.cpp: (objectFocusedAndCaretOffsetUnignored): Ditto. * accessibility/ios/WebAccessibilityObjectWrapperIOS.mm: (+[WebAccessibilityTextMarker startOrEndTextMarkerForRange:isStart:cache:]): Take SimpleRange. (-[WebAccessibilityObjectWrapper arrayOfTextForTextMarkers:attributed:]): Use makeSimpleRange. (-[WebAccessibilityObjectWrapper _convertToDOMRange:]): Return SimpleRange. (-[WebAccessibilityObjectWrapper textMarkerRange]): Remove createLiveRange. (-[WebAccessibilityObjectWrapper textMarkerForPosition:]): Use auto. (-[WebAccessibilityObjectWrapper misspellingTextMarkerRange:forward:]): Remove createLiveRange. (-[WebAccessibilityObjectWrapper rangeFromMarkers:withText:]): Return SimpleRange. (-[WebAccessibilityObjectWrapper textRectsFromMarkers:withText:]): Add createLiveRange. (-[WebAccessibilityObjectWrapper rangeForTextMarkers:]): Return SimpleRange. (-[WebAccessibilityObjectWrapper startOrEndTextMarkerForTextMarkers:isStart:]): Use auto. (-[WebAccessibilityObjectWrapper textMarkerRangeForMarkers:]): Get rid of local. (-[WebAccessibilityObjectWrapper textMarkersForRange:]): Take SimpleRange. * accessibility/mac/WebAccessibilityObjectWrapperMac.mm: (accessibilityTextOperationForParameterizedAttribute): Remove makeSimpleRange. (accessibilityMisspellingSearchCriteriaForParameterizedAttribute): Return SimpleRange. (-[WebAccessibilityObjectWrapper textMarkerRangeFromRange:]): Take SimpleRange. (textMarkerRangeFromRange): Ditto. (-[WebAccessibilityObjectWrapper startOrEndTextMarkerForRange:isStart:]): Ditto. (startOrEndTextmarkerForRange): Return SimpleRange. (-[WebAccessibilityObjectWrapper rangeForTextMarkerRange:]): Ditto. (-[WebAccessibilityObjectWrapper doAXAttributedStringForTextMarkerRange:spellCheck:]): Use auto. (-[WebAccessibilityObjectWrapper doAXAttributedStringForRange:]): Remove createLiveRange. (-[WebAccessibilityObjectWrapper textMarkerRangeAtTextMarker:forUnit:]): Ditto. (-[WebAccessibilityObjectWrapper accessibilityAttributeValue:forParameter:]): Ditto. * dom/DocumentMarkerController.cpp: (WebCore::updateRenderedRectsForMarker): Use document marker range function. (WebCore::range): Added. * dom/DocumentMarkerController.h: Update for above. * dom/Position.cpp: Removed unneeded Range.h include. * dom/Range.cpp: (WebCore::Range::Range): Removed unused overload that takes start/end. (WebCore::Range::create): Removed overloads that take start/end. (WebCore::Range::setStart): Removed overload that takes Position. (WebCore::Range::setEnd): Ditto. (WebCore::Range::cloneRange const): Rewrote to use setStart/End since that's what the constructor used to do. (WebCore::Range::contains const): Use SimpleRange/createLiveRange instead of makeRange. Soon this function will be deleted. (WebCore::rangeOfContents): Deleted. (WebCore::createLiveRange): Rewrote to use setStart/End since that's what the constructor used to do. * dom/Range.h: Update for above removals. * dom/SimpleRange.h: Export commonInclusiveAncestor for use outside WebCore. * dom/StaticRange.cpp: (WebCore::StaticRange::create): Added overload that copies the SimpleRange. * dom/StaticRange.h: Update for above. * editing/AlternativeTextController.cpp: (WebCore::AlternativeTextController::respondToMarkerAtEndOfWord): Use document marker range function. * editing/ApplyStyleCommand.cpp: (WebCore::ApplyStyleCommand::fixRangeAndApplyInlineStyle): Use makeSimpleRange. * editing/DeleteSelectionCommand.cpp: (WebCore::DeleteSelectionCommand::mergeParagraphs): Ditto. (WebCore::DeleteSelectionCommand::originalStringForAutocorrectionAtBeginningOfSelection): Ditto. * editing/EditingStyle.cpp: (WebCore::EditingStyle::textDirectionForSelection): Use makeSimpleRange and intersectingNodes. * editing/Editor.cpp: (WebCore::Editor::replaceSelectionWithFragment): Use makeRangeSelectingNodeContents. (WebCore::Editor::updateMarkersForWordsAffectedByEditing): Use makeSimpleRange. (WebCore::Editor::transpose): Ditto. (WebCore::Editor::rangeOfString): Use makeRangeSelectingNodeContents. (WebCore::Editor::handleAcceptedCandidate): Update since rangeForTextCheckingResult now returns an Optional<SimpleRange>. * editing/FrameSelection.cpp: (WebCore::FrameSelection::selectRangeOnElement): Use SimpleRange. * editing/ReplaceRangeWithTextCommand.cpp: (WebCore::ReplaceRangeWithTextCommand::ReplaceRangeWithTextCommand): Take SimpleRange. (WebCore::ReplaceRangeWithTextCommand::willApplyCommand): Update since m_rangeToBeReplaced is a SimpleRange. (WebCore::ReplaceRangeWithTextCommand::doApply): Ditto. (WebCore::ReplaceRangeWithTextCommand::targetRanges const): Ditto. * editing/ReplaceRangeWithTextCommand.h: Update for above. * editing/ReplaceSelectionCommand.cpp: (WebCore::ReplaceSelectionCommand::insertedContentRange const): Return a SimpleRange. * editing/ReplaceSelectionCommand.h: Update for above. * editing/SpellingCorrectionCommand.cpp: (WebCore::SpellingCorrectionCommand::SpellingCorrectionCommand): Take a SimpleRange. (WebCore::SpellingCorrectionCommand::create): Moved here from header. * editing/SpellingCorrectionCommand.h: Update for above. * editing/TextCheckingHelper.cpp: (WebCore::TextCheckingHelper::findFirstMisspelledWordOrUngrammaticalPhrase const): Use makeSimpleRange. * editing/TypingCommand.cpp: (WebCore::TypingCommand::markMisspellingsAfterTyping): Use makeSimpleRange. (WebCore::TypingCommand::willAddTypingToOpenCommand): Take SimpleRange. (WebCore::TypingCommand::deleteKeyPressed): Remove createLiveRange. (WebCore::TypingCommand::forwardDeleteKeyPressed): Ditto. * editing/TypingCommand.h: Update for above. * editing/VisiblePosition.cpp: (WebCore::makeRange): Deleted. (WebCore::startVisiblePosition): Deleted. (WebCore::endVisiblePosition): Deleted. (WebCore::setStart): Deleted. (WebCore::setEnd): Deleted. * editing/VisiblePosition.h: Update for above. Also export makeSimpleRange for use outside WebCore. * editing/VisibleUnits.cpp: (WebCore::suffixLengthForRange): Take SimpleRange. (WebCore::prefixLengthForRange): Ditto. (WebCore::previousBoundary): Use makeSimpleRange. (WebCore::nextBoundary): Ditto. * editing/VisibleUnits.h: Update for above. * editing/cocoa/DataDetection.mm: (WebCore::buildQuery): Remove unused local variable. * editing/ios/EditorIOS.mm: (WebCore::Editor::setDictationPhrasesAsChildOfElement): Use makeRangeSelectingNodeContents. * page/DOMSelection.cpp: (WebCore::DOMSelection::getRangeAt): Use createLiveRange. * page/DragController.cpp: (WebCore::DragController::insertDroppedImagePlaceholdersAtCaret): Remove makeSimpleRange. * page/Frame.cpp: (WebCore::Frame::rangeForPoint): Return SimpleRange. * page/Frame.h: Update for above. * page/ios/FrameIOS.mm: (WebCore::Frame::interpretationsForCurrentRoot const): Use makeRangeSelectingNodeContents, intersectingNodes, and makeSimpleRange. * testing/Internals.cpp: (WebCore::Internals::markerRangeForNode): Use createLiveRange and the document marker range function. 2020-07-31 Jer Noble <jer.noble@apple.com> [Mac] AudioSessionRoutingArbitrator causes a launch time regression checking for CoreAudio muted state https://bugs.webkit.org/show_bug.cgi?id=214993 Reviewed by Eric Carlson. The initial query of isMuted() is only there to tell whether, when we get a notification that the mute state changed, whether our internal state is dirty and we need to fire a notification. Instead, replace the bool member with an Optional<bool>, so we know we need to fire a changed notification whenever the first mute state change comes in. * platform/audio/mac/AudioSessionMac.mm: (WebCore::AudioSession::AudioSession): (WebCore::AudioSession::handleMutedStateChange): (WebCore::AudioSessionPrivate::AudioSessionPrivate): Deleted. 2020-07-31 Jer Noble <jer.noble@apple.com> Unreviewed Windows build fix after r265167; add some missing includes. * page/Screen.cpp: 2020-07-31 Myles C. Maxfield <mmaxfield@apple.com> Clean up text layout code a bit https://bugs.webkit.org/show_bug.cgi?id=215013 Reviewed by Zalan Bujtas. This is in preparation for https://bugs.webkit.org/show_bug.cgi?id=214769. See file-specific ChangeLog entries for more information. No tests because there is no behavior change. * platform/graphics/Font.h: Remove unnecessary declaration. * platform/graphics/FontCascade.cpp: (WebCore::FontCascade::layoutText const): Rename glyphBufferForTextRun() to layoutText(). Also, make it return a GlyphBuffer instead of taking a GlyphBuffer as an out param. Its previous return, the initial advance, is now returned in GlyphBuffer::initialAdvance. (WebCore::FontCascade::drawText const): Update to new signature of layoutText(). (WebCore::FontCascade::drawEmphasisMarks const): Inline drawEmphasisMarksForSimpleText() and drawEmphasisMarksForComplexText(), since they're nearly identical. Update to the new signature of layoutText(). (WebCore::FontCascade::displayListForTextRun const): Update to the new signature of layoutText(). (WebCore::FontCascade::layoutSimpleText const): Make this return a new GlyphBuffer, instead of taking one as an out param. Also, use accessors of WidthIterator instead of reaching into its guts. The previous return value is now returned in GlyphBuffer::initialAdvance. (WebCore::FontCascade::layoutComplexText const): Ditto. (WebCore::FontCascade::floatWidthForSimpleText const): Use accessors of WidthIterator instead of reaching into its guts. (WebCore::FontCascade::adjustSelectionRectForSimpleText const): Ditto. (WebCore::FontCascade::offsetForPositionForSimpleText const): Ditto. (WebCore::FontCascade::dashesForIntersectionsWithRect const): Same as FontCascade::drawEmphasisMarks() above. (WebCore::FontCascade::glyphBufferForTextRun const): Renamed to layoutText(). (WebCore::FontCascade::getGlyphsAndAdvancesForSimpleText const): Renamed to layoutSimpleText(). (WebCore::FontCascade::getGlyphsAndAdvancesForComplexText const): Renamed to layoutComplexText(). (WebCore::FontCascade::drawEmphasisMarksForSimpleText const): Inlined into drawEmphasisMarks(). (WebCore::FontCascade::drawEmphasisMarksForComplexText const): Ditto. * platform/graphics/FontCascade.h: * platform/graphics/GlyphBuffer.h: (WebCore::GlyphBufferAdvance::GlyphBufferAdvance): (WebCore::GlyphBufferAdvance::operator FloatSize): * platform/graphics/TextRun.h: Remove unnecessary declaration. * platform/graphics/WidthIterator.cpp: (WebCore::WidthIterator::WidthIterator): Update for changes to WidthIterator.h * platform/graphics/WidthIterator.h: Rearrange the class members to sort them by size, to get better packing. Also, make all member variables private, and initialize them all with { } syntax. (WebCore::WidthIterator::finalRoundingWidth const): (WebCore::WidthIterator::currentCharacter const): * rendering/svg/SVGTextMetrics.cpp: Remove unnecessary include. 2020-07-31 Chris Dumez <cdumez@apple.com> Add OfflineAudioCompletionEvent constructor https://bugs.webkit.org/show_bug.cgi?id=214994 Reviewed by Eric Carlson. Add OfflineAudioCompletionEvent constructor, as per: - https://www.w3.org/TR/webaudio/#OfflineAudioCompletionEvent Test: webaudio/OfflineAudioCompletionEvent-constructor.html * CMakeLists.txt: * DerivedSources-input.xcfilelist: * DerivedSources-output.xcfilelist: * DerivedSources.make: * Modules/webaudio/BaseAudioContext.cpp: (WebCore::BaseAudioContext::finishedRendering): * Modules/webaudio/OfflineAudioCompletionEvent.cpp: (WebCore::OfflineAudioCompletionEvent::create): (WebCore::OfflineAudioCompletionEvent::OfflineAudioCompletionEvent): * Modules/webaudio/OfflineAudioCompletionEvent.h: * Modules/webaudio/OfflineAudioCompletionEvent.idl: * Modules/webaudio/OfflineAudioCompletionEventInit.h: Copied from Source/WebCore/Modules/webaudio/OfflineAudioCompletionEvent.idl. * Modules/webaudio/OfflineAudioCompletionEventInit.idl: Copied from Source/WebCore/Modules/webaudio/OfflineAudioCompletionEvent.idl. * Sources.txt: * WebCore.xcodeproj/project.pbxproj: 2020-07-31 Jer Noble <jer.noble@apple.com> [Mac] YouTube does not offer HDR variants to devices which support HDR https://bugs.webkit.org/show_bug.cgi?id=215022 Reviewed by Eric Carlson. Test: platform/mac/media/media-source/is-type-supported-vp9-codec-check.html There are three separate issues which block YouTube from offering HDR: 1) YouTube checks both valid and invalid VP9 strings through MediaSource.isTypeSupported(), and UAs which answer `true` to even invalid VP9 strings are blocked from HDR. To solve this, we will now send isTypeSupported() through the same code path as Media Capabilities. 2) YouTube's standard valid and invalid VP9 strings do not include the fullRangeVideoFlag field, which would normally be tossed as invalid. We shouldn't relax our requirements globally, so we will add a Quirk which relaxes the requriement that VP9 strings contain a fullRangeVideoFlag. 3) YouTube's HDR query checks that window.screen.pixelDepth is > 24. We obviously don't want to change the value of this field globally, so we will add separate Quirk which sets window.screen.pixelDepth to 25 (a totally nonsensical value) when HDR is available. Each of these Quirks has a path towards removal for YouTube. The fullRangeVideoFlag field involves YouTube updating their compatibility check to inculde the fullRangeVideoFlag. The pixelDepth check can be replaced by the `dynamic-range:high` Media Query. * Modules/mediasource/MediaSource.cpp: (WebCore::addVP9FullRangeVideoFlagToContentType): (WebCore::MediaSource::addSourceBuffer): (WebCore::MediaSource::removeSourceBuffer): (WebCore::MediaSource::isTypeSupported): (WebCore::MediaSource::onReadyStateChange): (WebCore::MediaSource::activeRanges const): * Modules/mediasource/MediaSource.h: * page/Quirks.cpp: (WebCore::Quirks::needsVP9FullRangeFlagQuirk const): (WebCore::Quirks::needsHDRPixelDepthQuirk const): * page/Quirks.h: * page/Screen.cpp: (WebCore::Screen::pixelDepth const): * platform/graphics/cocoa/SourceBufferParserWebM.cpp: (WebCore::SourceBufferParserWebM::isContentTypeSupported): * platform/graphics/cocoa/VP9UtilitiesCocoa.h: * platform/graphics/cocoa/VP9UtilitiesCocoa.mm: (WebCore::isVPCodecConfigurationRecordSupported): (WebCore::validateVPParameters): 2020-07-31 Chris Dumez <cdumez@apple.com> Add linked-on-after check to keep WebSQL working in UIWebView until apps are rebuilt with iOS 14 SDK https://bugs.webkit.org/show_bug.cgi?id=215035 <rdar://problem/65003342> Reviewed by Tim Horton. * platform/RuntimeApplicationChecks.h: * platform/cocoa/RuntimeApplicationChecksCocoa.mm: (WebCore::IOSApplication::isJesusCalling): Deleted. (WebCore::IOSApplication::isFudget): Deleted. (WebCore::IOSApplication::isFamilyHealthApp): Deleted. Drop code that is no longer needed. 2020-07-31 Brady Eidson <beidson@apple.com> Log a warning to the dev console when gamepads are accessed from an insecure context. https://bugs.webkit.org/show_bug.cgi?id=214995 Reviewed by Tim Horton. Test: http/tests/misc/gamepads-insecure.html * Modules/gamepad/NavigatorGamepad.cpp: (WebCore::NavigatorGamepad::getGamepads): Insecure contexts should log that getGamepads() will be going away in a future release. Just do it once, because getGamepads() is called frequently. 2020-07-31 Aditya Keerthi <akeerthi@apple.com> [macOS] Date/time input types should have a textfield appearance https://bugs.webkit.org/show_bug.cgi?id=214978 Reviewed by Wenson Hsieh. On iOS, date/time input types have a menulist-button appearance. However, this appearance does not match the style of native date controls on macOS. The textfield appearance with no focus ring brings us closer to a natively styled control. * rendering/RenderTheme.h: * rendering/RenderThemeMac.h: * rendering/RenderThemeMac.mm: (WebCore::RenderThemeMac::dateInputStyleSheet const): (WebCore::RenderThemeMac::dateTimeLocalInputStyleSheet const): (WebCore::RenderThemeMac::monthInputStyleSheet const): (WebCore::RenderThemeMac::timeInputStyleSheet const): (WebCore::RenderThemeMac::weekInputStyleSheet const): 2020-07-31 Brady Eidson <beidson@apple.com> Special HID mapping for the Dualshock 3 controller <rdar://problem/66255198> and https://bugs.webkit.org/show_bug.cgi?id=214911 Reviewed by Tim Horton. Covered by API tests. - Move GamepadButtons into a GamepadConstants header - Add a "KnownGamepads" header to hold all vendor/product pairs that WebKit knows about - Add a Dualshock3 controller mapping based on its HID report - Add a basic DS3 test based on the HID report * Sources.txt: * SourcesCocoa.txt: * WebCore.xcodeproj/project.pbxproj: * platform/gamepad/GamepadConstants.cpp: Copied from Source/WebCore/platform/gamepad/mac/GenericHIDGamepad.h. (WebCore::standardGamepadMappingString): * platform/gamepad/GamepadConstants.h: Added. * platform/gamepad/KnownGamepads.h: Copied from Source/WebCore/platform/gamepad/mac/GenericHIDGamepad.h. * platform/gamepad/cocoa/GameControllerGamepad.mm: (WebCore::GameControllerGamepad::setupAsExtendedGamepad): * platform/gamepad/mac/Dualshock3HIDGamepad.cpp: Added. (WebCore::Dualshock3HIDGamepad::Dualshock3HIDGamepad): * platform/gamepad/mac/Dualshock3HIDGamepad.h: Copied from Source/WebCore/platform/gamepad/mac/GenericHIDGamepad.h. * platform/gamepad/mac/GenericHIDGamepad.cpp: (WebCore::GenericHIDGamepad::GenericHIDGamepad): (WebCore::GenericHIDGamepad::id): Deleted. * platform/gamepad/mac/GenericHIDGamepad.h: * platform/gamepad/mac/HIDGamepad.cpp: (WebCore::HIDGamepad::create): (WebCore::HIDGamepad::HIDGamepad): (WebCore::HIDGamepad::initialize): * platform/gamepad/mac/HIDGamepad.h: * platform/mac/HIDDevice.h: (WebCore::HIDDevice::fullProductIdentifier const): * platform/mac/HIDElement.h: (WebCore::HIDElement::fullUsage const): 2020-07-31 Alex Christensen <achristensen@webkit.org> Fix Windows build. https://bugs.webkit.org/show_bug.cgi?id=214988 * platform/network/cf/CertificateInfo.h: * platform/network/cf/CertificateInfoCFNet.cpp: 2020-07-31 Chris Dumez <cdumez@apple.com> Add constructor for WaveShaperNode https://bugs.webkit.org/show_bug.cgi?id=214989 Reviewed by Youenn Fablet. Add constructor for WaveShaperNode: - https://www.w3.org/TR/webaudio/#waveshapernode No new tests, rebaselined existing tests. * CMakeLists.txt: * DerivedSources-input.xcfilelist: * DerivedSources-output.xcfilelist: * DerivedSources.make: * Modules/webaudio/BaseAudioContext.cpp: (WebCore::BaseAudioContext::createWaveShaper): * Modules/webaudio/OverSampleType.h: Copied from Source/WebCore/Modules/webaudio/WaveShaperNode.idl. * Modules/webaudio/OverSampleType.idl: Copied from Source/WebCore/Modules/webaudio/WaveShaperNode.idl. * Modules/webaudio/WaveShaperNode.cpp: (WebCore::WaveShaperNode::create): (WebCore::WaveShaperNode::setCurve): (WebCore::processorType): * Modules/webaudio/WaveShaperNode.h: (WTF::LogArgument<WebCore::OverSampleType>::toString): * Modules/webaudio/WaveShaperNode.idl: * Modules/webaudio/WaveShaperOptions.h: Copied from Source/WebCore/Modules/webaudio/WaveShaperNode.idl. * Modules/webaudio/WaveShaperOptions.idl: Copied from Source/WebCore/Modules/webaudio/WaveShaperNode.idl. * Sources.txt: * WebCore.xcodeproj/project.pbxproj: 2020-07-31 Youenn Fablet <youenn@apple.com> Update service worker if certificate info does not match when soft updating https://bugs.webkit.org/show_bug.cgi?id=214988 Reviewed by Alex Christensen. In case service worker certificate info does not match, treat it as if the script changed. This is a convenient way to update the service worker and the stored registration database. Covered by API test. * platform/network/cf/CertificateInfo.h: * platform/network/cf/CertificateInfoCFNet.cpp: (WebCore::certificatesMatch): * workers/service/server/SWServerJobQueue.cpp: (WebCore::doCertificatesMatch): (WebCore::SWServerJobQueue::scriptFetchFinished): * workers/service/server/SWServerWorker.h: (WebCore::SWServerWorker::certificateInfo const): 2020-07-31 Sihui Liu <sihui_liu@appe.com> -[WKWebsiteDataStore _renameOrigin:] needs to support IndexedDB renames https://bugs.webkit.org/show_bug.cgi?id=214905 <rdar://problem/66247978> Reviewed by Alex Christensen. To do the renaming, we close all existing databases whose top origin is old origin, and move all files in directory of old origin to that of new origin. API test: WebKit.WebsiteDataStoreRenameOriginForIndexedDatabase * Modules/indexeddb/server/IDBServer.cpp: (WebCore::IDBServer::IDBServer::closeDatabasesForOrigins): (WebCore::IDBServer::IDBServer::closeAndDeleteDatabasesForOrigins): (WebCore::IDBServer::IDBServer::renameOrigin): * Modules/indexeddb/server/IDBServer.h: 2020-07-31 Chris Fleizach <cfleizach@apple.com> AX: Inteterminate progressbar reading as 50% with Voiceover https://bugs.webkit.org/show_bug.cgi?id=214330 <rdar://problem/65570800> Reviewed by Zalan Bujtas. Expose indeterminate status to iOS API. * accessibility/ios/WebAccessibilityObjectWrapperIOS.mm: (-[WebAccessibilityObjectWrapper accessibilityIsIndeterminate]): (-[WebAccessibilityObjectWrapper accessibilityIsInDescriptionListTerm]): (-[WebAccessibilityObjectWrapper accessibilityIsInDescriptionListDefinition]): - Drive by style fix. 2020-07-31 Peng Liu <peng.liu6@apple.com> PIP on netflix.com shows only a gray window and spinner https://bugs.webkit.org/show_bug.cgi?id=214899 Reviewed by Jer Noble. Use an empty "seekableRanges" instead of a special "duration" value (NaN) to indicate that seeking is not supported. With this change, the "duration" will always have a meaningful value, so that WebAVPlayerController can work properly in the picture-in-picture mode. Related change: https://trac.webkit.org/changeset/217858. * html/HTMLMediaElement.cpp: (WebCore::HTMLMediaElement::supportsSeeking const): * platform/cocoa/PlaybackSessionModelMediaElement.mm: (WebCore::PlaybackSessionModelMediaElement::duration const): (WebCore::PlaybackSessionModelMediaElement::seekableRanges const): * platform/mac/WebPlaybackControlsManager.mm: (-[WebPlaybackControlsManager canBeginTouchBarScrubbing]): 2020-07-31 Carlos Garcia Campos <cgarcia@igalia.com> [GTK] Mouse wheel events on horizontal scrollbar not correctly handled when AC mode is forced https://bugs.webkit.org/show_bug.cgi?id=207113 Reviewed by Adrian Perez de Castro. Remove GTK specific code to invert scroll direction of wheel events. * page/EventHandler.cpp: (WebCore::EventHandler::handleWheelEvent): (WebCore::EventHandler::shouldSwapScrollDirection const): Deleted. * platform/SourcesGLib.txt: * platform/glib/EventHandlerGLib.cpp: Removed. 2020-07-10 Sergio Villar Senin <svillar@igalia.com> [WebXR] Retrieve supported reference spaces from actual XR systems https://bugs.webkit.org/show_bug.cgi?id=214187 Reviewed by Carlos Garcia Campos. Each XR system supports a set of reference spaces which are used by WebXR to stablish a spatial relationship with user's physical environment. The list of supported reference spaces determine whether or not a session request succeeds or not, as it will refuse to start a session with an unsupported reference space. So far, no reference spaces were retrieved from the actual devices. This patch adds the required OpenXR machinery to retrieve them. In particular, we have to create a XrSession (although we don't have to start it) in order to retrieve the reference spaces. Since we don't need it to show content to the user we can create it in headless mode and then discard it afterwards when no longer needed. * Modules/webxr/WebXRSession.cpp: (WebCore::WebXRSession::WebXRSession): Clarify a comment. Also s/TODO/FIXME/g. * platform/xr/openxr/PlatformXROpenXR.cpp: (PlatformXR::isExtensionSupported): New method to check whether a specific extension is supported. (PlatformXR::Instance::Impl::checkInstanceExtensionProperties const): renamed from enumerateInstanceExtensionProperties(). Returns whether or not the call succeeded. (PlatformXR::Instance::Impl::Impl): Pass the list of enabled extensions to the instance. (PlatformXR::Instance::enumerateImmersiveXRDevices): Log the systems found. (PlatformXR::OpenXRDevice::OpenXRDevice): (PlatformXR::OpenXRDevice::enumerateReferenceSpaces const): New method to list the supported reference spaces by the XR system. (PlatformXR::OpenXRDevice::collectSupportedSessionModes): Store reference spaces as enabled features for supported modes. (PlatformXR::OpenXRDevice::collectConfigurationViews): Renamed from enumerateConfigurationViews(). (PlatformXR::Instance::Impl::enumerateInstanceExtensionProperties const): Deleted. (PlatformXR::OpenXRDevice::enumerateConfigurationViews): Deleted. * platform/xr/openxr/PlatformXROpenXR.h: 2020-07-31 Youenn Fablet <youenn@apple.com> Add LibWebRTCAudioModule logging https://bugs.webkit.org/show_bug.cgi?id=214987 Reviewed by Eric Carlson. * platform/mediastream/libwebrtc/LibWebRTCAudioModule.cpp: (WebCore::LibWebRTCAudioModule::RegisterAudioCallback): (WebCore::LibWebRTCAudioModule::StartPlayout): (WebCore::LibWebRTCAudioModule::StopPlayout): 2020-07-30 Simon Fraser <simon.fraser@apple.com> Minor RenderLayerCompositor::updateBackingAndHierarchy() cleanup https://bugs.webkit.org/show_bug.cgi?id=215008 Reviewed by Zalan Bujtas. Instead of setting child layers, and then adding another child (overflowControlLayer), append overflowControlLayer to the vector and then set children. No behavior change. * rendering/RenderLayerCompositor.cpp: (WebCore::RenderLayerCompositor::updateBackingAndHierarchy): 2020-07-30 Sam Weinig <weinig@apple.com> It would be nice if the predicate taking functions in ParsingUtilities.h didn't require specifying the character type https://bugs.webkit.org/show_bug.cgi?id=215002 Reviewed by Darin Adler. Remove the need for specifying the character type by providing overloads for LChar and UChar explicitly. * html/parser/HTMLSrcsetParser.cpp: (WebCore::parseImageCandidatesFromSrcsetAttribute): * html/parser/ParsingUtilities.h: (WebCore::characterPredicate): * html/track/VTTScanner.h: (WebCore::characterPredicate): * loader/LinkHeader.cpp: (WebCore::findURLBoundaries): (WebCore::invalidParameterDelimiter): (WebCore::parseParameterDelimiter): (WebCore::parseParameterName): (WebCore::skipQuotesIfNeeded): (WebCore::parseParameterValue): (WebCore::findNextHeader): * loader/ResourceCryptographicDigest.cpp: (WebCore::parseCryptographicDigestImpl): (WebCore::parseEncodedCryptographicDigestImpl): * loader/SubresourceIntegrity.cpp: (WebCore::splitOnSpaces): * loader/appcache/ApplicationCacheManifestParser.cpp: (WebCore::parseApplicationCacheManifest): * page/csp/ContentSecurityPolicyDirectiveList.cpp: (WebCore::ContentSecurityPolicyDirectiveList::parseDirective): (WebCore::ContentSecurityPolicyDirectiveList::parseReportURI): * page/csp/ContentSecurityPolicyMediaListDirective.cpp: (WebCore::ContentSecurityPolicyMediaListDirective::parse): * page/csp/ContentSecurityPolicySourceList.cpp: (WebCore::isSourceListNone): (WebCore::ContentSecurityPolicySourceList::parse): (WebCore::ContentSecurityPolicySourceList::parseSource): (WebCore::ContentSecurityPolicySourceList::parseScheme): (WebCore::ContentSecurityPolicySourceList::parseHost): (WebCore::ContentSecurityPolicySourceList::parsePath): (WebCore::ContentSecurityPolicySourceList::parsePort): (WebCore::ContentSecurityPolicySourceList::parseNonceSource): * platform/DateComponents.cpp: (WebCore::countDigits): * svg/SVGLengthList.cpp: (WebCore::SVGLengthList::parse): * svg/SVGParserUtilities.cpp: (WebCore::genericParseNumber): * svg/SVGParserUtilities.h: (WebCore::skipOptionalSVGSpaces): 2020-07-30 Sam Weinig <weinig@apple.com> Convert DateComponents to use StringParsingBuffer https://bugs.webkit.org/show_bug.cgi?id=213929 Reviewed by Darin Adler. - Switches string parsing in DateComponents to using StringParsingBuffer, making use of ParsingUtilities to streamline / simplify the code. - Moves a few constant values only used in DateComponents.cpp to DateComponents.cpp - Rename toInt in DateComponents.cpp to parseInt, and have use an Optional return value rather than bool + out-parameter. - Add new parseIntWithinLimits that also checks that parsed value is within specfied limits, as this is what almost all of the int parsing in DateComponents needs. * platform/DateComponents.cpp: (WebCore::countDigits): (WebCore::parseInt): (WebCore::parseIntWithinLimits): (WebCore::DateComponents::parseYear): (WebCore::withinHTMLDateLimits): (WebCore::createFromString): (WebCore::DateComponents::fromParsingMonth): (WebCore::DateComponents::fromParsingDate): (WebCore::DateComponents::fromParsingWeek): (WebCore::DateComponents::fromParsingTime): (WebCore::DateComponents::fromParsingDateTimeLocal): (WebCore::DateComponents::fromParsingDateTime): (WebCore::DateComponents::parseTimeZone): (WebCore::DateComponents::parseMonth): (WebCore::DateComponents::parseDate): (WebCore::DateComponents::parseWeek): (WebCore::DateComponents::parseTime): (WebCore::DateComponents::parseDateTimeLocal): (WebCore::DateComponents::parseDateTime): (WebCore::DateComponents::setMonthsSinceEpoch): (WebCore::DateComponents::setMillisecondsSinceEpochForWeek): (WebCore::toInt): Deleted. * platform/DateComponents.h: (WebCore::DateComponents::minimumYear): Deleted. (WebCore::DateComponents::maximumYear): Deleted. 2020-07-30 Ryan Haddad <ryanhaddad@apple.com> Unreviewed attempt to fix Catalyst build after r265084. * editing/cocoa/DictionaryLookup.mm: 2020-07-30 Dean Jackson <dino@apple.com> [WebGL] Safari snapshots of WebGL content in the tab picker don't work https://bugs.webkit.org/show_bug.cgi?id=214452 <rdar://problem/21243082> Original patch by Justin Fan. Reviewed by Darin Adler. Test is in TestWebKitAPI/Tests/WebKitCocoa/WKWebViewSnapshot.mm. * html/HTMLCanvasElement.cpp: (WebCore::HTMLCanvasElement::paint): Will properly request a paint when a snapshot is requested. * html/HTMLCanvasElement.h: * html/canvas/WebGLRenderingContextBase.cpp: (WebCore::WebGLRenderingContextBase::paintRenderingResultsToCanvas): Only clear the last snapshot if readPixels will succeed. * rendering/RenderHTMLCanvas.cpp: (WebCore::RenderHTMLCanvas::paintReplaced): 2020-07-30 Jer Noble <jer.noble@apple.com> [Cocoa] Adopt -[AVContentKeyRequest willOutputBeObscuredDueToInsufficientExternalProtectionForDisplays:] https://bugs.webkit.org/show_bug.cgi?id=214659 <rdar://problem/63555006> Reviewed by Darin Adler. Use the new WTF::Observer object as the listener type for notifying clients of display changes. When a displayChanged event is observed, use the new AVContentKeyRequest -willOutputBeObscuredDueToInsufficientExternalProtectionForDisplays: to set the keyStatus for that request appropriately. * Modules/encryptedmedia/MediaKeySession.cpp: (WebCore::MediaKeySession::MediaKeySession): (WebCore::MediaKeySession::displayID): (WebCore::MediaKeySession::displayChanged): * Modules/encryptedmedia/MediaKeySession.h: * dom/Document.cpp: (WebCore::Document::windowScreenDidChange): (WebCore::Document::addDisplayChangedObserver): * dom/Document.h: * platform/encryptedmedia/CDMInstanceSession.h: (WebCore::CDMInstanceSession::displayChanged): * platform/graphics/avfoundation/objc/CDMInstanceFairPlayStreamingAVFObjC.h: * platform/graphics/avfoundation/objc/CDMInstanceFairPlayStreamingAVFObjC.mm: (-[WebCoreFPSContentKeySessionDelegate contentKeySession:externalProtectionStatusDidChangeForContentKeyRequest:]): (WebCore::CDMInstanceFairPlayStreamingAVFObjC::externalProtectionStatusDidChangeForContentKeyRequest): (WebCore::CDMInstanceSessionFairPlayStreamingAVFObjC::displayChanged): (WebCore::CDMInstanceSessionFairPlayStreamingAVFObjC::externalProtectionStatusDidChangeForContentKeyRequest): (WebCore::CDMInstanceSessionFairPlayStreamingAVFObjC::updateProtectionStatusForDisplayID): 2020-07-30 James Darpinian <jdarpinian@chromium.org> [WebGL2] Buffer updates https://bugs.webkit.org/show_bug.cgi?id=209511 Reviewed by Dean Jackson. Various fixes in bufferData, bufferSubData, and getBufferSubData. Passes all WebGL conformance tests in conformance/buffers/* and conformance2/buffers/*. * html/canvas/WebGL2RenderingContext.cpp: (WebCore::WebGL2RenderingContext::sliceArrayBufferView): (WebCore::WebGL2RenderingContext::getBufferSubData): * html/canvas/WebGLRenderingContextBase.cpp: (WebCore::WebGLRenderingContextBase::bufferData): (WebCore::WebGLRenderingContextBase::bufferSubData): * html/canvas/WebGLRenderingContextBase.h: * html/canvas/WebGLRenderingContextBase.idl: 2020-07-30 Jer Noble <jer.noble@apple.com> [Cocoa] Make DecoderTest run against .mp4 files; add rate-limiting. https://bugs.webkit.org/show_bug.cgi?id=214807 Reviewed by Darin Adler. Export registerWebKitVP9Decoder() from VP9UtilitiesCocoa instead of LibWebRTCProvider to make it easier for DecodeTest to import, as LibWebRTCProvider also pulls in a bunch of libwebrtc headers. Also, export SourceBufferParser.h so DecoderTest can create parsers for fMP4 files. * SourcesCocoa.txt: * WebCore.xcodeproj/project.pbxproj: * platform/graphics/cocoa/VP9UtilitiesCocoa.h: * platform/graphics/cocoa/VP9UtilitiesCocoa.mm: (WebCore::registerWebKitVP9Decoder): 2020-07-30 Ryosuke Niwa <rniwa@webkit.org> Clicking on a shadow DOM does not move the selection to the focused element when delegatesFocus is set to true https://bugs.webkit.org/show_bug.cgi?id=214859 <rdar://problem/66192901> Reviewed by Wenson Hsieh. The bug was caused by EventHandler moving the selection to where the user had clicked, not to where the focus had been delegated, which is a uniquely WebKit behavior. Fixed the bug by revealing the focused element as done in Element::focus in EventHandler::dispatchMouseEvent and avoid updating the selection to the clicked point later in EventHandler::handleMousePressEventSingleClick by adding an early exit. Test: fast/shadow-dom/delegates-focus-and-types-into-input.html * dom/Element.cpp: (WebCore::Element::focus): (WebCore::Element::revealFocusedElement): Extracted from Element::focus. * dom/Element.h: * page/EventHandler.cpp: (WebCore::EventHandler::handleMousePressEventSingleClick): Added an early exit when dispatchMouseEvent had delegated the focus to an element different from the one the user had clicked. (WebCore::EventHandler::dispatchMouseEvent): Added a code to reveal the newly focused element when the focus had been delegated. * page/EventHandler.h: 2020-07-30 Tim Horton <timothy_horton@apple.com> Web content gets stuck in an inactive state (no cursor updates or text insertion caret) when activating a tab with a thumbnail visible https://bugs.webkit.org/show_bug.cgi?id=214962 <rdar://problem/65670984> Reviewed by Wenson Hsieh. New API test: WebKit.WKThumbnailViewResetsViewStateWhenUnparented * testing/Internals.cpp: (WebCore::Internals::isPageActive const): * testing/Internals.h: * testing/Internals.idl: Add a "view window is active" getter. 2020-07-30 Antoine Quint <graouts@webkit.org> [iOS] Unable to swipe on IMDB.com after long press on image https://bugs.webkit.org/show_bug.cgi?id=214968 <rdar://problem/66234421> Reviewed by Wenson Hsieh. When a long press occurs on an <img>, a system drag interaction is initiated on iOS. In WebCore, EventHandler::tryToBeginDragAtPoint() is called and a synthetic mouse event is produced, causing handleMousePressEvent() to be called. Further down the call chain, dispatchPointerEventIfNeeded() is called and a valid PointerEvent is generated in PointerCaptureController::pointerEventForMouseEvent() with "pointerType" set to "mouse", even though there is already a touch interaction initiated. We now check whether there are known touches before generating a PointerEvent for a MouseEvent. In the case of IMDb, the page would keep track of "pointerdown" events to track whether a multi-touch user gesture is in progress so that their slide shows can support two-finger zooming as well as single-finger swiping. In the case of a long press, the second "pointerdown" event would trick the code in thinking a zoom gesture was initiated and it never recovered. Test: pointerevents/ios/long-press-yields-single-pointerdown-event.html * page/PointerCaptureController.cpp: (WebCore::PointerCaptureController::pointerEventForMouseEvent): 2020-07-30 Chris Dumez <cdumez@apple.com> OfflineAudioContext.startRendering() should return a Promise https://bugs.webkit.org/show_bug.cgi?id=214940 Reviewed by Eric Carlson. OfflineAudioContext.startRendering() should return a Promise: - https://www.w3.org/TR/webaudio/#dom-offlineaudiocontext-startrendering This is important as it was preventing a lot of web-platform-tests from running properly and our test coverage was therefore really poor. No new tests, rebaselined existing tests. * Modules/webaudio/AudioBuffer.idl: * Modules/webaudio/AudioDestinationNode.h: * Modules/webaudio/BaseAudioContext.cpp: (WebCore::BaseAudioContext::finishedRendering): * Modules/webaudio/BaseAudioContext.h: (WebCore::BaseAudioContext::didFinishOfflineRendering): * Modules/webaudio/DefaultAudioDestinationNode.cpp: (WebCore::DefaultAudioDestinationNode::startRendering): * Modules/webaudio/DefaultAudioDestinationNode.h: * Modules/webaudio/OfflineAudioContext.cpp: (WebCore::OfflineAudioContext::startOfflineRendering): (WebCore::OfflineAudioContext::didFinishOfflineRendering): * Modules/webaudio/OfflineAudioContext.h: * Modules/webaudio/OfflineAudioContext.idl: * Modules/webaudio/OfflineAudioDestinationNode.cpp: (WebCore::OfflineAudioDestinationNode::startRendering): * Modules/webaudio/OfflineAudioDestinationNode.h: 2020-07-30 Darin Adler <darin@apple.com> Further reduction in the use of live ranges, particularly in headers https://bugs.webkit.org/show_bug.cgi?id=214793 Reviewed by Sam Weinig. * accessibility/AccessibilityObject.cpp: (WebCore::AccessibilityObject::performTextOperation): Do not call createLiveRange. (WebCore::AccessibilityObject::replaceTextInRange): Ditto. * dom/SimpleRange.cpp: Moved makeSimpleRange functions to the header. * dom/SimpleRange.h: Reworked the makeSimpleRange implementation to avoid a mistake which made template expansion infinitely recurse while compiling and crash the compiler. Ended up moving all the code to the header. Should be a good thing; I expect it will optimize well inlined. * editing/CompositeEditCommand.cpp: (WebCore::CompositeEditCommand::moveParagraphs): Use makeSimpleRange. * editing/Editor.cpp: (WebCore::Editor::replaceSelectionWithText): Do not call createLiveRange. (WebCore::Editor::setComposition): Use SimpleRange. (WebCore::Editor::stringForCandidateRequest const): Do not call createLiveRange. (WebCore::Editor::handleAcceptedCandidate): Use auto intead of RefPtr<Range>. * editing/EditorCommand.cpp: (WebCore::expandSelectionToGranularity): Do not call createLiveRange. (WebCore::executeDeleteToMark): Ditto. (WebCore::executeSelectToMark): Ditto. (WebCore::valueFormatBlock): Ditto. * editing/FormatBlockCommand.cpp: (WebCore::FormatBlockCommand::formatRange): Use makeSimpleRange. (WebCore::FormatBlockCommand::elementForFormatBlockCommand): Take a SimpleRange. * editing/FormatBlockCommand.h: Updated for above. * editing/FrameSelection.cpp: (WebCore::FrameSelection::moveTo): Deleted overload taking a live range. (WebCore::FrameSelection::setSelectedRange): Take a SimpleRange. * editing/FrameSelection.h: Updated for above. * editing/ReplaceSelectionCommand.cpp: (WebCore::ReplacementFragment::ReplacementFragment): Do not call createLiveRange. * editing/VisibleUnits.cpp: (WebCore::enclosingTextUnitOfGranularity): Return SimpleRange. (WebCore::wordRangeFromPosition): Ditto. (WebCore::closestWordBoundaryForPosition): Use SimpleRange. (WebCore::rangeExpandedByCharactersInDirectionAtWordBoundary): Return a SimpleRange. (WebCore::rangeExpandedAroundPositionByCharacters): Ditto. (WebCore::wordBoundaryForPositionWithoutCrossingLine): Use SimpleRange. * editing/VisibleUnits.h: Updated for above. * editing/cocoa/DataDetection.mm: (WebCore::DataDetection::detectItemAroundHitTestResult): Use SimpleRange. * editing/cocoa/DictionaryLookup.mm: (WebCore::DictionaryLookup::rangeForSelection): Use SimpleRange. (WebCore::DictionaryLookup::rangeAtHitTestResult): Ditto. * editing/cocoa/EditorCocoa.mm: (WebCore::Editor::getPasteboardTypesAndDataForAttachment): Do not call createLiveRange. * editing/cocoa/WebContentReaderCocoa.mm: (WebCore::WebContentReader::readPlainText): Ditto. * editing/gtk/WebContentReaderGtk.cpp: (WebCore::WebContentReader::readPlainText): Ditto. * editing/libwpe/EditorLibWPE.cpp: (WebCore::createFragmentFromPasteboardData): Ditto. * editing/mac/DictionaryLookupLegacy.mm: (WebCore::DictionaryLookup::rangeAtHitTestResult): Use SimpleRange. * editing/markup.cpp: (WebCore::serializePreservingVisualAppearance): Take SimpleRange. (WebCore::contextPreservesNewline): Ditto. (WebCore::createFragmentFromText): Ditto. * editing/markup.h: Updated for above. * loader/archive/cf/LegacyWebArchive.cpp: (WebCore::LegacyWebArchive::create): Take SimpleRange. * loader/archive/cf/LegacyWebArchive.h: Updated for above. * page/DragController.cpp: (WebCore::DragController::performDragOperation): Use SimpleRange. (WebCore::DragController::concludeEditDrag): Do not call createLiveRange. (WebCore::selectElement): Use SimpleRange. (WebCore::DragController::removeAllDroppedImagePlaceholders): Ditto. (WebCore::DragController::insertDroppedImagePlaceholdersAtCaret): Ditto. * page/DragController.h: Use SimpleRange. * page/Page.cpp: (WebCore::Page::findTextMatches): Return vector of SimpleRange, in structure so we have one return value instead of two out arguments. Also renamed from findStringMatchingRanges. (WebCore::Page::rangeOfString): Return SimpleRange. (WebCore::replaceRanges): Do not call createLiveRange. (WebCore::Page::replaceRangesWithText): Take SimpleRange. * page/Page.h: Updated for above. * page/ios/FrameIOS.mm: (WebCore::Frame::wordsInCurrentParagraph const): Use SimpleRange. * rendering/HitTestResult.cpp: (WebCore::HitTestResult::isOverTextInsideFormControlElement const): Use SimpleRange, and also use hasAnyPlainText instead of computing the plain text string and checking if it's empty. 2020-07-30 Brady Eidson <beidson@apple.com> Refactor HID gamepad code to be much less fragile and much easier to hack on. https://bugs.webkit.org/show_bug.cgi?id=214910 Reviewed by Darin Adler. Covered by API tests. Currently - for HID device gamepads - we throw all buttons and axes against the wall and see what sticks. Instead, for specific popular devices, we'd like to have device-specific mappings so the representation makes sense. To support that work, this is a major refactoring of the HID gamepad code. It does the following: - Breaks out logic specific to IOHIDDeviceRef into HIDDevice - Breaks out logic specific to IOHIDElementRef into HIDElement - Moves responsibities of managing things to the right places (e.g. HIDElement manages its own current value directly) - Makes HIDGamepadElement derive from HIDElement directly - Moves device specific logic from HIDGamepad into a subclass of HID gamepad. Currently the only subclass is "generic" which encompasses HIDGamepad's old behavior - Changes button/value vectors from Vector<double> to Vector<SharedGamepadValue> so multiple objects can reference the value at once. e.g. HIDGamepadButton can simply update it's own SharedGamepadValue without knowing which HIDGamepad owns it or which index into the gamepad's value vector it should be mutating. This will be critical in the "specific device mapping" work as some types of HIDElements actually drive more than one gamepad button value. e.g. a "direction pad axis" actually manages 2 button values, or a "hat-switch" direction pad manages 4 button values This patch doesn't change any current behavior. * Modules/gamepad/Gamepad.cpp: (WebCore::Gamepad::updateFromPlatformGamepad): * Sources.txt: * SourcesCocoa.txt: * WebCore.xcodeproj/project.pbxproj: * platform/Logging.h: * platform/gamepad/PlatformGamepad.h: * platform/gamepad/SharedGamepadValue.h: Copied from Source/WebKit/UIProcess/Gamepad/UIGamepad.h. (WebCore::SharedGamepadValue::SharedGamepadValue): (WebCore::SharedGamepadValue::setValue): (WebCore::SharedGamepadValue::value const): (WebCore::SharedGamepadValue::Data::Data): * platform/gamepad/cocoa/GameControllerGamepad.h: * platform/gamepad/cocoa/GameControllerGamepad.mm: (WebCore::GameControllerGamepad::setupAsExtendedGamepad): (WebCore::GameControllerGamepad::setupAsGamepad): * platform/gamepad/mac/GenericHIDGamepad.cpp: Added. (WebCore::GenericHIDGamepad::GenericHIDGamepad): (WebCore::GenericHIDGamepad::id): (WebCore::GenericHIDGamepad::maybeAddGenericDesktopElement): (WebCore::GenericHIDGamepad::maybeAddButtonElement): * platform/gamepad/mac/GenericHIDGamepad.h: Copied from Source/WebKit/WebProcess/Gamepad/WebGamepad.h. * platform/gamepad/mac/HIDGamepad.cpp: (WebCore::HIDGamepad::create): (WebCore::HIDGamepad::HIDGamepad): (WebCore::HIDGamepad::initialize): (WebCore::HIDGamepad::valueChanged): (WebCore::HIDGamepad::getCurrentValueForElement): Deleted. (WebCore::HIDGamepad::initElements): Deleted. (WebCore::HIDGamepad::initElementsFromArray): Deleted. (WebCore::HIDGamepad::maybeAddButton): Deleted. (WebCore::HIDGamepad::maybeAddAxis): Deleted. * platform/gamepad/mac/HIDGamepad.h: (WebCore::HIDGamepad::hidDevice const): (WebCore::HIDGamepadElement::HIDGamepadElement): Deleted. (WebCore::HIDGamepadElement::~HIDGamepadElement): Deleted. (WebCore::HIDGamepadElement::isButton const): Deleted. (WebCore::HIDGamepadElement::isAxis const): Deleted. (WebCore::HIDGamepadButton::HIDGamepadButton): Deleted. (WebCore::HIDGamepadAxis::HIDGamepadAxis): Deleted. * platform/gamepad/mac/HIDGamepadElement.cpp: Added. (WebCore::HIDGamepadElement::HIDGamepadElement): (WebCore::HIDGamepadElement::refreshCurrentValue): (WebCore::HIDGamepadElement::normalizedValue): (WebCore::HIDGamepadButton::gamepadValueChanged): (WebCore::HIDGamepadAxis::gamepadValueChanged): (WebCore::HIDGamepadAxis::normalizedValue): * platform/gamepad/mac/HIDGamepadElement.h: Copied from Source/WebCore/platform/gamepad/PlatformGamepad.h. (WebCore::HIDGamepadElement::~HIDGamepadElement): (WebCore::HIDGamepadElement::isButton const): (WebCore::HIDGamepadElement::isAxis const): * platform/gamepad/mac/HIDGamepadProvider.mm: (WebCore::HIDGamepadProvider::deviceAdded): * platform/gamepad/mac/MultiGamepadProvider.h: * platform/graphics/cocoa/SourceBufferParserWebM.cpp: * platform/mac/HIDDevice.cpp: Added. (WebCore::HIDDevice::HIDDevice): (WebCore::HIDDevice::uniqueInputElementsInDeviceTreeOrder const): * platform/mac/HIDDevice.h: Copied from Source/WebCore/platform/gamepad/PlatformGamepad.h. (WebCore::HIDDevice::rawElement const): (WebCore::HIDDevice::vendorID const): (WebCore::HIDDevice::productID const): (WebCore::HIDDevice::productName const): * platform/mac/HIDElement.cpp: Copied from Source/WebKit/UIProcess/Gamepad/UIGamepad.h. (WebCore::HIDElement::HIDElement): (WebCore::HIDElement::valueChanged): * platform/mac/HIDElement.h: Copied from Source/WebKit/UIProcess/Gamepad/UIGamepad.h. (WebCore::HIDElement::rawElement const): (WebCore::HIDElement::physicalMin const): (WebCore::HIDElement::physicalMax const): (WebCore::HIDElement::physicalValue const): (WebCore::HIDElement::usage const): (WebCore::HIDElement::usagePage const): (WebCore::HIDElement::cookie const): * testing/MockGamepad.cpp: (WebCore::MockGamepad::updateDetails): (WebCore::MockGamepad::setAxisValue): (WebCore::MockGamepad::setButtonValue): * testing/MockGamepad.h: 2020-07-29 Joonghun Park <jh718.park@samsung.com> Unreviewed. Remove the build warning below since r265062. warning: comparison of unsigned expression < 0 is always false [-Wtype-limits] No new tests, no new behaviors. * Modules/webaudio/AudioBuffer.cpp: (WebCore::AudioBuffer::copyFromChannel): (WebCore::AudioBuffer::copyToChannel): 2020-07-29 Jer Noble <jer.noble@apple.com> Support HDR decode in SW VP9 https://bugs.webkit.org/show_bug.cgi?id=214928 Reviewed by Eric Carlson. Convert the incoming properties parsed from the VP9 header into extensions to our CMFormatDescription attached to each incoming video fram. Drive-by fix: Files in the wild will have incorrect values for whether a given frame is a keyframe or not. Trust the VP9 header parser rather than the container in this situations. * platform/graphics/cocoa/SourceBufferParserWebM.cpp: (WebCore::convertToCMColorPrimaries): (WebCore::convertToCMTransferFunction): (WebCore::convertToCMYCbCRMatrix): (WebCore::createFormatDescriptionFromVP9HeaderParser): (WebCore::SourceBufferParserWebM::OnFrame): 2020-07-29 Wenson Hsieh <wenson_hsieh@apple.com> [iPadOS] Custom dropdown menu dismisses immediately on account.nhl.com https://bugs.webkit.org/show_bug.cgi?id=214944 <rdar://problem/66248506> Reviewed by Jer Noble. Exempt account.nhl.com from site-specific "simulated mouse events" behavior, since it is incompatible with some custom dropdown menus that appear on this website. * page/Quirks.cpp: (WebCore::Quirks::shouldDispatchSimulatedMouseEvents const): 2020-07-29 Clark Wang <clark_wang@apple.com> Added constructor methods to ChannelMergerNode, ChannelSplitterNode https://bugs.webkit.org/show_bug.cgi?id=214851 <rdar://problem/66233763> Reviewed by Chris Dumez. Added constructors for ChannelMergerNode, ChannelSplitterNode according to spec: https://www.w3.org/TR/webaudio/#ChannelMergerNode-constructors. Added new files for ChannelMergerOptions and ChannelSplitterOptions. This patch also ensures that BaseAudioContext::create*() and *Node::create() methods behave the same. Re-baselined existing tests that now pass, or fail further along. * CMakeLists.txt: * DerivedSources-input.xcfilelist: * DerivedSources-output.xcfilelist: * DerivedSources.make: * Modules/webaudio/AudioNode.h: * Modules/webaudio/BaseAudioContext.cpp: (WebCore::BaseAudioContext::createChannelSplitter): (WebCore::BaseAudioContext::createChannelMerger): * Modules/webaudio/ChannelMergerNode.cpp: (WebCore::ChannelMergerNode::create): (WebCore::ChannelMergerNode::setChannelCount): (WebCore::ChannelMergerNode::setChannelCountMode): * Modules/webaudio/ChannelMergerNode.h: * Modules/webaudio/ChannelMergerNode.idl: * Modules/webaudio/ChannelMergerOptions.h: Added. * Modules/webaudio/ChannelMergerOptions.idl: Added. * Modules/webaudio/ChannelSplitterNode.cpp: (WebCore::ChannelSplitterNode::create): (WebCore::ChannelSplitterNode::setChannelCount): (WebCore::ChannelSplitterNode::setChannelCountMode): (WebCore::ChannelSplitterNode::setChannelInterpretation): * Modules/webaudio/ChannelSplitterNode.h: * Modules/webaudio/ChannelSplitterNode.idl: * Modules/webaudio/ChannelSplitterOptions.h: Added. * Modules/webaudio/ChannelSplitterOptions.idl: Added. * Sources.txt: * WebCore.xcodeproj/project.pbxproj: 2020-07-29 Clark Wang <clark_wang@apple.com> Added copyFromChannel, copyToChannel to AudioBuffer https://bugs.webkit.org/show_bug.cgi?id=214926 Reviewed by Chris Dumez. Added copyFromChannel, copyToChannel methods according to spec: https://www.w3.org/TR/webaudio/#dom-audiobuffer-copyfromchannel-destination. Used Chromium implementation for reference: https://source.chromium.org/chromium/chromium/src/+/master:third_party/blink/renderer/modules/webaudio/audio_buffer.cc. Re-baselined existing tests. Fails on catching sharedBuffer being passed in, but currently WebKit does not support sharedBuffer implementation. * Modules/webaudio/AudioBuffer.cpp: (WebCore::AudioBuffer::getChannelData): (WebCore::AudioBuffer::copyFromChannel): (WebCore::AudioBuffer::copyToChannel): * Modules/webaudio/AudioBuffer.h: * Modules/webaudio/AudioBuffer.idl: 2020-07-29 Wenson Hsieh <wenson_hsieh@apple.com> [macOS] Inspector bar in Mail compose shows incorrect text alignment style for ranged selections https://bugs.webkit.org/show_bug.cgi?id=214930 <rdar://problem/66185224> Reviewed by Tim Horton. When a range of text is selected, AppKit consults `-attributedSubstringForProposedRange:completionHandler:` (or just `-attributedSubstringFromRange:` in WebKitLegacy) to update the inspector bar with new style information. Among this information is the paragraph style (an `NSParagraphStyle` corresponding to the attribute key `NSParagraphStyleAttributeName`), which AppKit uses to select either the left, center or right text alignment segmented control. However, in both WebKitLegacy and modern WebKit, we don't include this information at all in HTMLConverter, so AppKit just defaults to using `-[NSParagraphStyle defaultParagraphStyle]`, with a default text alignment of `NSTextAlignmentNatural`. To fix this, include a new paragraph style object in the case where the text alignment is not equal to natural (in other words, either a direction has been explicitly specified, or the text alignment style is not equal to "start"). This paragraph style matches the default paragraph style, except for the `alignment` property which is set to the corresponding `NSTextAlignment` value. Tests: AttributedSubstringForProposedRange.TextAlignmentParagraphStyles FontAttributes.FontAttributesAfterChangingSelection * editing/Editor.cpp: (WebCore::Editor::fontAttributesAtSelectionStart const): Also fixes an existing bug in `Editor::fontAttributesAtSelectionStart`, where `NSTextAlignmentNatural` is currently always used for `text-align: start;`, even if the direction is specified as RTL. Instead, change this so that we only fall back to "natural" if no direction is specified; otherwise, go with the explicit "left" or "right" values. * editing/cocoa/HTMLConverter.mm: (WebCore::editingAttributedString): 2020-07-29 Jer Noble <jer.noble@apple.com> REGRESSION(r264476): Calling systemHasAC() regresses launch time performance https://bugs.webkit.org/show_bug.cgi?id=214907 <rdar://problem/66191430> Reviewed by Eric Carlson. Because calling into IOPS can block, delay queries about AC state during WebProcessPool creation until the next run-loop. Simultaneously, we don't need to check HDR state in the UI process for IOS, so send a default value there as well. * platform/cocoa/PowerSourceNotifier.h: * platform/cocoa/PowerSourceNotifier.mm: (WebCore::PowerSourceNotifier::PowerSourceNotifier): * platform/cocoa/SystemBattery.h: * platform/cocoa/SystemBattery.mm: (WebCore::cachedSystemHasAC): * platform/ios/PlatformScreenIOS.mm: (WebCore::collectScreenProperties): 2020-07-29 Don Olmstead <don.olmstead@sony.com> Remove USE(ZLIB) https://bugs.webkit.org/show_bug.cgi?id=214929 Reviewed by Darin Adler. Remove USE(ZLIB) guards in WebSocket code. Since WebSocketDeflateFramer::canDeflate is always true remove it and the callsite checking it in WebSocketChannel. * Modules/websockets/WebSocketChannel.cpp: (WebCore::WebSocketChannel::connect): * Modules/websockets/WebSocketDeflateFramer.cpp: (WebCore::WebSocketExtensionDeflateFrame::processResponse): (WebCore::WebSocketDeflateFramer::enableDeflate): (WebCore::WebSocketDeflateFramer::deflate): (WebCore::WebSocketDeflateFramer::resetDeflateContext): (WebCore::WebSocketDeflateFramer::inflate): (WebCore::WebSocketDeflateFramer::resetInflateContext): (WebCore::WebSocketDeflateFramer::canDeflate const): Deleted. * Modules/websockets/WebSocketDeflateFramer.h: * Modules/websockets/WebSocketDeflater.cpp: 2020-07-29 Chris Dumez <cdumez@apple.com> Calling AudioNode constructors should have identical behavior to using create*() function on BaseAudioContext https://bugs.webkit.org/show_bug.cgi?id=214931 Reviewed by Eric Carlson. Calling AudioNode constructors should have identical behavior to using create*() function on BaseAudioContext. Otherwise, this leads to assertion hits on the bots like we saw for Bug 214851. We need to make sure that the AudioContext gets initialized when an AudioNode constructor gets called. We also need to make sure refNode() gets called if necessary. * Modules/webaudio/BaseAudioContext.cpp: (WebCore::BaseAudioContext::createPanner): (WebCore::BaseAudioContext::createOscillator): (WebCore::BaseAudioContext::createPeriodicWave): * Modules/webaudio/BaseAudioContext.h: * Modules/webaudio/OscillatorNode.cpp: (WebCore::OscillatorNode::create): * Modules/webaudio/PannerNode.cpp: (WebCore::PannerNode::create): * Modules/webaudio/PeriodicWave.cpp: (WebCore::PeriodicWave::create): 2020-07-29 Simon Fraser <simon.fraser@apple.com> REGRESSION: ASSERTION FAILED: !needsLayout() on tiled-drawing/scrolling/fast-scroll-mainframe-zoom.html flakily https://bugs.webkit.org/show_bug.cgi?id=214651 <rdar://problem/65952371> Reviewed by Zalan Bujtas. Page::doAfterUpdateRendering() is expected to only call functions that can't trigger layout. However, it could cause the firing of the "monitorWheelEvent" callback which can run arbitrary JS, so move that earlier in the rendering update, before we do the final layout. Also assert that the main frame doesn't need layout at the end of Page::doAfterUpdateRendering(); we were only checking subframes. Tested by lots of existing tests. * page/Page.cpp: (WebCore::Page::updateRendering): (WebCore::Page::doAfterUpdateRendering): 2020-07-29 Chris Dumez <cdumez@apple.com> Make sure playback state constants remain on OscillatorNode for backward compatibility https://bugs.webkit.org/show_bug.cgi?id=214925 Reviewed by Eric Carlson. Make sure playback state constants remain on OscillatorNode for backward compatibility, while we keep supporting the prefixed Web Audio API. No new tests, updated existing test. * Modules/webaudio/OscillatorNode.idl: * Modules/webaudio/WebKitOscillatorNode.idl: 2020-07-29 Chris Dumez <cdumez@apple.com> http/tests/cookies/document-cookie-multiple-cookies.html is failing on Windows https://bugs.webkit.org/show_bug.cgi?id=214880 Reviewed by Darin Adler. Fix same bug as in r264943 but on Windows. No new tests, covered by http/tests/cookies/document-cookie-multiple-cookies.html. * platform/network/cf/NetworkStorageSessionCFNetWin.cpp: (WebCore::parseDOMCookie): (WebCore::NetworkStorageSession::setCookiesFromDOM const): 2020-07-29 Youenn Fablet <youenn@apple.com> scaleResolutionDownBy has no effect on RTCRtpSender https://bugs.webkit.org/show_bug.cgi?id=214783 <rdar://problem/66108346> Reviewed by Eric Carlson. Covered by updated test. * Modules/mediastream/libwebrtc/LibWebRTCUtils.cpp: (WebCore::updateRTCRtpSendParameters): Allow to change scaleResolutionDownBy. 2020-07-29 Mark Lam <mark.lam@apple.com> CodeGeneratorJS should release the throwScope before doing a void call at end of a function. https://bugs.webkit.org/show_bug.cgi?id=214924 Reviewed by Chris Dumez. It is necessary to release the throwScope because the void call at the end of the function may throw an exception. Releasing the throwScope here says that this function is releasing the responsibility to handle the exception, and will allow the potential exception from the trailing void call to propagate to its caller. The responsibility to handle the exception is passed to this function's caller (or some earlier caller in the stack). It is ok to release the throwScope here because the trailing void call will effectively be the last thing that this function does before returning. Covered by existing tests. * bindings/scripts/CodeGeneratorJS.pm: (GenerateImplementationFunctionCall): * bindings/scripts/test/JS/JSMapLike.cpp: (WebCore::jsMapLikePrototypeFunctionClearBody): * bindings/scripts/test/JS/JSSetLike.cpp: (WebCore::jsSetLikePrototypeFunctionClearBody): * bindings/scripts/test/JS/JSTestActiveDOMObject.cpp: (WebCore::jsTestActiveDOMObjectPrototypeFunctionExcitingFunctionBody): (WebCore::jsTestActiveDOMObjectPrototypeFunctionPostMessageBody): (WebCore::jsTestActiveDOMObjectPrototypeFunctionOverloadedMethod1Body): (WebCore::jsTestActiveDOMObjectPrototypeFunctionOverloadedMethod2Body): * bindings/scripts/test/JS/JSTestCEReactions.cpp: (WebCore::jsTestCEReactionsPrototypeFunctionMethodWithCEReactionsBody): (WebCore::jsTestCEReactionsPrototypeFunctionMethodWithCEReactionsNotNeededBody): * bindings/scripts/test/JS/JSTestCallTracer.cpp: (WebCore::jsTestCallTracerPrototypeFunctionTestOperationInterfaceBody): (WebCore::jsTestCallTracerPrototypeFunctionTestOperationSpecifiedBody): (WebCore::jsTestCallTracerPrototypeFunctionTestOperationWithArgumentsBody): (WebCore::jsTestCallTracerPrototypeFunctionTestOperationWithNullableArgumentBody): (WebCore::jsTestCallTracerPrototypeFunctionTestOperationWithVariantArgumentBody): (WebCore::jsTestCallTracerPrototypeFunctionTestOperationWithNullableVariantArgumentBody): (WebCore::jsTestCallTracerPrototypeFunctionTestOperationWithOptionalVariantArgumentBody): (WebCore::jsTestCallTracerPrototypeFunctionTestOperationWithDefaultVariantArgumentBody): * bindings/scripts/test/JS/JSTestEnabledBySetting.cpp: (WebCore::jsTestEnabledBySettingPrototypeFunctionEnabledBySettingOperationBody): * bindings/scripts/test/JS/JSTestGlobalObject.cpp: (WebCore::jsTestGlobalObjectInstanceFunctionRegularOperationBody): (WebCore::jsTestGlobalObjectInstanceFunctionEnabledAtRuntimeOperation1Body): (WebCore::jsTestGlobalObjectInstanceFunctionEnabledAtRuntimeOperation2Body): (WebCore::jsTestGlobalObjectConstructorFunctionEnabledAtRuntimeOperationStaticBody): (WebCore::jsTestGlobalObjectInstanceFunctionEnabledInSpecificWorldBody): (WebCore::jsTestGlobalObjectInstanceFunctionEnabledInSpecificWorldWhenRuntimeFeatureEnabledBody): (WebCore::jsTestGlobalObjectInstanceFunctionEnabledInSpecificWorldWhenRuntimeFeaturesEnabledBody): (WebCore::jsTestGlobalObjectInstanceFunctionTestPrivateFunctionBody): (WebCore::jsTestGlobalObjectInstanceFunctionCalculateSecretResultBody): * bindings/scripts/test/JS/JSTestIndexedSetterWithIdentifier.cpp: (WebCore::jsTestIndexedSetterWithIdentifierPrototypeFunctionIndexedSetterBody): * bindings/scripts/test/JS/JSTestInterface.cpp: (WebCore::jsTestInterfacePrototypeFunctionImplementsMethod1Body): (WebCore::jsTestInterfaceConstructorFunctionImplementsMethod4Body): (WebCore::jsTestInterfacePrototypeFunctionSupplementalMethod1Body): (WebCore::jsTestInterfaceConstructorFunctionSupplementalMethod4Body): * bindings/scripts/test/JS/JSTestNamedAndIndexedSetterWithIdentifier.cpp: (WebCore::jsTestNamedAndIndexedSetterWithIdentifierPrototypeFunctionNamedSetterBody): (WebCore::jsTestNamedAndIndexedSetterWithIdentifierPrototypeFunctionIndexedSetterBody): * bindings/scripts/test/JS/JSTestNamedDeleterWithIdentifier.cpp: (WebCore::jsTestNamedDeleterWithIdentifierPrototypeFunctionNamedDeleterBody): * bindings/scripts/test/JS/JSTestNamedSetterWithIdentifier.cpp: (WebCore::jsTestNamedSetterWithIdentifierPrototypeFunctionNamedSetterBody): * bindings/scripts/test/JS/JSTestNamedSetterWithIndexedGetter.cpp: (WebCore::jsTestNamedSetterWithIndexedGetterPrototypeFunctionNamedSetterBody): * bindings/scripts/test/JS/JSTestNamedSetterWithIndexedGetterAndSetter.cpp: (WebCore::jsTestNamedSetterWithIndexedGetterAndSetterPrototypeFunctionNamedSetterBody): (WebCore::jsTestNamedSetterWithIndexedGetterAndSetterPrototypeFunctionIndexedSetter1Body): * bindings/scripts/test/JS/JSTestNamedSetterWithUnforgableProperties.cpp: (WebCore::jsTestNamedSetterWithUnforgablePropertiesInstanceFunctionUnforgeableOperationBody): * bindings/scripts/test/JS/JSTestNamedSetterWithUnforgablePropertiesAndOverrideBuiltins.cpp: (WebCore::jsTestNamedSetterWithUnforgablePropertiesAndOverrideBuiltinsInstanceFunctionUnforgeableOperationBody): * bindings/scripts/test/JS/JSTestNode.cpp: (WebCore::jsTestNodePrototypeFunctionTestWorkerPromiseBody): (WebCore::jsTestNodePrototypeFunctionCalculateSecretResultBody): * bindings/scripts/test/JS/JSTestObj.cpp: (WebCore::callJSTestObj1): (WebCore::callJSTestObj3): (WebCore::jsTestObjPrototypeFunctionEnabledAtRuntimeOperation1Body): (WebCore::jsTestObjPrototypeFunctionEnabledAtRuntimeOperation2Body): (WebCore::jsTestObjConstructorFunctionEnabledAtRuntimeOperationStaticBody): (WebCore::jsTestObjPrototypeFunctionEnabledInSpecificWorldWhenRuntimeFeatureEnabledBody): (WebCore::jsTestObjPrototypeFunctionWorldSpecificMethodBody): (WebCore::jsTestObjPrototypeFunctionCalculateSecretResultBody): (WebCore::jsTestObjPrototypeFunctionVoidMethodBody): (WebCore::jsTestObjPrototypeFunctionVoidMethodWithArgsBody): (WebCore::jsTestObjPrototypeFunctionMethodWithArgTreatingNullAsEmptyStringBody): (WebCore::jsTestObjPrototypeFunctionMethodWithXPathNSResolverParameterBody): (WebCore::jsTestObjPrototypeFunctionMethodWithEnumArgBody): (WebCore::jsTestObjPrototypeFunctionMethodWithStandaloneEnumArgBody): (WebCore::jsTestObjPrototypeFunctionMethodWithOptionalEnumArgBody): (WebCore::jsTestObjPrototypeFunctionMethodWithOptionalEnumArgAndDefaultValueBody): (WebCore::jsTestObjPrototypeFunctionMethodWithUSVStringArgBody): (WebCore::jsTestObjPrototypeFunctionMethodWithNullableUSVStringArgBody): (WebCore::jsTestObjPrototypeFunctionMethodWithUSVStringArgTreatingNullAsEmptyStringBody): (WebCore::jsTestObjPrototypeFunctionMethodWithByteStringArgBody): (WebCore::jsTestObjPrototypeFunctionMethodWithNullableByteStringArgBody): (WebCore::jsTestObjPrototypeFunctionMethodWithByteStringArgTreatingNullAsEmptyStringBody): (WebCore::jsTestObjPrototypeFunctionSerializedValueBody): (WebCore::jsTestObjPrototypeFunctionMethodWithRecordBody): (WebCore::jsTestObjPrototypeFunctionMethodWithExceptionBody): (WebCore::jsTestObjPrototypeFunctionAddEventListenerBody): (WebCore::jsTestObjPrototypeFunctionRemoveEventListenerBody): (WebCore::jsTestObjPrototypeFunctionWithExecStateVoidBody): (WebCore::jsTestObjPrototypeFunctionWithExecStateVoidExceptionBody): (WebCore::jsTestObjPrototypeFunctionWithScriptExecutionContextBody): (WebCore::jsTestObjPrototypeFunctionWithScriptExecutionContextAndExecStateBody): (WebCore::jsTestObjPrototypeFunctionWithDocumentArgumentBody): (WebCore::jsTestObjPrototypeFunctionWithCallerDocumentArgumentBody): (WebCore::jsTestObjPrototypeFunctionWithCallerWindowArgumentBody): (WebCore::jsTestObjPrototypeFunctionMethodWithOptionalArgBody): (WebCore::jsTestObjPrototypeFunctionMethodWithOptionalArgAndDefaultValueBody): (WebCore::jsTestObjPrototypeFunctionMethodWithNonOptionalArgAndOptionalArgBody): (WebCore::jsTestObjPrototypeFunctionMethodWithNonOptionalArgAndTwoOptionalArgsBody): (WebCore::jsTestObjPrototypeFunctionMethodWithOptionalStringBody): (WebCore::jsTestObjPrototypeFunctionMethodWithOptionalUSVStringBody): (WebCore::jsTestObjPrototypeFunctionMethodWithOptionalAtomStringBody): (WebCore::jsTestObjPrototypeFunctionMethodWithOptionalStringAndDefaultValueBody): (WebCore::jsTestObjPrototypeFunctionMethodWithOptionalAtomStringAndDefaultValueBody): (WebCore::jsTestObjPrototypeFunctionMethodWithOptionalStringIsNullBody): (WebCore::jsTestObjPrototypeFunctionMethodWithOptionalStringIsUndefinedBody): (WebCore::jsTestObjPrototypeFunctionMethodWithOptionalAtomStringIsNullBody): (WebCore::jsTestObjPrototypeFunctionMethodWithOptionalStringIsEmptyStringBody): (WebCore::jsTestObjPrototypeFunctionMethodWithOptionalUSVStringIsEmptyStringBody): (WebCore::jsTestObjPrototypeFunctionMethodWithOptionalAtomStringIsEmptyStringBody): (WebCore::jsTestObjPrototypeFunctionMethodWithOptionalDoubleIsNaNBody): (WebCore::jsTestObjPrototypeFunctionMethodWithOptionalFloatIsNaNBody): (WebCore::jsTestObjPrototypeFunctionMethodWithOptionalLongLongBody): (WebCore::jsTestObjPrototypeFunctionMethodWithOptionalLongLongIsZeroBody): (WebCore::jsTestObjPrototypeFunctionMethodWithOptionalUnsignedLongLongBody): (WebCore::jsTestObjPrototypeFunctionMethodWithOptionalUnsignedLongLongIsZeroBody): (WebCore::jsTestObjPrototypeFunctionMethodWithOptionalSequenceBody): (WebCore::jsTestObjPrototypeFunctionMethodWithOptionalSequenceIsEmptyBody): (WebCore::jsTestObjPrototypeFunctionMethodWithOptionalBooleanBody): (WebCore::jsTestObjPrototypeFunctionMethodWithOptionalBooleanIsFalseBody): (WebCore::jsTestObjPrototypeFunctionMethodWithOptionalAnyBody): (WebCore::jsTestObjPrototypeFunctionMethodWithOptionalObjectBody): (WebCore::jsTestObjPrototypeFunctionMethodWithOptionalNullableWrapperBody): (WebCore::jsTestObjPrototypeFunctionMethodWithOptionalNullableWrapperIsNullBody): (WebCore::jsTestObjPrototypeFunctionMethodWithOptionalXPathNSResolverBody): (WebCore::jsTestObjPrototypeFunctionMethodWithOptionalRecordBody): (WebCore::jsTestObjPrototypeFunctionMethodWithOptionalPromiseBody): (WebCore::jsTestObjPrototypeFunctionMethodWithCallbackArgBody): (WebCore::jsTestObjPrototypeFunctionMethodWithNonCallbackArgAndCallbackArgBody): (WebCore::jsTestObjPrototypeFunctionMethodWithCallbackAndOptionalArgBody): (WebCore::jsTestObjPrototypeFunctionMethodWithCallbackFunctionArgBody): (WebCore::jsTestObjPrototypeFunctionMethodWithNonCallbackArgAndCallbackFunctionArgBody): (WebCore::jsTestObjPrototypeFunctionMethodWithCallbackFunctionAndOptionalArgBody): (WebCore::jsTestObjConstructorFunctionStaticMethodWithCallbackAndOptionalArgBody): (WebCore::jsTestObjConstructorFunctionStaticMethodWithCallbackArgBody): (WebCore::jsTestObjPrototypeFunctionConditionalMethod2Body): (WebCore::jsTestObjPrototypeFunctionConditionalMethod3Body): (WebCore::jsTestObjPrototypeFunctionOverloadedMethod1Body): (WebCore::jsTestObjPrototypeFunctionOverloadedMethod2Body): (WebCore::jsTestObjPrototypeFunctionOverloadedMethod3Body): (WebCore::jsTestObjPrototypeFunctionOverloadedMethod4Body): (WebCore::jsTestObjPrototypeFunctionOverloadedMethod5Body): (WebCore::jsTestObjPrototypeFunctionOverloadedMethod6Body): (WebCore::jsTestObjPrototypeFunctionOverloadedMethod7Body): (WebCore::jsTestObjPrototypeFunctionOverloadedMethod8Body): (WebCore::jsTestObjPrototypeFunctionOverloadedMethod9Body): (WebCore::jsTestObjPrototypeFunctionOverloadedMethod10Body): (WebCore::jsTestObjPrototypeFunctionOverloadedMethod11Body): (WebCore::jsTestObjPrototypeFunctionOverloadedMethod12Body): (WebCore::jsTestObjPrototypeFunctionOverloadedMethod13Body): (WebCore::jsTestObjPrototypeFunctionOverloadedMethodWithOptionalParameter1Body): (WebCore::jsTestObjPrototypeFunctionOverloadedMethodWithOptionalParameter2Body): (WebCore::jsTestObjPrototypeFunctionOverloadedMethodWithDistinguishingUnion1Body): (WebCore::jsTestObjPrototypeFunctionOverloadedMethodWithDistinguishingUnion2Body): (WebCore::jsTestObjPrototypeFunctionOverloadedMethodWith2DistinguishingUnions1Body): (WebCore::jsTestObjPrototypeFunctionOverloadedMethodWith2DistinguishingUnions2Body): (WebCore::jsTestObjPrototypeFunctionOverloadedMethodWithNonDistinguishingUnion1Body): (WebCore::jsTestObjPrototypeFunctionOverloadedMethodWithNonDistinguishingUnion2Body): (WebCore::jsTestObjPrototypeFunctionOverloadWithNullableUnion1Body): (WebCore::jsTestObjPrototypeFunctionOverloadWithNullableUnion2Body): (WebCore::jsTestObjPrototypeFunctionOverloadWithOptionalUnion1Body): (WebCore::jsTestObjPrototypeFunctionOverloadWithOptionalUnion2Body): (WebCore::jsTestObjPrototypeFunctionOverloadWithNullableNonDistinguishingParameter1Body): (WebCore::jsTestObjPrototypeFunctionOverloadWithNullableNonDistinguishingParameter2Body): (WebCore::jsTestObjConstructorFunctionClassMethodBody): (WebCore::jsTestObjConstructorFunctionOverloadedMethod11Body): (WebCore::jsTestObjConstructorFunctionOverloadedMethod12Body): (WebCore::jsTestObjPrototypeFunctionClassMethodWithClampBody): (WebCore::jsTestObjPrototypeFunctionClassMethodWithClampOnOptionalBody): (WebCore::jsTestObjPrototypeFunctionClassMethodWithEnforceRangeBody): (WebCore::jsTestObjPrototypeFunctionClassMethodWithEnforceRangeOnOptionalBody): (WebCore::jsTestObjPrototypeFunctionMethodWithUnsignedLongSequenceBody): (WebCore::jsTestObjPrototypeFunctionOperationWithOptionalUnionParameterBody): (WebCore::jsTestObjPrototypeFunctionMethodWithAndWithoutNullableSequenceBody): (WebCore::jsTestObjPrototypeFunctionConvert1Body): (WebCore::jsTestObjPrototypeFunctionConvert2Body): (WebCore::jsTestObjPrototypeFunctionConvert3Body): (WebCore::jsTestObjPrototypeFunctionConvert4Body): (WebCore::jsTestObjPrototypeFunctionOrangeBody): (WebCore::jsTestObjPrototypeFunctionVariadicStringMethodBody): (WebCore::jsTestObjPrototypeFunctionVariadicDoubleMethodBody): (WebCore::jsTestObjPrototypeFunctionVariadicNodeMethodBody): (WebCore::jsTestObjPrototypeFunctionVariadicUnionMethodBody): (WebCore::jsTestObjPrototypeFunctionAnyBody): (WebCore::jsTestObjPrototypeFunctionTestPromiseFunctionBody): (WebCore::jsTestObjPrototypeFunctionTestPromiseFunctionWithFloatArgumentBody): (WebCore::jsTestObjPrototypeFunctionTestPromiseFunctionWithExceptionBody): (WebCore::jsTestObjPrototypeFunctionTestPromiseFunctionWithOptionalIntArgumentBody): (WebCore::jsTestObjPrototypeFunctionTestPromiseOverloadedFunction1Body): (WebCore::jsTestObjPrototypeFunctionTestPromiseOverloadedFunction2Body): (WebCore::jsTestObjConstructorFunctionTestStaticPromiseFunctionBody): (WebCore::jsTestObjConstructorFunctionTestStaticPromiseFunctionWithExceptionBody): (WebCore::jsTestObjPrototypeFunctionConditionalOverload1Body): (WebCore::jsTestObjPrototypeFunctionConditionalOverload2Body): (WebCore::jsTestObjPrototypeFunctionSingleConditionalOverload1Body): (WebCore::jsTestObjPrototypeFunctionSingleConditionalOverload2Body): (WebCore::jsTestObjPrototypeFunctionAttachShadowRootBody): (WebCore::jsTestObjPrototypeFunctionOperationWithExternalDictionaryParameterBody): (WebCore::jsTestObjPrototypeFunctionBufferSourceParameterBody): (WebCore::jsTestObjPrototypeFunctionLegacyCallerNamedBody): (WebCore::jsTestObjPrototypeFunctionTestReturnValueOptimizationBody): (WebCore::jsTestObjPrototypeFunctionTestReturnValueOptimizationWithExceptionBody): (WebCore::jsTestObjPrototypeFunctionConditionallyExposedToWindowFunctionBody): (WebCore::jsTestObjPrototypeFunctionConditionallyExposedToWorkerFunctionBody): (WebCore::jsTestObjPrototypeFunctionConditionallyExposedToWindowAndWorkerFunctionBody): * bindings/scripts/test/JS/JSTestOperationConditional.cpp: (WebCore::jsTestOperationConditionalPrototypeFunctionNonConditionalOperationBody): (WebCore::jsTestOperationConditionalPrototypeFunctionConditionalOperationBody): * bindings/scripts/test/JS/JSTestSerializedScriptValueInterface.cpp: (WebCore::jsTestSerializedScriptValueInterfacePrototypeFunctionFunctionBody): * bindings/scripts/test/JS/JSTestTypedefs.cpp: (WebCore::jsTestTypedefsPrototypeFunctionFuncBody): (WebCore::jsTestTypedefsPrototypeFunctionSetShadowBody): (WebCore::jsTestTypedefsPrototypeFunctionNullableSequenceArgBody): (WebCore::jsTestTypedefsPrototypeFunctionSequenceOfNullablesArgBody): (WebCore::jsTestTypedefsPrototypeFunctionNullableSequenceOfNullablesArgBody): (WebCore::jsTestTypedefsPrototypeFunctionNullableSequenceOfUnionsArgBody): (WebCore::jsTestTypedefsPrototypeFunctionUnionArgBody): (WebCore::jsTestTypedefsPrototypeFunctionFuncWithClampBody): (WebCore::jsTestTypedefsPrototypeFunctionFuncWithClampInTypedefBody): (WebCore::jsTestTypedefsPrototypeFunctionMethodWithExceptionBody): 2020-07-29 Darin Adler <darin@apple.com> Improve range idioms and other changes to prepare the way for more reduction in live range use https://bugs.webkit.org/show_bug.cgi?id=214882 Reviewed by Sam Weinig. * accessibility/AXObjectCache.cpp: (WebCore::AccessibilityReplacedText::AccessibilityReplacedText): Call the VisiblePosition versions of start and end instead of converting to Position and then back to VisiblePosition. (WebCore::AXObjectCache::rangeMatchesTextNearRange): Simplify with makeSimpleRange. (WebCore::AXObjectCache::characterOffsetForPoint): Ditto. * accessibility/AccessibilityObject.cpp: (WebCore::AccessibilityObject::visiblePositionRangeForUnorderedPositions const): Update idiom for creating VisiblePositionRange since it's just a struct now without explicit constructors. (WebCore::AccessibilityObject::positionOfLeftWord const): Ditto. (WebCore::AccessibilityObject::positionOfRightWord const): Ditto. (WebCore::AccessibilityObject::leftLineVisiblePositionRange const): Ditto. (WebCore::AccessibilityObject::rightLineVisiblePositionRange const): Ditto. (WebCore::AccessibilityObject::sentenceForPosition const): Ditto. (WebCore::AccessibilityObject::paragraphForPosition const): Ditto. (WebCore::AccessibilityObject::styleRangeForPosition const): Ditto. (WebCore::AccessibilityObject::visiblePositionRangeForRange const): Ditto. (WebCore::AccessibilityObject::lineRangeForPosition const): Ditto. (WebCore::AccessibilityObject::stringForVisiblePositionRange): Ditto. (WebCore::AccessibilityObject::lengthForVisiblePositionRange const): Ditto. (WebCore::AccessibilityObject::nextSentenceEndPosition const): Ditto. (WebCore::AccessibilityObject::previousSentenceStartPosition const): Ditto. * accessibility/AccessibilityObjectInterface.h: Moved VisiblePositionRange to VisiblePosition.h for wider use. Also removed constructors. * accessibility/AccessibilityRenderObject.cpp: (WebCore::AccessibilityRenderObject::textUnderElement const): Simplify with makeSimpleRange. (WebCore::AccessibilityRenderObject::linkClickPoint): Ditto. (WebCore::AccessibilityRenderObject::clickPoint): Ditto. (WebCore::AccessibilityRenderObject::visiblePositionRange const): Updated for removal of VisiblePositionRange constructor. (WebCore::AccessibilityRenderObject::visiblePositionRangeForLine const): Remove unnecessary explicit conversion to VisiblePositionRange. * accessibility/mac/WebAccessibilityObjectWrapperMac.mm: (visiblePositionRangeForTextMarkerRange): Added, replacing separate functions for start and end. (-[WebAccessibilityObjectWrapper visiblePositionRangeForTextMarkerRange:]): Simplify using visiblePositionRangeForTextMarkerRange. * dom/Document.cpp: Added include of "Range.h", may not be needed right now, but highly likely to be needed after future live range work. * dom/Node.cpp: Removed include of "Range.h". * dom/Position.h: Added PositionRange. This will be a more efficient alternative to SimpleRange that can avoid computing node offets for positions before and after anchor nodes in some cases. Not used yet. * dom/RadioButtonGroups.cpp: Removed include of "Range.h". * dom/Range.h: Export makeSimpleRange overload now used outside WebCore. * dom/SimpleRange.cpp: (WebCore::makeSimpleRange): Added overloads for ranges that consist of just a single boundary point, so the argument does not have to be passed twice. (WebCore::commonInclusiveAncestor): Added overload so caller can just pass a simple range rather than passing two boundary point container nodes. * dom/SimpleRange.h: Added makeSimpleRange overloads that take one or more argument that can be passed to makeBoundaryPoint or actual boundary points. * dom/StaticRange.cpp: Removed include of "Range.h". * editing/AlternativeTextController.cpp: (WebCore::AlternativeTextController::markPrecedingWhitespaceForDeletedAutocorrectionAfterCommand): Simplify with makeSimpleRange. (WebCore::AlternativeTextController::processMarkersOnTextToBeReplacedByResult): Ditto. * editing/ApplyStyleCommand.cpp: (WebCore::ApplyStyleCommand::applyBlockStyle): Ditto. * editing/CompositeEditCommand.cpp: (WebCore::stringForVisiblePositionIndexRange): Updated for removal of VisiblePositionRange constructor; also use move to reduce reference count churn a tiny bit. (WebCore::CompositeEditCommand::moveParagraphs): Simplify with makeSimpleRange. * editing/DeleteSelectionCommand.cpp: Added include of "Range.h", may not be needed now, but highly likely to be needed after future live range work. * editing/Editing.cpp: (WebCore::indexForVisiblePosition): Simplify using makeSimpleRange and makeBoundaryPointBeforeNodeContents. * editing/Editor.cpp: (WebCore::Editor::selectedText const): Simplify using VisibleSelection::firstRange. (WebCore::extendSelection): Simplify using makeSimpleRange. (WebCore::Editor::contextRangeForCandidateRequest const): Ditto. (WebCore::Editor::adjustedSelectionRange): Simplify with the new overload of commonInclusiveAncestor. * editing/FrameSelection.cpp: (WebCore::FrameSelection::wordOffsetInRange const): Deleted. Moved the code into the iOS-specific part of WebKitLegacy WebFrame. (WebCore::FrameSelection::spaceFollowsWordInRange const): Deleted. Moved the code into the iOS-specific part of WebKitLegacy WebFrame. (WebCore::FrameSelection::selectionAtSentenceStart const): Merged in with actualSelectionAtSentenceStart. (WebCore::FrameSelection::actualSelectionAtSentenceStart const): Deleted. * editing/FrameSelection.h: Updated for the above deletion. * editing/TextCheckingHelper.cpp: (WebCore::TextCheckingParagraph::offsetTo const): Simplify with makeSimpleRange. * editing/TextManipulationController.cpp: (WebCore::ParagraphContentIterator::ParagraphContentIterator): Simplify with makeSimpleRange. * editing/TypingCommand.cpp: (WebCore::TypingCommand::postTextStateChangeNotificationForDeletion): Pass visibleStart/End instead of converting to Position and back to VisiblePosition. * editing/VisiblePosition.cpp: (WebCore::makeSimpleRange): Added. Converts a VisiblePositionRange into a SimpleRange. * editing/VisiblePosition.h: Moved VisiblePositionRange here. * editing/VisibleSelection.cpp: (WebCore::VisibleSelection::firstRange const): Simplify using makeSimpleRange. (WebCore::VisibleSelection::toNormalizedRange const): Ditto. (WebCore::makeSearchRange): Deleted. This was confusingly named given that it was only used in appendTrailingWhitespace. (WebCore::VisibleSelection::appendTrailingWhitespace): Merged makeSearchRange in here and simplified using makeSimpleRange. * editing/VisibleSelection.h: Added conversion to VisiblePositionRange. Previously this was implemented as a constructor for VisiblePositionRange, but that was a layering inversion since this is built on top of VisiblePosition. * editing/VisibleUnits.cpp: (WebCore::distanceBetweenPositions): Simplified using makeSimpleRange. (WebCore::charactersAroundPosition): Ditto. (WebCore::wordRangeFromPosition): Removed an unhelpful comment. (WebCore::closestWordBoundaryForPosition): Ditto. * editing/cocoa/DataDetection.mm: (WebCore::detectItem): Simplify using makeSimpleRange. (WebCore::searchForLinkRemovingExistingDDLinks): Removed out argument about modifying the DOM. This was used to work around a problem caused by using live ranges. The problem no longer exists because the code does not use live ranges any more. (WebCore::DataDetection::detectContentInRange): Removed the workaround. * editing/cocoa/DictionaryLookup.mm: (WebCore::DictionaryLookup::rangeForSelection): Simplify using makeSimpleRange. (WebCore::DictionaryLookup::rangeAtHitTestResult): Ditto. * editing/cocoa/WebContentReaderCocoa.mm: Added include of "Range.h", may not be needed now, but highly likely to be needed after future live range work. * editing/ios/DictationCommandIOS.cpp: Removed include of "Range.h". * editing/mac/DictionaryLookupLegacy.mm: (WebCore::DictionaryLookup::rangeForSelection): Simplify using makeSimpleRange. (WebCore::DictionaryLookup::rangeAtHitTestResult): Ditto. * editing/mac/EditorMac.mm: Removed include of "Range.h". * editing/markup.cpp: (WebCore::StyledMarkupAccumulator::renderedTextRespectingRange): Simplify using makeSimpleRange. * editing/win/EditorWin.cpp: Added include of "Range.h", may not be needed now, but highly likely to be needed after future live range work. * html/shadow/mac/ImageControlsButtonElementMac.cpp: Removed include of "Range.h". * page/DOMSelection.cpp: (WebCore::DOMSelection::addRange): Call setSelection instead of moveTo. No need to have two functions that do the same thing. * page/EventHandler.cpp: (WebCore::textDistance): Simplify using makeSimpleRange. * page/Frame.cpp: (WebCore::Frame::rangeForPoint): Simplify using makeSimpleRange. * page/TextIndicator.cpp: (WebCore::estimatedBackgroundColorForRange): Simplify using the commonInclusiveAncestor overload that takes a range. (WebCore::initializeIndicator): Ditto. 2020-07-29 Adrian Perez de Castro <aperez@igalia.com> Non-unified build fixes, late July 2020 edition https://bugs.webkit.org/show_bug.cgi?id=214918 Unreviewed build fix. No new tests needed. * Modules/webaudio/WebKitOscillatorNode.h: Add missing WebKitAudioContext.h header to make the constructor of WebKitOscillatorNode that WebKitAudioContext inherits from the base context, otherwise the compiler does not know which base class constructor to invoke. * bindings/js/JSDOMConvertDate.h: Add missing JSGlobalObject.h header. * bindings/js/ReadableStreamDefaultController.cpp: Sprinkle missing JSC:: namespace prefixes where needed. (WebCore::invokeReadableStreamDefaultControllerFunction): (WebCore::ReadableStreamDefaultController::close): (WebCore::ReadableStreamDefaultController::error): (WebCore::ReadableStreamDefaultController::enqueue): * editing/SpellChecker.cpp: Add missing inclusion of TextIterator.h. * editing/SpellChecker.h: Add missing inclusion of SimpleRange.h. * editing/TextCheckingHelper.h: Forward declare Frame and VisibleSelection. * editing/TextIterator.cpp: Add missing inclusion of Range.h. * workers/WorkerScriptLoader.h: Add missing inclusion of CertificateInfo.h. 2020-07-29 Commit Queue <commit-queue@webkit.org> Unreviewed, reverting r265002. https://bugs.webkit.org/show_bug.cgi?id=214919 Broke imported/w3c/web-platform-tests/webaudio/the-audio-api /the-scriptprocessornode-interface/simple-input-output.html Reverted changeset: "Added constructor methods to ChannelMergerNode, ChannelSplitterNode" https://bugs.webkit.org/show_bug.cgi?id=214851 https://trac.webkit.org/changeset/265002 2020-07-28 Fujii Hironori <Hironori.Fujii@sony.com> [WinCairo] REGRESSION(r264986) Unreviewed crash fix https://bugs.webkit.org/show_bug.cgi?id=201507 * platform/graphics/egl/GLContextEGL.cpp: (WebCore::GLContextEGL::createWindowContext): Initialize a variable 'surface' as EGL_NO_SURFACE for WinCairo. 2020-07-28 Chris Dumez <cdumez@apple.com> Move non standard OscillatorNode API to new webKitOscillatorNode interface https://bugs.webkit.org/show_bug.cgi?id=214902 Reviewed by Darin Adler. Move non standard OscillatorNode API to new webKitOscillatorNode interface: https://webaudio.github.io/web-audio-api/#oscillatornode Namely, the playbackState attribute and its associated constants are now exposed on the prefixed webKitOscillatorNode interface instead of the unprefixed OscillatorNode. This way, this API is still available to apps using the prefixed API but we do not support this legacy API if the app is using the modern unprefixed API. Test: webaudio/oscillatornode-legacy-api.html * CMakeLists.txt: * DerivedSources-input.xcfilelist: * DerivedSources-output.xcfilelist: * DerivedSources.make: * Modules/webaudio/OscillatorNode.cpp: (WebCore::OscillatorNode::create): (WebCore::OscillatorNode::setType): (WebCore::OscillatorNode::setPeriodicWave): * Modules/webaudio/OscillatorNode.h: * Modules/webaudio/OscillatorNode.idl: * Modules/webaudio/WebKitAudioContext.cpp: (WebCore::WebKitAudioContext::createWebKitOscillator): * Modules/webaudio/WebKitAudioContext.h: * Modules/webaudio/WebKitAudioContext.idl: * Modules/webaudio/WebKitOscillatorNode.h: Copied from Source/WebCore/Modules/webaudio/OscillatorNode.idl. (WebCore::WebKitOscillatorNode::create): (WebCore::WebKitOscillatorNode::setWebKitPeriodicWave): (WebCore::WebKitOscillatorNode::WebKitOscillatorNode): * Modules/webaudio/WebKitOscillatorNode.idl: Copied from Source/WebCore/Modules/webaudio/OscillatorNode.idl. * Sources.txt: * WebCore.xcodeproj/project.pbxproj: * bindings/js/WebCoreBuiltinNames.h: 2020-07-28 Karl Rackler <rackler@apple.com> Unreviewed, reverting r264930. Reverting Pre-Submission Testing Reverted changeset: "scaleResolutionDownBy has no effect on RTCRtpSender" https://bugs.webkit.org/show_bug.cgi?id=214783 https://trac.webkit.org/changeset/264930 2020-07-28 Oriol Brufau <obrufau@igalia.com> [css-grid] Fix 'align-content' in grid containers with small content area https://bugs.webkit.org/show_bug.cgi?id=214370 Reviewed by Darin Adler. In order to properly obey 'align-content', grid containers need to know the available grid space for the block axis. But there was a bug when the sum of border and padding sizes in the block axis were bigger than the content area. Then the available space was considered to be that sum. This patch fixes it so that the available grid space is the size of its content box when that is definite. Tests: imported/w3c/web-platform-tests/css/css-grid/alignment/grid-place-content-001.html imported/w3c/web-platform-tests/css/css-sizing/available-height-for-replaced-content-001.html * rendering/RenderBox.cpp: (WebCore::RenderBox::availableLogicalHeight const): 2020-07-28 Peng Liu <peng.liu6@apple.com> Clean up PlaybackSessionInterface[Mac|AVKit] https://bugs.webkit.org/show_bug.cgi?id=214895 Reviewed by Eric Carlson. No new tests, no functional change. * platform/ios/PlaybackSessionInterfaceAVKit.h: * platform/ios/PlaybackSessionInterfaceAVKit.mm: (WebCore::PlaybackSessionInterfaceAVKit::PlaybackSessionInterfaceAVKit): (WebCore::PlaybackSessionInterfaceAVKit::playbackSessionModel const): Remove unnecessary WEBCORE_EXPORT. Include the correct header for Ref. Replace "protected" with "private". Use WeakPtr of PlaybackSessionModel instead of a raw pointer. * platform/mac/PlaybackSessionInterfaceMac.h: Add "final" to ensureControlsManager(). Some small cleanup. 2020-07-28 Chris Dumez <cdumez@apple.com> [EventSource] WebKit fails to UTF-8 encode the Last-Event-ID HTTP header value https://bugs.webkit.org/show_bug.cgi?id=214860 Reviewed by Alex Christensen and Darin Adler. WebKit fails to UTF-8 encode the Last-Event-ID HTTP header value for EventSource. The specification is here: https://html.spec.whatwg.org/multipage/server-sent-events.html#reestablish-the-connection (step 5.3.) This is causing us to fail a couple of EventSource web-platform-tests which are passing in both Chrome & Firefox. No new tests, rebaselined existing tests. * platform/network/cf/ResourceRequestCFNet.cpp: (WebCore::setHeaderFields): * platform/network/cf/ResourceRequestCFNet.h: (WebCore::httpHeaderValueUsingSuitableEncoding): * platform/network/cocoa/ResourceRequestCocoa.mm: (WebCore::ResourceRequest::doUpdatePlatformRequest): 2020-07-28 Fujii Hironori <Hironori.Fujii@sony.com> [WinCairo] ANGLE D3D renderer can crash when PlatformDisplayWin is destructed in IPC thread https://bugs.webkit.org/show_bug.cgi?id=214241 Reviewed by Don Olmstead. Web process calls _exit() in IPC thread when the IPC connection is closed. PlatformDisplay::sharedDisplay has a static variable of std::unique_ptr<PlatformDisplay> to ensure it will be destructed on the process termination. This rarely causes crashes in ANGLE because ANGLE D3D renderer isn't thread-safe at the moment. * platform/graphics/PlatformDisplay.cpp: (WebCore::PlatformDisplay::sharedDisplay): Don't destruct PlatformDisplay for PLATFORM(WIN). Use unique_ptr::release to leak it. 2020-07-28 Clark Wang <clark_wang@apple.com> Added constructor methods to ChannelMergerNode, ChannelSplitterNode https://bugs.webkit.org/show_bug.cgi?id=214851 Reviewed by Chris Dumez. Added constructors for ChannelMergerNode, ChannelSplitterNode according to spec: https://www.w3.org/TR/webaudio/#ChannelMergerNode-constructors. Added new files for ChannelMergerOptions and ChannelSplitterOptions. Re-baselined existing tests that now pass, or fail due to a different interface. * CMakeLists.txt: * DerivedSources-input.xcfilelist: * DerivedSources-output.xcfilelist: * DerivedSources.make: * Modules/webaudio/AudioNode.h: * Modules/webaudio/BaseAudioContext.cpp: (WebCore::BaseAudioContext::createChannelSplitter): (WebCore::BaseAudioContext::createChannelMerger): * Modules/webaudio/ChannelMergerNode.cpp: (WebCore::ChannelMergerNode::create): (WebCore::ChannelMergerNode::setChannelCount): (WebCore::ChannelMergerNode::setChannelCountMode): * Modules/webaudio/ChannelMergerNode.h: * Modules/webaudio/ChannelMergerNode.idl: * Modules/webaudio/ChannelMergerOptions.h: Added. * Modules/webaudio/ChannelMergerOptions.idl: Added. * Modules/webaudio/ChannelSplitterNode.cpp: (WebCore::ChannelSplitterNode::create): (WebCore::ChannelSplitterNode::setChannelCount): (WebCore::ChannelSplitterNode::setChannelCountMode): (WebCore::ChannelSplitterNode::setChannelInterpretation): * Modules/webaudio/ChannelSplitterNode.h: * Modules/webaudio/ChannelSplitterNode.idl: * Modules/webaudio/ChannelSplitterOptions.h: Added. * Modules/webaudio/ChannelSplitterOptions.idl: Added. * Sources.txt: * WebCore.xcodeproj/project.pbxproj: 2020-07-28 Rob Buis <rbuis@igalia.com> PerformanceObserver should work with 'type' and not just `entryTypes` https://bugs.webkit.org/show_bug.cgi?id=209216 Reviewed by Youenn Fablet. Add support for 'type' attribute as specified here [1]. Tests: imported/w3c/web-platform-tests/performance-timeline/po-observe-type.any.html imported/w3c/web-platform-tests/performance-timeline/po-observe-type.any.worker.html [1] https://w3c.github.io/performance-timeline/#dom-performanceobserverinit * page/PerformanceObserver.cpp: (WebCore::PerformanceObserver::observe): * page/PerformanceObserver.h: * page/PerformanceObserver.idl: 2020-07-28 Karl Rackler <rackler@apple.com> Unreviewed, reverting r264955. Reverting because this commit may have caused issues with tests. Reverted changeset: "WebCoreResourceHandleAsOperationQueueDelegate can use RunLoop::dispatch" https://bugs.webkit.org/show_bug.cgi?id=214771 https://trac.webkit.org/changeset/264955 2020-07-28 Saam Barati <sbarati@apple.com> JSPromise::reject might throw more than an unterminated exception https://bugs.webkit.org/show_bug.cgi?id=214854 <rdar://problem/66152648> Reviewed by Yusuke Suzuki. Before, we were assuming the only exception that could be thrown was an early termination exception. However, it's tenuous to assume the types of exceptions that can be thrown. This particular test was throwing a stack overflow exception. It's better form to just propagate the exception upwards instead of attempting to enumerate the list of valid exceptions. Test: js/dom/promise-rejection-might-stack-overflow.html * bindings/js/JSDOMPromiseDeferred.cpp: (WebCore::DeferredPromise::reject): 2020-07-28 Alex Christensen <achristensen@webkit.org> Add null checks in ResourceLoader https://bugs.webkit.org/show_bug.cgi?id=214786 <rdar://problem/61106685> Reviewed by Youenn Fablet. We had added some iOS-only checks based on crash tracer data. It turns out these code paths are indeed reachable. Let's make ResourceLoader less platform-dependent. The original patch for this has a test that would reach this code, but it never finishes loading. Rather than add a test that always times out or not committing the fix, I commit the fix without the test. * loader/ResourceLoader.cpp: (WebCore::ResourceLoader::init): (WebCore::ResourceLoader::cancel): 2020-07-28 Yusuke Suzuki <ysuzuki@apple.com> IndexedDB binding utilities miss exception checks https://bugs.webkit.org/show_bug.cgi?id=214820 <rdar://problem/66152374> Reviewed by Mark Lam. Test: js/dom/indexed-db-operations-exception-checks.html This patch appropriately inserts exception checking code into IndexedDB binding utilities. * Modules/indexeddb/IDBKeyRange.cpp: (WebCore::IDBKeyRange::only): (WebCore::IDBKeyRange::lowerBound): (WebCore::IDBKeyRange::upperBound): (WebCore::IDBKeyRange::bound): (WebCore::IDBKeyRange::includes): * bindings/js/IDBBindingUtilities.cpp: (WebCore::get): (WebCore::set): (WebCore::toJS): (WebCore::createIDBKeyFromValue): (WebCore::internalCreateIDBKeyFromScriptValueAndKeyPath): (WebCore::ensureNthValueOnKeyPath): (WebCore::injectIDBKeyIntoScriptValue): (WebCore::maybeCreateIDBKeyFromScriptValueAndKeyPath): (WebCore::canInjectIDBKeyIntoScriptValue): (WebCore::scriptValueToIDBKey): * bindings/js/IDBBindingUtilities.h: * bindings/js/JSCustomXPathNSResolver.cpp: (WebCore::JSCustomXPathNSResolver::lookupNamespaceURI): * bindings/js/JSDOMConvertDate.cpp: (WebCore::valueToDate): * bindings/js/JSDOMConvertDate.h: (WebCore::Converter<IDLDate>::convert): * bindings/js/JSDOMConvertStrings.h: (WebCore::JSConverter<IDLDOMString>::convert): (WebCore::JSConverter<IDLByteString>::convert): (WebCore::JSConverter<IDLUSVString>::convert): * bindings/js/JSDOMConvertWebGL.cpp: (WebCore::convertToJSValue): * bindings/js/JSLazyEventListener.cpp: (WebCore::JSLazyEventListener::initializeJSFunction const): * bindings/scripts/CodeGeneratorJS.pm: (GenerateEnumerationImplementationContent): * bindings/scripts/test/JS/JSTestCallbackInterface.cpp: (WebCore::convertEnumerationToJS): * bindings/scripts/test/JS/JSTestObj.cpp: (WebCore::convertEnumerationToJS): * bindings/scripts/test/JS/JSTestStandaloneDictionary.cpp: (WebCore::convertEnumerationToJS): * bindings/scripts/test/JS/JSTestStandaloneEnumeration.cpp: (WebCore::convertEnumerationToJS): * bridge/c/c_utility.cpp: (JSC::Bindings::convertNPVariantToValue): 2020-07-28 Adrian Perez de Castro <aperez@igalia.com> [GTK] Crash in Nicosia::GC3DLayer::makeContextCurrent due to failure in EGL display creation https://bugs.webkit.org/show_bug.cgi?id=201507 Reviewed by Carlos Garcia Campos. Ensure that EGL context and display creation failures are always logged using RELEASE_LOG_INFO(), even for intermediate failures for which a fallback will be tried next, in order to ease diagnosis of related issues. Failure to create contexts at the end of the public methods ::createContext() and ::createSharingContext() is still logged with WTFLogAlways() to write a notice to standard error, and let users/developers know that something failed and checking the complete logs (e.g. with "journalctl" on Linux) may reveal more information. This also replaces the chains of "if" statements with a single "switch" on the PlatformDisplay::Type enum, which makes the code easier to follow and should be more robust as well. No new tests needed. * platform/graphics/egl/GLContextEGL.cpp: (WebCore::GLContextEGL::getEGLConfig): (WebCore::GLContextEGL::createWindowContext): (WebCore::GLContextEGL::createSurfacelessContext): (WebCore::GLContextEGL::createContext): (WebCore::GLContextEGL::createSharingContext): 2020-07-28 Xabier Rodriguez Calvar <calvaris@igalia.com> [GStreamer] Use GST_PLUGIN_FEATURE_RANK env var to have Thunder ranked higher in runtime instead of current custom one https://bugs.webkit.org/show_bug.cgi?id=214826 * platform/graphics/gstreamer/GStreamerCommon.cpp: Unreviewed, added comment about delaying because of the dependency on GStreamer 1.16. 2020-07-28 Xabier Rodriguez Calvar <calvaris@igalia.com> [GStreamer] media/vp9.html failing since check-in in r263894 https://bugs.webkit.org/show_bug.cgi?id=213947 Reviewed by Philippe Normand. Test: media/vp9.html. * testing/Internals.cpp: (WebCore::Internals::usingGStreamer const): Added. * testing/Internals.h: * testing/Internals.idl: 2020-07-27 Carlos Garcia Campos <cgarcia@igalia.com> [GTK][WPE] Support for backdrop-filter https://bugs.webkit.org/show_bug.cgi?id=169988 Reviewed by Adrian Perez de Castro. Add initial support for backdrop filters to coordinated graphics. * platform/graphics/nicosia/NicosiaPlatformLayer.h: (Nicosia::CompositionLayer::flushState): Update the backdrop layer. * platform/graphics/texmap/TextureMapper.h: * platform/graphics/texmap/TextureMapperLayer.cpp: (WebCore::TextureMapperLayer::computeTransformsRecursive): Call it on backdrop layer too. (WebCore::TextureMapperLayer::paintSelfAndChildren): Paint the backdrop layer before current layer to apply backdrop filters on previous contents, then the layer is painted on top. (WebCore::TextureMapperLayer::paintIntoSurface): In case of backdrop layer paint the root layer up to the target layer into the intermediate surface. (WebCore::TextureMapperLayer::setBackdropLayer): Set the bakdrop layer and mark it as such. (WebCore::TextureMapperLayer::applyAnimationsRecursively): Also call syncAnimations on backdrop layer to get the filters updated. * platform/graphics/texmap/TextureMapperLayer.h: * platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp: (WebCore::CoordinatedGraphicsLayer::didChangeBackdropFilters): (WebCore::CoordinatedGraphicsLayer::didChangeBackdropFiltersRect): (WebCore::CoordinatedGraphicsLayer::setShouldUpdateVisibleRect): Also call it for backdrop layer. (WebCore::CoordinatedGraphicsLayer::setContentsVisible): Ditto. (WebCore::CoordinatedGraphicsLayer::setBackdropFilters): (WebCore::CoordinatedGraphicsLayer::setBackdropFiltersRect): (WebCore::CoordinatedGraphicsLayer::flushCompositingState): Also call it for backdrop layer. (WebCore::CoordinatedGraphicsLayer::flushCompositingStateForThisLayerOnly): Handle the changes in backdrop filters and the rect, creating the backdrop layer or updating it. (WebCore::CoordinatedGraphicsLayer::syncPendingStateChangesIncludingSubLayers): Also call it for backdrop layer. (WebCore::CoordinatedGraphicsLayer::addAnimation): Handle AnimatedPropertyWebkitBackdropFilter property. (WebCore::dumpInnerLayer): Dump internal layer info. (WebCore::CoordinatedGraphicsLayer::dumpAdditionalProperties const): Dump backdrop layer. * platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.h: 2020-07-28 Youenn Fablet <youenn@apple.com> ReadableStreamDefaultController should use private JS built-in methods https://bugs.webkit.org/show_bug.cgi?id=214819 Reviewed by Darin Adler. Call directly private buitl-in methods instead of getting close/error/enqueue methods from the controller. Test: http/wpt/fetch/readableStreamDefaultController-overwriting.html * bindings/js/ReadableStreamDefaultController.cpp: (WebCore::invokeReadableStreamDefaultControllerFunction): (WebCore::ReadableStreamDefaultController::close): (WebCore::ReadableStreamDefaultController::error): (WebCore::ReadableStreamDefaultController::enqueue): * bindings/js/ReadableStreamDefaultController.h: (WebCore::ReadableStreamDefaultController::enqueue): (WebCore::ReadableStreamDefaultController::error): 2020-07-27 Carlos Garcia Campos <cgarcia@igalia.com> REGRESSION(r230479): [TextureMapper] replica layer is not rendered https://bugs.webkit.org/show_bug.cgi?id=214827 Reviewed by Adrian Perez de Castro. Since r230479 the replica layer transform is not applied because m_layerTransforms.localTransform is never set for the replica layer. We need to call applyAnimationsRecursively() on the replica layer to initialize the localTransform (even when we know the replica layer won't have animations). * platform/graphics/texmap/TextureMapperLayer.cpp: (WebCore::TextureMapperLayer::applyAnimationsRecursively): 2020-07-27 Alex Christensen <achristensen@webkit.org> Null check inlineStyle in StyledElement::invalidateStyleAttribute https://bugs.webkit.org/show_bug.cgi?id=214782 <rdar://problem/66052987> Reviewed by Geoffrey Garen. This fixes a reachable crash. Test: fast/dom/null-inline-style.html * dom/StyledElement.cpp: (WebCore::StyledElement::invalidateStyleAttribute): 2020-07-27 Wenson Hsieh <wenson_hsieh@apple.com> [iOS] Drag and drop does not preserve file names that contain periods https://bugs.webkit.org/show_bug.cgi?id=214701 <rdar://problem/66014009> Reviewed by Tim Horton. Cocoa documentation does not make it clear whether the `-suggestedName` property on `NSItemProvider` should or should not include the file extension. To avoid adding a redundant file extension, logic in `WebItemProviderPasteboard` attempts to deduce whether the suggested name already contains an extension, and only appends a file extension (taken from name of the original file) if the suggested name does not have one. Unfortunately, since this logic only checks whether or not there is a period in the filename, it will incorrectly avoid adding a file extension when the suggested name contains a period. To fix this, instead of checking for the presence of a period, check to see whether the file extension of the suggested name is the same, and append the extension if it isn't. Test: DragAndDropTests.SuggestedNameContainsDot * platform/ios/WebItemProviderPasteboard.mm: (linkTemporaryItemProviderFilesToDropStagingDirectory): 2020-07-27 Zalan Bujtas <zalan@apple.com> Extension is sized incorrectly, content is cut off. https://bugs.webkit.org/show_bug.cgi?id=214858 <rdar://problem/64135680> Reviewed by Simon Fraser. Autosizing uses an 1px tall viewport to layout the content initially. When the document renderer's height is set to a percent value, this 1px tall viewport will drive the available height for the descendants and we pretty much end up with overflow content. Autosizing takes the overflow into account when computing the final content size, however this overflow depends on the type of the layout context (e.g. flex vs. block). Let's replace percent height values on the document renderer with the initial "height: auto". Test: fast/dynamic/size-to-content-autosize-with-percent-document-height.html * page/FrameView.cpp: (WebCore::FrameView::performSizeToContentAutoSize): 2020-07-27 Chris Dumez <cdumez@apple.com> Update release*() functions on ExceptionOr() to always release the member https://bugs.webkit.org/show_bug.cgi?id=214835 Reviewed by Darin Adler. Update release*() functions on ExceptionOr() to always release the member instead of simply doing a cast to an rvalue reference and leaving it up to the caller. Also add assertions to make sure we don't release those members more than once and to make sure we don't try to access the member after releasing it. * Modules/indexeddb/IDBIndex.cpp: (WebCore::IDBIndex::doOpenCursor): (WebCore::IDBIndex::doOpenKeyCursor): (WebCore::IDBIndex::doGetAll): (WebCore::IDBIndex::doGetAllKeys): * Modules/indexeddb/IDBObjectStore.cpp: (WebCore::IDBObjectStore::doOpenCursor): (WebCore::IDBObjectStore::doOpenKeyCursor): (WebCore::IDBObjectStore::doDelete): (WebCore::IDBObjectStore::doGetAll): (WebCore::IDBObjectStore::doGetAllKeys): Fix issues found in existing code by new assertions. * dom/ExceptionOr.h: (WebCore::ExceptionOr<ReturnType>::exception const): (WebCore::ExceptionOr<ReturnType>::releaseException): (WebCore::ExceptionOr<ReturnType>::returnValue const): (WebCore::ExceptionOr<ReturnType>::releaseReturnValue): (WebCore::>::releaseException): (WebCore::ExceptionOr<void>::exception const): (WebCore::ExceptionOr<void>::releaseException): * dom/TreeWalker.cpp: Fix issues found in existing code by new assertions. 2020-07-27 Geoffrey Garen <ggaren@apple.com> WebCoreResourceHandleAsOperationQueueDelegate can use RunLoop::dispatch https://bugs.webkit.org/show_bug.cgi?id=214771 Reviewed by Darin Adler. Use the new helper function for consistency, and to remove a bit of code. * platform/network/mac/WebCoreResourceHandleAsOperationQueueDelegate.mm: (scheduledWithCustomRunLoopMode): Deleted. (-[WebCoreResourceHandleAsOperationQueueDelegate callFunctionOnMainThread:]): Deleted. 2020-07-27 Chris Dumez <cdumez@apple.com> thisValue is not always set correctly when calling JS callbacks https://bugs.webkit.org/show_bug.cgi?id=214847 Reviewed by Darin Adler. thisValue was not always set correctly when calling JS callbacks. This was causing us to fail the last subtest on: http://w3c-test.org/dom/traversal/TreeWalker-acceptNode-filter.html The specification for TreeWalker is here: - https://dom.spec.whatwg.org/#concept-node-filter Step 6 refers to [call a user object’s operation] in the WebIDL specification: - https://heycam.github.io/webidl/#call-a-user-objects-operation Step 10.5 says: "Set thisArg to O (overriding the provided value)." We were missing this step in our implementation so thisValue ended up being undefined (as per earlier step 2). No new tests, resync'd existing test. * bindings/js/JSCallbackData.cpp: (WebCore::JSCallbackData::invokeCallback): 2020-07-27 Sihui Liu <sihui_liu@appe.com> Text manipulation should not extract non-breaking spaces https://bugs.webkit.org/show_bug.cgi?id=214839 <rdar://problem/64113531> Reviewed by Wenson Hsieh. Spaces are very likely to be dropped during translation. And non-breaking space, if dropped, is likely to affect layout of web page. API test: TextManipulation.StartTextManipulationIgnoresSpaces * editing/TextManipulationController.cpp: (WebCore::isNotSpace): (WebCore::TextManipulationController::parse): 2020-07-27 Chris Dumez <cdumez@apple.com> ASSERT([filteredCookies.get() count] <= 1) on imported/w3c/web-platform-tests/websockets/cookies/third-party-cookie-accepted.https.html https://bugs.webkit.org/show_bug.cgi?id=214222 <rdar://problem/65587120> Reviewed by Alex Christensen. Per the HTML specification [1], upon setting document.cookie, we should act as we would when receiving a Set-Cookie string [2]. This means that you can only set one cookie at a time (you cannot comma-separate several cookies). We were behaving correctly on macOS because we were using the [NSHTTPCookie _parsedCookiesWithResponseHeaderFields] SPI that was made specifically for this purpose. However, we would set multiple cookies (in release), and crash in debug on iOS because iOS was using a different API to parse the cookies ([NSHTTPCookie cookiesWithResponseHeaderFields:). Note that [NSHTTPCookie _parsedCookiesWithResponseHeaderFields] was deprecated in CFNetwork, in favor of [NSHTTPCookie _cookieForSetCookieString:]. As a result, I updated both macOS and iOS to use the same new CFNetwork SPI, which gives us the standard behavior. [1] https://html.spec.whatwg.org/#dom-document-cookie [2] https://tools.ietf.org/html/rfc6265#section-4.1 Test: http/tests/cookies/document-cookie-multiple-cookies.html * platform/network/cocoa/NetworkStorageSessionCocoa.mm: (WebCore::parseDOMCookie): (WebCore::NetworkStorageSession::setCookiesFromDOM const): 2020-07-27 Clark Wang <clark_wang@apple.com> Added Constructor method to OscillatorNode https://bugs.webkit.org/show_bug.cgi?id=214746 Reviewed by Chris Dumez. Re-baselined existing tests that now pass, or fail further along. Added ctor to OscillatorNode, added OscillatorOptions, OscillatorType files all according to spec: https://www.w3.org/TR/webaudio/#OscillatorNode-constructors. Updated createOscillator() method in BaseAudioContext. * CMakeLists.txt: * DerivedSources-input.xcfilelist: * DerivedSources-output.xcfilelist: * DerivedSources.make: * Modules/webaudio/AudioContextOptions.h: * Modules/webaudio/BaseAudioContext.cpp: (WebCore::BaseAudioContext::createOscillator): * Modules/webaudio/OscillatorNode.cpp: (WebCore::OscillatorNode::create): (WebCore::OscillatorNode::OscillatorNode): (WebCore::OscillatorNode::setType): (WebCore::OscillatorNode::setPeriodicWave): * Modules/webaudio/OscillatorNode.h: (WTF::LogArgument<WebCore::OscillatorType>::toString): (WTF::LogArgument<WebCore::OscillatorNode::Type>::toString): Deleted. * Modules/webaudio/OscillatorNode.idl: * Modules/webaudio/OscillatorOptions.h: Copied from Source/WebCore/Modules/webaudio/PeriodicWaveConstraints.h. * Modules/webaudio/OscillatorOptions.idl: Copied from Source/WebCore/Modules/webaudio/PeriodicWaveConstraints.h. * Modules/webaudio/OscillatorType.h: Copied from Source/WebCore/Modules/webaudio/PeriodicWaveConstraints.h. * Modules/webaudio/OscillatorType.idl: Copied from Source/WebCore/Modules/webaudio/PeriodicWaveConstraints.h. * Modules/webaudio/PannerOptions.h: * Modules/webaudio/PeriodicWave.cpp: * Modules/webaudio/PeriodicWaveConstraints.h: * Modules/webaudio/PeriodicWaveOptions.h: * Sources.txt: * WebCore.xcodeproj/project.pbxproj: 2020-07-27 Mark Lam <mark.lam@apple.com> DisallowVMEntry needs a copy assignment operator, detected by gcc's -Wdeprecated-copy warning https://bugs.webkit.org/show_bug.cgi?id=214809 Reviewed by Yusuke Suzuki. Added handling of a possible VMInquiry failure in JSDOMWindow::getOwnPropertySlot() after returning from Base::getOwnPropertySlot(). If a VMInquiry is requested and Base::getOwnPropertySlot() returns false with slot.isTaintedByOpaqueObject() set, then it means that Base::getOwnPropertySlot() failed to execute the VMInquiry, not that it successfully determined that the property doesn't exist. This issue was noticed while studying how JSDOMWindow::getOwnPropertySlot() uses copy assignment of JSC::PropertySlots. * bindings/js/JSDOMWindowCustom.cpp: (WebCore::JSDOMWindow::getOwnPropertySlot): 2020-07-27 Dean Jackson <dino@apple.com> Repeatable WebContent crash: WebCore::jsWebGLRenderingContextPrototypeFunctionGetError https://bugs.webkit.org/show_bug.cgi?id=214814 rdar://59290537 Reviewed by Anders Carlsson. If a WebGL context was killed due to too many contexts in the page, we would get a null pointer crash if the page called getError() more than once on it. This is an edge case not covered by the WebGL conformance suite since the recyling behaviour is specific to our implementation. Test: fast/canvas/webgl/recycle-contexts.html * html/canvas/WebGLRenderingContextBase.cpp: (WebCore::WebGLRenderingContextBase::getError): Add a null check. 2020-07-27 Youenn Fablet <youenn@apple.com> scaleResolutionDownBy has no effect on RTCRtpSender https://bugs.webkit.org/show_bug.cgi?id=214783 <rdar://problem/66108346> Reviewed by Eric Carlson. Covered by updated test. * Modules/mediastream/libwebrtc/LibWebRTCUtils.cpp: (WebCore::updateRTCRtpSendParameters): Allow to change scaleResolutionDownBy. 2020-07-25 Simon Fraser <simon.fraser@apple.com> Scroll Snap broken when using RTL layout https://bugs.webkit.org/show_bug.cgi?id=193671 <rdar://problem/47457471> Reviewed by Wenson Hsieh. There were various places in the scroll snapping code which confused scroll offsets (zero-based) with scroll positions (relative to scroll origin, can be negative). This broke snapping in `direction: rtl` content. The computation of snap locations in updateSnapOffsetsForScrollableArea() was also broken in RTL; we need to snap the right edge of boxes to the right edge of the scroller for the 'start' alignment. (Snapping for LTR boxes in an RTL scroller is poorly defined; for now, follow Gecko.) Tests: css3/scroll-snap/scroll-snap-2d-change-axis-type-rtl.html css3/scroll-snap/scroll-snap-2d-offsets-computed-independently.rtl.html css3/scroll-snap/scroll-snap-elements-container-larger-than-children-rtl.html css3/scroll-snap/scroll-snap-iframe-rtl.html css3/scroll-snap/scroll-snap-offsets-mixed-rtl.html css3/scroll-snap/scroll-snap-offsets-rtl.html * page/scrolling/AxisScrollSnapOffsets.cpp: (WebCore::computeScrollSnapAlignOffset): (WebCore::updateSnapOffsetsForScrollableArea): * page/scrolling/mac/ScrollingTreeScrollingNodeDelegateMac.mm: (WebCore::ScrollingTreeScrollingNodeDelegateMac::scrollOffset const): * platform/ScrollAnimator.cpp: (WebCore::ScrollAnimator::updateActiveScrollSnapIndexForOffset): (WebCore::ScrollAnimator::scrollOffset const): * platform/cocoa/ScrollController.mm: (WebCore::ScrollController::updateScrollSnapPoints): 2020-07-26 Michael Catanzaro <mcatanzaro@gnome.org> -Wunused-parameter in FilterEffectRenderer.cpp https://bugs.webkit.org/show_bug.cgi?id=214808 Unreviewed. * platform/graphics/filters/FilterEffectRenderer.cpp: (WebCore::FilterEffectRenderer::tryCreate): 2020-07-22 Darin Adler <darin@apple.com> Stop using live ranges in SpellChecker.h and TextCheckingHelper.h https://bugs.webkit.org/show_bug.cgi?id=214648 Reviewed by Sam Weinig. * accessibility/mac/WebAccessibilityObjectWrapperBase.mm: Removed unneeded include of TextCheckingHelper.h. * dom/DocumentMarkerController.cpp: (WebCore::DocumentMarkerController::removeMarkers): Updated for change to the argument type name. (WebCore::DocumentMarkerController::filterMarkers): Ditto. (WebCore::addMarker): Added. Convenience so call doesn't have to get the document to call this. (WebCore::removeMarkers): Ditto. * dom/DocumentMarkerController.h: Moved RemovePartiallyOverlappingMarker out of the DocumentMarkerController class, tweaked its name and changed it into an enum class. Added conveniences functions for add/removeMarker. * editing/AlternativeTextController.cpp: (WebCore::AlternativeTextController::respondToUnappliedSpellCorrection): Use convenience versions of removeMarkers and addMarker. (WebCore::AlternativeTextController::handleAlternativeTextUIResult): Ditto. (WebCore::AlternativeTextController::respondToUnappliedEditing): Ditto. (WebCore::AlternativeTextController::markReversed): Ditto. (WebCore::AlternativeTextController::markCorrection): Ditto. (WebCore::AlternativeTextController::recordSpellcheckerResponseForModifiedCorrection): Ditto. (WebCore::AlternativeTextController::markPrecedingWhitespaceForDeletedAutocorrectionAfterCommand): Ditto. (WebCore::AlternativeTextController::applyAlternativeTextToRange): Ditto. * editing/CompositeEditCommand.cpp: (WebCore::CompositeEditCommand::replaceTextInNodePreservingMarkers): Ditto. * editing/Editor.cpp: (WebCore::Editor::ignoreSpelling): Ditto. (WebCore::Editor::learnSpelling): Ditto. (WebCore::Editor::advanceToNextMisspelling): Rewrote to not use a live range and for the changes to the TextCheckingHelper. (WebCore::Editor::isSelectionUngrammatical): Deleted. (WebCore::Editor::guessesForMisspelledOrUngrammatical): Changed to use a return value instead of out arguments. (WebCore::Editor::clearMisspellingsAndBadGrammar): Use convenience versions of removeMarkers. (WebCore::Editor::markMisspellingsAfterTypingToWord): Ditto. (WebCore::Editor::markMisspellingsOrBadGrammar): Updated for change to TextCheckingHelper. (WebCore::Editor::markAllMisspellingsAndBadGrammarInRanges): Do not use live ranges. (WebCore::correctSpellcheckingPreservingTextCheckingParagraph): Take a range that isn't a live range. (WebCore::Editor::markAndReplaceFor): Tweak for changes to text checking and to use convenience version of addMarker. (WebCore::Editor::changeBackToReplacedString): Use convenience versions of removeMarkers and addMarker. (WebCore::Editor::updateMarkersForWordsAffectedByEditing): Ditto. (WebCore::Editor::countMatchesForText): Ditto. (WebCore::Editor::scanSelectionForTelephoneNumbers): Ditto. (WebCore::Editor::editorUIUpdateTimerFired): Ditto. (WebCore::Editor::handleAcceptedCandidate): Ditto. * editing/Editor.h: Update for the above. * editing/SpellChecker.cpp: (WebCore::SpellCheckRequest::SpellCheckRequest): No longer take live ranges. (WebCore::SpellCheckRequest::create): Ditto. (WebCore::SpellChecker::canCheckAsynchronously const): Ditto. (WebCore::SpellChecker::isCheckable const): Ditto. (WebCore::SpellChecker::didCheckSucceed): Use convenience versions of removeMarkers. * editing/SpellChecker.h: Remove the use of live ranges. Removed many unneeded includes and forward declarations. * editing/TextCheckingHelper.cpp: (WebCore::expandToParagraphBoundary): Take and return non-live ranges. (WebCore::TextCheckingParagraph::TextCheckingParagraph): Ditto. (WebCore::TextCheckingParagraph::expandRangeToNextEnd): Updated to use non-live ranges. (WebCore::TextCheckingParagraph::invalidateParagraphRangeValues): Ditto. (WebCore::TextCheckingParagraph::paragraphRange const): Ditto. (WebCore::TextCheckingParagraph::subrange const): Ditto. (WebCore::TextCheckingParagraph::offsetTo const): Ditto. (WebCore::TextCheckingParagraph::offsetAsRange const): Ditto. (WebCore::TextCheckingParagraph::automaticReplacementStart const): Ditto. (WebCore::TextCheckingParagraph::automaticReplacementLength const): Ditto. (WebCore::TextCheckingHelper::~TextCheckingHelper): Deleted. (WebCore::TextCheckingHelper::findMispelledWords const): Renamed from findFirstMispelling, and made this private function since it has confusing argument and return types. Reimplemented to use non-live ranges and to use return values and the addMarker convenience function. Also changed this to not mark when called just to find the first mispelled word. The old version always marked, which didn't make logical sense, but was harmless because the caller always marked the same way. Now this does what it says. (WebCore::TextCheckingHelper::findFirstMisspelledWord const): Added. Replaces findFirstMispelling as a public function, and returns a structure instead of using out arguments. (WebCore::TextCheckingHelper::findFirstMisspelledWordOrUngrammaticalPhrase const): Renamed from findFirstMisspellingOrBadGrammar and changed to return a structure instead of using out arguments. (WebCore::TextCheckingHelper::findUngrammaticalPhrases const): Renamed from findFirstGrammarDetail and findFirstBadGrammar. Both functions are now private and use the new Operation enum class to distinguish the "find first" from "mark all" usage. Also use the convience version of addMarker and return results in a structure instead of using out arguments. (WebCore::TextCheckingHelper::findFirstUngrammaticalPhrase const): Added. Replaces findFirstBadGrammar as a public function, returns a structure instead of using out arguments. (WebCore::TextCheckingHelper::guessesForMisspelledWordOrUngrammaticalPhrase const): Renamed from guessesForMisspelledOrUngrammaticalRange and changed to return a structure instead of out arguments. (WebCore::TextCheckingHelper::markAllMisspelledWords const): Renamed from markAllMisspellings and changed to use a return value instead of an out argument. (WebCore::TextCheckingHelper::markAllUngrammaticalPhrases const): Renamed from markAllBadGrammar. * editing/TextCheckingHelper.h: Removed unneed include of "EditorClient.h". Use non-live ranges. Updated for the other changes above. * editing/ios/DictationCommandIOS.cpp: (WebCore::DictationCommandIOS::doApply): Use the convenience version of addMarker. * editing/ios/EditorIOS.mm: (WebCore::Editor::setDictationPhrasesAsChildOfElement): Ditto. * page/ContextMenuController.cpp: (WebCore::ContextMenuController::populate): Updated for the change to Editor::guessesForMisspelledOrUngrammatical. * platform/text/TextChecking.h: Added a TextCheckingGuesses structure here used both by Editor and TextCheckingHelper. 2020-07-26 Youenn Fablet <youenn@apple.com> Update capture MediaStreamTrack frameRate and aspectRatio capabilities https://bugs.webkit.org/show_bug.cgi?id=214741 Reviewed by Eric Carlson. We support frame decimation to decrease the frame rate. This allows to get a frame rate down to 1. We support resizing up to max width/height resolution. This allows very wide aspect ratios. Covered by updated tests. * platform/mediastream/RealtimeVideoCaptureSource.cpp: (WebCore::RealtimeVideoCaptureSource::updateCapabilities): 2020-07-24 Mark Lam <mark.lam@apple.com> pluginElementCustomGetOwnPropertySlot() should support VMInquiry requests. https://bugs.webkit.org/show_bug.cgi?id=214555 <rdar://problem/65855400> Reviewed by Yusuke Suzuki. 1. Add handling for VMInquiry failure in CodeGeneratorJS. 2. Fix pluginElementCustomGetOwnPropertySlot() to setIsTaintedByOpaqueObject(). 3. Fix pluginElementCustomGetOwnPropertySlot() handle a VMInquiry failure case and if so, to initialize the PropertySlot to a jsUndefined() value. The client shouldn't be reading the value if the VMInquiry failed, but as a defensive action, we'll initialize the slot to effectively return an undefined value. * bindings/js/JSPluginElementFunctions.cpp: (WebCore::pluginElementCustomGetOwnPropertySlot): * bindings/scripts/CodeGeneratorJS.pm: (GenerateGetOwnPropertySlot): (GenerateGetOwnPropertySlotByIndex): * bindings/scripts/test/JS/JSTestPluginInterface.cpp: (WebCore::JSTestPluginInterface::getOwnPropertySlot): (WebCore::JSTestPluginInterface::getOwnPropertySlotByIndex): 2020-07-25 Wenson Hsieh <wenson_hsieh@apple.com> [iOS] Crash under ValidationBubble::setAnchorRect when showing form validation UI in unparented view https://bugs.webkit.org/show_bug.cgi?id=214789 <rdar://problem/66104012> Reviewed by Tim Horton. On iOS, in the case where `WKWebView` is unparented (or is otherwise missing a root view controller, or the private WKUIDelegate method `-_presentingViewControllerForWebView:` returns `nil`), we end up crashing under `ValidationBubble::setAnchorRect` while attempting to add `presentingViewController.view` (which is `nil`) to an array of passthrough views. Since `fallbackViewController` is not guaranteed to successfully find a view controller anyways, make this scenario fail gracefully with a null check, instead of crashing the app. Test: FormValidation.PresentingFormValidationUIWithoutViewControllerDoesNotCrash * platform/ios/ValidationBubbleIOS.mm: (WebCore::ValidationBubble::setAnchorRect): 2020-07-25 Simon Fraser <simon.fraser@apple.com> Some scroll snap cleanup https://bugs.webkit.org/show_bug.cgi?id=214788 Reviewed by Wenson Hsieh. Mostly cleanup in updateSnapOffsetsForScrollableArea() related to getting the scroll limits, which changes behavior. updateSnapOffsetsForScrollableArea() was manually computing the scroll limits with scrollingElementBox.scrollWidth() - scrollingElementBox.contentWidth(), but needs to use the same computation that scrolling uses, namely scrollableArea.maximumScrollOffset(). This changes results, since the old code could compute offsets outside of the scroll limits. It can also get the scrollPosition from the scrollableArea, instead of going via Element. When computing scroll offsets, explicitly round now (which changes some test results). * page/scrolling/AxisScrollSnapOffsets.cpp: (WebCore::updateSnapOffsetsForScrollableArea): * platform/ScrollAnimator.cpp: (WebCore::ScrollAnimator::updateActiveScrollSnapIndexForOffset): Explicitly round. * platform/ScrollTypes.h: * platform/ScrollableArea.h: * platform/cocoa/ScrollController.h: * platform/cocoa/ScrollController.mm: (WebCore::ScrollController::setActiveScrollSnapIndicesForOffset): Use ScrollOffset instead of x,y. 2020-07-25 Kenneth Russell <kbr@chromium.org> [WebGL2] Context state updates https://bugs.webkit.org/show_bug.cgi?id=209513 Reviewed by Dean Jackson. Refactor a few methods related to context state to reduce duplicated code between WebGL 1.0 and 2.0. No behavioral changes. Covered by existing WebGL conformance tests. * html/canvas/WebGL2RenderingContext.cpp: (WebCore::WebGL2RenderingContext::validateCapability): (WebCore::WebGL2RenderingContext::clear): Deleted. (WebCore::WebGL2RenderingContext::hint): Deleted. * html/canvas/WebGL2RenderingContext.h: * html/canvas/WebGLRenderingContext.cpp: (WebCore::WebGLRenderingContext::hint): Deleted. (WebCore::WebGLRenderingContext::clear): Deleted. (WebCore::WebGLRenderingContext::validateCapability): Deleted. * html/canvas/WebGLRenderingContext.h: * html/canvas/WebGLRenderingContextBase.cpp: (WebCore::WebGLRenderingContextBase::clear): (WebCore::WebGLRenderingContextBase::hint): (WebCore::WebGLRenderingContextBase::validateCapability): * html/canvas/WebGLRenderingContextBase.h: 2020-07-24 Brady Eidson <beidson@apple.com> Throw another one on the pile take 2. * platform/gamepad/cocoa/GameControllerGamepadProvider.mm: (WebCore::GameControllerGamepadProvider::controllerDidConnect): Back to the NSString* trick now we know the function is declared. 2020-07-24 Brady Eidson <beidson@apple.com> Throw another one on the pile. * platform/gamepad/cocoa/GameControllerGamepadProvider.mm: (Actually include the SPI header) 2020-07-24 Brady Eidson <beidson@apple.com> Maybe the last build fix after r264874 * platform/gamepad/cocoa/GameControllerGamepadProvider.mm: 2020-07-24 Brady Eidson <beidson@apple.com> Yet another (bizarre?) attempted build fix after r264874 * platform/gamepad/cocoa/GameControllerGamepadProvider.mm: (WebCore::GameControllerGamepadProvider::controllerDidConnect): The last attempt revealed the real problem - missing declaration for this function. *sigh* 2020-07-24 Brady Eidson <beidson@apple.com> Another (bizarre?) attempted build fix after r264874 * platform/gamepad/cocoa/GameControllerGamepadProvider.mm: (WebCore::GameControllerGamepadProvider::controllerDidConnect): The CFSTR macro was wonky for unknown reasons...? Let's try it this way. 2020-07-24 Brady Eidson <beidson@apple.com> Build fix after r264874 Remove all nullability specifiers because just having one goes viral. * platform/gamepad/cocoa/GameControllerSPI.h: 2020-07-24 Alex Christensen <achristensen@webkit.org> Null check frame in Document::dispatchDisabledAdaptationsDidChangeForMainFrame and a few other places https://bugs.webkit.org/show_bug.cgi?id=214715 <rdar://problem/65467702> Reviewed by Geoffrey Garen. Test: security/mutation-observer-frame-detach.html * dom/Document.cpp: (WebCore::Document::didBecomeCurrentDocumentInFrame): (WebCore::Document::initContentSecurityPolicy): * loader/DocumentLoader.cpp: (WebCore::DocumentLoader::commitData): Add some null checks and early returns if the frame detaches. * loader/SubframeLoader.cpp: (WebCore::FrameLoader::SubframeLoader::loadSubframe): Balance the call to incrementLoadEventDelayCount in the early return case or this test never finishes loading. 2020-07-24 Alex Christensen <achristensen@webkit.org> Fix assertion when highlighting in detached frames and make loads complete https://bugs.webkit.org/show_bug.cgi?id=214770 Reviewed by Geoffrey Garen. There's an assertion added in r53218 I think should be an early return. It can be triggered by an interesting test I found while looking into rdar://problem/65467702 I also needed to balance the call to incrementLoadEventDelayCount in an early return in order to get the test to finish loading. Test: fast/editing/frame-selection-is-not-caret.html * editing/FrameSelection.cpp: (WebCore::FrameSelection::caretBlinkTimerFired): * loader/SubframeLoader.cpp: (WebCore::FrameLoader::SubframeLoader::loadSubframe): 2020-07-24 Michael Saboff <msaboff@apple.com> Fixed exception check handling below ScheduledAction::executeFunctionInContext() https://bugs.webkit.org/show_bug.cgi?id=214774 Reviewed by Mark Lam. Test: js/dom/scheduled-action-exception-checks.html * bindings/js/ScheduledAction.cpp: (WebCore::ScheduledAction::executeFunctionInContext): 2020-07-24 Brady Eidson <beidson@apple.com> Hard code some MFi controller devices instead of dynamically managing HID vs GameController.framework. rdar://problem/65961406 and https://bugs.webkit.org/show_bug.cgi?id=214664 Reviewed by Tim Horton. Covered by API tests. I'd added code to dynamically tell whether a device would be handled by GameController.framework or IOHID. On macOS Big Sur, it works flawlessly. On Catalina, it doesn't. The key problem being that GameController.framework will try to handle some controllers it should not. Instead, we can use a hard coded list of the controllers that are most important to support using GCF. The GCF provider and HID provider coordinate on that list when deciding if they should handle a new device. The worst case scenario for that list missing an important controller is that it would be handled in HID instead of GCF, so some features may be missing. * Modules/gamepad/GamepadManager.cpp: (WebCore::GamepadManager::makeGamepadVisible): * platform/gamepad/cocoa/GameControllerGamepadProvider.h: (WebCore::GameControllerGamepadProvider::numberOfConnectedGamepads const): * platform/gamepad/cocoa/GameControllerGamepadProvider.mm: (WebCore::GameControllerGamepadProvider::willHandleVendorAndProduct): (WebCore::GameControllerGamepadProvider::controllerDidConnect): * platform/gamepad/cocoa/GameControllerSPI.h: * platform/gamepad/mac/HIDGamepadProvider.h: (WebCore::HIDGamepadProvider::numberOfConnectedGamepads const): * platform/gamepad/mac/HIDGamepadProvider.mm: (WebCore::deviceAddedCallback): (WebCore::gameControllerFrameworkWillHandleHIDDevice): (WebCore::HIDGamepadProvider::deviceAdded): (WebCore::HIDGamepadProvider::deviceRemoved): (WebCore::HIDGamepadProvider::waitForManagementDecisionForDevice): Deleted. (WebCore::HIDGamepadProvider::removeDeviceWaitingForManagementDecision): Deleted. (WebCore::HIDGamepadProvider::gamePadServiceWasPublished): Deleted. 2020-07-24 Mark Lam <mark.lam@apple.com> Fix exception check handling below postMessage(). https://bugs.webkit.org/show_bug.cgi?id=214761 <rdar://problem/65932136> Reviewed by Yusuke Suzuki and Keith Miller. Test: js/dom/missing-exception-check-below-postMessage.html * bindings/js/JSDOMConvertSequences.h: (WebCore::Detail::SequenceConverter::convertArray): (WebCore::Detail::SequenceConverter::convert): 2020-07-24 Eric Carlson <eric.carlson@apple.com> [Cocoa] Tell AVAssetResourceLoadingContentInformationRequest that asset size is available immediately https://bugs.webkit.org/show_bug.cgi?id=214759 <rdar://problem/63751958> Reviewed by Jer Noble. * platform/graphics/avfoundation/objc/WebCoreAVFResourceLoader.mm: (WebCore::WebCoreAVFResourceLoader::responseReceived): 2020-07-23 Simon Fraser <simon.fraser@apple.com> steps() timing function on a transform animation triggers a render every frame https://bugs.webkit.org/show_bug.cgi?id=214712 <rdar://problem/62737868> Reviewed by Tim Horton. An animation of transform, with a steps() timing function, would schedule a rendering update on every frame. This happened because KeyframeEffect::updateAcceleratedActions() would keep trying, and failing to start the accelerated animation every frame, since GraphicsLayerCA refuses to run accelerated animations with steps timing functions. Fix by making m_isRunningAccelerated a tri-state enum, which gets a new value once we've tried to run the animation the first time. Also ensure that we re-try if the timing function changes, via animationDidChangeTimingProperties(). Test: animations/steps-transform-rendering-updates.html * animation/KeyframeEffect.cpp: (WebCore::KeyframeEffect::isRunningAcceleratedAnimationForProperty const): (WebCore::KeyframeEffect::updateAcceleratedActions): (WebCore::KeyframeEffect::animationDidChangeTimingProperties): (WebCore::KeyframeEffect::animationWasCanceled): (WebCore::KeyframeEffect::willChangeRenderer): (WebCore::KeyframeEffect::animationSuspensionStateDidChange): (WebCore::KeyframeEffect::applyPendingAcceleratedActions): * animation/KeyframeEffect.h: (WebCore::KeyframeEffect::isRunningAccelerated const): * page/Page.cpp: (WebCore::Page::startTrackingRenderingUpdates): (WebCore::Page::renderingUpdateCount const): (WebCore::Page::updateRendering): * page/Page.h: * testing/Internals.cpp: (WebCore::Internals::startTrackingRenderingUpdates): (WebCore::Internals::renderingUpdateCount): * testing/Internals.h: * testing/Internals.idl: 2020-07-24 Mark Lam <mark.lam@apple.com> Fix JS bindings code to DECLARE_THROW_SCOPE in the functions that can throw instead of passing a ThrowScope around. https://bugs.webkit.org/show_bug.cgi?id=214695 <rdar://problem/65927049> Reviewed by Yusuke Suzuki. There are a few exceptions where it makes sense to pass a ThrowScope&, but those are rare. Unless one has a very good reason to do so, the best practice is to always DECLARE_THROW_SCOPE in the functions that can throw. Test: js/dom/missing-exception-check-below-queueMicrotask.html * bindings/js/JSDOMAttribute.h: (WebCore::IDLAttribute::set): (WebCore::IDLAttribute::setStatic): (WebCore::IDLAttribute::get): (WebCore::IDLAttribute::getStatic): * bindings/js/JSDOMIterator.h: (WebCore::iteratorForEach): * bindings/js/JSDOMOperation.h: (WebCore::IDLOperation::call): (WebCore::IDLOperation::callStatic): * bindings/js/JSDOMOperationReturningPromise.h: (WebCore::IDLOperationReturningPromise::call): (WebCore::IDLOperationReturningPromise::callReturningOwnPromise): (WebCore::IDLOperationReturningPromise::callStatic): (WebCore::IDLOperationReturningPromise::callStaticReturningOwnPromise): * bindings/js/JSDOMWindowCustom.cpp: (WebCore::jsDOMWindowInstanceFunctionOpenDatabaseBody): * bindings/js/JSEventTargetCustom.h: (WebCore::IDLOperation<JSEventTarget>::call): * bindings/scripts/CodeGeneratorJS.pm: (GenerateHeader): (GenerateAttributeGetterBodyDefinition): (GenerateAttributeSetterBodyDefinition): (GenerateOperationBodyDefinition): (GenerateSerializerDefinition): (GenerateWriteBarriersForArguments): (GenerateImplementationCustomFunctionCall): (GenerateIterableDefinition): (NativeToJSValueMayThrow): (NativeToJSValue): * bindings/scripts/test/JS/JSMapLike.cpp: (WebCore::jsMapLikeSizeGetter): (WebCore::jsMapLikePrototypeFunctionGetBody): (WebCore::jsMapLikePrototypeFunctionHasBody): (WebCore::jsMapLikePrototypeFunctionEntriesBody): (WebCore::jsMapLikePrototypeFunctionKeysBody): (WebCore::jsMapLikePrototypeFunctionValuesBody): (WebCore::jsMapLikePrototypeFunctionForEachBody): (WebCore::jsMapLikePrototypeFunctionSetBody): (WebCore::jsMapLikePrototypeFunctionClearBody): (WebCore::jsMapLikePrototypeFunctionDeleteBody): * bindings/scripts/test/JS/JSReadOnlyMapLike.cpp: (WebCore::jsReadOnlyMapLikeSizeGetter): (WebCore::jsReadOnlyMapLikePrototypeFunctionGetBody): (WebCore::jsReadOnlyMapLikePrototypeFunctionHasBody): (WebCore::jsReadOnlyMapLikePrototypeFunctionEntriesBody): (WebCore::jsReadOnlyMapLikePrototypeFunctionKeysBody): (WebCore::jsReadOnlyMapLikePrototypeFunctionValuesBody): (WebCore::jsReadOnlyMapLikePrototypeFunctionForEachBody): * bindings/scripts/test/JS/JSReadOnlySetLike.cpp: (WebCore::jsReadOnlySetLikeSizeGetter): (WebCore::jsReadOnlySetLikePrototypeFunctionHasBody): (WebCore::jsReadOnlySetLikePrototypeFunctionEntriesBody): (WebCore::jsReadOnlySetLikePrototypeFunctionKeysBody): (WebCore::jsReadOnlySetLikePrototypeFunctionValuesBody): (WebCore::jsReadOnlySetLikePrototypeFunctionForEachBody): * bindings/scripts/test/JS/JSSetLike.cpp: (WebCore::jsSetLikeSizeGetter): (WebCore::jsSetLikePrototypeFunctionHasBody): (WebCore::jsSetLikePrototypeFunctionEntriesBody): (WebCore::jsSetLikePrototypeFunctionKeysBody): (WebCore::jsSetLikePrototypeFunctionValuesBody): (WebCore::jsSetLikePrototypeFunctionForEachBody): (WebCore::jsSetLikePrototypeFunctionAddBody): (WebCore::jsSetLikePrototypeFunctionClearBody): (WebCore::jsSetLikePrototypeFunctionDeleteBody): * bindings/scripts/test/JS/JSTestActiveDOMObject.cpp: (WebCore::jsTestActiveDOMObjectExcitingAttrGetter): (WebCore::jsTestActiveDOMObjectPrototypeFunctionExcitingFunctionBody): (WebCore::jsTestActiveDOMObjectPrototypeFunctionPostMessageBody): (WebCore::jsTestActiveDOMObjectPrototypeFunctionOverloadedMethod1Body): (WebCore::jsTestActiveDOMObjectPrototypeFunctionOverloadedMethod2Body): (WebCore::jsTestActiveDOMObjectPrototypeFunctionOverloadedMethodOverloadDispatcher): * bindings/scripts/test/JS/JSTestCEReactions.cpp: (WebCore::jsTestCEReactionsAttributeWithCEReactionsGetter): (WebCore::setJSTestCEReactionsAttributeWithCEReactionsSetter): (WebCore::jsTestCEReactionsReflectAttributeWithCEReactionsGetter): (WebCore::setJSTestCEReactionsReflectAttributeWithCEReactionsSetter): (WebCore::jsTestCEReactionsStringifierAttributeGetter): (WebCore::setJSTestCEReactionsStringifierAttributeSetter): (WebCore::jsTestCEReactionsAttributeWithCEReactionsNotNeededGetter): (WebCore::setJSTestCEReactionsAttributeWithCEReactionsNotNeededSetter): (WebCore::jsTestCEReactionsReflectAttributeWithCEReactionsNotNeededGetter): (WebCore::setJSTestCEReactionsReflectAttributeWithCEReactionsNotNeededSetter): (WebCore::jsTestCEReactionsStringifierAttributeNotNeededGetter): (WebCore::setJSTestCEReactionsStringifierAttributeNotNeededSetter): (WebCore::jsTestCEReactionsPrototypeFunctionMethodWithCEReactionsBody): (WebCore::jsTestCEReactionsPrototypeFunctionMethodWithCEReactionsNotNeededBody): * bindings/scripts/test/JS/JSTestCEReactionsStringifier.cpp: (WebCore::jsTestCEReactionsStringifierValueGetter): (WebCore::setJSTestCEReactionsStringifierValueSetter): (WebCore::jsTestCEReactionsStringifierValueWithoutReactionsGetter): (WebCore::setJSTestCEReactionsStringifierValueWithoutReactionsSetter): (WebCore::jsTestCEReactionsStringifierPrototypeFunctionToStringBody): * bindings/scripts/test/JS/JSTestCallTracer.cpp: (WebCore::jsTestCallTracerTestAttributeInterfaceGetter): (WebCore::setJSTestCallTracerTestAttributeInterfaceSetter): (WebCore::jsTestCallTracerTestAttributeSpecifiedGetter): (WebCore::setJSTestCallTracerTestAttributeSpecifiedSetter): (WebCore::jsTestCallTracerTestAttributeWithVariantGetter): (WebCore::setJSTestCallTracerTestAttributeWithVariantSetter): (WebCore::jsTestCallTracerTestReadonlyAttributeGetter): (WebCore::jsTestCallTracerPrototypeFunctionTestOperationInterfaceBody): (WebCore::jsTestCallTracerPrototypeFunctionTestOperationSpecifiedBody): (WebCore::jsTestCallTracerPrototypeFunctionTestOperationWithArgumentsBody): (WebCore::jsTestCallTracerPrototypeFunctionTestOperationWithNullableArgumentBody): (WebCore::jsTestCallTracerPrototypeFunctionTestOperationWithVariantArgumentBody): (WebCore::jsTestCallTracerPrototypeFunctionTestOperationWithNullableVariantArgumentBody): (WebCore::jsTestCallTracerPrototypeFunctionTestOperationWithOptionalVariantArgumentBody): (WebCore::jsTestCallTracerPrototypeFunctionTestOperationWithDefaultVariantArgumentBody): * bindings/scripts/test/JS/JSTestDOMJIT.cpp: (WebCore::jsTestDOMJITAnyAttrGetter): (WebCore::jsTestDOMJITBooleanAttrGetter): (WebCore::jsTestDOMJITByteAttrGetter): (WebCore::jsTestDOMJITOctetAttrGetter): (WebCore::jsTestDOMJITShortAttrGetter): (WebCore::jsTestDOMJITUnsignedShortAttrGetter): (WebCore::jsTestDOMJITLongAttrGetter): (WebCore::jsTestDOMJITUnsignedLongAttrGetter): (WebCore::jsTestDOMJITLongLongAttrGetter): (WebCore::jsTestDOMJITUnsignedLongLongAttrGetter): (WebCore::jsTestDOMJITFloatAttrGetter): (WebCore::jsTestDOMJITUnrestrictedFloatAttrGetter): (WebCore::jsTestDOMJITDoubleAttrGetter): (WebCore::jsTestDOMJITUnrestrictedDoubleAttrGetter): (WebCore::jsTestDOMJITDomStringAttrGetter): (WebCore::jsTestDOMJITByteStringAttrGetter): (WebCore::jsTestDOMJITUsvStringAttrGetter): (WebCore::jsTestDOMJITNodeAttrGetter): (WebCore::jsTestDOMJITBooleanNullableAttrGetter): (WebCore::jsTestDOMJITByteNullableAttrGetter): (WebCore::jsTestDOMJITOctetNullableAttrGetter): (WebCore::jsTestDOMJITShortNullableAttrGetter): (WebCore::jsTestDOMJITUnsignedShortNullableAttrGetter): (WebCore::jsTestDOMJITLongNullableAttrGetter): (WebCore::jsTestDOMJITUnsignedLongNullableAttrGetter): (WebCore::jsTestDOMJITLongLongNullableAttrGetter): (WebCore::jsTestDOMJITUnsignedLongLongNullableAttrGetter): (WebCore::jsTestDOMJITFloatNullableAttrGetter): (WebCore::jsTestDOMJITUnrestrictedFloatNullableAttrGetter): (WebCore::jsTestDOMJITDoubleNullableAttrGetter): (WebCore::jsTestDOMJITUnrestrictedDoubleNullableAttrGetter): (WebCore::jsTestDOMJITDomStringNullableAttrGetter): (WebCore::jsTestDOMJITByteStringNullableAttrGetter): (WebCore::jsTestDOMJITUsvStringNullableAttrGetter): (WebCore::jsTestDOMJITNodeNullableAttrGetter): (WebCore::jsTestDOMJITPrototypeFunctionGetAttributeBody): (WebCore::jsTestDOMJITPrototypeFunctionItemBody): (WebCore::jsTestDOMJITPrototypeFunctionHasAttributeBody): (WebCore::jsTestDOMJITPrototypeFunctionGetElementByIdBody): (WebCore::jsTestDOMJITPrototypeFunctionGetElementsByNameBody): * bindings/scripts/test/JS/JSTestEnabledBySetting.cpp: (WebCore::jsTestEnabledBySettingTestSubObjEnabledBySettingConstructorGetter): (WebCore::setJSTestEnabledBySettingTestSubObjEnabledBySettingConstructorSetter): (WebCore::jsTestEnabledBySettingEnabledBySettingAttributeGetter): (WebCore::setJSTestEnabledBySettingEnabledBySettingAttributeSetter): (WebCore::jsTestEnabledBySettingPrototypeFunctionEnabledBySettingOperationBody): * bindings/scripts/test/JS/JSTestEnabledForContext.cpp: (WebCore::jsTestEnabledForContextTestSubObjEnabledForContextConstructorGetter): (WebCore::setJSTestEnabledForContextTestSubObjEnabledForContextConstructorSetter): * bindings/scripts/test/JS/JSTestEventConstructor.cpp: (WebCore::jsTestEventConstructorAttr1Getter): (WebCore::jsTestEventConstructorAttr2Getter): (WebCore::jsTestEventConstructorAttr3Getter): * bindings/scripts/test/JS/JSTestEventTarget.cpp: (WebCore::jsTestEventTargetPrototypeFunctionItemBody): * bindings/scripts/test/JS/JSTestException.cpp: (WebCore::jsTestExceptionNameGetter): * bindings/scripts/test/JS/JSTestGenerateIsReachable.cpp: (WebCore::jsTestGenerateIsReachableASecretAttributeGetter): * bindings/scripts/test/JS/JSTestGlobalObject.cpp: (WebCore::jsTestGlobalObjectRegularAttributeGetter): (WebCore::setJSTestGlobalObjectRegularAttributeSetter): (WebCore::jsTestGlobalObjectPublicAndPrivateAttributeGetter): (WebCore::setJSTestGlobalObjectPublicAndPrivateAttributeSetter): (WebCore::jsTestGlobalObjectPublicAndPrivateConditionalAttributeGetter): (WebCore::setJSTestGlobalObjectPublicAndPrivateConditionalAttributeSetter): (WebCore::jsTestGlobalObjectEnabledAtRuntimeAttributeGetter): (WebCore::setJSTestGlobalObjectEnabledAtRuntimeAttributeSetter): (WebCore::jsTestGlobalObjectTestCEReactionsConstructorGetter): (WebCore::setJSTestGlobalObjectTestCEReactionsConstructorSetter): (WebCore::jsTestGlobalObjectTestCEReactionsStringifierConstructorGetter): (WebCore::setJSTestGlobalObjectTestCEReactionsStringifierConstructorSetter): (WebCore::jsTestGlobalObjectTestCallTracerConstructorGetter): (WebCore::setJSTestGlobalObjectTestCallTracerConstructorSetter): (WebCore::jsTestGlobalObjectTestCallbackInterfaceConstructorGetter): (WebCore::setJSTestGlobalObjectTestCallbackInterfaceConstructorSetter): (WebCore::jsTestGlobalObjectTestClassWithJSBuiltinConstructorConstructorGetter): (WebCore::setJSTestGlobalObjectTestClassWithJSBuiltinConstructorConstructorSetter): (WebCore::jsTestGlobalObjectTestDOMJITConstructorGetter): (WebCore::setJSTestGlobalObjectTestDOMJITConstructorSetter): (WebCore::jsTestGlobalObjectTestDomainSecurityConstructorGetter): (WebCore::setJSTestGlobalObjectTestDomainSecurityConstructorSetter): (WebCore::jsTestGlobalObjectTestEnabledBySettingConstructorGetter): (WebCore::setJSTestGlobalObjectTestEnabledBySettingConstructorSetter): (WebCore::jsTestGlobalObjectTestEnabledForContextConstructorGetter): (WebCore::setJSTestGlobalObjectTestEnabledForContextConstructorSetter): (WebCore::jsTestGlobalObjectTestEventConstructorConstructorGetter): (WebCore::setJSTestGlobalObjectTestEventConstructorConstructorSetter): (WebCore::jsTestGlobalObjectTestEventTargetConstructorGetter): (WebCore::setJSTestGlobalObjectTestEventTargetConstructorSetter): (WebCore::jsTestGlobalObjectTestExceptionConstructorGetter): (WebCore::setJSTestGlobalObjectTestExceptionConstructorSetter): (WebCore::jsTestGlobalObjectTestGenerateIsReachableConstructorGetter): (WebCore::setJSTestGlobalObjectTestGenerateIsReachableConstructorSetter): (WebCore::jsTestGlobalObjectTestGlobalObjectConstructorGetter): (WebCore::setJSTestGlobalObjectTestGlobalObjectConstructorSetter): (WebCore::jsTestGlobalObjectTestIndexedSetterNoIdentifierConstructorGetter): (WebCore::setJSTestGlobalObjectTestIndexedSetterNoIdentifierConstructorSetter): (WebCore::jsTestGlobalObjectTestIndexedSetterThrowingExceptionConstructorGetter): (WebCore::setJSTestGlobalObjectTestIndexedSetterThrowingExceptionConstructorSetter): (WebCore::jsTestGlobalObjectTestIndexedSetterWithIdentifierConstructorGetter): (WebCore::setJSTestGlobalObjectTestIndexedSetterWithIdentifierConstructorSetter): (WebCore::jsTestGlobalObjectTestInterfaceConstructorGetter): (WebCore::setJSTestGlobalObjectTestInterfaceConstructorSetter): (WebCore::jsTestGlobalObjectTestInterfaceLeadingUnderscoreConstructorGetter): (WebCore::setJSTestGlobalObjectTestInterfaceLeadingUnderscoreConstructorSetter): (WebCore::jsTestGlobalObjectTestIterableConstructorGetter): (WebCore::setJSTestGlobalObjectTestIterableConstructorSetter): (WebCore::jsTestGlobalObjectTestJSBuiltinConstructorConstructorGetter): (WebCore::setJSTestGlobalObjectTestJSBuiltinConstructorConstructorSetter): (WebCore::jsTestGlobalObjectTestMapLikeConstructorGetter): (WebCore::setJSTestGlobalObjectTestMapLikeConstructorSetter): (WebCore::jsTestGlobalObjectTestNamedAndIndexedSetterNoIdentifierConstructorGetter): (WebCore::setJSTestGlobalObjectTestNamedAndIndexedSetterNoIdentifierConstructorSetter): (WebCore::jsTestGlobalObjectTestNamedAndIndexedSetterThrowingExceptionConstructorGetter): (WebCore::setJSTestGlobalObjectTestNamedAndIndexedSetterThrowingExceptionConstructorSetter): (WebCore::jsTestGlobalObjectTestNamedAndIndexedSetterWithIdentifierConstructorGetter): (WebCore::setJSTestGlobalObjectTestNamedAndIndexedSetterWithIdentifierConstructorSetter): (WebCore::jsTestGlobalObjectTestNamedConstructorConstructorGetter): (WebCore::setJSTestGlobalObjectTestNamedConstructorConstructorSetter): (WebCore::jsTestGlobalObjectAudioConstructorGetter): (WebCore::setJSTestGlobalObjectAudioConstructorSetter): (WebCore::jsTestGlobalObjectTestNamedDeleterNoIdentifierConstructorGetter): (WebCore::setJSTestGlobalObjectTestNamedDeleterNoIdentifierConstructorSetter): (WebCore::jsTestGlobalObjectTestNamedDeleterThrowingExceptionConstructorGetter): (WebCore::setJSTestGlobalObjectTestNamedDeleterThrowingExceptionConstructorSetter): (WebCore::jsTestGlobalObjectTestNamedDeleterWithIdentifierConstructorGetter): (WebCore::setJSTestGlobalObjectTestNamedDeleterWithIdentifierConstructorSetter): (WebCore::jsTestGlobalObjectTestNamedDeleterWithIndexedGetterConstructorGetter): (WebCore::setJSTestGlobalObjectTestNamedDeleterWithIndexedGetterConstructorSetter): (WebCore::jsTestGlobalObjectTestNamedGetterCallWithConstructorGetter): (WebCore::setJSTestGlobalObjectTestNamedGetterCallWithConstructorSetter): (WebCore::jsTestGlobalObjectTestNamedGetterNoIdentifierConstructorGetter): (WebCore::setJSTestGlobalObjectTestNamedGetterNoIdentifierConstructorSetter): (WebCore::jsTestGlobalObjectTestNamedGetterWithIdentifierConstructorGetter): (WebCore::setJSTestGlobalObjectTestNamedGetterWithIdentifierConstructorSetter): (WebCore::jsTestGlobalObjectTestNamedSetterNoIdentifierConstructorGetter): (WebCore::setJSTestGlobalObjectTestNamedSetterNoIdentifierConstructorSetter): (WebCore::jsTestGlobalObjectTestNamedSetterThrowingExceptionConstructorGetter): (WebCore::setJSTestGlobalObjectTestNamedSetterThrowingExceptionConstructorSetter): (WebCore::jsTestGlobalObjectTestNamedSetterWithIdentifierConstructorGetter): (WebCore::setJSTestGlobalObjectTestNamedSetterWithIdentifierConstructorSetter): (WebCore::jsTestGlobalObjectTestNamedSetterWithIndexedGetterConstructorGetter): (WebCore::setJSTestGlobalObjectTestNamedSetterWithIndexedGetterConstructorSetter): (WebCore::jsTestGlobalObjectTestNamedSetterWithIndexedGetterAndSetterConstructorGetter): (WebCore::setJSTestGlobalObjectTestNamedSetterWithIndexedGetterAndSetterConstructorSetter): (WebCore::jsTestGlobalObjectTestNamedSetterWithOverrideBuiltinsConstructorGetter): (WebCore::setJSTestGlobalObjectTestNamedSetterWithOverrideBuiltinsConstructorSetter): (WebCore::jsTestGlobalObjectTestNamedSetterWithUnforgablePropertiesConstructorGetter): (WebCore::setJSTestGlobalObjectTestNamedSetterWithUnforgablePropertiesConstructorSetter): (WebCore::jsTestGlobalObjectTestNamedSetterWithUnforgablePropertiesAndOverrideBuiltinsConstructorGetter): (WebCore::setJSTestGlobalObjectTestNamedSetterWithUnforgablePropertiesAndOverrideBuiltinsConstructorSetter): (WebCore::jsTestGlobalObjectTestOperationConditionalConstructorGetter): (WebCore::setJSTestGlobalObjectTestOperationConditionalConstructorSetter): (WebCore::jsTestGlobalObjectTestOverloadedConstructorsConstructorGetter): (WebCore::setJSTestGlobalObjectTestOverloadedConstructorsConstructorSetter): (WebCore::jsTestGlobalObjectTestOverloadedConstructorsWithSequenceConstructorGetter): (WebCore::setJSTestGlobalObjectTestOverloadedConstructorsWithSequenceConstructorSetter): (WebCore::jsTestGlobalObjectTestOverrideBuiltinsConstructorGetter): (WebCore::setJSTestGlobalObjectTestOverrideBuiltinsConstructorSetter): (WebCore::jsTestGlobalObjectTestPluginInterfaceConstructorGetter): (WebCore::setJSTestGlobalObjectTestPluginInterfaceConstructorSetter): (WebCore::jsTestGlobalObjectTestReadOnlyMapLikeConstructorGetter): (WebCore::setJSTestGlobalObjectTestReadOnlyMapLikeConstructorSetter): (WebCore::jsTestGlobalObjectTestReadOnlySetLikeConstructorGetter): (WebCore::setJSTestGlobalObjectTestReadOnlySetLikeConstructorSetter): (WebCore::jsTestGlobalObjectTestReportExtraMemoryCostConstructorGetter): (WebCore::setJSTestGlobalObjectTestReportExtraMemoryCostConstructorSetter): (WebCore::jsTestGlobalObjectTestSerializationConstructorGetter): (WebCore::setJSTestGlobalObjectTestSerializationConstructorSetter): (WebCore::jsTestGlobalObjectTestSerializationIndirectInheritanceConstructorGetter): (WebCore::setJSTestGlobalObjectTestSerializationIndirectInheritanceConstructorSetter): (WebCore::jsTestGlobalObjectTestSerializationInheritConstructorGetter): (WebCore::setJSTestGlobalObjectTestSerializationInheritConstructorSetter): (WebCore::jsTestGlobalObjectTestSerializationInheritFinalConstructorGetter): (WebCore::setJSTestGlobalObjectTestSerializationInheritFinalConstructorSetter): (WebCore::jsTestGlobalObjectTestSerializedScriptValueInterfaceConstructorGetter): (WebCore::setJSTestGlobalObjectTestSerializedScriptValueInterfaceConstructorSetter): (WebCore::jsTestGlobalObjectTestSetLikeConstructorGetter): (WebCore::setJSTestGlobalObjectTestSetLikeConstructorSetter): (WebCore::jsTestGlobalObjectTestStringifierConstructorGetter): (WebCore::setJSTestGlobalObjectTestStringifierConstructorSetter): (WebCore::jsTestGlobalObjectTestStringifierAnonymousOperationConstructorGetter): (WebCore::setJSTestGlobalObjectTestStringifierAnonymousOperationConstructorSetter): (WebCore::jsTestGlobalObjectTestStringifierNamedOperationConstructorGetter): (WebCore::setJSTestGlobalObjectTestStringifierNamedOperationConstructorSetter): (WebCore::jsTestGlobalObjectTestStringifierOperationImplementedAsConstructorGetter): (WebCore::setJSTestGlobalObjectTestStringifierOperationImplementedAsConstructorSetter): (WebCore::jsTestGlobalObjectTestStringifierOperationNamedToStringConstructorGetter): (WebCore::setJSTestGlobalObjectTestStringifierOperationNamedToStringConstructorSetter): (WebCore::jsTestGlobalObjectTestStringifierReadOnlyAttributeConstructorGetter): (WebCore::setJSTestGlobalObjectTestStringifierReadOnlyAttributeConstructorSetter): (WebCore::jsTestGlobalObjectTestStringifierReadWriteAttributeConstructorGetter): (WebCore::setJSTestGlobalObjectTestStringifierReadWriteAttributeConstructorSetter): (WebCore::jsTestGlobalObjectTestTypedefsConstructorGetter): (WebCore::setJSTestGlobalObjectTestTypedefsConstructorSetter): (WebCore::jsTestGlobalObjectInstanceFunctionRegularOperationBody): (WebCore::jsTestGlobalObjectInstanceFunctionEnabledAtRuntimeOperation1Body): (WebCore::jsTestGlobalObjectInstanceFunctionEnabledAtRuntimeOperation2Body): (WebCore::jsTestGlobalObjectInstanceFunctionEnabledAtRuntimeOperationOverloadDispatcher): (WebCore::jsTestGlobalObjectConstructorFunctionEnabledAtRuntimeOperationStaticBody): (WebCore::jsTestGlobalObjectInstanceFunctionEnabledInSpecificWorldBody): (WebCore::jsTestGlobalObjectInstanceFunctionEnabledInSpecificWorldWhenRuntimeFeatureEnabledBody): (WebCore::jsTestGlobalObjectInstanceFunctionEnabledInSpecificWorldWhenRuntimeFeaturesEnabledBody): (WebCore::jsTestGlobalObjectInstanceFunctionTestPrivateFunctionBody): (WebCore::jsTestGlobalObjectInstanceFunctionCalculateSecretResultBody): (WebCore::jsTestGlobalObjectInstanceFunctionGetSecretBooleanBody): (WebCore::jsTestGlobalObjectInstanceFunctionTestFeatureGetSecretBooleanBody): * bindings/scripts/test/JS/JSTestIndexedSetterWithIdentifier.cpp: (WebCore::jsTestIndexedSetterWithIdentifierPrototypeFunctionIndexedSetterBody): * bindings/scripts/test/JS/JSTestInterface.cpp: (WebCore::jsTestInterfaceConstructorImplementsStaticReadOnlyAttrGetter): (WebCore::jsTestInterfaceConstructorImplementsStaticAttrGetter): (WebCore::setJSTestInterfaceConstructorImplementsStaticAttrSetter): (WebCore::jsTestInterfaceImplementsStr1Getter): (WebCore::jsTestInterfaceImplementsStr2Getter): (WebCore::setJSTestInterfaceImplementsStr2Setter): (WebCore::jsTestInterfaceImplementsStr3Getter): (WebCore::setJSTestInterfaceImplementsStr3Setter): (WebCore::jsTestInterfaceImplementsNodeGetter): (WebCore::setJSTestInterfaceImplementsNodeSetter): (WebCore::jsTestInterfaceConstructorSupplementalStaticReadOnlyAttrGetter): (WebCore::jsTestInterfaceConstructorSupplementalStaticAttrGetter): (WebCore::setJSTestInterfaceConstructorSupplementalStaticAttrSetter): (WebCore::jsTestInterfaceSupplementalStr1Getter): (WebCore::jsTestInterfaceSupplementalStr2Getter): (WebCore::setJSTestInterfaceSupplementalStr2Setter): (WebCore::jsTestInterfaceSupplementalStr3Getter): (WebCore::setJSTestInterfaceSupplementalStr3Setter): (WebCore::jsTestInterfaceSupplementalNodeGetter): (WebCore::setJSTestInterfaceSupplementalNodeSetter): (WebCore::jsTestInterfaceReflectAttributeGetter): (WebCore::setJSTestInterfaceReflectAttributeSetter): (WebCore::jsTestInterfacePrototypeFunctionImplementsMethod1Body): (WebCore::jsTestInterfacePrototypeFunctionImplementsMethod2Body): (WebCore::jsTestInterfacePrototypeFunctionImplementsMethod3Body): (WebCore::jsTestInterfaceConstructorFunctionImplementsMethod4Body): (WebCore::jsTestInterfacePrototypeFunctionTakeNodesBody): (WebCore::jsTestInterfacePrototypeFunctionSupplementalMethod1Body): (WebCore::jsTestInterfacePrototypeFunctionSupplementalMethod2Body): (WebCore::jsTestInterfacePrototypeFunctionSupplementalMethod3Body): (WebCore::jsTestInterfaceConstructorFunctionSupplementalMethod4Body): (WebCore::jsTestInterfacePrototypeFunctionEntriesCaller): (WebCore::jsTestInterfacePrototypeFunctionKeysCaller): (WebCore::jsTestInterfacePrototypeFunctionValuesCaller): (WebCore::jsTestInterfacePrototypeFunctionForEachCaller): * bindings/scripts/test/JS/JSTestInterfaceLeadingUnderscore.cpp: (WebCore::jsTestInterfaceLeadingUnderscoreReadonlyGetter): * bindings/scripts/test/JS/JSTestIterable.cpp: (WebCore::jsTestIterablePrototypeFunctionEntriesCaller): (WebCore::jsTestIterablePrototypeFunctionKeysCaller): (WebCore::jsTestIterablePrototypeFunctionValuesCaller): (WebCore::jsTestIterablePrototypeFunctionForEachCaller): * bindings/scripts/test/JS/JSTestJSBuiltinConstructor.cpp: (WebCore::jsTestJSBuiltinConstructorTestAttributeCustomGetter): (WebCore::jsTestJSBuiltinConstructorTestAttributeRWCustomGetter): (WebCore::setJSTestJSBuiltinConstructorTestAttributeRWCustomSetter): (WebCore::jsTestJSBuiltinConstructorPrototypeFunctionTestCustomFunctionBody): * bindings/scripts/test/JS/JSTestNamedAndIndexedSetterWithIdentifier.cpp: (WebCore::jsTestNamedAndIndexedSetterWithIdentifierPrototypeFunctionNamedSetterBody): (WebCore::jsTestNamedAndIndexedSetterWithIdentifierPrototypeFunctionIndexedSetterBody): * bindings/scripts/test/JS/JSTestNamedDeleterWithIdentifier.cpp: (WebCore::jsTestNamedDeleterWithIdentifierPrototypeFunctionNamedDeleterBody): * bindings/scripts/test/JS/JSTestNamedGetterWithIdentifier.cpp: (WebCore::jsTestNamedGetterWithIdentifierPrototypeFunctionGetterNameBody): * bindings/scripts/test/JS/JSTestNamedSetterWithIdentifier.cpp: (WebCore::jsTestNamedSetterWithIdentifierPrototypeFunctionNamedSetterBody): * bindings/scripts/test/JS/JSTestNamedSetterWithIndexedGetter.cpp: (WebCore::jsTestNamedSetterWithIndexedGetterPrototypeFunctionNamedSetterBody): (WebCore::jsTestNamedSetterWithIndexedGetterPrototypeFunctionIndexedSetterBody): * bindings/scripts/test/JS/JSTestNamedSetterWithIndexedGetterAndSetter.cpp: (WebCore::jsTestNamedSetterWithIndexedGetterAndSetterPrototypeFunctionNamedSetterBody): (WebCore::jsTestNamedSetterWithIndexedGetterAndSetterPrototypeFunctionIndexedSetter1Body): (WebCore::jsTestNamedSetterWithIndexedGetterAndSetterPrototypeFunctionIndexedSetter2Body): (WebCore::jsTestNamedSetterWithIndexedGetterAndSetterPrototypeFunctionIndexedSetterOverloadDispatcher): * bindings/scripts/test/JS/JSTestNamedSetterWithUnforgableProperties.cpp: (WebCore::jsTestNamedSetterWithUnforgablePropertiesUnforgeableAttributeGetter): (WebCore::jsTestNamedSetterWithUnforgablePropertiesInstanceFunctionUnforgeableOperationBody): * bindings/scripts/test/JS/JSTestNamedSetterWithUnforgablePropertiesAndOverrideBuiltins.cpp: (WebCore::jsTestNamedSetterWithUnforgablePropertiesAndOverrideBuiltinsUnforgeableAttributeGetter): (WebCore::jsTestNamedSetterWithUnforgablePropertiesAndOverrideBuiltinsInstanceFunctionUnforgeableOperationBody): * bindings/scripts/test/JS/JSTestNode.cpp: (WebCore::jsTestNodeNameGetter): (WebCore::setJSTestNodeNameSetter): (WebCore::jsTestNodePrototypeFunctionTestWorkerPromiseBody): (WebCore::jsTestNodePrototypeFunctionCalculateSecretResultBody): (WebCore::jsTestNodePrototypeFunctionGetSecretBooleanBody): (WebCore::jsTestNodePrototypeFunctionTestFeatureGetSecretBooleanBody): (WebCore::jsTestNodePrototypeFunctionEntriesCaller): (WebCore::jsTestNodePrototypeFunctionKeysCaller): (WebCore::jsTestNodePrototypeFunctionValuesCaller): (WebCore::jsTestNodePrototypeFunctionForEachCaller): (WebCore::JSTestNode::serialize): (WebCore::jsTestNodePrototypeFunctionToJSONBody): * bindings/scripts/test/JS/JSTestNode.h: * bindings/scripts/test/JS/JSTestObj.cpp: (WebCore::jsTestObjReadOnlyLongAttrGetter): (WebCore::jsTestObjReadOnlyStringAttrGetter): (WebCore::jsTestObjReadOnlyTestObjAttrGetter): (WebCore::jsTestObjConstructorStaticReadOnlyLongAttrGetter): (WebCore::jsTestObjConstructorStaticStringAttrGetter): (WebCore::setJSTestObjConstructorStaticStringAttrSetter): (WebCore::jsTestObjConstructorTestSubObjGetter): (WebCore::jsTestObjConstructorTestStaticReadonlyObjGetter): (WebCore::jsTestObjEnumAttrGetter): (WebCore::setJSTestObjEnumAttrSetter): (WebCore::jsTestObjByteAttrGetter): (WebCore::setJSTestObjByteAttrSetter): (WebCore::jsTestObjOctetAttrGetter): (WebCore::setJSTestObjOctetAttrSetter): (WebCore::jsTestObjShortAttrGetter): (WebCore::setJSTestObjShortAttrSetter): (WebCore::jsTestObjClampedShortAttrGetter): (WebCore::setJSTestObjClampedShortAttrSetter): (WebCore::jsTestObjEnforceRangeShortAttrGetter): (WebCore::setJSTestObjEnforceRangeShortAttrSetter): (WebCore::jsTestObjUnsignedShortAttrGetter): (WebCore::setJSTestObjUnsignedShortAttrSetter): (WebCore::jsTestObjLongAttrGetter): (WebCore::setJSTestObjLongAttrSetter): (WebCore::jsTestObjLongLongAttrGetter): (WebCore::setJSTestObjLongLongAttrSetter): (WebCore::jsTestObjUnsignedLongLongAttrGetter): (WebCore::setJSTestObjUnsignedLongLongAttrSetter): (WebCore::jsTestObjStringAttrGetter): (WebCore::setJSTestObjStringAttrSetter): (WebCore::jsTestObjUsvstringAttrGetter): (WebCore::setJSTestObjUsvstringAttrSetter): (WebCore::jsTestObjTestObjAttrGetter): (WebCore::setJSTestObjTestObjAttrSetter): (WebCore::jsTestObjTestNullableObjAttrGetter): (WebCore::setJSTestObjTestNullableObjAttrSetter): (WebCore::jsTestObjLenientTestObjAttrGetter): (WebCore::setJSTestObjLenientTestObjAttrSetter): (WebCore::jsTestObjUnforgeableAttrGetter): (WebCore::jsTestObjStringAttrTreatingNullAsEmptyStringGetter): (WebCore::setJSTestObjStringAttrTreatingNullAsEmptyStringSetter): (WebCore::jsTestObjUsvstringAttrTreatingNullAsEmptyStringGetter): (WebCore::setJSTestObjUsvstringAttrTreatingNullAsEmptyStringSetter): (WebCore::jsTestObjByteStringAttrTreatingNullAsEmptyStringGetter): (WebCore::setJSTestObjByteStringAttrTreatingNullAsEmptyStringSetter): (WebCore::jsTestObjStringLongRecordAttrGetter): (WebCore::setJSTestObjStringLongRecordAttrSetter): (WebCore::jsTestObjUsvstringLongRecordAttrGetter): (WebCore::setJSTestObjUsvstringLongRecordAttrSetter): (WebCore::jsTestObjStringObjRecordAttrGetter): (WebCore::setJSTestObjStringObjRecordAttrSetter): (WebCore::jsTestObjStringNullableObjRecordAttrGetter): (WebCore::setJSTestObjStringNullableObjRecordAttrSetter): (WebCore::jsTestObjStringVoidCallbackRecordAttrGetter): (WebCore::setJSTestObjStringVoidCallbackRecordAttrSetter): (WebCore::jsTestObjDictionaryAttrGetter): (WebCore::setJSTestObjDictionaryAttrSetter): (WebCore::jsTestObjNullableDictionaryAttrGetter): (WebCore::setJSTestObjNullableDictionaryAttrSetter): (WebCore::jsTestObjAnnotatedTypeInUnionAttrGetter): (WebCore::setJSTestObjAnnotatedTypeInUnionAttrSetter): (WebCore::jsTestObjAnnotatedTypeInSequenceAttrGetter): (WebCore::setJSTestObjAnnotatedTypeInSequenceAttrSetter): (WebCore::jsTestObjImplementationEnumAttrGetter): (WebCore::setJSTestObjImplementationEnumAttrSetter): (WebCore::jsTestObjMediaDevicesGetter): (WebCore::jsTestObjXMLObjAttrGetter): (WebCore::setJSTestObjXMLObjAttrSetter): (WebCore::jsTestObjCreateGetter): (WebCore::setJSTestObjCreateSetter): (WebCore::jsTestObjReflectedStringAttrGetter): (WebCore::setJSTestObjReflectedStringAttrSetter): (WebCore::jsTestObjReflectedUSVStringAttrGetter): (WebCore::setJSTestObjReflectedUSVStringAttrSetter): (WebCore::jsTestObjReflectedIntegralAttrGetter): (WebCore::setJSTestObjReflectedIntegralAttrSetter): (WebCore::jsTestObjReflectedUnsignedIntegralAttrGetter): (WebCore::setJSTestObjReflectedUnsignedIntegralAttrSetter): (WebCore::jsTestObjReflectedBooleanAttrGetter): (WebCore::setJSTestObjReflectedBooleanAttrSetter): (WebCore::jsTestObjReflectedURLAttrGetter): (WebCore::setJSTestObjReflectedURLAttrSetter): (WebCore::jsTestObjReflectedUSVURLAttrGetter): (WebCore::setJSTestObjReflectedUSVURLAttrSetter): (WebCore::jsTestObjReflectedCustomIntegralAttrGetter): (WebCore::setJSTestObjReflectedCustomIntegralAttrSetter): (WebCore::jsTestObjReflectedCustomBooleanAttrGetter): (WebCore::setJSTestObjReflectedCustomBooleanAttrSetter): (WebCore::jsTestObjReflectedCustomURLAttrGetter): (WebCore::setJSTestObjReflectedCustomURLAttrSetter): (WebCore::jsTestObjEnabledAtRuntimeAttributeGetter): (WebCore::setJSTestObjEnabledAtRuntimeAttributeSetter): (WebCore::jsTestObjConstructorEnabledAtRuntimeAttributeStaticGetter): (WebCore::setJSTestObjConstructorEnabledAtRuntimeAttributeStaticSetter): (WebCore::jsTestObjTypedArrayAttrGetter): (WebCore::setJSTestObjTypedArrayAttrSetter): (WebCore::jsTestObjCustomAttrGetter): (WebCore::setJSTestObjCustomAttrSetter): (WebCore::jsTestObjOnfooGetter): (WebCore::setJSTestObjOnfooSetter): (WebCore::jsTestObjOnwebkitfooGetter): (WebCore::setJSTestObjOnwebkitfooSetter): (WebCore::jsTestObjWithExecStateAttributeGetter): (WebCore::setJSTestObjWithExecStateAttributeSetter): (WebCore::jsTestObjWithCallWithAndSetterCallWithAttributeGetter): (WebCore::setJSTestObjWithCallWithAndSetterCallWithAttributeSetter): (WebCore::jsTestObjWithScriptExecutionContextAttributeGetter): (WebCore::setJSTestObjWithScriptExecutionContextAttributeSetter): (WebCore::jsTestObjWithScriptExecutionContextAndExecStateAttributeGetter): (WebCore::setJSTestObjWithScriptExecutionContextAndExecStateAttributeSetter): (WebCore::jsTestObjWithScriptExecutionContextAndExecStateWithSpacesAttributeGetter): (WebCore::setJSTestObjWithScriptExecutionContextAndExecStateWithSpacesAttributeSetter): (WebCore::jsTestObjConditionalAttr1Getter): (WebCore::setJSTestObjConditionalAttr1Setter): (WebCore::jsTestObjConditionalAttr2Getter): (WebCore::setJSTestObjConditionalAttr2Setter): (WebCore::jsTestObjConditionalAttr3Getter): (WebCore::setJSTestObjConditionalAttr3Setter): (WebCore::jsTestObjConditionalAttr4ConstructorGetter): (WebCore::setJSTestObjConditionalAttr4ConstructorSetter): (WebCore::jsTestObjConditionalAttr5ConstructorGetter): (WebCore::setJSTestObjConditionalAttr5ConstructorSetter): (WebCore::jsTestObjConditionalAttr6ConstructorGetter): (WebCore::setJSTestObjConditionalAttr6ConstructorSetter): (WebCore::jsTestObjCachedAttribute1Getter): (WebCore::jsTestObjCachedAttribute2Getter): (WebCore::jsTestObjCachedAttribute3Getter): (WebCore::jsTestObjAnyAttributeGetter): (WebCore::setJSTestObjAnyAttributeSetter): (WebCore::jsTestObjObjectAttributeGetter): (WebCore::setJSTestObjObjectAttributeSetter): (WebCore::jsTestObjContentDocumentGetter): (WebCore::jsTestObjMutablePointGetter): (WebCore::setJSTestObjMutablePointSetter): (WebCore::jsTestObjStrawberryGetter): (WebCore::setJSTestObjStrawberrySetter): (WebCore::jsTestObjDescriptionGetter): (WebCore::jsTestObjIdGetter): (WebCore::setJSTestObjIdSetter): (WebCore::jsTestObjHashGetter): (WebCore::jsTestObjReplaceableAttributeGetter): (WebCore::setJSTestObjReplaceableAttributeSetter): (WebCore::jsTestObjNullableDoubleAttributeGetter): (WebCore::jsTestObjNullableLongAttributeGetter): (WebCore::jsTestObjNullableBooleanAttributeGetter): (WebCore::jsTestObjNullableStringAttributeGetter): (WebCore::jsTestObjNullableLongSettableAttributeGetter): (WebCore::setJSTestObjNullableLongSettableAttributeSetter): (WebCore::jsTestObjNullableStringSettableAttributeGetter): (WebCore::setJSTestObjNullableStringSettableAttributeSetter): (WebCore::jsTestObjNullableUSVStringSettableAttributeGetter): (WebCore::setJSTestObjNullableUSVStringSettableAttributeSetter): (WebCore::jsTestObjNullableByteStringSettableAttributeGetter): (WebCore::setJSTestObjNullableByteStringSettableAttributeSetter): (WebCore::jsTestObjAttributeGetter): (WebCore::jsTestObjAttributeWithReservedEnumTypeGetter): (WebCore::setJSTestObjAttributeWithReservedEnumTypeSetter): (WebCore::jsTestObjTestReadOnlyVoidPromiseAttributeGetter): (WebCore::jsTestObjTestReadOnlyPromiseAttributeGetter): (WebCore::jsTestObjPutForwardsAttributeGetter): (WebCore::setJSTestObjPutForwardsAttributeSetter): (WebCore::jsTestObjPutForwardsNullableAttributeGetter): (WebCore::setJSTestObjPutForwardsNullableAttributeSetter): (WebCore::jsTestObjStringifierAttributeGetter): (WebCore::setJSTestObjStringifierAttributeSetter): (WebCore::jsTestObjConditionallyReadWriteAttributeGetter): (WebCore::setJSTestObjConditionallyReadWriteAttributeSetter): (WebCore::jsTestObjConditionalAndConditionallyReadWriteAttributeGetter): (WebCore::setJSTestObjConditionalAndConditionallyReadWriteAttributeSetter): (WebCore::jsTestObjRuntimeConditionallyReadWriteAttributeGetter): (WebCore::setJSTestObjRuntimeConditionallyReadWriteAttributeSetter): (WebCore::jsTestObjRuntimeConditionallyReadWriteAttributeUnforgeableGetter): (WebCore::setJSTestObjRuntimeConditionallyReadWriteAttributeUnforgeableSetter): (WebCore::jsTestObjRuntimeConditionallyReadWriteAttributeUnforgeablePrivateGetter): (WebCore::setJSTestObjRuntimeConditionallyReadWriteAttributeUnforgeablePrivateSetter): (WebCore::jsTestObjRuntimeConditionallyReadWriteAttributePromiseGetter): (WebCore::setJSTestObjRuntimeConditionallyReadWriteAttributePromiseSetter): (WebCore::jsTestObjConditionallyExposedToWindowAttributeGetter): (WebCore::setJSTestObjConditionallyExposedToWindowAttributeSetter): (WebCore::jsTestObjConditionallyExposedToWorkerAttributeGetter): (WebCore::setJSTestObjConditionallyExposedToWorkerAttributeSetter): (WebCore::jsTestObjConditionallyExposedToWindowAndWorkerAttributeGetter): (WebCore::setJSTestObjConditionallyExposedToWindowAndWorkerAttributeSetter): (WebCore::jsTestObjPrototypeFunctionEnabledAtRuntimeOperation1Body): (WebCore::jsTestObjPrototypeFunctionEnabledAtRuntimeOperation2Body): (WebCore::jsTestObjPrototypeFunctionEnabledAtRuntimeOperationOverloadDispatcher): (WebCore::jsTestObjConstructorFunctionEnabledAtRuntimeOperationStaticBody): (WebCore::jsTestObjPrototypeFunctionEnabledInSpecificWorldWhenRuntimeFeatureEnabledBody): (WebCore::jsTestObjPrototypeFunctionWorldSpecificMethodBody): (WebCore::jsTestObjPrototypeFunctionCalculateSecretResultBody): (WebCore::jsTestObjPrototypeFunctionGetSecretBooleanBody): (WebCore::jsTestObjPrototypeFunctionTestFeatureGetSecretBooleanBody): (WebCore::jsTestObjPrototypeFunctionVoidMethodBody): (WebCore::jsTestObjPrototypeFunctionVoidMethodWithArgsBody): (WebCore::jsTestObjPrototypeFunctionByteMethodBody): (WebCore::jsTestObjPrototypeFunctionByteMethodWithArgsBody): (WebCore::jsTestObjPrototypeFunctionOctetMethodBody): (WebCore::jsTestObjPrototypeFunctionOctetMethodWithArgsBody): (WebCore::jsTestObjPrototypeFunctionLongMethodBody): (WebCore::jsTestObjPrototypeFunctionLongMethodWithArgsBody): (WebCore::jsTestObjPrototypeFunctionObjMethodBody): (WebCore::jsTestObjPrototypeFunctionObjMethodWithArgsBody): (WebCore::jsTestObjInstanceFunctionUnforgeableMethodBody): (WebCore::jsTestObjPrototypeFunctionMethodWithArgTreatingNullAsEmptyStringBody): (WebCore::jsTestObjPrototypeFunctionMethodWithXPathNSResolverParameterBody): (WebCore::jsTestObjPrototypeFunctionNullableStringMethodBody): (WebCore::jsTestObjConstructorFunctionNullableStringStaticMethodBody): (WebCore::jsTestObjPrototypeFunctionNullableStringSpecialMethodBody): (WebCore::jsTestObjPrototypeFunctionMethodWithEnumArgBody): (WebCore::jsTestObjPrototypeFunctionMethodWithStandaloneEnumArgBody): (WebCore::jsTestObjPrototypeFunctionMethodWithOptionalEnumArgBody): (WebCore::jsTestObjPrototypeFunctionMethodWithOptionalEnumArgAndDefaultValueBody): (WebCore::jsTestObjPrototypeFunctionMethodThatRequiresAllArgsAndThrowsBody): (WebCore::jsTestObjPrototypeFunctionMethodWithUSVStringArgBody): (WebCore::jsTestObjPrototypeFunctionMethodWithNullableUSVStringArgBody): (WebCore::jsTestObjPrototypeFunctionMethodWithUSVStringArgTreatingNullAsEmptyStringBody): (WebCore::jsTestObjPrototypeFunctionMethodWithByteStringArgBody): (WebCore::jsTestObjPrototypeFunctionMethodWithNullableByteStringArgBody): (WebCore::jsTestObjPrototypeFunctionMethodWithByteStringArgTreatingNullAsEmptyStringBody): (WebCore::jsTestObjPrototypeFunctionSerializedValueBody): (WebCore::jsTestObjPrototypeFunctionMethodWithRecordBody): (WebCore::jsTestObjPrototypeFunctionMethodWithExceptionBody): (WebCore::jsTestObjPrototypeFunctionMethodWithExceptionReturningLongBody): (WebCore::jsTestObjPrototypeFunctionMethodWithExceptionReturningObjectBody): (WebCore::jsTestObjPrototypeFunctionCustomMethodBody): (WebCore::jsTestObjPrototypeFunctionCustomMethodWithArgsBody): (WebCore::jsTestObjPrototypeFunctionPrivateMethodBody): (WebCore::jsTestObjPrototypeFunctionPublicAndPrivateMethodBody): (WebCore::jsTestObjPrototypeFunctionAddEventListenerBody): (WebCore::jsTestObjPrototypeFunctionRemoveEventListenerBody): (WebCore::jsTestObjPrototypeFunctionWithExecStateVoidBody): (WebCore::jsTestObjPrototypeFunctionWithExecStateObjBody): (WebCore::jsTestObjPrototypeFunctionWithExecStateVoidExceptionBody): (WebCore::jsTestObjPrototypeFunctionWithExecStateObjExceptionBody): (WebCore::jsTestObjPrototypeFunctionWithScriptExecutionContextBody): (WebCore::jsTestObjPrototypeFunctionWithScriptExecutionContextAndExecStateBody): (WebCore::jsTestObjPrototypeFunctionWithScriptExecutionContextAndExecStateObjExceptionBody): (WebCore::jsTestObjPrototypeFunctionWithScriptExecutionContextAndExecStateWithSpacesBody): (WebCore::jsTestObjPrototypeFunctionWithDocumentArgumentBody): (WebCore::jsTestObjPrototypeFunctionWithCallerDocumentArgumentBody): (WebCore::jsTestObjPrototypeFunctionWithCallerWindowArgumentBody): (WebCore::jsTestObjPrototypeFunctionMethodWithOptionalArgBody): (WebCore::jsTestObjPrototypeFunctionMethodWithOptionalArgAndDefaultValueBody): (WebCore::jsTestObjPrototypeFunctionMethodWithNonOptionalArgAndOptionalArgBody): (WebCore::jsTestObjPrototypeFunctionMethodWithNonOptionalArgAndTwoOptionalArgsBody): (WebCore::jsTestObjPrototypeFunctionMethodWithOptionalStringBody): (WebCore::jsTestObjPrototypeFunctionMethodWithOptionalUSVStringBody): (WebCore::jsTestObjPrototypeFunctionMethodWithOptionalAtomStringBody): (WebCore::jsTestObjPrototypeFunctionMethodWithOptionalStringAndDefaultValueBody): (WebCore::jsTestObjPrototypeFunctionMethodWithOptionalAtomStringAndDefaultValueBody): (WebCore::jsTestObjPrototypeFunctionMethodWithOptionalStringIsNullBody): (WebCore::jsTestObjPrototypeFunctionMethodWithOptionalStringIsUndefinedBody): (WebCore::jsTestObjPrototypeFunctionMethodWithOptionalAtomStringIsNullBody): (WebCore::jsTestObjPrototypeFunctionMethodWithOptionalStringIsEmptyStringBody): (WebCore::jsTestObjPrototypeFunctionMethodWithOptionalUSVStringIsEmptyStringBody): (WebCore::jsTestObjPrototypeFunctionMethodWithOptionalAtomStringIsEmptyStringBody): (WebCore::jsTestObjPrototypeFunctionMethodWithOptionalDoubleIsNaNBody): (WebCore::jsTestObjPrototypeFunctionMethodWithOptionalFloatIsNaNBody): (WebCore::jsTestObjPrototypeFunctionMethodWithOptionalLongLongBody): (WebCore::jsTestObjPrototypeFunctionMethodWithOptionalLongLongIsZeroBody): (WebCore::jsTestObjPrototypeFunctionMethodWithOptionalUnsignedLongLongBody): (WebCore::jsTestObjPrototypeFunctionMethodWithOptionalUnsignedLongLongIsZeroBody): (WebCore::jsTestObjPrototypeFunctionMethodWithOptionalSequenceBody): (WebCore::jsTestObjPrototypeFunctionMethodWithOptionalSequenceIsEmptyBody): (WebCore::jsTestObjPrototypeFunctionMethodWithOptionalBooleanBody): (WebCore::jsTestObjPrototypeFunctionMethodWithOptionalBooleanIsFalseBody): (WebCore::jsTestObjPrototypeFunctionMethodWithOptionalAnyBody): (WebCore::jsTestObjPrototypeFunctionMethodWithOptionalObjectBody): (WebCore::jsTestObjPrototypeFunctionMethodWithOptionalNullableWrapperBody): (WebCore::jsTestObjPrototypeFunctionMethodWithOptionalNullableWrapperIsNullBody): (WebCore::jsTestObjPrototypeFunctionMethodWithOptionalXPathNSResolverBody): (WebCore::jsTestObjPrototypeFunctionMethodWithOptionalRecordBody): (WebCore::jsTestObjPrototypeFunctionMethodWithOptionalPromiseBody): (WebCore::jsTestObjPrototypeFunctionMethodWithCallbackArgBody): (WebCore::jsTestObjPrototypeFunctionMethodWithNonCallbackArgAndCallbackArgBody): (WebCore::jsTestObjPrototypeFunctionMethodWithCallbackAndOptionalArgBody): (WebCore::jsTestObjPrototypeFunctionMethodWithCallbackFunctionArgBody): (WebCore::jsTestObjPrototypeFunctionMethodWithNonCallbackArgAndCallbackFunctionArgBody): (WebCore::jsTestObjPrototypeFunctionMethodWithCallbackFunctionAndOptionalArgBody): (WebCore::jsTestObjConstructorFunctionStaticMethodWithCallbackAndOptionalArgBody): (WebCore::jsTestObjConstructorFunctionStaticMethodWithCallbackArgBody): (WebCore::jsTestObjPrototypeFunctionConditionalMethod1Body): (WebCore::jsTestObjPrototypeFunctionConditionalMethod2Body): (WebCore::jsTestObjPrototypeFunctionConditionalMethod3Body): (WebCore::jsTestObjPrototypeFunctionOverloadedMethod1Body): (WebCore::jsTestObjPrototypeFunctionOverloadedMethod2Body): (WebCore::jsTestObjPrototypeFunctionOverloadedMethod3Body): (WebCore::jsTestObjPrototypeFunctionOverloadedMethod4Body): (WebCore::jsTestObjPrototypeFunctionOverloadedMethod5Body): (WebCore::jsTestObjPrototypeFunctionOverloadedMethod6Body): (WebCore::jsTestObjPrototypeFunctionOverloadedMethod7Body): (WebCore::jsTestObjPrototypeFunctionOverloadedMethod8Body): (WebCore::jsTestObjPrototypeFunctionOverloadedMethod9Body): (WebCore::jsTestObjPrototypeFunctionOverloadedMethod10Body): (WebCore::jsTestObjPrototypeFunctionOverloadedMethod11Body): (WebCore::jsTestObjPrototypeFunctionOverloadedMethod12Body): (WebCore::jsTestObjPrototypeFunctionOverloadedMethod13Body): (WebCore::jsTestObjPrototypeFunctionOverloadedMethodOverloadDispatcher): (WebCore::jsTestObjPrototypeFunctionOverloadedMethodWithOptionalParameter1Body): (WebCore::jsTestObjPrototypeFunctionOverloadedMethodWithOptionalParameter2Body): (WebCore::jsTestObjPrototypeFunctionOverloadedMethodWithOptionalParameterOverloadDispatcher): (WebCore::jsTestObjPrototypeFunctionOverloadedMethodWithDistinguishingUnion1Body): (WebCore::jsTestObjPrototypeFunctionOverloadedMethodWithDistinguishingUnion2Body): (WebCore::jsTestObjPrototypeFunctionOverloadedMethodWithDistinguishingUnionOverloadDispatcher): (WebCore::jsTestObjPrototypeFunctionOverloadedMethodWith2DistinguishingUnions1Body): (WebCore::jsTestObjPrototypeFunctionOverloadedMethodWith2DistinguishingUnions2Body): (WebCore::jsTestObjPrototypeFunctionOverloadedMethodWith2DistinguishingUnionsOverloadDispatcher): (WebCore::jsTestObjPrototypeFunctionOverloadedMethodWithNonDistinguishingUnion1Body): (WebCore::jsTestObjPrototypeFunctionOverloadedMethodWithNonDistinguishingUnion2Body): (WebCore::jsTestObjPrototypeFunctionOverloadedMethodWithNonDistinguishingUnionOverloadDispatcher): (WebCore::jsTestObjPrototypeFunctionOverloadWithNullableUnion1Body): (WebCore::jsTestObjPrototypeFunctionOverloadWithNullableUnion2Body): (WebCore::jsTestObjPrototypeFunctionOverloadWithNullableUnionOverloadDispatcher): (WebCore::jsTestObjPrototypeFunctionOverloadWithOptionalUnion1Body): (WebCore::jsTestObjPrototypeFunctionOverloadWithOptionalUnion2Body): (WebCore::jsTestObjPrototypeFunctionOverloadWithOptionalUnionOverloadDispatcher): (WebCore::jsTestObjPrototypeFunctionOverloadWithNullableNonDistinguishingParameter1Body): (WebCore::jsTestObjPrototypeFunctionOverloadWithNullableNonDistinguishingParameter2Body): (WebCore::jsTestObjPrototypeFunctionOverloadWithNullableNonDistinguishingParameterOverloadDispatcher): (WebCore::jsTestObjConstructorFunctionClassMethodBody): (WebCore::jsTestObjConstructorFunctionClassMethodWithOptionalBody): (WebCore::jsTestObjConstructorFunctionClassMethod2Body): (WebCore::jsTestObjConstructorFunctionOverloadedMethod11Body): (WebCore::jsTestObjConstructorFunctionOverloadedMethod12Body): (WebCore::jsTestObjConstructorFunctionOverloadedMethod1OverloadDispatcher): (WebCore::jsTestObjPrototypeFunctionClassMethodWithClampBody): (WebCore::jsTestObjPrototypeFunctionClassMethodWithClampOnOptionalBody): (WebCore::jsTestObjPrototypeFunctionClassMethodWithEnforceRangeBody): (WebCore::jsTestObjPrototypeFunctionClassMethodWithEnforceRangeOnOptionalBody): (WebCore::jsTestObjPrototypeFunctionMethodWithUnsignedLongSequenceBody): (WebCore::jsTestObjPrototypeFunctionStringArrayFunctionBody): (WebCore::jsTestObjPrototypeFunctionDomStringListFunctionBody): (WebCore::jsTestObjPrototypeFunctionOperationWithOptionalUnionParameterBody): (WebCore::jsTestObjPrototypeFunctionMethodWithAndWithoutNullableSequenceBody): (WebCore::jsTestObjPrototypeFunctionGetElementByIdBody): (WebCore::jsTestObjPrototypeFunctionGetSVGDocumentBody): (WebCore::jsTestObjPrototypeFunctionConvert1Body): (WebCore::jsTestObjPrototypeFunctionConvert2Body): (WebCore::jsTestObjPrototypeFunctionConvert3Body): (WebCore::jsTestObjPrototypeFunctionConvert4Body): (WebCore::jsTestObjPrototypeFunctionMutablePointFunctionBody): (WebCore::jsTestObjPrototypeFunctionOrangeBody): (WebCore::jsTestObjPrototypeFunctionVariadicStringMethodBody): (WebCore::jsTestObjPrototypeFunctionVariadicDoubleMethodBody): (WebCore::jsTestObjPrototypeFunctionVariadicNodeMethodBody): (WebCore::jsTestObjPrototypeFunctionVariadicUnionMethodBody): (WebCore::jsTestObjPrototypeFunctionAnyBody): (WebCore::jsTestObjPrototypeFunctionTestPromiseFunctionBody): (WebCore::jsTestObjPrototypeFunctionTestPromiseFunctionWithFloatArgumentBody): (WebCore::jsTestObjPrototypeFunctionTestPromiseFunctionWithExceptionBody): (WebCore::jsTestObjPrototypeFunctionTestPromiseFunctionWithOptionalIntArgumentBody): (WebCore::jsTestObjPrototypeFunctionTestPromiseOverloadedFunction1Body): (WebCore::jsTestObjPrototypeFunctionTestPromiseOverloadedFunction2Body): (WebCore::jsTestObjPrototypeFunctionTestPromiseOverloadedFunctionOverloadDispatcher): (WebCore::jsTestObjConstructorFunctionTestStaticPromiseFunctionBody): (WebCore::jsTestObjConstructorFunctionTestStaticPromiseFunctionWithExceptionBody): (WebCore::jsTestObjPrototypeFunctionTestCustomPromiseFunctionBody): (WebCore::jsTestObjConstructorFunctionTestStaticCustomPromiseFunctionBody): (WebCore::jsTestObjPrototypeFunctionTestCustomReturnsOwnPromiseFunctionBody): (WebCore::jsTestObjPrototypeFunctionTestReturnsOwnPromiseAndPromiseProxyFunctionBody): (WebCore::jsTestObjPrototypeFunctionConditionalOverload1Body): (WebCore::jsTestObjPrototypeFunctionConditionalOverload2Body): (WebCore::jsTestObjPrototypeFunctionConditionalOverloadOverloadDispatcher): (WebCore::jsTestObjPrototypeFunctionSingleConditionalOverload1Body): (WebCore::jsTestObjPrototypeFunctionSingleConditionalOverload2Body): (WebCore::jsTestObjPrototypeFunctionSingleConditionalOverloadOverloadDispatcher): (WebCore::jsTestObjPrototypeFunctionAttachShadowRootBody): (WebCore::jsTestObjPrototypeFunctionOperationWithExternalDictionaryParameterBody): (WebCore::jsTestObjPrototypeFunctionBufferSourceParameterBody): (WebCore::jsTestObjPrototypeFunctionLegacyCallerNamedBody): (WebCore::jsTestObjPrototypeFunctionTestReturnValueOptimizationBody): (WebCore::jsTestObjPrototypeFunctionTestReturnValueOptimizationWithExceptionBody): (WebCore::jsTestObjPrototypeFunctionConditionallyExposedToWindowFunctionBody): (WebCore::jsTestObjPrototypeFunctionConditionallyExposedToWorkerFunctionBody): (WebCore::jsTestObjPrototypeFunctionConditionallyExposedToWindowAndWorkerFunctionBody): (WebCore::jsTestObjPrototypeFunctionToStringBody): (WebCore::JSTestObj::serialize): (WebCore::jsTestObjPrototypeFunctionToJSONBody): * bindings/scripts/test/JS/JSTestObj.h: * bindings/scripts/test/JS/JSTestOperationConditional.cpp: (WebCore::jsTestOperationConditionalPrototypeFunctionNonConditionalOperationBody): (WebCore::jsTestOperationConditionalPrototypeFunctionConditionalOperationBody): * bindings/scripts/test/JS/JSTestOverrideBuiltins.cpp: (WebCore::jsTestOverrideBuiltinsPrototypeFunctionNamedItemBody): * bindings/scripts/test/JS/JSTestPromiseRejectionEvent.cpp: (WebCore::jsTestPromiseRejectionEventPromiseGetter): (WebCore::jsTestPromiseRejectionEventReasonGetter): * bindings/scripts/test/JS/JSTestSerialization.cpp: (WebCore::jsTestSerializationFirstStringAttributeGetter): (WebCore::setJSTestSerializationFirstStringAttributeSetter): (WebCore::jsTestSerializationSecondLongAttributeGetter): (WebCore::setJSTestSerializationSecondLongAttributeSetter): (WebCore::jsTestSerializationThirdUnserializableAttributeGetter): (WebCore::setJSTestSerializationThirdUnserializableAttributeSetter): (WebCore::jsTestSerializationFourthUnrestrictedDoubleAttributeGetter): (WebCore::setJSTestSerializationFourthUnrestrictedDoubleAttributeSetter): (WebCore::jsTestSerializationFifthLongAttributeGetter): (WebCore::setJSTestSerializationFifthLongAttributeSetter): (WebCore::jsTestSerializationSixthTypedefAttributeGetter): (WebCore::setJSTestSerializationSixthTypedefAttributeSetter): (WebCore::jsTestSerializationSeventhDirectlySerializableAttributeGetter): (WebCore::setJSTestSerializationSeventhDirectlySerializableAttributeSetter): (WebCore::jsTestSerializationEighthIndirectlyAttributeGetter): (WebCore::setJSTestSerializationEighthIndirectlyAttributeSetter): (WebCore::jsTestSerializationNinthOptionalDirectlySerializableAttributeGetter): (WebCore::setJSTestSerializationNinthOptionalDirectlySerializableAttributeSetter): (WebCore::jsTestSerializationTenthFrozenArrayAttributeGetter): (WebCore::setJSTestSerializationTenthFrozenArrayAttributeSetter): (WebCore::jsTestSerializationEleventhSequenceAttributeGetter): (WebCore::setJSTestSerializationEleventhSequenceAttributeSetter): (WebCore::jsTestSerializationTwelfthInterfaceSequenceAttributeGetter): (WebCore::setJSTestSerializationTwelfthInterfaceSequenceAttributeSetter): (WebCore::JSTestSerialization::serialize): (WebCore::jsTestSerializationPrototypeFunctionToJSONBody): * bindings/scripts/test/JS/JSTestSerialization.h: * bindings/scripts/test/JS/JSTestSerializationInherit.cpp: (WebCore::jsTestSerializationInheritInheritLongAttributeGetter): (WebCore::setJSTestSerializationInheritInheritLongAttributeSetter): (WebCore::JSTestSerializationInherit::serialize): (WebCore::jsTestSerializationInheritPrototypeFunctionToJSONBody): * bindings/scripts/test/JS/JSTestSerializationInherit.h: * bindings/scripts/test/JS/JSTestSerializationInheritFinal.cpp: (WebCore::jsTestSerializationInheritFinalFinalLongAttributeFooGetter): (WebCore::setJSTestSerializationInheritFinalFinalLongAttributeFooSetter): (WebCore::jsTestSerializationInheritFinalFinalLongAttributeBarGetter): (WebCore::setJSTestSerializationInheritFinalFinalLongAttributeBarSetter): (WebCore::JSTestSerializationInheritFinal::serialize): (WebCore::jsTestSerializationInheritFinalPrototypeFunctionToJSONBody): * bindings/scripts/test/JS/JSTestSerializationInheritFinal.h: * bindings/scripts/test/JS/JSTestSerializedScriptValueInterface.cpp: (WebCore::jsTestSerializedScriptValueInterfaceValueGetter): (WebCore::setJSTestSerializedScriptValueInterfaceValueSetter): (WebCore::jsTestSerializedScriptValueInterfaceReadonlyValueGetter): (WebCore::jsTestSerializedScriptValueInterfaceCachedValueGetter): (WebCore::setJSTestSerializedScriptValueInterfaceCachedValueSetter): (WebCore::jsTestSerializedScriptValueInterfacePortsGetter): (WebCore::jsTestSerializedScriptValueInterfaceCachedReadonlyValueGetter): (WebCore::jsTestSerializedScriptValueInterfacePrototypeFunctionFunctionBody): (WebCore::jsTestSerializedScriptValueInterfacePrototypeFunctionFunctionReturningBody): * bindings/scripts/test/JS/JSTestStringifier.cpp: (WebCore::jsTestStringifierPrototypeFunctionToStringBody): * bindings/scripts/test/JS/JSTestStringifierAnonymousOperation.cpp: (WebCore::jsTestStringifierAnonymousOperationPrototypeFunctionToStringBody): * bindings/scripts/test/JS/JSTestStringifierNamedOperation.cpp: (WebCore::jsTestStringifierNamedOperationPrototypeFunctionIdentifierBody): (WebCore::jsTestStringifierNamedOperationPrototypeFunctionToStringBody): * bindings/scripts/test/JS/JSTestStringifierOperationImplementedAs.cpp: (WebCore::jsTestStringifierOperationImplementedAsPrototypeFunctionIdentifierBody): (WebCore::jsTestStringifierOperationImplementedAsPrototypeFunctionToStringBody): * bindings/scripts/test/JS/JSTestStringifierOperationNamedToString.cpp: (WebCore::jsTestStringifierOperationNamedToStringPrototypeFunctionToStringBody): * bindings/scripts/test/JS/JSTestStringifierReadOnlyAttribute.cpp: (WebCore::jsTestStringifierReadOnlyAttributeIdentifierGetter): (WebCore::jsTestStringifierReadOnlyAttributePrototypeFunctionToStringBody): * bindings/scripts/test/JS/JSTestStringifierReadWriteAttribute.cpp: (WebCore::jsTestStringifierReadWriteAttributeIdentifierGetter): (WebCore::setJSTestStringifierReadWriteAttributeIdentifierSetter): (WebCore::jsTestStringifierReadWriteAttributePrototypeFunctionToStringBody): * bindings/scripts/test/JS/JSTestTypedefs.cpp: (WebCore::jsTestTypedefsUnsignedLongLongAttrGetter): (WebCore::setJSTestTypedefsUnsignedLongLongAttrSetter): (WebCore::jsTestTypedefsSerializedScriptValueGetter): (WebCore::setJSTestTypedefsSerializedScriptValueSetter): (WebCore::jsTestTypedefsConstructorTestSubObjGetter): (WebCore::jsTestTypedefsAttributeWithClampGetter): (WebCore::setJSTestTypedefsAttributeWithClampSetter): (WebCore::jsTestTypedefsAttributeWithClampInTypedefGetter): (WebCore::setJSTestTypedefsAttributeWithClampInTypedefSetter): (WebCore::jsTestTypedefsBufferSourceAttrGetter): (WebCore::setJSTestTypedefsBufferSourceAttrSetter): (WebCore::jsTestTypedefsDomTimeStampAttrGetter): (WebCore::setJSTestTypedefsDomTimeStampAttrSetter): (WebCore::jsTestTypedefsPrototypeFunctionFuncBody): (WebCore::jsTestTypedefsPrototypeFunctionSetShadowBody): (WebCore::jsTestTypedefsPrototypeFunctionMethodWithSequenceArgBody): (WebCore::jsTestTypedefsPrototypeFunctionNullableSequenceArgBody): (WebCore::jsTestTypedefsPrototypeFunctionSequenceOfNullablesArgBody): (WebCore::jsTestTypedefsPrototypeFunctionNullableSequenceOfNullablesArgBody): (WebCore::jsTestTypedefsPrototypeFunctionNullableSequenceOfUnionsArgBody): (WebCore::jsTestTypedefsPrototypeFunctionUnionArgBody): (WebCore::jsTestTypedefsPrototypeFunctionFuncWithClampBody): (WebCore::jsTestTypedefsPrototypeFunctionFuncWithClampInTypedefBody): (WebCore::jsTestTypedefsPrototypeFunctionPointFunctionBody): (WebCore::jsTestTypedefsPrototypeFunctionStringSequenceFunctionBody): (WebCore::jsTestTypedefsPrototypeFunctionStringSequenceFunction2Body): (WebCore::jsTestTypedefsPrototypeFunctionCallWithSequenceThatRequiresIncludeBody): (WebCore::jsTestTypedefsPrototypeFunctionMethodWithExceptionBody): 2020-07-24 Jiewen Tan <jiewen_tan@apple.com> Propagating user gesture through Fetch API https://bugs.webkit.org/show_bug.cgi?id=214444 <rdar://problem/65980953> Reviewed by Youenn Fablet. This patch propagates media only user gestures through Fetch API, including Fetch and FetchResponse. Covered by new test contents. * Modules/fetch/DOMWindowFetch.cpp: (WebCore::DOMWindowFetch::fetch): Propagates media only user gestures through Fetch. * Modules/fetch/FetchBodyConsumer.cpp: (WebCore::FetchBodyConsumer::clean): (WebCore::FetchBodyConsumer::resolve): (WebCore::FetchBodyConsumer::setConsumePromise): (WebCore::FetchBodyConsumer::resetConsumePromise): (WebCore::FetchBodyConsumer::loadingFailed): (WebCore::FetchBodyConsumer::loadingSucceeded): * Modules/fetch/FetchBodyConsumer.h: (WebCore::FetchBodyConsumer::setMaximumIntervalForUserGestureForwarding): (WebCore::FetchBodyConsumer::FetchBodyConsumer): Propagates media only user gestures through FetchResponse. UserGestureIndicator is only set in the async promise resolving path. * WebCore.xcodeproj/project.pbxproj: * bindings/js/JSDOMWindowBase.cpp: (WebCore::JSDOMWindowBase::queueMicrotaskToEventLoop): Propagates media only user gestures that was propagated through Fetch to the related promise executors. * dom/UserGestureIndicator.cpp: (WebCore::UserGestureIndicator::UserGestureIndicator): (WebCore::UserGestureIndicator::~UserGestureIndicator): * dom/UserGestureIndicator.h: (WebCore::UserGestureToken::setIsPropagatedFromFetch): (WebCore::UserGestureToken::resetIsPropagatedFromFetch): (WebCore::UserGestureToken::isPropagatedFromFetch const): Adds a flag to indicate the propagation source of a user gesture token. And makes pipelines from testing. * page/DOMTimer.cpp: (WebCore::DOMTimer::fired): Gathers some constants. * testing/Internals.cpp: (WebCore::Internals::setFetchMaximumIntervalForUserGestureForwarding): * testing/Internals.h: * testing/Internals.idl: Crafts a way to pass the maximum interval from layout tests. * xml/XMLHttpRequest.cpp: (WebCore::XMLHttpRequest::XMLHttpRequest): Gathers some constants. 2020-07-24 Kenneth Russell <kbr@chromium.org> [WebGL2] Framebuffer and renderbuffer updates https://bugs.webkit.org/show_bug.cgi?id=126448 Reviewed by Dean Jackson. Implement, or finish implementing, the following WebGL 2.0 framebuffer and renderbuffer related APIs: framebufferTextureLayer getInternalformatParameter getRenderbufferParameter invalidateFramebuffer invalidateSubFramebuffer readBuffer renderbufferStorage renderbufferStorageMultisample Covered by existing WebGL 2.0 conformance tests. * html/canvas/WebGL2RenderingContext.cpp: (WebCore::WebGL2RenderingContext::initializeNewContext): (WebCore::WebGL2RenderingContext::validateTexFuncLayer): (WebCore::WebGL2RenderingContext::maxTextureLevelForTarget): (WebCore::WebGL2RenderingContext::blitFramebuffer): (WebCore::WebGL2RenderingContext::framebufferTextureLayer): (WebCore::WebGL2RenderingContext::getInternalformatParameter): (WebCore::WebGL2RenderingContext::invalidateFramebuffer): (WebCore::WebGL2RenderingContext::invalidateSubFramebuffer): (WebCore::WebGL2RenderingContext::renderbufferStorageMultisample): (WebCore::WebGL2RenderingContext::renderbufferStorageImpl): (WebCore::WebGL2RenderingContext::renderbufferStorageHelper): (WebCore::WebGL2RenderingContext::checkAndTranslateAttachments): (WebCore::WebGL2RenderingContext::renderbufferStorage): Deleted. * html/canvas/WebGL2RenderingContext.h: * html/canvas/WebGLFramebuffer.cpp: (WebCore::WebGLFramebuffer::setAttachmentForBoundFramebuffer): (WebCore::WebGLFramebuffer::attach): (WebCore::WebGLFramebuffer::removeAttachmentFromBoundFramebuffer): (WebCore::WebGLFramebuffer::setAttachmentInternal): (WebCore::WebGLFramebuffer::removeAttachmentInternal): * html/canvas/WebGLFramebuffer.h: * html/canvas/WebGLRenderingContext.cpp: (WebCore::WebGLRenderingContext::renderbufferStorage): Deleted. * html/canvas/WebGLRenderingContext.h: * html/canvas/WebGLRenderingContextBase.cpp: (WebCore::WebGLRenderingContextBase::framebufferRenderbuffer): (WebCore::WebGLRenderingContextBase::framebufferTexture2D): (WebCore::WebGLRenderingContextBase::getRenderbufferParameter): (WebCore::WebGLRenderingContextBase::renderbufferStorage): (WebCore::WebGLRenderingContextBase::renderbufferStorageImpl): (WebCore::WebGLRenderingContextBase::validateTexFuncLevel): (WebCore::WebGLRenderingContextBase::maxTextureLevelForTarget): (WebCore::WebGLRenderingContextBase::validateFramebufferFuncParameters): * html/canvas/WebGLRenderingContextBase.h: * platform/graphics/GraphicsContextGL.h: * platform/graphics/angle/GraphicsContextGLANGLE.cpp: (WebCore::GraphicsContextGLOpenGL::framebufferTextureLayer): (WebCore::GraphicsContextGLOpenGL::invalidateFramebuffer): (WebCore::GraphicsContextGLOpenGL::invalidateSubFramebuffer): * platform/graphics/opengl/GraphicsContextGLOpenGL.h: 2020-07-24 Jer Noble <jer.noble@apple.com> [Cocoa] Add PerformanceTest tool for measuring raw speed of a video decoder https://bugs.webkit.org/show_bug.cgi?id=214723 Reviewed by Darin Adler. Export classes used by the DecoderTest performance tool. Drive-by fix: allow the clients to enable or disable the hardware decoder for a given decompression session. * WebCore.xcodeproj/project.pbxproj: * platform/MediaSample.h: * platform/graphics/cocoa/SourceBufferParserWebM.h: * platform/graphics/cocoa/WebCoreDecompressionSession.h: * platform/graphics/cocoa/WebCoreDecompressionSession.mm: (WebCore::WebCoreDecompressionSession::ensureDecompressionSessionForSample): 2020-07-24 Youenn Fablet <youenn@apple.com> Monitor the case of a fetch event not able to register to the respondWith promise https://bugs.webkit.org/show_bug.cgi?id=214631 Reviewed by Alex Christensen. In some cases, the "Fetch event is destroyed" error is received. One possibility is that the fetch event is not able to register to its respondWith promise. Add a specific error message for that case. This is difficult to test as we would need to have a fetch event trying to register to the respondWith promise exactly at the time the service worker gets stopped. * bindings/js/JSDOMPromise.cpp: (WebCore::DOMPromise::whenSettled): (WebCore::DOMPromise::whenPromiseIsSettled): * bindings/js/JSDOMPromise.h: * workers/service/FetchEvent.cpp: (WebCore::FetchEvent::respondWith): Change from weakThis to makeRef. While this is not strictly needed since addExtendLifetimePromise ref the event while calling whenSettled, this is clearer and more robust. 2020-07-24 Youenn Fablet <youenn@apple.com> ASSERT(!m_peerConnection.isClosed()) on imported/w3c/web-platform-tests/webrtc/RTCPeerConnection-operations.https.html https://bugs.webkit.org/show_bug.cgi?id=214189 <rdar://problem/65343941> Reviewed by Eric Carlson. Covered by unskipped tests. * Modules/mediastream/PeerConnectionBackend.cpp: (WebCore::PeerConnectionBackend::addPendingTrackEvent): This can be called in case the connection is closed but should not be in case the connection is stopped. Update the ASSERT accordingly. 2020-07-24 Xabier Rodriguez Calvar <calvaris@igalia.com> [GStreamer] gst_buffer_unmap: assertion 'GST_IS_BUFFER (buffer)' failed https://bugs.webkit.org/show_bug.cgi?id=213364 Reviewed by Philippe Normand. The initial patch for this bug had good intentions but it failed in something basic and tests did not tackle the original issue. The problem was in that the destructor of the subclass was being called before the destructor of the superclass, hence the buffer was unreffed before unmapped. Now we finish what we started by adding an unmapEarly method that can be used as regular API if wanted and that it is used by the GstMappedOwnedBuffer destructor to instruct GstMappedBuffer superclass to actually unmap without having to wait for the destructor of the superclass to kick in. Tests: GStreamerTest::mappedOwnedBufferDestruction and GStreamerTest::mappedBufferValidityUnmapEarly API tests. * platform/graphics/gstreamer/GStreamerCommon.h: (WebCore::GstMappedBuffer::~GstMappedBuffer): (WebCore::GstMappedBuffer::unmapEarly): (WebCore::GstMappedOwnedBuffer::~GstMappedOwnedBuffer): 2020-07-23 Alex Christensen <achristensen@webkit.org> Split Windows parts from CFNetworkSPI.h to CFNetworkSPIWin.h https://bugs.webkit.org/show_bug.cgi?id=214719 Reviewed by Tim Horton. No change in behavior. Windows CFNetwork work is not actively developed, but Cocoa is. This makes it easier to find where to put new things. * platform/network/NetworkStorageSession.h: * platform/network/ResourceHandleClient.h: * platform/network/ResourceHandleInternal.h: * platform/network/cf/CookieStorageCFNet.cpp: * platform/network/cf/CredentialStorageCFNet.cpp: * platform/network/cf/NetworkStorageSessionCFNetWin.cpp: * platform/network/cf/ResourceErrorCF.cpp: * platform/network/cf/ResourceHandleCFNet.cpp: * platform/network/cf/ResourceHandleCFURLConnectionDelegate.cpp: * platform/network/cf/ResourceHandleCFURLConnectionDelegateWithOperationQueue.cpp: * platform/network/cf/ResourceRequestCFNet.cpp: * platform/network/cf/ResourceRequestCFNet.h: * platform/network/cf/ResourceResponse.h: * platform/network/cf/ResourceResponseCFNet.cpp: * platform/network/cf/SocketStreamHandleImplCFNet.cpp: 2020-07-23 Alex Christensen <achristensen@webkit.org> Remove dead code in ResourceHandleCFNet.cpp https://bugs.webkit.org/show_bug.cgi?id=214717 Reviewed by Darin Adler. ResourceHandleCFNet.cpp is not compiled on Cocoa platforms any more. Remove Cocoa-specific code in that file, which was used on iOS before adopting NSURLSession. * platform/network/cf/ResourceHandleCFNet.cpp: (WebCore::ResourceHandle::createCFURLConnection): (WebCore::ResourceHandle::start): (WebCore::ResourceHandle::tryHandlePasswordBasedAuthentication): (WebCore::ResourceHandle::receivedCredential): (WebCore::ResourceHandle::schedule): Deleted. (WebCore::ResourceHandle::unschedule): Deleted. 2020-07-23 James Darpinian <jdarpinian@chromium.org> [WebGL2] Query Objects https://bugs.webkit.org/show_bug.cgi?id=126940 Reviewed by Dean Jackson. Passes conformance tests webgl/2.0.0/conformance2/query/* * html/canvas/WebGL2RenderingContext.cpp: (WebCore::WebGL2RenderingContext::deleteQuery): (WebCore::WebGL2RenderingContext::isQuery): (WebCore::WebGL2RenderingContext::validateQueryTarget): (WebCore::WebGL2RenderingContext::beginQuery): (WebCore::WebGL2RenderingContext::endQuery): (WebCore::WebGL2RenderingContext::getQuery): (WebCore::WebGL2RenderingContext::getQueryParameter): * html/canvas/WebGL2RenderingContext.h: * html/canvas/WebGLQuery.cpp: (WebCore::WebGLQuery::deleteObjectImpl): * html/canvas/WebGLQuery.h: * html/canvas/WebGLRenderingContextBase.cpp: (WebCore::WebGLRenderingContextBase::validateWebGLObject): * platform/graphics/angle/GraphicsContextGLANGLE.cpp: (WebCore::GraphicsContextGLOpenGL::deleteQuery): (WebCore::GraphicsContextGLOpenGL::isQuery): (WebCore::GraphicsContextGLOpenGL::getQuery): 2020-07-23 Guowei Yang <guowei_yang@apple.com> Infrastructure Work for Integrating CoreImage for Accelerated CSS/SVG Filter Rendering https://bugs.webkit.org/show_bug.cgi?id=213672 Reviewed by Simon Fraser. This patch is the infrastructure work to enable filter rendering using CoreImage. The design of this code is as follows: 0) changing WebCore configuration for using CoreImage framework from iOS/mac only to unconditional, so watchOS and tvOS could also use CoreImage 1) adding a new API to obtain the IOSurface from an AcceleratedImageBuffer since CoreImage needs to render to an IOSurface 2) Instead of applying the filters inside FilterEffect, a new class, FilterEffectRendererCoreImage is designed to handle the rendering. We hide the implementation details by subclassing from a generic FilterEffectRenderer class. This also has the benefit of organizing CoreImage obj-c calls in one place. This class owns a FilterEffect node, that is the last FilterEffect of a given filter graph. The filter graph will be traversed backwards and filter parameters is gathered along the way. Then CIFilters will be created and connected to a larger CIFilter graph. The output of the CIFilter graph will be rendered to the IOSurface of a newly created AcceleratedImageBuffer. This image buffer will be returned to RenderLayerFilters and rendered to the screen 3) Inside CSSFilter::build, we first try to create a FilterEffectRenderer by passing in a renderer setting. A valid pointer will be returned only when the following two conditions are met: . CoreImage rendering is enabled in settings . All the filters inside the filter graph is implemented using CIFilters No new tests are required as this is the infrastructure code for integrating CoreImage This patch should pass all the existing css3/filters tests * Configurations/WebCore.xcconfig: modified flag definition so that CoreImage is used on all Apple Platforms, not only iPhone. * Sources.txt: Added the generic FilterEffectRenderer class file * SourcesCocoa.txt: added FilterEffectRendererCoreImage.mm * WebCore.xcodeproj/project.pbxproj: Reflecting newly added files, with some ordering changes * platform/graphics/ConcreteImageBuffer.h: overrides isAccelerated() function that returns true only if the backend is IOSurface * platform/graphics/ImageBuffer.h: defined virtual function isAccelerated() * platform/graphics/ImageBufferBackend.h: defined virtual function isAccelerated() that returns false in the base class (WebCore::ImageBufferBackend::isAccelerated const): returns false for the base class * platform/graphics/PlatformImageBuffer.h: added SPECIALIZE_TYPE_TRAITS to check what type of ImageBufferBackend is * platform/graphics/PlatformImageBuffer.h: Added API to obtain IOSurface from IOSurfaceBackend; added SPECIALIZE_TYPE_TRAITS (WebCore::AcceleratedImageBuffer::surface): Obtain the IOSurface pointer from ImageBufferIOSurfaceBackend (isType): check if a given ImageBuffer is type AcceleratedImageBuffer * platform/graphics/cg/ImageBufferIOSurfaceBackend.cpp: (WebCore::ImageBufferIOSurfaceBackend::surface): added an API to get the IOSurface pointer (WebCore::ImageBufferIOSurfaceBackend::isAccelerated const): returns true because it is an accelerated image buffer * platform/graphics/cg/ImageBufferIOSurfaceBackend.h: added function surface() and isAccelerated() * platform/graphics/coreimage/FilterEffectRendererCoreImage.h: Added. * platform/graphics/coreimage/FilterEffectRendererCoreImage.mm: Added. (WebCore::FilterEffectRendererCoreImage::tryCreate): creates a FilterEffectRendererCoreImage unique pointer. If the filters inside the graph are not all implemented, we return nullptr (WebCore::FilterEffectRendererCoreImage::supportsCoreImageRendering): a function that takes in FilterEffect& and returns true if its a filter effect type that is implemented in CoreImage, false otherwise (WebCore::FilterEffectRendererCoreImage::applyEffects): takes in a FilterEffect pointer, calls FilterEffectRendererCoreImage::connectCIFilters to create the final output CIImage (WebCore::FilterEffectRendererCoreImage::connectCIFilters): recursive helper function that traverses the FilterEffect graph backwards, creates CIFilter graph based on the subclass type of current processing FilterEffect node. It will cache the CIFilter in a hashmap, whose key is the corresponding FilterEffect pointer. (WebCore::FilterEffectRendererCoreImage::canRenderUsingCIFilters): unction that takes in the last FilterEffect node and determines whether all of the filters inside the filter graph is already implemented using CIFilters. It returns false as long as there is one filter that hasn't been implemented. The rendering procedure will fallback to software mode if this function returns false (WebCore::FilterEffectRendererCoreImage::output const): returns the ImageBuffer that contains the data of the final output image (WebCore::FilterEffectRendererCoreImage::renderToImageBuffer): r enders CIImage* to an ImageBuffer (WebCore::FilterEffectRendererCoreImage::destRect const): calculates the destination bounding box (WebCore::FilterEffectRendererCoreImage::clearResult): clears all the saved results (WebCore::FilterEffectRendererCoreImage::FilterEffectRendererCoreImage): constructor * platform/graphics/filters/FEBlend.cpp: (WebCore::FEBlend::FEBlend): Pass an additional FilterEffect::Type argument to base class constructor * platform/graphics/filters/FEColorMatrix.cpp: (WebCore::FEColorMatrix::FEColorMatrix): ditto * platform/graphics/filters/FEComponentTransfer.cpp: (WebCore::FEComponentTransfer::FEComponentTransfer): ditto * platform/graphics/filters/FEComposite.cpp: (WebCore::FEComposite::FEComposite): ditto * platform/graphics/filters/FEConvolveMatrix.cpp: (WebCore::FEConvolveMatrix::FEConvolveMatrix): ditto * platform/graphics/filters/FEDiffuseLighting.cpp: (WebCore::FEDiffuseLighting::FEDiffuseLighting):ditto * platform/graphics/filters/FEDisplacementMap.cpp: (WebCore::FEDisplacementMap::FEDisplacementMap):ditto * platform/graphics/filters/FEDisplacementMap.h: * platform/graphics/filters/FEDropShadow.cpp: (WebCore::FEDropShadow::FEDropShadow):ditto * platform/graphics/filters/FEFlood.cpp: (WebCore::FEFlood::FEFlood):ditto * platform/graphics/filters/FEGaussianBlur.cpp: (WebCore::FEGaussianBlur::FEGaussianBlur):ditto * platform/graphics/filters/FELighting.cpp: (WebCore::FELighting::FELighting):ditto * platform/graphics/filters/FELighting.h: * platform/graphics/filters/FEMerge.cpp: (WebCore::FEMerge::FEMerge): ditto * platform/graphics/filters/FEMorphology.cpp: (WebCore::FEMorphology::FEMorphology): ditto * platform/graphics/filters/FEOffset.cpp: (WebCore::FEOffset::FEOffset): ditto * platform/graphics/filters/FESpecularLighting.cpp: (WebCore::FESpecularLighting::FESpecularLighting): ditto * platform/graphics/filters/FETile.cpp: (WebCore::FETile::FETile): ditto * platform/graphics/filters/FETurbulence.cpp: (WebCore::FETurbulence::FETurbulence): ditto * platform/graphics/filters/FilterEffect.cpp: (WebCore::FilterEffect::FilterEffect): ditto * platform/graphics/filters/FilterEffect.h: added a const member, m_filterEffectType (WebCore::FilterEffect::filterEffectClassType): returns the FilterEffect class type * platform/graphics/filters/FilterEffectRenderer.cpp: Added. (WebCore::FilterEffectRenderer::tryCreate): tries creates a new FilterEffectRenderer unique pointer. Here, we check whether the renderer setting has CoreImage accelerated filter rendering enabled; we also check if all the filters in the given FilterEffect graph is already implemented using CoreImage. If both conditions are satisfied, create a FilterEffectRendererCoreImage otherwise returns nullptr. * platform/graphics/filters/FilterEffectRenderer.h: Added. * platform/graphics/filters/SourceAlpha.cpp: (WebCore::SourceAlpha::SourceAlpha): Pass an additional FilterEffect::Type argument to base class constructor * platform/graphics/filters/SourceAlpha.h: * platform/graphics/filters/SourceGraphic.h: (WebCore::SourceGraphic::SourceGraphic): ditto * rendering/CSSFilter.cpp: (WebCore::CSSFilter::build): we try to create a FilterEffectRenderer here by passing in the state of the CoreImage Accelerated Rendering feature switch (WebCore::CSSFilter::apply): If we have a valid m_filterRenderer pointer, that means we can render the result image using CoreImage path, thus we don't call effect.apply() fall back to software mode if hasResult() returns false. (WebCore::CSSFilter::output const): if we have a valid m_filterRenderer, then we will obtain the ImageBuffer result from it, not FilterEffect (WebCore::CSSFilter::outputRect const): if we have a valid m_filterRenderer, then we will obtain the ImageBuffer result from it, not FilterEffect * rendering/CSSFilter.h: * svg/graphics/filters/SVGFEImage.cpp: (WebCore::FEImage::FEImage): Pass an additional FilterEffect::Type argument to base class constructor 2020-07-23 Yusuke Suzuki <ysuzuki@apple.com> We should have exception check after promise operation https://bugs.webkit.org/show_bug.cgi?id=214610 <rdar://problem/65881794> Reviewed by Youenn Fablet and Mark Lam. Test: js/dom/promise-should-have-exception-check-on-operation.html Add exception check after promise operations. * bindings/js/JSDOMPromiseDeferred.cpp: (WebCore::DeferredPromise::reject): 2020-07-23 Jer Noble <jer.noble@apple.com> [Cocoa|WebM] Seeking can leave parser in hung state https://bugs.webkit.org/show_bug.cgi?id=214704 <rdar://problem/66009420> Reviewed by Eric Carlson. When the parser is explicitly reset, make sure to clear out all the tracks and initialization datas. Otherwise, a half-filled CMSampleBuffer can be left waiting around for more data, which may never arrive, and no further samples will ever be parsed. * platform/graphics/cocoa/SourceBufferParserWebM.cpp: (WebCore::SourceBufferParserWebM::resetParserState): 2020-07-23 Jer Noble <jer.noble@apple.com> [Cocoa] RELEASE_ASSERT when calling registerSupplementalVP9Decoder() when VideoToolbox.framework is not present https://bugs.webkit.org/show_bug.cgi?id=214697 <rdar://problem/66010949> Reviewed by Eric Carlson. * platform/graphics/cocoa/VP9UtilitiesCocoa.mm: (WebCore::registerSupplementalVP9Decoder): (WebCore::isVP9DecoderAvailable): 2020-07-23 Sihui Liu <sihui_liu@appe.com> Allow IndexedDB in third-party frames https://bugs.webkit.org/show_bug.cgi?id=214583 <rdar://problem/61278487> Reviewed by Geoffrey Garen. Match IndexedDB's behavior with localStorage. Third-party iframes now have access to IndexedDB with partitioned in-memory storage. The partitioning key is ClientOrigin, which consists of opening origin and top origin. API Test: IndexedDB.IndexedDBThirdPartyFrameHasAccess IndexedDB.IndexedDBThirdPartyDataRemoval IndexedDB.IndexedDBThirdPartyWorkerHasAccess * Modules/indexeddb/IDBDatabaseIdentifier.cpp: (WebCore::IDBDatabaseIdentifier::IDBDatabaseIdentifier): (WebCore::m_isTransient): (WebCore::IDBDatabaseIdentifier::isolatedCopy const): (WebCore::IDBDatabaseIdentifier::loggingString const): * Modules/indexeddb/IDBDatabaseIdentifier.h: (WebCore::IDBDatabaseIdentifier::hash const): (WebCore::IDBDatabaseIdentifier::operator== const): (WebCore::IDBDatabaseIdentifier::isTransient const): (WebCore::IDBDatabaseIdentifier::encode const): (WebCore::IDBDatabaseIdentifier::decode): * Modules/indexeddb/IDBFactory.cpp: (WebCore::shouldThrowSecurityException): (WebCore::IDBFactory::openInternal): (WebCore::IDBFactory::deleteDatabase): * Modules/indexeddb/server/IDBServer.cpp: (WebCore::IDBServer::IDBServer::createBackingStore): * Modules/webdatabase/DOMWindowWebDatabase.cpp: (WebCore::DOMWindowWebDatabase::openDatabase): * page/SecurityOrigin.h: (WebCore::SecurityOrigin::canAccessDatabase const): 2020-07-23 Chris Dumez <cdumez@apple.com> Add support for SVGAElement's rel / relList attributes https://bugs.webkit.org/show_bug.cgi?id=214690 Reviewed by Darin Adler. Add support for SVGAElement's rel / relList attributes: https://www.w3.org/TR/SVG/linking.html#InterfaceSVGAElement No new tests, rebaselined existing tests. * svg/SVGAElement.cpp: (WebCore::SVGAElement::parseAttribute): (WebCore::SVGAElement::relList const): * svg/SVGAElement.h: * svg/SVGAElement.idl: * svg/svgattrs.in: 2020-07-23 Yusuke Suzuki <ysuzuki@apple.com> Add exception check for WebCore createRejectedPromiseWithTypeError https://bugs.webkit.org/show_bug.cgi?id=214680 <rdar://problem/65925490> Reviewed by Mark Lam. Test: js/dom/rejected-promise-creation-should-check-exception.html Add missing exception checks in createRejectedPromiseWithTypeError. * bindings/js/JSDOMAttribute.h: (WebCore::IDLAttribute::get): * bindings/js/JSDOMOperationReturningPromise.h: (WebCore::IDLOperationReturningPromise::call): (WebCore::IDLOperationReturningPromise::callReturningOwnPromise): * bindings/js/JSDOMPromiseDeferred.cpp: (WebCore::createRejectedPromiseWithTypeError): 2020-07-23 Fujii Hironori <Hironori.Fujii@sony.com> [CMake][Win] Build StructuredExceptionHandlerSuppressor.cpp and makesafeseh.asm only for AppleWin https://bugs.webkit.org/show_bug.cgi?id=214671 Reviewed by Per Arne Vollan. StructuredExceptionHandlerSuppressor is used only by AppleWin port in platform/graphics/ca/win/LayerChangesFlusher.cpp. makesafeseh.asm causes a building problem for 32bit WinCairo because it is using OBJECT library type for WebCore. * PlatformAppleWin.cmake: Added build rules for them. * PlatformWin.cmake: Removed build rules for them. 2020-07-23 Andres Gonzalez <andresg_22@apple.com> Update the isolated tree even when there is no client request. https://bugs.webkit.org/show_bug.cgi?id=214692 Reviewed by Chris Fleizach. AXObjectCache::updateIsolatedTree was checking for isIsolatedTreeEnabled, which in turn checks for whether the clientSupportsIsolatedTree. Often at the time updateIsolatedTree is called, there is no client request since client requests and updates occur in separate threads, independently from each other. Thus the isolated tree wasn't being updated. This patch removes the check for isIsolatedTreeEnabled and rely on the presence of an isolated tree for the given PageID to perform the update. In addition, added an update of the isolated tree for AXLoadingEvent::AXLoadingFinished. This fixes several instance of dynamic content page changes that were not being reflected on the isolated tree. * accessibility/AXObjectCache.cpp: (WebCore::AXObjectCache::clientSupportsIsolatedTree): Some logging. (WebCore::AXObjectCache::isIsolatedTreeEnabled): Some logging. (WebCore::AXObjectCache::frameLoadingEventNotification): Calls updateIsolatedTree. (WebCore::AXObjectCache::updateIsolatedTree): Handles AXLoadingEvents. * accessibility/AXObjectCache.h: 2020-07-23 Clark Wang <clark_wang@apple.com> Added PeriodicWave constructor according to spec https://bugs.webkit.org/show_bug.cgi?id=214615 Reviewed by Chris Dumez. Re-baselined existing tests that now pass. Added PeriodicWave constructor according to spec: https://www.w3.org/TR/webaudio/#periodicwave. Added PeriodicWaveConstraints, PeriodicWaveOptions files. Updated PeriodicWave::createBandLimitedTables to normalize waveform based on spec: https://www.w3.org/TR/webaudio/#waveform-normalization. Added updated createPeriodicWave method in BaseAudioContext, and moved old createPeriodicWave method Into WebKitAudioContext. * CMakeLists.txt: * DerivedSources-input.xcfilelist: * DerivedSources-output.xcfilelist: * DerivedSources.make: * Modules/webaudio/BaseAudioContext.cpp: (WebCore::BaseAudioContext::createPeriodicWave): * Modules/webaudio/BaseAudioContext.h: (WebCore::BaseAudioContext::createPeriodicWave): * Modules/webaudio/BaseAudioContext.idl: * Modules/webaudio/PeriodicWave.cpp: (WebCore::PeriodicWave::create): (WebCore::PeriodicWave::createBandLimitedTables): * Modules/webaudio/PeriodicWave.h: * Modules/webaudio/PeriodicWave.idl: * Modules/webaudio/PeriodicWaveConstraints.h: Added. * Modules/webaudio/PeriodicWaveConstraints.idl: Added. * Modules/webaudio/PeriodicWaveOptions.h: Added. * Modules/webaudio/PeriodicWaveOptions.idl: Added. * Modules/webaudio/WebKitAudioContext.cpp: (WebCore::WebKitAudioContext::createPeriodicWave): * Modules/webaudio/WebKitAudioContext.h: * Sources.txt: * WebCore.xcodeproj/project.pbxproj: 2020-07-23 David Kilzer <ddkilzer@apple.com> [IPC hardening] WebKit::ArgumentCoder<BlobPart>::decode() and encode() should use enum BlobPart::Type <https://webkit.org/b/214665> <rdar://problem/65777948> Reviewed by Darin Adler. * platform/network/BlobPart.h: (WebCore::BlobPart::Type): - Convert to an enum class of size `bool`. (WebCore::BlobPart::BlobPart): (WebCore::BlobPart::data const): (WebCore::BlobPart::moveData): (WebCore::BlobPart::url const): - Change BlobPart::Type enums to use fully qualified name. * platform/network/BlobRegistryImpl.cpp: (WebCore::BlobRegistryImpl::registerBlobURL): - Change BlobPart::Type enums to use fully qualified name. 2020-07-23 Simon Fraser <simon.fraser@apple.com> updateRendering trace point should exclude SVG https://bugs.webkit.org/show_bug.cgi?id=214649 Reviewed by Geoffrey Garen. Don't issue the trace point for SVGImage Pages. * page/Page.cpp: (WebCore::Page::updateRendering): 2020-07-23 Zalan Bujtas <zalan@apple.com> Unreviewed, reverting r262124. See REGRESSION(r262124) Overlapping text on Youtube's video upload page https://bugs.webkit.org/show_bug.cgi?id=214655 * rendering/RenderFlexibleBox.cpp: (WebCore::RenderFlexibleBox::mainSizeForPercentageResolution): 2020-07-23 Brady Eidson <beidson@apple.com> Add Gamepad tests that exercise the native frameworks <rdar://problem/65343674> and https://bugs.webkit.org/show_bug.cgi?id=214188 Reviewed by Tim Horton. * platform/gamepad/mac/MultiGamepadProvider.h: (WebCore::MultiGamepadProvider::setUsesOnlyHIDGamepadProvider): * platform/gamepad/mac/MultiGamepadProvider.mm: (WebCore::MultiGamepadProvider::startMonitoringGamepads): (WebCore::MultiGamepadProvider::stopMonitoringGamepads): 2020-07-23 Xabier Rodriguez Calvar <calvaris@igalia.com> Unreviewed, build fix after r264762. * platform/graphics/gstreamer/GStreamerCommon.cpp: Added include SharedBuffer.h. 2020-07-23 Xabier Rodriguez Calvar <calvaris@igalia.com> [GStreamer] gst_buffer_unmap: assertion 'GST_IS_BUFFER (buffer)' failed https://bugs.webkit.org/show_bug.cgi?id=213364 Reviewed by Philippe Normand. In some cases as in passing init datas around, the InitData that contains a SharedBuffer that contains a non-reffed mapped buffer can outlive the buffer itself, creating this problem. In this patch we make a new class called GstMappedOwnedBuffer that is to map read-only buffers and that is used for the InitData SharedBuffer. GstMappedBuffer does not support SharedBuffer anymore and is not ref counted anymore as it is intended for short term and quick usage. Test: imported/w3c/web-platform-tests/encrypted-media/clearkey-mp4-setmediakeys-to-multiple-video-elements.https.html * platform/SharedBuffer.cpp: (WebCore::SharedBuffer::create): (WebCore::SharedBuffer::SharedBuffer): (WebCore::SharedBuffer::DataSegment::data const): (WebCore::SharedBuffer::DataSegment::size const): * platform/SharedBuffer.h: * platform/audio/gstreamer/WebKitWebAudioSourceGStreamer.cpp: (webKitWebAudioSrcAllocateBuffersAndRenderAudio): * platform/graphics/gstreamer/GStreamerCommon.cpp: (WebCore::GstMappedBuffer::createVector const): (WebCore::GstMappedOwnedBuffer::createSharedBuffer): * platform/graphics/gstreamer/GStreamerCommon.h: (WebCore::GstMappedBuffer::GstMappedBuffer): (WebCore::GstMappedBuffer::~GstMappedBuffer): (WebCore::GstMappedBuffer::isValid const): (WebCore::GstMappedBuffer::data): (WebCore::GstMappedBuffer::data const): (WebCore::GstMappedBuffer::size const): (WebCore::GstMappedBuffer::operator bool const): (WebCore::GstMappedBuffer::operator! const): (WebCore::GstMappedOwnedBuffer::create): (WebCore::GstMappedOwnedBuffer::GstMappedOwnedBuffer): (WebCore::operator==): * platform/graphics/gstreamer/InbandTextTrackPrivateGStreamer.cpp: (WebCore::InbandTextTrackPrivateGStreamer::notifyTrackOfSample): * platform/graphics/gstreamer/eme/CDMProxyThunder.cpp: (WebCore::CDMProxyThunder::getDecryptionSession const): * platform/graphics/gstreamer/eme/GStreamerEMEUtilities.h: (WebCore::InitData::InitData): * platform/graphics/gstreamer/eme/WebKitClearKeyDecryptorGStreamer.cpp: (decrypt): * platform/mediastream/gstreamer/MockRealtimeAudioSourceGStreamer.cpp: (WebCore::MockRealtimeAudioSourceGStreamer::render): * platform/mediastream/gstreamer/RealtimeOutgoingAudioSourceLibWebRTC.cpp: (WebCore::RealtimeOutgoingAudioSourceLibWebRTC::pullAudioData): * platform/mediastream/gstreamer/RealtimeOutgoingVideoSourceLibWebRTC.cpp: (WebCore::RealtimeOutgoingVideoSourceLibWebRTC::createBlackFrame): * platform/mediastream/libwebrtc/GStreamerVideoEncoderFactory.cpp: (WebCore::GStreamerVideoEncoder::Fragmentize): 2020-07-23 Mark Lam <mark.lam@apple.com> Fix missing exception checks below RTCPeerConnection.generateCertificate(). https://bugs.webkit.org/show_bug.cgi?id=214668 <rdar://problem/65929975> Reviewed by Yusuke Suzuki. Test: webrtc/missing-exception-checks-RTCPeerConnection-generateCertificate.html * bindings/js/JSCustomElementRegistryCustom.cpp: (WebCore::JSCustomElementRegistry::whenDefined): * bindings/js/JSDOMConvertUnion.h: * bindings/js/JSDOMOperationReturningPromise.h: (WebCore::IDLOperationReturningPromise::call): (WebCore::IDLOperationReturningPromise::callReturningOwnPromise): (WebCore::IDLOperationReturningPromise::callStatic): (WebCore::IDLOperationReturningPromise::callStaticReturningOwnPromise): * bindings/js/JSDOMPromiseDeferred.cpp: (WebCore::DeferredPromise::reject): (WebCore::rejectPromiseWithExceptionIfAny): * bindings/js/JSDOMPromiseDeferred.h: (WebCore::callPromiseFunction): 2020-07-22 Conrad Shultz <conrad_shultz@apple.com> Update macOS Version macros https://bugs.webkit.org/show_bug.cgi?id=214653 Reviewed by Tim Horton. * Configurations/Base.xcconfig: * Configurations/DebugRelease.xcconfig: * Configurations/Version.xcconfig: * Configurations/WebKitTargetConditionals.xcconfig: 2020-07-22 Jer Noble <jer.noble@apple.com> [Cocoa|WebM] Decode error when seeking https://bugs.webkit.org/show_bug.cgi?id=214666 Reviewed by Eric Carlson. A decoder error is hit when seeking because we think all samples coming out of the SourceBufferParserWebM are sync-samples. This is because the attachment added with CMSetAttachment() is ignored; the correct way to set sample attachments is by getting the sample attachments array with CMSampleBufferGetSampleAttachmentsArray(), and then iterating over the attachments and adding keys to the underlying mutable CFDictionary. * platform/graphics/cocoa/SourceBufferParserWebM.cpp: (WebCore::SourceBufferParserWebM::OnFrame): 2020-07-22 Fujii Hironori <Hironori.Fujii@sony.com> [WinCairo][32bit] JPEG2000ImageDecoder.cpp: error C2664: 'std::unique_ptr<...>::unique_ptr(...)': cannot convert argument 2 from 'void (__stdcall *)(opj_codec_t *)' to 'const _Dx &' https://bugs.webkit.org/show_bug.cgi?id=214657 Reviewed by Darin Adler. __cdecl and __stdcall calling conventions don't match. <https://docs.microsoft.com/en-us/cpp/cpp/argument-passing-and-naming-conventions> * platform/image-decoders/jpeg2000/JPEG2000ImageDecoder.cpp: (WebCore::JPEG2000ImageDecoder::decode): Use decltype for the second template argument of unique_ptr. 2020-07-22 Jon Davis <jond@apple.com> Add feature status for CSS Containment Module Level 1 https://bugs.webkit.org/show_bug.cgi?id=214663 Reviewed by Darin Adler. * features.json: 2020-07-22 Jon Davis <jond@apple.com> Add feature status for the focus-visible pseudo-selector https://bugs.webkit.org/show_bug.cgi?id=214662 Reviewed by Darin Adler. * features.json: 2020-07-22 Wenson Hsieh <wenson_hsieh@apple.com> Unreviewed, update feature status for async clipboard API * features.json: Move from "In Development" to "Supported". 2020-07-21 Mark Lam <mark.lam@apple.com> Disallow VM entry when doing a VMInquiry. https://bugs.webkit.org/show_bug.cgi?id=214624 <rdar://problem/65915314> Reviewed by Saam Barati. 1. Change binding to reset the DisallowVMEntry scope in PropertySlot after doing a VMInquiry. 2. Rebase bindings test results to match. * bindings/js/JSDOMAbstractOperations.h: (WebCore::isVisibleNamedProperty): (WebCore::accessVisibleNamedProperty): * bindings/scripts/CodeGeneratorJS.pm: (GeneratePut): (GeneratePutByIndex): (GenerateDefineOwnProperty): * bindings/scripts/test/JS/JSTestNamedAndIndexedSetterNoIdentifier.cpp: (WebCore::JSTestNamedAndIndexedSetterNoIdentifier::put): (WebCore::JSTestNamedAndIndexedSetterNoIdentifier::putByIndex): (WebCore::JSTestNamedAndIndexedSetterNoIdentifier::defineOwnProperty): * bindings/scripts/test/JS/JSTestNamedAndIndexedSetterThrowingException.cpp: (WebCore::JSTestNamedAndIndexedSetterThrowingException::put): (WebCore::JSTestNamedAndIndexedSetterThrowingException::putByIndex): (WebCore::JSTestNamedAndIndexedSetterThrowingException::defineOwnProperty): * bindings/scripts/test/JS/JSTestNamedAndIndexedSetterWithIdentifier.cpp: (WebCore::JSTestNamedAndIndexedSetterWithIdentifier::put): (WebCore::JSTestNamedAndIndexedSetterWithIdentifier::putByIndex): (WebCore::JSTestNamedAndIndexedSetterWithIdentifier::defineOwnProperty): * bindings/scripts/test/JS/JSTestNamedSetterNoIdentifier.cpp: (WebCore::JSTestNamedSetterNoIdentifier::put): (WebCore::JSTestNamedSetterNoIdentifier::putByIndex): (WebCore::JSTestNamedSetterNoIdentifier::defineOwnProperty): * bindings/scripts/test/JS/JSTestNamedSetterThrowingException.cpp: (WebCore::JSTestNamedSetterThrowingException::put): (WebCore::JSTestNamedSetterThrowingException::putByIndex): (WebCore::JSTestNamedSetterThrowingException::defineOwnProperty): * bindings/scripts/test/JS/JSTestNamedSetterWithIdentifier.cpp: (WebCore::JSTestNamedSetterWithIdentifier::put): (WebCore::JSTestNamedSetterWithIdentifier::putByIndex): (WebCore::JSTestNamedSetterWithIdentifier::defineOwnProperty): * bindings/scripts/test/JS/JSTestNamedSetterWithIndexedGetter.cpp: (WebCore::JSTestNamedSetterWithIndexedGetter::put): (WebCore::JSTestNamedSetterWithIndexedGetter::putByIndex): (WebCore::JSTestNamedSetterWithIndexedGetter::defineOwnProperty): * bindings/scripts/test/JS/JSTestNamedSetterWithIndexedGetterAndSetter.cpp: (WebCore::JSTestNamedSetterWithIndexedGetterAndSetter::put): (WebCore::JSTestNamedSetterWithIndexedGetterAndSetter::putByIndex): (WebCore::JSTestNamedSetterWithIndexedGetterAndSetter::defineOwnProperty): * bindings/scripts/test/JS/JSTestNamedSetterWithUnforgableProperties.cpp: (WebCore::JSTestNamedSetterWithUnforgableProperties::put): (WebCore::JSTestNamedSetterWithUnforgableProperties::putByIndex): (WebCore::JSTestNamedSetterWithUnforgableProperties::defineOwnProperty): 2020-07-22 Eric Carlson <eric.carlson@apple.com> [Cocoa] canPlayType with 'codecs' parameter should never return "maybe" https://bugs.webkit.org/show_bug.cgi?id=214621 <rdar://problem/65146785> Reviewed by Jer Noble. No new tests, updated existing tests and results. * platform/graphics/MIMETypeCache.cpp: (WebCore::MIMETypeCache::canDecodeType): 2020-07-22 Kenneth Russell <kbr@chromium.org> [WebGL2] Implement multiple render target entry points https://bugs.webkit.org/show_bug.cgi?id=211156 Reviewed by Dean Jackson. Implement the drawBuffers and clearBuffer entry points. Integrate the clearBuffer APIs with preserveDrawingBuffer:false's auto-clearing. Move some auto-clearing state from WebGLRenderingContextBase to GraphicsContextGL and GraphicsContextGLOpenGL. Rename setPreserveDrawingBuffer to enablePreserveDrawingBuffer to make it clear that arbitrary changes of preserveDrawingBuffer are not supported. setPreserveDrawingBuffer was previously added for capture of preserveDrawingBuffer:false WebGL canvases. Covered by existing WebGL conformance tests and canvas capture layout tests. * Modules/mediastream/CanvasCaptureMediaStreamTrack.cpp: (WebCore::CanvasCaptureMediaStreamTrack::Source::canvasChanged): * html/canvas/WebGL2RenderingContext.cpp: (WebCore::WebGL2RenderingContext::drawBuffers): (WebCore::WebGL2RenderingContext::clearBufferiv): (WebCore::WebGL2RenderingContext::clearBufferuiv): (WebCore::WebGL2RenderingContext::clearBufferfv): (WebCore::WebGL2RenderingContext::clearBufferfi): (WebCore::WebGL2RenderingContext::validateClearBuffer): (WebCore::WebGL2RenderingContext::updateBuffersToAutoClear): * html/canvas/WebGL2RenderingContext.h: * html/canvas/WebGLFramebuffer.cpp: (WebCore::WebGLFramebuffer::drawBuffersIfNecessary): * html/canvas/WebGLRenderingContextBase.cpp: (WebCore::WebGLRenderingContextBase::clearIfComposited): (WebCore::WebGLRenderingContextBase::enablePreserveDrawingBuffer): * html/canvas/WebGLRenderingContextBase.h: (WebCore::WebGLRenderingContextBase::setPreserveDrawingBuffer): Deleted. * platform/graphics/GraphicsContextGL.cpp: (WebCore::GraphicsContextGL::enablePreserveDrawingBuffer): * platform/graphics/GraphicsContextGL.h: * platform/graphics/angle/GraphicsContextGLANGLE.cpp: (WebCore::GraphicsContextGLOpenGL::markLayerComposited): (WebCore::GraphicsContextGLOpenGL::drawBuffers): (WebCore::GraphicsContextGLOpenGL::clearBufferiv): (WebCore::GraphicsContextGLOpenGL::clearBufferuiv): (WebCore::GraphicsContextGLOpenGL::clearBufferfv): (WebCore::GraphicsContextGLOpenGL::clearBufferfi): * platform/graphics/opengl/GraphicsContextGLOpenGL.cpp: (WebCore::GraphicsContextGLOpenGL::resetBuffersToAutoClear): (WebCore::GraphicsContextGLOpenGL::setBuffersToAutoClear): (WebCore::GraphicsContextGLOpenGL::getBuffersToAutoClear const): (WebCore::GraphicsContextGLOpenGL::enablePreserveDrawingBuffer): * platform/graphics/opengl/GraphicsContextGLOpenGL.h: * platform/graphics/opengl/GraphicsContextGLOpenGLCommon.cpp: (WebCore::GraphicsContextGLOpenGL::markLayerComposited): (WebCore::GraphicsContextGLOpenGL::drawBuffers): 2020-07-22 Wenson Hsieh <wenson_hsieh@apple.com> Article headlines are split across multiple lines after translating tagesschau.de https://bugs.webkit.org/show_bug.cgi?id=214652 <rdar://problem/63995571> Reviewed by Tim Horton. Treat block-level heading elements (`h1` through `h6`) as item boundaries. On this website, we currently vend the main heading and sub-heading as separate tokens in the same item, which sometimes causes the machine translation framework to try and rearrange and split tokens, since it treats the combination of the main heading and sub-heading text as a single sentence to be translated. Test: TextManipulation.StartTextManipulationExtractsHeadingElementsAsSeparateItems * editing/TextManipulationController.cpp: (WebCore::isEnclosingItemBoundaryElement): 2020-07-22 Alex Christensen <achristensen@webkit.org> Safari does not present CertificateInfo for service-worker served documents https://bugs.webkit.org/show_bug.cgi?id=206403 <rdar://problem/65410875> Reviewed by Darin Adler and Youenn Fablet. When loading a service worker JavaScript resource, we need to tell the network process to include certificate info with the response. We then pass that response to the ServiceWorkerContextData for storage. When the service worker generates responses to fetches, use that certificate chain for WKWebView.serverTrust when the page is committed. Covered by updating a test I wrote in r264687. * platform/network/ResourceResponseBase.h: (WebCore::ResourceResponseBase::setCertificateInfo): * platform/network/cf/CertificateInfo.h: * platform/network/cf/CertificateInfoCFNet.cpp: (WebCore::CertificateInfo::isolatedCopy const): * platform/network/soup/CertificateInfo.h: (WebCore::CertificateInfo::isolatedCopy const): * workers/Worker.cpp: (WebCore::Worker::create): * workers/WorkerScriptLoader.cpp: (WebCore::WorkerScriptLoader::loadAsynchronously): (WebCore::WorkerScriptLoader::didReceiveResponse): * workers/WorkerScriptLoader.h: (WebCore::WorkerScriptLoader::certificateInfo const): * workers/service/ServiceWorkerContainer.cpp: (WebCore::ServiceWorkerContainer::jobFinishedLoadingScript): * workers/service/ServiceWorkerContainer.h: * workers/service/ServiceWorkerContextData.cpp: (WebCore::ServiceWorkerContextData::isolatedCopy const): * workers/service/ServiceWorkerContextData.h: (WebCore::ServiceWorkerContextData::encode const): (WebCore::ServiceWorkerContextData::decode): * workers/service/ServiceWorkerFetchResult.h: (WebCore::ServiceWorkerFetchResult::isolatedCopy const): (WebCore::serviceWorkerFetchError): (WebCore::ServiceWorkerFetchResult::encode const): (WebCore::ServiceWorkerFetchResult::decode): * workers/service/ServiceWorkerGlobalScope.h: * workers/service/ServiceWorkerJob.cpp: (WebCore::ServiceWorkerJob::fetchScriptWithContext): (WebCore::ServiceWorkerJob::notifyFinished): * workers/service/ServiceWorkerJobClient.h: * workers/service/context/ServiceWorkerFetch.cpp: (WebCore::ServiceWorkerFetch::processResponse): (WebCore::ServiceWorkerFetch::dispatchFetchEvent): * workers/service/server/RegistrationDatabase.cpp: (WebCore::RegistrationDatabase::importRecords): * workers/service/server/SWServer.cpp: (WebCore::SWServer::addRegistrationFromStore): Also fix a possible use-after-move bug, depending on parameter evaluation order which is undefined behavior. (WebCore::SWServer::updateWorker): (WebCore::SWServer::installContextData): * workers/service/server/SWServer.h: * workers/service/server/SWServerJobQueue.cpp: (WebCore::SWServerJobQueue::scriptFetchFinished): * workers/service/server/SWServerWorker.cpp: (WebCore::SWServerWorker::SWServerWorker): (WebCore::SWServerWorker::contextData const): * workers/service/server/SWServerWorker.h: 2020-07-22 David Kilzer <ddkilzer@apple.com> Unreviewed build fix after r264710, r264719, r264721: use more HAVE_AVPLAYER_VIDEORANGEOVERRIDE. * platform/PlatformScreen.h: * platform/mac/PlatformScreenMac.mm: (WebCore::collectScreenProperties): - Guard more code with HAVE(AVPLAYER_VIDEORANGEOVERRIDE). 2020-07-22 Fujii Hironori <Hironori.Fujii@sony.com> [Win][Uniscribe] Material icons containing underscore or numbers aren't shown because ScriptItemize splits them apart https://bugs.webkit.org/show_bug.cgi?id=201214 Reviewed by Don Olmstead. ScriptItemize split "3d_rotation" into "3", "d", "_" and "rotation". It has a option fMergeNeutralItems to control it. Test: fonts/ligature.html * platform/graphics/win/ComplexTextControllerUniscribe.cpp: (WebCore::ComplexTextController::collectComplexTextRunsForCharacters): Set fMergeNeutralItems of SCRIPT_CONTROL true. 2020-07-22 Jer Noble <jer.noble@apple.com> Further unreviewed build fix after r264710; need more HAVE_AVPLAYER_VIDEORANGEOVERRIDE guards. * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm: 2020-07-22 Jer Noble <jer.noble@apple.com> Unreviewed build fix after r264710; add a HAVE_AVPLAYER_VIDEORANGEOVERRIDE guard. * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm: (WebCore::MediaPlayerPrivateAVFoundationObjC::createAVPlayer): (WebCore::MediaPlayerPrivateAVFoundationObjC::setPreferredDynamicRangeMode): 2020-07-22 Myles C. Maxfield <mmaxfield@apple.com> REGRESSION(r205826): narrowNoBreakSpace (U+202F) has zero width, regardless of font https://bugs.webkit.org/show_bug.cgi?id=214626 <rdar://problem/65193790> Reviewed by Timothy Hatcher. There's no reason to overwrite narrowNoBreakSpace with zeroWidthSpace. This is becoming much more prominent now because a lot of the French unit formatting data in CLDR - and hence in e.g. NSMeasurementFormatter - uses 202F between numeric value and unit, e.g. "37 km" It works in native content on macOS, and in all other browsers on macOS, but not in WebKit. Test: fast/text/narrowNoBreakSpace.html * platform/graphics/Font.cpp: (WebCore::overrideControlCharacters): 2020-07-22 James Darpinian <jdarpinian@chromium.org> Fix validation of deleted WebGL objects https://bugs.webkit.org/show_bug.cgi?id=214622 Reviewed by Dean Jackson. Programs and shaders need to be validated differently than other WebGL objects. Using a deleted WebGL object should cause an INVALID_OPERATION error, except for programs and shaders which should be INVALID_VALUE. * html/canvas/WebGL2RenderingContext.cpp: (WebCore::WebGL2RenderingContext::getFragDataLocation): (WebCore::WebGL2RenderingContext::transformFeedbackVaryings): (WebCore::WebGL2RenderingContext::getTransformFeedbackVarying): (WebCore::WebGL2RenderingContext::getUniformIndices): (WebCore::WebGL2RenderingContext::getActiveUniforms): (WebCore::WebGL2RenderingContext::getUniformBlockIndex): (WebCore::WebGL2RenderingContext::getActiveUniformBlockParameter): (WebCore::WebGL2RenderingContext::getActiveUniformBlockName): (WebCore::WebGL2RenderingContext::uniformBlockBinding): * html/canvas/WebGLRenderingContextBase.cpp: (WebCore::WebGLRenderingContextBase::attachShader): (WebCore::WebGLRenderingContextBase::bindAttribLocation): (WebCore::WebGLRenderingContextBase::compileShader): (WebCore::WebGLRenderingContextBase::detachShader): (WebCore::WebGLRenderingContextBase::validateWebGLObject): (WebCore::WebGLRenderingContextBase::validateWebGLProgramOrShader): (WebCore::WebGLRenderingContextBase::getActiveAttrib): (WebCore::WebGLRenderingContextBase::getActiveUniform): (WebCore::WebGLRenderingContextBase::getAttachedShaders): (WebCore::WebGLRenderingContextBase::getAttribLocation): (WebCore::WebGLRenderingContextBase::getProgramParameter): (WebCore::WebGLRenderingContextBase::getProgramInfoLog): (WebCore::WebGLRenderingContextBase::getShaderParameter): (WebCore::WebGLRenderingContextBase::getShaderInfoLog): (WebCore::WebGLRenderingContextBase::getShaderSource): (WebCore::WebGLRenderingContextBase::getUniform): (WebCore::WebGLRenderingContextBase::getUniformLocation): (WebCore::WebGLRenderingContextBase::linkProgramWithoutInvalidatingAttribLocations): (WebCore::WebGLRenderingContextBase::shaderSource): (WebCore::WebGLRenderingContextBase::validateProgram): * html/canvas/WebGLRenderingContextBase.h: 2020-07-22 Jon Davis <jond@apple.com> Update feature status to include the inert attribute https://bugs.webkit.org/show_bug.cgi?id=214644 Reviewed by Darin Adler. * features.json: 2020-07-22 Jer Noble <jer.noble@apple.com> [macOS] Adopt AVPlayer.videoRangeOverride https://bugs.webkit.org/show_bug.cgi?id=213902 <rdar://problem/63953509> Reviewed by Youenn Fablet. AVPlayer.videoRangeOverride and also +[AVPlayer preferredVideoRangeForDisplays:] are replacements for the process-global MTShouldPlayHDR() and MTOverrideShouldPlayHDRVideo() and should be used preferentially if present. * html/HTMLMediaElement.cpp: (WebCore::HTMLMediaElement::createMediaPlayer): (WebCore::HTMLMediaElement::setPreferredDynamicRangeMode): * html/HTMLMediaElement.h: * page/Page.cpp: (WebCore::Page::screenPropertiesDidChange): (WebCore::Page::windowScreenDidChange): * page/Page.h: * platform/PlatformScreen.h: (WebCore::preferredDynamicRangeMode): * platform/ScreenProperties.h: (WebCore::ScreenData::encode const): (WebCore::ScreenData::decode): * platform/graphics/MediaPlayer.cpp: (WebCore::MediaPlayer::setPreferredDynamicRangeMode): * platform/graphics/MediaPlayer.h: * platform/graphics/MediaPlayerPrivate.h: (WebCore::MediaPlayerPrivateInterface::setPreferredDynamicRangeMode): * platform/graphics/avfoundation/objc/CDMSessionAVStreamSession.mm: (WebCore::CDMSessionAVStreamSession::update): * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h: * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm: (WebCore::convertDynamicRangeModeEnumToAVVideoRange): (WebCore::MediaPlayerPrivateAVFoundationObjC::createAVPlayer): (WebCore::MediaPlayerPrivateAVFoundationObjC::setPreferredDynamicRangeMode): * platform/mac/PlatformScreenMac.mm: (WebCore::convertAVVideoRangeToEnum): (WebCore::collectScreenProperties): (WebCore::preferredDynamicRangeMode): 2020-07-22 Jon Davis <jond@apple.com> Update status for Web App Manifest https://bugs.webkit.org/show_bug.cgi?id=204863 Reviewed by Dean Jackson. * features.json: 2020-07-21 Simon Fraser <simon.fraser@apple.com> Scrolling tesla.com on iPad is not smooth https://bugs.webkit.org/show_bug.cgi?id=214627 Reviewed by Tim Horton. This is the iOS equivalent of the fix in r264203; if the user is scrolling (or we're animating for scroll snap), layout should not trigger scroll position changes via computation of the current snap location. To fix this, we need to send data from the UI process to the web process about which scrolling tree nodes the user is scrolling. That's done via RemoteScrollingUIState, which will, in the long term, become a more general UI -> WebProcess scrolling state updating mechanism. For now, it just keeps track of nodes undergoing scroll snap and user scrolls (only the latter is hooked up for now). Test: fast/scrolling/ios/adjust-scroll-snap-during-gesture.html * page/scrolling/AsyncScrollingCoordinator.h: * page/scrolling/ScrollingTree.h: (WebCore::ScrollingTree::scrollingTreeNodeWillStartPanGesture): (WebCore::ScrollingTree::scrollingTreeNodeWillStartScroll): (WebCore::ScrollingTree::scrollingTreeNodeDidEndScroll): 2020-07-22 Commit Queue <commit-queue@webkit.org> Unreviewed, reverting r264691. https://bugs.webkit.org/show_bug.cgi?id=214642 Regressed fast/mediastream/captureStream/canvas3d.html Reverted changeset: "[WebGL2] Implement multiple render target entry points" https://bugs.webkit.org/show_bug.cgi?id=211156 https://trac.webkit.org/changeset/264691 2020-07-22 Youenn Fablet <youenn@apple.com> KeepAlive fetch should not be blocked in pagehide event handlers https://bugs.webkit.org/show_bug.cgi?id=214630 <rdar://problem/65564772> Reviewed by Chris Dumez. Test: http/wpt/fetch/fetch-in-pagehide.html * loader/cache/CachedResource.cpp: (WebCore::CachedResource::load): Allow keep alive fetches to proceed similarly to ping loads. 2020-07-22 Geoffrey Garen <ggaren@apple.com> JSRunLoopTimer should use WTF::RunLoop rather than custom CF code https://bugs.webkit.org/show_bug.cgi?id=214102 Unreviewed, re-landing r264242 with crash fixed. Since I was here, I applied Darin's previous review feedback that I had missed. * bindings/js/CommonVM.cpp: (WebCore::commonVMSlow): 2020-07-19 Darin Adler <darin@apple.com> Remove live ranges from Editor.h and EditorClient.h https://bugs.webkit.org/show_bug.cgi?id=214261 Reviewed by Sam Weinig. * accessibility/AccessibilityObject.cpp: (WebCore::AccessibilityObject::misspellingRange const): Update since rangeForTextCheckingResult no longer returns a live range. (WebCore::AccessibilityObject::rangeOfStringClosestToRangeInDirection const): Update since rangeOfString no longer returns a live range. * accessibility/mac/WebAccessibilityObjectWrapperMac.mm: (accessibilityTextOperationForParameterizedAttribute): Use makeSimpleRange. * dom/Document.cpp: (WebCore::acceptsEditingFocus): Use makeRangeSelectingNodeContents since shouldBeginEditing no longer takes a live range. * dom/Range.h: Exxported makeSimpleRange for use outside WebCore. * dom/SimpleRange.cpp: (WebCore::makeSimpleRange): Added. Takes two optional boundary points and returns an optional range. * dom/SimpleRange.h: Added the above. * editing/AlternativeTextController.cpp: (WebCore::AlternativeTextController::timerFired): Removed calls to crateLiveRange since markAllMisspellingsAndBadGrammarInRanges no longer takes live ranges. (WebCore::AlternativeTextController::applyDictationAlternative): Updates since shouldInsertText no longer takes a live range. * editing/DeleteSelectionCommand.cpp: (WebCore::DeleteSelectionCommand::mergeParagraphs): Updated since shouldMoveRangeAfterDelete no longer takes live ranges. * editing/Editor.cpp: (WebCore::Editor::canDeleteRange const): Updated to not take a live range. (WebCore::Editor::deleteWithDirection): Updated since addRangeToKillRing no longer takes a live range. (WebCore::Editor::pasteAsPlainTextWithPasteboard): Updated since shouldInsertText no longer takes a live range. (WebCore::Editor::shouldInsertFragment): No longer take a live range. (WebCore::Editor::replaceSelectionWithText): Updated since selectedRange no longer returns a live range. (WebCore::Editor::selectedRange): Do not return a live range. (WebCore::Editor::shouldDeleteRange const): Do not take a live range. (WebCore::Editor::shouldInsertText const): Ditto. (WebCore::Editor::shouldApplyStyle): Ditto. Also take a const& to the style instead of a non-const*. (WebCore::Editor::applyStyleToSelection): Pass a style reference and a non-live range. (WebCore::Editor::applyParagraphStyleToSelection): Updated for the change above. (WebCore::Editor::insertTextWithoutSendingTextEvent): No need to pass a live range any more. (WebCore::Editor::insertLineBreak): Ditto. (WebCore::Editor::insertParagraphSeparator): Ditto. (WebCore::Editor::performCutOrCopy): Updated to not use live range. (WebCore::Editor::performDelete): Ditto. (WebCore::Editor::shouldEndEditing): Do not take a live range. (WebCore::Editor::shouldBeginEditing): Ditto. (WebCore::Editor::willWriteSelectionToPasteboard): Ditto. (WebCore::Editor::selectComposition): Update since compositionRange is not a live range. (WebCore::Editor::markMisspellingsAfterTypingToWord): Update since we don't need to pass live ranges to markAllMisspellingsAndBadGrammarInRanges. (WebCore::Editor::markMisspellingsOrBadGrammar): Don't return a live range in tthe out argument. (WebCore::Editor::markMisspellings): Ditto. (WebCore::Editor::markBadGrammar): Update for the above. (WebCore::Editor::markAllMisspellingsAndBadGrammarInRanges): Do not take live ranges for the arguments. (WebCore::Editor::replaceRangeForSpellChecking): Do not take a live range. (WebCore::Editor::markAndReplaceFor): Update since shouldInsertText does not take a live range any more. (WebCore::Editor::changeBackToReplacedString): Update to not use live ranges as much. (WebCore::Editor::markMisspellingsAndBadGrammar): Updae since we don't need to pass live ranges to markAllMisspellingsAndBadGrammarInRanges. (WebCore::Editor::rangeForPoint): Don't return a live range. (WebCore::Editor::compositionRange const): Ditto. (WebCore::Editor::transpose): Updated since we don't pass a live range. (WebCore::Editor::firstRectForRange const): Don't take a live range. (WebCore::Editor::shouldChangeSelection const): Updated since we don't need to pass a live range. (WebCore::Editor::findString): Ditto. (WebCore::start): Added. Helper to make rangeOfString easier to read. (WebCore::end): Ditto. (WebCore::makeBoundaryPointAfterNodeContents): Ditto. (WebCore::makeBoundaryPointAfterNode): Ditto. (WebCore::collapseIfRootsDiffer): Ditto. (WebCore::Editor::rangeOfString): Updated to not take or return a live range and not use it internally either. (WebCore::isFrameInRange): Don't take a live range. (WebCore::Editor::countMatchesForText): Don't take or return live ranges. (WebCore::Editor::contextRangeForCandidateRequest const): Don't return a live range. (WebCore::Editor::rangeForTextCheckingResult const): Ditto. (WebCore::Editor::handleAcceptedCandidate): Update for the above. (WebCore::Editor::adjustedSelectionRange): Don't return a live range. * editing/Editor.h: Updated for all the chagnes above. * editing/EditorCommand.cpp: (WebCore::expandSelectionToGranularity): Updated to reduce the use of live ranges. (WebCore::unionRanges): Updated to no longer take or return a live range. Still uses live ranges in the algorithm for now. (WebCore::executeDeleteToMark): Updated since selectedRange no longer returns a live range. (WebCore::executeSelectToMark): Update to use the new unionRanges. * editing/FrameSelection.cpp: (WebCore::FrameSelection::shouldDeleteSelection const): Updated since shouldDeleteRange no longer requires a live range. * editing/cocoa/EditorCocoa.mm: (WebCore::Editor::getPasteboardTypesAndDataForAttachment): Updated for changes to use fewer live ranges. (WebCore::Editor::writeSelectionToPasteboard): Ditto. (WebCore::Editor::writeSelection): Ditto. (WebCore::Editor::replaceSelectionWithAttributedString): Ditto. * editing/gtk/EditorGtk.cpp: (WebCore::Editor::pasteWithPasteboard): Ditto. * editing/ios/EditorIOS.mm: (WebCore::Editor::writeImageToPasteboard): Ditto. (WebCore::Editor::pasteWithPasteboard): Ditto. * editing/libwpe/EditorLibWPE.cpp: (WebCore::createFragmentFromPasteboardData): Ditto. (WebCore::Editor::pasteWithPasteboard): Ditto. * editing/mac/EditorMac.mm: (WebCore::Editor::pasteWithPasteboard): Ditto. (WebCore::Editor::replaceNodeFromPasteboard): Ditto. (WebCore::Editor::dataSelectionForPasteboard): Ditto. * editing/win/EditorWin.cpp: (WebCore::Editor::pasteWithPasteboard): Ditto. * html/FTPDirectoryDocument.cpp: (WebCore::FTPDirectoryDocumentParser::createTDForFilename): Removed a WTFMove that messes up the return value optimization. Noticed while fixing errors caused by live range changes. * loader/EmptyClients.cpp: Updated for changes to EditorClient. * page/ContextMenuController.cpp: (WebCore::insertUnicodeCharacter): Updated to use fewer live ranges. (WebCore::ContextMenuController::contextMenuItemSelected): DItto. * page/DragController.cpp: (WebCore::DragController::concludeEditDrag): Ditto. (WebCore::DragController::startDrag): Ditto. * page/EditorClient.h: Don't take or return live ranges. * page/EventHandler.cpp: (WebCore::EventHandler::sendContextMenuEventForKey): Simplified since we don't need to use a live range. * page/FocusController.cpp: (WebCore::relinquishesEditingFocus): Changed argument type to be more specific, and changed to not use a live range. (WebCore::FocusController::setFocusedElement): Updated for the above. * page/Frame.cpp: (WebCore::Frame::rangeForPoint): Updated to not use live ranges. * page/Page.cpp: (WebCore::Page::findStringMatchingRanges): Updated to not use live ranges as much. (WebCore::Page::rangeOfString): Ditto. (WebCore::Page::findMatchesForText): Ditto. * testing/Internals.cpp: (WebCore::Internals::rangeOfString): Updated since return value of the Editor member function is no longer a live range. (WebCore::Internals::countMatchesForText): Ditto. 2020-07-21 Kenneth Russell <kbr@chromium.org> [WebGL2] Implement multiple render target entry points https://bugs.webkit.org/show_bug.cgi?id=211156 Reviewed by Myles C. Maxfield. Implement the drawBuffers and clearBuffer entry points. Integrate the clearBuffer APIs with preserveDrawingBuffer:false's auto-clearing. Covered by existing WebGL conformance tests. * html/canvas/WebGL2RenderingContext.cpp: (WebCore::WebGL2RenderingContext::drawBuffers): (WebCore::WebGL2RenderingContext::clearBufferiv): (WebCore::WebGL2RenderingContext::clearBufferuiv): (WebCore::WebGL2RenderingContext::clearBufferfv): (WebCore::WebGL2RenderingContext::clearBufferfi): (WebCore::WebGL2RenderingContext::validateClearBuffer): (WebCore::WebGL2RenderingContext::updateBuffersToAutoClear): * html/canvas/WebGL2RenderingContext.h: * html/canvas/WebGLFramebuffer.cpp: (WebCore::WebGLFramebuffer::drawBuffersIfNecessary): * html/canvas/WebGLRenderingContextBase.cpp: (WebCore::WebGLRenderingContextBase::clearIfComposited): * platform/graphics/GraphicsContextGL.h: * platform/graphics/angle/GraphicsContextGLANGLE.cpp: (WebCore::GraphicsContextGLOpenGL::markLayerComposited): (WebCore::GraphicsContextGLOpenGL::drawBuffers): (WebCore::GraphicsContextGLOpenGL::clearBufferiv): (WebCore::GraphicsContextGLOpenGL::clearBufferuiv): (WebCore::GraphicsContextGLOpenGL::clearBufferfv): (WebCore::GraphicsContextGLOpenGL::clearBufferfi): * platform/graphics/opengl/GraphicsContextGLOpenGL.cpp: (WebCore::GraphicsContextGLOpenGL::resetBuffersToAutoClear): (WebCore::GraphicsContextGLOpenGL::setBuffersToAutoClear): (WebCore::GraphicsContextGLOpenGL::getBuffersToAutoClear const): * platform/graphics/opengl/GraphicsContextGLOpenGL.h: * platform/graphics/opengl/GraphicsContextGLOpenGLCommon.cpp: (WebCore::GraphicsContextGLOpenGL::markLayerComposited): (WebCore::GraphicsContextGLOpenGL::drawBuffers): 2020-07-21 Wenson Hsieh <wenson_hsieh@apple.com> REGRESSION (r258871): Shift + click to extend selection loses currently selected text https://bugs.webkit.org/show_bug.cgi?id=214617 <rdar://problem/64980223> Reviewed by Megan Gardner. After the changes in r258871, shift clicking sometimes fails to preserve the existing selected text range on macOS and iOS. The logic in `EventHandler::handleMousePressEventSingleClick` uses the `textDistance` helper method to count the number of characters between the start of the current selection to the newly selected extent, as well as the number of characters between the end of the current selection and the newly selected extent position. It compares these two character counts, and attempts to choose the new selection extents in such a way that maximizes the amount of selected text. However, after r258871, `textDistance` uses `characterCount` instead of `TextIterator::rangeLength`. Unlike the former, `rangeLength` is robust in the case where the start position comes after the end position (in document order), since the process of creating a live `Range` object swaps the start and end if needed. This isn't the case when using `SimpleRange`. Instead, when given a simple range where the start comes after the end, `characterCount` will iterate text in the DOM, starting from the start position and ending at the end of the document rather than the end position. The result is that `characterCount` actually counts the number of characters between the start position and the end of the document, rather than the number of characters between the two positions. In the context of this bug, if the start of the current selection is "far away" (in terms of character count) from the end of the document and the new extent position comes after end of the current selection, we will end up choosing the end (instead of the start) as one of the new extents of the updated selection. To fix this (as well as other similar issues that might've arisen when replacing uses of `TextIterator::rangeLength` with `characterCount`), simply teach `characterCount` to flip the start and end positions if the end position of the `SimpleRange` comes before the start. Test: editing/selection/shift-click-includes-existing-selection.html * editing/TextIterator.cpp: (WebCore::characterCount): 2020-07-21 Alex Christensen <achristensen@webkit.org> Fix Windows build. https://bugs.webkit.org/show_bug.cgi?id=214623 * platform/network/curl/CertificateInfo.h: * platform/network/curl/CertificateInfoCurl.cpp: (WebCore::CertificateInfo::summary const): (WebCore::CertificateInfo::summaryInfo const): Deleted. 2020-07-21 Alex Christensen <achristensen@webkit.org> Remove unneeded CertificateInfoBase https://bugs.webkit.org/show_bug.cgi?id=214623 Reviewed by Brady Eidson. I need to make CertificateInfo::isolatedCopy and this class was making it messy. It has no shared functionality, so I removed it. * Headers.cmake: * WebCore.xcodeproj/project.pbxproj: * inspector/agents/InspectorNetworkAgent.cpp: (WebCore::InspectorNetworkAgent::buildObjectForResourceResponse): * platform/network/CertificateInfoBase.h: Removed. * platform/network/CertificateSummary.h: Copied from Source/WebCore/platform/network/CertificateInfoBase.h. (WebCore::CertificateInfoBase::containsNonRootSHA1SignedCertificate const): Deleted. (WebCore::CertificateInfoBase::summaryInfo const): Deleted. (WebCore::CertificateInfoBase::isEmpty const): Deleted. * platform/network/cf/CertificateInfo.h: * platform/network/cf/CertificateInfoCFNet.cpp: (WebCore::CertificateInfo::summary const): (WebCore::CertificateInfo::summaryInfo const): Deleted. * platform/network/curl/CertificateInfo.h: * platform/network/soup/CertificateInfo.h: (WebCore::CertificateInfo::summary const): (WebCore::CertificateInfo::summaryInfo const): Deleted. 2020-07-21 Jer Noble <jer.noble@apple.com> [Cocoa] Add experimental MSE WebM parser https://bugs.webkit.org/show_bug.cgi?id=214529 Reviewed by Eric Carlson. Test: media/media-source/media-source-webm.html Add an experimental MSE WebM parser to SourceBufferPrivateAVFObjC. This will require extensive refactoring of SourceBufferPrivateAVFObjC, to extract out the parser into a new, virtualized class. This new parser can take advantage of new C++>11 features such as lambdas to clean up some problematic existing code. The new virtualized SourceBufferParser class uses passed-in Function objects, rather than pure-virtual Client classes to notify it's parent object when the parser encounters initialization- or media-data. Because SourceBufferPrivateAVFObjC will now have to deal with AudioTrackPrivate and VideoTrackPrivate objects that are not necessarily Audio- and VideoTrackPrivateMediaSourceAVFObjC subclasses, move those classes notification features up into Audio- and VideoTrackPrivate, again using a Function object rather than a client class. Add a new SourceBufferParserWebM and associated AudioTrackPrivateWebM and VideoTrackPrivateWebM classes, which use libwebm via libwebrtc to parse appended buffers. SourceBufferParserWebM feeds passed-in data into a libwebm-provided parser of its own. It then builds up tracks and samples based on callbacks from that same parser, constructing CMSampleBuffers and VideoTrackPrivate objects out of the underlying libwebm primitives. Because WebM uses a UUID as its track identifier, the representation of a "trackID" inside WebCore must be increased from an int to a uint64_t, or trackIDs will be truncated or zeroed when passed between classes and when converted to and from AtomStrings. This early implementation is not yet able to pass the WebM WPT media-source/ tests, as we only have a VP9 decoder available, and those tests use both VP8 and Vorbis. * SourcesCocoa.txt: * WebCore.xcodeproj/project.pbxproj: * page/RuntimeEnabledFeatures.h: (WebCore::RuntimeEnabledFeatures::setWebMParserEnabled): (WebCore::RuntimeEnabledFeatures::webMParserEnabled const): * platform/graphics/AudioTrackPrivate.h: (WebCore::AudioTrackPrivate::setEnabled): (WebCore::AudioTrackPrivate::setEnabledChangedCallback): * platform/graphics/VP9Utilities.cpp: (WebCore::isValidVPColorPrimaries): (WebCore::isValidVPTransferCharacteristics): (WebCore::isValidVPMatrixCoefficients): (WebCore::parseVPCodecParameters): * platform/graphics/VP9Utilities.h: * platform/graphics/VideoTrackPrivate.h: (WebCore::VideoTrackPrivate::setSelected): (WebCore::VideoTrackPrivate::setSelectedChangedCallback): * platform/graphics/avfoundation/objc/AudioTrackPrivateMediaSourceAVFObjC.cpp: (WebCore::AudioTrackPrivateMediaSourceAVFObjC::AudioTrackPrivateMediaSourceAVFObjC): (WebCore::AudioTrackPrivateMediaSourceAVFObjC::setEnabled): * platform/graphics/avfoundation/objc/AudioTrackPrivateMediaSourceAVFObjC.h: * platform/graphics/avfoundation/objc/CDMSessionAVContentKeySession.mm: (WebCore::CDMSessionAVContentKeySession::update): * platform/graphics/avfoundation/objc/CDMSessionAVStreamSession.mm: (WebCore::CDMSessionAVStreamSession::update): * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm: (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::supportsType): * platform/graphics/avfoundation/objc/MediaSampleAVFObjC.h: (WebCore::MediaSampleAVFObjC::create): (WebCore::MediaSampleAVFObjC::MediaSampleAVFObjC): * platform/graphics/avfoundation/objc/MediaSourcePrivateAVFObjC.mm: (WebCore::MediaSourcePrivateAVFObjC::addSourceBuffer): * platform/graphics/avfoundation/objc/SourceBufferParserAVFObjC.h: Added. (isType): * platform/graphics/avfoundation/objc/SourceBufferParserAVFObjC.mm: Added. (-[WebAVStreamDataParserListener initWithParser:parent:]): (-[WebAVStreamDataParserListener dealloc]): (-[WebAVStreamDataParserListener invalidate]): (-[WebAVStreamDataParserListener streamDataParser:didParseStreamDataAsAsset:]): (-[WebAVStreamDataParserListener streamDataParser:didParseStreamDataAsAsset:withDiscontinuity:]): (-[WebAVStreamDataParserListener streamDataParser:didFailToParseStreamDataWithError:]): (-[WebAVStreamDataParserListener streamDataParser:didProvideMediaData:forTrackID:mediaType:flags:]): (-[WebAVStreamDataParserListener streamDataParserWillProvideContentKeyRequestInitializationData:forTrackID:]): (-[WebAVStreamDataParserListener streamDataParser:didProvideContentKeyRequestInitializationData:forTrackID:]): (WebCore::SourceBufferParserAVFObjC::isContentTypeSupported): (WebCore::SourceBufferParserAVFObjC::SourceBufferParserAVFObjC): (WebCore::SourceBufferParserAVFObjC::~SourceBufferParserAVFObjC): (WebCore::SourceBufferParserAVFObjC::appendData): (WebCore::SourceBufferParserAVFObjC::flushPendingMediaData): (WebCore::SourceBufferParserAVFObjC::setShouldProvideMediaDataForTrackID): (WebCore::SourceBufferParserAVFObjC::shouldProvideMediadataForTrackID): (WebCore::SourceBufferParserAVFObjC::resetParserState): (WebCore::SourceBufferParserAVFObjC::didParseStreamDataAsAsset): (WebCore::SourceBufferParserAVFObjC::didFailToParseStreamDataWithError): (WebCore::SourceBufferParserAVFObjC::didProvideMediaDataForTrackID): (WebCore::SourceBufferParserAVFObjC::willProvideContentKeyRequestInitializationDataForTrackID): (WebCore::SourceBufferParserAVFObjC::didProvideContentKeyRequestInitializationDataForTrackID): * platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.h: * platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm: (WebCore::SourceBufferPrivateAVFObjC::create): (WebCore::SourceBufferPrivateAVFObjC::SourceBufferPrivateAVFObjC): (WebCore::SourceBufferPrivateAVFObjC::~SourceBufferPrivateAVFObjC): (WebCore::SourceBufferPrivateAVFObjC::didParseInitializationData): (WebCore::SourceBufferPrivateAVFObjC::didEncounterErrorDuringParsing): (WebCore::SourceBufferPrivateAVFObjC::didProvideMediaDataForTrackID): (WebCore::SourceBufferPrivateAVFObjC::willProvideContentKeyRequestInitializationDataForTrackID): (WebCore::SourceBufferPrivateAVFObjC::didProvideContentKeyRequestInitializationDataForTrackID): (WebCore::SourceBufferPrivateAVFObjC::append): (WebCore::SourceBufferPrivateAVFObjC::appendCompleted): (WebCore::SourceBufferPrivateAVFObjC::abort): (WebCore::SourceBufferPrivateAVFObjC::resetParserState): (WebCore::SourceBufferPrivateAVFObjC::destroyParser): (WebCore::SourceBufferPrivateAVFObjC::clearTracks): (WebCore::SourceBufferPrivateAVFObjC::hasSelectedVideo const): (WebCore::SourceBufferPrivateAVFObjC::trackDidChangeSelected): (WebCore::SourceBufferPrivateAVFObjC::trackDidChangeEnabled): (WebCore::SourceBufferPrivateAVFObjC::parser const): (WebCore::SourceBufferPrivateAVFObjC::attemptToDecrypt): (WebCore::SourceBufferPrivateAVFObjC::flush): (WebCore::SourceBufferPrivateAVFObjC::enqueueSample): (WebCore::SourceBufferPrivateAVFObjC::isReadyForMoreSamples): (WebCore::SourceBufferPrivateAVFObjC::didBecomeReadyForMoreSamples): (WebCore::SourceBufferPrivateAVFObjC::notifyClientWhenReadyForMoreSamples): (WebCore::SourceBufferPrivateAVFObjC::canSetMinimumUpcomingPresentationTime const): * platform/graphics/avfoundation/objc/VideoTrackPrivateMediaSourceAVFObjC.h: * platform/graphics/avfoundation/objc/VideoTrackPrivateMediaSourceAVFObjC.mm: (WebCore::VideoTrackPrivateMediaSourceAVFObjC::VideoTrackPrivateMediaSourceAVFObjC): * platform/graphics/cocoa/AudioTrackPrivateWebM.cpp: Copied from Source/WebCore/platform/graphics/cocoa/VP9UtilitiesCocoa.h. (WebCore::AudioTrackPrivateWebM::create): (WebCore::AudioTrackPrivateWebM::AudioTrackPrivateWebM): (WebCore::AudioTrackPrivateWebM::id const): (WebCore::AudioTrackPrivateWebM::label const): (WebCore::AudioTrackPrivateWebM::language const): (WebCore::AudioTrackPrivateWebM::trackIndex const): * platform/graphics/cocoa/AudioTrackPrivateWebM.h: Copied from Source/WebCore/platform/graphics/cocoa/VP9UtilitiesCocoa.h. * platform/graphics/cocoa/SourceBufferParser.cpp: Copied from Source/WebCore/platform/graphics/cocoa/VP9UtilitiesCocoa.h. (WebCore::SourceBufferParser::isContentTypeSupported): (WebCore::SourceBufferParser::create): * platform/graphics/cocoa/SourceBufferParser.h: Added. (WebCore::SourceBufferParser::setDidParseInitializationDataCallback): (WebCore::SourceBufferParser::setDidEncounterErrorDuringParsingCallback): (WebCore::SourceBufferParser::setDidProvideMediaDataCallback): (WebCore::SourceBufferParser::setWillProvideContentKeyRequestInitializationDataForTrackIDCallback): (WebCore::SourceBufferParser::setDidProvideContentKeyRequestInitializationDataForTrackIDCallback): * platform/graphics/cocoa/SourceBufferParserWebM.cpp: Added. (WebCore::isWebmParserAvailable): (WebCore::SourceBufferParserWebM::isContentTypeSupported): (WebCore::SourceBufferParserWebM::SourceBufferParserWebM): (WebCore::SourceBufferParserWebM::appendData): (WebCore::SourceBufferParserWebM::flushPendingMediaData): (WebCore::SourceBufferParserWebM::setShouldProvideMediaDataForTrackID): (WebCore::SourceBufferParserWebM::shouldProvideMediadataForTrackID): (WebCore::SourceBufferParserWebM::resetParserState): (WebCore::SourceBufferParserWebM::trackDataForTrackNumber): (WebCore::SourceBufferParserWebM::OnElementBegin): (WebCore::SourceBufferParserWebM::OnEbml): (WebCore::SourceBufferParserWebM::OnSegmentBegin): (WebCore::SourceBufferParserWebM::OnInfo): (WebCore::SourceBufferParserWebM::OnClusterBegin): (WebCore::SourceBufferParserWebM::OnTrackEntry): (WebCore::SourceBufferParserWebM::OnBlockBegin): (WebCore::SourceBufferParserWebM::OnBlockEnd): (WebCore::SourceBufferParserWebM::OnSimpleBlockBegin): (WebCore::SourceBufferParserWebM::OnSimpleBlockEnd): (WebCore::SourceBufferParserWebM::OnBlockGroupBegin): (WebCore::SourceBufferParserWebM::OnBlockGroupEnd): (WebCore::convertToColorPrimaries): (WebCore::convertToTransferCharacteristics): (WebCore::convertToMatrixCoefficients): (WebCore::convertSubsamplingXYToChromaSubsampling): (WebCore::createFormatDescriptionFromVP9HeaderParser): (WebCore::SourceBufferParserWebM::OnFrame): * platform/graphics/cocoa/SourceBufferParserWebM.h: Added. (WebCore::SourceBufferParserWebM::status const): (WebCore::SourceBufferParserWebM::type const): (isType): * platform/graphics/cocoa/VP9UtilitiesCocoa.h: * platform/graphics/cocoa/VP9UtilitiesCocoa.mm: (WebCore::isVP9DecoderAvailable): (WebCore::validateVPParameters): * platform/graphics/cocoa/VideoTrackPrivateWebM.cpp: (WebCore::VideoTrackPrivateWebM::create): (WebCore::VideoTrackPrivateWebM::VideoTrackPrivateWebM): (WebCore::VideoTrackPrivateWebM::id const): (WebCore::VideoTrackPrivateWebM::label const): (WebCore::VideoTrackPrivateWebM::language const): (WebCore::VideoTrackPrivateWebM::trackIndex const): * platform/graphics/cocoa/VideoTrackPrivateWebM.h: 2020-07-21 Peng Liu <peng.liu6@apple.com> Safari is unresponsive after playing a video of youtube.com playlist in picture-in-picture mode https://bugs.webkit.org/show_bug.cgi?id=214616 Reviewed by Eric Carlson. Remove the function setPreparedToReturnVideoLayerToInline() from MediaControlsHost.idl and replace all the calls to that function in Javascript code with a call in HTMLVideoElement::fullscreenModeChanged(). Calling setPreparedToReturnVideoLayerToInline() in the Javascript code of modern media controls can be problematic because the host object might have been destroyed when the webkitpresentationmodechanged event is fired. During the exit fullscreen/picture-in-picture transaction, missing a call to setPreparedToReturnVideoLayerToInline() will block the transaction, and the UI process will be stuck in a bad state. * Modules/mediacontrols/MediaControlsHost.cpp: (WebCore::MediaControlsHost::setPreparedToReturnVideoLayerToInline): Deleted. * Modules/mediacontrols/MediaControlsHost.h: * Modules/mediacontrols/MediaControlsHost.idl: * Modules/mediacontrols/mediaControlsApple.js: (Controller.prototype.handlePresentationModeChange): * Modules/modern-media-controls/media/media-controller.js: (MediaController.prototype.handleEvent): (MediaController.prototype._returnMediaLayerToInlineIfNeeded): Deleted. * html/HTMLVideoElement.cpp: (WebCore::HTMLVideoElement::fullscreenModeChanged): 2020-07-21 Tim Horton <timothy_horton@apple.com> REGRESSION (WebSQL disablement): Fudget app is unresponsive on launch https://bugs.webkit.org/show_bug.cgi?id=214620 <rdar://problem/65443085> Reviewed by Geoffrey Garen. * platform/RuntimeApplicationChecks.h: * platform/cocoa/RuntimeApplicationChecksCocoa.mm: (WebCore::IOSApplication::isFudget): 2020-07-21 Michael Catanzaro <mcatanzaro@gnome.org> Update Chrome and Firefox versions in user agent quirks https://bugs.webkit.org/show_bug.cgi?id=214595 Reviewed by Adrian Perez de Castro. * platform/UserAgentQuirks.cpp: (WebCore::UserAgentQuirks::stringForQuirk): 2020-07-21 Yusuke Suzuki <ysuzuki@apple.com> Use CatchScope in microtask execution https://bugs.webkit.org/show_bug.cgi?id=214600 <rdar://problem/65881165> Reviewed by Mark Lam. Test: js/dom/microtask-drain-should-use-catch-scope.html Use CatchScope to suppress JSC_validateExceptionChecks. * bindings/js/JSMicrotaskCallback.h: (WebCore::JSMicrotaskCallback::call): 2020-07-21 Eric Carlson <eric.carlson@apple.com> Use AVRoutePickerView when available for choosing AirPlay devices https://bugs.webkit.org/show_bug.cgi?id=213497 <rdar://problem/58610662> Reviewed by Jer Noble. Use an AVRoutePickerView, the replacement for AVOutputDeviceMenuController, when it is available to allow a user to pick an AirPlay device. To do this, create an AVPlaybackTargetPicker abstract base and create a concrete class from the AVOutputDeviceMenuController-specific code from MediaPlaybackTargetPickerMac, and create a new concrete class using AVRoutePickerView. Tested manually because these changes require an AirPlay device. * Modules/mediasession/WebMediaSessionManager.cpp: (WebCore::WebMediaSessionManager::showPlaybackTargetPicker): Pass the view to the target picker. * Modules/mediasession/WebMediaSessionManagerClient.h: * Modules/remoteplayback/RemotePlayback.cpp: (WebCore::RemotePlayback::playbackTargetPickerWasDismissed): Drive-by fix: return early if there are no pending promises. * SourcesCocoa.txt: Add new files. * WebCore.xcodeproj/project.pbxproj: Ditto. * platform/graphics/MediaPlaybackTargetPicker.cpp: (WebCore::MediaPlaybackTargetPicker::showPlaybackTargetPicker): Add new parameter. * platform/graphics/MediaPlaybackTargetPicker.h: * platform/graphics/avfoundation/objc/AVOutputDeviceMenuControllerTargetPicker.h: Copied from Source/WebCore/platform/graphics/avfoundation/objc/MediaPlaybackTargetPickerMac.h. * platform/graphics/avfoundation/objc/AVOutputDeviceMenuControllerTargetPicker.mm: Copied from Source/WebCore/platform/graphics/avfoundation/objc/MediaPlaybackTargetPickerMac.mm. (WebCore::AVOutputDeviceMenuControllerTargetPicker::AVOutputDeviceMenuControllerTargetPicker): (WebCore::AVOutputDeviceMenuControllerTargetPicker::~AVOutputDeviceMenuControllerTargetPicker): (WebCore::AVOutputDeviceMenuControllerTargetPicker::devicePicker): (WebCore::AVOutputDeviceMenuControllerTargetPicker::availableDevicesDidChange): (WebCore::AVOutputDeviceMenuControllerTargetPicker::currentDeviceDidChange): (WebCore::AVOutputDeviceMenuControllerTargetPicker::showPlaybackTargetPicker): (WebCore::AVOutputDeviceMenuControllerTargetPicker::startingMonitoringPlaybackTargets): (WebCore::AVOutputDeviceMenuControllerTargetPicker::stopMonitoringPlaybackTargets): (WebCore::AVOutputDeviceMenuControllerTargetPicker::invalidatePlaybackTargets): (WebCore::AVOutputDeviceMenuControllerTargetPicker::externalOutputDeviceAvailable): (WebCore::AVOutputDeviceMenuControllerTargetPicker::outputContext): (-[WebAVOutputDeviceMenuControllerHelper initWithCallback:]): (-[WebAVOutputDeviceMenuControllerHelper clearCallback]): (-[WebAVOutputDeviceMenuControllerHelper observeValueForKeyPath:ofObject:change:context:]): * platform/graphics/avfoundation/objc/AVPlaybackTargetPicker.h: Added. (WebCore::AVPlaybackTargetPicker::AVPlaybackTargetPicker): (WebCore::AVPlaybackTargetPicker::client const): * platform/graphics/avfoundation/objc/AVRoutePickerViewTargetPicker.h: Added. * platform/graphics/avfoundation/objc/AVRoutePickerViewTargetPicker.mm: Added. (WebCore::AVRoutePickerViewTargetPicker::isAvailable): (WebCore::AVRoutePickerViewTargetPicker::AVRoutePickerViewTargetPicker): (WebCore::AVRoutePickerViewTargetPicker::~AVRoutePickerViewTargetPicker): (WebCore::AVRoutePickerViewTargetPicker::outputContextInternal): (WebCore::AVRoutePickerViewTargetPicker::devicePicker): (WebCore::AVRoutePickerViewTargetPicker::routeDetector): (WebCore::AVRoutePickerViewTargetPicker::showPlaybackTargetPicker): (WebCore::AVRoutePickerViewTargetPicker::startingMonitoringPlaybackTargets): (WebCore::AVRoutePickerViewTargetPicker::stopMonitoringPlaybackTargets): (WebCore::AVRoutePickerViewTargetPicker::externalOutputDeviceAvailable): (WebCore::AVRoutePickerViewTargetPicker::outputContext): (WebCore::AVRoutePickerViewTargetPicker::invalidatePlaybackTargets): (WebCore::AVRoutePickerViewTargetPicker::availableDevicesDidChange): (WebCore::AVRoutePickerViewTargetPicker::currentDeviceDidChange): (WebCore::AVRoutePickerViewTargetPicker::devicePickerWasDismissed): (-[WebAVRoutePickerViewHelper initWithCallback:]): (-[WebAVRoutePickerViewHelper dealloc]): (-[WebAVRoutePickerViewHelper clearCallback]): (-[WebAVRoutePickerViewHelper routePickerViewDidEndPresentingRoutes:]): (-[WebAVRoutePickerViewHelper notificationHandler:]): * platform/graphics/avfoundation/objc/MediaPlaybackTargetPickerMac.h: * platform/graphics/avfoundation/objc/MediaPlaybackTargetPickerMac.mm: (WebCore::MediaPlaybackTargetPickerMac::MediaPlaybackTargetPickerMac): (WebCore::MediaPlaybackTargetPickerMac::~MediaPlaybackTargetPickerMac): (WebCore::MediaPlaybackTargetPickerMac::externalOutputDeviceAvailable): (WebCore::MediaPlaybackTargetPickerMac::playbackTarget): (WebCore::MediaPlaybackTargetPickerMac::routePicker): (WebCore::MediaPlaybackTargetPickerMac::showPlaybackTargetPicker): (WebCore::MediaPlaybackTargetPickerMac::startingMonitoringPlaybackTargets): (WebCore::MediaPlaybackTargetPickerMac::stopMonitoringPlaybackTargets): (WebCore::MediaPlaybackTargetPickerMac::invalidatePlaybackTargets): (WebCore::MediaPlaybackTargetPickerMac::pickerWasDismissed): (WebCore::MediaPlaybackTargetPickerMac::availableDevicesChanged): (WebCore::MediaPlaybackTargetPickerMac::currentDeviceChanged): (WebCore::MediaPlaybackTargetPickerMac::devicePicker): Deleted. (-[WebAVOutputDeviceMenuControllerHelper initWithCallback:]): Deleted. (-[WebAVOutputDeviceMenuControllerHelper clearCallback]): Deleted. (-[WebAVOutputDeviceMenuControllerHelper observeValueForKeyPath:ofObject:change:context:]): Deleted. * platform/mock/MediaPlaybackTargetPickerMock.cpp: (WebCore::MediaPlaybackTargetPickerMock::showPlaybackTargetPicker): * platform/mock/MediaPlaybackTargetPickerMock.h: 2020-07-21 James Darpinian <jdarpinian@chromium.org> webgl/2.0.0/conformance2/state/gl-object-get-calls.html results appears to show an out of bounds access bug. https://bugs.webkit.org/show_bug.cgi?id=214557 Reviewed by Myles C. Maxfield. The WebGL 2 function getActiveUniformBlockName was accidentally untested because an unrelated bug caused the test to exit before reaching the part that tested it. The other bug is fixed now, and this change fixes getActiveUniformBlockName to actually work. * html/canvas/WebGL2RenderingContext.cpp: (WebCore::WebGL2RenderingContext::getActiveUniformBlockName): * platform/graphics/GraphicsContextGL.h: * platform/graphics/angle/GraphicsContextGLANGLE.cpp: (WebCore::GraphicsContextGLOpenGL::getActiveUniformBlockName): * platform/graphics/opengl/GraphicsContextGLOpenGL.h: * platform/graphics/opengl/GraphicsContextGLOpenGLCommon.cpp: (WebCore::GraphicsContextGLOpenGL::getActiveUniformBlockName): 2020-07-21 Sihui Liu <sihui_liu@appe.com> REGRESSION(r264486): ASSERTION FAILED: ASSERT_NOT_REACHED() in NetworkProcessPlatformStrategies::createBlobRegistry https://bugs.webkit.org/show_bug.cgi?id=214425 Reviewed by Youenn Fablet. In SerializedScriptValue.cpp, some kind of wrappers will not be created when global object is not JSDOMGlobalObject, so they would not be created for IDB before r264486. After r264486, IDB uses JSIDBSerializationGlobalObject, which is JSDOMGlobalObject, so those wrappers start to be created. To restore the old behavior, adding checks for JSIDBSerializationGlobalObject in SerializedScriptValue.cpp. Modify and re-enable test: LayoutTests/storage/indexeddb/structured-clone.html * bindings/js/SerializedScriptValue.cpp: (WebCore::CloneDeserializer::CloneDeserializer): (WebCore::CloneDeserializer::readFile): (WebCore::CloneDeserializer::readRTCCertificate): (WebCore::CloneDeserializer::readTerminal): 2020-07-21 Jer Noble <jer.noble@apple.com> [Cocoa] Adopt VTRegisterSupplementalVideoDecoderIfAvailable https://bugs.webkit.org/show_bug.cgi?id=214585 <rdar://problem/65863651> Reviewed by Youenn Fablet. * WebCore.xcodeproj/project.pbxproj: * platform/cocoa/VideoToolboxSoftLink.cpp: * platform/cocoa/VideoToolboxSoftLink.h: * platform/graphics/cocoa/VP9UtilitiesCocoa.h: * platform/graphics/cocoa/VP9UtilitiesCocoa.mm: (WebCore::registerSupplementalVP9Decoder): 2020-07-21 Zalan Bujtas <zalan@apple.com> [UI Events] Make mousemove cancelable https://bugs.webkit.org/show_bug.cgi?id=214513 <rdar://problem/64267520> Reviewed by Simon Fraser. This patch makes the mousemove event cancelable. The event was initially specified to be non-cancelable in DOM Level 2 Events, but was changed to reflect existing interoperability between browsers. The most user facing behavior change here is that when the mousemove event is prevent-defaulted (canceled) content selection is not possible. Chrome is aligned with the latest version of the spec, the mousemove event is cancelable. However they also have a TODO right at where the drag would happen: // TODO(crbug.com/346473): Since there is no default action for the mousemove // event we should consider doing drag&drop even when js cancels the // mouse move event. Firefox preforms the drag(select) operation but not sure if it’s because their mousemove event is still non-cancelable or whether they already went ahead with what the TODO says. Test: fast/text/selection-is-prevent-defaulted.html * dom/MouseEvent.cpp: (WebCore::MouseEvent::create): 2020-07-21 Clark Wang <clark_wang@apple.com> Added OfflineAudioContext constructor https://bugs.webkit.org/show_bug.cgi?id=214577 Reviewed by Chris Dumez. Added OfflineAudioContext constructor and OfflineAudioContextOptions files. Re-baselined existing tests. Lots of failures that fail because of unsupported sampleRate range. * CMakeLists.txt: * DerivedSources-input.xcfilelist: * DerivedSources-output.xcfilelist: * DerivedSources.make: * Modules/webaudio/OfflineAudioContext.cpp: (WebCore::OfflineAudioContext::create): * Modules/webaudio/OfflineAudioContext.h: * Modules/webaudio/OfflineAudioContext.idl: * Modules/webaudio/OfflineAudioContextOptions.h: Added. * Modules/webaudio/OfflineAudioContextOptions.idl: Added. * Sources.txt: * WebCore.xcodeproj/project.pbxproj: 2020-07-21 Rob Buis <rbuis@igalia.com> Make AnyStepHandling an enum class https://bugs.webkit.org/show_bug.cgi?id=214423 Reviewed by Darin Adler. Correct some post commit comments. * html/HTMLInputElement.h: * html/InputType.h: * html/StepRange.h: 2020-07-21 Xabier Rodriguez Calvar <calvaris@igalia.com> [GStreamer][1.18] mediastreamsrc element hits assert in gst -core https://bugs.webkit.org/show_bug.cgi?id=214150 Reviewed by Philippe Normand. Removed track pointers from observers cause the object was self-referencing a couple of times. Observers are 1-1 with the source so there is no need to keep an owned reference and there is no danger of incorrect dereferencing. Turned finalize into dispose as the work is doing is more removing the references with other objects, which what the dispose is about. Called the parent on that, which as missing as well. * platform/mediastream/gstreamer/GStreamerMediaStreamSource.cpp: (WebKitMediaStreamTrackObserver::WebKitMediaStreamTrackObserver): (WebKitMediaStreamObserver::WebKitMediaStreamObserver): (webkitMediaStreamSrcConstructed): (webkitMediaStreamSrcDispose): (webkit_media_stream_src_class_init): 2020-07-21 Carlos Garcia Campos <cgarcia@igalia.com> [FreeType] Add support for text-underline-offset and text-decoration-thickness https://bugs.webkit.org/show_bug.cgi?id=214550 Reviewed by Adrian Perez de Castro. Get the underline position and thickness from the font if it's scalable and set them in font metrics. * platform/graphics/freetype/SimpleFontDataFreeType.cpp: (WebCore::scaledFontScaleFactor): (WebCore::fontUnitsPerEm): (WebCore::Font::platformInit): 2020-07-21 Carlos Garcia Campos <cgarcia@igalia.com> [GTK][WPE] imported blink large gradient tests are crashing on debug builds https://bugs.webkit.org/show_bug.cgi?id=214192 Reviewed by Žan Doberšek. The assert is: ASSERT(cairo_surface_status(m_surface.get()) == CAIRO_STATUS_SUCCESS); and the status we are getting is CAIRO_STATUS_INVALID_SIZE, because we are reaching the cairo image size limit. We should check the size before trying to create the image surface. This patch fixes the crash, but not the tests themselves that will still fail due to the cairo limitation. * platform/graphics/cairo/ImageBufferCairoImageSurfaceBackend.cpp: (WebCore::ImageBufferCairoImageSurfaceBackend::create): Return early if the image size is bigger than the maximum allowed by cairo. 2020-07-20 Alex Christensen <achristensen@webkit.org> Revert r262776 for existing apps using UIWebView/WebView https://bugs.webkit.org/show_bug.cgi?id=214528 <rdar://problem/65468982> Reviewed by Tim Horton. r262776 removed Content-Type: application/x-www-form-urlencoded from POST requests with unspecified content type. This matches the behavior of Chrome, Firefox, and WKWebView and is a change we want to make. This doesn't match behavior of iOS 13 UIWebView, though, and given its state of being supported for compatibility until removed, we are going to keep it behaving as it always has. Updated WK1 test expectations. * platform/network/mac/WebCoreResourceHandleAsOperationQueueDelegate.mm: (-[WebCoreResourceHandleAsOperationQueueDelegate connection:willSendRequest:redirectResponse:]): 2020-07-20 Peng Liu <peng.liu6@apple.com> An airplaying video can enter picture-in-picture https://bugs.webkit.org/show_bug.cgi?id=214556 Reviewed by Eric Carlson. WebAVPlayerController replaces the AVPlayerController used by AVKit. Its property "pictureInPicturePossible" will always be YES after VideoFullscreenInterfaceAVKit::doSetup() sets it, even after the video enters picture-in-picture. This patch fixes the issue by checking whether the video is airplaying (isExternalPlaybackActive) in -[WebAVPlayerController isPictureInPicturePossible]. AVPlayerController has the logic to change the property "pictureInPicturePossible" to NO after a video enters picture-in-picture, but we cannot use AVPlayerController's value of "pictureInPicturePossible" as the property value of WebAVPlayerController. Because the value of "-[AVPlayerController isPictureInPicturePossible]" depends on the value of "[[AVAudioSession sharedInstance] isPiPAvailable]", which is always NO in the UI process. (AVAudioSession related code is in the web process). * platform/ios/VideoFullscreenInterfaceAVKit.mm: (VideoFullscreenInterfaceAVKit::doSetup): * platform/ios/WebAVPlayerController.h: * platform/ios/WebAVPlayerController.mm: (-[WebAVPlayerController setAllowsPictureInPicture:]): (-[WebAVPlayerController isPictureInPicturePossible]): 2020-07-20 Megan Gardner <megan_gardner@apple.com> Add OK button to Date/Time form controls. https://bugs.webkit.org/show_bug.cgi?id=214195 Reviewed by Darin Adler. * en.lproj/Localizable.strings: 2020-07-20 Geoffrey Garen <ggaren@apple.com> REGRESSION (r264242): [ macOS ] imported/w3c/web-platform-tests/wasm/jsapi/constructor/instantiate.any.html is a flaky crash https://bugs.webkit.org/show_bug.cgi?id=214572 Unreviewed, reverting r264242. * bindings/js/CommonVM.cpp: (WebCore::commonVMSlow): 2020-07-20 Adrian Perez de Castro <aperez@igalia.com> Non unified build fixes, midsummer 2020 edition https://bugs.webkit.org/show_bug.cgi?id=213616 Unreviewed build fix. No new tests needed. * inspector/InspectorInstrumentationWebKit.h: Forward-declare ResourceLoader class. 2020-07-20 Wenson Hsieh <wenson_hsieh@apple.com> REGRESSION (r261874): Typing near the bottom of a scrollable document causes the scroll position to jump https://bugs.webkit.org/show_bug.cgi?id=214426 <rdar://problem/65302701> Reviewed by Simon Fraser. After the changes in r261874, any content size changes that trigger `FrameView::adjustViewSize` cause the scroll position to be clamped to its minimum and maximum limits after the next layout pass. In the context of edit commands, this means that the scroll position may jump erratically, since many edit commands can temporarily leave the DOM in a state where the content size is unstable. For example, in the test case below, deleting the only character in a div element on its own line first involves emptying the text node underneath the div (causing it to have no height), before inserting a BR element in its place (which restores a nonzero height). After the text node is emptied (but before we insert the BR element), the content size of view changes due to a layout update while creating visible positions (under `VisiblePosition::canonicalPosition`). If we happen to be scrolled all the way to the bottom of the main frame, this means we'll scroll up, due to the maximum scroll position temporarily decreasing. A similar effect happens when inserting the first character on a line, wherein the div is empty after BR element is removed but before it is replaced with a text node. To mitigate this, introduce a mechanism to temporarily avoid updating the scroll position, and use it when executing edit commands. See below for more details. Test: editing/execCommand/typing-should-not-trigger-scrolling-when-selection-is-visible.html * editing/CompositeEditCommand.cpp: (WebCore::EditCommandComposition::unapply): (WebCore::EditCommandComposition::reapply): (WebCore::CompositeEditCommand::apply): * editing/Editor.cpp: (WebCore::Editor::willApplyEditing const): (WebCore::Editor::appliedEditing): Add logic to specifically handle typing commands here, since we handle typing commands by adding them to the latest "open" typing command, rather than go through the more standard codepaths in EditCommandComposition above. * editing/Editor.h: * page/FrameView.cpp: (WebCore::FrameView::reset): (WebCore::FrameView::topContentDirectionDidChange): (WebCore::FrameView::handleDeferredScrollbarsUpdate): (WebCore::FrameView::handleDeferredPositionScrollbarLayers): Split existing logic for handling deferred scrollbar updates and deferred calls to `positionScrollbarLayers` into two separate methods, with separate boolean flags. `topContentDirectionDidChange` sets both of these flags (which preserves existing behavior), while `decrementProhibitsScrollingWhenChangingContentSizeCount` just requests a scrollbar update. (WebCore::FrameView::didLayout): (WebCore::FrameView::didFinishProhibitingScrollingWhenChangingContentSize): After decrementing `m_prohibitsScrollingWhenChangingContentSizeCount` back to zero, ensure that the scroll position ultimately remains clamped to the minimum and maximum values by either immediately calling `updateScrollbars` with the current scroll position if layout and style are up to date, or by scheduling a deferred scrollbar update if that is not the case. (WebCore::FrameView::handleDeferredScrollbarsUpdateAfterDirectionChange): Deleted. Rename this to just `handleDeferredScrollbarsUpdate`. * page/FrameView.h: * platform/ScrollView.cpp: (WebCore::ScrollView::setContentsSize): (WebCore::ScrollView::prohibitScrollingWhenChangingContentSizeForScope): (WebCore::ScrollView::ProhibitScrollingWhenChangingContentSizeForScope::ProhibitScrollingWhenChangingContentSizeForScope): (WebCore::ScrollView::ProhibitScrollingWhenChangingContentSizeForScope::~ProhibitScrollingWhenChangingContentSizeForScope): Introduce a new token object, `ProhibitScrollingWhenChangingContentSizeForScope`, which increments a count on `ScrollView` when created and decrements the count when destroyed. While this counter is greater than zero, we will avoid scrolling as a result of changing content size. * platform/ScrollView.h: (WebCore::ScrollView::incrementProhibitsScrollingWhenChangingContentSizeCount): (WebCore::ScrollView::decrementProhibitsScrollingWhenChangingContentSizeCount): 2020-07-20 Said Abou-Hallawa <sabouhallawa@apple.com> CSS clip-path is applied to the <svg> root element in the view-box coordinates https://bugs.webkit.org/show_bug.cgi?id=214418 Reviewed by Darin Adler. We need to transfer the bounding box of the SVG element renderer from the SVG coordinates system to the CSS coordinates before calculating the clip path. Then we need to transfer the clip path back to the SVG coordinates before applying it to the GraphicsContext. The GraphicsContext is already transformed by the localToPrentTransform. Test: svg/in-html/svg-view-box-css-clip-path.html * rendering/svg/SVGRenderSupport.cpp: (WebCore::SVGRenderSupport::clipContextToCSSClippingArea): 2020-07-20 Clark Wang <clark_wang@apple.com> Fixes to match BaseAudioContext.idl to spec https://bugs.webkit.org/show_bug.cgi?id=214487 Reviewed by Chris Dumez. Removed unrestricted keyword from certain attributes and parameters in BaseAudioContext. Changed createPanner to call new PannerNode constructor, removed old PannerNode constructor. Re-baselined existing tests that now pass. * Modules/webaudio/BaseAudioContext.cpp: (WebCore::BaseAudioContext::createPanner): * Modules/webaudio/BaseAudioContext.idl: * Modules/webaudio/PannerNode.cpp: * Modules/webaudio/PannerNode.h: 2020-07-20 Keith Miller <keith_miller@apple.com> Add support for FinalizationRegistries https://bugs.webkit.org/show_bug.cgi?id=199888 Reviewed by Yusuke Suzuki. Refactor things for changing PromiseDeferredTimer to DeferredWorkTimer. Also, add globalObject hook for reporting uncaught exceptions from JSC's runloop callbacks. * bindings/js/JSDOMGlobalObject.cpp: (WebCore::JSDOMGlobalObject::reportUncaughtExceptionAtEventLoop): * bindings/js/JSDOMGlobalObject.h: * bindings/js/JSDOMWindowBase.cpp: (WebCore::JSDOMWindowBase::compileStreaming): (WebCore::JSDOMWindowBase::instantiateStreaming): * bindings/js/JSWorkerGlobalScopeBase.cpp: * bindings/js/JSWorkletGlobalScopeBase.cpp: * bindings/js/WorkerScriptController.cpp: (WebCore::WorkerScriptController::addTimerSetNotification): (WebCore::WorkerScriptController::removeTimerSetNotification): * workers/WorkerRunLoop.cpp: * worklets/WorkletScriptController.cpp: 2020-07-20 Said Abou-Hallawa <sabouhallawa@apple.com> [CG] Flushing ImageBuffer IOSurface cached image can happen when creating an image for encoding only https://bugs.webkit.org/show_bug.cgi?id=214515 <rdar://problem/65735991> Reviewed by Simon Fraser. Drawing an empty rectangle after changing the bytes of the IOSurface was a hack to force CG to regenerate the IOSurface cached image. This hack was added to solve the bug in which we were getting stale data url from the ImageBuffer after calling its putImageData() function. Drawing the ImageBuffer to a GraphicsContext or getting its data url starts by getting a native image from the IOSurface. The stale cached image problem was seen only in getting the data url but when not drawing the ImageBuffer. So to save the cost of flushing the cached image, we will delay doing the empty rectangle hack till toCFData() is called. toCFData() is called for all ImageBuffer data retrieval functions including toDataURL(). This gives a 15% progression to the Images test on MacBookPro15,2 because the Images test does not call toDataURL() so it does not require flushing the IOSurface cached image. It calls getImageData(), alter the image data and then calls putImageData(). * platform/graphics/cg/ImageBufferIOSurfaceBackend.cpp: (WebCore::ImageBufferIOSurfaceBackend::toCFData const): (WebCore::ImageBufferIOSurfaceBackend::putImageData): * platform/graphics/cg/ImageBufferIOSurfaceBackend.h: 2020-07-20 Darin Adler <darin@apple.com> Streamline URLDecomposition::setHash https://bugs.webkit.org/show_bug.cgi?id=214561 Reviewed by Anders Carlsson. * html/URLDecomposition.cpp: (WebCore::URLDecomposition::setHash): No need to cast to StringView since we already have a StringView. Also don't need a local variable. 2020-07-20 Darin Adler <darin@apple.com> [Cocoa] MediaSampleAVFObjC::createImageSample depends on function argument evaluation order https://bugs.webkit.org/show_bug.cgi?id=214560 Reviewed by Anders Carlsson. * platform/graphics/avfoundation/objc/MediaSampleAVFObjC.mm: (WebCore::deallocateVectorBuffer): Renamed from releaseUint8Vector. (WebCore::MediaSampleAVFObjC::createImageSample): Rearranged code so that we don't call both data() and releaseBuffer() on the same vector in the same function call; that isn't safe because the order of argument evaluation is not guaranteed, and so data() could be called after the buffer is released. Also added code to deallocate the buffer if CVPixelBufferCreateWithBytes fails. The old code would have leaked it in that case. Also made some style tweaks to use adoptCF more consistently to handle reference counting, and slightly optimized a loop to only get the array count once. 2020-07-20 Philippe Normand <pnormand@igalia.com> [GStreamer] Add support for canvas captureStream, tests failing since they were added in r213598 https://bugs.webkit.org/show_bug.cgi?id=169811 Reviewed by Darin Adler. Hook captureStream support in GStreamer ports. The only missing bits were: 1. create a MediaSample from a BGRA buffer 2. convert a MediaSample to a RGBA buffer (used only for layout tests) 3. set video width and height tags not only on video capture tracks (tracks created from captureStream are not GStreamer capture device tracks) * html/HTMLCanvasElement.cpp: (WebCore::HTMLCanvasElement::toMediaSample): * platform/graphics/avfoundation/objc/MediaSampleAVFObjC.h: Refactor createImageSample to use unsigned for dimensions. * platform/graphics/avfoundation/objc/MediaSampleAVFObjC.mm: * platform/graphics/gstreamer/MediaSampleGStreamer.cpp: (WebCore::MediaSampleGStreamer::createImageSample): (WebCore::MediaSampleGStreamer::getRGBAImageData const): * platform/graphics/gstreamer/MediaSampleGStreamer.h: * platform/mediastream/gstreamer/GStreamerMediaStreamSource.cpp: (mediaStreamTrackPrivateGetTags): 2020-07-20 Youenn Fablet <youenn@apple.com> GenerateCertificateAsync should be called on signaling thread https://bugs.webkit.org/show_bug.cgi?id=214447 Reviewed by Geoffrey Garen. As per debug assert, GenerateCertificateAsync is expected to be called in the signaling thread. Covered by unskipped test. * Modules/mediastream/libwebrtc/LibWebRTCCertificateGenerator.cpp: (WebCore::LibWebRTCCertificateGenerator::generateCertificate): * platform/mediastream/libwebrtc/LibWebRTCProvider.cpp: (WebCore::LibWebRTCProvider::prepareCertificateGenerator): We can pass generator to a background thread as it is allocated once and does not get freed. * platform/mediastream/libwebrtc/LibWebRTCProvider.h: 2020-07-20 Commit Queue <commit-queue@webkit.org> Unreviewed, reverting r264596. https://bugs.webkit.org/show_bug.cgi?id=214551 hits Debug asserts Reverted changeset: "[GStreamer] Add support for canvas captureStream, tests failing since they were added in r213598" https://bugs.webkit.org/show_bug.cgi?id=169811 https://trac.webkit.org/changeset/264596 2020-07-20 Rob Buis <rbuis@igalia.com> Make AnyStepHandling an enum class https://bugs.webkit.org/show_bug.cgi?id=214423 Reviewed by Youenn Fablet. Make AnyStepHandling an enum class since this is more readable and allows us to have less includes in header files. * html/BaseDateAndTimeInputType.cpp: * html/DateInputType.cpp: * html/DateTimeLocalInputType.cpp: * html/HTMLInputElement.cpp: (WebCore::HTMLInputElement::setupDateTimeChooserParameters): * html/HTMLInputElement.h: * html/InputType.cpp: (WebCore::InputType::rangeUnderflow const): (WebCore::InputType::rangeOverflow const): (WebCore::InputType::minimum const): (WebCore::InputType::maximum const): (WebCore::InputType::isInRange const): (WebCore::InputType::isOutOfRange const): (WebCore::InputType::stepMismatch const): (WebCore::InputType::validationMessage const): (WebCore::InputType::getAllowedValueStep const): (WebCore::InputType::stepUp): (WebCore::InputType::stepUpFromRenderer): * html/InputType.h: * html/MonthInputType.cpp: * html/NumberInputType.cpp: * html/RangeInputType.cpp: (WebCore::RangeInputType::handleKeydownEvent): (WebCore::RangeInputType::fallbackValue const): (WebCore::RangeInputType::sanitizeValue const): * html/StepRange.cpp: (WebCore::StepRange::parseStep): * html/StepRange.h: * html/TimeInputType.cpp: * html/WeekInputType.cpp: * html/shadow/SliderThumbElement.cpp: (WebCore::sliderPosition): (WebCore::SliderThumbElement::setPositionFromPoint): 2020-07-20 Rob Buis <rbuis@igalia.com> Setting URL.hash to '#' should set empty fragment https://bugs.webkit.org/show_bug.cgi?id=214318 Reviewed by Youenn Fablet. Setting URL.hash to '#' should set empty fragment identifier [1], unlike setting it to the empty string which drops the fragment identifier. Behavior matches Chrome and Firefox. [1] https://html.spec.whatwg.org/#dom-hyperlink-hash Test: imported/w3c/web-platform-tests/url/url-setters.html * html/URLDecomposition.cpp: (WebCore::URLDecomposition::setHash): 2020-07-20 Philippe Normand <pnormand@igalia.com> [GStreamer] Add support for canvas captureStream, tests failing since they were added in r213598 https://bugs.webkit.org/show_bug.cgi?id=169811 Reviewed by Darin Adler. Hook captureStream support in GStreamer ports. The only missing bits were: 1. create a MediaSample from a BGRA buffer 2. convert a MediaSample to a RGBA buffer (used only for layout tests) 3. set video width and height tags not only on video capture tracks (tracks created from captureStream are not GStreamer capture device tracks) * html/HTMLCanvasElement.cpp: (WebCore::HTMLCanvasElement::toMediaSample): * platform/graphics/avfoundation/objc/MediaSampleAVFObjC.h: Refactor createImageSample to use unsigned for dimensions. * platform/graphics/avfoundation/objc/MediaSampleAVFObjC.mm: * platform/graphics/gstreamer/MediaSampleGStreamer.cpp: (WebCore::MediaSampleGStreamer::createImageSample): (WebCore::MediaSampleGStreamer::getRGBAImageData const): * platform/graphics/gstreamer/MediaSampleGStreamer.h: * platform/mediastream/gstreamer/GStreamerMediaStreamSource.cpp: (mediaStreamTrackPrivateGetTags): 2020-07-20 Philippe Normand <pnormand@igalia.com> [GStreamer] ImageDecoder hits more Debug ASSERTs https://bugs.webkit.org/show_bug.cgi?id=214191 Reviewed by Xabier Rodriguez-Calvar. Process decoded video samples from the decoder parent thread, in order to guarantee the underlying RefPtrs stored in the ImageDecoderGStreamerSample keep a consistent owning runloop. * platform/graphics/gstreamer/ImageDecoderGStreamer.cpp: (WebCore::ImageDecoderGStreamer::InnerDecoder::connectDecoderPad): (WebCore::ImageDecoderGStreamer::setHasEOS): (WebCore::ImageDecoderGStreamer::notifySample): (WebCore::ImageDecoderGStreamer::InnerDecoder::handleMessage): (WebCore::ImageDecoderGStreamer::pushEncodedData): * platform/graphics/gstreamer/ImageDecoderGStreamer.h: 2020-07-20 Fujii Hironori <Hironori.Fujii@sony.com> Use forward template declarations for ColorComponents instead of including ColorComponents.h https://bugs.webkit.org/show_bug.cgi?id=214540 Reviewed by Darin Adler. * platform/graphics/ColorMatrix.h: * platform/graphics/ColorTypes.h: 2020-07-19 Lauro Moura <lmoura@igalia.com> Unreviewed, fix GTK build in Debian/LTS Like r264279, include functional to provide std::invoke. * platform/graphics/ColorUtilities.h: 2020-07-19 Fujii Hironori <Hironori.Fujii@sony.com> Unreviewed, reverting r264588. It broke Mac port. Reverted changeset: "Use forward template declarations for ColorComponents instead of including ColorComponents.h as much as possible" https://bugs.webkit.org/show_bug.cgi?id=214204 https://trac.webkit.org/changeset/264588 2020-07-19 Fujii Hironori <Hironori.Fujii@sony.com> Use forward template declarations for ColorComponents instead of including ColorComponents.h as much as possible https://bugs.webkit.org/show_bug.cgi?id=214204 <rdar://problem/65414170> Unreviewed follow-up for the review feedback of r264289. * platform/graphics/ColorConversion.cpp: * platform/graphics/ColorMatrix.h: * platform/graphics/ColorTypes.h: * platform/graphics/ColorUtilities.h: 2020-07-19 Fujii Hironori <Hironori.Fujii@sony.com> Unreviewed non-unified source build fix * html/canvas/WebGLSync.cpp: * html/canvas/WebGLSync.h: 2020-07-19 Geoffrey Garen <ggaren@apple.com> There should be only one RunLoop Timer class https://bugs.webkit.org/show_bug.cgi?id=214340 Reviewed by Darin Adler. RunLoop::Timer wins. RunLoopTimer loses. * loader/DocumentLoader.cpp: (WebCore::DocumentLoader::DocumentLoader): (WebCore::DocumentLoader::tryLoadingSubstituteData): (WebCore::DocumentLoader::cancelMainResourceLoad): (WebCore::DocumentLoader::startDataLoadTimer): Deleted. Use RunLoop::dispatch instead of a timer because we have no need to control the time period or to fire more than once. Use an explicit token so that we can still cancel. * loader/DocumentLoader.h: (WebCore::DocumentLoader::DataLoadToken::clear): Added an explicit token class to we can cancel a data load. * loader/ResourceLoader.cpp: (WebCore::ResourceLoader::loadDataURL): page->scheduledRunLoopPairs() is never null; and if it were null, data loads would always fail. * platform/network/DataURLDecoder.cpp: (WebCore::DataURLDecoder::decode): (WebCore::DataURLDecoder::DecodingResultDispatcher::dispatch): Deleted. (WebCore::DataURLDecoder::DecodingResultDispatcher::DecodingResultDispatcher): Deleted. (WebCore::DataURLDecoder::DecodingResultDispatcher::startTimer): Deleted. (WebCore::DataURLDecoder::DecodingResultDispatcher::timerFired): Deleted. No need for two code paths, now that we can just call RunLoop::dispatch. * platform/network/DataURLDecoder.h: 2020-07-19 Sam Weinig <weinig@apple.com> Rename Color::transparent to Color::transparentBlack to more clearly state what it is https://bugs.webkit.org/show_bug.cgi?id=214522 Reviewed by Darin Adler. * accessibility/AccessibilityNodeObject.cpp: (WebCore::AccessibilityNodeObject::colorValue const): * accessibility/AccessibilityObject.h: * css/CSSValuePool.cpp: (WebCore::StaticCSSValuePool::StaticCSSValuePool): (WebCore::CSSValuePool::createColorValue): * editing/EditingStyle.cpp: (WebCore::cssValueToColor): * html/HTMLInputElement.cpp: (WebCore::autoFillStrongPasswordMaskImage): * html/InputType.cpp: (WebCore::InputType::valueAsColor const): * html/canvas/CanvasRenderingContext2DBase.cpp: (WebCore::CanvasRenderingContext2DBase::State::State): (WebCore::CanvasRenderingContext2DBase::clearRect): (WebCore::CanvasRenderingContext2DBase::setShadow): (WebCore::CanvasRenderingContext2DBase::clearShadow): (WebCore::CanvasRenderingContext2DBase::applyShadow): * inspector/InspectorOverlay.cpp: (WebCore::drawShapeHighlight): * inspector/agents/InspectorDOMAgent.cpp: (WebCore::parseColor): * layout/displaytree/DisplayPainter.cpp: (WebCore::Display::paintBoxDecoration): * page/CaptionUserPreferencesMediaAF.cpp: (WebCore::CaptionUserPreferencesMediaAF::captionsWindowCSS const): * page/DebugPageOverlays.cpp: (WebCore::drawRightAlignedText): * page/FrameSnapshotting.cpp: (WebCore::snapshotNode): * page/FrameView.cpp: (WebCore::FrameView::recalculateBaseBackgroundColor): * page/PageOverlay.h: * page/TextIndicator.cpp: (WebCore::estimatedBackgroundColorForRange): * page/animation/CSSPropertyAnimation.cpp: (WebCore::shadowForBlending): * platform/graphics/Color.h: * platform/graphics/ca/GraphicsLayerCA.cpp: (WebCore::GraphicsLayerCA::createTransformAnimationsFromKeyframes): * platform/graphics/cg/ColorCG.cpp: (WebCore::cachedCGColor): * platform/graphics/cg/NativeImageCG.cpp: (WebCore::nativeImageSinglePixelSolidColor): * platform/graphics/filters/FilterOperation.cpp: (WebCore::DropShadowFilterOperation::blend): * platform/graphics/mac/ColorMac.mm: (WebCore::nsColor): * platform/graphics/nicosia/NicosiaPaintingEngineBasic.cpp: (Nicosia::PaintingEngineBasic::paint): * platform/graphics/nicosia/NicosiaPaintingEngineThreaded.cpp: (Nicosia::paintLayer): * platform/graphics/texmap/TextureMapperPlatformLayerBuffer.cpp: (WebCore::TextureMapperPlatformLayerBuffer::paintToTextureMapper): * platform/ios/WebVideoFullscreenControllerAVKit.mm: (VideoFullscreenControllerContext::requestVideoContentLayer): (VideoFullscreenControllerContext::returnVideoContentLayer): (VideoFullscreenControllerContext::didSetupFullscreen): * rendering/RenderImage.cpp: (WebCore::RenderImage::paintIncompleteImageOutline const): * rendering/RenderLayer.cpp: (WebCore::RenderLayer::paintResizer): * rendering/RenderListMarker.cpp: (WebCore::RenderListMarker::paint): * rendering/RenderThemeIOS.mm: (WebCore::RenderThemeIOS::platformActiveSelectionBackgroundColor const): (WebCore::RenderThemeIOS::platformInactiveSelectionBackgroundColor const): * rendering/RenderTreeAsText.cpp: (WebCore::RenderTreeAsText::writeRenderObject): * rendering/mathml/RenderMathMLMenclose.cpp: (WebCore::RenderMathMLMenclose::paint): * rendering/style/RenderStyle.cpp: (WebCore::RenderStyle::visitedDependentColor const): * rendering/style/RenderStyle.h: (WebCore::RenderStyle::initialStrokeColor): (WebCore::RenderStyle::initialBackgroundColor): * style/StyleBuilderCustom.h: (WebCore::Style::BuilderCustom::applyTextOrBoxShadowValue): * style/StyleBuilderState.cpp: (WebCore::Style::BuilderState::createFilterOperations): * svg/SVGStopElement.cpp: (WebCore::SVGStopElement::stopColorIncludingOpacity const): * testing/Internals.cpp: (WebCore::Internals::setViewIsTransparent): (WebCore::Internals::setViewBaseBackgroundColor): Color::transparent to Color::transparentBlack. 2020-07-19 Sam Weinig <weinig@apple.com> Remove ColorBuilder https://bugs.webkit.org/show_bug.cgi?id=214521 Reviewed by Darin Adler. ColorBuilder is unnecessary and just makes deduction contexts more complicated. Instead, we can get the same behavior by having color types inherit from a shared base class ColorType that uses the curiously recurring template pattern, which exposes the colorWithAlphaByte function (renamed from colorWithAlpha for clarity of the parameter). * Headers.cmake: * WebCore.xcodeproj/project.pbxproj: Remove ColorBuilder. * platform/graphics/ColorBuilder.h: Removed. * platform/graphics/Color.cpp: (WebCore::Color::lightened const): * platform/graphics/Color.h: (WebCore::Color::alphaByte const): (WebCore::Color::alpha const): Deleted. Stop using ColorBuilder for color named color types and rename Color::alpha to Color:alphaByte() for consistency with colorWithAlphaByte(). * platform/graphics/ColorTypes.h: (WebCore::ColorType::colorWithAlphaByte const): (WebCore::LinearSRGBA::LinearSRGBA): (WebCore::DisplayP3::DisplayP3): (WebCore::LinearDisplayP3::LinearDisplayP3): (WebCore::HSLA::HSLA): (WebCore::CMYKA::CMYKA): (WebCore::XYZA::XYZA): Switch each color type to inheriting from new ColorWithAlphaHelper struct. Use the opertunity to give each color type the same construction interface as well. Now that each type has constructors, the deduction guides are no longer necessary. * platform/graphics/ColorBlending.cpp: (WebCore::blendSourceOver): Switch from !color.alpha() to !color.isVisible() to more clearly indicate the intent. * accessibility/AccessibilityTable.cpp: (WebCore::AccessibilityTable::isDataTable const): Update to call alphaByte() and add FIXME indicating that it is probably incorrect and filed https://bugs.webkit.org/show_bug.cgi?id=214537 to track things further. * html/HTMLInputElement.cpp: (WebCore::HTMLInputElement::createInnerTextStyle): * inspector/InspectorOverlay.cpp: (WebCore::InspectorOverlay::drawPaintRects): (WebCore::InspectorOverlay::drawBounds): (WebCore::InspectorOverlay::drawRulers): * page/CaptionUserPreferencesMediaAF.cpp: (WebCore::CaptionUserPreferencesMediaAF::captionsBackgroundCSS const): * page/DebugPageOverlays.cpp: (WebCore::NonFastScrollableRegionOverlay::drawRect): * page/DragController.cpp: (WebCore::DragController::insertDroppedImagePlaceholdersAtCaret): * page/linux/ResourceUsageOverlayLinux.cpp: (WebCore::ResourceUsageOverlay::platformInitialize): * platform/graphics/BitmapImage.cpp: (WebCore::BitmapImage::draw): * platform/graphics/GraphicsLayer.cpp: (WebCore::GraphicsLayer::getDebugBorderInfo const): * platform/graphics/ca/GraphicsLayerCA.cpp: (WebCore::GraphicsLayerCA::recursiveCommitChanges): * platform/graphics/ca/PlatformCALayer.cpp: (WebCore::PlatformCALayer::drawRepaintIndicator): * platform/graphics/ca/TileCoverageMap.cpp: (WebCore::TileCoverageMap::TileCoverageMap): * platform/mock/ScrollbarThemeMock.cpp: (WebCore::ScrollbarThemeMock::paintTrackBackground): * platform/win/DragImageWin.cpp: (WebCore::createDragImageForLink): * rendering/InlineTextBox.cpp: (WebCore::InlineTextBox::resolveStyleForMarkedText): * rendering/RenderEmbeddedObject.cpp: * rendering/RenderLayerBacking.cpp: (WebCore::patternForTouchAction): (WebCore::patternForEventListenerRegionType): (WebCore::RenderLayerBacking::paintDebugOverlays): * rendering/RenderTheme.cpp: (WebCore::RenderTheme::platformTapHighlightColor const): * rendering/RenderThemeMac.mm: (WebCore::RenderThemeMac::paintMenuListButtonDecorations): * rendering/SimpleLineLayoutFunctions.cpp: (WebCore::SimpleLineLayout::paintFlow): * testing/cocoa/WebViewVisualIdentificationOverlay.mm: (-[WebViewVisualIdentificationOverlay initWithWebView:kind:deprecated:]): Update to call colorWithAlphaByte rather than colorWithAlpha. * rendering/RenderThemeIOS.mm: (WebCore::RenderThemeIOS::addRoundedBorderClip): (WebCore::RenderThemeIOS::paintCheckboxDecorations): (WebCore::RenderThemeIOS::paintRadioDecorations): (WebCore::RenderThemeIOS::paintMenuListButtonDecorations): (WebCore::RenderThemeIOS::paintSystemPreviewBadge): Update to use colorWithAlphaByte rather than colorWithAlpha and alphaByte rather than alpha. 2020-07-19 Rob Buis <rbuis@igalia.com> Remove findCharsetInMediaType https://bugs.webkit.org/show_bug.cgi?id=214523 Reviewed by Darin Adler. Remove findCharsetInMediaType (by moving its code into extractCharsetFromMediaType) since there are no users for findCharsetInMediaType anymore. * platform/network/HTTPParsers.cpp: (WebCore::extractCharsetFromMediaType): (WebCore::findCharsetInMediaType): Deleted. * platform/network/HTTPParsers.h: 2020-07-19 Sam Weinig <weinig@apple.com> Additional Color related cleanups https://bugs.webkit.org/show_bug.cgi?id=214514 Reviewed by Darin Adler. * platform/graphics/ColorBuilder.h: Remove redundant "public" and use decltype() rather than more wordy typename for static_assert. * platform/graphics/ColorUtilities.h: (WebCore::clampToComponentByte): (WebCore::clampToComponentFloat): Templatize to support any input. (WebCore::clampToComponentBytes): (WebCore::clampToComponentFloats): Templatize using variadic templates to support any input and prepare for color types with more than four components. (WebCore::colorByModifingEachNonAlphaComponent): Use std::invoke to support more types of functors. (WebCore::colorWithOverridenAlpha): (WebCore::invertedColorWithOverridenAlpha): Use auto more consistently. (WebCore::invertComponent): Deleted. Replace invertComponent functions with ComponentTraits::maxValue - value inline at callsite. 2020-07-18 Philippe Normand <pnormand@igalia.com> Unreviewed, fix build warnings in the WebXR backend * platform/xr/openxr/PlatformXROpenXR.cpp: (PlatformXR::Instance::Impl::enumerateInstanceExtensionProperties const): Guard log loop with LOG_DISABLED macro, to avoid unused variable warnings in release builds. * testing/WebFakeXRDevice.h: Remove unused private class member. 2020-07-18 Commit Queue <commit-queue@webkit.org> Unreviewed, reverting r264563. https://bugs.webkit.org/show_bug.cgi?id=214518 Broke the watchOS build Reverted changeset: "Add OK button to Date/Time form controls." https://bugs.webkit.org/show_bug.cgi?id=214195 https://trac.webkit.org/changeset/264563 2020-07-18 Rob Buis <rbuis@igalia.com> Only use enum classes in HTTPParsers https://bugs.webkit.org/show_bug.cgi?id=214451 Reviewed by Darin Adler. Only use enum classes in HTTPParsers by converting XFrameOptionsSameOrigin and ContentTypeOptionsDisposition. Remove HTTPVersion enum since its only use is by parseHTTPRequestLine, but this method is unused. * loader/FrameLoader.cpp: (WebCore::FrameLoader::shouldInterruptLoadForXFrameOptions): * loader/cache/CachedCSSStyleSheet.cpp: (WebCore::CachedCSSStyleSheet::mimeTypeAllowedByNosniff const): * platform/network/HTTPParsers.cpp: (WebCore::parseContentTypeOptionsHeader): (WebCore::parseXFrameOptionsHeader): (WebCore::parseHTTPRequestLine): Deleted. * platform/network/HTTPParsers.h: (): Deleted. * platform/network/ResourceResponseBase.cpp: (WebCore::isScriptAllowedByNosniff): 2020-07-17 Sam Weinig <weinig@apple.com> Remove final vestigates of SimpleColor https://bugs.webkit.org/show_bug.cgi?id=214439 Reviewed by Simon Fraser. Replace remaining makeSimpleColor uses: - Literal / constant colors switched to using SRGBA<uint8_t> { ... }. - Direct construction from uint8_t values also switched to SRGBA<uint8_t> { ... } - Where possible switched to using of named colors (e.g. Color::yellow) both directly and where an override alpha was needed. To aid this, new named colors were added for red, magenta, blue, green, darkGreen and orange. - Remaining callers switched to directly calling clampToComponentBytes, which was all that makeSimpleColor did. An overload of clampToComponentBytes that doesn't require the alpha parameter was added to simplify calls. To make construction of SRGBA<uint8_t> values nicer, callers no longer need to specify the alpha explicitly if the color is opaque. * Headers.cmake: * WebCore.xcodeproj/project.pbxproj: * platform/graphics/SimpleColor.h: Removed. Remove SimpleColor.h * css/parser/CSSParserFastPaths.cpp: (WebCore::parseNumericColor): Switch to clampToComponentBytes, but leave a FIXME indicating this should be switched to direct SRGBA<uint8_t> when hepler functions are fixed to return uint8_ts rather than ints. * inspector/agents/InspectorDOMAgent.cpp: (WebCore::parseColor): Switched to clampToComponentBytes and removed existing unnecessary additional clamping of the alpha component. * page/DebugPageOverlays.cpp: (WebCore::NonFastScrollableRegionOverlay::drawRect): Restructure HashMap construction to use the HashMap std::intializer_list constructor. This takes advantage of a change to WTF::KeyValuePair that allows it deduce in this context. * platform/graphics/Color.h: Remove SimpleColor.h include, but add ColorBuilder.h and ColorUtilities.h which SimpleColor was including on its behalf. Add new named colors for red, magenta, blue, green, darkGreen and orange. For all named colors, use ColorBuilder<SRGBA<uint8_t>> rather than SRGBA<uint8_t> alone to allow for callers to do things like Color::yellow.colorWithAlpha(...). In the future, it might make more sense to merge ColorBuilder's functionality directly into the color types, but for now this preserves that functionality. * svg/properties/SVGAnimationAdditiveValueFunctionImpl.h: (WebCore::SVGAnimationColorFunction::animate): (WebCore::SVGAnimationColorFunction::roundAndClampColorChannel): Deleted. Replace bespoke rounding/clamping functions in favor of ColorUtilities.h aggregate ones and directly calling std::lround. * css/parser/CSSPropertyParserHelpers.cpp: (WebCore::CSSPropertyParserHelpers::parseRGBParameters): * editing/CompositionHighlight.h: * html/ColorInputType.cpp: (WebCore::parseSimpleColorValue): * html/HTMLElement.cpp: (WebCore::parseLegacyColorValue): * html/HTMLInputElement.cpp: (WebCore::HTMLInputElement::createInnerTextStyle): * inspector/InspectorOverlay.cpp: (WebCore::drawOutlinedQuadWithClip): (WebCore::drawShapeHighlight): (WebCore::InspectorOverlay::paint): (WebCore::InspectorOverlay::drawPaintRects): (WebCore::InspectorOverlay::drawBounds): (WebCore::InspectorOverlay::drawRulers): (WebCore::InspectorOverlay::drawElementTitle): * layout/integration/LayoutIntegrationLineLayout.cpp: (WebCore::LayoutIntegration::LineLayout::debugTextShadow): * page/CaptionUserPreferencesMediaAF.cpp: (WebCore::CaptionUserPreferencesMediaAF::captionsBackgroundCSS const): * page/FrameView.cpp: (WebCore::FrameView::paintContents): * page/PrintContext.cpp: (WebCore::PrintContext::spoolAllPagesWithBoundaries): * page/cocoa/ResourceUsageOverlayCocoa.mm: (WebCore::HistoricResourceUsageData::HistoricResourceUsageData): * page/linux/ResourceUsageOverlayLinux.cpp: (WebCore::ResourceUsageOverlay::platformInitialize): * platform/adwaita/ScrollbarThemeAdwaita.cpp: * platform/adwaita/ThemeAdwaita.cpp: (WebCore::ThemeAdwaita::activeSelectionForegroundColor const): (WebCore::ThemeAdwaita::activeSelectionBackgroundColor const): (WebCore::ThemeAdwaita::inactiveSelectionForegroundColor const): * platform/graphics/Color.cpp: * platform/graphics/ColorBlending.cpp: (WebCore::blendSourceOver): (WebCore::blendWithWhite): * platform/graphics/ColorBuilder.h: (WebCore::ColorBuilder::colorWithAlpha const): (WebCore::ColorBuilder::ColorBuilder): Deleted. * platform/graphics/ColorTypes.h: (WebCore::SRGBA::SRGBA): * platform/graphics/ColorUtilities.h: (WebCore::clampToComponentBytes): (WebCore::clampToComponentFloats): * platform/graphics/GraphicsLayer.cpp: (WebCore::GraphicsLayer::getDebugBorderInfo const): * platform/graphics/ca/GraphicsLayerCA.cpp: (WebCore::GraphicsLayerCA::recursiveCommitChanges): (WebCore::contentsLayerDebugBorderColor): (WebCore::cloneLayerDebugBorderColor): (WebCore::GraphicsLayerCA::createTransformAnimationsFromKeyframes): * platform/graphics/ca/PlatformCALayer.cpp: (WebCore::PlatformCALayer::drawRepaintIndicator): * platform/graphics/ca/TileCoverageMap.cpp: (WebCore::TileCoverageMap::TileCoverageMap): (WebCore::TileCoverageMap::update): * platform/graphics/ca/win/PlatformCALayerWinInternal.cpp: (PlatformCALayerWinInternal::drawRepaintCounters): * platform/graphics/cg/NativeImageCG.cpp: (WebCore::nativeImageSinglePixelSolidColor): * platform/graphics/cocoa/GraphicsContextCocoa.mm: (WebCore::colorForMarkerLineStyle): * platform/graphics/mac/ColorMac.mm: (WebCore::makeSimpleColorFromNSColor): * platform/graphics/texmap/TextureMapperPlatformLayerBuffer.cpp: (WebCore::TextureMapperPlatformLayerBuffer::paintToTextureMapper): * platform/graphics/win/GraphicsContextCGWin.cpp: (WebCore::GraphicsContext::drawDotsForDocumentMarker): * platform/ios/DragImageIOS.mm: (WebCore::createDragImageForLink): * platform/ios/LegacyTileCache.mm: (WebCore::LegacyTileCache::colorForGridTileBorder const): * platform/mock/MockRealtimeMediaSourceCenter.cpp: (WebCore::defaultDevices): * platform/mock/MockRealtimeVideoSource.cpp: (WebCore::MockRealtimeVideoSource::drawBoxes): * platform/mock/ScrollbarThemeMock.cpp: (WebCore::ScrollbarThemeMock::paintTrackBackground): * platform/playstation/ScrollbarThemePlayStation.cpp: (WebCore::ScrollbarThemePlayStation::paintTrackBackground): * platform/win/DragImageWin.cpp: (WebCore::createDragImageForLink): * rendering/RenderEmbeddedObject.cpp: * rendering/RenderFrameSet.cpp: * rendering/RenderLayer.cpp: (WebCore::RenderLayer::beginTransparencyLayers): (WebCore::RenderLayer::paintResizer): * rendering/RenderLayerBacking.cpp: (WebCore::patternForTouchAction): (WebCore::patternForEventListenerRegionType): (WebCore::RenderLayerBacking::paintDebugOverlays): * rendering/RenderTheme.cpp: (WebCore::RenderTheme::platformActiveSelectionBackgroundColor const): (WebCore::RenderTheme::platformInactiveSelectionBackgroundColor const): (WebCore::RenderTheme::systemColor const): (WebCore::RenderTheme::paintSystemPreviewBadge): (WebCore::RenderTheme::platformTapHighlightColor const): * rendering/RenderThemeAdwaita.cpp: * rendering/RenderThemeIOS.h: * rendering/RenderThemeIOS.mm: (WebCore::RenderThemeIOS::paintSliderTrack): (WebCore::RenderThemeIOS::paintProgressBar): * rendering/RenderThemeMac.mm: (WebCore::menuBackgroundColor): (WebCore::RenderThemeMac::systemColor const): (WebCore::RenderThemeMac::paintMenuListButtonDecorations): * rendering/RenderThemeWin.cpp: (WebCore::RenderThemeWin::platformActiveSelectionBackgroundColor const): (WebCore::RenderThemeWin::platformInactiveSelectionBackgroundColor const): (WebCore::RenderThemeWin::platformActiveSelectionForegroundColor const): (WebCore::RenderThemeWin::systemColor const): * rendering/SimpleLineLayoutFunctions.cpp: (WebCore::SimpleLineLayout::paintFlow): * rendering/mathml/RenderMathMLBlock.cpp: (WebCore::RenderMathMLBlock::paint): * rendering/style/RenderStyle.cpp: (WebCore::RenderStyle::colorResolvingCurrentColor const): * rendering/style/SVGRenderStyle.h: (WebCore::SVGRenderStyle::initialStopColor): (WebCore::SVGRenderStyle::initialFloodColor): (WebCore::SVGRenderStyle::initialLightingColor): * testing/MockPageOverlayClient.cpp: (WebCore::MockPageOverlayClient::drawRect): * testing/cocoa/WebViewVisualIdentificationOverlay.mm: (-[WebViewVisualIdentificationOverlay initWithWebView:kind:deprecated:]): Replace makeSimpleColor uses with appropriate alternative. 2020-07-17 Megan Gardner <megan_gardner@apple.com> Add OK button to Date/Time form controls. https://bugs.webkit.org/show_bug.cgi?id=214195 Reviewed by Darin Adler. * en.lproj/Localizable.strings: 2020-07-17 Wenson Hsieh <wenson_hsieh@apple.com> Followup to r264531 https://bugs.webkit.org/show_bug.cgi?id=214488 <rdar://problem/64531754> Reviewed by Darin Adler. Elide a null check by grabbing `RenderStyle` from the renderer instead of the element, and also limit overflow hidden to the X axis. * editing/TextManipulationController.cpp: (WebCore::TextManipulationController::completeManipulation): 2020-07-17 Clark Wang <clark_wang@apple.com> Added Fixes for AudioScheduledSourceNode https://bugs.webkit.org/show_bug.cgi?id=214381 Reviewed by Chris Dumez. Added in IDL file for AudioScheduledSourceNode, according to spec: https://www.w3.org/TR/webaudio/#AudioScheduledSourceNode Re-baselined existing tests. * CMakeLists.txt: * DerivedSources-input.xcfilelist: * DerivedSources-output.xcfilelist: * DerivedSources.make: * Modules/webaudio/AudioBufferSourceNode.idl: * Modules/webaudio/AudioScheduledSourceNode.idl: Added. * Modules/webaudio/OscillatorNode.idl: * Sources.txt: * WebCore.xcodeproj/project.pbxproj: 2020-07-17 Kenneth Russell <kbr@chromium.org> [WebGL2] ReadPixels updates https://bugs.webkit.org/show_bug.cgi?id=209516 Reviewed by Dean Jackson. Upgrade readPixels to WebGL 2.0 functionality. Handle both WebGL 2.0 pack/unpack parameters correctly. Fix preexisting bugs in texture uploads from pixel unpack buffers. Remove entry points from GraphicsContextGL that will never be used by the WebGL 2.0 implementation. Covered by existing WebGL 2.0 conformance tests. * html/canvas/WebGL2RenderingContext.cpp: (WebCore::WebGL2RenderingContext::initializeNewContext): (WebCore::WebGL2RenderingContext::sliceArrayBufferView): (WebCore::WebGL2RenderingContext::pixelStorei): (WebCore::WebGL2RenderingContext::texImage2D): (WebCore::WebGL2RenderingContext::texImage3D): (WebCore::WebGL2RenderingContext::texSubImage2D): (WebCore::WebGL2RenderingContext::texSubImage3D): (WebCore::WebGL2RenderingContext::getPackPixelStoreParams const): (WebCore::WebGL2RenderingContext::getUnpackPixelStoreParams const): (WebCore::WebGL2RenderingContext::readPixels): * html/canvas/WebGL2RenderingContext.h: * html/canvas/WebGLRenderingContextBase.cpp: (WebCore::WebGLRenderingContextBase::readPixels): * html/canvas/WebGLRenderingContextBase.h: * platform/graphics/ExtensionsGL.h: * platform/graphics/GraphicsContextGL.h: * platform/graphics/angle/ExtensionsGLANGLE.cpp: (WebCore::ExtensionsGLANGLE::readnPixelsRobustANGLE): * platform/graphics/angle/ExtensionsGLANGLE.h: * platform/graphics/angle/GraphicsContextGLANGLE.cpp: (WebCore::GraphicsContextGLOpenGL::readRenderingResults): (WebCore::GraphicsContextGLOpenGL::texImage3D): Deleted. (WebCore::GraphicsContextGLOpenGL::texSubImage3D): Deleted. * platform/graphics/opengl/ExtensionsGLOpenGLCommon.cpp: (WebCore::ExtensionsGLOpenGLCommon::readnPixelsRobustANGLE): * platform/graphics/opengl/ExtensionsGLOpenGLCommon.h: * platform/graphics/opengl/GraphicsContextGLOpenGL.h: * platform/graphics/opengl/GraphicsContextGLOpenGLCommon.cpp: (WebCore::GraphicsContextGLOpenGL::texImage3D): Deleted. (WebCore::GraphicsContextGLOpenGL::texSubImage3D): Deleted. 2020-07-17 James Darpinian <jdarpinian@chromium.org> [WebGL2] Sync objects https://bugs.webkit.org/show_bug.cgi?id=126942 Reviewed by Dean Jackson. Passes WebGL conformance tests webgl/2.0.0/conformance2/sync/sync-webgl-specific.html and webgl/2.0.0/deqp/functional/gles3/sync.html although the latter times out in the layout test harness. * html/canvas/WebGL2RenderingContext.cpp: (WebCore::WebGL2RenderingContext::fenceSync): (WebCore::WebGL2RenderingContext::isSync): (WebCore::WebGL2RenderingContext::deleteSync): (WebCore::WebGL2RenderingContext::clientWaitSync): (WebCore::WebGL2RenderingContext::waitSync): (WebCore::WebGL2RenderingContext::getSyncParameter): * html/canvas/WebGLRenderingContextBase.h: * html/canvas/WebGLSync.cpp: (WebCore::WebGLSync::WebGLSync): (WebCore::WebGLSync::deleteObjectImpl): (WebCore::WebGLSync::updateCache): (WebCore::WebGLSync::getCachedResult const): (WebCore::WebGLSync::isSignaled const): (WebCore::WebGLSync::scheduleAllowCacheUpdate): * html/canvas/WebGLSync.h: * platform/graphics/GraphicsContextGL.h: * platform/graphics/GraphicsTypesGL.h: * platform/graphics/angle/GraphicsContextGLANGLE.cpp: (WebCore::GraphicsContextGLOpenGL::fenceSync): (WebCore::GraphicsContextGLOpenGL::isSync): (WebCore::GraphicsContextGLOpenGL::deleteSync): (WebCore::GraphicsContextGLOpenGL::clientWaitSync): (WebCore::GraphicsContextGLOpenGL::waitSync): (WebCore::GraphicsContextGLOpenGL::getSynciv): * platform/graphics/opengl/GraphicsContextGLOpenGL.h: * platform/graphics/opengl/GraphicsContextGLOpenGLCommon.cpp: (WebCore::GraphicsContextGLOpenGL::fenceSync): (WebCore::GraphicsContextGLOpenGL::isSync): (WebCore::GraphicsContextGLOpenGL::deleteSync): (WebCore::GraphicsContextGLOpenGL::clientWaitSync): (WebCore::GraphicsContextGLOpenGL::waitSync): (WebCore::GraphicsContextGLOpenGL::getSynciv): 2020-07-17 Lauro Moura <lmoura@igalia.com> Fix -Wformat= warnings when passing enum to integer specifiers https://bugs.webkit.org/show_bug.cgi?id=214441 Reviewed by Darin Adler. Covered by existing tests. * platform/mediastream/MediaConstraints.cpp: (WebCore::MediaConstraint::log const): (WebCore::BooleanConstraint::logAsBoolean const): (WebCore::DoubleConstraint::logAsDouble const): (WebCore::IntConstraint::logAsInt const): * platform/mediastream/MediaConstraints.h: Made uint8_t the underlying type for MediaConstraints::DataType. * platform/mediastream/RealtimeMediaSource.cpp: (WebCore::RealtimeMediaSource::selectSettings): * platform/mediastream/RealtimeMediaSourceSupportedConstraints.h: Made uint8_t the underlying type for MediaConstraintType. 2020-07-17 Fujii Hironori <Hironori.Fujii@sony.com> Don't include <wtf/text/WTFString.h> in SVGParserUtilities.h https://bugs.webkit.org/show_bug.cgi?id=214320 Reviewed by Darin Adler. r264332 mistakenly added #include <wtf/text/WTFString.h> in ColorSerialization.h and SVGParserUtilities.h. It should be <wtf/Forward.h>. See <https://lists.webkit.org/pipermail/webkit-dev/2020-July/031274.html> for the discussion. * platform/graphics/ColorSerialization.h: * svg/SVGParserUtilities.h: 2020-07-17 Wenson Hsieh <wenson_hsieh@apple.com> Recommended article titles on csdn.net are clipped after translating to English https://bugs.webkit.org/show_bug.cgi?id=214488 <rdar://problem/64531754> Reviewed by Tim Horton. On csdn.net, the translation of the "荐" pill into English is "Recommended". This increase in the size of the text node after translation breaks the layout of the page by clipping content below the pill, since the page expects the element containing this text to have a fixed width and height. Add a heuristic to detect and mitigate this exact scenario by applying `overflow: hidden;` onto containers after translation, in the case where the container: 1. Did not have any visual overflow before translation. 2. Has visual overflow after translation. 3. Has both fixed width and fixed height. 4. Does not have any overflow clip. 5. Is not out-of-flow (i.e. fixed or absolute position). While it does mean that the text inside the fixed-dimension container will be clipped, this will at least prevent this overflow from breaking the rest of the page. Test: TextManipulation.CompleteTextManipulationAddsOverflowHiddenToAvoidBreakingLayout * editing/TextManipulationController.cpp: (WebCore::TextManipulationController::completeManipulation): (WebCore::TextManipulationController::replace): While replacing content, keep track of nodes under which we're inserting content that didn't have any visual overflow prior to replacement. * editing/TextManipulationController.h: 2020-07-17 Simon Fraser <simon.fraser@apple.com> Make ScrollbarControlSize an enum class https://bugs.webkit.org/show_bug.cgi?id=199325 Reviewed by Sam Weinig. Make ScrollbarControlSize an enum class, and make some RenderScrollbar methods const. * platform/ScrollTypes.h: * platform/ScrollView.cpp: (WebCore::ScrollView::createScrollbar): * platform/ScrollbarTheme.h: (WebCore::ScrollbarTheme::scrollbarThickness): * platform/ios/ScrollbarThemeIOS.h: * platform/mac/ScrollbarThemeMac.h: * platform/mac/ScrollbarThemeMac.mm: (WebCore::scrollbarControlSizeToNSControlSize): (WebCore::scrollbarSizeToIndex): (WebCore::ScrollbarThemeMac::hasButtons): (WebCore::buttonRepaintRect): (WebCore::ScrollbarThemeMac::backButtonRect): (WebCore::ScrollbarThemeMac::forwardButtonRect): (WebCore::ScrollbarThemeMac::trackRect): * platform/mock/ScrollbarThemeMock.cpp: (WebCore::ScrollbarThemeMock::scrollbarThickness): * platform/mock/ScrollbarThemeMock.h: * platform/playstation/ScrollbarThemePlayStation.h: * platform/win/PopupMenuWin.cpp: (WebCore::PopupMenuWin::show): (WebCore::PopupMenuWin::calculatePositionAndSize): * platform/win/ScrollbarThemeWin.h: * rendering/RenderLayer.cpp: (WebCore::RenderLayer::createScrollbar): * rendering/RenderScrollbar.cpp: (WebCore::RenderScrollbar::RenderScrollbar): (WebCore::RenderScrollbar::buttonRect const): (WebCore::RenderScrollbar::trackRect const): (WebCore::RenderScrollbar::trackPieceRectWithMargins const): (WebCore::RenderScrollbar::minimumThumbLength const): (WebCore::RenderScrollbar::opacity const): (WebCore::RenderScrollbar::buttonRect): Deleted. (WebCore::RenderScrollbar::trackRect): Deleted. (WebCore::RenderScrollbar::trackPieceRectWithMargins): Deleted. (WebCore::RenderScrollbar::minimumThumbLength): Deleted. (WebCore::RenderScrollbar::opacity): Deleted. * rendering/RenderScrollbar.h: * rendering/RenderTheme.h: (WebCore::RenderTheme::scrollbarControlSizeForPart): * rendering/RenderThemeMac.h: 2020-07-17 Rob Buis <rbuis@igalia.com> Changing URL.host should not override port https://bugs.webkit.org/show_bug.cgi?id=151613 Reviewed by Alex Christensen. When setting host, empty/incorrect port strings should not change the existing port [1, 2]. Behavior matches Chrome and Firefox. [1] https://url.spec.whatwg.org/#host-state Step 2.4 [2] https://url.spec.whatwg.org/#port-state Step 2.2 Test: imported/w3c/web-platform-tests/url/url-setters.html * html/URLDecomposition.cpp: (WebCore::URLDecomposition::setHost): 2020-07-17 Truitt Savell <tsavell@apple.com> Unreviewed, reverting r264477. Broke the internal build Reverted changeset: "Use AVRoutePickerView when available for choosing AirPlay devices" https://bugs.webkit.org/show_bug.cgi?id=213497 https://trac.webkit.org/changeset/264477 2020-07-17 Truitt Savell <tsavell@apple.com> Unreviewed, reverting r264482. Part of an attempted fix for the build Reverted changeset: "Use AVRoutePickerView when available for choosing AirPlay devices" https://bugs.webkit.org/show_bug.cgi?id=213497 https://trac.webkit.org/changeset/264482 2020-07-17 Joonghun Park <jh718.park@samsung.com> Unreviewed. Remove the build warning below since r264280. warning: redundant move in return statement [-Wredundant-move] No new tests, no new behaviors. * platform/graphics/Gradient.h: (WebCore::Gradient::decode): 2020-07-17 Joonghun Park <jh718.park@samsung.com> Unreviewed. Remove the build warning below and redundant spaces since r264381. warning: this statement may fall through [-Wimplicit-fallthrough=] No new tests, no new behaviors. * html/canvas/WebGL2RenderingContext.cpp: (WebCore::WebGL2RenderingContext::vertexAttribI4iv): * html/canvas/WebGLRenderingContextBase.cpp: (WebCore::WebGLRenderingContextBase::getVertexAttrib): (WebCore::WebGLRenderingContextBase::vertexAttribfvImpl): 2020-07-17 Joonghun Park <jh718.park@samsung.com> Remove the build warning below and redundant spaces since r263985. warning: redundant move in return statement [-Wredundant-move] No new tests, no new behaviors. * Modules/webaudio/AudioNode.h: * Modules/webaudio/PannerNode.cpp: (WebCore::PannerNode::create): (WebCore::PannerNode::PannerNode): * Modules/webaudio/PannerNode.h: 2020-07-16 Rob Buis <rbuis@igalia.com> Make DocumentParser.ParserState an enum class https://bugs.webkit.org/show_bug.cgi?id=214416 Reviewed by Darin Adler. Make DocumentParser.ParserState an enum class since it is more readable. * dom/DocumentParser.cpp: (WebCore::DocumentParser::DocumentParser): (WebCore::DocumentParser::startParsing): (WebCore::DocumentParser::prepareToStopParsing): (WebCore::DocumentParser::stopParsing): (WebCore::DocumentParser::detach): * dom/DocumentParser.h: (WebCore::DocumentParser::isParsing const): (WebCore::DocumentParser::isStopping const): (WebCore::DocumentParser::isStopped const): (WebCore::DocumentParser::isDetached const): (): Deleted. 2020-07-16 Xabier Rodriguez Calvar <calvaris@igalia.com> Rename createBoxPtr into adoptBoxPtr https://bugs.webkit.org/show_bug.cgi?id=214171 Reviewed by Darin Adler. No new tests, just a rename. * platform/graphics/gstreamer/eme/CDMProxyThunder.cpp: (WebCore::CDMProxyThunder::getDecryptionSession const): Used the renamed function. 2020-07-16 Fujii Hironori <Hironori.Fujii@sony.com> [WTF] Remove the unnecessary inner class DefaultHash<T>::Hash https://bugs.webkit.org/show_bug.cgi?id=214389 Reviewed by Darin Adler. * Modules/indexeddb/IDBDatabaseIdentifier.h: * Modules/indexeddb/shared/IDBResourceIdentifier.h: * Modules/webgpu/WHLSL/AST/WHLSLUnnamedTypeHash.h: * Modules/webgpu/WHLSL/WHLSLSemanticMatcher.cpp: (WebCore::WHLSL::matchResources): (WebCore::WHLSL::matchVertexAttributes): (WebCore::WHLSL::matchColorAttachments): * accessibility/AccessibilityObject.cpp: * accessibility/AccessibilityObject.h: * contentextensions/ContentExtensionCompiler.cpp: (WebCore::ContentExtensions::serializeActions): * contentextensions/ContentExtensionRule.h: (WebCore::ContentExtensions::TriggerHash::hash): * contentextensions/ContentExtensionStyleSheet.h: * contentextensions/DFA.cpp: (WebCore::ContentExtensions::printTransitions): * contentextensions/DFABytecodeInterpreter.h: * contentextensions/DFACombiner.cpp: (WebCore::ContentExtensions::DFAMerger::getOrCreateCombinedNode): * contentextensions/DFANode.cpp: (WebCore::ContentExtensions::DFANode::bestFallbackTarget const): * contentextensions/ImmutableNFANodeBuilder.h: * contentextensions/NFA.cpp: (WebCore::ContentExtensions::NFA::debugPrintDot const): * contentextensions/NFANode.h: * contentextensions/NFAToDFA.cpp: (WebCore::ContentExtensions::NodeIdSetToUniqueNodeIdSetSource::NodeIdSetToUniqueNodeIdSetSource): (WebCore::ContentExtensions::NodeIdSetToUniqueNodeIdSetTranslator::translate): * css/makeprop.pl: * css/parser/CSSParserContext.h: * dom/GCReachableRef.h: * dom/MessagePortIdentifier.h: * dom/NodeRareData.h: (WebCore::NodeListsNodeData::NodeListCacheMapEntryHash::hash): (WebCore::NodeListsNodeData::NodeListCacheMapEntryHash::equal): * dom/QualifiedName.h: * history/BackForwardItemIdentifier.h: * html/canvas/WebGLRenderingContextBase.h: * layout/LayoutUnits.h: * loader/AdClickAttribution.h: * loader/ResourceCryptographicDigest.h: (WTF::DefaultHash<WebCore::ResourceCryptographicDigest>::hash): (WTF::DefaultHash<WebCore::ResourceCryptographicDigest>::equal): (WTF::DefaultHash<WebCore::ResourceCryptographicDigest>::Hash::hash): Deleted. (WTF::DefaultHash<WebCore::ResourceCryptographicDigest>::Hash::equal): Deleted. * page/ClientOrigin.h: * page/GlobalWindowIdentifier.h: * page/SecurityOriginData.h: * page/SecurityOriginHash.h: * platform/Cookie.h: * platform/RegistrableDomain.h: * platform/graphics/ColorHash.h: * platform/graphics/FloatSizeHash.h: (WTF::FloatHash<WebCore::FloatSize>::hash): * platform/graphics/FontGenericFamilies.h: * platform/graphics/IntPointHash.h: * platform/graphics/IntRectHash.h: (WTF::IntHash<WebCore::IntRect>::hash): (WTF::IntHash<WebCore::IntRect>::equal): * platform/graphics/IntSizeHash.h: * platform/graphics/WidthCache.h: * platform/graphics/freetype/FontCacheFreeType.cpp: (WebCore::FallbackFontDescriptionKey::computeHash const): * platform/network/HTTPParsers.h: * platform/network/ProtectionSpaceHash.h: * platform/win/COMPtr.h: * platform/win/WindowsKeyNames.h: * rendering/CSSValueKey.h: * rendering/GridBaselineAlignment.h: * rendering/GridTrackSizingAlgorithm.h: * rendering/RenderGrid.cpp: (WebCore::RenderGrid::placeSpecifiedMajorAxisItemsOnGrid const): * rendering/RenderTheme.h: * style/RuleSet.cpp: (WebCore::Style::RuleSet::evaluateDynamicMediaQueryRules): * svg/SVGElement.h: (WebCore::SVGAttributeHashTranslator::hash): * workers/service/ServiceWorkerClientIdentifier.h: * workers/service/ServiceWorkerRegistrationKey.h: 2020-07-16 Sihui Liu <sihui_liu@appe.com> IDB serialization of some DOM object types crashes the Networking process due to incorrect global object type (WPT IndexedDB/structured-clone.any tests fail) https://bugs.webkit.org/show_bug.cgi?id=210735 <rdar://problem/62045703> Reviewed by Yusuke Suzuki. In r239746, IDB went back to use JSGlobalObject for serialization and deserialization. However, in our current implementation, there is a strong assumption that DOM JS objects are tied to JSDOMGlobalObject, which is derived from JSGlobalObject. For example, in SerializedScriptValue.cpp, we cast the global object to JSDOMGlobalObject in many places. We recently notice this issue when we enable some wpt test, which has been disabled since it was imported as some types were not supported. The test fails as DOMMatrix object requires its global object to be JSDOMGlobalObject. To fix this, introduce a new Class JSIDBSerializationGlobalObject, derived from JSDOMGlobalObject, and use it for IDB serialization. Tests: LayoutTests/storage/indexeddb/structured-clone.html LayoutTests/storage/indexeddb/structured-clone-private.html * Modules/indexeddb/server/IDBSerializationContext.cpp: (WebCore::IDBServer::IDBSerializationContext::initializeVM): * Modules/indexeddb/server/IDBSerializationContext.h: * Sources.txt: * WebCore.xcodeproj/project.pbxproj: * bindings/js/JSDOMGlobalObject.cpp: (WebCore::JSDOMGlobalObject::scriptExecutionContext const): * bindings/js/JSIDBSerializationGlobalObject.cpp: Added. (WebCore::JSIDBSerializationGlobalObject::JSIDBSerializationGlobalObject): (WebCore::JSIDBSerializationGlobalObject::create): (WebCore::JSIDBSerializationGlobalObject::finishCreation): (WebCore::JSIDBSerializationGlobalObject::subspaceForImpl): (WebCore::JSIDBSerializationGlobalObject::destroy): * bindings/js/JSIDBSerializationGlobalObject.h: Added. * bindings/js/WebCoreJSClientData.cpp: (WebCore::JSVMClientData::JSVMClientData): * bindings/js/WebCoreJSClientData.h: (WebCore::JSVMClientData::idbSerializationSpace): * dom/EmptyScriptExecutionContext.h: Added. * worklets/WorkletScriptController.h: 2020-07-16 Eric Carlson <eric.carlson@apple.com> Use AVRoutePickerView when available for choosing AirPlay devices https://bugs.webkit.org/show_bug.cgi?id=213497 <rdar://problem/58610662> Unreviewed build fix. * platform/graphics/avfoundation/objc/AVRoutePickerViewTargetPicker.mm: * platform/graphics/avfoundation/objc/MediaPlaybackTargetPickerMac.mm: (WebCore::MediaPlaybackTargetPickerMac::routePicker): Use HAVE_AVROUTEPICKERVIEW. 2020-07-16 Eric Carlson <eric.carlson@apple.com> Use AVRoutePickerView when available for choosing AirPlay devices https://bugs.webkit.org/show_bug.cgi?id=213497 <rdar://problem/58610662> Reviewed by Jer Noble. Use an AVRoutePickerView, the replacement for AVOutputDeviceMenuController, when it is available to allow a user to pick an AirPlay device. To do this, create an AVPlaybackTargetPicker abstract base and create a concrete class from the AVOutputDeviceMenuController-specific code from MediaPlaybackTargetPickerMac, and create a new concrete class using AVRoutePickerView. Tested manually because these changes require an AirPlay device. * Modules/mediasession/WebMediaSessionManager.cpp: (WebCore::WebMediaSessionManager::showPlaybackTargetPicker): Pass the view to the target picker. * Modules/mediasession/WebMediaSessionManagerClient.h: * Modules/remoteplayback/RemotePlayback.cpp: (WebCore::RemotePlayback::playbackTargetPickerWasDismissed): Drive-by fix: return early if there are no pending promises. * SourcesCocoa.txt: Add new files. * WebCore.xcodeproj/project.pbxproj: Ditto. * platform/graphics/MediaPlaybackTargetPicker.cpp: (WebCore::MediaPlaybackTargetPicker::showPlaybackTargetPicker): Add new parameter. * platform/graphics/MediaPlaybackTargetPicker.h: * platform/graphics/avfoundation/objc/AVOutputDeviceMenuControllerTargetPicker.h: Copied from Source/WebCore/platform/graphics/avfoundation/objc/MediaPlaybackTargetPickerMac.h. * platform/graphics/avfoundation/objc/AVOutputDeviceMenuControllerTargetPicker.mm: Copied from Source/WebCore/platform/graphics/avfoundation/objc/MediaPlaybackTargetPickerMac.mm. (WebCore::AVOutputDeviceMenuControllerTargetPicker::AVOutputDeviceMenuControllerTargetPicker): (WebCore::AVOutputDeviceMenuControllerTargetPicker::~AVOutputDeviceMenuControllerTargetPicker): (WebCore::AVOutputDeviceMenuControllerTargetPicker::devicePicker): (WebCore::AVOutputDeviceMenuControllerTargetPicker::availableDevicesDidChange): (WebCore::AVOutputDeviceMenuControllerTargetPicker::currentDeviceDidChange): (WebCore::AVOutputDeviceMenuControllerTargetPicker::showPlaybackTargetPicker): (WebCore::AVOutputDeviceMenuControllerTargetPicker::startingMonitoringPlaybackTargets): (WebCore::AVOutputDeviceMenuControllerTargetPicker::stopMonitoringPlaybackTargets): (WebCore::AVOutputDeviceMenuControllerTargetPicker::invalidatePlaybackTargets): (WebCore::AVOutputDeviceMenuControllerTargetPicker::externalOutputDeviceAvailable): (WebCore::AVOutputDeviceMenuControllerTargetPicker::outputContext): (-[WebAVOutputDeviceMenuControllerHelper initWithCallback:]): (-[WebAVOutputDeviceMenuControllerHelper clearCallback]): (-[WebAVOutputDeviceMenuControllerHelper observeValueForKeyPath:ofObject:change:context:]): * platform/graphics/avfoundation/objc/AVPlaybackTargetPicker.h: Added. (WebCore::AVPlaybackTargetPicker::AVPlaybackTargetPicker): (WebCore::AVPlaybackTargetPicker::client const): * platform/graphics/avfoundation/objc/AVRoutePickerViewTargetPicker.h: Added. * platform/graphics/avfoundation/objc/AVRoutePickerViewTargetPicker.mm: Added. (WebCore::AVRoutePickerViewTargetPicker::isAvailable): (WebCore::AVRoutePickerViewTargetPicker::AVRoutePickerViewTargetPicker): (WebCore::AVRoutePickerViewTargetPicker::~AVRoutePickerViewTargetPicker): (WebCore::AVRoutePickerViewTargetPicker::outputContextInternal): (WebCore::AVRoutePickerViewTargetPicker::devicePicker): (WebCore::AVRoutePickerViewTargetPicker::routeDetector): (WebCore::AVRoutePickerViewTargetPicker::showPlaybackTargetPicker): (WebCore::AVRoutePickerViewTargetPicker::startingMonitoringPlaybackTargets): (WebCore::AVRoutePickerViewTargetPicker::stopMonitoringPlaybackTargets): (WebCore::AVRoutePickerViewTargetPicker::externalOutputDeviceAvailable): (WebCore::AVRoutePickerViewTargetPicker::outputContext): (WebCore::AVRoutePickerViewTargetPicker::invalidatePlaybackTargets): (WebCore::AVRoutePickerViewTargetPicker::availableDevicesDidChange): (WebCore::AVRoutePickerViewTargetPicker::currentDeviceDidChange): (WebCore::AVRoutePickerViewTargetPicker::devicePickerWasDismissed): (-[WebAVRoutePickerViewHelper initWithCallback:]): (-[WebAVRoutePickerViewHelper dealloc]): (-[WebAVRoutePickerViewHelper clearCallback]): (-[WebAVRoutePickerViewHelper routePickerViewDidEndPresentingRoutes:]): (-[WebAVRoutePickerViewHelper notificationHandler:]): * platform/graphics/avfoundation/objc/MediaPlaybackTargetPickerMac.h: * platform/graphics/avfoundation/objc/MediaPlaybackTargetPickerMac.mm: (WebCore::MediaPlaybackTargetPickerMac::MediaPlaybackTargetPickerMac): (WebCore::MediaPlaybackTargetPickerMac::~MediaPlaybackTargetPickerMac): (WebCore::MediaPlaybackTargetPickerMac::externalOutputDeviceAvailable): (WebCore::MediaPlaybackTargetPickerMac::playbackTarget): (WebCore::MediaPlaybackTargetPickerMac::routePicker): (WebCore::MediaPlaybackTargetPickerMac::showPlaybackTargetPicker): (WebCore::MediaPlaybackTargetPickerMac::startingMonitoringPlaybackTargets): (WebCore::MediaPlaybackTargetPickerMac::stopMonitoringPlaybackTargets): (WebCore::MediaPlaybackTargetPickerMac::invalidatePlaybackTargets): (WebCore::MediaPlaybackTargetPickerMac::pickerWasDismissed): (WebCore::MediaPlaybackTargetPickerMac::availableDevicesChanged): (WebCore::MediaPlaybackTargetPickerMac::currentDeviceChanged): (WebCore::MediaPlaybackTargetPickerMac::devicePicker): Deleted. (-[WebAVOutputDeviceMenuControllerHelper initWithCallback:]): Deleted. (-[WebAVOutputDeviceMenuControllerHelper clearCallback]): Deleted. (-[WebAVOutputDeviceMenuControllerHelper observeValueForKeyPath:ofObject:change:context:]): Deleted. * platform/mock/MediaPlaybackTargetPickerMock.cpp: (WebCore::MediaPlaybackTargetPickerMock::showPlaybackTargetPicker): * platform/mock/MediaPlaybackTargetPickerMock.h: 2020-07-16 Jer Noble <jer.noble@apple.com> [Cocoa] Add MediaCapabilities support for SW VP9 decoder. https://bugs.webkit.org/show_bug.cgi?id=214316 Reviewed by Eric Carlson. Test: platform/mac/media/mediacapabilities/vp9-decodingInfo-sw.html Add some foundational support for SW VP9, which due to policy decisions will need information both on the system battery status and the power adapter status, and these need to be shipped into the WebContent process from the UIProcess. Add some Internal override settings to allow the policies to be effectively tested through LayouTests. This includes overrides for system battery and AC state, as well as overrides for screen size and resolution. * SourcesCocoa.txt: * WebCore.xcodeproj/project.pbxproj: * platform/PlatformScreen.cpp: (WebCore::getScreenProperties): * platform/PlatformScreen.h: * platform/ScreenProperties.h: (WebCore::ScreenData::encode const): (WebCore::ScreenData::decode): * platform/cocoa/PowerSourceNotifier.h: * platform/cocoa/PowerSourceNotifier.mm: (WebCore::PowerSourceNotifier::PowerSourceNotifier): (WebCore::PowerSourceNotifier::~PowerSourceNotifier): (WebCore::PowerSourceNotifier::notifyPowerSourceChanged): * platform/cocoa/SystemBattery.h: * platform/cocoa/SystemBattery.mm: (WebCore::systemHasBattery): (WebCore::resetSystemHasAC): (WebCore::setSystemHasAC): (WebCore::systemHasAC): (WebCore::setOverrideSystemHasBatteryForTesting): (WebCore::setOverrideSystemHasACForTesting): * platform/graphics/cocoa/MediaEngineConfigurationFactoryCocoa.cpp: (WebCore::videoCodecTypeFromRFC4281Type): (WebCore::createMediaPlayerDecodingConfigurationCocoa): * platform/graphics/cocoa/VP9UtilitiesCocoa.h: Copied from Source/WebCore/PAL/pal/spi/cocoa/IOPSLibSPI.h. * platform/graphics/cocoa/VP9UtilitiesCocoa.mm: Added. (WebCore::setOverrideVP9HardwareDecoderDisabledForTesting): (WebCore::setOverrideVP9ScreenSizeAndScaleForTesting): (WebCore::resetOverrideVP9ScreenSizeAndScaleForTesting): (WebCore::validateVPParameters): * platform/ios/PlatformScreenIOS.mm: (WebCore::collectScreenProperties): * platform/mac/PlatformScreenMac.mm: (WebCore::collectScreenProperties): * testing/Internals.cpp: (WebCore::Internals::Internals): (WebCore::Internals::setSystemHasBattery): (WebCore::Internals::setSystemHasAC): (WebCore::Internals::setHardwareVP9DecoderDisabledForTesting): (WebCore::Internals::setVP9ScreenSizeAndScale): * testing/Internals.h: * testing/Internals.idl: 2020-07-16 Brady Eidson <beidson@apple.com> Remove (entirely unused) hat switch dpad support in HIDGamepad. https://bugs.webkit.org/show_bug.cgi?id=214419 Reviewed by Andy Estes. Turns out these devices simply don't exist in the wild. * platform/gamepad/mac/HIDGamepad.cpp: (WebCore::HIDGamepad::initElements): (WebCore::HIDGamepad::initElementsFromArray): (WebCore::HIDGamepad::valueChanged): (WebCore::HIDGamepad::maybeAddDPad): Deleted. (WebCore::fillInButtonValues): Deleted. * platform/gamepad/mac/HIDGamepad.h: (WebCore::HIDGamepadElement::isAxis const): (WebCore::HIDGamepadElement::isDPad const): Deleted. (WebCore::HIDGamepadDPad::HIDGamepadDPad): Deleted. (WebCore::HIDGamepadDPad::normalizedValue): Deleted. 2020-07-16 Peng Liu <peng.liu6@apple.com> Double tapping to zoom out a fullscreen video will zoom in slightly before zooming out https://bugs.webkit.org/show_bug.cgi?id=214400 Reviewed by Jer Noble. When changing the video gravity of a fullscreen video from AVLayerVideoGravityResizeAspectFill to AVLayerVideoGravityResizeAspect, the implicit animation of the AVPlayerLayer in the web process will conflict with the implicit animation of the _videoSublayer in the WebAVPlayerLayer in the UI process. To avoid the implicit animation in the web process because of the video gravity change, we have to let the remote hosting layer and the corresponding AVPlayerLayer in the web process to include the whole video, even when the video gravity is AVLayerVideoGravityResizeAspectFill and the video will be clipped by the superlayer. When the AVPlayerLayer has the whole video, changing the video gravity from AVLayerVideoGravityResizeAspectFill to AVLayerVideoGravityResizeAspect will not generate an implicit animation in the web process. This patch also adds an instance variable _previousVideoGravity to make sure the transform is correctly calculated when video gravity is changing. * platform/ios/VideoFullscreenInterfaceAVKit.mm: (-[WebAVPlayerLayer init]): (-[WebAVPlayerLayer layoutSublayers]): (-[WebAVPlayerLayer resolveBounds]): (-[WebAVPlayerLayer setVideoGravity:]): 2020-07-16 Andres Gonzalez <andresg_22@apple.com> Crash caused by clients that don't support isolated tree mode calling on the secondary thread. https://bugs.webkit.org/show_bug.cgi?id=214409 Reviewed by Chris Fleizach. In isolated tree mode, isIsolatedTreeEnabled should return true whenever is called off of the main thread, even if the client doesn’t support isolated tree mode. Once the secondary AX thread is initialized due to a call from a client that supports isolated tree mode like VoiceOver, all calls into the accessibility API will happen on the secondary thread, including calls from clients that don't support isolated tree mode. At this point, we need to handle those clients as if they supported isolated tree mode. In other words, one client that supports isolated tree mode makes all other clients to be treated as such. * accessibility/AXObjectCache.cpp: (WebCore::AXObjectCache::isIsolatedTreeEnabled): * accessibility/mac/WebAccessibilityObjectWrapperMac.mm: (-[WebAccessibilityObjectWrapper lineTextMarkerRangeForTextMarker:forUnit:]): Minor cleanup, the cache is already in a local varriable. 2020-07-16 Oriol Brufau <obrufau@igalia.com> [css-grid] Fix line name positions after implicit tracks https://bugs.webkit.org/show_bug.cgi?id=214315 Reviewed by Manuel Rego Casasnovas. When serializing grid-template-rows/columns of a grid container, we get the list of used track sizes, and then insert line names at the corresponding indices. Before this patch, these indices were simply taken from the computed value. However, leading implicit tracks appear in the used value but not in the computed one. Therefore, we have to offset the indices so that the line names appear at the proper positions. This patch is a port of https://crrev.com/777829 Tests: imported/w3c/web-platform-tests/css/css-grid/parsing/grid-template-columns-computed-implicit-track.html imported/w3c/web-platform-tests/css/css-grid/parsing/grid-template-rows-computed-implicit-track.html * css/CSSComputedStyleDeclaration.cpp: (WebCore::populateGridTrackList): (WebCore::valueForGridTrackList): * rendering/RenderGrid.h: 2020-07-16 Andres Gonzalez <andresg_22@apple.com> [webAccessibilityObjectWrapper doAXAttributedStringForTextMarkerRange]needs to autorelease the return value from the main thread. https://bugs.webkit.org/show_bug.cgi?id=214404 <rdar://problem/65627156> Reviewed by Chris Fleizach. * accessibility/mac/WebAccessibilityObjectWrapperMac.mm: (-[WebAccessibilityObjectWrapper doAXAttributedStringForTextMarkerRange:spellCheck:]): Call retrieveAutoreleasedValueFromMainthread instead of retrieveValueFromMainThread. The autorelease call inside the lambda doesn't do the job. 2020-07-16 Carlos Garcia Campos <cgarcia@igalia.com> REGRESSION(r264280) [GTK][WPE] fast/gradients/conic-gradient-alpha.html is failing https://bugs.webkit.org/show_bug.cgi?id=214259 Reviewed by Darin Adler. * platform/graphics/ColorBlending.cpp: (WebCore::blendWithoutPremultiply): Use 'to' instead of 'from' when converting to SRGBA. * platform/graphics/cairo/GradientCairo.cpp: (WebCore::createConic): Use blendWithoutPremultiply() instead of blend() for the color stops interpolation. 2020-07-16 Carlos Garcia Campos <cgarcia@igalia.com> REGRESSION(r264272) [GTK][WPE] css3/color/composited-solid-backgrounds.html is failing https://bugs.webkit.org/show_bug.cgi?id=214260 Reviewed by Darin Adler. The problem is that clampToComponentFloat is returning a uint8_t instead of a float, so we always end up returning 0. * platform/graphics/ColorUtilities.h: (WebCore::clampToComponentFloat): 2020-07-15 Yusuke Suzuki <ysuzuki@apple.com> Should clear exception after microtask draining https://bugs.webkit.org/show_bug.cgi?id=214391 <rdar://problem/65536227> Reviewed by Mark Lam. Test: js/dom/microtask-drain-should-clear-exceptions.html Since microtask draining involves JS calls, potentially it can cause exception. We should clear exceptions after microtask draining since we do not handle it and suppress exception-check validation. And we also should not create ThrowScope in canAccessDocument when parameter says it never throws an error. Both cases are handled in the attached test. * bindings/js/JSDOMBindingSecurity.cpp: (WebCore::canAccessDocument): * bindings/js/JSExecState.h: (WebCore::JSExecState::~JSExecState): 2020-07-15 Devin Rousso <drousso@apple.com> Unreviewed followup, use `objectReplacementCharacter` instead of `0xFFFC` <https://webkit.org/b/214331> <rdar://problem/64779558> * editing/TextIterator.cpp: (WebCore::TextIterator::representNodeOffsetZero): 2020-07-15 Simon Fraser <simon.fraser@apple.com> Flip the sense of the return value for processWheelEventForScrollSnap() https://bugs.webkit.org/show_bug.cgi?id=214328 Reviewed by Wenson Hsieh. All the other functions return "true" to mean "handled". Make this one the same. * platform/cocoa/ScrollController.mm: (WebCore::ScrollController::handleWheelEvent): (WebCore::ScrollController::processWheelEventForScrollSnap): 2020-07-15 Devin Rousso <drousso@apple.com> should represent `TextPlaceholderElement` as an `NSTextAttachmentCharacter` instead of a `\n` https://bugs.webkit.org/show_bug.cgi?id=214331 <rdar://problem/64779558> Reviewed by Wenson Hsieh. * editing/TextIterator.cpp: (WebCore::shouldEmitReplacementInsteadOfNode): Added. (WebCore::shouldEmitNewlinesBeforeAndAfterNode): (WebCore::TextIterator::representNodeOffsetZero): Placeholders should eventually be removed, so stringifying them as a newline doesn't make sense as they should be treated as a "slot" in the existing flow of the surrounding content without changing the characteristics of the content (e.g. a sentence with a placeholder should remain as a sentence, not suddenly become two paragraphs separated by a placeholder). 2020-07-15 Stephan Szabo <stephan.szabo@sony.com> [PlayStation] Build fix after r264213 https://bugs.webkit.org/show_bug.cgi?id=214373 Unreviewed build fix No new tests, build fix only * PlatformPlayStation.cmake: Stop compiling UserAgentQuirks 2020-07-15 Daniel Bates <dabates@apple.com> [iOS] Caret should be before text placeholder instead of after it https://bugs.webkit.org/show_bug.cgi?id=214319 <rdar://problem/65295523> Reviewed by Wenson Hsieh. Move the caret to before the text placeholder to match UIKit. Tests: editing/text-placeholder/caret-before-zero-width-placeholder-in-content-editable-end-of-word.html editing/text-placeholder/caret-before-zero-width-placeholder-in-content-editable-start-of-word.html editing/text-placeholder/insert-into-content-editable-and-remove-via-mutation-event.html * editing/Editor.cpp: (WebCore::Editor::insertTextPlaceholder): Compute the position before the placeholder in its parent. This computation can only be done if the placeholder still has a parent. It may not after insertion because arbitrary JavaScript code can run. If this happens then bail out and return nullptr. Otherwise, set the new selection. 2020-07-15 Simon Fraser <simon.fraser@apple.com> itsnicethat.com page is sometimes non-scrollable https://bugs.webkit.org/show_bug.cgi?id=214362 <rdar://problem/65431127> Reviewed by Tim Horton. This page uses 'clip-path: inset(1px); on a 1px x 1px element to hit descendants from hit-testing and compositing code turns this into a layer mask using a CAShapeLayer. Our layer/view hit-testing code failed to check for masking; if a layer has a mask, it needs to be handled like -masksToBounds, in that points outside the mask should never hit descendant layers. Make a -_web_maskContainsPoint: to test whether the point is inside the mask layer, and _web_maskMayIntersectRect: which does approximate testing using path bounds intersection (this is used for editable regions). Also convert some hard-coded winding rule strings to use the CA constants. Tests: fast/scrolling/ios/clip-path-hit-test.html fast/scrolling/mac/clip-path-hit-test.html * page/scrolling/mac/ScrollingTreeMac.mm: (collectDescendantLayersAtPoint): * platform/graphics/ca/cocoa/PlatformCALayerCocoa.mm: (WebCore::PlatformCALayerCocoa::shapeWindRule const): (WebCore::PlatformCALayerCocoa::setShapeWindRule): * platform/graphics/cocoa/WebCoreCALayerExtras.h: * platform/graphics/cocoa/WebCoreCALayerExtras.mm: (-[CALayer _web_maskContainsPoint:]): (-[CALayer _web_maskMayIntersectRect:]): 2020-07-15 Mark Lam <mark.lam@apple.com> Add handling of out of memory handling while adding a worklet module. https://bugs.webkit.org/show_bug.cgi?id=214354 <rdar://problem/65271931> Reviewed by Yusuke Suzuki and Keith Miller. Test: fast/css-custom-paint/out-of-memory-while-adding-worklet-module.html * bindings/js/JSDOMExceptionHandling.cpp: (WebCore::createDOMException): * dom/ExceptionCode.h: * worklets/PaintWorkletGlobalScope.cpp: (WebCore::PaintWorkletGlobalScope::tryCreate): (WebCore::PaintWorkletGlobalScope::PaintWorkletGlobalScope): (WebCore::PaintWorkletGlobalScope::create): Deleted. * worklets/PaintWorkletGlobalScope.h: * worklets/Worklet.cpp: (WebCore::Worklet::addModule): * worklets/Worklet.h: * worklets/Worklet.idl: * worklets/WorkletGlobalScope.cpp: (WebCore::WorkletGlobalScope::WorkletGlobalScope): * worklets/WorkletGlobalScope.h: * worklets/WorkletScriptController.cpp: (WebCore::WorkletScriptController::WorkletScriptController): * worklets/WorkletScriptController.h: 2020-07-15 Oriol Brufau <obrufau@igalia.com> [css-grid] Rename SmallestTrackStart to ExplicitGridStart https://bugs.webkit.org/show_bug.cgi?id=214347 Reviewed by Manuel Rego Casasnovas. The SmallestTrackStart method used to return a signed int which was never positive, representing the smallest untranslated start among all grid items, clamped by 0 as a maximum. In practice, though, what we usually want is the index of the first explicit track/line among all tracks/lines, or equivalently, the number of leading implicit tracks/lines. That number is precisely minus the return value of SmallestTrackStart. Thus, in grid layout there were various std::abs() to invert the value. But it's a bit confusing to have an API which returns a non-positive integer, which then needs to be made non-negative. Therefore, this patch renames SmallestTrackStart to ExplicitGridStart, and makes it return the unsigned which is usually desired. This patch should have no effect in practice. This patch is a port of https://crrev.com/777768 * rendering/Grid.cpp: (WebCore::Grid::setExplicitGridStart): (WebCore::Grid::explicitGridStart const): (WebCore::Grid::setNeedsItemsPlacement): * rendering/Grid.h: * rendering/GridTrackSizingAlgorithm.cpp: (WebCore::GridTrackSizingAlgorithm::rawGridTrackSize const): * rendering/RenderGrid.cpp: (WebCore::RenderGrid::computeEmptyTracksForAutoRepeat const): (WebCore::RenderGrid::placeItemsOnGrid const): (WebCore::RenderGrid::populateExplicitGridAndOrderIterator const): (WebCore::RenderGrid::gridAreaBreadthForOutOfFlowChild): 2020-07-15 Chris Dumez <cdumez@apple.com> Unreviewed atttempt to fix build after r264389. * platform/gamepad/mac/HIDGamepadProvider.mm: (WebCore::HIDGamepadProvider::deviceRemoved): 2020-07-15 Zalan Bujtas <zalan@apple.com> [LFC][IFC] Remove Display::LineBox::isConsideredEmpty https://bugs.webkit.org/show_bug.cgi?id=214335 Reviewed by Antti Koivisto. Display classes should not have layout related bits. * layout/blockformatting/BlockMarginCollapse.cpp: (WebCore::Layout::BlockFormattingContext::MarginCollapse::marginsCollapseThrough const): * layout/displaytree/DisplayLineBox.h: (WebCore::Display::LineBox::baselineOffset const): (WebCore::Display::LineBox::LineBox): (WebCore::Display::LineBox::isConsideredEmpty const): Deleted. * layout/inlineformatting/InlineFormattingContext.cpp: (WebCore::Layout::InlineFormattingContext::setDisplayBoxesForLine): 2020-07-15 Alicia Boya García <aboya@igalia.com> [MSE][GStreamer] Break circular reference between SourceBufferPrivateGStreamer and AppendPipeline https://bugs.webkit.org/show_bug.cgi?id=214345 Reviewed by Xabier Rodriguez-Calvar. SourceBufferPrivate is ref counted. AppendPipeline is owned exclusively by SourceBufferPrivateGStreamer: it's born and destroyed with it, managed by a never-moved unique_ptr. AppendPipeline needs a reference to SourceBufferPrivateGStreamer to notify it of essential events like samples having been parsed. This used to be a Ref<>, thus creating a circular reference leak: AppendPipeline is only destroyed in SourceBufferPrivateGStreamer destructor. AppendPipeline holds ref counted reference to SourceBufferPrivateGStreamer, therefore neither are destroyed. This patch breaks the cycle by replacing the Ref<> in AppendPipeline with a plain old reference. This is safe because SourceBufferPrivateGStreamer owns, and therefore is alive at least just as long as AppendPipeline. As a consequence of not using Ref<>, the SourceBufferPrivateGStreamer constructor does no longer need to relax the adoption requirements and unique_ptr<AppendPipeline> can be replaced by a UniqueRef<>. * platform/graphics/gstreamer/mse/AppendPipeline.cpp: (WebCore::AppendPipeline::AppendPipeline): (WebCore::AppendPipeline::handleErrorConditionFromStreamingThread): (WebCore::AppendPipeline::handleStateChangeMessage): (WebCore::AppendPipeline::handleEndOfAppend): (WebCore::AppendPipeline::appsinkNewSample): (WebCore::AppendPipeline::didReceiveInitializationSegment): (WebCore::AppendPipeline::connectDemuxerSrcPadToAppsink): * platform/graphics/gstreamer/mse/AppendPipeline.h: (WebCore::AppendPipeline::sourceBufferPrivate): * platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.cpp: (WebCore::MediaPlayerPrivateGStreamerMSE::trackDetected): * platform/graphics/gstreamer/mse/SourceBufferPrivateGStreamer.cpp: (WebCore::SourceBufferPrivateGStreamer::SourceBufferPrivateGStreamer): * platform/graphics/gstreamer/mse/SourceBufferPrivateGStreamer.h: 2020-07-15 Brady Eidson <beidson@apple.com> Resolve race between IOHIDManager and GameController framework. <rdar://problem/65554490> and https://bugs.webkit.org/show_bug.cgi?id=214245 Reviewed by Tim Horton. No automated testing available. IOHIDDevices and IOHIDServices are two separate things. An IOHIDDevice and IOHIDService often have a 1-to-1 correlation, but the IOHIDDevice might be published to the application before the IOHIDService is. WebKit's HID gamepad manager uses IOHIDDevice. GameController.framework uses IOHIDServices. When we added the ability for WebKit to switch between HID and GCF, the following happens: - Sometimes the IOHIDServiceClient will get published first. Then when the IOHIDDevice is published, and WebKit was deciding which gamepad manager to use, the device's services are available, and we get the right answer. - Sometimes, the IOHIDDevice is published first. Then when WebKit is deciding which gamepad manager to use, it can't check the IOHIDServiceClient against GameController framework. So we have the HID manager handle the device... but then GCF comes along a split second later and ALSO handles it. The "device before service" scenario results in the same gamepad showing up twice. To resolve this, we do the following: 1 - If an IOHIDDevice attaches and its services aren't available yet, we delay managing it. 2 - When we delay managing a device, we start listening for IOHIDServiceClient additions. 3 - Each time a GamePad service is published, we once again try to determine if GCF will handle the device. 4 - As long as the answer is "Maybe" - instead of "Yes" or "No" - we refuse to manage the device. 5 - After a brief delay (currently 1 second), we will give up waiting for published services and manage the device with the HID gamepad provider. In my testing, when the service publishes after the devices, it's always within 50ms, (and usually just a spin or two of the runloop) so the 1s delay seems sufficient. NOTE: The above all holds true with the "MultiGamepadProvider" on Catalina. On Big Sur, there's brand new GameController framework API that makes this much easier. 👍 * platform/gamepad/mac/HIDGamepadProvider.h: * platform/gamepad/mac/HIDGamepadProvider.mm: (WebCore::deviceAddedCallback): (WebCore::gameControllerFrameworkWillHandleHIDDevice): (WebCore::HIDGamepadProvider::waitForManagementDecisionForDevice): (WebCore::HIDGamepadProvider::removeDeviceWaitingForManagementDecision): (WebCore::HIDGamepadProvider::newGamePadServicePublished): (WebCore::HIDGamepadProvider::deviceAdded): (WebCore::HIDGamepadProvider::deviceRemoved): 2020-07-14 Zalan Bujtas <zalan@apple.com> Caret leaves trails behind when the editable content is subpixel positioned https://bugs.webkit.org/show_bug.cgi?id=214333 <rdar://problem/61914738> Reviewed by Simon Fraser. Replace integral rounding with pixelsnapping when painting the caret. The paint invalidation uses device pixel snapping and the actual painting needs to match it in order to not paint outside of the invalidated region. * editing/Editing.cpp: (WebCore::caretRendersInsideNode): (WebCore::rendererForCaretPainting): * editing/Editing.h: * editing/FrameSelection.cpp: (WebCore::FrameSelection::paintCaret): (WebCore::CaretBase::computeCaretColor): (WebCore::CaretBase::paintCaret const): (WebCore::DragCaretController::paintDragCaret const): * editing/FrameSelection.h: 2020-07-14 James Darpinian <jdarpinian@chromium.org> [WebGL2] vertexAttribI* and getFragDataLocation https://bugs.webkit.org/show_bug.cgi?id=214211 Reviewed by Dean Jackson. Passes all relevant WebGL 2 conformance tests. * html/canvas/WebGL2RenderingContext.cpp: (WebCore::WebGL2RenderingContext::getFragDataLocation): (WebCore::WebGL2RenderingContext::vertexAttribI4i): (WebCore::WebGL2RenderingContext::vertexAttribI4iv): (WebCore::WebGL2RenderingContext::vertexAttribI4ui): (WebCore::WebGL2RenderingContext::vertexAttribI4uiv): * html/canvas/WebGLRenderingContextBase.cpp: (WebCore::WebGLRenderingContextBase::getVertexAttrib): (WebCore::WebGLRenderingContextBase::vertexAttribfImpl): (WebCore::WebGLRenderingContextBase::vertexAttribfvImpl): (WebCore::WebGLRenderingContextBase::simulateVertexAttrib0): * html/canvas/WebGLRenderingContextBase.h: (WebCore::WebGLRenderingContextBase::VertexAttribValue::initValue): * platform/graphics/angle/GraphicsContextGLANGLE.cpp: (WebCore::GraphicsContextGLOpenGL::getFragDataLocation): (WebCore::GraphicsContextGLOpenGL::vertexAttribI4i): (WebCore::GraphicsContextGLOpenGL::vertexAttribI4iv): (WebCore::GraphicsContextGLOpenGL::vertexAttribI4ui): (WebCore::GraphicsContextGLOpenGL::vertexAttribI4uiv): 2020-07-14 Kenneth Russell <kbr@chromium.org> [WebGL2] Implement compressedTex{Sub}Image*, copyTexSubImage3D https://bugs.webkit.org/show_bug.cgi?id=126449 Reviewed by Dean Jackson. Implement WebGL 2.0 entry points compressedTex{Sub}Image[23]D and copyTexSubImage3D. These require and use the ANGLE_robust_client_memory extension for size checking. Remove the associated entry points from GraphicsContextGL and subclasses, since they will never be used. Add needed pixel buffer object validation to the WebGL 1.0 versions of these APIs as well as to texImage2D and texSubImage2D. * html/canvas/WebGL2RenderingContext.cpp: (WebCore::WebGL2RenderingContext::texImage2D): (WebCore::WebGL2RenderingContext::texSubImage2D): (WebCore::WebGL2RenderingContext::copyTexSubImage3D): (WebCore::WebGL2RenderingContext::compressedTexImage2D): (WebCore::WebGL2RenderingContext::compressedTexImage3D): (WebCore::WebGL2RenderingContext::compressedTexSubImage2D): (WebCore::WebGL2RenderingContext::compressedTexSubImage3D): * html/canvas/WebGL2RenderingContext.h: * html/canvas/WebGLRenderingContextBase.cpp: * html/canvas/WebGLRenderingContextBase.h: * platform/graphics/GraphicsContextGL.h: * platform/graphics/angle/GraphicsContextGLANGLE.cpp: (WebCore::GraphicsContextGLOpenGL::copyTexSubImage3D): (WebCore::GraphicsContextGLOpenGL::compressedTexImage3D): Deleted. (WebCore::GraphicsContextGLOpenGL::compressedTexSubImage3D): Deleted. * platform/graphics/opengl/GraphicsContextGLOpenGL.h: * platform/graphics/opengl/GraphicsContextGLOpenGLCommon.cpp: (WebCore::GraphicsContextGLOpenGL::compressedTexImage3D): Deleted. (WebCore::GraphicsContextGLOpenGL::compressedTexSubImage3D): Deleted. 2020-07-14 Chris Dumez <cdumez@apple.com> Drop cache of subframe count on the Page https://bugs.webkit.org/show_bug.cgi?id=214312 <rdar://problem/65433615> Reviewed by Geoffrey Garen. Drop cache of subframe count on the Page as it is error-prone to keep it up to date and it is not performance sensitive. We only need the subframe count when trying to load a new iframe to see if we reached the maximum number of subframes (1000). Calculating this count is also not very expensive since we merely need to iterate the frame tree, which is composed of at most 1000 frames. * history/CachedFrame.cpp: (WebCore::CachedFrame::CachedFrame): (WebCore::CachedFrame::open): * loader/FrameLoader.cpp: (WebCore::FrameLoader::closeAndRemoveChild): * page/Frame.cpp: (WebCore::Frame::Frame): (WebCore::Frame::disconnectOwnerElement): * page/FrameTree.cpp: (WebCore::FrameTree::childCount const): (WebCore::FrameTree::descendantCount const): * page/FrameTree.h: * page/Page.cpp: (WebCore::Page::subframeCount const): * page/Page.h: 2020-07-14 James Darpinian <jdarpinian@chromium.org> Implement uniform* and getUniform for WebGL 2 types https://bugs.webkit.org/show_bug.cgi?id=214116 Reviewed by Dean Jackson. Passes all relevant WebGL conformance tests. * html/canvas/WebGL2RenderingContext.cpp: (WebCore::WebGL2RenderingContext::getFragDataLocation): (WebCore::WebGL2RenderingContext::uniform1ui): (WebCore::WebGL2RenderingContext::uniform2ui): (WebCore::WebGL2RenderingContext::uniform3ui): (WebCore::WebGL2RenderingContext::uniform4ui): (WebCore::WebGL2RenderingContext::uniform1uiv): (WebCore::WebGL2RenderingContext::uniform2uiv): (WebCore::WebGL2RenderingContext::uniform3uiv): (WebCore::WebGL2RenderingContext::uniform4uiv): (WebCore::WebGL2RenderingContext::uniformMatrix2x3fv): (WebCore::WebGL2RenderingContext::uniformMatrix3x2fv): (WebCore::WebGL2RenderingContext::uniformMatrix2x4fv): (WebCore::WebGL2RenderingContext::uniformMatrix4x2fv): (WebCore::WebGL2RenderingContext::uniformMatrix3x4fv): (WebCore::WebGL2RenderingContext::uniformMatrix4x3fv): (WebCore::WebGL2RenderingContext::uniform1fv): (WebCore::WebGL2RenderingContext::uniform2fv): (WebCore::WebGL2RenderingContext::uniform3fv): (WebCore::WebGL2RenderingContext::uniform4fv): (WebCore::WebGL2RenderingContext::uniform1iv): (WebCore::WebGL2RenderingContext::uniform2iv): (WebCore::WebGL2RenderingContext::uniform3iv): (WebCore::WebGL2RenderingContext::uniform4iv): (WebCore::WebGL2RenderingContext::uniformMatrix2fv): (WebCore::WebGL2RenderingContext::uniformMatrix3fv): (WebCore::WebGL2RenderingContext::uniformMatrix4fv): * html/canvas/WebGLRenderingContextBase.cpp: (WebCore::WebGLRenderingContextBase::getUniform): (WebCore::WebGLRenderingContextBase::uniform1fv): (WebCore::WebGLRenderingContextBase::uniform2fv): (WebCore::WebGLRenderingContextBase::uniform3fv): (WebCore::WebGLRenderingContextBase::uniform4fv): (WebCore::WebGLRenderingContextBase::uniform1iv): (WebCore::WebGLRenderingContextBase::uniform2iv): (WebCore::WebGLRenderingContextBase::uniform3iv): (WebCore::WebGLRenderingContextBase::uniform4iv): (WebCore::WebGLRenderingContextBase::uniformMatrix2fv): (WebCore::WebGLRenderingContextBase::uniformMatrix3fv): (WebCore::WebGLRenderingContextBase::uniformMatrix4fv): (WebCore::WebGLRenderingContextBase::validateUniformParameters): (WebCore::WebGLRenderingContextBase::validateUniformMatrixParameters): * html/canvas/WebGLRenderingContextBase.h: * platform/graphics/GraphicsContextGL.h: * platform/graphics/angle/GraphicsContextGLANGLE.cpp: (WebCore::GraphicsContextGLOpenGL::getUniformuiv): (WebCore::GraphicsContextGLOpenGL::getFragDataLocation): (WebCore::GraphicsContextGLOpenGL::uniform1ui): (WebCore::GraphicsContextGLOpenGL::uniform2ui): (WebCore::GraphicsContextGLOpenGL::uniform3ui): (WebCore::GraphicsContextGLOpenGL::uniform4ui): (WebCore::GraphicsContextGLOpenGL::uniform1uiv): (WebCore::GraphicsContextGLOpenGL::uniform2uiv): (WebCore::GraphicsContextGLOpenGL::uniform3uiv): (WebCore::GraphicsContextGLOpenGL::uniform4uiv): (WebCore::GraphicsContextGLOpenGL::uniformMatrix2x3fv): (WebCore::GraphicsContextGLOpenGL::uniformMatrix3x2fv): (WebCore::GraphicsContextGLOpenGL::uniformMatrix2x4fv): (WebCore::GraphicsContextGLOpenGL::uniformMatrix4x2fv): (WebCore::GraphicsContextGLOpenGL::uniformMatrix3x4fv): (WebCore::GraphicsContextGLOpenGL::uniformMatrix4x3fv): (WebCore::GraphicsContextGLOpenGL::uniform1fv): (WebCore::GraphicsContextGLOpenGL::uniform2fv): (WebCore::GraphicsContextGLOpenGL::uniform3fv): (WebCore::GraphicsContextGLOpenGL::uniform4fv): (WebCore::GraphicsContextGLOpenGL::uniform1iv): (WebCore::GraphicsContextGLOpenGL::uniform2iv): (WebCore::GraphicsContextGLOpenGL::uniform3iv): (WebCore::GraphicsContextGLOpenGL::uniform4iv): (WebCore::GraphicsContextGLOpenGL::uniformMatrix2fv): (WebCore::GraphicsContextGLOpenGL::uniformMatrix3fv): (WebCore::GraphicsContextGLOpenGL::uniformMatrix4fv): * platform/graphics/opengl/GraphicsContextGLOpenGL.h: * platform/graphics/opengl/GraphicsContextGLOpenGLCommon.cpp: (WebCore::GraphicsContextGLOpenGL::getUniformuiv): 2020-07-14 Per Arne Vollan <pvollan@apple.com> [iOS] Avoid loading media libraries in Document::visibilityStateChanged() if not needed https://bugs.webkit.org/show_bug.cgi?id=214304 <rdar://problem/65005038> Unreviewed, address additional review comments. * dom/Document.cpp: (WebCore::Document::visibilityStateChanged): 2020-07-14 Jer Noble <jer.noble@apple.com> Add support for parsing VP-style codec strings. https://bugs.webkit.org/show_bug.cgi?id=214270 Reviewed by Eric Carlson. Test: media/vp-codec-parameters.html * Sources.txt: * WebCore.xcodeproj/project.pbxproj: * platform/graphics/VP9Utilities.cpp: Added. (WebCore::validVPLevels): (WebCore::validColorPrimaries): (WebCore::parseVPCodecParameters): * platform/graphics/VP9Utilities.h: Added. * testing/Internals.cpp: (WebCore::Internals::parseVPCodecParameters): * testing/Internals.h: * testing/Internals.idl: 2020-07-14 Said Abou-Hallawa <sabouhallawa@apple.com> When invalidating the clients of an SVG resource we should not go beyond the RenderSVGRoot https://bugs.webkit.org/show_bug.cgi?id=211804 <rdar://problem/60308199> Reviewed by Zalan Bujtas. ComplexLineLayout::layoutLineBoxes() walks through the renderers of a line. The order of this walk may include a node and its children. For example the layout of a RenderInline may be run first, then it is followed by the layout for a RenderSVGRoot which happens to be a child of the RenderInline. If the RenderSVGRoot has a dirty RenderSVGResource, e.g. RenderSVGResourceClipper, this resource will call RenderSVGResource::markForLayoutAndParentResourceInvalidation() which will invalidate its ancestors including RenderSVGRoot and RenderInline by setting the normalChildNeedsLayoutBit() for each of them. The layout of SVG is hierarchical which means RenderSVGRoot will finish its layout after finishing the layout of all its descendants including this RenderSVGResource. So dirtying the RenderSVGRoot is this scenario is okay since RenderSVGRoot will do another SVGRenderSupport::layoutChildren() and will clear its needsLayout bits before it returns. The problem happens because we set normalChildNeedsLayoutBit for the containing RenderInline and this leaves the render tree dirty. Later Document::resolveStyle() may called to invalidate an SVG element e.g. RenderSVGPath. So setNeedsLayout() is called for this object. Because the normalChildNeedsLayoutBit() is set for the RenderInline, RenderObject::markContainingBlocksForLayout() stops in the middle and do not mark the containing RenderBlock. So we end up with a render tree like this: + RenderView + HTML RenderBlock + BODY RenderBody - RenderBlock + ANY-ELEMENT RenderInline + svg RenderSVGRoot - clipPath RenderSVGResourceClipper + polygon RenderSVGPath where the '+' means needsLayout() is true and '-' means needsLayout() is false. So the layout will not run for RenderBlock with '-' sign. And we end up with dirty RenderSVGPath or even worse RenderSVGPath with uninitialized m_path. So a null pointer deref may happen. The fix is to prevent mutating the render tree while running the layout of the SVG resource. This can be done by making the RenderSVGResource not dirtying any renderer beyond the RenderSVGRoot when it finishes its layout. The SVG resource layout should not affect the intrinsic size of the SVG if it is embedded in an HTML document. In RenderObject::markContainingBlocksForLayout(), we do something similar when we break if the ancestor is objectIsRelayoutBoundary(). Test: svg/in-html/inline-svg-resource-dynamic-update.html * rendering/svg/RenderSVGResource.cpp: (WebCore::RenderSVGResource::markForLayoutAndParentResourceInvalidation): * rendering/svg/RenderSVGRoot.cpp: (WebCore::RenderSVGRoot::layout): * rendering/svg/RenderSVGRoot.h: 2020-07-14 Per Arne Vollan <pvollan@apple.com> [iOS] Avoid loading media libraries in Document::visibilityStateChanged() if not needed https://bugs.webkit.org/show_bug.cgi?id=214304 <rdar://problem/65005038> Reviewed by Darin Adler. When the shared PlatformMediaSessionManager is created and accessed for the first time, some media libraries are loaded. There should be no need to access the shared PlatformMediaSessionManager if no manager has been created in Document::visibilityStateChanged(). No new tests, since this patch does not change behavior. * dom/Document.cpp: (WebCore::Document::visibilityStateChanged): 2020-07-14 Jonathan Bedard <jbedard@apple.com> [watchOS] Support armv7k build https://bugs.webkit.org/show_bug.cgi?id=214306 <rdar://problem/65549901> Reviewed by Aakash Jain. No new tests, build fix. * Configurations/Base.xcconfig: Disable 64 to 32 bit conversion warning for armv7k. 2020-07-14 Eric Carlson <eric.carlson@apple.com> [macOS] Do not update ScreenTime when in private browsing mode https://bugs.webkit.org/show_bug.cgi?id=214288 <rdar://problem/63735067> Reviewed by Jer Noble. Test: media/media-usage-state-private-browsing.html * html/MediaElementSession.cpp: (WebCore::MediaElementSession::updateMediaUsageIfChanged): Return early if the page is in private mode. 2020-07-14 Clark Wang <clark_wang@apple.com> Updated AudioContext constructor according to spec https://bugs.webkit.org/show_bug.cgi?id=214267 Reviewed by Chris Dumez. Updated AudioContext constructor according to spec: https://www.w3.org/TR/webaudio/#AudioContext-constructors. Added in files accordingly to support AudioContextOptions. Re-baselined existing tests. One new test case passes, and one fails due to current accepted range for sampleRate. * CMakeLists.txt: * DerivedSources-input.xcfilelist: * DerivedSources-output.xcfilelist: * DerivedSources.make: * Modules/webaudio/AudioContext.cpp: (WebCore::AudioContext::create): (WebCore::AudioContext::AudioContext): * Modules/webaudio/AudioContext.h: (WebCore::AudioContext::create): * Modules/webaudio/AudioContext.idl: * Modules/webaudio/AudioContextLatencyCategory.h: Added. * Modules/webaudio/AudioContextLatencyCategory.idl: Added. * Modules/webaudio/AudioContextOptions.h: Added. * Modules/webaudio/AudioContextOptions.idl: Added. * Modules/webaudio/BaseAudioContext.cpp: (WebCore::BaseAudioContext::BaseAudioContext): * Modules/webaudio/BaseAudioContext.h: * Modules/webaudio/DefaultAudioDestinationNode.cpp: (WebCore::DefaultAudioDestinationNode::DefaultAudioDestinationNode): * Modules/webaudio/DefaultAudioDestinationNode.h: * Modules/webaudio/PannerNode.cpp: (WebCore::PannerNode::PannerNode): * Sources.txt: * WebCore.xcodeproj/project.pbxproj: 2020-07-14 Justin Fan <justin_fan@apple.com> [WebGL] REGRESSION (r262366): Google search photos do not render, black images https://bugs.webkit.org/show_bug.cgi?id=214156 <rdar://problem/64964922> Reviewed by Dean Jackson. http://trac.webkit.org/changeset/262366 separated WebGL canvas contents swapping and presentation into two steps. This Google search page was only running the presentation code without the swapping step, as it removes canvases from the observer Document before the Document is able to swap its canvas' contents. Ensure that re-inserted canvas elements properly register their new Documents as observers. Covered by existing tests. * html/HTMLCanvasElement.cpp: (WebCore::HTMLCanvasElement::insertedIntoAncestor): * html/HTMLCanvasElement.h: 2020-07-14 Fujii Hironori <Hironori.Fujii@sony.com> Unreviewed non-unified build fixes * bindings/js/CommonVM.cpp: * html/canvas/CanvasRenderingContext2DBase.cpp: * html/canvas/CanvasStyle.cpp: * platform/graphics/GradientImage.cpp: * rendering/svg/RenderSVGPath.cpp: 2020-07-13 Fujii Hironori <Hironori.Fujii@sony.com> Unreviewed non-unified build fixes * animation/CSSTransition.cpp: * html/HTMLFormControlElement.cpp: * html/ImageData.cpp: * inspector/InspectorInstrumentationWebKit.h: * layout/FormattingContextGeometry.cpp: * layout/floats/FloatingContext.cpp: * layout/floats/FloatingState.cpp: * layout/tableformatting/TableFormattingContext.cpp: * loader/MediaResourceLoader.cpp: * platform/FrameRateMonitor.h: * platform/graphics/ColorSerialization.cpp: * platform/graphics/ColorSerialization.h: * svg/SVGNumber.h: * svg/SVGParserUtilities.h: * svg/SVGTransformList.cpp: * svg/SVGZoomAndPan.cpp: 2020-07-13 Peng Liu <peng.liu6@apple.com> Keyboard remains on full screen video view after back from PiP https://bugs.webkit.org/show_bug.cgi?id=214287 Reviewed by Daniel Bates. Make the window for video fullscreen and picture-in-picture support the key window after the video returns to fullscreen from the picture-in-picture mode. Otherwise, the WebAVPlayerViewController cannot become the first responder. * platform/ios/VideoFullscreenInterfaceAVKit.mm: (VideoFullscreenInterfaceAVKit::didStopPictureInPicture): 2020-07-13 Zalan Bujtas <zalan@apple.com> [RenderTreeNeedsLayoutChecker] imported/w3c/web-platform-tests/html/rendering/replaced-elements/embedded-content/video-controls-vertical-writing-mode.html asserts https://bugs.webkit.org/show_bug.cgi?id=214281 <rdar://problem/56740133> Reviewed by Simon Fraser. While percentage height descendant computation runs on the containing block chain, when we mark the ancestors for layout, we need to traverse the parent (container) chain rather than the containing block chain. Containing block traversal skips certain non-block renderers which leaves gap between dirty renderers. Renderer[A] + dirty Renderer[B] - not dirty Renderer[C] + dirty During layout this gap (Renderer[B]) makes us exit early, resulting dirty leftover renderers (Renderer[C]). This is similar to what we do in RenderObject::markContainingBlocksForLayout. * rendering/RenderBlock.cpp: (WebCore::RenderBlock::dirtyForLayoutFromPercentageHeightDescendants): 2020-07-13 Andres Gonzalez <andresg_22@apple.com> REGRESSION: (r257915?) [ Mac ] accessibility/accessibility-node-memory-management.html is flaky failing. https://bugs.webkit.org/show_bug.cgi?id=208930 Reviewed by Chris Fleizach. Test: accessibility/accessibility-node-memory-management.html In some cases, such as the empty canvas in this test, the algorithm in AXIsolatedTree::updateChildren to only update the children that are added or removed does not work. In those cases, fallback to updating the entire subtree. * accessibility/isolatedtree/AXIsolatedTree.cpp: (WebCore::AXIsolatedTree::updateChildren): 2020-07-13 Keith Miller <keith_miller@apple.com> ScriptController needs to SetForScope m_sourceURL after Refing its Frame https://bugs.webkit.org/show_bug.cgi?id=214276 Reviewed by Chris Dumez. The SetForScopes in ScriptController need to be constructed after the Frame is retained otherwise the Ref to the frame may be destroyed before m_sourceURL is restored. Since the Frame owns the ScriptController we end up writing the SourceURL after the ScriptController has been freed. No new tests because my recent code change already caused ASAN failures. * bindings/js/ScriptController.cpp: (WebCore::ScriptController::evaluateInWorld): (WebCore::ScriptController::evaluateModule): (WebCore::ScriptController::callInWorld): 2020-07-13 Geoffrey Garen <ggaren@apple.com> Unreviewed, re-landing r264242 with crash fixed. Re-landed changeset: "JSRunLoopTimer should use WTF::RunLoop rather than custom CF code" https://bugs.webkit.org/show_bug.cgi?id=214102 https://trac.webkit.org/changeset/264242 * bindings/js/CommonVM.cpp: (WebCore::commonVMSlow): 2020-07-13 Eric Carlson <eric.carlson@apple.com> Impossible to pause playback of MediaStream video track https://bugs.webkit.org/show_bug.cgi?id=214262 <rdar://problem/65483729> Reviewed by Jer Noble. These changes were tested manually because they don't change the behavior when snapshotting or rendering to canvas. * platform/graphics/avfoundation/SampleBufferDisplayLayer.h: Add pure virtual play and pause methods. * platform/graphics/avfoundation/objc/LocalSampleBufferDisplayLayer.h: (WebCore::LocalSampleBufferDisplayLayer::play): New, toggle m_paused. (WebCore::LocalSampleBufferDisplayLayer::pause): Ditto. * platform/graphics/avfoundation/objc/LocalSampleBufferDisplayLayer.mm: (WebCore::LocalSampleBufferDisplayLayer::enqueueSample): Return early if paused. * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm: (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::ensureLayers): Pause the display layer if necessary. (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::play): Start display layer. (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::pause): Pause display layer. 2020-07-13 Sam Weinig <weinig@apple.com> Replace single argument makeSimpleColor uses with their implementation https://bugs.webkit.org/show_bug.cgi?id=214240 Reviewed by Darin Adler. Remove makeSimpleColor overloads that took SRGBA<uint8_t> and SRGBA<float>: - makeSimpleColor(SRGBA<uint8_t>) was a no-op, so is replaced with nothing. - makeSimpleColor(SRGBA<float>) is replaced by the function it called, convertToComponentBytes(). * css/StyleColor.cpp: (WebCore::StyleColor::colorFromKeyword): * css/parser/CSSPropertyParserHelpers.cpp: (WebCore::CSSPropertyParserHelpers::parseHSLParameters): * editing/cocoa/DataDetection.mm: (WebCore::DataDetection::detectContentInRange): * html/canvas/CanvasRenderingContext2DBase.cpp: (WebCore::CanvasRenderingContext2DBase::setShadow): * html/canvas/CanvasStyle.cpp: (WebCore::CanvasStyle::CanvasStyle): (WebCore::CanvasStyle::isEquivalent const): * platform/graphics/Color.cpp: (WebCore::Color::lightened const): (WebCore::Color::darkened const): * platform/graphics/SimpleColor.h: * platform/graphics/avfoundation/InbandTextTrackPrivateAVF.cpp: (WebCore::makeSimpleColorFromARGBCFArray): * platform/graphics/filters/FilterOperations.cpp: (WebCore::FilterOperations::transformColor const): (WebCore::FilterOperations::inverseTransformColor const): * platform/graphics/mac/ColorMac.mm: (WebCore::makeSimpleColorFromNSColor): (WebCore::colorFromNSColor): (WebCore::semanticColorFromNSColor): * platform/graphics/win/PlatformContextDirect2D.cpp: (WebCore::PlatformContextDirect2D::brushWithColor): * platform/ios/ColorIOS.mm: (WebCore::colorFromUIColor): 2020-07-13 Sihui Liu <sihui_liu@appe.com> Text manipulation does not observe manipulated text after update https://bugs.webkit.org/show_bug.cgi?id=213318 <rdar://problem/63766703> Reviewed by Geoffrey Garen. Make TextManipulationController be aware of content replacement on Text and extract the new content. Test: TextManipulation.CompleteTextManipulationForManipulatedTextWithNewContent * dom/CharacterData.h: * dom/Text.cpp: (WebCore::Text::setDataAndUpdate): * dom/Text.h: * editing/TextManipulationController.cpp: (WebCore::TextManipulationController::didCreateRendererForElement): (WebCore::TextManipulationController::didUpdateContentForText): (WebCore::TextManipulationController::scheduleObservationUpdate): * editing/TextManipulationController.h: * editing/markup.cpp: 2020-07-13 Keith Miller <keith_miller@apple.com> Clean up SourceProvider and add caller relative load script to jsc.cpp https://bugs.webkit.org/show_bug.cgi?id=214205 Reviewed by Yusuke Suzuki. Refactor WebCore <-> JSC binding layer now that JSC uses WTF::URLs for SourceOrigins. Also, improve module loading error messages to include the specifier and referrer when producing errors around bare-name specifiers. New error message behavior is already tested so existing tests have been updated. * bindings/js/CachedScriptSourceProvider.h: (WebCore::CachedScriptSourceProvider::CachedScriptSourceProvider): * bindings/js/JSEventListener.cpp: (WebCore::JSEventListener::handleEvent): * bindings/js/JSEventListener.h: (WebCore::JSEventListener::sourceURL const): * bindings/js/JSLazyEventListener.cpp: (WebCore::JSLazyEventListener::JSLazyEventListener): (WebCore::JSLazyEventListener::initializeJSFunction const): (WebCore::JSLazyEventListener::create): * bindings/js/JSLazyEventListener.h: * bindings/js/ScriptController.cpp: (WebCore::ScriptController::evaluateInWorld): (WebCore::ScriptController::evaluateModule): (WebCore::ScriptController::callInWorld): * bindings/js/ScriptController.h: (WebCore::ScriptController::sourceURL const): * bindings/js/ScriptModuleLoader.cpp: (WebCore::resolveModuleSpecifier): (WebCore::rejectPromise): * bindings/js/ScriptSourceCode.h: (WebCore::ScriptSourceCode::ScriptSourceCode): (WebCore::ScriptSourceCode::url const): 2020-07-13 Alicia Boya García <aboya@igalia.com> [MSE][GStreamer] Discard PTS-less samples https://bugs.webkit.org/show_bug.cgi?id=214252 Reviewed by Philippe Normand. In some cases GStreamer demuxers emit PTS-less samples with metadata at the beginning of the container. These are fortunately not necessary for playback, and in fact incompatible with the way MSE works, where you should be able to start playing a stream from the middle. This patch skips these frames in the AppendPipeline so they don't pollute other parts of the MSE codebase. Since these frames were not necessary and were later overwritten, this patch is just a cleanup introducing no notable behavior changes. * platform/graphics/gstreamer/mse/AppendPipeline.cpp: (WebCore::AppendPipeline::appsinkNewSample): 2020-07-13 Carlos Garcia Campos <cgarcia@igalia.com> [WPE][GTK4] Form controls are not painted when using threaded rendering https://bugs.webkit.org/show_bug.cgi?id=214178 Reviewed by Žan Doberšek. Which is the default for GTK4 since r263888. The problem is that RenderTheme::paint() returns early if the given GraphicsContext doesn't have a platform context, assuming all RenderTheme implementations paint directly to the platform context. This patch adds a pure virtual canPaint() to RenderTheme to be used as the early return. * rendering/RenderTheme.cpp: (WebCore::RenderTheme::paint): * rendering/RenderTheme.h: * rendering/RenderThemeAdwaita.h: * rendering/RenderThemeCocoa.h: * rendering/RenderThemeCocoa.mm: (WebCore::RenderThemeCocoa::canPaint const): * rendering/RenderThemePlayStation.h: * rendering/RenderThemeWin.h: 2020-07-13 Xabier Rodriguez Calvar <calvaris@igalia.com> [GStreamer] Unreviewed, remove private debug code When I landed the OpenCDM code I accidentally landed a couple of things that were internal debug that is not useful upstream. * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp: (WebCore::MediaPlayerPrivateGStreamer::handleSyncMessage): (WebCore::MediaPlayerPrivateGStreamer::handleMessage): 2020-07-12 Darin Adler <darin@apple.com> Some further streamlining of Gradient handling code https://bugs.webkit.org/show_bug.cgi?id=214239 Reviewed by Sam Weinig. * platform/graphics/cairo/GradientCairo.cpp: (WebCore::interpolateColorStop): Deleted. (WebCore::createConic): Rewrite the interpolation code to create a new vector rather than edit the existing one and to use a more straightforward idiom, and a lambda rather than a helper function. Also removed an explicit conversion to Gradient::ColorStop, no longer needed because of the overload added to Vector::insert. * rendering/svg/RenderSVGResourceGradient.cpp: (WebCore::RenderSVGResourceGradient::applyResource): Use ensure rather than add to initialize gradient data in the gradient map. Change the #if for USE(CG) so it doesn't confuse brace matching from the syntax handling of text editors like the one in Xcode. Update for the changes to the buildGradient and gradientTransform functions. Use auto a bit more. (WebCore::RenderSVGResourceGradient::postApplyResource): Update since the map now contains GradientData rather than unique_ptr<GradientData>. Use std::exchange when fetching m_savedContext and a local variable to make the gradient-related code a bit less wordy. (WebCore::RenderSVGResourceGradient::addStops): Updated to take Gradient& rather than GradientData* and made this a static member function. (WebCore::RenderSVGResourceGradient::platformSpreadMethodFromSVGType): Made this a static member function. * rendering/svg/RenderSVGResourceGradient.h: Made more functions private. Converted addStops and platformSpreadMethodFromSVGType to static member functions. Made GradientData a member class, and put directly into the HashMap rather than putting unique_ptr into the map. Changed calculateGradientTransform to gradientTransform, which uses a return value rather than an out argument. Changed buildGradient to return Ref<Gradient> rather than taking a GradientData* to store it in. * rendering/svg/RenderSVGResourceLinearGradient.cpp: (WebCore::RenderSVGResourceLinearGradient::buildGradient const): Changed to return the gradient instead of modifying an argument and updated for the change to addStops. * rendering/svg/RenderSVGResourceLinearGradient.h: Made more functions private and updated for changes to gradientTransform and buildGradient. * rendering/svg/RenderSVGResourceRadialGradient.cpp: (WebCore::RenderSVGResourceRadialGradient::buildGradient const): Changed to return the gradient instead of modifying an argument and updated for the change to addStops. * rendering/svg/RenderSVGResourceRadialGradient.h: Made more functions private and updated for changes to gradientTransform and buildGradient. * svg/GradientAttributes.h: Removed the stopsSet boolean since the stops vector is empty if and only if it's not set. Made the setStops function take an rvalue reference so it doesn't always copy a vector. Also use the ColorStopVector type, sharing the same inline capacity policy with the Gradient class; both are optimizing the same thing. * svg/SVGGradientElement.cpp: (WebCore::SVGGradientElement::buildStops): Use the ColorStopVector type. * svg/SVGGradientElement.h: Update for the above. * svg/SVGLinearGradientElement.cpp: (WebCore::setGradientAttributes): Update for changes to buildStops and removed an unnecessary check for an empty vector now that an empty vector has the same semantics as "no stops". * svg/SVGRadialGradientElement.cpp: (WebCore::setGradientAttributes): Ditto. 2020-07-12 Fujii Hironori <Hironori.Fujii@sony.com> [WinCairo][Clang] Unreviewed build fix for r264272 https://bugs.webkit.org/show_bug.cgi?id=214204 <rdar://problem/65414170> clang-cl reported: > ..\..\Source\WebCore\platform\graphics/ColorUtilities.h(200,26): error: no template named 'ComponentTraits' > constexpr auto min = ComponentTraits<typename ColorType::ComponentType>::minValue; > ^ * platform/graphics/ColorUtilities.cpp: Removed #include "ColorTypes.h". * platform/graphics/ColorUtilities.h: Added #include "ColorTypes.h". 2020-07-12 Said Abou-Hallawa <sabouhallawa@apple.com> [macOS]: A HEIF image, selected from the OpenPanel, should be converted to an accepted MIME type https://bugs.webkit.org/show_bug.cgi?id=213347 <rdar://problem/57258464> Reviewed by Darin Adler. Tests: fast/forms/file/entries-api/image-no-transcode-open-panel.html fast/forms/file/entries-api/image-transcode-open-panel.html * platform/MIMETypeRegistry.cpp: (WebCore::MIMETypeRegistry::allowedMIMETypes): Make sure this function returns lowercase MIME types. * platform/MIMETypeRegistry.h: * platform/graphics/NativeImage.h: * platform/graphics/cg/NativeImageCG.cpp: (WebCore::drawNativeImage): 2020-07-12 Sam Weinig <weinig@apple.com> Tidy up color usage in accessibility code https://bugs.webkit.org/show_bug.cgi?id=214226 Reviewed by Darin Adler. Rather than passing around r, g, b components as out-parameters, use SRGBA<uint8_t> return values. * accessibility/AccessibilityNodeObject.cpp: (WebCore::AccessibilityNodeObject::colorValue const): * accessibility/AccessibilityNodeObject.h: * accessibility/AccessibilityObject.h: * accessibility/AccessibilityObjectInterface.h: * accessibility/atk/WebKitAccessibleInterfaceText.cpp: (webkitAccessibleTextGetText): * accessibility/isolatedtree/AXIsolatedObject.cpp: (WebCore::AXIsolatedObject::initializeAttributeData): (WebCore::AXIsolatedObject::colorValue const): * accessibility/isolatedtree/AXIsolatedObject.h: * accessibility/mac/WebAccessibilityObjectWrapperMac.mm: (-[WebAccessibilityObjectWrapper accessibilityAttributeValue:]): 2020-07-12 Rob Buis <rbuis@igalia.com> Improve IPv6 detection when setting host/hostname https://bugs.webkit.org/show_bug.cgi?id=214218 Reviewed by Darin Adler. Improve IPv6 detection when setting host/hostname by checking for '[' and ']' as well as using reverse find for ':' separators, to ensure we are not finding a separator within the IPv6 section of the url. Behavior matches Chrome and Firefox. Test: imported/w3c/web-platform-tests/url/url-setters.html * html/URLDecomposition.cpp: (WebCore::URLDecomposition::setHost): 2020-07-12 Zalan Bujtas <zalan@apple.com> [LFC][BFC][Min-Max width] Regular block level box resets the horizontal stacking https://bugs.webkit.org/show_bug.cgi?id=214225 Reviewed by Antti Koivisto. Non-floating block level boxes reset the current horizontal float stacking. e.g. with a shrink-to-fit width container: <div style="float: left; width: 10px;"></div> <div></div> <div style="float: left; width: 40px;"></div> will produce a max width of 40px which makes the floats vertically stacked. Test: fast/layoutformattingcontext/min-max-content-width-with-nested-floats-simple.html * layout/blockformatting/BlockFormattingContext.cpp: (WebCore::Layout::BlockFormattingContext::computedIntrinsicWidthConstraints): * layout/blockformatting/BlockFormattingContextGeometry.cpp: (WebCore::Layout::BlockFormattingContext::Geometry::intrinsicWidthConstraints): 2020-07-12 Darin Adler <darin@apple.com> Simplify and improve Gradient, some other small color-related removals https://bugs.webkit.org/show_bug.cgi?id=214221 Reviewed by Sam Weinig. * css/CSSGradientValue.cpp: Removed some unneeded includes. * html/ColorInputType.cpp: (WebCore::ColorInputType::currentColor): Deleted. (WebCore::ColorInputType::shouldShowSuggestions const): Deleted. * html/ColorInputType.h: Updated for the above. * html/HTMLDocument.cpp: Removed unneeded include of HashTools.h. * html/canvas/CanvasGradient.cpp: (WebCore::CanvasGradient::create): Moved these functions out of the header since inlining should be the same or better with them here. (WebCore::CanvasGradient::~CanvasGradient): Moved this out of the header so we don't need to include Gradient.h in the header. (WebCore::CanvasGradient::addColorStop): Updated for change to Gradient::addColorStop and move Color rather than copying it. * html/canvas/CanvasGradient.h: Removed include of Gradient.h. Moved things out of the header to make that work. * inspector/InspectorCanvas.cpp: (WebCore::InspectorCanvas::buildArrayForCanvasGradient): Removed use of Gradient::type and instead unify the type string code with the code that interprets the data for the different types. * page/FrameView.cpp: (WebCore::FrameView::recalculateScrollbarOverlayStyle): Refactored to eliminate the multiple redundant code paths, otherwising leaving the logic unchanged. * platform/ColorChooserClient.h: Remove unneeded includes and unused currentColor and shouldShowSuggestions functions. * platform/graphics/Gradient.cpp: (WebCore::Gradient::create): Replaced create functions that take type-specific data structure with one that takes the variant Data. (WebCore::Gradient::Gradient): Ditto. Also removed platformInit. (WebCore::Gradient::~Gradient): Removed platformDestroy. (WebCore::Gradient::type const): Deleted. (WebCore::Gradient::addColorStop): Take an rvalue reference to cut down a little bit on reference count churn. Replaced the platformDestroy function with a new stopsChanged function. Removed an unneeded overload that takes the two parts of a ColorStop separately. (WebCore::Gradient::setSortedColorStops): Use stopsChanged. (WebCore::Gradient::sortStops const): Simplify a bit, using a lambda. Also gave this a shorter name; it still optimizes by not sorting if the vector is already sorted. (WebCore::Gradient::hasAlpha const): Deleted. (WebCore::Gradient::setSpreadMethod): Removed some slightly overzealous code checking this isn't used after creating the platform-specific gradient. Decided not to bother with this for now. (WebCore::Gradient::setGradientSpaceTransform): Tweaked formatting. (WebCore::add): Added overloads to add(Hasher&) so we can use computeHash. (WebCore::Gradient::hash const): Use computeHash instead of hashMemory. * platform/graphics/Gradient.h: Use RetainPtr, COMPtr, and RefPtr instead of manually managing the lifetimes of the platform-specific underlying gradient objects. Also removed the unhelpful PlatformGradient type. This pattern, all too common in our platform library, provides no useful abstraction here. Removed unneeded constructors from ColorStop. Updated for changes above. Added platform-specific functions createBrush, createPattern, and createCGGradient. Simplify encoding and decoding by taking advantage of the support for encoding/decoding variants. Remove the enum Gradient::Type entirely. Removed the invalidateHash function because it's only used in a few setters and setting the hash to 0 is a fine way to write it there. * platform/graphics/GraphicsContext.cpp: (WebCore::GraphicsContextState::GraphicsContextState): Moved here from the header so we don't need to include Gradient.h in the header. (WebCore::GraphicsContextState::~GraphicsContextState): Ditto. (WebCore::GraphicsContextState::operator=): Ditto. * platform/graphics/GraphicsContext.h: Removed include of Gradient.h. Moved things out of the header to make that work. * platform/graphics/cairo/CairoOperations.cpp: (WebCore::Cairo::FillSource::FillSource): Use createPattern instead of createPlatformGradient. (WebCore::Cairo::StrokeSource::StrokeSource): Ditto. * platform/graphics/cairo/GradientCairo.cpp: (WebCore::Gradient::stopsChanged): Renamed from platformDestroy. (WebCore::interpolateColorStop): Rewrote to use existing blend functions. (WebCore::createConic): Changed return type to RefPtr. Tweaked to match WebKit coding style a bit better, use auto, use Vector::first/last, and updated for removal of the Gradient::ColorStop constructor. (WebCore::Gradient::createPattern): Renamed from createPlatformGradient. Changed to return a RefPtr instead of a raw pointer the caller needs to adopt at each call site. Refactored so it no longer uses Gradient::type. (WebCore::Gradient::fill): Use createPattern. * platform/graphics/cairo/GraphicsContextImplCairo.cpp: (WebCore::GraphicsContextImplCairo::fillRect): Ditto. * platform/graphics/cg/GradientCG.cpp: (WebCore::Gradient::stopsChanged): Renamed from platformDestroy, and simplified implementation now that we use RetainPtr. (WebCore::Gradient::createCGGradient): Renamed from platformGradient, got rid of the return value, and made it caller responsibility to only call this when a gradeitn needs to be allocated. (WebCore::Gradient::paint): Updated to use the above. * platform/graphics/cg/GraphicsContextCG.cpp: Add include of Gradient.h. * platform/graphics/displaylists/DisplayListItems.h: Added include of Gradient.h since the function templates in this file encode and decode gradients. * platform/graphics/nicosia/cairo/NicosiaCairoOperationRecorder.cpp: (Nicosia::CairoOperationRecorder::fillRect): Use createPattern. * platform/graphics/win/Direct2DOperations.cpp: (WebCore::Direct2D::FillSource::FillSource): Use createBrush (WebCore::Direct2D::StrokeSource::StrokeSource): Ditto. * platform/graphics/win/GradientDirect2D.cpp: (WebCore::Gradient::stopsChanged): Renamed from platformDestroy and simplified implementation now that we use COMPtr. (WebCore::Gradient::platformGradient): Deleted. (WebCore::Gradient::createPlatformGradientIfNecessary): Deleted. (WebCore::Gradient::createBrush): Renamed from generateGradient and added a return value. Simplified now that we use COMPtr, optimized the code a bit, and added some FIXME about mistakes I noticed. (WebCore::Gradient::fill): Use createBrush and m_brush. * platform/graphics/win/GraphicsContextImplDirect2D.cpp: (WebCore::GraphicsContextImplDirect2D::fillRect): Use createBrush. * platform/mac/ScrollAnimatorMac.mm: Added include of Gradient.h. * rendering/RenderThemeIOS.mm: (WebCore::RenderThemeIOS::paintProgressBar): Updated for changes to addColorStop. Also remove a lot of unnecessary conversion from float to double and back to float. * rendering/svg/RenderSVGResourceGradient.cpp: (WebCore::RenderSVGResourceGradient::addStops): Update to make and move a new color stop instead of copying it, modifying it in place, and then copying it again. * rendering/svg/RenderSVGResourceGradient.cpp: Removed include of Gradient.h. * svg/SVGGradientElement.cpp: (WebCore::SVGGradientElement::buildStops): Use std::clamp to convert the offsets into monotonically increasing ones in a more direct way, using variable names instead of comments to clarify what we are doing. 2020-07-12 Yusuke Suzuki <ysuzuki@apple.com> Unreviewed, fix GTK debian builds Include <functional> in ExtendedColor.h since it uses std::invoke. * platform/graphics/ExtendedColor.h: 2020-07-11 Fujii Hironori <Hironori.Fujii@sony.com> [WinCairo] Conic gradients support https://bugs.webkit.org/show_bug.cgi?id=214216 Reviewed by Sam Weinig. * platform/graphics/cairo/GradientCairo.cpp: (WebCore::addConicSector): Replaced M_PI with piDouble of WTF. (WebCore::Gradient::createPlatformGradient): Don't use C++20 designated initializers. 2020-07-11 Sam Weinig <weinig@apple.com> Reduce surface area of the ExtendedColor class to a bare minimum https://bugs.webkit.org/show_bug.cgi?id=214204 Reviewed by Darin Adler. - Add helper function to Color to operate on the underlying color type and reimplement a bunch of functionality using it, reducing the need for duplicate implementations in ExtendedColor. - Add constructors to Color that take extended color types, replacing the makeExtendedColor helper function. * Sources.txt: * WebCore.xcodeproj/project.pbxproj: Remove ExtenedColor.cpp * css/parser/CSSPropertyParserHelpers.cpp: (WebCore::CSSPropertyParserHelpers::parseColorFunctionParameters): Use new Color constructor taking ColorComponents and ColorSpace. * platform/graphics/Color.cpp: (WebCore::Color::colorWithAlpha const): Reimpliment using callOnUnderlyingType. (WebCore::Color::invertedColorWithAlpha const): Reimpliment using callOnUnderlyingType. * platform/graphics/Color.h: (WebCore::Color::Color): (WebCore::Color::hash const): (WebCore::Color::callOnUnderlyingType const): (WebCore::Color::toSRGBALossy const): (WebCore::Color::setColor): (WebCore::Color::isBlackColor): (WebCore::Color::isWhiteColor): - Add new constructors taking extended color types: SRGBA<float>, LinearSRGBA<float> and DiplayP3<float>. - Add new function, callOnUnderlyingType, to make working with any underlying type more streamlined. * platform/graphics/ColorConversion.h: (WebCore::toSRGBA): (WebCore::toLinearSRGBA): (WebCore::toDisplayP3): (WebCore::toLinearDisplayP3): (WebCore::toHSLA): Add identity conversion functions to make implementing generic functions like Color::toSRGBALossy more straigtforward. * platform/graphics/ColorSerialization.cpp: (WebCore::serialization): (WebCore::serializationForCSS): (WebCore::serializationForHTML): (WebCore::serializationForRenderTreeAsText): * platform/graphics/ColorSerialization.h: Replace serialization of the ExtendedColor type itself, with serialization for the underlying color types. Use callOnUnderlyingType to dispatch to the right one. * platform/graphics/ColorTypes.h: - Adds ComponentTraits struct to get information like min/max value of the component types. - Adds `using ComponentType = T;` to each color type, to allow easy access to the type in deduced contexts. - Adds static constexpr ColorSpace to each color type that currently has a ColorSpace mapping. * platform/graphics/ColorUtilities.h: (WebCore::isBlack): (WebCore::isWhite): Add helpers to implement Color::isBlack/Color::isWhiteColor for each color type. * platform/graphics/ExtendedColor.cpp: Removed. * platform/graphics/ExtendedColor.h: (WebCore::ExtendedColor::create): (WebCore::ExtendedColor::ExtendedColor): (WebCore::ExtendedColor::callOnUnderlyingType const): (WebCore::ExtendedColor::toSRGBALossy const): Deleted. Reduce down to just construction, member access and the callOnUnderlyingType helper. In future revisions, ExtendedColor should be converted to an internal class of Color. * platform/graphics/gtk/ColorGtk.cpp: (WebCore::Color::Color): * platform/graphics/win/ColorDirect2D.cpp: (WebCore::Color::Color): Update to use constructor delegation. 2020-07-11 Darin Adler <darin@apple.com> Remove live ranges from AccessibilityObject.h, AccessibilityObjectInterface.h, AccessibilityRenderObject.h, AXIsolatedObject.h https://bugs.webkit.org/show_bug.cgi?id=214215 Reviewed by Sam Weinig. Also use the IntPoint and LayoutPoint center() functions instead of rolling our own. * accessibility/AccessibilityObject.cpp: (WebCore::AccessibilityObject::misspellingRange const): Return SimpleRange. Also renamed from getMisspellingRange. (WebCore::rangeClosestToRange): Take and return SimpleRange. (WebCore::AccessibilityObject::rangeOfStringClosestToRangeInDirection const): Ditto. (WebCore::AccessibilityObject::elementRange const): Return SimpleRange. (WebCore::AccessibilityObject::findTextRange const): Take and return SimpleRange. (WebCore::AccessibilityObject::findTextRanges const): Ditto. (WebCore::AccessibilityObject::performTextOperation): Use SimpleRange. (WebCore::AccessibilityObject::clickPoint): Use center(). (WebCore::AccessibilityObject::rangeForPlainTextRange const): Return SimpleRange. (WebCore::AccessibilityObject::stringForRange const): Take SimpleRange. (WebCore::AccessibilityObject::stringForVisiblePositionRange): Use SimpleRange. (WebCore::AccessibilityObject::lengthForVisiblePositionRange const): Ditto. (WebCore::AccessibilityObject::replaceTextInRange): Use SimpleRange. * accessibility/AccessibilityObject.h: Update for above. * accessibility/AccessibilityObjectInterface.h: Take and return SimpleRange. * accessibility/AccessibilityRenderObject.cpp: (WebCore::AccessibilityRenderObject::linkClickPoint): Use SimpleRange. (WebCore::AccessibilityRenderObject::clickPoint): Ditto. (WebCore::AccessibilityRenderObject::setSelectedTextRange): Ditto. (WebCore::AccessibilityRenderObject::boundsForRange const): Take SimpleRange. (WebCore::AccessibilityRenderObject::setSelectedVisiblePositionRange const): Use SimpleRange. (WebCore::AccessibilityRenderObject::doAXBoundsForRangeUsingCharacterOffset const): Use SimpleRange. * accessibility/AccessibilityRenderObject.h: Update for above. * accessibility/atk/WebKitAccessibleInterfaceText.cpp: Include Range.h. * accessibility/ios/WebAccessibilityObjectWrapperIOS.mm: (-[WebAccessibilityObjectWrapper stringForTextMarkers:]): Use SimpleRange. (-[WebAccessibilityObjectWrapper textMarkerRange]): Ditto. (-[WebAccessibilityObjectWrapper stringForRange:]): Ditto. (-[WebAccessibilityObjectWrapper misspellingTextMarkerRange:forward:]): Ditto. (-[WebAccessibilityObjectWrapper frameForTextMarkers:]): Ditto. * accessibility/isolatedtree/AXIsolatedObject.cpp: (WebCore::AXIsolatedObject::stringForRange const): Take SimpleRange. (WebCore::AXIsolatedObject::findTextRanges const): Return SimpleRange. * accessibility/isolatedtree/AXIsolatedObject.h: Update for above. * accessibility/mac/WebAccessibilityObjectWrapperMac.mm: (accessibilityTextOperationForParameterizedAttribute): Use SimpleRange. (-[WebAccessibilityObjectWrapper doAXAttributedStringForRange:]): Ditto. (-[WebAccessibilityObjectWrapper accessibilityAttributeValue:forParameter:]): Ditto. * dom/Range.cpp: (WebCore::makeSimpleRange): Added. * dom/Range.h: Added makeSimpleRange so we can explicitly convert from live ranges to simple ranges. * editing/Editing.cpp: (WebCore::indexForVisiblePosition): Use separate returns for start and end. * editing/TextCheckingHelper.cpp: (WebCore::TextCheckingParagraph::offsetTo const): Ditto. (WebCore::TextCheckingParagraph::automaticReplacementStart const): Ditto. * page/FocusController.cpp: (WebCore::updateFocusCandidateIfNeeded): Use center(). 2020-07-11 Simon Fraser <simon.fraser@apple.com> REGRESSION(r260276): Overflow scrolling layers misplaced inside SVG foreign object https://bugs.webkit.org/show_bug.cgi?id=213788 <rdar://problem/65039637> Reviewed by Zalan Bujtas. RenderLayers inside SVG <foreignObject> don't display correctly, so don't use accelerated overflow scroll (which requires layers) inside <foreignObject>. This reverts behavior to macOS Catalina behavior (i.e. as soon as the overflow becomes scrollable, rendering problems appear), and to pre-iOS 13 behavior. Test: fast/scrolling/overflow-inside-foreignobject.html * dom/Document.h: (WebCore::Document::mayHaveRenderedSVGForeignObjects const): (WebCore::Document::setMayHaveRenderedSVGForeignObjects): * rendering/RenderLayer.cpp: (WebCore::RenderLayer::RenderLayer): (WebCore::RenderLayer::addChild): (WebCore::RenderLayer::updateAncestorDependentState): (WebCore::RenderLayer::canUseCompositedScrolling const): * rendering/RenderLayer.h: * rendering/svg/RenderSVGForeignObject.h: * svg/SVGForeignObjectElement.cpp: (WebCore::SVGForeignObjectElement::createElementRenderer): 2020-07-11 Zalan Bujtas <zalan@apple.com> [LFC][BFC][Min-Max width] Add support for float avoiders https://bugs.webkit.org/show_bug.cgi?id=214220 Reviewed by Antti Koivisto. Test: fast/layoutformattingcontext/min-max-content-width-with-floats-simple.html Float avoiders (including the float boxes) with infinite constraint form a horizontal float stack. (This does not yet support clear property/non-direct children.) * layout/blockformatting/BlockFormattingContext.cpp: (WebCore::Layout::BlockFormattingContext::computedIntrinsicWidthConstraints): * layout/blockformatting/BlockFormattingContextGeometry.cpp: (WebCore::Layout::BlockFormattingContext::Geometry::intrinsicWidthConstraints): 2020-07-10 Chris Dumez <cdumez@apple.com> Unreviewed, reverting r264242. Caused many crashes on iOS bots Reverted changeset: "JSRunLoopTimer should use WTF::RunLoop rather than custom CF code" https://bugs.webkit.org/show_bug.cgi?id=214102 https://trac.webkit.org/changeset/264242 2020-07-10 Brady Eidson <beidson@apple.com> Cleanup GameController framework button binding with some constants https://bugs.webkit.org/show_bug.cgi?id=214210 Reviewed by Darin Adler. No new tests (No behavior change) * platform/gamepad/cocoa/GameControllerGamepad.mm: (WebCore::GameControllerGamepad::setupAsExtendedGamepad): Use named constants instead of magic numbers. 2020-07-10 Darin Adler <darin@apple.com> Fix build for PLATFORM(IOS_FAMILY) && !ENABLE(REVEAL), for example, tvOS * editing/cocoa/DictionaryLookup.mm: Added include of "SimpleRange.h". 2020-07-10 Darin Adler <darin@apple.com> Fix build for PLATFORM(IOS_FAMILY) && !ENABLE(REVEAL), for example, tvOS * editing/cocoa/DictionaryLookup.mm: (WebCore::DictionaryLookup::rangeForSelection): Update to return SimpleRange. (WebCore::DictionaryLookup::rangeAtHitTestResult): Ditto. 2020-07-08 Darin Adler <darin@apple.com> Remove live ranges from Document.h, AlternativeTextController.h, DictionaryLookup.h, and WebPage.h https://bugs.webkit.org/show_bug.cgi?id=214109 Reviewed by Sam Weinig. * accessibility/AXObjectCache.cpp: (WebCore::AXObjectCache::characterOffsetForPoint): Updated to call caretPositionFromPoint, internal function, instead of caretRangeFromPoint, public DOM function. * dom/Document.cpp: (WebCore::Document::Document): Changed documentClasses argument to DocumentClassFlags. (WebCore::Document::caretRangeFromPoint): Refactored so this calls createLiveRange, since it's a DOM function that returns a live range. (WebCore::Document::caretPositionFromPoint): Renamed so this is not just an overload and changed to return a BoundaryPoint rather than a live range. * dom/Document.h: Simplified forward declarations by getting rid of all the conditionals. Tweaked a few typedef things. Updated for the changes above. * editing/AlternativeTextController.cpp: (WebCore::AlternativeTextController::startAlternativeTextUITimer): Updated since m_rangeWithAlternative is an Optional<SimpleRange>. (WebCore::AlternativeTextController::stopAlternativeTextUITimer): Ditto. (WebCore::AlternativeTextController::applyPendingCorrection): Ditto. (WebCore::AlternativeTextController::hasPendingCorrection const): Ditto. (WebCore::AlternativeTextController::isSpellingMarkerAllowed const): Take SimpleRange. (WebCore::AlternativeTextController::show): Ditto. (WebCore::AlternativeTextController::applyAutocorrectionBeforeTypingIfAppropriate): Updated since m_rangeWithAlternative is an Optional<SimpleRange>. (WebCore::AlternativeTextController::timerFired): Ditto. (WebCore::AlternativeTextController::handleAlternativeTextUIResult): Ditto. (WebCore::AlternativeTextController::markReversed): Take SimpleRange. (WebCore::AlternativeTextController::markCorrection): Ditto. (WebCore::AlternativeTextController::recordSpellcheckerResponseForModifiedCorrection): Ditto. (WebCore::AlternativeTextController::processMarkersOnTextToBeReplacedByResult): Ditto. (WebCore::AlternativeTextController::respondToMarkerAtEndOfWord): Use SimpleRange instead of a live range. (WebCore::AlternativeTextController::applyAlternativeTextToRange): Take SimpleRange. * editing/AlternativeTextController.h: Use SimpleRange instead of live ranges. * editing/cocoa/DictionaryLookup.mm: (WebCore::DictionaryLookup::rangeForSelection): Return SimpleRange. (WebCore::DictionaryLookup::rangeAtHitTestResult): Ditto. (WebCore::showPopupOrCreateAnimationController): Renamed type from RevealView to CocoaView. (WebCore::DictionaryLookup::showPopup): Ditto. * editing/mac/DictionaryLookup.h: Simplified header since it is included only from Objective-C files. Use SimpleRange instead of live ranges. * editing/mac/DictionaryLookupLegacy.mm: (WebCore::DictionaryLookup::rangeForSelection): Return SimpleRange. (WebCore::DictionaryLookup::rangeAtHitTestResult): Ditto. * page/mac/EventHandlerMac.mm: (WebCore::EventHandler::selectClosestWordFromHitTestResultBasedOnLookup): Updated since DictionaryLookup::rangeAtHitTestResult returns SimpleRange. (WebCore::autoscrollAdjustmentFactorForScreenBoundaries): Use constexpr instead of macros for constants. * testing/Internals.mm: (WebCore::Internals::rangeForDictionaryLookupAtLocation): Updated since DictionaryLookup::rangeAtHitTestResult returns SimpleRange. (WebCore::Internals::encodedPreferenceValue): Removed unneeded error local, and fixed formatting. 2020-07-10 Brady Eidson <beidson@apple.com> GameController.framework gamepads should support Home buttons. <rdar://problem/63500696> and https://bugs.webkit.org/show_bug.cgi?id=212933 Reviewed by Tim Horton. No new tests (Cannot yet drive GameController framework directly in tests) * platform/gamepad/cocoa/GameControllerGamepad.mm: (WebCore::homeButtonFromExtendedGamepad): Try a few different techniques of extracting the home button from a GCExtendedGamepad. (WebCore::GameControllerGamepad::setupAsExtendedGamepad): If there's a home button, put it at button index 16, defined by the spec as "Center button in center cluster" * platform/gamepad/cocoa/GameControllerSoftLink.h: * platform/gamepad/cocoa/GameControllerSoftLink.mm: 2020-07-10 Chris Fleizach <cfleizach@apple.com> AX: Build failure for catalyst https://bugs.webkit.org/show_bug.cgi?id=214202 <rdar://problem/65366125> Reviewed by Zalan Bujtas. * accessibility/ios/WebAccessibilityObjectWrapperIOS.mm: (-[WebAccessibilityObjectWrapper accessibilityIsInDescriptionListTerm]): (-[WebAccessibilityObjectWrapper accessibilityIsInDescriptionListDefinition]): 2020-07-10 Geoffrey Garen <ggaren@apple.com> JSRunLoopTimer should use WTF::RunLoop rather than custom CF code https://bugs.webkit.org/show_bug.cgi?id=214102 Reviewed by Darin Adler. * bindings/js/CommonVM.cpp: (WebCore::commonVMSlow): Supply a RunLoop at construction time since JSC requires that now. 2020-07-10 Guowei Yang <guowei_yang@apple.com> Removing usage of "using namespace WebCore" from TextTrackRepresentationCocoa.mm https://bugs.webkit.org/show_bug.cgi?id=214196 Reviewed by Tim Horton. The line "using namespace WebCore" will cause problems when compiling unified source. Removing this line and replace it with WebCore::prefix and namespace WebCore{ } to enclose C++ calls. No new tests are requied as this is a code style fix * platform/graphics/cocoa/TextTrackRepresentationCocoa.mm: removed usage of "using namespace WebCore" to avoid future errors while compiling (-[WebCoreTextTrackRepresentationCocoaHelper initWithParent:]): added "WebCore::" prefix (-[WebCoreTextTrackRepresentationCocoaHelper setParent:]): ditto (-[WebCoreTextTrackRepresentationCocoaHelper parent]): ditto (TextTrackRepresentation::create): enclosed inside namespace WebCore{ } (TextTrackRepresentationCocoa::TextTrackRepresentationCocoa): Deleted. enclosed inside namespace WebCore{ } (TextTrackRepresentationCocoa::~TextTrackRepresentationCocoa): ditto (TextTrackRepresentationCocoa::update): ditto (TextTrackRepresentationCocoa::setContentScale): ditto (TextTrackRepresentationCocoa::setHidden const): ditto (TextTrackRepresentationCocoa::bounds const): ditto (TextTrackRepresentationCocoa::boundsChanged): ditto 2020-07-10 Peng Liu <peng.liu6@apple.com> MobileSafari rotates its scene to portrait upside down if it has a PiP on screen https://bugs.webkit.org/show_bug.cgi?id=214169 Reviewed by Jer Noble. The UIViewController for video fullscreen/picture-in-picture should not ignore the App's supported orientations when the video element is in picture-in-picture. * platform/ios/VideoFullscreenInterfaceAVKit.mm: (VideoFullscreenInterfaceAVKit::doSetup): 2020-07-10 Don Olmstead <don.olmstead@sony.com> and Fujii Hironori <Hironori.Fujii@sony.com> [WinCairo] WOFF2 font support https://bugs.webkit.org/show_bug.cgi?id=214174 Reviewed by Per Arne Vollan. * PlatformWinCairo.cmake: Added additional libraries for static WOFF2 library to WebCore_LIBRARIES. * platform/graphics/win/FontCustomPlatformDataCairo.cpp: (WebCore::FontCustomPlatformData::supportsFormat): Added woff2. 2020-07-10 Chris Fleizach <cfleizach@apple.com> AX: iOS VoiceOver should support definition lists https://bugs.webkit.org/show_bug.cgi?id=210214 <rdar://problem/61478299> Reviewed by Darin Adler. Expose bits to make definition lists accessibility on iOS. Test: accessibility/ios-simulator/definition-list.html * accessibility/ios/WebAccessibilityObjectWrapperIOS.mm: (-[WebAccessibilityObjectWrapper _accessibilityDescriptionListAncestor]): (-[WebAccessibilityObjectWrapper accessibilityIsInDescriptionListTerm]): (-[WebAccessibilityObjectWrapper accessibilityIsInDescriptionListDefinition]): 2020-07-10 Brady Eidson <beidson@apple.com> Limit MultiGamepadProvider to Catalina and Big Sur. https://bugs.webkit.org/show_bug.cgi?id=214190 Unreviewed build fix. * platform/gamepad/cocoa/GameControllerSPI.h: * platform/gamepad/cocoa/GameControllerSoftLink.h: * platform/gamepad/cocoa/GameControllerSoftLink.mm: * platform/gamepad/mac/HIDGamepadProvider.mm: (WebCore::HIDGamepadProvider::deviceAdded): * platform/gamepad/mac/MultiGamepadProvider.h: * platform/gamepad/mac/MultiGamepadProvider.mm: 2020-07-10 Sam Weinig <weinig@apple.com> Part 4 of SimpleColor and SRGBA<uint8_t> are essentially the same - let's converge them https://bugs.webkit.org/show_bug.cgi?id=214158 Reviewed by Darin Adler. Removes SimpleColor! Alas, makeSimpleColor() remains for now, seeking a new name in a follow up. * platform/graphics/SimpleColor.h: (WebCore::SimpleColor::SimpleColor): Deleted. (WebCore::SimpleColor::alphaComponent const): Deleted. (WebCore::SimpleColor::alphaComponentAsFloat const): Deleted. (WebCore::SimpleColor::isOpaque const): Deleted. (WebCore::SimpleColor::isVisible const): Deleted. (WebCore::SimpleColor::colorWithAlpha const): Deleted. (WebCore::SimpleColor::invertedColorWithAlpha const): Deleted. (WebCore::SimpleColor::asSRGBA const): Deleted. (WebCore::SimpleColor::get const): Deleted. (): Deleted. (WebCore::operator==): Deleted. (WebCore::operator!=): Deleted. Remove the SimpleColor class. * platform/graphics/Color.cpp: (WebCore::Color::operator=): (WebCore::Color::lightened const): (WebCore::Color::darkened const): (WebCore::Color::colorWithAlpha const): (WebCore::Color::invertedColorWithAlpha const): (WebCore::Color::colorSpaceAndComponents const): * platform/graphics/Color.h: (WebCore::Color::isHashTableDeletedValue const): (WebCore::Color::isValid const): (WebCore::Color::isSemantic const): (WebCore::Color::isOpaque const): (WebCore::Color::isVisible const): (WebCore::Color::alpha const): (WebCore::Color::alphaAsFloat const): (WebCore::Color::isExtended const): (WebCore::Color::isInline const): (WebCore::Color::tagAsSemantic): (WebCore::Color::tagAsValid): (WebCore::operator==): (WebCore::equalIgnoringSemanticColor): (WebCore::Color::Color): (WebCore::Color::~Color): (WebCore::Color::hash const): (WebCore::Color::toSRGBALossy const): (WebCore::Color::asInline const): (WebCore::Color::setInlineColor): (WebCore::Color::setExtendedColor): (WebCore::Color::isBlackColor): (WebCore::Color::isWhiteColor): (WebCore::Color::encode const): (WebCore::Color::isSimple const): Deleted. (WebCore::Color::asSimple const): Deleted. (WebCore::Color::setSimpleColor): Deleted. - Rename existing uses of Simple with Inline, denoting the inline SRGBA<uint8_t>. - Move multiline functions out of line in the header. - Adds new constructor functions taking Optional<SRGBA<uint8_t>> to make Color(CGColorRef) constructors more straightforward. - Replaces uses of SimpleColor's interface with use of ColorUtilities.h helpers. e.g. Color::invertedColorWithAlpha() now uses the new invertedColorWithOverridenAlpha() helper function. Use of these utilities will be expanded to ExtendedColor in a follow up, allowing us to have just one implementation of these algorithms. * platform/graphics/ColorSerialization.cpp: (WebCore::serializationForCSS): (WebCore::serializationForHTML): (WebCore::serializationForRenderTreeAsText): * platform/graphics/ColorSerialization.h: Replace serialization of SimpleColor with serialization of SRGBA<uint8_t>. * platform/graphics/ColorTypes.h: (WebCore::forEachNonAlphaComponent): Deleted. Removed forEachNonAlphaComponent. Uses replaced by new colorByModifingEachNonAlphaComponent function in ColorUtilities.h * platform/graphics/ColorUtilities.h: (WebCore::colorByModifingEachNonAlphaComponent): (WebCore::convertComponentByteTo<uint8_t>): (WebCore::convertComponentByteTo<float>): (WebCore::convertComponentFloatTo<uint8_t>): (WebCore::convertComponentFloatTo<float>): (WebCore::colorWithOverridenAlpha): (WebCore::invertComponent): (WebCore::invertedColorWithOverridenAlpha): Added heplers to implement color mutation behaviors. * platform/graphics/cg/ColorCG.cpp: (WebCore::makeSimpleColorFromCGColor): (WebCore::Color::Color): (WebCore::cachedCGColor): Switch makeSimpleColorFromCGColor to return an Optional<SRGBA<uint8_t>> to streamline the constructors. Update to use is/asInline functions. * platform/graphics/mac/ColorMac.mm: (WebCore::nsColor): Update to use is/asInline functions. * platform/graphics/filters/FilterOperation.cpp: (WebCore::BasicComponentTransferFilterOperation::transformColor const): Switch to using colorByModifingEachNonAlphaComponent(). 2020-07-10 Philippe Normand <pnormand@igalia.com> [GStreamer] Unreviewed, prospective API test bot fix... * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp: (WebCore::MediaPlayerPrivateGStreamer::setVolume): I suppose changing the audio volume to 0 wasn't intended :) 2020-07-10 Philippe Normand <pnormand@igalia.com> Unreviewed, remove debug printf after r264219. * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp: (WebCore::MediaPlayerPrivateGStreamer::MediaPlayerPrivateGStreamer): 2020-07-10 Zalan Bujtas <zalan@apple.com> [LFC][Floats] Normal flow element that establishes a new block formatting context must not overlap the margin box of any floats https://bugs.webkit.org/show_bug.cgi?id=214185 Reviewed by Antti Koivisto. BFCs in general should avoid floats. This code was confusing the cases where the block container box (not necessarily a BFC) establishes an IFC. <div>The div establishes an IFC only. It should not avoid floats.</div> <div style="overflow: hidden">The div establishes both a new BFC and an IFC. It should avoid floats.</div> Test: fast/layoutformattingcontext/float-avoider-with-inline-content.html * layout/layouttree/LayoutBox.cpp: (WebCore::Layout::Box::isFloatAvoider const): 2020-07-10 Xabier Rodriguez Calvar <calvaris@igalia.com> [GStreamer][EME][OpenCDM] Implement OpenCDM support https://bugs.webkit.org/show_bug.cgi?id=213550 Reviewed by Philippe Normand. Implemented the OpenCDM support in the CDMOpenCDM and CDMProxyOpenCDM related classes. CDMOpenCDM classes check for Widevine support in OpenCDM and glues the JavaScript API to the OpenCDM/Thunder framework. Building this is optional and --opencdm parameter needs to be passed to build-webkit to get it. CDMProxy related needed changes because of several reasons. First is that Key was considering only a Vector<uint8_t> as a type and OpenCDM has session objects. Key is also renamed to KeyHandle as this name reflects in a better way the purpose of the class. This bleeds out to all CDMProxy related classes. CDMInstanceSessionProxy gets support to remove itself from the CDMSessionProxy. Regarding ClearKey, we adapt the changes to the CDMProxy classes and de-cable protection system from the decryptors as the OpenCDM decryptor could handle more than one system. No new tests. YouTube TV 2019 tests are green. * Headers.cmake: * WebCore.xcodeproj/project.pbxproj: * platform/GStreamer.cmake: * platform/SharedBuffer.cpp: (WebCore::SharedBuffer::dataAsUInt8Ptr const): * platform/SharedBuffer.h: * platform/encryptedmedia/CDMInstance.h: * platform/encryptedmedia/CDMOpenCDMTypes.h: Copied from Source/WebCore/platform/graphics/gstreamer/eme/CDMFactoryGStreamer.cpp. * platform/encryptedmedia/CDMProxy.cpp: (WebCore::KeyHandle::idAsString const): (WebCore::KeyHandle::takeValueIfDifferent): (WebCore::KeyStore::containsKeyID const): (WebCore::KeyStore::merge): (WebCore::KeyStore::allKeysAs const): (WebCore::KeyStore::addKeys): (WebCore::KeyStore::add): (WebCore::KeyStore::remove): (WebCore::KeyStore::keyHandle const): (WebCore::CDMProxy::keyHandle const): (WebCore::CDMProxy::tryWaitForKeyHandle const): (WebCore::CDMProxy::keyAvailableUnlocked const): (WebCore::CDMProxy::keyAvailable const): (WebCore::CDMProxy::getOrWaitForKeyHandle const): (WebCore::CDMProxy::getOrWaitForKeyValue const): (WebCore::CDMInstanceSessionProxy::CDMInstanceSessionProxy): (WebCore::CDMInstanceSessionProxy::removeFromInstanceProxy): * platform/encryptedmedia/CDMProxy.h: (WebCore::KeyHandle::create): (WebCore::KeyHandle::id const): (WebCore::KeyHandle::value const): (WebCore::KeyHandle::value): (WebCore::KeyHandle::isStatusCurrentlyValid): (WebCore::KeyHandle::operator==): (WebCore::KeyHandle::operator<): (WebCore::KeyHandle::KeyHandle): (WebCore::KeyStore::isEmpty const): (WebCore::CDMProxy::instance const): (WebCore::CDMInstanceSessionProxy::releaseDecryptionResources): (WebCore::CDMInstanceSessionProxy::cdmInstanceProxy const): (WebCore::CDMInstanceProxy::proxy const): (WebCore::CDMInstanceProxy::removeSession): * platform/encryptedmedia/CDMUtilities.cpp: Copied from Source/WebCore/platform/graphics/gstreamer/eme/CDMFactoryGStreamer.cpp. (WebCore::CDMUtilities::parseJSONObject): * platform/encryptedmedia/CDMUtilities.h: Copied from Source/WebCore/platform/graphics/gstreamer/eme/CDMFactoryGStreamer.cpp. * platform/encryptedmedia/clearkey/CDMClearKey.cpp: (WebCore::parseLicenseFormat): (WebCore::CDMPrivateClearKey::supportsInitData const): (WebCore::CDMPrivateClearKey::sanitizeResponse const): (WebCore::CDMInstanceSessionClearKey::updateLicense): (WebCore::CDMInstanceSessionClearKey::removeSessionData): (WebCore::CDMInstanceSessionClearKey::parentInstance const): * platform/encryptedmedia/clearkey/CDMClearKey.h: * platform/graphics/gstreamer/GStreamerCommon.cpp: (WebCore::isOpenCDMRanked): (WebCore::initializeGStreamerAndRegisterWebKitElements): (WebCore::GstMappedBuffer::createVector): * platform/graphics/gstreamer/GStreamerCommon.h: (WebCore::GstMappedBuffer::create): * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp: (WebCore::MediaPlayerPrivateGStreamer::~MediaPlayerPrivateGStreamer): (WebCore::MediaPlayerPrivateGStreamer::waitForCDMAttachment): * platform/graphics/gstreamer/eme/CDMFactoryGStreamer.cpp: (WebCore::CDMFactory::platformRegisterFactories): * platform/graphics/gstreamer/eme/CDMOpenCDM.cpp: Added. (openCDMLicenseType): (WebCore::initDataMD5): (WebCore::sessionLoadFailureFromOpenCDM): (WebCore::OpenCDM::destructOpenCDMSession): (WebCore::OpenCDM::createSharedOpenCDMSession): (WebCore::CDMFactoryOpenCDM::singleton): (WebCore::CDMFactoryOpenCDM::createCDM): (WebCore::CDMFactoryOpenCDM::createCDMProxy): (WebCore::CDMFactoryOpenCDM::supportedKeySystems const): (WebCore::CDMFactoryOpenCDM::supportsKeySystem): (WebCore::CDMPrivateOpenCDM::supportedInitDataTypes const): (WebCore::CDMPrivateOpenCDM::supportsConfiguration const): (WebCore::CDMPrivateOpenCDM::supportedRobustnesses const): (WebCore::CDMPrivateOpenCDM::distinctiveIdentifiersRequirement const): (WebCore::CDMPrivateOpenCDM::persistentStateRequirement const): (WebCore::CDMPrivateOpenCDM::distinctiveIdentifiersAreUniquePerOriginAndClearable const): (WebCore::CDMPrivateOpenCDM::createInstance): (WebCore::CDMPrivateOpenCDM::loadAndInitialize): (WebCore::CDMPrivateOpenCDM::supportsServerCertificates const): (WebCore::CDMPrivateOpenCDM::supportsSessions const): (WebCore::CDMPrivateOpenCDM::supportsInitData const): (WebCore::CDMPrivateOpenCDM::sanitizeResponse const): (WebCore::CDMPrivateOpenCDM::sanitizeSessionId const): (WebCore::CDMInstanceOpenCDM::CDMInstanceOpenCDM): (WebCore::CDMInstanceOpenCDM::initializeWithConfiguration): (WebCore::CDMInstanceOpenCDM::setServerCertificate): (WebCore::CDMInstanceOpenCDM::setStorageDirectory): (WebCore::CDMInstanceSessionOpenCDM::CDMInstanceSessionOpenCDM): (WebCore::CDMInstanceOpenCDM::createSession): (WebCore::ParsedResponseMessage::ParsedResponseMessage): (WebCore::ParsedResponseMessage::hasPayload const): (WebCore::ParsedResponseMessage::payload const): (WebCore::ParsedResponseMessage::payload): (WebCore::ParsedResponseMessage::hasType const): (WebCore::ParsedResponseMessage::type const): (WebCore::ParsedResponseMessage::typeOr const): (WebCore::CDMInstanceSessionOpenCDM::challengeGeneratedCallback): (WebCore::toString): (WebCore::CDMInstanceSessionOpenCDM::status const): (WebCore::CDMInstanceSessionOpenCDM::keyUpdatedCallback): (WebCore::CDMInstanceSessionOpenCDM::keysUpdateDoneCallback): (WebCore::CDMInstanceSessionOpenCDM::errorCallback): (WebCore::CDMInstanceSessionOpenCDM::requestLicense): (WebCore::CDMInstanceSessionOpenCDM::sessionFailure): (WebCore::CDMInstanceSessionOpenCDM::updateLicense): (WebCore::CDMInstanceSessionOpenCDM::loadSession): (WebCore::CDMInstanceSessionOpenCDM::closeSession): (WebCore::CDMInstanceSessionOpenCDM::removeSessionData): (WebCore::CDMInstanceSessionOpenCDM::storeRecordOfKeyUsage): (WebCore:: const): * platform/graphics/gstreamer/eme/CDMOpenCDM.h: Added. (WebCore::OpenCDM::OpenCDMSystemDeleter::operator() const): (WebCore::OpenCDM::OpenCDMSessionDeleter::operator() const): * platform/graphics/gstreamer/eme/CDMProxyClearKey.cpp: (WebCore::CDMProxyClearKey::cencSetDecryptionKey): * platform/graphics/gstreamer/eme/CDMProxyOpenCDM.cpp: Added. (WebCore::CDMProxyOpenCDM::getDecryptionSession const): (WebCore::CDMProxyOpenCDM::decrypt): * platform/graphics/gstreamer/eme/CDMProxyOpenCDM.h: Copied from Source/WebCore/platform/graphics/gstreamer/eme/CDMFactoryGStreamer.cpp. * platform/graphics/gstreamer/eme/GStreamerEMEUtilities.h: (WebCore::InitData::InitData): (WebCore::InitData::payload const): (WebCore::GStreamerEMEUtilities::isWidevineKeySystem): (WebCore::GStreamerEMEUtilities::keySystemToUuid): * platform/graphics/gstreamer/eme/WebKitClearKeyDecryptorGStreamer.cpp: (webkit_media_clear_key_decrypt_class_init): (protectionSystemId): * platform/graphics/gstreamer/eme/WebKitCommonEncryptionDecryptorGStreamer.cpp: (transformCaps): (transformInPlace): * platform/graphics/gstreamer/eme/WebKitCommonEncryptionDecryptorGStreamer.h: * platform/graphics/gstreamer/eme/WebKitOpenCDMDecryptorGStreamer.cpp: Added. (webkit_media_opencdm_decrypt_class_init): (webkit_media_opencdm_decrypt_init): (finalize): (protectionSystemId): (cdmProxyAttached): (decrypt): * platform/graphics/gstreamer/eme/WebKitOpenCDMDecryptorGStreamer.h: Added. 2020-07-10 Zalan Bujtas <zalan@apple.com> [LFC][TreeConstruction] Create block level container for unsupported renderer https://bugs.webkit.org/show_bug.cgi?id=214182 Reviewed by Antti Koivisto. It makes full LFC rendering on random pages less crashy. * layout/layouttree/LayoutTreeBuilder.cpp: (WebCore::Layout::TreeBuilder::createLayoutBox): 2020-07-02 Sergio Villar Senin <svillar@igalia.com> [WebXR] Retrieve WebGL framebuffer resolution from XR devices https://bugs.webkit.org/show_bug.cgi?id=213886 Reviewed by Carlos Garcia Campos. The recommended WebGL framebuffer resolution should be retrieved from the actual XR device being used. Implemented the OpenXR machinery to retrieve it from the XR system. We are also moving the methods that call the platform code to the XRSession as specs define, instead of having them inside the XRWebGLLayer. Finally this patch is also removing a unused definition in OpenXR plaform code and properly initializing a OpenXR struct. The missing initialization was the source of errors when querying api layer properties. The patch is also properly setting the SessionMode::Inline when XR_VIEW_CONFIGURATION_TYPE_PRIMARY_MONO is found. It used to set SessionMode::ImmersiveAr instead, but that's wrong, we should only care about ImmersiveAr session mode once the WebXR AR module is implemented. * Modules/webxr/WebXRRenderState.cpp: (WebCore::WebXRRenderState::outputCanvas const): Return render state's canvas. * Modules/webxr/WebXRRenderState.h: Added a m_outputCanvas member with its getter. * Modules/webxr/WebXRSession.cpp: (WebCore::WebXRSession::nativeWebGLFramebufferResolution const): Moved from WebXRWebGLLayer and reimplemented. (WebCore::WebXRSession::recommendedWebGLFramebufferResolution const): Ditto. * Modules/webxr/WebXRSession.h: * Modules/webxr/WebXRWebGLLayer.cpp: (WebCore::WebXRWebGLLayer::WebXRWebGLLayer): (WebCore::WebXRWebGLLayer::getNativeFramebufferScaleFactor): Call the session to get native and recommended resolutions. (WebCore::WebXRWebGLLayer::computeNativeWebGLFramebufferResolution): Deleted. (WebCore::WebXRWebGLLayer::computeRecommendedWebGLFramebufferResolution): Ditto. * platform/xr/PlatformXR.h: (PlatformXR::Device::recommendedResolution): New virtual method with default implementation. * platform/xr/openxr/PlatformXROpenXR.cpp: (PlatformXR::Instance::Impl::enumerateApiLayerProperties const): Added initialization of the XrApiLayerProperties objects. The call to xrEnumerateApiLayerProperties succeeds now. (PlatformXR::OpenXRDevice::OpenXRDevice): Call enumerateConfigurationViews(). (PlatformXR::OpenXRDevice::collectSupportedSessionModes): Fill in the m_viewConfigurationProperties map. (PlatformXR::OpenXRDevice::enumerateConfigurationViews): New method that retrieves the XR device views for each supported configuration. (PlatformXR::OpenXRDevice::recommendedResolution): Return the recommended resolution for a given SessionMode. * platform/xr/openxr/PlatformXROpenXR.h: Added some new methods and attributes. 2020-07-10 Zalan Bujtas <zalan@apple.com> [LFC][MarginCollapsing] Margins do not collapse through when the box has clearance. https://bugs.webkit.org/show_bug.cgi?id=214172 Reviewed by Antti Koivisto. https://www.w3.org/TR/CSS22/box.html#collapsing-margins "Two margins are adjoining if and only if: no line boxes, no clearance, no padding and no border separate them" Only adjoining margins can collapse through. Test: fast/layoutformattingcontext/empty-block-level-box-with-clearance.html * layout/blockformatting/BlockMarginCollapse.cpp: (WebCore::Layout::BlockFormattingContext::MarginCollapse::marginsCollapseThrough const): 2020-07-10 Jan-Michael Brummer <jan.brummer@tabos.org> [GTK][WPE] Use mobile user-agent on tablet https://bugs.webkit.org/show_bug.cgi?id=149496 Reviewed by Carlos Garcia Campos. * platform/UserAgentQuirks.cpp: (WebCore::urlRequiresMacintoshPlatform): (WebCore::urlRequiresLinuxDesktopPlatform): (WebCore::UserAgentQuirks::quirksForURL): * platform/UserAgentQuirks.h: * platform/glib/UserAgentGLib.cpp: (WebCore::getChassisType): (WebCore::platformForUAString): (WebCore::platformVersionForUAString): (WebCore::buildUserAgentString): (WebCore::standardUserAgent): (WebCore::standardUserAgentForURL): 2020-07-10 Alicia Boya García <aboya@igalia.com> [MSE][GStreamer] Inline MediaSourceClientGStreamerMSE away https://bugs.webkit.org/show_bug.cgi?id=214140 Reviewed by Xabier Rodriguez-Calvar. MediaSourceClientGStreamerMSE is a superfluous class that adds a layer of indirection and complexity to the GStreamer MSE codebase for no gain. This patch gets rid of it. This also gets rid of the friend access layer violations that MediaSourceClientGStreamerMSE relied upon. This patch is a refactor that doesn't introduce behavior changes and it's covered by existing tests. * platform/GStreamer.cmake: * platform/graphics/gstreamer/mse/AppendPipeline.cpp: (WebCore::AppendPipeline::AppendPipeline): * platform/graphics/gstreamer/mse/AppendPipeline.h: * platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.cpp: (WebCore::MediaPlayerPrivateGStreamerMSE::durationChanged): (WebCore::MediaPlayerPrivateGStreamerMSE::setMediaSourceClient): Deleted. (WebCore::MediaPlayerPrivateGStreamerMSE::mediaSourceClient): Deleted. * platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.h: (WebCore::MediaPlayerPrivateGStreamerMSE::playbackPipeline const): * platform/graphics/gstreamer/mse/MediaSourceClientGStreamerMSE.cpp: Removed. * platform/graphics/gstreamer/mse/MediaSourceClientGStreamerMSE.h: Removed. * platform/graphics/gstreamer/mse/MediaSourcePrivateGStreamer.cpp: (WebCore::MediaSourcePrivateGStreamer::MediaSourcePrivateGStreamer): (WebCore::MediaSourcePrivateGStreamer::addSourceBuffer): (WebCore::MediaSourcePrivateGStreamer::durationChanged): (WebCore::MediaSourcePrivateGStreamer::markEndOfStream): * platform/graphics/gstreamer/mse/MediaSourcePrivateGStreamer.h: * platform/graphics/gstreamer/mse/SourceBufferPrivateGStreamer.cpp: (WebCore::SourceBufferPrivateGStreamer::create): (WebCore::SourceBufferPrivateGStreamer::SourceBufferPrivateGStreamer): (WebCore::SourceBufferPrivateGStreamer::finishCreation): (WebCore::SourceBufferPrivateGStreamer::append): (WebCore::SourceBufferPrivateGStreamer::abort): (WebCore::SourceBufferPrivateGStreamer::resetParserState): (WebCore::SourceBufferPrivateGStreamer::removedFromMediaSource): (WebCore::SourceBufferPrivateGStreamer::flush): (WebCore::SourceBufferPrivateGStreamer::enqueueSample): (WebCore::SourceBufferPrivateGStreamer::allSamplesInTrackEnqueued): * platform/graphics/gstreamer/mse/SourceBufferPrivateGStreamer.h: 2020-07-09 Brady Eidson <beidson@apple.com> Multiplex the HID and GameController gamepad providers on Mac. <rdar://problem/63192532> and https://bugs.webkit.org/show_bug.cgi?id=214126 Reviewed by Tim Horton. Mac has already supported both the HID provider and GameController provider. By adding an intermediate provider to multiplex both and tweaking a few other things, it can support both at the same time. * SourcesCocoa.txt: * WebCore.xcodeproj/project.pbxproj: * platform/gamepad/PlatformGamepad.h: (WebCore::PlatformGamepad::lastUpdateTime const): (WebCore::PlatformGamepad::source const): * platform/gamepad/cocoa/GameControllerGamepad.h: * platform/gamepad/cocoa/GameControllerGamepadProvider.h: * platform/gamepad/cocoa/GameControllerGamepadProvider.mm: (WebCore::GameControllerGamepadProvider::controllerDidConnect): (WebCore::GameControllerGamepadProvider::gamepadHadInput): (WebCore::GameControllerGamepadProvider::makeInvisibleGamepadsVisible): (WebCore::GameControllerGamepadProvider::inputNotificationTimerFired): (WebCore::GameControllerGamepadProvider::makeInvisibileGamepadsVisible): Deleted. * platform/gamepad/cocoa/GameControllerSPI.h: * platform/gamepad/cocoa/GameControllerSoftLink.h: * platform/gamepad/cocoa/GameControllerSoftLink.mm: * platform/gamepad/mac/HIDGamepad.h: * platform/gamepad/mac/HIDGamepadProvider.h: (WebCore::HIDGamepadProvider::ignoreGameControllerFrameworkDevices): * platform/gamepad/mac/HIDGamepadProvider.mm: Renamed from Source/WebCore/platform/gamepad/mac/HIDGamepadProvider.cpp. (WebCore::deviceMatchingDictionary): (WebCore::deviceAddedCallback): (WebCore::deviceRemovedCallback): (WebCore::deviceValuesChangedCallback): (WebCore::HIDGamepadProvider::singleton): (WebCore::HIDGamepadProvider::HIDGamepadProvider): (WebCore::HIDGamepadProvider::stopMonitoringInput): (WebCore::HIDGamepadProvider::startMonitoringInput): (WebCore::HIDGamepadProvider::indexForNewlyConnectedDevice): (WebCore::HIDGamepadProvider::initialGamepadsConnectedTimerFired): (WebCore::HIDGamepadProvider::openAndScheduleManager): (WebCore::HIDGamepadProvider::closeAndUnscheduleManager): (WebCore::HIDGamepadProvider::startMonitoringGamepads): (WebCore::HIDGamepadProvider::stopMonitoringGamepads): (WebCore::gameControllerFrameworkWillHandleHIDDevice): (WebCore::HIDGamepadProvider::deviceAdded): (WebCore::HIDGamepadProvider::deviceRemoved): (WebCore::HIDGamepadProvider::valuesChanged): (WebCore::HIDGamepadProvider::inputNotificationTimerFired): (WebCore::HIDGamepadProvider::removeGamepadForDevice): * platform/gamepad/mac/MultiGamepadProvider.h: Added. (WebCore::MultiGamepadProvider::isMockGamepadProvider const): (WebCore::MultiGamepadProvider::PlatformGamepadWrapper::PlatformGamepadWrapper): * platform/gamepad/mac/MultiGamepadProvider.mm: Added. (WebCore::MultiGamepadProvider::singleton): (WebCore::MultiGamepadProvider::startMonitoringGamepads): (WebCore::MultiGamepadProvider::stopMonitoringGamepads): (WebCore::MultiGamepadProvider::indexForNewlyConnectedDevice): (WebCore::MultiGamepadProvider::platformGamepadConnected): (WebCore::MultiGamepadProvider::platformGamepadDisconnected): (WebCore::MultiGamepadProvider::platformGamepadInputActivity): 2020-07-09 Tim Horton <timothy_horton@apple.com> "ESPN Fantasy Sports" does not respond to mouse events, only touch events https://bugs.webkit.org/show_bug.cgi?id=214165 <rdar://problem/64671543> Reviewed by Wenson Hsieh. * platform/RuntimeApplicationChecks.h: * platform/cocoa/RuntimeApplicationChecksCocoa.mm: (WebCore::IOSApplication::isESPNFantasySports): 2020-07-09 Simon Fraser <simon.fraser@apple.com> [macOS] Stuttery scrolling on tesla.com https://bugs.webkit.org/show_bug.cgi?id=214159 <rdar://problem/64555500> Reviewed by Wenson Hsieh. tesla.com uses scroll snapping, and also triggers layout during scrolling that could cause scroll snap to yank the scroll position. This manifested as a change that affected getBoundingClientRect which is used an an input to some transform math, causing the images to move around. Fix by ensuring that layout-triggered scroll snap does not happen if a user scroll is in progress, when that scroll occurs via the scrolling thread. ScrollingTreeScrollingNodeDelegateMac has a ScrollController that tracks when a gesture is in progress; push this state to the ScrollingTree so it can be consulted from the main thread. The two subclasses of ScrollableArea, RenderLayer and FrameView, then consult the ScrollingCoordinator to ask whether a user scroll is in progress for their scrolling tree node. Test: fast/scrolling/mac/adjust-scroll-snap-during-gesture.html * page/FrameView.cpp: (WebCore::FrameView::isUserScrollInProgress const): * page/scrolling/AsyncScrollingCoordinator.cpp: (WebCore::AsyncScrollingCoordinator::isUserScrollInProgress const): * page/scrolling/AsyncScrollingCoordinator.h: * page/scrolling/ScrollingCoordinator.h: (WebCore::ScrollingCoordinator::isUserScrollInProgress const): * page/scrolling/ScrollingTree.cpp: (WebCore::ScrollingTree::handleWheelEvent): (WebCore::ScrollingTree::isUserScrollInProgressForNode): (WebCore::ScrollingTree::setUserScrollInProgressForNode): (WebCore::ScrollingTree::clearNodesWithUserScrollInProgress): * page/scrolling/ScrollingTree.h: * page/scrolling/ScrollingTreeScrollingNode.cpp: (WebCore::ScrollingTreeScrollingNode::isUserScrollProgress const): (WebCore::ScrollingTreeScrollingNode::setUserScrollInProgress): (WebCore::ScrollingTreeScrollingNode::setScrollSnapInProgress): * page/scrolling/ScrollingTreeScrollingNode.h: * page/scrolling/mac/ScrollingTreeScrollingNodeDelegateMac.mm: (WebCore::ScrollingTreeScrollingNodeDelegateMac::handleWheelEvent): * rendering/RenderLayer.cpp: (WebCore::RenderLayer::isUserScrollInProgress const): 2020-07-09 Chris Dumez <cdumez@apple.com> [Bindings] Add default value support for union types in dictionary members https://bugs.webkit.org/show_bug.cgi?id=214160 Reviewed by Sam Weinig. Add default value support for union types in dictionary members. This is needed for the WebAudio specification: - https://www.w3.org/TR/webaudio/#AudioContextOptions """ (AudioContextLatencyCategory or double) latencyHint = "interactive"; """ * bindings/scripts/CodeGeneratorJS.pm: (GenerateDefaultValue): * bindings/scripts/test/JS/JSTestObj.cpp: (WebCore::jsTestObjPrototypeFunctionOverloadWithOptionalUnion1Body): * bindings/scripts/test/JS/JSTestStandaloneDictionary.cpp: (WebCore::convertDictionary<DictionaryImplName>): (WebCore::convertDictionaryToJS): * bindings/scripts/test/TestStandaloneDictionary.idl: 2020-07-09 Per Arne Vollan <pvollan@apple.com> Move XPCEndpoint and XPCEndpointClient classes from WebCore to WebKit https://bugs.webkit.org/show_bug.cgi?id=214099 Reviewed by Alex Christensen. These classes should not be in WebCore, but in WebKit, since they are only expected to be used there. No new tests, since this patch is only moving source files. * WebCore.xcodeproj/project.pbxproj: * platform/cocoa/XPCEndpoint.h: Removed. * platform/cocoa/XPCEndpoint.mm: Removed. * platform/cocoa/XPCEndpointClient.h: Removed. * platform/cocoa/XPCEndpointClient.mm: Removed. 2020-07-09 Simon Fraser <simon.fraser@apple.com> After a scroll gesture, content changes don't trigger re-snapping with scroll snap https://bugs.webkit.org/show_bug.cgi?id=214123 Reviewed by Wenson Hsieh. ScrollController::m_inScrollGesture could get stuck as true after a scroll gesture, because ScrollAnimatorMac::handleWheelEvent() didn't reliably call m_scrollController.handleWheelEvent() for the event event based on the hokey shouldForwardWheelEventsToParent() code. Fix by explicitly calling m_scrollController.updateGestureInProgressState() which maintains m_inScrollGesture. When m_inScrollGesture was stuck as true, ScrollableArea::updateScrollSnapState() would return early because isScrollSnapInProgress() would return true. In addition, ScrollController::isScrollSnapInProgress() was a lie for non-scroll-snapping scrollable areas, so explicitly check for snap points there, using an explicit usesScrollSnap() function. Rename some WheelEventStatus values to use "momentum" rather than "inertia". Test: fast/scrolling/mac/adjust-scroll-snap-after-gesture.html * page/scrolling/mac/ScrollingTreeScrollingNodeDelegateMac.mm: (WebCore::ScrollingTreeScrollingNodeDelegateMac::handleWheelEvent): * platform/ScrollableArea.cpp: (WebCore::ScrollableArea::usesScrollSnap const): (WebCore::ScrollableArea::updateScrollSnapState): * platform/ScrollableArea.h: * platform/cocoa/ScrollController.h: * platform/cocoa/ScrollController.mm: (WebCore::ScrollController::handleWheelEvent): (WebCore::ScrollController::usesScrollSnap const): (WebCore::ScrollController::isScrollSnapInProgress const): (WebCore::ScrollController::snapRubberBand): (WebCore::toWheelEventStatus): (WebCore::operator<<): (WebCore::ScrollController::shouldOverrideMomentumScrolling const): (WebCore::ScrollController::scheduleStatelessScrollSnap): (WebCore::ScrollController::statelessSnapTransitionTimerFired): (WebCore::ScrollController::processWheelEventForScrollSnap): (WebCore::ScrollController::updateGestureInProgressState): (WebCore::ScrollController::scrollSnapTimerFired): (WebCore::ScrollController::activeScrollSnapIndexForAxis const): (WebCore::ScrollController::setActiveScrollSnapIndexForAxis): (WebCore::ScrollController::setNearestScrollSnapIndexForAxisAndOffset): (WebCore::ScrollController::setActiveScrollSnapIndicesForOffset): (WebCore::ScrollController::shouldOverrideInertialScrolling const): Deleted. * platform/mac/ScrollAnimatorMac.mm: (WebCore::ScrollAnimatorMac::handleWheelEvent): 2020-07-09 Fujii Hironori <Hironori.Fujii@sony.com> [WinCairo][MediaFoundation] Use /DELAYLOAD for mf.dll https://bugs.webkit.org/show_bug.cgi?id=213330 Reviewed by Per Arne Vollan. WinCairo failed to start up due to a missing dependency on some versions of Windows in which Media Foundation is not available such like Windows 10 N. Use delay load for Media Foundation. And, check the availability. * PlatformWinCairo.cmake: Link with delayimp.lib. Added /DELAYLOAD linker options. * platform/graphics/win/MediaPlayerPrivateMediaFoundation.cpp: (WebCore::MediaPlayerPrivateMediaFoundation::isAvailable): Check mf.dll is available. 2020-07-09 Eric Carlson <eric.carlson@apple.com> Reset AVSystemController_PIDToInheritApplicationStateFrom when mediaserverd dies https://bugs.webkit.org/show_bug.cgi?id=214112 <rdar://problem/65229214> Reviewed by Jer Noble. Tested manually because this can only be tested by killing a system process while capturing on iOS hardware. * platform/audio/cocoa/MediaSessionManagerCocoa.h: Add task queue accessor. (WebCore::MediaSessionManagerCocoa::taskQueue): * platform/audio/ios/MediaSessionHelperIOS.h: (WebCore::MediaSessionHelperClient::mediaServerConnectionDied): * platform/audio/ios/MediaSessionHelperIOS.mm: (MediaSessionHelperiOS::mediaServerConnectionDied): Renamed from carPlayServerDied. Inform clients if we previously set the PID proxy. (-[WebMediaSessionHelper initWithCallback:]): Call mediaServerConnectionDied. (-[WebMediaSessionHelper mediaServerConnectionDied:]): Ditto. (MediaSessionHelperiOS::carPlayServerDied): Deleted. (-[WebMediaSessionHelper carPlayServerDied:]): Deleted. * platform/audio/ios/MediaSessionManagerIOS.h: * platform/audio/ios/MediaSessionManagerIOS.mm: (WebCore::MediaSessionManageriOS::mediaServerConnectionDied): Call providePresentingApplicationPID if we previously set the PID proxy. * platform/mediastream/mac/AVVideoCaptureSource.mm: (WebCore::AVVideoCaptureSource::captureSessionRuntimeError): Don't try to restart the session immediately since this is called directly from the notification handler. 2020-07-09 Clark Wang <clark_wang@apple.com> Set Restrictions for channelCount, channelCountMode for PannerNode https://bugs.webkit.org/show_bug.cgi?id=213992 Reviewed by Chris Dumez. Added setter methods to PannerNode that handle exceptions for channelCount, channelCountMode, according to spec: https://www.w3.org/TR/webaudio/#dom-audionode-channelcount. Moved ChannelCount, ChannelCountMode enums into their own files. Re-baselined tests that now pass. * CMakeLists.txt: * DerivedSources-input.xcfilelist: * DerivedSources-output.xcfilelist: * DerivedSources.make: * Modules/webaudio/AudioNode.cpp: (WebCore::AudioNode::AudioNode): (WebCore::AudioNode::setChannelCount): (WebCore::AudioNode::setChannelCountMode): (WebCore::AudioNode::setChannelInterpretation): (WebCore::AudioNode::channelCount): Deleted. (WebCore::AudioNode::channelCountMode): Deleted. (WebCore::AudioNode::channelInterpretation): Deleted. * Modules/webaudio/AudioNode.h: (WebCore::AudioNode::channelCount const): (WebCore::AudioNode::channelCountMode const): (WebCore::AudioNode::channelInterpretation const): (WebCore::AudioNode::internalChannelCountMode const): Deleted. (WebCore::AudioNode::internalChannelInterpretation const): Deleted. * Modules/webaudio/AudioNode.idl: * Modules/webaudio/AudioNodeInput.cpp: (WebCore::AudioNodeInput::numberOfChannels const): (WebCore::AudioNodeInput::bus): (WebCore::AudioNodeInput::sumAllConnections): (WebCore::AudioNodeInput::pull): * Modules/webaudio/AudioNodeOptions.h: * Modules/webaudio/AudioNodeOptions.idl: * Modules/webaudio/ChannelCountMode.h: Copied from Source/WebCore/Modules/webaudio/AudioNodeOptions.h. * Modules/webaudio/ChannelCountMode.idl: Copied from Source/WebCore/Modules/webaudio/AudioNodeOptions.idl. * Modules/webaudio/ChannelInterpretation.h: Copied from Source/WebCore/Modules/webaudio/AudioNodeOptions.h. * Modules/webaudio/ChannelInterpretation.idl: Copied from Source/WebCore/Modules/webaudio/AudioNodeOptions.idl. * Modules/webaudio/ConvolverNode.cpp: (WebCore::ConvolverNode::ConvolverNode): * Modules/webaudio/DefaultAudioDestinationNode.cpp: (WebCore::DefaultAudioDestinationNode::DefaultAudioDestinationNode): * Modules/webaudio/PannerNode.cpp: (WebCore::PannerNode::PannerNode): (WebCore::PannerNode::create): (WebCore::PannerNode::setChannelCount): (WebCore::PannerNode::setChannelCountMode): * Modules/webaudio/PannerNode.h: * Modules/webaudio/WebKitAudioPannerNode.cpp: (WebCore::WebKitAudioPannerNode::WebKitAudioPannerNode): * Sources.txt: * WebCore.xcodeproj/project.pbxproj: * platform/audio/AudioBus.cpp: (WebCore::AudioBus::copyFrom): (WebCore::AudioBus::sumFrom): * platform/audio/AudioBus.h: 2020-07-09 Alicia Boya García <aboya@igalia.com> [MSE][GStreamer] Remove m_appendPipelinesMap https://bugs.webkit.org/show_bug.cgi?id=214132 Reviewed by Xabier Rodriguez-Calvar. m_appendPipelinesMap was owned by MediaPlayerPrivateGStreamerMSE but was only used by MediaPlayerPrivateGStreamerMSE to clear it during destruction, while the other uses were in MediaSourceClientGStreamerMSE. After analysis, it was found keeping a HashMap of AppendPipelines is not necessary. An AppendPipeline only needs to be used by the SourceBuffer receiving the muxed data: making AppendPipeline a member of SourceBufferPrivateGStreamer reflects this dependency in a much clearer way. No need for a HashMap of AppendPipeline's. Moreso, there are no other users of AppendPipeline, which means AppendPipeline doesn't need to be ref counted. This patch removes that feature, using std::unique_ptr<AppendPipeline> for ownership instead. This patch is a refactor: it doesn't introduce behavior changes and it's covered by existing tests. * platform/graphics/gstreamer/mse/AppendPipeline.cpp: (WebCore::AppendPipeline::appsinkCapsChanged): (WebCore::AppendPipeline::connectDemuxerSrcPadToAppsink): * platform/graphics/gstreamer/mse/AppendPipeline.h: * platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.cpp: (WebCore::MediaPlayerPrivateGStreamerMSE::~MediaPlayerPrivateGStreamerMSE): (WebCore::MediaPlayerPrivateGStreamerMSE::trackDetected): * platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.h: * platform/graphics/gstreamer/mse/MediaSourceClientGStreamerMSE.cpp: (WebCore::MediaSourceClientGStreamerMSE::addSourceBuffer): (WebCore::MediaSourceClientGStreamerMSE::abort): (WebCore::MediaSourceClientGStreamerMSE::resetParserState): (WebCore::MediaSourceClientGStreamerMSE::append): (WebCore::MediaSourceClientGStreamerMSE::removedFromMediaSource): * platform/graphics/gstreamer/mse/MediaSourcePrivateGStreamer.cpp: (WebCore::MediaSourcePrivateGStreamer::addSourceBuffer): * platform/graphics/gstreamer/mse/SourceBufferPrivateGStreamer.cpp: (WebCore::SourceBufferPrivateGStreamer::create): (WebCore::SourceBufferPrivateGStreamer::SourceBufferPrivateGStreamer): (WebCore::SourceBufferPrivateGStreamer::finishCreation): * platform/graphics/gstreamer/mse/SourceBufferPrivateGStreamer.h: 2020-07-09 Zalan Bujtas <zalan@apple.com> [LFC][Verification] Use the table wrapper box's margin when checking the table box https://bugs.webkit.org/show_bug.cgi?id=214119 Reviewed by Darin Adler. Table margins are propagated to the table wrapper box. Test: fast/layoutformattingcontext/table-with-margin-simple.html * layout/Verification.cpp: (WebCore::Layout::outputMismatchingBlockBoxInformationIfNeeded): (WebCore::Layout::LayoutContext::verifyAndOutputMismatchingLayoutTree): 2020-07-09 Alicia Boya García <aboya@igalia.com> [MSE][GStreamer] Don't cache duration in MediaSourceClientGStreamerMSE https://bugs.webkit.org/show_bug.cgi?id=214128 Reviewed by Xabier Rodriguez-Calvar. MediaSource should be the single source of truth for the duration of the MediaSource, and querying it to MediaSource is efficient enough (trivial getter). There is no reason for MediaSourceClientGStreamerMSE to store a separate m_duration field. This patch introduces no behavior changes. * platform/graphics/gstreamer/mse/MediaSourceClientGStreamerMSE.cpp: (WebCore::MediaSourceClientGStreamerMSE::MediaSourceClientGStreamerMSE): (WebCore::MediaSourceClientGStreamerMSE::duration): (WebCore::MediaSourceClientGStreamerMSE::durationChanged): * platform/graphics/gstreamer/mse/MediaSourceClientGStreamerMSE.h: 2020-07-09 Alicia Boya García <aboya@igalia.com> [MSE][GStreamer] Make duration changes one way https://bugs.webkit.org/show_bug.cgi?id=214083 Reviewed by Xabier Rodriguez-Calvar. Until now, AppendPipeline emitted duration changes for the MediaSource. This was done with MediaSourcePrivateClient::durationChanged(const MediaTime&), a method which was added to MediaSource in r207889 just to implement this in the GStreamer port. This is not necessary though. AppendPipeline only needs to inform MediaSource of the duration of the initialization segment, and MediaSource will in turn set duration from the multi-platform code. This patch removes MediaSourcePrivateClient::durationChanged(const MediaTime&) from the multi-platform API, along with its usages in the GStreamer port, giving the multi-platform code sole responsibility on duration changes. This is a code cleanup and it's covered by existing tests. * Modules/mediasource/MediaSource.cpp: (WebCore::MediaSource::durationChanged): Deleted. * Modules/mediasource/MediaSource.h: * platform/graphics/MediaSourcePrivateClient.h: * platform/graphics/gstreamer/mse/AppendPipeline.cpp: (WebCore::AppendPipeline::didReceiveInitializationSegment): (WebCore::AppendPipeline::connectDemuxerSrcPadToAppsink): * platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.cpp: (WebCore::MediaPlayerPrivateGStreamerMSE::durationChanged): 2020-07-09 Philippe Normand <pnormand@igalia.com> [GStreamer][MSE] AV1 support https://bugs.webkit.org/show_bug.cgi?id=207547 Reviewed by Xabier Rodriguez-Calvar. If only the av1dec decoder is available, consider AV1 decoding support as disabled, because this plugin performs really badly. However, if any other AV1 decoder is present, such as the dav1d-based Rust decoder for instance, consider AV1 support as enabled. These checks are now performed by both RegistryScanner instances, for MSE and non-MSE players. * platform/graphics/gstreamer/GStreamerRegistryScanner.cpp: (WebCore::GStreamerRegistryScanner::hasElementForMediaType const): (WebCore::GStreamerRegistryScanner::initialize): * platform/graphics/gstreamer/GStreamerRegistryScanner.h: 2020-07-09 Alicia Boya García <aboya@igalia.com> [MSE][GStreamer] Remove orphan code in SourceBufferPrivateGStreamer::append() https://bugs.webkit.org/show_bug.cgi?id=214086 Reviewed by Xabier Rodriguez-Calvar. A refactor in r240784 missed this line, which was unreachable code before and should have removed. Instead, it has been run every time after sending an append to the AppendPipeline, and it just happens it doesn't have visible consequences. This patch cleans that up removing that line. No visible behavior changes are introduced. * platform/graphics/gstreamer/mse/SourceBufferPrivateGStreamer.cpp: (WebCore::SourceBufferPrivateGStreamer::append): 2020-07-09 Carlos Garcia Campos <cgarcia@igalia.com> [SOUP] Initialize m_allowCookies and m_acceptEncoding in ResourceRequest::updateFromSoupMessage https://bugs.webkit.org/show_bug.cgi?id=214077 Reviewed by Michael Catanzaro. Check if SOUP_TYPE_CONTENT_DECODER and SOUP_TYPE_COOKIE_JAR are disabled in the given message. * platform/network/soup/ResourceRequestSoup.cpp: (WebCore::ResourceRequest::updateFromSoupMessage): 2020-07-09 Carlos Garcia Campos <cgarcia@igalia.com> [SOUP] Add support for HTTPCookieAcceptPolicy::OnlyFromMainDocumentDomain https://bugs.webkit.org/show_bug.cgi?id=213954 Reviewed by Michael Catanzaro. Handle both OnlyFromMainDocumentDomain and ExclusivelyFromMainDocumentDomain. * platform/network/soup/NetworkStorageSessionSoup.cpp: (WebCore::NetworkStorageSession::NetworkStorageSession): (WebCore::NetworkStorageSession::setCookieAcceptPolicy): (WebCore::NetworkStorageSession::cookieAcceptPolicy const): (WebCore::NetworkStorageSession::setResourceLoadStatisticsEnabled): 2020-07-08 Simon Fraser <simon.fraser@apple.com> Allow ScrollableArea to ask if a user scroll is in progress https://bugs.webkit.org/show_bug.cgi?id=214121 Reviewed by Wenson Hsieh. Work towards fixing scrolling stutters on layouting pages using scroll snap, like tesla.com. ScrollableArea::updateScrollSnapState(), which happens as a result of layout, should not set a new scroll position if a user scroll is in progress. ScrollController already tracks m_inScrollGesture, so in the first instance just refactor the code to return that. Future changes will check for scrolling thread activity. * page/FrameView.cpp: (WebCore::FrameView::isUserScrollInProgress const): (WebCore::FrameView::isRubberBandInProgress const): * page/FrameView.h: * platform/ScrollAnimator.h: (WebCore::ScrollAnimator::ScrollAnimator::isUserScrollInProgress const): * platform/ScrollableArea.cpp: (WebCore::ScrollableArea::updateScrollSnapState): * platform/ScrollableArea.h: (WebCore::ScrollableArea::isUserScrollInProgress const): * platform/cocoa/ScrollController.h: * platform/cocoa/ScrollController.mm: (WebCore::ScrollController::isUserScrollInProgress const): * platform/mac/ScrollAnimatorMac.h: * platform/mac/ScrollAnimatorMac.mm: (WebCore::ScrollAnimatorMac::isUserScrollInProgress const): * rendering/RenderLayer.cpp: (WebCore::RenderLayer::isUserScrollInProgress const): (WebCore::RenderLayer::isRubberBandInProgress const): * rendering/RenderLayer.h: 2020-07-08 Andres Gonzalez <andresg_22@apple.com> Implementation of AXIsolatedObject::setSelectedVisiblePositionRange. https://bugs.webkit.org/show_bug.cgi?id=214118 Reviewed by Chris Fleizach. Covered by test: accessibility/mac/selected-visible-position-range.html. Implemented AXIsolatedObject::setSelectedVisiblePositionRange() and selection() by forwarding the call to the associated AX object. * accessibility/isolatedtree/AXIsolatedObject.cpp: (WebCore::AXIsolatedObject::selection const): (WebCore::AXIsolatedObject::setSelectedVisiblePositionRange const): * accessibility/isolatedtree/AXIsolatedObject.h: * accessibility/mac/WebAccessibilityObjectWrapperMac.mm: (-[WebAccessibilityObjectWrapper _accessibilitySetValue:forAttribute:]): call to the backing object should happen on the main thread since it takes a VisiblePositionRange parameter. 2020-07-08 Simon Fraser <simon.fraser@apple.com> Clean up time values in ScrollController https://bugs.webkit.org/show_bug.cgi?id=214117 Reviewed by Wenson Hsieh. ScrollController used a mixture of [NSDate timeIntervalSinceReferenceDate], [NSProcessInfo processInfo].systemUptime and wheelEvent.timestamp().secondsSinceEpoch(). Standardize on Seconds/MonotonicTime/WallTime. * platform/cocoa/ScrollController.h: * platform/cocoa/ScrollController.mm: (WebCore::elasticDeltaForTimeDelta): (WebCore::ScrollController::handleWheelEvent): (WebCore::ScrollController::snapRubberBandTimerFired): (WebCore::ScrollController::snapRubberBand): 2020-07-08 Brady Eidson <beidson@apple.com> Aggressively prime GameController.framework gamepad provider. https://bugs.webkit.org/show_bug.cgi?id=214094 Reviewed by Darin Adler. GameController.framework gets itself going by listening for application activation, assuming that it is hard linked. Soft linking breaks this. There's an SPI to manually kickstart it. Also add some logging I'd added while exploring issues around this. * platform/gamepad/cocoa/GameControllerGamepadProvider.h: * platform/gamepad/cocoa/GameControllerGamepadProvider.mm: (WebCore::GameControllerGamepadProvider::controllerDidConnect): (WebCore::GameControllerGamepadProvider::prewarmGameControllerDevicesIfNecessary): (WebCore::GameControllerGamepadProvider::startMonitoringGamepads): * platform/gamepad/cocoa/GameControllerSPI.h: 2020-07-08 Sam Weinig <weinig@apple.com> Part 3 of SimpleColor and SRGBA<uint8_t> are essentially the same - let's converge them https://bugs.webkit.org/show_bug.cgi?id=214082 Reviewed by Darin Adler. - Replaces all uses of SimpleColor that are not implementation details of Color, with SRGBA<uint8_t>. - Adds ColorBuilder<T> to allow maintaining the syntax SimpleColor for constant colors. e.g: Color color = Color::yellow.colorWithAlpha(128); * Headers.cmake: * WebCore.xcodeproj/project.pbxproj: Add ColorBuilder.h * platform/graphics/Color.cpp: (WebCore::Color::lightened const): (WebCore::Color::darkened const): (WebCore::Color::semanticColor const): * platform/graphics/Color.h: (WebCore::Color::Color): (WebCore::Color::asSimple const): (WebCore::Color::setSimpleColor): (WebCore::Color::isBlackColor): (WebCore::Color::isWhiteColor): (WebCore::Color::encode const): (WebCore::Color::decode): - Make constructor taking a SimpleColor private. - Add / modifiy constructors to take SRGBA<uint8_t>. - Make setSimpleColor() take a SRGBA<uint8_t> (this will be renamed along with other aspects of Color's internals in a subsequent change). - Update calls that still need SimpleColor to use an explicit construction from SRGBA<uint8_t>. * platform/graphics/ColorBuilder.h: Added. (WebCore::ColorBuilder::ColorBuilder): (WebCore::ColorBuilder::color const): (WebCore::ColorBuilder::colorWithAlpha const): Added to help maintain current syntax why constructing colors. Currently it only supports color type with uint8_t components, but can be expanded to support more. * platform/graphics/ColorUtilities.h: (WebCore::clampToComponentByte): Remove unnecessary cast. * platform/graphics/SimpleColor.h: (WebCore::SimpleColor::SimpleColor): Restrict to explicit construction via a SRGBA<uint8_t>. (WebCore::makeSimpleColor): Update to return ColorBuilder<SRGBA<uint8_t>>. A future change will update the function name, but kept the same here to limit the size of the change. * platform/graphics/mac/ColorMac.mm: (WebCore::makeSimpleColorFromNSColor): (WebCore::nsColor): * platform/graphics/cg/ColorCG.cpp: (WebCore::makeSimpleColorFromCGColor): (WebCore::cachedCGColor): Replace direct SimpleColor usage with SRGBA<uint8_t> and simplify Packed construction now that .asSRGBA<uint8_t>() is not needed for color constants. * css/DeprecatedCSSOMRGBColor.h: * css/parser/CSSParser.cpp: (WebCore::CSSParser::parseNamedColor): (WebCore::CSSParser::parseHexColor): * css/parser/CSSParser.h: * css/parser/CSSParserFastPaths.cpp: (WebCore::finishParsingHexColor): (WebCore::parseHexColorInternal): (WebCore::parseNumericColor): (WebCore::finishParsingNamedColor): (WebCore::parseNamedColorInternal): (WebCore::parseSimpleColorInternal): (WebCore::CSSParserFastPaths::parseSimpleColor): (WebCore::CSSParserFastPaths::parseHexColor): (WebCore::CSSParserFastPaths::parseNamedColor): * css/parser/CSSParserFastPaths.h: * css/parser/CSSPropertyParserHelpers.cpp: (WebCore::CSSPropertyParserHelpers::parseHexColor): * html/ColorInputType.cpp: (WebCore::parseSimpleColorValue): * html/HTMLElement.cpp: (WebCore::parseLegacyColorValue): * page/DebugPageOverlays.cpp: (WebCore::touchEventRegionColors): * page/cocoa/ResourceUsageOverlayCocoa.mm: (WebCore::HistoricMemoryCategoryInfo::HistoricMemoryCategoryInfo): * platform/graphics/ColorBlending.cpp: (WebCore::blendWithWhite): (WebCore::blend): (WebCore::blendWithoutPremultiply): * platform/graphics/avfoundation/InbandTextTrackPrivateAVF.cpp: (WebCore::makeSimpleColorFromARGBCFArray): * platform/graphics/ca/GraphicsLayerCA.cpp: (WebCore::cloneLayerDebugBorderColor): * platform/mock/MockRealtimeVideoSource.cpp: (WebCore::MockRealtimeVideoSource::drawBoxes): * rendering/RenderLayerBacking.cpp: * rendering/RenderThemeMac.mm: (WebCore::menuBackgroundColor): Replace direct SimpleColor usage with SRGBA<uint8_t>. 2020-07-08 Simon Fraser <simon.fraser@apple.com> Make a logging channel for ScrollSnap and improve its logging https://bugs.webkit.org/show_bug.cgi?id=214096 Reviewed by Wenson Hsieh. Pull existing scroll snap logging out of the Scrolling log channel into a new ScrollSnap channel, add more logging, and make better use of TextStream-based logging. * page/scrolling/AxisScrollSnapOffsets.cpp: (WebCore::operator<<): (WebCore::updateSnapOffsetsForScrollableArea): (WebCore::snapOffsetsToString): Deleted. (WebCore::snapOffsetRangesToString): Deleted. (WebCore::snapPortOrAreaToString): Deleted. * platform/Logging.h: * platform/ScrollableArea.cpp: (WebCore::ScrollableArea::updateScrollSnapState): * platform/cocoa/ScrollController.mm: (WebCore::operator<<): (WebCore::ScrollController::processWheelEventForScrollSnap): (WebCore::ScrollController::startScrollSnapTimer): (WebCore::ScrollController::stopScrollSnapTimer): (WebCore::ScrollController::scrollSnapTimerFired): (WebCore::ScrollController::updateScrollSnapState): * platform/cocoa/ScrollSnapAnimatorState.h: * platform/cocoa/ScrollSnapAnimatorState.mm: (WebCore::operator<<): 2020-07-08 Per Arne Vollan <pvollan@apple.com> [Cocoa] Make it possible to establish direct XPC connections between WebKit processes https://bugs.webkit.org/show_bug.cgi?id=214079 Reviewed by Brent Fulgham. Add abstract classes XPCEndpoint and XPCEndpointClient to handle the creation of direct xpc connections between WebKit processes. In order to create a direct xpc connection between two processes, these two classes can be subclassed, and the xpc endpoint created by the XPCEndpoint object, can be sent via the UI process over the bootstrap xpc connection. The UI process can then forward this endpoint to another WebKit process by sending it over the bootstrap xpc connection. The receiving process can then initialize an XPCEndpointClient object with this endpoint, and a new direct connection will then be available, over which the two processes can communicate. API test: WebKit.XPCEndpoint * WebCore.xcodeproj/project.pbxproj: * platform/cocoa/XPCEndpoint.h: Added. * platform/cocoa/XPCEndpoint.mm: Added. (WebCore::XPCEndpoint::XPCEndpoint): (WebCore::XPCEndpoint::sendEndpointToConnection): (WebCore::XPCEndpoint::endpoint const): * platform/cocoa/XPCEndpointClient.h: Added. (WebCore::XPCEndpointClient::~XPCEndpointClient): * platform/cocoa/XPCEndpointClient.mm: Added. (WebCore::XPCEndpointClient::setEndpoint): (WebCore::XPCEndpointClient::connection): 2020-07-08 Stephan Szabo <stephan.szabo@sony.com> [PlayStation] Build fix after r264050 https://bugs.webkit.org/show_bug.cgi?id=214091 Unreviewed build fix No new tests, only build fix. * platform/playstation/ScrollbarThemePlayStation.cpp: 2020-07-08 Sihui Liu <sihui_liu@appe.com> Text manipulation should ignore white spaces between nodes https://bugs.webkit.org/show_bug.cgi?id=213907 Reviewed by Wenson Hsieh. Text returned by TextIterator contains white spaces (including tabs and line breaks) that do not belong to content of nodes. Those spaces are emitted based on style of nodes. For example, line breaks can be emitted before and after block-level element. These spaces should not be extracted as part of the content, because they could change based on the style of nodes or range of TextIterator, and manipulation fails if content is changed. We want to make sure TextManipulationController monitors the real content of nodes. r262778 tried solving this issue by excluding text with empty node from TextIterator's result. That worked with line break, but not space and tab. See radar and new test. To solve this, now we exclude text with zero-length range. This patch does not change the behavior of line breaks, which is covered by: TextManipulation.StartTextManipulationExtractsVisibleLineBreaksInTextAsExcludedTokens TextManipulation.CompleteTextManipulationCanMergeContentAndPreserveLineBreaks TextManipulation.CompleteTextManipulationReplaceTwoSimpleParagraphs New test: TextManipulation.CompleteTextManipulationIgnoreWhiteSpacesBetweenParagraphs Modified existing tests: TextManipulation.StartTextManipulationExtractsValuesByNode * editing/TextManipulationController.cpp: (WebCore::ParagraphContentIterator::ParagraphContentIterator): (WebCore::ParagraphContentIterator::shouldAdvanceIteratorPastCurrentNode const): (WebCore::ParagraphContentIterator::advanceIteratorNodeAndUpdateText): 2020-07-08 Darin Adler <darin@apple.com> Remove use of live ranges from AXObject.h https://bugs.webkit.org/show_bug.cgi?id=214053 Reviewed by Sam Weinig. * accessibility/AXObjectCache.cpp: (WebCore::AXObjectCache::traverseToOffsetInRange): Take SimpleRange. (WebCore::AXObjectCache::lengthForRange): Take Optional<SimpleRange>. (WebCore::AXObjectCache::rangeForNodeContents): Return SimpleRange, take reference rather than pointer. (WebCore::characterOffsetsInOrder): Use SimpleRange. (WebCore::resetNodeAndOffsetForReplacedNode): Take a reference to the node rather than a pointer. (WebCore::boundaryPoint): Added. Could be used to replace calls to setRangeStartOrEndWithCharacterOffset. (WebCore::setRangeStartOrEndWithCharacterOffset): Take SimpleRange. Also use the new boundaryPoint function above. (WebCore::AXObjectCache::rangeForUnorderedCharacterOffsets): Return Optional<SimpleRange>. (WebCore::AXObjectCache::startOrEndCharacterOffsetForRange): Take SimpleRange. (WebCore::AXObjectCache::startOrEndTextMarkerDataForRange): Take SimpleRange. (WebCore::AXObjectCache::characterOffsetForNodeAndOffset): Use SimpleRange. (WebCore::AXObjectCache::textMarkerDataForNextCharacterOffset): Ditto. (WebCore::AXObjectCache::textMarkerDataForPreviousCharacterOffset): Ditto. (WebCore::AXObjectCache::visiblePositionFromCharacterOffset): (WebCore::AXObjectCache::characterOffsetFromVisiblePosition): (WebCore::AXObjectCache::leftWordRange): Return Optional<SimpleRange>. (WebCore::AXObjectCache::rightWordRange): Ditto. (WebCore::AXObjectCache::nextBoundary): Ditto. (WebCore::AXObjectCache::previousBoundary): Ditto. (WebCore::AXObjectCache::startCharacterOffsetOfParagraph): Use SimpleRange. (WebCore::AXObjectCache::endCharacterOffsetOfParagraph): Ditto. (WebCore::AXObjectCache::paragraphForCharacterOffset): Ditto. (WebCore::AXObjectCache::sentenceForCharacterOffset): Ditto. (WebCore::AXObjectCache::localCaretRectForCharacterOffset): Ditto. (WebCore::AXObjectCache::characterOffsetForPoint): Ditto. (WebCore::AXObjectCache::characterOffsetForIndex): Ditto. (WebCore::AXObjectCache::indexForCharacterOffset): Ditto. * accessibility/AXObjectCache.h: Remove uses of Range and include of "Range.h". * accessibility/AccessibilityObject.cpp: (WebCore::AccessibilityObject::elementRange const): Call createLiveRange. (WebCore::AccessibilityObject::rangeForPlainTextRange const): Ditto. * accessibility/AccessibilityRenderObject.cpp: (WebCore::AccessibilityRenderObject::boundsForRange const): Pass SimpleRange. * accessibility/ios/WebAccessibilityObjectWrapperIOS.mm: (+[WebAccessibilityTextMarker startOrEndTextMarkerForRange:isStart:cache:]): Pass SimpleRange. (-[WebAccessibilityObjectWrapper positionForTextMarker:]): Call createLiveRange. (-[WebAccessibilityObjectWrapper textMarkerRangeForSelection]): Pass SimpleRange. (-[WebAccessibilityObjectWrapper textMarkerForPosition:]): Ditto. (-[WebAccessibilityObjectWrapper rangeForTextMarkers:]): Call createLiveRange. (-[WebAccessibilityObjectWrapper lengthForTextMarkers:]): Pass SimpleRange. * accessibility/mac/WebAccessibilityObjectWrapperMac.mm: (startOrEndTextmarkerForRange): (-[WebAccessibilityObjectWrapper rangeForTextMarkerRange:]): Pass SimpleRange. (-[WebAccessibilityObjectWrapper _indexForTextMarker:]): Call createLiveRange. (-[WebAccessibilityObjectWrapper textMarkerRangeAtTextMarker:forUnit:]): Ditto. (-[WebAccessibilityObjectWrapper accessibilityAttributeValue:forParameter:]): Ditto. * dom/BoundaryPoint.h: Added makeBoundaryPointBefore/AfterNode. * dom/SimpleRange.cpp: (WebCore::makeBoundaryPointBeforeNode): Added. (WebCore::makeBoundaryPointAfterNode): Ditto. 2020-07-08 Zalan Bujtas <zalan@apple.com> [LFC][IFC] Do not use the initial strut baseline values when the text content is inside an inline container https://bugs.webkit.org/show_bug.cgi?id=214069 Reviewed by Antti Koivisto. Test: fast/layoutformattingcontext/line-heigt-when-text-is-inside-inline-container.html * layout/inlineformatting/InlineLineBuilder.cpp: (WebCore::Layout::LineBuilder::close): (WebCore::Layout::LineBuilder::adjustBaselineAndLineHeight): * layout/inlineformatting/InlineLineBuilder.h: 2020-07-08 Zalan Bujtas <zalan@apple.com> [LFC][TFC] Table width is computed as if box-sizing was border-box https://bugs.webkit.org/show_bug.cgi?id=214070 Reviewed by Antti Koivisto. Apparently the width property of the <table> works as if box-sizing were set to border-box (and <div style="display: table" does not). Test: fast/layoutformattingcontext/table-with-padding-and-border-simple.html * layout/layouttree/LayoutTreeBuilder.cpp: (WebCore::Layout::TreeBuilder::buildTableStructure): 2020-07-07 Antoine Quint <graouts@webkit.org> [iOS] Sharing an <img> element with a base64-encoded URL shares the URL as raw text instead of an image https://bugs.webkit.org/show_bug.cgi?id=214042 <rdar://problem/56669102> Reviewed by Wenson Hsieh. * en.lproj/Localizable.strings: 2020-07-08 Philippe Normand <pnormand@igalia.com> REGRESSION(r263836): [GStreamer] Debug ASSERT hits https://bugs.webkit.org/show_bug.cgi?id=214047 Reviewed by Xabier Rodriguez-Calvar. Reduce the element dependency on RefPtr<MediaStreamTrackPrivate> which is not MT-safe. The data we need from it are its ID and the contents required to build a GstTagList. So we now create this tag-list upfront and keep track of the trackID as well. * platform/mediastream/gstreamer/GStreamerMediaStreamSource.cpp: (webkitMediaStreamSrcAddPad): (ProbeData::ProbeData): (webkitMediaStreamSrcPadProbeCb): (webkitMediaStreamSrcSetupSrc): 2020-07-07 Andy Estes <aestes@apple.com> [Apple Pay] Fix the build on Catalina internal SDKs https://bugs.webkit.org/show_bug.cgi?id=214066 Unreviewed build fix for the 10.15.0 Internal SDK. * Modules/applepay/ApplePaySetupFeature.mm: (WebCore::ApplePaySetupFeature::supportsInstallments const): 2020-07-07 Alex Christensen <achristensen@webkit.org> Allow WebCoreNSURLSession sendH2Ping:pongHandler: to be called from any thread like the rest of WebCoreNSURLSession methods https://bugs.webkit.org/show_bug.cgi?id=214065 Reviewed by Jer Noble. Otherwise horrible crashes happen. The WebCore function calls and loading IPC calls need to happen on the main thread, and the callback should happen on the NSOperationQueue given when constructing the WebCoreNSURLSession. * platform/network/cocoa/WebCoreNSURLSession.mm: (-[WebCoreNSURLSession sendH2Ping:pongHandler:]): 2020-07-07 Sam Weinig <weinig@apple.com> Part 2 of SimpleColor and SRGBA<uint8_t> are essentially the same - let's converge them https://bugs.webkit.org/show_bug.cgi?id=213981 Reviewed by Darin Adler. - Replaces internal representation of SimpleColor based on an ARGB uint32_t with SRGBA<uint8_t>. - Removes SimpleColor constructor taking a uint32_t. Callers that still need to convert from ARGB now do makeSimpleColor(asSRGBA(Packed::ARGB { value })). - Removes value() and valueAsARGB() member functions from SimpleColor. Callers that need a packed representation now do Packed::ARGB { simpleColor.asSRGBA<uint8_t>() }.value. * css/StyleColor.cpp: (WebCore::StyleColor::colorFromKeyword): Use asSRGBA(Packed::ARGB{...}) to constuct the color. * css/parser/CSSParserFastPaths.cpp: (WebCore::finishParsingNamedColor): Use asSRGBA(Packed::ARGB{...}) (or in one case, Packed::RGBA) to constuct the color. These can almost certainly be simplified, but in the interest of keeping things smallish, I have left that for a subsequent change. * editing/CompositionHighlight.h: Switch to using auto/makeSimpleColor. * page/cocoa/ResourceUsageOverlayCocoa.mm: Switch to using makeSimpleColor. (WebCore::HistoricMemoryCategoryInfo::HistoricMemoryCategoryInfo): (WebCore::HistoricResourceUsageData::HistoricResourceUsageData): Switch to using auto/makeSimpleColor. * platform/adwaita/ScrollbarThemeAdwaita.cpp: Switch to using auto/makeSimpleColor. * platform/graphics/Color.cpp: * platform/graphics/Color.h: - Switch to using auto/makeSimpleColor for named colors. - Switch to storing/encoding the inline SimpleColor as a Packed::RGBA value. * platform/graphics/ColorBlending.cpp: (WebCore::blend): Update for new name of clampToComponentBytes. * platform/graphics/ColorTypes.h: (WebCore::Packed::RGBA::RGBA): (WebCore::Packed::ARGB::ARGB): (WebCore::asSRGBA): Rename WebCore::ARGB to WebCore::Packed::ARGB. Adds companion, WebCore::Packed::RGBA. And adds constructors which make a packed type from an SRGBA<uint8_t>. * platform/graphics/ColorUtilities.h: (WebCore::clampToComponentByte): (WebCore::clampToComponentFloat): Extract out helper functions which just do the clamping for the type. (WebCore::clampToComponentBytes): (WebCore::clampToComponentFloats): Rename conversion functions that just clamp to use "clamp" prefix rather than "convert". Make use of extracted helpers. * platform/graphics/ImageBackingStore.h: (WebCore::ImageBackingStore::blendPixel): (WebCore::ImageBackingStore::pixelValue const): Update using new packed color types and funtions. * platform/graphics/SimpleColor.h: (WebCore::SimpleColor::SimpleColor): (WebCore::SimpleColor::alphaComponent const): (WebCore::SimpleColor::alphaComponentAsFloat const): (WebCore::SimpleColor::isOpaque const): (WebCore::SimpleColor::isVisible const): (WebCore::SimpleColor::colorWithAlpha const): (WebCore::SimpleColor::invertedColorWithAlpha const): (WebCore::SimpleColor::asSRGBA const): (WebCore::SimpleColor::get const): (WebCore::makeSimpleColor): (WebCore::SimpleColor::valueAsARGB const): Deleted. (WebCore::SimpleColor::value const): Deleted. (WebCore::SimpleColor::redComponent const): Deleted. (WebCore::SimpleColor::greenComponent const): Deleted. (WebCore::SimpleColor::blueComponent const): Deleted. - Removes constructor taking an ARGB uint32_t. - Removes valueAsARGB()/value() functions (can use Packed::ARGB directly if needed). - Switches internal representation to SRGBA<uint8_t>. - Streamline makeSimpleColor functions to use shared helpers from ColorUtilities.h * platform/graphics/cg/ColorCG.cpp: (WebCore::cachedCGColor): * platform/graphics/mac/ColorMac.mm: (WebCore::nsColor): Use Packed::RGBA to extract uint32_t for quick lookup of transparent/white/black SimpleColors. Despite the length of the calls, SimpleColor is fully constexpr, so these actually collapse down to the uint32_t representation at compile time. * platform/graphics/win/GraphicsContextCGWin.cpp: (WebCore::GraphicsContext::drawDotsForDocumentMarker): Switch to using auto/makeSimpleColor. * platform/mock/MockRealtimeMediaSourceCenter.cpp: (WebCore::defaultDevices): Switch to using makeSimpleColor. * platform/mock/MockRealtimeVideoSource.cpp: (WebCore::MockRealtimeVideoSource::drawBoxes): Switch to using auto/makeSimpleColor. * platform/mock/ScrollbarThemeMock.cpp: (WebCore::ScrollbarThemeMock::paintTrackBackground): Switch to using makeSimpleColor. * rendering/RenderObject.cpp: (WebCore::RenderObject::calculateBorderStyleColor): Update comment to use per-component values. * rendering/RenderTheme.cpp: (WebCore::RenderTheme::systemColor const): Switch to using makeSimpleColor. * rendering/RenderThemeAdwaita.cpp: Switch to using auto/makeSimpleColor. * rendering/RenderThemeIOS.h: * rendering/RenderThemeIOS.mm: (WebCore::RenderThemeIOS::paintProgressBar): Switch to using auto/makeSimpleColor. * rendering/RenderThemeMac.mm: (WebCore::RenderThemeMac::systemColor const): Switch to using auto/makeSimpleColor. 2020-07-07 Andres Gonzalez <andresg_22@apple.com> Web content process hangs in AccessibilityRenderObject::setSelectedVisiblePositionRange in some corner cases. https://bugs.webkit.org/show_bug.cgi?id=214017 <rdar://problem/63000006> Reviewed by Chris Fleizach. Ensures that in the case of collapsed ranges, the VisiblePosition that the selection is being set to, is contained in the Element object. Test: accessibility/mac/selected-visible-position-range.html * accessibility/AccessibilityRenderObject.cpp: (WebCore::AccessibilityRenderObject::setSelectedVisiblePositionRange const): 2020-07-07 Youenn Fablet <youenn@apple.com> Fix potential pixel buffer leak in ImageRotationSessionVT::rotate https://bugs.webkit.org/show_bug.cgi?id=213922 Reviewed by Eric Carlson. Fix a potential memory leak in an error case. Add more logging to be able to see errors. Remove the kCVPixelBufferIOSurfacePropertiesKey key on iOS from the buffer pool to revert part of https://trac.webkit.org/changeset/258504/webkit that seems problematic in iOS. * platform/graphics/cv/ImageRotationSessionVT.mm: (WebCore::ImageRotationSessionVT::initialize): (WebCore::ImageRotationSessionVT::rotate): 2020-07-07 Simon Fraser <simon.fraser@apple.com> Unable to scroll elcomerico.pe page until the page finishes loading https://bugs.webkit.org/show_bug.cgi?id=214027 <rdar://problem/64646259> Reviewed by Antti Koivisto. <https://elcomercio.pe/mundo/eeuu/que-visas-para-estados-unidos-fueron-suspendidas-por-orden-de-donald-trump-hasta-fin-de-ano-y-a-quien-afecta-la-medida-noticia/> had a scaleX(0) element as an ancestor of an overflow:scroll. The CALayer hit-testing code failed to take non-invertible transforms into account, causing the overflow:scroll to intercept scrolling events. Fix by explicitly testing for non-invertible transforms, and, when found, bailing from the sublayer walk. A non-invertible layer transform makes all its descendants non hit-testable. Tests: fast/scrolling/ios/non-invertible-transformed-scroller-ancestor.html fast/scrolling/mac/non-invertible-transform-hit-testing.html * page/scrolling/mac/ScrollingTreeMac.mm: (collectDescendantLayersAtPoint): * platform/graphics/transforms/TransformationMatrix.h: 2020-07-07 Peng Liu <peng.liu6@apple.com> Function didCleanupFullscreencreen() should be called at the end of VideoFullscreenInterfaceAVKit::cleanupFullscreen() https://bugs.webkit.org/show_bug.cgi?id=214032 Reviewed by Eric Carlson. VideoFullscreenManagerProxy::didCleanupFullscreen() may destroy an instance of VideoFullscreenInterfaceAVKit. So we should not access member variables of VideoFullscreenInterfaceAVKit after calling didCleanupFullscreen() in VideoFullscreenInterfaceAVKit::cleanupFullscreen(). Fix a flaky test crash: media/video-autoplay.html * platform/ios/VideoFullscreenInterfaceAVKit.mm: (VideoFullscreenInterfaceAVKit::cleanupFullscreen): 2020-07-07 Tim Horton <timothy_horton@apple.com> <attachment> layout does not scale with Dynamic Type size changes https://bugs.webkit.org/show_bug.cgi?id=214023 <rdar://problem/64914762> Reviewed by Sam Weinig. Test: fast/attachment/attachment-dynamic-type.html * rendering/RenderThemeIOS.mm: (WebCore::shortCaptionPointSizeWithContentSizeCategory): (WebCore::attachmentDynamicTypeScaleFactor): (WebCore::RenderAttachmentInfo::buildWrappedLines): (WebCore::RenderThemeIOS::attachmentIntrinsicSize const): Scale the <attachment> overall size and text line width by the Dynamic Type scaling factor, determined by dividing the resolved point size of two font descriptors created with the Large (default) category and the Current category. * rendering/RenderAttachment.cpp: (WebCore::RenderAttachment::layout): * rendering/RenderTheme.h: (WebCore::RenderTheme::attachmentShouldAllowWidthToShrink const): * rendering/RenderThemeIOS.h: Add a RenderTheme bit controlling the behavior introduced in r202117. After r202117, <attachment> elements are never allowed to shrink. This is fine for macOS, where we don't vary the Dynamic Type size, only the content, but undesirable on iOS, where the size of the <attachment> is based solely on Dynamic Type size (and thus can shrink when the size is reduced), and not the content. * Configurations/WebCoreTestSupport.xcconfig: * testing/Internals.cpp: (WebCore::Internals::resetToConsistentState): (WebCore::Internals::setContentSizeCategory): * testing/Internals.h: * testing/Internals.idl: Add a Internals method to change the current Dynamic Type category. 2020-07-07 Alex Christensen <achristensen@webkit.org> Add WebCoreNSURLSession SPI to send HTTP/2 ping https://bugs.webkit.org/show_bug.cgi?id=214030 <rdar://problem/64495827> Reviewed by Jer Noble. Add lots of plumbing, move internalError from WebKit to WebCore. Covered by an API test that requires some future CFNetwork behavior. * Sources.txt: * WebCore.xcodeproj/project.pbxproj: * bindings/js/JSDOMPromiseDeferred.h: * loader/FrameLoaderClient.cpp: Added. (WebCore::FrameLoaderClient::sendH2Ping): * loader/FrameLoaderClient.h: * loader/MediaResourceLoader.cpp: (WebCore::MediaResourceLoader::sendH2Ping): * loader/MediaResourceLoader.h: * platform/graphics/PlatformMediaResourceLoader.cpp: Added. (WebCore::PlatformMediaResourceLoader::sendH2Ping): * platform/graphics/PlatformMediaResourceLoader.h: * platform/network/ResourceErrorBase.cpp: (WebCore::internalError): * platform/network/ResourceErrorBase.h: * platform/network/cocoa/WebCoreNSURLSession.h: * platform/network/cocoa/WebCoreNSURLSession.mm: (-[WebCoreNSURLSession sendH2Ping:pongHandler:]): * testing/Internals.cpp: (WebCore::Internals::sendH2Ping): * testing/Internals.h: * testing/Internals.idl: 2020-07-07 Tomoki Imai <Tomoki.Imai@sony.com> [Win] Implement Pasteboard::writeCustomData for Web Inspector Console tab https://bugs.webkit.org/show_bug.cgi?id=213986 Reviewed by Fujii Hironori. Implement Pasteboard::writeCustomData and Pasteboard::typesSafeForBindings. This fixes the issue which we cannot copy text in WebInspector's Console tab. We enable some existing testcases for pasteboard. * platform/Pasteboard.h: * platform/PasteboardCustomData.cpp: (WebCore::PasteboardCustomData::fromPersistenceDecoder): Construct PasteboardCustomData from WTF::Persistence::Decoder. (WebCore::PasteboardCustomData::fromSharedBuffer): Use fromPersistenceDecoder function to implement. * platform/PasteboardCustomData.h: * platform/win/ClipboardUtilitiesWin.cpp: (WebCore::createGlobalData): Add uint8_t* variant. * platform/win/ClipboardUtilitiesWin.h: * platform/win/PasteboardWin.cpp: (WebCore::Pasteboard::finishCreatingPasteboard): Register new clipboard format CustomDataClipboardFormat. (WebCore::Pasteboard::readPasteboardCustomData): Helper function to read PasteboardCustomData from the pasteboard. (WebCore::Pasteboard::typesSafeForBindings): Implemented. (WebCore::Pasteboard::readOrigin): Implemented. (WebCore::Pasteboard::readStringInCustomData): Implemented. (WebCore::Pasteboard::writeCustomData): Implemented. 2020-07-06 Simon Fraser <simon.fraser@apple.com> High CPU usage on Stash search results pages https://bugs.webkit.org/show_bug.cgi?id=214018 <rdar://problem/64832917> Reviewed by Tim Horton. Stash search results pages can contain a lot of overflow:scroll areas, so scrolling thread CA commits would take a long time because ScrollingTreeScrollingNodeDelegateMac::updateScrollbarPainters() would open and close a CA commit for each scroller. Fix by not explicitly starting a CA commit, and only entering this code if a gesture is active and in the momentum phase. Also sprinkle BEGIN_BLOCK_OBJC_EXCEPTIONS/END_BLOCK_OBJC_EXCEPTIONS in more places that call into Core Animation. * page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.mm: (WebCore::ScrollingTreeFrameScrollingNodeMac::repositionScrollingLayers): (WebCore::ScrollingTreeFrameScrollingNodeMac::repositionRelatedLayers): * page/scrolling/mac/ScrollingTreeOverflowScrollingNodeMac.mm: (WebCore::ScrollingTreeOverflowScrollingNodeMac::repositionScrollingLayers): * page/scrolling/mac/ScrollingTreeScrollingNodeDelegateMac.h: * page/scrolling/mac/ScrollingTreeScrollingNodeDelegateMac.mm: (WebCore::ScrollingTreeScrollingNodeDelegateMac::handleWheelEvent): (WebCore::ScrollingTreeScrollingNodeDelegateMac::updateScrollbarPainters): 2020-07-06 Simon Fraser <simon.fraser@apple.com> BEGIN_BLOCK_OBJC_EXCEPTIONS/END_BLOCK_OBJC_EXCEPTIONS should not have trailing semicolons https://bugs.webkit.org/show_bug.cgi?id=214019 Reviewed by Tim Horton. These macros are defined as: #define BEGIN_BLOCK_OBJC_EXCEPTIONS @try { #define END_BLOCK_OBJC_EXCEPTIONS } @catch(NSException *localException) { ReportBlockedObjCException(localException); } so they should not be used with trailing semicolons. * editing/cocoa/DictionaryLookup.mm: (WebCore::expandSelectionByCharacters): (WebCore::showPopupOrCreateAnimationController): * editing/cocoa/EditorCocoa.mm: (WebCore::Editor::dataInRTFDFormat): (WebCore::Editor::dataInRTFFormat): * editing/mac/DictionaryLookupLegacy.mm: (WebCore::tokenRange): (WebCore::expandSelectionByCharacters): (WebCore::showPopupOrCreateAnimationController): (WebCore::DictionaryLookup::hidePopup): * page/ios/EventHandlerIOS.mm: (WebCore::EventHandler::keyEvent): (WebCore::lastEventIsMouseUp): (WebCore::EventHandler::passMouseDownEventToWidget): (WebCore::findViewInSubviews): (WebCore::EventHandler::eventLoopHandleMouseUp): (WebCore::EventHandler::passSubframeEventToSubframe): (WebCore::EventHandler::passWheelEventToWidget): (WebCore::EventHandler::mouseDown): (WebCore::EventHandler::mouseUp): (WebCore::EventHandler::mouseMoved): * page/mac/ChromeMac.mm: (WebCore::Chrome::focusNSView): * page/mac/EventHandlerMac.mm: (WebCore::EventHandler::keyEvent): (WebCore::lastEventIsMouseUp): (WebCore::EventHandler::passMouseDownEventToWidget): (WebCore::findViewInSubviews): (WebCore::EventHandler::eventLoopHandleMouseDragged): (WebCore::EventHandler::eventLoopHandleMouseUp): (WebCore::EventHandler::passSubframeEventToSubframe): (WebCore::EventHandler::passWheelEventToWidget): (WebCore::EventHandler::mouseDown): (WebCore::EventHandler::mouseDragged): (WebCore::EventHandler::mouseUp): (WebCore::EventHandler::sendFakeEventsAfterWidgetTracking): (WebCore::EventHandler::mouseMoved): (WebCore::EventHandler::pressureChange): (WebCore::EventHandler::passMouseMovedEventToScrollbars): * platform/cocoa/ContentFilterUnblockHandlerCocoa.mm: (WebCore::ContentFilterUnblockHandler::encode const): (WebCore::ContentFilterUnblockHandler::decode): * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm: (WebCore::MediaPlayerPrivateAVFoundationObjC::paintCurrentFrameInContext): * platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm: (WebCore::SourceBufferPrivateAVFObjC::willProvideContentKeyRequestInitializationDataForTrackID): * platform/graphics/gpu/cocoa/GPUBindGroupAllocatorMetal.mm: (WebCore::GPUBindGroupAllocator::allocateAndSetEncoders): (WebCore::GPUBindGroupAllocator::reallocate): * platform/graphics/gpu/cocoa/GPUBindGroupLayoutMetal.mm: (WebCore::appendArgumentToArray): (WebCore::tryCreateMtlArgumentEncoder): (WebCore::argumentDescriptor): (WebCore::GPUBindGroupLayout::tryCreate): * platform/graphics/gpu/cocoa/GPUBindGroupMetal.mm: (WebCore::setBufferOnEncoder): (WebCore::setSamplerOnEncoder): (WebCore::setTextureOnEncoder): * platform/graphics/gpu/cocoa/GPUBufferMetal.mm: (WebCore::GPUBuffer::tryCreate): (WebCore::GPUBuffer::commandBufferCommitted): (WebCore::GPUBuffer::copyStagingBufferToGPU): * platform/graphics/gpu/cocoa/GPUCommandBufferMetal.mm: (WebCore::GPUCommandBuffer::tryCreate): (WebCore::GPUCommandBuffer::endBlitEncoding): (WebCore::GPUCommandBuffer::copyBufferToBuffer): (WebCore::GPUCommandBuffer::copyBufferToTexture): (WebCore::GPUCommandBuffer::copyTextureToBuffer): (WebCore::GPUCommandBuffer::copyTextureToTexture): * platform/graphics/gpu/cocoa/GPUComputePassEncoderMetal.mm: (WebCore::GPUComputePassEncoder::tryCreate): (WebCore::GPUComputePassEncoder::setPipeline): (WebCore::GPUComputePassEncoder::dispatch): (WebCore::GPUComputePassEncoder::useResource): (WebCore::GPUComputePassEncoder::setComputeBuffer): * platform/graphics/gpu/cocoa/GPUComputePipelineMetal.mm: (WebCore::trySetMetalFunctions): (WebCore::trySetFunctions): (WebCore::convertComputePipelineDescriptor): (WebCore::tryCreateMTLComputePipelineState): * platform/graphics/gpu/cocoa/GPUDeviceMetal.mm: (WebCore::GPUDevice::tryCreate): * platform/graphics/gpu/cocoa/GPUProgrammablePassEncoderMetal.mm: (WebCore::GPUProgrammablePassEncoder::endPass): * platform/graphics/gpu/cocoa/GPUQueueMetal.mm: (WebCore::GPUQueue::tryCreate): (WebCore::GPUQueue::submit): * platform/graphics/gpu/cocoa/GPURenderPassEncoderMetal.mm: (WebCore::populateMtlColorAttachmentsArray): (WebCore::populateMtlDepthStencilAttachment): (WebCore::GPURenderPassEncoder::tryCreate): (WebCore::GPURenderPassEncoder::setPipeline): (WebCore::GPURenderPassEncoder::setBlendColor): (WebCore::GPURenderPassEncoder::setViewport): (WebCore::GPURenderPassEncoder::setScissorRect): (WebCore::GPURenderPassEncoder::setVertexBuffers): (WebCore::GPURenderPassEncoder::draw): (WebCore::GPURenderPassEncoder::drawIndexed): (WebCore::GPURenderPassEncoder::useResource): (WebCore::GPURenderPassEncoder::setVertexBuffer): (WebCore::GPURenderPassEncoder::setFragmentBuffer): * platform/graphics/gpu/cocoa/GPURenderPipelineMetal.mm: (WebCore::tryCreateMtlDepthStencilState): (WebCore::trySetVertexInput): (WebCore::trySetColorStates): (WebCore::trySetMetalFunctions): (WebCore::trySetFunctions): (WebCore::convertRenderPipelineDescriptor): (WebCore::tryCreateMtlRenderPipelineState): * platform/graphics/gpu/cocoa/GPUSamplerMetal.mm: (WebCore::tryCreateMtlSamplerState): * platform/graphics/gpu/cocoa/GPUShaderModuleMetal.mm: (WebCore::GPUShaderModule::tryCreate): * platform/graphics/gpu/cocoa/GPUSwapChainMetal.mm: (WebCore::tryCreateWebGPULayer): (WebCore::GPUSwapChain::tryGetCurrentTexture): * platform/graphics/gpu/cocoa/GPUTextureMetal.mm: (WebCore::tryCreateMtlTextureDescriptor): (WebCore::GPUTexture::tryCreate): (WebCore::GPUTexture::tryCreateDefaultTextureView): * platform/graphics/mac/ColorMac.mm: (WebCore::makeSimpleColorFromNSColor): * platform/ios/ScrollViewIOS.mm: (WebCore::ScrollView::documentView const): (WebCore::ScrollView::platformSetScrollbarModes): (WebCore::ScrollView::platformScrollbarModes const): (WebCore::ScrollView::platformSetCanBlitOnScroll): (WebCore::ScrollView::platformUnobscuredContentRect const): (WebCore::ScrollView::platformExposedContentRect const): (WebCore::ScrollView::setActualScrollPosition): (WebCore::ScrollView::platformVisibleContentRect const): (WebCore::ScrollView::platformVisibleContentSize const): (WebCore::ScrollView::legacyTileCache): (WebCore::ScrollView::platformSetContentsSize): (WebCore::ScrollView::platformSetScrollbarsSuppressed): (WebCore::ScrollView::platformSetScrollPosition): (WebCore::ScrollView::platformRepaintContentRectangle): (WebCore::ScrollView::platformContentsToScreen const): (WebCore::ScrollView::platformScreenToContents const): (WebCore::ScrollView::platformSetScrollOrigin): * platform/ios/WidgetIOS.mm: (WebCore::Widget::show): (WebCore::Widget::hide): (WebCore::Widget::frameRect const): (WebCore::Widget::setFrameRect): (WebCore::Widget::paint): (WebCore::Widget::addToSuperview): (WebCore::Widget::removeFromSuperview): (WebCore::Widget::convertFromRootToContainingWindow): (WebCore::Widget::convertFromContainingWindowToRoot): * platform/mac/CursorMac.mm: (WebCore::createCustomCursor): * platform/mac/ScrollAnimatorMac.mm: (-[WebScrollbarPartAnimation invalidate]): (-[WebScrollerImpDelegate cancelAnimations]): (-[WebScrollerImpDelegate invalidate]): (WebCore::ScrollAnimatorMac::~ScrollAnimatorMac): * platform/mac/ScrollViewMac.mm: (WebCore::ScrollView::documentView const): (WebCore::ScrollView::platformAddChild): (WebCore::ScrollView::platformSetScrollbarModes): (WebCore::ScrollView::platformScrollbarModes const): (WebCore::ScrollView::platformSetCanBlitOnScroll): (WebCore::ScrollView::platformTopContentInset const): (WebCore::ScrollView::platformSetTopContentInset): (WebCore::ScrollView::platformVisibleContentRect const): (WebCore::ScrollView::platformVisibleContentRectIncludingObscuredArea const): (WebCore::ScrollView::platformSetContentsSize): (WebCore::ScrollView::platformSetScrollbarsSuppressed): (WebCore::ScrollView::platformSetScrollPosition): (WebCore::ScrollView::platformRepaintContentRectangle): (WebCore::ScrollView::platformContentsToScreen const): (WebCore::ScrollView::platformScreenToContents const): (WebCore::ScrollView::platformSetScrollOrigin): * platform/mac/ScrollbarThemeMac.mm: (WebCore::ScrollbarThemeMac::scrollbarThickness): (WebCore::ScrollbarThemeMac::updateScrollbarOverlayStyle): (WebCore::ScrollbarThemeMac::minimumThumbLength): (WebCore::ScrollbarThemeMac::updateEnabledState): (WebCore::ScrollbarThemeMac::setPaintCharacteristicsForScrollbar): (WebCore::scrollerImpPaint): (WebCore::linenBackgroundColor): * platform/mac/WidgetMac.mm: (WebCore::Widget::setFocus): (WebCore::Widget::show): (WebCore::Widget::hide): (WebCore::Widget::frameRect const): (WebCore::Widget::setFrameRect): (WebCore::Widget::paint): (WebCore::Widget::setIsSelected): (WebCore::Widget::removeFromSuperview): (WebCore::Widget::convertFromRootToContainingWindow): (WebCore::Widget::convertFromContainingWindowToRoot): * platform/network/cocoa/NetworkStorageSessionCocoa.mm: (WebCore::NetworkStorageSession::setCookie): (WebCore::NetworkStorageSession::setCookies): (WebCore::NetworkStorageSession::setAllCookiesToSameSiteStrict): (WebCore::NetworkStorageSession::cookiesForSession const): (WebCore::NetworkStorageSession::setCookiesFromDOM const): (WebCore::NetworkStorageSession::cookieAcceptPolicy const): (WebCore::NetworkStorageSession::getRawCookies const): (WebCore::NetworkStorageSession::deleteCookie const): (WebCore::NetworkStorageSession::getHostnamesWithCookies): (WebCore::NetworkStorageSession::deleteCookiesForHostnames): * platform/network/mac/ResourceErrorMac.mm: (WebCore::ResourceError::platformLazyInit): * platform/network/mac/ResourceHandleMac.mm: (WebCore::ResourceHandle::start): * rendering/RenderThemeCocoa.mm: (WebCore::RenderThemeCocoa::mediaControlsFormattedStringForDuration): 2020-07-06 Chris Fleizach <cfleizach@apple.com> AX: Add ability for AX objects to output html in debug https://bugs.webkit.org/show_bug.cgi?id=214020 Reviewed by Darin Adler. * accessibility/mac/WebAccessibilityObjectWrapperBase.mm: (-[WebAccessibilityObjectWrapperBase innerHTML]): (-[WebAccessibilityObjectWrapperBase outerHTML]): 2020-07-06 Brady Eidson <beidson@apple.com> Get rid of concept of "initial connected gamepads" https://bugs.webkit.org/show_bug.cgi?id=214010 Reviewed by Tim Horton. No new tests (Refactor, no behavior change) When a page starts using gamepads and some were already connected, this concept was meant to manage when the already-connected gamepads could be revealed to the page. It obviously wasn't needed, as only the HID provider used them (GameController provider didn't) Instead, we should just always include a "does this event make gamepads visible?" bit. This cleans up a lot of weird code gets both providers working closer to each other. * Modules/gamepad/GamepadManager.cpp: (WebCore::GamepadManager::platformGamepadConnected): (WebCore::GamepadManager::platformGamepadInputActivity): * Modules/gamepad/GamepadManager.h: * platform/gamepad/GamepadProvider.cpp: (WebCore::GamepadProvider::dispatchPlatformGamepadInputActivity): * platform/gamepad/GamepadProviderClient.h: (WebCore::GamepadProviderClient::setInitialConnectedGamepads): Deleted. * platform/gamepad/cocoa/GameControllerGamepadProvider.mm: (WebCore::GameControllerGamepadProvider::controllerDidConnect): (WebCore::GameControllerGamepadProvider::makeInvisibileGamepadsVisible): * platform/gamepad/mac/HIDGamepadProvider.cpp: (WebCore::HIDGamepadProvider::HIDGamepadProvider): (WebCore::HIDGamepadProvider::initialGamepadsConnectedTimerFired): (WebCore::HIDGamepadProvider::openAndScheduleManager): (WebCore::HIDGamepadProvider::closeAndUnscheduleManager): (WebCore::HIDGamepadProvider::deviceAdded): (WebCore::HIDGamepadProvider::deviceRemoved): (WebCore::HIDGamepadProvider::inputNotificationTimerFired): (WebCore::HIDGamepadProvider::connectionDelayTimerFired): Deleted. * platform/gamepad/mac/HIDGamepadProvider.h: * testing/MockGamepadProvider.cpp: (WebCore::MockGamepadProvider::connectMockGamepad): 2020-07-06 Wenson Hsieh <wenson_hsieh@apple.com> Web process sometimes crashes when translating an article on spiegel.de https://bugs.webkit.org/show_bug.cgi?id=214014 <rdar://problem/65099253> Reviewed by Tim Horton. The crash happens because we try to make a BoundaryPoint (using `makeBoundaryPoint`) out of an orphaned `Position` that is anchored before or after the anchor node (more specifically, either `PositionIsBeforeAnchor` or `PositionIsAfterAnchor`). In `makeBoundaryPoint`, we'll avoid the early `WTF::nullopt` return since the position is non-null, but then try to access the container node, which is null in this case because the anchor node has been unparented. Fix this by not attempting to observe orphaned DOM positions when extracting content for translation. Test: TextManipulation.StartTextManipulationAvoidCrashWhenExtractingOrphanedPositions * editing/TextManipulationController.cpp: (WebCore::TextManipulationController::observeParagraphs): 2020-07-06 John Wilander <wilander@apple.com> Follow-up to r263992: Make isKinjaLoginAvatarElement() a free function https://bugs.webkit.org/show_bug.cgi?id=214015 <rdar://problem/65153632> Unreviewed follow-up to a quirk. Just changing isKinjaLoginAvatarElement() from member to free function. As requested in https://bugs.webkit.org/show_bug.cgi?id=213910#c10. * page/Quirks.cpp: (WebCore::isKinjaLoginAvatarElement): (WebCore::Quirks::isKinjaLoginAvatarElement const): Deleted. * page/Quirks.h: 2020-07-06 Chris Fleizach <cfleizach@apple.com> AX: Implement user action spec for Escape action https://bugs.webkit.org/show_bug.cgi?id=213875 <rdar://problem/65022980> Reviewed by Darin Adler. Implement the Escape action for the user action events. https://github.com/WICG/aom/blob/gh-pages/explainer.md#user-action-events-from-assistive-technology Test: accessibility/keyevents-posted-for-dismiss-action.html * accessibility/AccessibilityNodeObject.cpp: (WebCore::AccessibilityNodeObject::performEscape): (WebCore::AccessibilityNodeObject::dispatchSimulatedKeyboardUpDownEvent): (WebCore::AccessibilityNodeObject::postKeyboardKeysForValueChange): * accessibility/AccessibilityNodeObject.h: * accessibility/AccessibilityObject.h: * accessibility/AccessibilityObjectInterface.h: * accessibility/ios/WebAccessibilityObjectWrapperIOS.mm: (-[WebAccessibilityObjectWrapper accessibilityPerformEscape]): * accessibility/isolatedtree/AXIsolatedObject.cpp: (WebCore::AXIsolatedObject::performEscape): * accessibility/isolatedtree/AXIsolatedObject.h: * accessibility/mac/WebAccessibilityObjectWrapperMac.mm: (-[WebAccessibilityObjectWrapper accessibilityPerformAction:]): 2020-07-06 James Darpinian <jdarpinian@chromium.org> Fix transform feedback tests https://bugs.webkit.org/show_bug.cgi?id=213906 Reviewed by Dean Jackson. Fix transform feedback conformance tests by implementing missing functionality such as: - Transform feedback object state tracking - Validation for all GL errors that can affect state tracking before calling ANGLE - Default transform feedback object - Pause/resume - Fix vertexAttribDivisor in WebGL 2 (unrelated to transform feedback) After this, all related tests pass except for a few that also fail in Chrome, and one that uses PIXEL_PACK_BUFFER which is not yet supported. * html/canvas/WebGL2RenderingContext.cpp: (WebCore::WebGL2RenderingContext::~WebGL2RenderingContext): (WebCore::WebGL2RenderingContext::initializeNewContext): (WebCore::WebGL2RenderingContext::deleteTransformFeedback): (WebCore::WebGL2RenderingContext::bindTransformFeedback): (WebCore::ValidateTransformFeedbackPrimitiveMode): (WebCore::WebGL2RenderingContext::beginTransformFeedback): (WebCore::WebGL2RenderingContext::endTransformFeedback): (WebCore::WebGL2RenderingContext::transformFeedbackVaryings): (WebCore::WebGL2RenderingContext::pauseTransformFeedback): (WebCore::WebGL2RenderingContext::resumeTransformFeedback): (WebCore::WebGL2RenderingContext::setIndexedBufferBinding): (WebCore::WebGL2RenderingContext::getIndexedParameter): (WebCore::WebGL2RenderingContext::getMaxTransformFeedbackSeparateAttribs): (WebCore::WebGL2RenderingContext::getParameter): (WebCore::WebGL2RenderingContext::uncacheDeletedBuffer): * html/canvas/WebGL2RenderingContext.h: * html/canvas/WebGLProgram.cpp: (WebCore::WebGLProgram::cacheInfoIfNeeded): * html/canvas/WebGLProgram.h: * html/canvas/WebGLTransformFeedback.cpp: (WebCore::WebGLTransformFeedback::create): (WebCore::WebGLTransformFeedback::WebGLTransformFeedback): (WebCore::WebGLTransformFeedback::setProgram): (WebCore::WebGLTransformFeedback::setBoundIndexedTransformFeedbackBuffer): (WebCore::WebGLTransformFeedback::getBoundIndexedTransformFeedbackBuffer): (WebCore::WebGLTransformFeedback::hasEnoughBuffers const): (WebCore::WebGLTransformFeedback::usesBuffer): (WebCore::WebGLTransformFeedback::unbindBuffer): (WebCore::WebGLTransformFeedback::validateProgramForResume const): * html/canvas/WebGLTransformFeedback.h: * platform/graphics/angle/GraphicsContextGLANGLE.cpp: (WebCore::GraphicsContextGLOpenGL::vertexAttribDivisor): 2020-07-06 Myles C. Maxfield <mmaxfield@apple.com> Locale-specific quotes infrastructure needs to compare locale strings properly https://bugs.webkit.org/show_bug.cgi?id=213827 Reviewed by Darin Adler. Before this patch, WebKit is selecting which quotes to display on <q> elements by doing a raw strcmp() on the locale string with a big table of locale strings. strcmp() is the wrong way to compare locale strings. The HTML spec has a list of locales and their associated quotes[1]. It is formulated in terms of CSS using the "lang()" pseudoclass. The spec of the lang() pseudoclass[2] describes that locale comparison needs to be done according to section 3.3.2 in RFC4647[3]. This algorithm is a pretty general algorithm, and implementing it naively would mean turning our O(log(n)) algorithm into a O(n) algorithm, which would be unfortunate. Instead, we can use a few observations about the set of locale strings we are comparing against, in order to preserve the O(log(n)) runtime: - All the locales have either 1 or 2 subtags - None of the subtags in any of the ranges are wildcards - The list is sorted, so a locale string that is a prefix of another one is listed before it. [1] https://html.spec.whatwg.org/multipage/rendering.html#quotes [2] https://drafts.csswg.org/selectors-4/#the-lang-pseudo [3] https://tools.ietf.org/html/rfc4647#page-10 Test: fast/css-generated-content/quotes-lang-2.html * WebCore.xcodeproj/xcshareddata/xcschemes/WebCore.xcscheme: * rendering/RenderQuote.cpp: (WebCore::subtagCompare): (WebCore::quoteTableLanguageComparisonFunction): (WebCore::quotesForLanguage): (WebCore::RenderQuote::computeText const): 2020-07-06 Daniel Bates <dabates@apple.com> [iOS] WAKWindow should override -resignFirstResponder and clear state https://bugs.webkit.org/show_bug.cgi?id=214011 <rdar://problem/65152410> Reviewed by Tim Horton. This is part of the fix for <rdar://problem/62615273>. Override -resignFirstResponder to clear out internal state that tracks the first responder in the iOS Legacy WebKit world. * platform/ios/wak/WAKWindow.mm: (-[WAKWindow resignFirstResponder]): 2020-07-06 Sam Weinig <weinig@apple.com> REGRESSION: (r263977): [ iOS Debug WK2 ] 36 fast form and web-platform test consistently crashing https://bugs.webkit.org/show_bug.cgi?id=214009 <rdar://problem/65151752> * rendering/RenderTheme.cpp: (WebCore::RenderTheme::weekInputStyleSheet const): Replace ""_s with emptyString() to fix crashing tests. 2020-07-06 John Wilander <wilander@apple.com> Storage Access API: Add the capability to open a popup and get user interaction so we can call the Storage Access API as a quirk, on behalf of websites that should be doing it themselves https://bugs.webkit.org/show_bug.cgi?id=213910 <rdar://problem/65058017> Reviewed by Darin Adler. This patch not only adds the capability but also adds a site-specific quirk for the family of Kinja sites so that no previous user interaction with kinja.com results in a login popup for kinja.com. No new tests. This is for site-specific quirks. * dom/Element.cpp: (WebCore::Element::dispatchMouseEvent): Just a change in the call into the quirk function. * page/Quirks.cpp: (WebCore::Quirks::isKinjaLoginAvatarElement const): Convenience function for telling if the given element is the Kinja login avatar. (WebCore::Quirks::triggerOptionalStorageAccessQuirk const): Now takes the whole Element to be able to look at both classes and attributes. * page/Quirks.h: 2020-07-06 Peng Liu <peng.liu6@apple.com> Cleanup WebVideoFullscreenControllerAVKit.mm and PlaybackSessionInterfaceAVKit.mm https://bugs.webkit.org/show_bug.cgi?id=214005 Reviewed by Daniel Bates. No new tests, no behavior change. * platform/ios/PlaybackSessionInterfaceAVKit.mm: * platform/ios/WebVideoFullscreenControllerAVKit.mm: (VideoFullscreenControllerContext::setUpFullscreen): Remove a redundant line. 2020-07-06 Clark Wang <clark_wang@apple.com> Added PannerNode constructor according to spec https://bugs.webkit.org/show_bug.cgi?id=213801 Reviewed by Chris Dumez. Added in new PannerNode constructor to match spec: https://www.w3.org/TR/webaudio/#dom-pannernode-pannernode. Added in AudioNodeOptions and PannerOptions files. Modified some previous code in order to pass compilation. Re-baselined existing tests now that new ones are passing. New ones that fail are due to accepted range of values that attributes can take on, which are to be implemented in a future patch. * CMakeLists.txt: * DerivedSources-input.xcfilelist: * DerivedSources-output.xcfilelist: * DerivedSources.make: * Modules/webaudio/AudioDestinationNode.h: * Modules/webaudio/AudioNode.cpp: (WebCore::AudioNode::AudioNode): * Modules/webaudio/AudioNode.h: * Modules/webaudio/AudioNodeOptions.h: Added. * Modules/webaudio/AudioNodeOptions.idl: Added. * Modules/webaudio/PannerNode.cpp: (WebCore::PannerNode::PannerNode): (WebCore::PannerNodeBase::PannerNodeBase): (WebCore::PannerNode::create): * Modules/webaudio/PannerNode.h: * Modules/webaudio/PannerNode.idl: * Modules/webaudio/PannerOptions.h: Added. * Modules/webaudio/PannerOptions.idl: Added. * Sources.txt: * WebCore.xcodeproj/project.pbxproj: 2020-07-06 Simon Fraser <simon.fraser@apple.com> ASSERT_NOT_REACHED() in EventRegionContext::popClip() https://bugs.webkit.org/show_bug.cgi?id=213905 Reviewed by Daniel Bates. Fix an assertion seen on bing.com, tesla.com etc where event region painting would have mismatched push/pop because of an obvious code error. I spent too long trying to make a testcase and gave up. * rendering/RenderLayer.cpp: (WebCore::RenderLayer::restoreClip): 2020-07-06 Sam Weinig <weinig@apple.com> Compile-time enable (but leave disabled at runtime by default) date/time input types on macOS to allow testing of cross platform (e.g. DOM) aspects of the controls https://bugs.webkit.org/show_bug.cgi?id=213949 Reviewed by Darin Adler. Enable date/time related input element types on all Cocoa platforms, but disable them at runtime. To make runtime disabling work completely, the user agent style for these element types was extracted from html.css and is now only added when needed via UserAgentStyle::ensureDefaultStyleSheetsForElement. This is the first step to allowing us to run a subset of the date/time related input element tests on more platforms. If this is successful, we should consider do this for all platforms, not just Cocoa. * css/html.css: Move to RenderTheme accessors for conditional inclusion based on Settings. * html/HTMLInputElement.cpp: (WebCore::HTMLInputElement::isDateTimeField const): Deleted. * html/HTMLInputElement.h: Removed dead isDateTimeField() code. This should have been removed when datetime was removed. * html/InputType.cpp: (WebCore::createInputTypeFactoryMap): (WebCore::InputType::create): Switch from using RuntimeEnabledFeatures to Settings for checking for enabling (Settings allows us to write less boilerplate code and is more versatile for testing) and switch to checking the condition on each InputType construction, rather than just on map's creation (again, this allows us to have more flexibility in testing). * page/RuntimeEnabledFeatures.h: (WebCore::RuntimeEnabledFeatures::inputTypeColorEnabled const): Deleted. (WebCore::RuntimeEnabledFeatures::setInputTypeColorEnabled): Deleted. (WebCore::RuntimeEnabledFeatures::inputTypeDateEnabled const): Deleted. (WebCore::RuntimeEnabledFeatures::setInputTypeDateEnabled): Deleted. (WebCore::RuntimeEnabledFeatures::inputTypeDateTimeLocalEnabled const): Deleted. (WebCore::RuntimeEnabledFeatures::setInputTypeDateTimeLocalEnabled): Deleted. (WebCore::RuntimeEnabledFeatures::inputTypeMonthEnabled const): Deleted. (WebCore::RuntimeEnabledFeatures::setInputTypeMonthEnabled): Deleted. (WebCore::RuntimeEnabledFeatures::inputTypeTimeEnabled const): Deleted. (WebCore::RuntimeEnabledFeatures::setInputTypeTimeEnabled): Deleted. (WebCore::RuntimeEnabledFeatures::inputTypeWeekEnabled const): Deleted. (WebCore::RuntimeEnabledFeatures::setInputTypeWeekEnabled): Deleted. Remove hand written code infavor of code genreated from Settings.yaml. * page/Settings.yaml: Moved from RuntimeEnabledFeatures. * platform/LocalizedStrings.h: Remove weekFormatInLDML() declaration, which had not implementation. * platform/text/PlatformLocale.cpp: (WebCore::Locale::formatDateTime): * platform/text/PlatformLocale.h: Simplify code by marking formatDateTime() virtual on all platforms and un-#ifdefing the base implementation. Platforms that wish to override it still can. * platform/text/cocoa/LocaleCocoa.h: * platform/text/cocoa/LocaleCocoa.mm: * platform/text/ios/LocalizedDateCache.h: * platform/text/ios/LocalizedDateCache.mm: Remove iOS specific #ifdefs around code that should work on all Cocoa platforms. * rendering/RenderTheme.cpp: (WebCore::RenderTheme::colorInputStyleSheet const): (WebCore::RenderTheme::dateInputStyleSheet const): (WebCore::RenderTheme::dateTimeLocalInputStyleSheet const): (WebCore::RenderTheme::monthInputStyleSheet const): (WebCore::RenderTheme::timeInputStyleSheet const): (WebCore::RenderTheme::weekInputStyleSheet const): * rendering/RenderTheme.h: Add default user agent stylesheet strings for input types. All moved from html.css. * style/UserAgentStyle.cpp: (WebCore::Style::UserAgentStyle::ensureDefaultStyleSheetsForElement): * style/UserAgentStyle.h: Conditionally add the input type specific user agent stylesheets only if the actual input type is being passed in. Since creation of the input types is guarded by a Setting, this can only happen if the type has been enabled. 2020-07-06 Rob Buis <rbuis@igalia.com> Allow setting empty host/hostname on URLs if they use file scheme https://bugs.webkit.org/show_bug.cgi?id=213983 Reviewed by Alex Christensen. Allow setting empty host/hostname on URLs if they use file scheme [1, 2, 3]. Behavior matches Firefox. [1] https://url.spec.whatwg.org/#dom-url-host [2] https://url.spec.whatwg.org/#dom-url-hostname [3] https://url.spec.whatwg.org/#host-state Step 1 Test: imported/w3c/web-platform-tests/url/url-setters.html * html/URLDecomposition.cpp: (WebCore::URLDecomposition::setHost): (WebCore::URLDecomposition::setHostname): 2020-07-06 Matt Gilligan <matthew_gilligan@apple.com> Update the user agent on iPadOS to use 11 to match macOS Safari https://bugs.webkit.org/show_bug.cgi?id=213753 Reviewed by Alex Christensen. Update the version number in the desktop user agent string to 11_0. * platform/ios/UserAgentIOS.mm: (WebCore::standardUserAgentWithApplicationName): 2020-07-06 Daniel Bates <dabates@apple.com> Use RenderObject::positionForPoint instead of hit testing the entire view in closestEditablePositionInElementForAbsolutePoint https://bugs.webkit.org/show_bug.cgi?id=213975 Reviewed by Wenson Hsieh. The target renderer is known a priori so it is more efficient to hit test this directly instead of indirectly by hit testing the entire view. * editing/Editing.cpp: (WebCore::closestEditablePositionInElementForAbsolutePoint): 2020-07-06 Carlos Garcia Campos <cgarcia@igalia.com> [GTK][WPE] Change the cookies accept policy when ITP is enabled https://bugs.webkit.org/show_bug.cgi?id=213502 Reviewed by Michael Catanzaro. Set the accept policy to always when ITP is enabled and no-third-party is set, otherwise cookies access granted by request storage access would still be rejected by libsoup if policy is set to no-third-party. * platform/network/NetworkStorageSession.cpp: (WebCore::NetworkStorageSession::setResourceLoadStatisticsEnabled): Move here the implementation for ports not using soup. * platform/network/NetworkStorageSession.h: * platform/network/soup/NetworkStorageSessionSoup.cpp: (WebCore::NetworkStorageSession::NetworkStorageSession): Initialize cookie accept policy. (WebCore::NetworkStorageSession::setCookieStorage): Set here the accept policy of the new jar. (WebCore::NetworkStorageSession::setCookieAcceptPolicy): Set the cookie accept policy taking into account that if ITP is enabled and no-third-party is set we save the policy but use always instead. (WebCore::NetworkStorageSession::cookieAcceptPolicy const): Remove the default case of the switch. (WebCore::NetworkStorageSession::setResourceLoadStatisticsEnabled): When enabled, save current policy and set always if no-third-party is set. When disabled, restore the saved policy. 2020-07-06 Alicia Boya García <aboya@igalia.com> [MSE][GStreamer] Don't skip samples past media duration in AppendPipeline https://bugs.webkit.org/show_bug.cgi?id=213888 Reviewed by Xabier Rodriguez-Calvar. appsinkNewSample() contained code to skip samples whose presentation time starts after media duration. This is paradoxical, because later sourceBufferPrivateDidReceiveSample() extends media duration whenever the presentation end time of the sample is past the original one. It does not sound reasonable that samples extending the duration are okay on one case but outright rejected in the other. Also, if it was about skipping samples, sourceBufferPrivateDidReceiveSample() could do it itself, and already does in other cases. For all these reasons I was very doubtful of the need for this if() and indeed removing this condition didn't cause any new test failure. * platform/graphics/gstreamer/mse/AppendPipeline.cpp: (WebCore::AppendPipeline::appsinkNewSample): 2020-07-05 Commit Queue <commit-queue@webkit.org> Unreviewed, reverting r263960. https://bugs.webkit.org/show_bug.cgi?id=213980 Re-land, because r263959 somehow fixed the build issue caused by r263953 Reverted changeset: "Unreviewed, reverting r263953 and r263959." https://bugs.webkit.org/show_bug.cgi?id=213979 https://trac.webkit.org/changeset/263960 2020-07-05 Commit Queue <commit-queue@webkit.org> Unreviewed, reverting r263953 and r263959. https://bugs.webkit.org/show_bug.cgi?id=213979 Broke internal build Reverted changesets: "[Cocoa] Move almost all features from FeatureDefines.xcconfig to PlatformEnableCocoa.h" https://bugs.webkit.org/show_bug.cgi?id=212542 https://trac.webkit.org/changeset/263953 "[Cocoa] Remove FEATURE_DEFINES from the Cocoa/Xcode build system" https://bugs.webkit.org/show_bug.cgi?id=213976 https://trac.webkit.org/changeset/263959 2020-07-05 Darin Adler <darin@apple.com> [Cocoa] Remove FEATURE_DEFINES from the Cocoa/Xcode build system https://bugs.webkit.org/show_bug.cgi?id=213976 Reviewed by Sam Weinig. * Configurations/FeatureDefines.xcconfig: Removed everything except for ENABLE_WEB_RTC. * Configurations/WebCore.xcconfig: Removed FEATURE_DEFINES. * DerivedSources-input.xcfilelist: Removed FeatureDefines.xcconfig. * DerivedSources.make: Removed FEATURE_DEFINES, FEATURE_DEFINE_FLAGS, and the dependency on FeatureDefines.xcconfig. 2020-07-05 Sihui Liu <sihui_liu@appe.com> Text manipulation: add a new heuristic to decide paragraph boundary https://bugs.webkit.org/show_bug.cgi?id=213918 Reviewed by Wenson Hsieh. Modified test: TextManipulation.StartTextManipulationTreatsInlineBlockLinksAndButtonsAndSpansAsParagraphs. * editing/TextManipulationController.cpp: (WebCore::isEnclosingItemBoundaryElement): 2020-07-05 Darin Adler <darin@apple.com> [Cocoa] REGRESSION (r263914): Non-Apple-Pay Cocoa builds failing https://bugs.webkit.org/show_bug.cgi?id=213977 * Modules/applepay/cocoa/PaymentMethodCocoa.mm: Fixed messed up #endif and unnecessary #undef at end of file. 2020-07-05 Andy Estes <aestes@apple.com> [iOS] La Banque Postale app does not respect safe area insets on iOS 14 https://bugs.webkit.org/show_bug.cgi?id=213974 <rdar://problem/65109197> Reviewed by Darin Adler. * platform/RuntimeApplicationChecks.h: * platform/cocoa/RuntimeApplicationChecksCocoa.mm: (WebCore::IOSApplication::isLaBanquePostale): Added. 2020-07-05 Darin Adler <darin@apple.com> [Cocoa] Move almost all features from FeatureDefines.xcconfig to PlatformEnableCocoa.h https://bugs.webkit.org/show_bug.cgi?id=212542 Reviewed by Sam Weinig. * Configurations/FeatureDefines.xcconfig: Delete everything except ENABLE_EXPERIMENTAL_FEATURES and ENABLE_WEBRTC. 2020-07-05 Wenson Hsieh <wenson_hsieh@apple.com> [macOS 11] Indeterminate progress bar animation periodically jumps https://bugs.webkit.org/show_bug.cgi?id=213967 Reviewed by Sam Weinig. The animation for an indeterminate progress bar occasionally jumps to the starting frame on macOS 11. This is because the indeterinate progress bar animation only lasts for 120 frames on macOS 11, so our current hard-coded value of 256 frames results in 16 extra frames of animation, before abruptly looping back to the starting frame. To fix this, instead of specifying the animation frame index when painting progress bars on macOS, specify the starting time and current time for the animation, and let CoreUI determine which frame to use. * rendering/RenderProgress.cpp: (WebCore::RenderProgress::animationProgress): Assert that this never gets called with a zero animation duration. (WebCore::RenderProgress::updateAnimationState): Instead of checking for the animation duration to determine whether or not we should try and animate progress bar painting, check for the animation repeat interval instead. This is because on macOS, we no longer hard-code the animation duration, but still want to be able to animate progress bars. * rendering/RenderThemeIOS.h: * rendering/RenderThemeIOS.mm: (WebCore::RenderThemeIOS::animationRepeatIntervalForProgressBar const): Deleted. (WebCore::RenderThemeIOS::animationDurationForProgressBar const): Deleted. Drive-by fix: remove some unnecessary overridden method implementations on RenderThemeIOS. * rendering/RenderThemeMac.h: * rendering/RenderThemeMac.mm: (WebCore::RenderThemeMac::paintProgressBar): (WebCore::RenderThemeMac::animationDurationForProgressBar const): Deleted. Stop overriding this method, and remove the `progressAnimationNumFrames` constant declared in this file. 2020-07-05 Said Abou-Hallawa <sabouhallawa@apple.com> [macOS] Allow selecting HEIF images if the 'accept' attribute includes an image MIME type that the platform can transcode the HEIF to https://bugs.webkit.org/show_bug.cgi?id=212489 Reviewed by Darin Adler. Add some utility functions to MIMETypeRegistry. These new functions will deal with a list of MIME types combined with a list of file extensions. They are going to be used the FileChooserSettings which reflects the 'accept' attribute of the <input> file element. * platform/MIMETypeRegistry.cpp: (WebCore::trimmedExtension): (WebCore::MIMETypeRegistry::preferredImageMIMETypeForEncoding): (WebCore::MIMETypeRegistry::containsImageMIMETypeForEncoding): (WebCore::MIMETypeRegistry::allowedMIMETypes): It returns the set of mime types which is stated by a list of mime types and a list of file extensions. (WebCore::MIMETypeRegistry::allowedFileExtensions): It returns the set of extensions which is stated by a list of mime types and a list of file extensions. * platform/MIMETypeRegistry.h: 2020-07-04 Darin Adler <darin@apple.com> [Cocoa] Remove all features from FeatureDefines.xcconfig that are already mentioned in PlatformEnableCocoa.h https://bugs.webkit.org/show_bug.cgi?id=213962 Reviewed by Sam Weinig. * Configurations/FeatureDefines.xcconfig: Removed all features that were mentioned in PlatformEnableCocoa.h; the rules in that file now define whether they are enabled. 2020-07-04 Zalan Bujtas <zalan@apple.com> [LFC][BFC] Move PositiveAndNegativeVerticalMargin to UsedVerticalMargin https://bugs.webkit.org/show_bug.cgi?id=213963 Reviewed by Antti Koivisto. Now that UsedVerticalMargin is not used in Display::Box, we can merged these 2 layout structures. * layout/MarginTypes.h: (WebCore::Layout::UsedVerticalMargin::PositiveAndNegativePair::Values::isNonZero const): (WebCore::Layout::PositiveAndNegativeVerticalMargin::Values::isNonZero const): Deleted. * layout/blockformatting/BlockFormattingContext.cpp: (WebCore::Layout::BlockFormattingContext::precomputeVerticalPositionForBoxAndAncestors): (WebCore::Layout::BlockFormattingContext::computeHeightAndMargin): * layout/blockformatting/BlockFormattingContext.h: * layout/blockformatting/BlockFormattingState.h: (WebCore::Layout::BlockFormattingState::hasUsedVerticalMargin const): (WebCore::Layout::BlockFormattingState::setPositiveAndNegativeVerticalMargin): Deleted. (WebCore::Layout::BlockFormattingState::hasPositiveAndNegativeVerticalMargin const): Deleted. (WebCore::Layout::BlockFormattingState::positiveAndNegativeVerticalMargin const): Deleted. * layout/blockformatting/BlockMarginCollapse.cpp: (WebCore::Layout::BlockFormattingContext::MarginCollapse::computedPositiveAndNegativeMargin const): (WebCore::Layout::BlockFormattingContext::MarginCollapse::marginValue const): (WebCore::Layout::BlockFormattingContext::MarginCollapse::updateMarginAfterForPreviousSibling): (WebCore::Layout::BlockFormattingContext::MarginCollapse::positiveNegativeValues const): (WebCore::Layout::BlockFormattingContext::MarginCollapse::positiveNegativeMarginBefore const): (WebCore::Layout::BlockFormattingContext::MarginCollapse::positiveNegativeMarginAfter const): (WebCore::Layout::BlockFormattingContext::MarginCollapse::collapsedVerticalValues): * layout/blockformatting/PrecomputedBlockMarginCollapse.cpp: (WebCore::Layout::BlockFormattingContext::MarginCollapse::precomputedPositiveNegativeValues const): (WebCore::Layout::BlockFormattingContext::MarginCollapse::precomputedPositiveNegativeMarginBefore const): * layout/blockformatting/tablewrapper/TableWrapperBlockFormattingContext.cpp: (WebCore::Layout::TableWrapperBlockFormattingContext::computeHeightAndMarginForTableBox): 2020-07-04 Zalan Bujtas <zalan@apple.com> [LFC][BFC] Remove redundant out-of-flow height-and-margin handling https://bugs.webkit.org/show_bug.cgi?id=213959 Reviewed by Antti Koivisto. We will never end up here with an out-of-flow box. * layout/blockformatting/BlockFormattingContext.cpp: (WebCore::Layout::BlockFormattingContext::computeHeightAndMargin): 2020-07-04 Zalan Bujtas <zalan@apple.com> [LFC][BFC] Store used vertical margin values in the formatting state https://bugs.webkit.org/show_bug.cgi?id=213958 Reviewed by Antti Koivisto. Layout related vertical margin values (collapsed vs. non-collapsed) should all go to the FormattingState, while Display::Box should only have the final values. * layout/FormattingContext.cpp: (WebCore::Layout::FormattingContext::computeOutOfFlowVerticalGeometry): * layout/FormattingContextGeometry.cpp: (WebCore::Layout::FormattingContext::Geometry::staticVerticalPositionForOutOfFlowPositioned const): * layout/MarginTypes.h: (WebCore::Layout::marginBefore): (WebCore::Layout::marginAfter): (WebCore::Layout::UsedVerticalMargin::before const): Deleted. (WebCore::Layout::UsedVerticalMargin::after const): Deleted. (WebCore::Layout::UsedVerticalMargin::isCollapsedThrough const): Deleted. (WebCore::Layout::UsedVerticalMargin::nonCollapsedValues const): Deleted. (WebCore::Layout::UsedVerticalMargin::collapsedValues const): Deleted. (WebCore::Layout::UsedVerticalMargin::hasCollapsedValues const): Deleted. (WebCore::Layout::UsedVerticalMargin::setCollapsedValues): Deleted. (WebCore::Layout::UsedVerticalMargin::UsedVerticalMargin): Deleted. * layout/Verification.cpp: (WebCore::Layout::outputMismatchingBlockBoxInformationIfNeeded): * layout/blockformatting/BlockFormattingContext.cpp: (WebCore::Layout::BlockFormattingContext::precomputeVerticalPositionForBoxAndAncestors): (WebCore::Layout::BlockFormattingContext::computeHeightAndMargin): (WebCore::Layout::BlockFormattingContext::verticalPositionWithMargin const): * layout/blockformatting/BlockFormattingContextGeometry.cpp: (WebCore::Layout::BlockFormattingContext::Geometry::inFlowNonReplacedHeightAndMargin): * layout/blockformatting/BlockFormattingState.h: (WebCore::Layout::BlockFormattingState::setUsedVerticalMargin): (WebCore::Layout::BlockFormattingState::usedVerticalMargin const): * layout/blockformatting/BlockMarginCollapse.cpp: (WebCore::Layout::BlockFormattingContext::MarginCollapse::updateMarginAfterForPreviousSibling): * layout/blockformatting/tablewrapper/TableWrapperBlockFormattingContext.cpp: (WebCore::Layout::TableWrapperBlockFormattingContext::computeHeightAndMarginForTableBox): * layout/displaytree/DisplayBox.cpp: (WebCore::Display::Box::Box): (WebCore::Display::Box::nonCollapsedMarginBox const): Deleted. * layout/displaytree/DisplayBox.h: (WebCore::Display::Box::rectWithMargin const): (WebCore::Display::Box::setHasValidVerticalMargin): (WebCore::Display::Box::setVerticalMargin): (WebCore::Display::Box::marginBefore const): (WebCore::Display::Box::marginAfter const): (WebCore::Display::Box::VerticalMargin::before const): Deleted. (WebCore::Display::Box::VerticalMargin::after const): Deleted. (WebCore::Display::Box::VerticalMargin::isCollapsedThrough const): Deleted. (WebCore::Display::Box::VerticalMargin::nonCollapsedValues const): Deleted. (WebCore::Display::Box::VerticalMargin::collapsedValues const): Deleted. (WebCore::Display::Box::VerticalMargin::hasCollapsedValues const): Deleted. (WebCore::Display::Box::VerticalMargin::setCollapsedValues): Deleted. (WebCore::Display::Box::hasCollapsedThroughMargin const): Deleted. (WebCore::Display::Box::setHasValidVerticalNonCollapsedMargin): Deleted. (WebCore::Display::Box::VerticalMargin::VerticalMargin): Deleted. (WebCore::Display::Box::VerticalMargin::NonCollapsedValues::NonCollapsedValues): Deleted. (WebCore::Display::Box::VerticalMargin::CollapsedValues::CollapsedValues): Deleted. (WebCore::Display::Box::nonCollapsedMarginBefore const): Deleted. (WebCore::Display::Box::nonCollapsedMarginAfter const): Deleted. * layout/floats/FloatingContext.cpp: (WebCore::Layout::FloatingContext::verticalPositionWithClearance const): * layout/inlineformatting/InlineFormattingContext.cpp: (WebCore::Layout::InlineFormattingContext::layoutInFlowContent): (WebCore::Layout::InlineFormattingContext::computeHeightAndMargin): * layout/tableformatting/TableFormattingContext.cpp: (WebCore::Layout::TableFormattingContext::setUsedGeometryForRows): (WebCore::Layout::TableFormattingContext::setUsedGeometryForSections): (WebCore::Layout::TableFormattingContext::layoutCell): 2020-07-04 Darin Adler <darin@apple.com> [Cocoa] Remove unconditional features from FeatureDefines.xcconfig, making sure they are covered in PlatformEnableCocoa.h https://bugs.webkit.org/show_bug.cgi?id=212418 Reviewed by Sam Weinig. * Configurations/FeatureDefines.xcconfig: Removed features that are either unconditionally not enabled, or unconditionally enabled. Double checked that all the enabled ones are either in PlatformEnable.h or PlatformEnableCocoa.h. 2020-07-04 Sam Weinig <weinig@apple.com> Part 1 of SimpleColor and SRGBA<uint8_t> are essentially the same - let's converge them https://bugs.webkit.org/show_bug.cgi?id=213948 Reviewed by Darin Adler. Begin converging SimpleColor and SRGBA<uint8_t>, starting with removing usages that were getting SimpleColors to access or operate on the color's components. - Replace toSRGBASimpleColorLossy() with toSRGBALossy<uint8_t> - Replace toSRGBALossy() with toSRGBALossy<float>(). - Remove direct color component accessors from SimpleColor. - Add new ARGB type to support explicit conversion from packed ARGB bits to a color type. - Update premulitplication functions to operate on SRGBA<uint8_t> and rename them to match existing function operating on SRGBA<float>. * Sources.txt: * WebCore.xcodeproj/project.pbxproj: Removes SimpleColor.cpp * accessibility/AccessibilityNodeObject.cpp: (WebCore::AccessibilityNodeObject::colorValue const): Replace toSRGBASimpleColorLossy() with toSRGBALossy<uint8_t>. * accessibility/atk/WebKitAccessibleInterfaceText.cpp: (getAttributeSetForAccessibilityObject): Replace toSRGBASimpleColorLossy() with toSRGBALossy<uint8_t>. * accessibility/isolatedtree/AXIsolatedObject.cpp: (WebCore::AXIsolatedObject::colorValue const): Replace toSRGBASimpleColorLossy() with toSRGBALossy<uint8_t>. * css/DeprecatedCSSOMRGBColor.h: Replace toSRGBASimpleColorLossy() with toSRGBALossy<uint8_t>. * editing/cocoa/DataDetection.mm: (WebCore::DataDetection::detectContentInRange): Replace toSRGBALossy() with toSRGBALossy<float>(). * platform/graphics/Color.cpp: (WebCore::Color::lightened const): (WebCore::Color::darkened const): (WebCore::Color::lightness const): (WebCore::Color::luminance const): (WebCore::Color::semanticColor const): (WebCore::Color::toSRGBASimpleColorLossy const): Deleted. (WebCore::Color::toSRGBALossy const): Deleted. * platform/graphics/Color.h: Remove toSRGBASimpleColorLossy() and templatize toSRGBALossy() to support both lossy conversion to byte based components as well. * platform/graphics/ColorBlending.cpp: (WebCore::blendSourceOver): (WebCore::blendWithWhite): Replace toSRGBASimpleColorLossy() with toSRGBALossy<uint8_t>. (WebCore::blend): (WebCore::blendWithoutPremultiply): Replace toSRGBASimpleColorLossy() with toSRGBALossy<uint8_t>. Adopt new premultipliedCeiling and unpremultiplied functions that operate on SRGBA<uint8_t> (rather than SimpleColor) and clamping conversion to SRGBA<uint8_t> via convertToComponentBytes<SRGBA>. premultipliedCeiling now works correctly for 0 alpha, so no workaround is needed anymore. * platform/graphics/ColorTypes.h: (WebCore::asARGB): (WebCore::asSRGBA): Add new type of color struct representing a format packing. The initial one is ARGB to support the few places using SimpleColor to manipulate ARGB pixel data. * platform/graphics/ColorUtilities.cpp: (WebCore::unpremultiplied): (WebCore::premultipliedFlooring): (WebCore::premultipliedCeiling): (WebCore::unpremultipliedComponentByte): * platform/graphics/ColorUtilities.h: (WebCore::convertToComponentBytes): (WebCore::convertToComponentFloats): Move remaining premultiplication functions here (from SimpleColor.h/cpp) and reimplement to operate on SRGBA<uint8_t>. Also slightly rename, premultiply -> premultiplied, to match existing premultiplied functions. While moving them, also fix the premultiplied functions to better support 0 alpha to avoid workarounds in callers. Additional, this adds convertToComponentBytes/convertToComponentFloats helper functions which convert to/from uint8_t/float based color types, and support creating color types from values potentially outside of their supported value range. Right now, that value range is always considerer to be 0-255 for uint8_t and 0-1 for float, but that can be chnaged in the future by allowing color type structs to indicate their supported ranges. * platform/graphics/ExtendedColor.cpp: (WebCore::ExtendedColor::toSRGBAFloatComponentsLossy const): (WebCore::ExtendedColor::toSRGBALossy const): Deleted. * platform/graphics/ExtendedColor.h: (WebCore::ExtendedColor::toSRGBALossy const): Rename existing toSRGBALossy() to toSRGBAFloatComponentsLossy() and replace templatize toSRGBALossy(), with the uint8_t case just down converting via new convertToComponentBytes. * platform/graphics/ImageBackingStore.h: (WebCore::ImageBackingStore::fillRect): (WebCore::ImageBackingStore::setPixel): (WebCore::ImageBackingStore::blendPixel): (WebCore::ImageBackingStore::pixelValue const): Replace usage of SimpleColor with new ARGB type for conversion from ARGB to SRGBA<uint8_t>. Update to use new premulitplication functions. Also, update the interface to take pixel components as uint8_t, rather than unsigned, as that is what the callers are passing anyway, and it avoids us having to clamp/cast manually all over the case. * platform/graphics/SimpleColor.cpp: Removed. * platform/graphics/SimpleColor.h: (WebCore::SimpleColor::alphaComponent const): (WebCore::SimpleColor::asSRGBA const): (WebCore::SimpleColor::redComponent const): (WebCore::SimpleColor::greenComponent const): (WebCore::SimpleColor::blueComponent const): (WebCore::operator==): (WebCore::makeSimpleColor): Simplify interface, making red, green and blue component accessors private and having callers all use SRGBA directly. Remove premultiplication functions in favor of new ones in ColorUtilities. * platform/graphics/ca/cocoa/PlatformCAAnimationCocoa.mm: (WebCore::PlatformCAAnimationCocoa::setFromValue): (WebCore::PlatformCAAnimationCocoa::setToValue): (WebCore::PlatformCAAnimationCocoa::setValues): Replace toSRGBASimpleColorLossy() with toSRGBALossy<uint8_t>. * platform/graphics/ca/win/PlatformCAAnimationWin.cpp: (PlatformCAAnimationWin::setFromValue): (PlatformCAAnimationWin::setToValue): (PlatformCAAnimationWin::setValues): Replace toSRGBASimpleColorLossy() with toSRGBALossy<uint8_t>. * platform/graphics/cairo/CairoUtilities.cpp: (WebCore::setSourceRGBAFromColor): Replace toSRGBALossy() with toSRGBALossy<float>(). * platform/graphics/cairo/GradientCairo.cpp: (WebCore::addColorStopRGBA): (WebCore::setCornerColorRGBA): (WebCore::interpolateColorStop): Replace toSRGBALossy() with toSRGBALossy<float>(). * platform/graphics/cairo/ImageBufferCairoImageSurfaceBackend.cpp: (WebCore::ImageBufferCairoImageSurfaceBackend::platformTransformColorSpace): Replace usage of SimpleColor with new ARGB type for conversion from ARGB to SRGBA<uint8_t>. Update to use new premulitplication functions. * platform/graphics/cairo/NativeImageCairo.cpp: (WebCore::nativeImageSinglePixelSolidColor): Replace usage of SimpleColor with new ARGB type for conversion from ARGB to SRGBA<uint8_t>. Update to use new premulitplication functions. * platform/graphics/cpu/arm/filters/FELightingNEON.h: (WebCore::FELighting::platformApplyNeon): Replace toSRGBASimpleColorLossy() with toSRGBALossy<uint8_t>. * platform/graphics/filters/FELighting.cpp: (WebCore::FELighting::drawLighting): Replace toSRGBALossy() with toSRGBALossy<float>(). * platform/graphics/filters/FilterOperations.cpp: (WebCore::FilterOperations::transformColor const): (WebCore::FilterOperations::inverseTransformColor const): Replace toSRGBALossy() with toSRGBALossy<float>(). * platform/graphics/gtk/ColorGtk.cpp: (WebCore::Color::operator GdkRGBA const): Replace toSRGBALossy() with toSRGBALossy<float>(). * platform/graphics/texmap/TextureMapperGL.cpp: (WebCore::TextureMapperGL::drawBorder): (WebCore::TextureMapperGL::drawNumber): (WebCore::prepareFilterProgram): (WebCore::TextureMapperGL::drawSolidColor): (WebCore::TextureMapperGL::clearColor): Replace toSRGBALossy() with toSRGBALossy<float>(). * platform/graphics/win/ColorDirect2D.cpp: (WebCore::Color::operator D2D1_COLOR_F const): (WebCore::Color::operator D2D1_VECTOR_4F const): Replace toSRGBALossy() with toSRGBALossy<float>(). * platform/graphics/win/GradientDirect2D.cpp: (WebCore::Gradient::generateGradient): Replace toSRGBALossy() with toSRGBALossy<float>(). * platform/graphics/win/GraphicsContextCGWin.cpp: (WebCore::GraphicsContext::drawDotsForDocumentMarker): Replace direct usage component access from SimpleColor with usage of accessed SRGBA<uint8_t>. * platform/graphics/win/GraphicsContextDirect2D.cpp: (WebCore::GraphicsContext::colorWithGlobalAlpha const): Replace toSRGBALossy() with toSRGBALossy<float>(). * rendering/RenderTheme.cpp: (WebCore::RenderTheme::disabledTextColor const): Replace toSRGBALossy() with toSRGBALossy<float>(). * rendering/RenderThemeIOS.mm: (WebCore::shouldUseConvexGradient): Replace toSRGBALossy() with toSRGBALossy<float>(). * rendering/TextPaintStyle.cpp: (WebCore::textColorIsLegibleAgainstBackgroundColor): Replace toSRGBALossy() with toSRGBALossy<float>(). * svg/properties/SVGAnimationAdditiveValueFunctionImpl.h: (WebCore::SVGAnimationColorFunction::animate): Replace toSRGBASimpleColorLossy() with toSRGBALossy<uint8_t>. 2020-07-04 Zalan Bujtas <zalan@apple.com> [LFC] Remove redundant Display::Box::HorizontalMargin c'tors https://bugs.webkit.org/show_bug.cgi?id=213957 Reviewed by Antti Koivisto. Let's just have a very simple Display::Box:HorizontalMargin struct. * layout/FormattingContext.cpp: (WebCore::Layout::FormattingContext::computeOutOfFlowHorizontalGeometry): * layout/blockformatting/BlockFormattingContext.cpp: (WebCore::Layout::BlockFormattingContext::computeWidthAndMargin): * layout/blockformatting/tablewrapper/TableWrapperBlockFormattingContext.cpp: (WebCore::Layout::TableWrapperBlockFormattingContext::computeWidthAndMarginForTableBox): * layout/displaytree/DisplayBox.h: (WebCore::Display::Box::HorizontalMargin::HorizontalMargin): Deleted. * layout/inlineformatting/InlineFormattingContext.cpp: (WebCore::Layout::InlineFormattingContext::computeWidthAndMargin): 2020-07-04 Zalan Bujtas <zalan@apple.com> [LFC] Do not cache computed horizontal margin values https://bugs.webkit.org/show_bug.cgi?id=213956 Reviewed by Antti Koivisto. Outside of the width + margin computation, computed horizontal margin values are only required by float positioning. Let's just re-computed them on demand (which is basically just a style.marginStart/end resolve). * layout/FormattingContext.cpp: (WebCore::Layout::FormattingContext::computeOutOfFlowHorizontalGeometry): * layout/FormattingContextGeometry.cpp: (WebCore::Layout::FormattingContext::Geometry::outOfFlowNonReplacedHorizontalGeometry): (WebCore::Layout::FormattingContext::Geometry::outOfFlowReplacedHorizontalGeometry): (WebCore::Layout::FormattingContext::Geometry::floatingNonReplacedWidthAndMargin): (WebCore::Layout::FormattingContext::Geometry::inlineReplacedWidthAndMargin): * layout/LayoutContext.cpp: (WebCore::Layout::LayoutContext::layout): * layout/LayoutUnits.h: * layout/Verification.cpp: (WebCore::Layout::outputMismatchingBlockBoxInformationIfNeeded): * layout/blockformatting/BlockFormattingContext.cpp: (WebCore::Layout::BlockFormattingContext::computePositionToAvoidFloats): (WebCore::Layout::BlockFormattingContext::computeWidthAndMargin): * layout/blockformatting/BlockFormattingContextGeometry.cpp: (WebCore::Layout::BlockFormattingContext::Geometry::inFlowNonReplacedWidthAndMargin): (WebCore::Layout::BlockFormattingContext::Geometry::inFlowReplacedWidthAndMargin): * layout/blockformatting/tablewrapper/TableWrapperBlockFormattingContext.cpp: (WebCore::Layout::TableWrapperBlockFormattingContext::computeWidthAndMarginForTableBox): * layout/displaytree/DisplayBox.cpp: (WebCore::Display::Box::Box): * layout/displaytree/DisplayBox.h: (WebCore::Display::Box::setHasValidVerticalNonCollapsedMargin): (WebCore::Display::Box::setHasValidHorizontalComputedMargin): Deleted. (WebCore::Display::Box::ComputedHorizontalMargin::ComputedHorizontalMargin): Deleted. (WebCore::Display::Box::setHorizontalComputedMargin): Deleted. (WebCore::Display::Box::computedMarginStart const): Deleted. (WebCore::Display::Box::computedMarginEnd const): Deleted. * layout/floats/FloatingContext.cpp: (WebCore::Layout::computedHorizontalMargin): (WebCore::Layout::FloatingContext::positionForFloat const): (WebCore::Layout::FloatingContext::positionForNonFloatingFloatAvoider const): * layout/floats/FloatingContext.h: * layout/inlineformatting/InlineFormattingContext.cpp: (WebCore::Layout::InlineFormattingContext::computeHorizontalMargin): (WebCore::Layout::InlineFormattingContext::computeWidthAndMargin): * layout/inlineformatting/InlineFormattingContextGeometry.cpp: (WebCore::Layout::InlineFormattingContext::Geometry::inlineBlockWidthAndMargin): * layout/tableformatting/TableFormattingContext.cpp: (WebCore::Layout::TableFormattingContext::setUsedGeometryForRows): (WebCore::Layout::TableFormattingContext::setUsedGeometryForSections): (WebCore::Layout::TableFormattingContext::layoutCell): 2020-07-04 Darin Adler <darin@apple.com> Make generate-unified-sources.sh not depend on features being listed in FEATURE_DEFINES environment variable https://bugs.webkit.org/show_bug.cgi?id=212420 Reviewed by Don Olmstead. * Scripts/generate-unified-sources.sh: Added code to include sources from SourcesCocoaInternalSDK.txt, only if USE_INTERNAL_SDK is YES. Removed --feature-flags argument from invocation of generate-unified-source-bundles.rb. Removed many unnecessary quotes. * SourcesCocoa.txt: Removed the names of the files from the internal SDK. * SourcesCocoaInternalSDK.txt: Added. Moved those names here. * html/MediaElementSession.cpp: Added some includes, apparently needed because of different groupings of unified sources. 2020-07-04 Zalan Bujtas <zalan@apple.com> [LFC] Used dedicated paint margin structures https://bugs.webkit.org/show_bug.cgi?id=213955 Reviewed by Antti Koivisto. This is in preparation for having only final margin values in Display::Box. * layout/FormattingContext.cpp: (WebCore::Layout::FormattingContext::computeOutOfFlowHorizontalGeometry): (WebCore::Layout::FormattingContext::computeOutOfFlowVerticalGeometry): * layout/blockformatting/BlockFormattingContext.cpp: (WebCore::Layout::BlockFormattingContext::computeWidthAndMargin): * layout/displaytree/DisplayBox.h: (WebCore::Display::Box::VerticalMargin::before const): (WebCore::Display::Box::VerticalMargin::after const): (WebCore::Display::Box::VerticalMargin::isCollapsedThrough const): (WebCore::Display::Box::VerticalMargin::nonCollapsedValues const): (WebCore::Display::Box::VerticalMargin::collapsedValues const): (WebCore::Display::Box::VerticalMargin::hasCollapsedValues const): (WebCore::Display::Box::VerticalMargin::setCollapsedValues): (WebCore::Display::Box::VerticalMargin::VerticalMargin): (WebCore::Display::Box::VerticalMargin::NonCollapsedValues::NonCollapsedValues): (WebCore::Display::Box::VerticalMargin::CollapsedValues::CollapsedValues): (WebCore::Display::Box::ComputedHorizontalMargin::ComputedHorizontalMargin): (WebCore::Display::Box::HorizontalMargin::HorizontalMargin): (WebCore::Display::Box::setHorizontalMargin): (WebCore::Display::Box::setVerticalMargin): (WebCore::Display::Box::setHorizontalComputedMargin): (WebCore::Display::Box::verticalMargin const): (WebCore::Display::Box::horizontalMargin const): * layout/floats/FloatingState.h: (WebCore::Layout::FloatingState::FloatItem::horizontalMargin const): * layout/inlineformatting/InlineFormattingContext.cpp: (WebCore::Layout::InlineFormattingContext::computeWidthAndMargin): (WebCore::Layout::InlineFormattingContext::computeHeightAndMargin): 2020-07-04 Darin Adler <darin@apple.com> Update comment in FeatureDefines.xcconfig since PlatformEnableCocoa.h should be used instead https://bugs.webkit.org/show_bug.cgi?id=213952 Reviewed by Sam Weinig. * Configurations/FeatureDefines.xcconfig: Updated comment. 2020-07-04 Youenn Fablet <youenn@apple.com> Enable VTB required low latency code path https://bugs.webkit.org/show_bug.cgi?id=210609 <rdar://problem/61890332> Reviewed by Darin Adler. Add new runtime flag for the low latency code path. Call webrtc newly introduced setter whenever creating a new encoder factory. Manually tested. * page/RuntimeEnabledFeatures.h: (WebCore::RuntimeEnabledFeatures::webRTCH264LowLatencyEncoderEnabled const): (WebCore::RuntimeEnabledFeatures::setWebRTCH264LowLatencyEncoderEnabled): * platform/mediastream/libwebrtc/LibWebRTCProviderCocoa.cpp: (WebCore::LibWebRTCProviderCocoa::createEncoderFactory): 2020-07-03 Youenn Fablet <youenn@apple.com> MediaRecorder should support peer connection remote video tracks https://bugs.webkit.org/show_bug.cgi?id=213924 Reviewed by Darin Adler. Previsouly we were checking whether width and height are given for a video track. This is not always available, for instance for remote tracks. And this can change over time. Instead, pass a simple boolean (whether there is a video track or not). Minor simplifications to stop storing unneeded members. Tests: imported/w3c/web-platform-tests/mediacapture-record/MediaRecorder-bitrate.https.html imported/w3c/web-platform-tests/mediacapture-record/MediaRecorder-creation.https.html imported/w3c/web-platform-tests/mediacapture-record/MediaRecorder-detached-context.html imported/w3c/web-platform-tests/mediacapture-record/MediaRecorder-disabled-tracks.https.html imported/w3c/web-platform-tests/mediacapture-record/MediaRecorder-events-and-exceptions.html imported/w3c/web-platform-tests/mediacapture-record/MediaRecorder-mimetype.html imported/w3c/web-platform-tests/mediacapture-record/MediaRecorder-no-sink.https.html imported/w3c/web-platform-tests/mediacapture-record/MediaRecorder-pause-resume.html imported/w3c/web-platform-tests/mediacapture-record/MediaRecorder-peerconnection.https.html imported/w3c/web-platform-tests/mediacapture-record/passthrough/MediaRecorder-passthrough.https.html * platform/mediarecorder/MediaRecorderPrivateAVFImpl.cpp: (WebCore::MediaRecorderPrivateAVFImpl::create): (WebCore::MediaRecorderPrivateAVFImpl::MediaRecorderPrivateAVFImpl): * platform/mediarecorder/MediaRecorderPrivateAVFImpl.h: * platform/mediarecorder/cocoa/MediaRecorderPrivateWriterCocoa.h: * platform/mediarecorder/cocoa/MediaRecorderPrivateWriterCocoa.mm: (WebCore::MediaRecorderPrivateWriter::create): 2020-07-03 Darin Adler <darin@apple.com> WebCore/Sources.txt: Remove all remaining #if (ENABLE_WEBGL and ENABLE_WEBXR) https://bugs.webkit.org/show_bug.cgi?id=213946 Reviewed by Sam Weinig. * CMakeLists.txt: Move IDL-related ENABLE_WEBGL and ENABLE_WEBXR items out of if blocks. Longer term, I think our direction should be to remove most feature conditionals from CMakeLists.txt too, just like I am doing for Sources.txt. But for now, doing just enough of this to keep the build working. Someone can tidy this later as desired. * Sources.txt: Remove all remaining #if, and sort files, getting rid of paragraphing per directory to just turn this into three sorted lists of filenames (separate ones for derived sources and generated bindings at the end). The source files themselves have the appropriate conditionals and soon we will not need to support #if in Sources.txt files. 2020-07-03 Fujii Hironori <Hironori.Fujii@sony.com> [Win] Unreviewed stack-overflow crash fix for r263890 https://bugs.webkit.org/show_bug.cgi?id=213912 <rdar://problem/65069686> Renamed mimeTypeForExtension to mimeTypeForExtensionFromRegistry. * platform/win/MIMETypeRegistryWin.cpp: (WebCore::mimeTypeForExtensionFromRegistry): (WebCore::MIMETypeRegistry::mimeTypeForExtension): (WebCore::mimeTypeForExtension): Deleted. 2020-07-03 Fujii Hironori <Hironori.Fujii@sony.com> [Win] Unreviewed build fix for r263913 https://bugs.webkit.org/show_bug.cgi?id=213939 <rdar://problem/65084185> * CMakeLists.txt: Process encrypted media IDL files even if ENABLE_ENCRYPTED_MEDIA is off. 2020-07-03 Darin Adler <darin@apple.com> WebCore/Sources.txt: Remove #if ENABLE_WIRELESS_PLAYBACK_TARGET https://bugs.webkit.org/show_bug.cgi?id=213945 Reviewed by Sam Weinig. * CMakeLists.txt: Moved items from the pictureinpicture and remoteplayback module here from PlatformMac.cmake. Even if these are currently only implemented on Mac, they are not intrinsically Mac-specific, so they belong here. * PlatformMac.cmake: Ditto. * Sources.txt: Remove #if ENABLE_WIRELESS_PLAYBACK_TARGET and sort files in with the others. The source files themselves have conditionals, we don't need conditionals in Sources.txt, and we are moving towards removing the capability for #if ENABLE in the Sources.txt file. 2020-07-03 Sam Weinig <weinig@apple.com> Remove support for ENABLE_INPUT_TYPE_DATETIME_INCOMPLETE https://bugs.webkit.org/show_bug.cgi?id=213932 Reviewed by Darin Adler. Removes support for non-standard <input type="datetime">, currently being guarded by the macro ENABLE_INPUT_TYPE_DATETIME_INCOMPLETE. This macro, was added back in 2013 as a temporary measure to support some engines who shipped support for <input type="datetime">. It is currently not enabled for any ports so now seems like as good a time as any to remove it. * Configurations/FeatureDefines.xcconfig: * Sources.txt: * WebCore.xcodeproj/project.pbxproj: * css/html.css: (#endif): * html/DateTimeInputType.cpp: Removed. * html/DateTimeInputType.h: Removed. * html/InputType.cpp: (WebCore::createInputTypeFactoryMap): * page/RuntimeEnabledFeatures.h: (WebCore::RuntimeEnabledFeatures::inputTypeDateTimeEnabled const): Deleted. (WebCore::RuntimeEnabledFeatures::setInputTypeDateTimeEnabled): Deleted. * platform/DateComponents.cpp: (WebCore::DateComponents::setMillisecondsSinceEpochForDateTimeLocal): (WebCore::DateComponents::millisecondsSinceEpoch const): (WebCore::DateComponents::toString const): (WebCore::DateComponents::fromParsingDateTime): Deleted. (WebCore::DateComponents::parseDateTime): Deleted. (WebCore::DateComponents::fromMillisecondsSinceEpochForDateTime): Deleted. (WebCore::DateComponents::setMillisecondsSinceEpochForDateTime): Deleted. * platform/DateComponents.h: * platform/text/PlatformLocale.cpp: (WebCore::Locale::formatDateTime): * platform/text/ios/LocalizedDateCache.mm: (WebCore::LocalizedDateCache::createFormatterForType): 2020-07-03 Darin Adler <darin@apple.com> WebCore/Sources.txt: Remove #if ENABLE_USER_MESSAGE_HANDLERS https://bugs.webkit.org/show_bug.cgi?id=213944 Reviewed by Sam Weinig. * CMakeLists.txt: Move IDL-related ENABLE_USER_MESSAGE_HANDLERS items out of if blocks. Longer term, I think our direction should be to remove most feature conditionals from CMakeLists.txt too, just like I am doing for Sources.txt. But for now, doing just enough of this to keep the build working. Someone can tidy this later as desired. * Sources.txt: Remove #if ENABLE_USER_MESSAGE_HANDLERS and sort files in with the others. The source files themselves have conditionals, we don't need conditionals in Sources.txt, and we are moving towards removing the capability for #if ENABLE in the Sources.txt file. 2020-07-03 Darin Adler <darin@apple.com> WebCore/SourcesCocoa.txt: Remove #if ENABLE_APPLE_PAY https://bugs.webkit.org/show_bug.cgi?id=213943 Reviewed by Sam Weinig. * SourcesCocoa.txt: Remove #if ENABLE_APPLE_PAY and sort files in with the others. The source files themselves have conditionals, we don't need conditionals in Sources.txt, and we are moving towards removing the capability for #if ENABLE in the Sources.txt file. Also, sort the files and remove the separate per-directory paragraphs, making this closer to just a sorted list of filenames with less "editorial" content. Also added comments about the USE_INTERNAL_SDK part of the file. 2020-07-03 Darin Adler <darin@apple.com> WebCore/Sources.txt: Remove #if ENABLE_ENCRYPTED_MEDIA https://bugs.webkit.org/show_bug.cgi?id=213939 Reviewed by Sam Weinig. * CMakeLists.txt: Move IDL-related ENABLE_ENCRYPTED_MEDIA items out of if blocks. Longer term, I think our direction should be to remove most feature conditionals from CMakeLists.txt too, just like I am doing for Sources.txt. But for now, doing just enough of this to keep the build working. Someone can tidy this later as desired. * Sources.txt: Remove #if ENABLE_LEGACY_ENCRYPTED_MEDIA and sort files in with the others. The IDL files themselves have conditionals, we don't need conditionals in Sources.txt, and we are moving towards removing the capability for #if ENABLE in the Sources.txt file. 2020-07-03 Darin Adler <darin@apple.com> WebCore/Sources.txt: Remove #if ENABLE_LEGACY_ENCRYPTED_MEDIA https://bugs.webkit.org/show_bug.cgi?id=213937 Reviewed by Sam Weinig. * CMakeLists.txt: Move IDL-related ENABLE_LEGACY_ENCRYPTED_MEDIA items out of if blocks. Longer term, I think our direction should be to remove most feature conditionals from CMakeLists.txt too, just like I am doing for Sources.txt. But for now, doing just enough of this to keep the build working. Someone can tidy this later as desired. * Sources.txt: Remove #if ENABLE_LEGACY_ENCRYPTED_MEDIA and sort files in with the others. The IDL files themselves have conditionals, we don't need conditionals in Sources.txt, and we are moving towards removing the capability for #if ENABLE in the Sources.txt file. 2020-07-03 Darin Adler <darin@apple.com> WebCore/Sources.txt: Remove #if ENABLE_QUOTA https://bugs.webkit.org/show_bug.cgi?id=213941 Reviewed by Sam Weinig. * CMakeLists.txt: Move IDL-related ENABLE_QUOTA items out of "if (ENABLE_QUOTA)". Longer term, I think our direction should be to remove most feature conditionals from CMakeLists.txt too, just like I am doing for Sources.txt. But for now, doing just enough of this to keep the build working. Someone can tidy this later as desired. * Sources.txt: Remove #if ENABLE_QUOTA and sort files in with the others. The source files themselves have conditionals, we don't need conditionals in Sources.txt, and we are moving towards removing the capability for #if ENABLE in the Sources.txt file. 2020-07-03 Darin Adler <darin@apple.com> WebCore/Sources.txt: Remove #if ENABLE_GAMEPAD https://bugs.webkit.org/show_bug.cgi?id=213936 Reviewed by Sam Weinig. * CMakeLists.txt: Move IDL-related ENABLE_GAMEPAD items out of "if (ENABLE_GAMEPAD)". Longer term, I think our direction should be to remove most feature conditionals from CMakeLists.txt too, just like I am doing for Sources.txt. But for now, doing just enough of this to keep the build working. Someone can tidy this later as desired. * Sources.txt: Remove #if ENABLE_GAMEPAD and sort files in with the others. The IDL files themselves have conditionals, we don't need conditionals in Sources.txt, and we are moving towards removing the capability for #if ENABLE in the Sources.txt file. 2020-07-03 Darin Adler <darin@apple.com> WebCore/Sources.txt: Remove #if ENABLE_MEDIA_SOURCE https://bugs.webkit.org/show_bug.cgi?id=213940 Reviewed by Sam Weinig. * Sources.txt: Remove #if ENABLE_MEDIA_SOURCE and sort files in with the others. The IDL files themselves have conditionals, we don't need conditionals in Sources.txt, and we are moving towards removing the capability for #if ENABLE in the Sources.txt file. 2020-07-03 Lauro Moura <lmoura@igalia.com> [WPE] Fix build with clang after r263898 https://bugs.webkit.org/show_bug.cgi?id=213942 Unreviewed build fix. * loader/appcache/ApplicationCacheManifestParser.cpp: 2020-07-03 Darin Adler <darin@apple.com> WebCore/Sources.txt: Remove #if ENABLE_APPLICATION_MANIFEST https://bugs.webkit.org/show_bug.cgi?id=213935 Reviewed by Sam Weinig. * Sources.txt: Remove #if ENABLE_APPLICATION_MANIFEST and sort files in with the others. The source files themselves have conditionals, we don't need conditionals in Sources.txt, and we are moving towards removing the capability for #if ENABLE in the Sources.txt file. 2020-07-03 Sam Weinig <weinig@apple.com> Add "-Wliteral-conversion" warning to Xcode based builds and fix the issues it finds https://bugs.webkit.org/show_bug.cgi?id=213931 Reviewed by Darin Adler. * Configurations/Base.xcconfig: Add -Wliteral-conversion. * platform/graphics/BitmapImage.cpp: (WebCore::BitmapImage::draw): Fix error due to passing a double when a uint8_t was expected. This probably means that the debug borders looked wrong for a little bit, but should now be back to their transparent splendor. 2020-07-03 Zalan Bujtas <zalan@apple.com> [LFC][TFC][Quirk] Inflow child box quirk vertical margins should collapse with table cell. https://bugs.webkit.org/show_bug.cgi?id=213926 Reviewed by Antti Koivisto. The BFC rootd (table cell box in this case) nornally do not collapse their margins with the first/last inflow child. However in quirks mode, cell boxes collapse their (non-existing)margins with inflow quirk margins. <table><tr><td><p>text content</td></tr></table> <- <p> box's top position is at 0px in quirks mode, while at 16px (1em) in strict mode. This patch ensures that we collapse the quirk margins and take them into account when computing the cell's content height. Test: fast/layoutformattingcontext/table-quirk-vertical-margin-simple.html * Sources.txt: * WebCore.xcodeproj/project.pbxproj: * layout/blockformatting/BlockFormattingContext.cpp: (WebCore::Layout::BlockFormattingContext::computeHeightAndMargin): * layout/blockformatting/BlockFormattingContext.h: * layout/blockformatting/BlockFormattingContextQuirks.cpp: (WebCore::Layout::BlockFormattingContext::Quirks::shouldCollapseMarginBeforeWithParentMarginBefore const): (WebCore::Layout::BlockFormattingContext::Quirks::shouldCollapseMarginAfterWithParentMarginAfter const): * layout/blockformatting/BlockMarginCollapse.cpp: (WebCore::Layout::BlockFormattingContext::MarginCollapse::marginBeforeCollapsesWithParentMarginBefore const): (WebCore::Layout::BlockFormattingContext::MarginCollapse::marginAfterCollapsesWithParentMarginAfter const): (WebCore::Layout::BlockFormattingContext::MarginCollapse::collapsedVerticalValues): * layout/tableformatting/TableFormattingContext.h: (WebCore::Layout::TableFormattingContext::Quirks::Quirks): * layout/tableformatting/TableFormattingContextGeometry.cpp: (WebCore::Layout::TableFormattingContext::Geometry::cellHeigh const): * layout/tableformatting/TableFormattingContextQuirks.cpp: Added. (WebCore::Layout::TableFormattingContext::Quirks::shouldIgnoreChildContentVerticalMargin const): 2020-07-03 Sam Weinig <weinig@apple.com> Split color conversion functions out of ColorUtilities.h/cpp into their own file. https://bugs.webkit.org/show_bug.cgi?id=213803 Reviewed by Simon Fraser. Moves color conversion functions (both between color spaces like toDisplayP3(const SRGBA&) and between different representations like toHSLA(const SRGBA&)) to their own files. * Headers.cmake: * Sources.txt: * WebCore.xcodeproj/project.pbxproj: Add new files. * css/parser/CSSPropertyParserHelpers.cpp: * editing/cocoa/DataDetection.mm: * html/canvas/CanvasRenderingContext2DBase.cpp: * html/canvas/CanvasStyle.cpp: Add include of ColorConversion.h * platform/graphics/ColorConversion.cpp: Added. * platform/graphics/ColorConversion.h: Added. * platform/graphics/ColorUtilities.cpp: * platform/graphics/ColorUtilities.h: Move functions to the new files. * platform/graphics/ExtendedColor.cpp: * platform/graphics/cairo/ImageBufferCairoBackend.cpp: * platform/graphics/filters/FELighting.cpp: Add include of ColorConversion.h, remove unncessary include of ColorUtilities.h * platform/graphics/cairo/ImageBufferCairoSurfaceBackend.cpp: * platform/graphics/filters/FEDisplacementMap.cpp: * platform/graphics/filters/FEMorphology.cpp: * platform/graphics/filters/FilterOperations.cpp: Remove unncessary include of ColorUtilities.h * platform/graphics/filters/FilterOperation.cpp: Add include of ColorConversion.h and ColorTypes.h, remove unncessary include of ColorUtilities.h. * platform/graphics/gtk/ColorGtk.cpp: * platform/graphics/win/ColorDirect2D.cpp: Remove unncessary include of ColorUtilities.h. Update to use standard float -> SimpleColor idiom using SRGBA<float>. 2020-07-03 Sam Weinig <weinig@apple.com> Convert DateComponents parsing code to use Optional based return values rather than out-parameters https://bugs.webkit.org/show_bug.cgi?id=213440 Reviewed by Darin Adler. Rework DateComponents and Date/Time related InputTypes to use Optional based programming for parsing results. Also take the opportunity to remove unicode upconversion from DateComponent parsing and instead separate UChar and LChar variants via templates. * html/BaseDateAndTimeInputType.cpp: * html/BaseDateAndTimeInputType.h: * html/DateInputType.cpp: * html/DateInputType.h: * html/DateTimeInputType.cpp: * html/DateTimeInputType.h: * html/DateTimeLocalInputType.cpp: * html/DateTimeLocalInputType.h: * html/HTMLInputElement.cpp: * html/HTMLInputElement.h: * html/InputType.cpp: * html/InputType.h: * html/MonthInputType.cpp: * html/MonthInputType.h: * html/TimeInputType.cpp: * html/TimeInputType.h: * html/WeekInputType.cpp: * html/WeekInputType.h: - Removes parseToDateComponentsInternal. No need it and parseToDateComponents. - Makes parseToDateComponents pure virtual. The old code had a default implementations down in InputType, but it had no callers. - Remove iOS vs. non-iOS difference for dateType(). It is now available on InputType on all platforms. - Make setMillisecondToDateComponents and parseToDateComponents return an Optional. * platform/DateComponents.cpp: * platform/DateComponents.h: - Replace member function based interfaces for parsing/setting explicit time offsets with new factory functions that return Optional<DateComponents>. - These factories are implemented using the existing member functions, which are now private. - Make max/min constants constexpr. - Make parse* member functions templates to allow factory parse functions to call them without upconverting. - Replace header guard with #pragma once. 2020-07-03 Sam Weinig <weinig@apple.com> Cleanup ApplicationCacheManifestParser.h/cpp https://bugs.webkit.org/show_bug.cgi?id=213844 Reviewed by Alex Christensen. Address some post review comments. * loader/appcache/ApplicationCacheManifestParser.cpp: (WebCore::parseApplicationCacheManifest): Fix typos: manfest -> manifest. * loader/appcache/ApplicationCacheManifestParser.h: Stop including ApplicationCache.h, and only include / declare what's needed. 2020-07-03 Youenn Fablet <youenn@apple.com> Support MediaRecorder.onstart https://bugs.webkit.org/show_bug.cgi?id=213720 Reviewed by Darin Adler. Fire start event if MediaRecorder.start is successful. Do some WebIDL clean-up, in particular change timeSlice from long to unsigned long, as per spec. Covered by added test. * Modules/mediarecorder/MediaRecorder.cpp: (WebCore::MediaRecorder::startRecording): * Modules/mediarecorder/MediaRecorder.h: * Modules/mediarecorder/MediaRecorder.idl: 2020-07-03 Youenn Fablet <youenn@apple.com> MediaRecorder.start() Method is Ignoring the "timeslice" Parameter https://bugs.webkit.org/show_bug.cgi?id=202233 <rdar://problem/55720555> Reviewed by Eric Carlson. Use a timer to implement timeSlice parameter. Schedule timer either when start is called or as part of requestData callback. This should ensure that, if requestData is called by the application, the timer will be rescheduled appropriately. Test: http/wpt/mediarecorder/MediaRecorder-start-timeSlice.html * Modules/mediarecorder/MediaRecorder.cpp: (WebCore::MediaRecorder::MediaRecorder): (WebCore::MediaRecorder::startRecording): (WebCore::MediaRecorder::requestData): * Modules/mediarecorder/MediaRecorder.h: 2020-07-03 Youenn Fablet <youenn@apple.com> MediaRecorder stopRecorder() returns empty Blob after first use https://bugs.webkit.org/show_bug.cgi?id=212274 <rdar://problem/63601298> Reviewed by Eric Carlson. Refactor code to create/destroy MediaRecorderPrivate on MediaRecorder start/stop. This allows reusing a MediaRecorder after a stop and restarting with a clean state. We introduce MediaRecorderPrivate::startRecording to do the initialization, which allows to fix a potential ref cycle as part of the error callback handling. Make some improvements to the platform implementation, in particular add default initialization to all fields. Align the code using AudioConverterRef to what is done in AudioSampleDataSource. Also call VTCompressionSessionInvalidate when destroying the VideoSampleBufferCompressor. Test: http/wpt/mediarecorder/MediaRecorder-multiple-start-stop.html * Modules/mediarecorder/MediaRecorder.cpp: (WebCore::MediaRecorder::create): (WebCore::MediaRecorder::MediaRecorder): (WebCore::MediaRecorder::startRecording): (WebCore::MediaRecorder::stopRecording): (WebCore::MediaRecorder::requestData): * Modules/mediarecorder/MediaRecorder.h: * platform/mediarecorder/MediaRecorderPrivateMock.cpp: (WebCore::MediaRecorderPrivateMock::fetchData): * platform/mediarecorder/MediaRecorderPrivate.h: (WebCore::MediaRecorderPrivate::startRecording): * platform/mediarecorder/cocoa/AudioSampleBufferCompressor.h: * platform/mediarecorder/cocoa/AudioSampleBufferCompressor.mm: (WebCore::AudioSampleBufferCompressor::~AudioSampleBufferCompressor): (WebCore::AudioSampleBufferCompressor::initAudioConverterForSourceFormatDescription): (WebCore::AudioSampleBufferCompressor::attachPrimingTrimsIfNeeded): (WebCore::AudioSampleBufferCompressor::gradualDecoderRefreshCount): (WebCore::AudioSampleBufferCompressor::sampleBufferWithNumPackets): (WebCore::AudioSampleBufferCompressor::processSampleBuffersUntilLowWaterTime): * platform/mediarecorder/cocoa/MediaRecorderPrivateWriterCocoa.h: * platform/mediarecorder/cocoa/MediaRecorderPrivateWriterCocoa.mm: (WebCore::MediaRecorderPrivateWriter::stopRecording): * platform/mediarecorder/cocoa/VideoSampleBufferCompressor.mm: (WebCore::VideoSampleBufferCompressor::~VideoSampleBufferCompressor): 2020-07-03 Said Abou-Hallawa <sabouhallawa@apple.com> Change the names of MIMETypeRegistry methods to comply with webkit naming style https://bugs.webkit.org/show_bug.cgi?id=213912 Reviewed by Youenn Fablet. Remove the verb 'get' from the name of some of the methods of MIMETypeRegistry. * editing/cocoa/WebArchiveResourceFromNSAttributedString.mm: (WebCore::if): * fileapi/File.cpp: (WebCore::File::computeNameAndContentType): * html/HTMLPlugInElement.cpp: (WebCore::pluginReplacementForType): * loader/mac/LoaderNSURLExtras.mm: (suggestedFilenameWithMIMEType): * platform/MIMETypeRegistry.cpp: (WebCore::commonMimeTypesMap): (WebCore::MIMETypeRegistry::mediaMIMETypeForExtension): (WebCore::MIMETypeRegistry::mimeTypeForPath): (WebCore::MIMETypeRegistry::isSupportedImageMIMEType): (WebCore::MIMETypeRegistry::normalizedMIMEType): (WebCore::MIMETypeRegistry::appendFileExtensionIfNecessary): (WebCore::MIMETypeRegistry::getMediaMIMETypeForExtension): Deleted. (WebCore::MIMETypeRegistry::getMediaMIMETypesForExtension): Deleted. Delete this function since it is not used. (WebCore::MIMETypeRegistry::getMIMETypeForPath): Deleted. (WebCore::MIMETypeRegistry::getNormalizedMIMEType): Deleted. * platform/MIMETypeRegistry.h: * platform/cocoa/MIMETypeRegistryCocoa.mm: (WebCore::MIMETypeRegistry::mimeTypeForExtension): (WebCore::MIMETypeRegistry::extensionsForMIMEType): (WebCore::MIMETypeRegistry::preferredExtensionForMIMEType): (WebCore::MIMETypeRegistry::getMIMETypeForExtension): Deleted. (WebCore::MIMETypeRegistry::getExtensionsForMIMEType): Deleted. (WebCore::MIMETypeRegistry::getPreferredExtensionForMIMEType): Deleted. * platform/graphics/MediaPlayer.cpp: (WebCore::MediaPlayer::load): * platform/graphics/avfoundation/objc/ImageDecoderAVFObjC.mm: (WebCore::ImageDecoderAVFObjC::filenameExtension const): * platform/graphics/gstreamer/ImageDecoderGStreamer.h: * platform/network/curl/CurlRequest.cpp: (WebCore::CurlRequest::invokeDidReceiveResponseForFile): * platform/playstation/MIMETypeRegistryPlayStation.cpp: (WebCore::MIMETypeRegistry::mimeTypeForExtension): (WebCore::MIMETypeRegistry::preferredExtensionForMIMEType): (WebCore::MIMETypeRegistry::extensionsForMIMEType): (WebCore::MIMETypeRegistry::getMIMETypeForExtension): Deleted. (WebCore::MIMETypeRegistry::getPreferredExtensionForMIMEType): Deleted. (WebCore::MIMETypeRegistry::getExtensionsForMIMEType): Deleted. * platform/win/MIMETypeRegistryWin.cpp: (WebCore::MIMETypeRegistry::preferredExtensionForMIMEType): (WebCore::MIMETypeRegistry::mimeTypeForExtension): (WebCore::MIMETypeRegistry::extensionsForMIMEType): (WebCore::MIMETypeRegistry::getPreferredExtensionForMIMEType): Deleted. (WebCore::MIMETypeRegistry::getMIMETypeForExtension): Deleted. (WebCore::MIMETypeRegistry::getExtensionsForMIMEType): Deleted. * platform/xdg/MIMETypeRegistryXdg.cpp: (WebCore::MIMETypeRegistry::mimeTypeForExtension): (WebCore::MIMETypeRegistry::preferredExtensionForMIMEType): (WebCore::MIMETypeRegistry::extensionsForMIMEType): (WebCore::MIMETypeRegistry::getMIMETypeForExtension): Deleted. (WebCore::MIMETypeRegistry::getPreferredExtensionForMIMEType): Deleted. (WebCore::MIMETypeRegistry::getExtensionsForMIMEType): Deleted. 2020-07-03 Carlos Garcia Campos <cgarcia@igalia.com> [GTK4] Enable threaded rendering by default https://bugs.webkit.org/show_bug.cgi?id=213883 Reviewed by Adrian Perez de Castro. When building with GTK4 we no longer use the cairo context to render directly, so we can always enable the threaded rendering. In WPE port threaded rendering is only enabled when env var WEBKIT_NICOSIA_PAINTING_THREADS is present. This patch changes a bit the meaning of the env var, so that when 0 is passed the feature is disabled too, instead of setting the number of threads to 4. * platform/graphics/nicosia/NicosiaPaintingEngine.cpp: (Nicosia::PaintingEngine::create): 2020-07-02 Mark Lam <mark.lam@apple.com> ReadableStream::create() should handle any exceptions that may be thrown during construction. https://bugs.webkit.org/show_bug.cgi?id=213819 Reviewed by Youenn Fablet and Yusuke Suzuki. Win EWS detected that ReadableStream::create() can throw exceptions, and we were failing to handle it. This patch fixes that. * Modules/cache/DOMCache.cpp: (WebCore::DOMCache::put): * Modules/fetch/FetchBodyOwner.cpp: (WebCore::FetchBodyOwner::readableStream): (WebCore::FetchBodyOwner::createReadableStream): * Modules/fetch/FetchBodyOwner.h: * Modules/fetch/FetchResponse.cpp: (WebCore::FetchResponse::clone): * bindings/js/ReadableStream.cpp: (WebCore::ReadableStream::create): * bindings/js/ReadableStream.h: 2020-07-02 Alex Christensen <achristensen@webkit.org> Update Mac CMake build * PlatformMac.cmake: 2020-07-02 Said Abou-Hallawa <sabouhallawa@apple.com> MIMETypeRegistry::getExtensionsForMIMEType() needs to handle wildcard MIME types https://bugs.webkit.org/show_bug.cgi?id=213826 Reviewed by Darin Adler. Addressing post commit review comments for r263832. * platform/cocoa/MIMETypeRegistryCocoa.mm: (WebCore::extensionsForMIMETypeMap): 2020-07-02 Brady Eidson <beidson@apple.com> GameController.framework soft linking refactoring https://bugs.webkit.org/show_bug.cgi?id=213909 Reviewed by Tim Horton. No new tests (No behavior changes) * WebCore.xcodeproj/project.pbxproj: * platform/gamepad/cocoa/GameControllerGamepadProvider.mm: (WebCore::GameControllerGamepadProvider::startMonitoringGamepads): * platform/gamepad/cocoa/GameControllerSPI.h: Added. * platform/gamepad/cocoa/GameControllerSoftLink.h: Added. * platform/gamepad/cocoa/GameControllerSoftLink.mm: Added. 2020-07-02 Simon Fraser <simon.fraser@apple.com> REGRESSION(r260276): menu items in footer of https://salo.ai are invisible until you hover or resize https://bugs.webkit.org/show_bug.cgi?id=213712 <rdar://problem/64893190> Reviewed by Zalan Bujtas. A negative z-index child triggers a foreground layer inside overflow scroll. This foreground layer gets the PaintingOverflowContents flag but not the PaintingCompositingScrollingPhase flag, but we still need to avoid the clip check that happens in RenderBlock::paint(), so change RenderLayer::paintLayerContents() to just check for isPaintingOverflowContents. Test: compositing/scrolling/async-overflow-scrolling/foreground-layer-paint-phase.html * rendering/RenderLayer.cpp: (WebCore::RenderLayer::paintLayerContents): 2020-07-02 Antoine Quint <graouts@webkit.org> visualViewport.addEventListener("scroll"*** fires permanently after zoom or orientation change https://bugs.webkit.org/show_bug.cgi?id=211522 <rdar://problem/62939371> Reviewed by Simon Fraser. Correctly set the flag indicating that a scroll event has been dispatched on the visual viewport. Test: fast/visual-viewport/scroll-event-fired-during-scroll-alone.html * dom/Document.cpp: (WebCore::Document::runScrollSteps): 2020-07-02 Zalan Bujtas <zalan@apple.com> Overlapping content on earny.co https://bugs.webkit.org/show_bug.cgi?id=213864 <rdar://problem/61011802> Reviewed by Simon Fraser. Do not use a 1px value for initial min/max content width. * rendering/AutoTableLayout.cpp: (WebCore::AutoTableLayout::recalcColumn): (WebCore::AutoTableLayout::calcEffectiveLogicalWidth): (WebCore::AutoTableLayout::layout): I found 2 places where we rely on the initial 1px value for min/max width. This might cause some "regression". 2020-07-02 Ryan Haddad <ryanhaddad@apple.com> Unreviewed, reverting r263633, r263651, and r263671. Still seeing MediaRecorder test crashes after re-landing r263633 Reverted changesets: "MediaRecorder stopRecorder() returns empty Blob after first use" https://bugs.webkit.org/show_bug.cgi?id=212274 https://trac.webkit.org/changeset/263633 "MediaRecorder.start() Method is Ignoring the "timeslice" Parameter" https://bugs.webkit.org/show_bug.cgi?id=202233 https://trac.webkit.org/changeset/263651 "Support MediaRecorder.onstart" https://bugs.webkit.org/show_bug.cgi?id=213720 https://trac.webkit.org/changeset/263671 2020-07-02 Antti Koivisto <antti@apple.com> REGRESSION: Comments section at dpreview has overlapping names with comment on phone https://bugs.webkit.org/show_bug.cgi?id=213890 <rdar://problem/64693599> Reviewed by Simon Fraser. Test: fast/text-autosizing/ios/float-miscomputed-line-height.html * rendering/TextAutoSizing.cpp: (WebCore::TextAutoSizingValue::adjustTextNodeSizes): Negative value is used to indicate unset line-height. We shouldn't make adjustments in this case. This matches Style::BuilderCustom code. 2020-07-02 Zalan Bujtas <zalan@apple.com> [LFC][BFC] Remove redundant margin-border-padding when computing the intrinsic width https://bugs.webkit.org/show_bug.cgi?id=213882 Reviewed by Antti Koivisto. The child intrinsic width already includes the margin-border-padding values. Test: fast/layoutformattingcontext/table-with-margin-content-simple.html * layout/blockformatting/BlockFormattingContextGeometry.cpp: (WebCore::Layout::BlockFormattingContext::Geometry::intrinsicWidthConstraints): 2020-07-02 Zalan Bujtas <zalan@apple.com> [LFC][IFC] Use <tr> computed height as minimum height for the row https://bugs.webkit.org/show_bug.cgi?id=213880 Reviewed by Antti Koivisto. Test: fast/layoutformattingcontext/table-fixed-row-height-simple.html * layout/tableformatting/TableLayout.cpp: (WebCore::Layout::TableFormattingContext::TableLayout::distributedVerticalSpace): 2020-07-02 Youenn Fablet <youenn@apple.com> getUserMedia returns OverConstrained on Jitsi https://bugs.webkit.org/show_bug.cgi?id=210932 <rdar://problem/64403675> Reviewed by Philippe Normand. We compute the max width, max height and max frame rate across all presets. In case a preset for the max resolution is different from the preset for the max frame rate, we were selecting capture parameters that no preset can match. To fix the issue, in case the frame rate constraint is not mandatory, and we do not find a preset when starting to capture, we remove the frame rate constraint, pick the preset and choose the max frame rate from that preset. Update mock sources to have a high resolution preset with low frame rate to enable writing a test. Test: fast/mediastream/get-user-media-ideal-constraints.html * platform/mediastream/RealtimeMediaSource.cpp: (WebCore::RealtimeMediaSource::supportsSizeAndFrameRate): * platform/mediastream/RealtimeVideoCaptureSource.cpp: (WebCore::RealtimeVideoCaptureSource::bestSupportedSizeAndFrameRate): (WebCore::RealtimeVideoCaptureSource::setSizeAndFrameRate): * platform/mediastream/VideoPreset.h: (WebCore::VideoPreset::maxFrameRate const): * platform/mock/MockRealtimeMediaSourceCenter.cpp: (WebCore::defaultDevices): 2020-07-02 Carlos Garcia Campos <cgarcia@igalia.com> Unreviewed. Fix GTK4 build * platform/gtk/GtkVersioning.h: (gtk_scrolled_window_new): 2020-07-02 Rob Buis <rbuis@igalia.com> Fragment navigation involving fragment identifiers does not match specification https://bugs.webkit.org/show_bug.cgi?id=83930 Reviewed by Darin Adler. Implement step 5 and 6 of [1] to allow fragment identifier lookup using percent-decoding, after normal lookup failed. Behavior matches Chrome and Firefox. [1] https://html.spec.whatwg.org/multipage/browsing-the-web.html#the-indicated-part-of-the-document Tests: imported/w3c/web-platform-tests/html/browsers/browsing-the-web/scroll-to-fragid/scroll-to-anchor-name.html imported/w3c/web-platform-tests/html/browsers/browsing-the-web/scroll-to-fragid/fragment-and-encoding-2.html imported/w3c/web-platform-tests/html/browsers/browsing-the-web/scroll-to-fragid/fragment-and-encoding.html imported/w3c/web-platform-tests/html/browsers/browsing-the-web/scroll-to-fragid/scroll-frag-non-utf8-encoded-document.html * page/FrameView.cpp: (WebCore::FrameView::scrollToFragmentInternal): 2020-07-02 Alexander Mikhaylenko <alexm@gnome.org> [GTK] Kinetic scrolling is still triggered if you wait before lifting fingers https://bugs.webkit.org/show_bug.cgi?id=213789 Reviewed by Carlos Garcia Campos. The intended behavior for kinetic scrolling is that it's possible to not trigger it by stopping moving fingers before lifting them, as opposed to doing a fling/swipe. However, right now it's broken and trying to do this triggers kinetic scrolling as well. Currently, the last scroll event with (0, 0) deltas isn't added to the scroll history for kinetic scrolling. However, this is wrong, because the last event, or rather the timespan between it and the previous scroll event, actually determines the kinetic scrolling velocity: if this event follows the previous one quickly, the velocity is large, but if there was a long pause, the velocity would be close to 0. See https://gitlab.gnome.org/GNOME/gtk/-/merge_requests/1902 and https://gitlab.gnome.org/GNOME/gtk/-/merge_requests/1903 for the equivalent GTK fixes. * page/scrolling/nicosia/ScrollingTreeFrameScrollingNodeNicosia.cpp: (WebCore::ScrollingTreeFrameScrollingNodeNicosia::handleWheelEvent): * page/scrolling/nicosia/ScrollingTreeOverflowScrollingNodeNicosia.cpp: (WebCore::ScrollingTreeOverflowScrollingNodeNicosia::handleWheelEvent): * platform/generic/ScrollAnimatorGeneric.cpp: (WebCore::ScrollAnimatorGeneric::handleWheelEvent): 2020-07-02 Philippe Normand <pnormand@igalia.com> [GStreamer] Rewrite mediastreamsrc element https://bugs.webkit.org/show_bug.cgi?id=213777 Reviewed by Xabier Rodriguez-Calvar. The underlying functionality remains the same, design-wise. This is mostly a refactoring switching to smart pointers as much as possible and trying to comply with WebKit code style guidelines. The previous version of this element was leaking pad templates and sticky stream-start events (in webkitMediaStreamSrcTrackEnded). The LIBWEBRTC ifdef guards were removed as well, because there's no actual libwebrtc dependency involved in this code. No new tests, existing webrtc and fast/mediastream tests cover this patch. * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp: * platform/mediastream/gstreamer/GStreamerMediaStreamSource.cpp: (mediaStreamTrackPrivateGetTags): (webkitMediaStreamNew): (WebKitMediaStreamTrackObserver::WebKitMediaStreamTrackObserver): (WebKitMediaStreamObserver::WebKitMediaStreamObserver): (InternalSource::InternalSource): (InternalSource::~InternalSource): (InternalSource::src const): (InternalSource::pushSample): (webkitMediaStreamSrcUriGetType): (webkitMediaStreamSrcUriGetProtocols): (webkitMediaStreamSrcUriGetUri): (webkitMediaStreamSrcUriSetUri): (webkitMediaStreamSrcUriHandlerInit): (webkitMediaStreamSrcSetProperty): (webkitMediaStreamSrcGetProperty): (webkitMediaStreamSrcConstructed): (stopObservingTracks): (webkitMediaStreamSrcFinalize): (webkitMediaStreamSrcChangeState): (webkit_media_stream_src_class_init): (webkitMediaStreamSrcChain): (webkitMediaStreamSrcAddPad): (ProbeData::ProbeData): (webkitMediaStreamSrcPadProbeCb): (webkitMediaStreamSrcSetupSrc): (webkitMediaStreamSrcPostStreamCollection): (webkitMediaStreamSrcAddTrack): (webkitMediaStreamSrcRemoveTrackByType): (webkitMediaStreamSrcSetStream): (webkitMediaStreamSrcPushVideoSample): (webkitMediaStreamSrcPushAudioSample): (webkitMediaStreamSrcTrackEnded): (webkitMediaStreamSrcNew): * platform/mediastream/gstreamer/GStreamerMediaStreamSource.h: 2020-07-01 Said Abou-Hallawa <sabouhallawa@apple.com> MIMETypeRegistry::getExtensionsForMIMEType() needs to handle wildcard MIME types https://bugs.webkit.org/show_bug.cgi?id=213826 Reviewed by Darin Adler. Working towards webkit.org/b/213347, it needs to be possible for WebCore to get the file extensions for wildcard MIME types, e.g. "image/*" or "video/*". For Cocoa platforms, we will enumerate the UTIs of the system. Get the MIMEType and the extensions of each UTI. Add the following pairs to a singleton HashMap: { MIMEType, extension } { Type(MIMEType)/*, extension } Change MIMETypeRegistry::getExtensionsForMIMEType() such that it calls extensionsForWildcardMIMEType() if the MIMEType ends with "*". * platform/MIMETypeRegistry.h: * platform/cocoa/MIMETypeRegistryCocoa.mm: (WebCore::extensionsForMIMETypeMap): (WebCore::extensionsForWildcardMIMEType): (WebCore::MIMETypeRegistry::getExtensionsForMIMEType): * platform/playstation/MIMETypeRegistryPlayStation.cpp: (WebCore::MIMETypeRegistry::getExtensionsForMIMEType): * platform/win/MIMETypeRegistryWin.cpp: (WebCore::MIMETypeRegistry::getExtensionsForMIMEType): * platform/xdg/MIMETypeRegistryXdg.cpp: (WebCore::MIMETypeRegistry::getExtensionsForMIMEType): 2020-07-01 Said Abou-Hallawa <sabouhallawa@apple.com> Allow the File object to be created with a replacement file https://bugs.webkit.org/show_bug.cgi?id=213825 Reviewed by Darin Adler. Working towards webkit.org/b/213347, it needs to be possible to create the File object with an optional replacement file. Only the registered BlobDataFileReference will be created with both the original file path and the replacement file path. So it can delete the replacement file when it is destroyed. Otherwise BlobDataFileReference will be created with the replacement file path. It is important to create the File object with the replacement file because it needs to get the meta-data and the bytes of the replacement file not the original file. * fileapi/File.cpp: (WebCore::File::create): * fileapi/File.h: * fileapi/ThreadableBlobRegistry.cpp: (WebCore::ThreadableBlobRegistry::registerFileBlobURL): * fileapi/ThreadableBlobRegistry.h: * html/DirectoryFileListCreator.cpp: (WebCore::createFileList): * html/FileInputType.cpp: (WebCore::FileInputType::filesFromFormControlState): When the Files are created from a FormControlState, they will be created without replacement files since they might have been deleted. (WebCore::FileInputType::filesChosen): (WebCore::FileInputType::receiveDroppedFiles): * platform/FileChooser.cpp: (WebCore::FileChooser::chooseFiles): (WebCore::FileChooser::chooseMediaFiles): * platform/FileChooser.h: (WebCore::FileChooserFileInfo::isolatedCopy const): (WebCore::FileChooser::chooseFiles): (WebCore::FileChooserFileInfo::FileChooserFileInfo): Deleted. * platform/network/BlobDataFileReference.cpp: (WebCore::BlobDataFileReference::BlobDataFileReference): (WebCore::BlobDataFileReference::~BlobDataFileReference): (WebCore::BlobDataFileReference::path): (WebCore::BlobDataFileReference::startTrackingModifications): * platform/network/BlobDataFileReference.h: * platform/network/BlobRegistry.h: 2020-07-01 Don Olmstead <don.olmstead@sony.com> [CMake] Add WOFF2 targets https://bugs.webkit.org/show_bug.cgi?id=213865 Reviewed by Fujii Hironori. Use the WOFF:: targets when USE_WOFF2 is set. * CMakeLists.txt: 2020-07-01 Chris Fleizach <cfleizach@apple.com> AX: Implement relevant simulated key presses for custom ARIA widgets for increment/decrement https://bugs.webkit.org/show_bug.cgi?id=213744 Reviewed by Darin Adler. In order to allow custom ARIA widgets to work, we can post keyboard events for specific ax actions that are not handled natively. Spec: https://github.com/WICG/aom/blob/gh-pages/explainer.md#user-action-events-from-assistive-technology Test: accessibility/keyevents-posted-for-increment-actions.html accessibility/keyevents-for-increment-actions-with-node-removal.html * accessibility/AccessibilityNodeObject.cpp: (WebCore::AccessibilityNodeObject::postKeyboardKeysForValueChange): (WebCore::AccessibilityNodeObject::setNodeValue): (WebCore::AccessibilityNodeObject::changeValueByStep): (WebCore::AccessibilityNodeObject::changeValueByPercent): * accessibility/AccessibilityNodeObject.h: * accessibility/AccessibilityObject.h: * accessibility/AccessibilityObjectInterface.h: * accessibility/AccessibilityRenderObject.cpp: (WebCore::AccessibilityRenderObject::setValue): * accessibility/AccessibilityRenderObject.h: * accessibility/AccessibilityScrollbar.cpp: (WebCore::AccessibilityScrollbar::setValue): * accessibility/AccessibilityScrollbar.h: * accessibility/AccessibilitySlider.cpp: (WebCore::AccessibilitySlider::setValue): * accessibility/AccessibilitySlider.h: * accessibility/isolatedtree/AXIsolatedObject.cpp: (WebCore::AXIsolatedObject::setValue): * accessibility/isolatedtree/AXIsolatedObject.h: 2020-07-01 Wenson Hsieh <wenson_hsieh@apple.com> Fix the WebKit build after <rdar://problem/64288191> https://bugs.webkit.org/show_bug.cgi?id=213832 Reviewed by Tim Horton. Upcoming changes to <UIKit/UIWebDocumentView.h> will cause the WebKit build to break, due to conflicting declarations of WKObject in both WebCore (WAK) code and the WebKit API. Avoid this by renaming the WAK version to WAKObject, rather than WKObject. Additionally, fix some minor style issues along the way. * platform/ios/wak/WKTypes.h: * platform/ios/wak/WKUtilities.c: (WKRetain): (WKRelease): (_WAKObjectDealloc): (WKGetClassInfo): (_WKObjectDealloc): Deleted. * platform/ios/wak/WKUtilities.h: * platform/ios/wak/WKView.h: * platform/ios/wak/WKView.mm: (_WKViewDealloc): 2020-07-01 Zalan Bujtas <zalan@apple.com> [LFC][TFC] Add support for non-baseline aligned cell height https://bugs.webkit.org/show_bug.cgi?id=213845 Reviewed by Antti Koivisto. Adjust max ascent/descent only when the cell is basline aligned. Test: fast/layoutformattingcontext/table-cell-height-middle-align-simple.html * layout/tableformatting/TableLayout.cpp: (WebCore::Layout::TableFormattingContext::TableLayout::distributedVerticalSpace): 2020-07-01 Antoine Quint <graouts@webkit.org> [Media Controls] Tracks panel can show text tracks with mode "hidden" as selected https://bugs.webkit.org/show_bug.cgi?id=213839 <rdar://problem/57989325> Reviewed by Jer Noble. We only considered text tracks that had their "mode" set to "disabled" as tracks that weren't selected, but there is also the "hidden" mode which should share the same UI state. We now check for "mode" to be set to "showing" to consider a text track as selected in the tracks panel. Test: media/modern-media-controls/tracks-support/tracks-support-hidden-tracks.html * Modules/modern-media-controls/media/tracks-support.js: (TracksSupport.prototype.tracksPanelIsTrackInSectionSelected): 2020-07-01 Sam Weinig <weinig@apple.com> Regression (r263788): Windows build broken: nameForRenderTreeAsText is not a member of WebCore::Color https://bugs.webkit.org/show_bug.cgi?id=213841 <rdar://problem/64985276> Fix Windows build. * platform/graphics/ca/win/PlatformCALayerWin.cpp: (printColor): 2020-07-01 Youenn Fablet <youenn@apple.com> Make NetworkSendQueue use CString instead of String for UTF-8 data https://bugs.webkit.org/show_bug.cgi?id=213714 Reviewed by Darin Adler. Use CString instead of String in NetworkSendQueue as all data is to be encoded as UTF-8. This allows converting and allocating the UTF-8 string only once. Covered by existing tests. * Modules/mediastream/RTCDataChannel.cpp: (WebCore::RTCDataChannel::createMessageQueue): (WebCore::RTCDataChannel::send): * Modules/mediastream/libwebrtc/LibWebRTCDataChannelHandler.cpp: (WebCore::LibWebRTCDataChannelHandler::sendStringData): (WebCore::LibWebRTCDataChannelHandler::sendRawData): * Modules/mediastream/libwebrtc/LibWebRTCDataChannelHandler.h: * fileapi/NetworkSendQueue.cpp: (WebCore::NetworkSendQueue::enqueue): (WebCore::NetworkSendQueue::processMessages): * fileapi/NetworkSendQueue.h: * platform/mediastream/RTCDataChannelHandler.h: * platform/mock/RTCDataChannelHandlerMock.cpp: (WebCore::RTCDataChannelHandlerMock::sendStringData): * platform/mock/RTCDataChannelHandlerMock.h: 2020-07-01 Alexey Shvayka <shvaikalesh@gmail.com> Use more efficient makeString() instead of StringBuilder https://bugs.webkit.org/show_bug.cgi?id=213708 Reviewed by Sam Weinig. This patch refactors throwRequiredMemberTypeError() and throwArgument*Error() methods, replacing all StringBuilder usages with more efficient makeString(). Extracts makeArgumentTypeErrorMessage(), similiar to existing helpers, which can be reused if neccessary. No new tests, no behavior change. * bindings/js/JSDOMExceptionHandling.cpp: (WebCore::makeArgumentTypeErrorMessage): (WebCore::throwArgumentMustBeEnumError): (WebCore::throwArgumentMustBeFunctionError): (WebCore::throwArgumentMustBeObjectError): (WebCore::throwArgumentTypeError): (WebCore::throwRequiredMemberTypeError): (WebCore::appendArgumentMustBe): Deleted. 2020-06-29 Sergio Villar Senin <svillar@igalia.com> [css-flexbox] Don't include scrollbar extents when computing sizes for percentage resolution https://bugs.webkit.org/show_bug.cgi?id=213739 Reviewed by Javier Fernandez. Content override sizes do include scrollbars so they must be substracted when using the override size to compute percentages. * rendering/RenderFlexibleBox.cpp: (WebCore::RenderFlexibleBox::crossSizeForPercentageResolution): Remove scrollbars. (WebCore::RenderFlexibleBox::mainSizeForPercentageResolution): Ditto. 2020-06-30 Sergio Villar Senin <svillar@igalia.com> [css-flex] Remove death code paths when evaluating percentage resolution https://bugs.webkit.org/show_bug.cgi?id=213809 Reviewed by Manuel Rego Casasnovas. Both crossSizeForPercentageResolution() and mainSizeForPercentageResolution() are only called from childLogicalHeightForPercentageResolution(). The former is called whenever hasOrthogonalFlow(child) is false and the latter when it's true. However crossSizeForPercentageResolution() has a path for hasOrthogonalFlow(child)==true which is impossible to reach. The same happens to mainSizeForPercentageResolution() which has a path for hasOrthogonalFlow(child)==false which is also impossible to reach. Remove both death code paths and replace them by assertions. We're also making both methods private since are not meant to be used from the outside. * rendering/RenderFlexibleBox.cpp: (WebCore::RenderFlexibleBox::crossSizeForPercentageResolution): Remove death code path. (WebCore::RenderFlexibleBox::mainSizeForPercentageResolution): Ditto. * rendering/RenderFlexibleBox.h: Make both calls private. 2020-06-30 Sam Weinig <weinig@apple.com> Split Color serialization out of Color classes https://bugs.webkit.org/show_bug.cgi?id=213820 Reviewed by Darin Adler. Move all color serialization related functions out of the Color family of classes, and into a standalone ColorSerialization.h Now all color serialization calls one of the following three functions, depending on need: - serializationForCSS(...) - serializationForHTML(...) - serializationForRenderTreeAsText(...) These are overload for all three Color classes (Color, SimpleColor and ExtendedColor) to allow easy use without necessarily needing to construct another type. * Headers.cmake: * Sources.txt: * WebCore.xcodeproj/project.pbxproj: Add new files. * css/CSSPrimitiveValue.cpp: (WebCore::CSSPrimitiveValue::formatNumberForCustomCSSText const): * editing/EditingStyle.cpp: (WebCore::EditingStyle::inverseTransformColorIfNeeded): (WebCore::StyleChange::extractTextStyles): * editing/cocoa/DataDetection.mm: (WebCore::DataDetection::detectContentInRange): * html/ColorInputType.cpp: (WebCore::ColorInputType::didChooseColor): * html/canvas/CanvasRenderingContext2DBase.cpp: (WebCore::CanvasRenderingContext2DBase::shadowColor const): * html/canvas/CanvasStyle.h: (WebCore::CanvasStyle::color const): * html/track/TextTrackCueGeneric.cpp: (WebCore::TextTrackCueGenericBoxElement::applyCSSProperties): (WebCore::TextTrackCueGeneric::toJSON const): * inspector/InspectorCanvas.cpp: (WebCore::InspectorCanvas::buildArrayForCanvasGradient): * page/CaptionUserPreferencesMediaAF.cpp: (WebCore::CaptionUserPreferencesMediaAF::colorPropertyCSS const): * page/DragController.cpp: (WebCore::DragController::concludeEditDrag): (WebCore::DragController::insertDroppedImagePlaceholdersAtCaret): * platform/graphics/Color.cpp: (WebCore::operator<<): (WebCore::Color::serialized const): Deleted. (WebCore::Color::cssText const): Deleted. (WebCore::Color::nameForRenderTreeAsText const): Deleted. * platform/graphics/Color.h: * platform/graphics/ColorSerialization.cpp: Added. (WebCore::decimalDigit): (WebCore::fractionDigitsForFractionalAlphaValue): (WebCore::serializationForCSS): (WebCore::serializationForHTML): (WebCore::serializationForRenderTreeAsText): (WebCore::serialization): * platform/graphics/ColorSerialization.h: Added. * platform/graphics/ExtendedColor.cpp: (WebCore::ExtendedColor::cssText const): Deleted. * platform/graphics/ExtendedColor.h: * platform/graphics/GraphicsLayer.cpp: (WebCore::GraphicsLayer::dumpProperties const): * platform/graphics/InbandGenericCue.cpp: (WebCore::InbandGenericCue::toJSONString const): * platform/graphics/SimpleColor.cpp: (WebCore::SimpleColor::serializationForHTML const): Deleted. (WebCore::decimalDigit): Deleted. (WebCore::fractionDigitsForFractionalAlphaValue): Deleted. (WebCore::SimpleColor::serializationForCSS const): Deleted. (WebCore::SimpleColor::serializationForRenderTreeAsText const): Deleted. * platform/graphics/SimpleColor.h: * platform/graphics/filters/FEDropShadow.cpp: (WebCore::FEDropShadow::externalRepresentation const): * platform/graphics/filters/FEFlood.cpp: (WebCore::FEFlood::externalRepresentation const): * rendering/RenderTreeAsText.cpp: (WebCore::RenderTreeAsText::writeRenderObject): * rendering/svg/SVGRenderTreeAsText.cpp: (WebCore::writeRenderSVGTextBox): * svg/properties/SVGPropertyTraits.h: (WebCore::SVGPropertyTraits<Color>::toString): * testing/Internals.cpp: (WebCore::Internals::viewBaseBackgroundColor): (WebCore::Internals::highlightPseudoElementColor): (WebCore::Internals::systemColorForCSSValue): (WebCore::Internals::focusRingColor): Adopt new serialization functions. 2020-06-30 Fujii Hironori <Hironori.Fujii@sony.com> [WinCairo] Unreviewed build fix after r263776 > WebCore\platform\graphics\ColorUtilities.h(67): error C2039: 'lround': is not a member of 'std' * platform/graphics/ColorUtilities.h: Include <cmath> for std::lround. 2020-06-30 Andres Gonzalez <andresg_22@apple.com> Code cleanup in AccessibilityMenuList.cpp and AXIsolatedTree.h. https://bugs.webkit.org/show_bug.cgi?id=213806 Reviewed by Darin Adler. No change in functionality. Minor code cleanup pointed out by Darin Adler in reviews for bug 209169 and bug 213575. * accessibility/AccessibilityMenuList.cpp: (WebCore::AccessibilityMenuList::isCollapsed const): * accessibility/isolatedtree/AXIsolatedTree.h: 2020-06-30 Sam Weinig <weinig@apple.com> Move Color blending related functions to their own files https://bugs.webkit.org/show_bug.cgi?id=213742 Reviewed by Dean Jackson. - Moves Color::blend(const Color&), Color::blendWithWhite(), blend(const Color&, const Color&, double) and blendWithoutPremultiply(const Color&, const Color&, double) to their own files: ColorBlending.h/cpp - Renames Color::blend(const Color&) to blendSourceOver(const Color&, const Color&) - Renames Color::blendWithWhite() to blendWithWhite(const Color&). * Sources.txt: * WebCore.xcodeproj/project.pbxproj: Add new files. * platform/graphics/Color.cpp: (WebCore::Color::blend const): Deleted. (WebCore::Color::blendWithWhite const): Deleted. (WebCore::blend): Deleted. (WebCore::blendWithoutPremultiply): Deleted. * platform/graphics/Color.h: * platform/graphics/ColorBlending.cpp: Copied from Source/WebCore/platform/graphics/Color.cpp. * platform/graphics/ColorBlending.h: Added. Move declarations / implementations from Color.h/cpp to ColorBlending.h/cpp. * css/CSSGradientValue.cpp: * editing/FrameSelection.cpp: (WebCore::CaretBase::computeCaretColor): * page/FrameView.cpp: (WebCore::FrameView::documentBackgroundColor const): * page/TextIndicator.cpp: (WebCore::estimatedBackgroundColorForRange): * page/animation/CSSPropertyAnimation.cpp: * platform/graphics/filters/FilterOperation.cpp: * rendering/RenderBoxModelObject.cpp: (WebCore::RenderBoxModelObject::paintFillLayerExtended): * rendering/RenderMenuList.cpp: (RenderMenuList::getItemBackgroundColor const): * rendering/RenderTheme.cpp: (WebCore::RenderTheme::transformSelectionBackgroundColor const): Update for new signatures and #include ColorBlending.h as neeeded. 2020-06-30 Sam Weinig <weinig@apple.com> Rename ManifestParser.h/cpp to ApplicationCacheManifestParser.h/cpp to make it clear its not the ApplicationManifestParser (a different thing entirely) https://bugs.webkit.org/show_bug.cgi?id=213815 Reviewed by Darin Adler. * Sources.txt: * WebCore.xcodeproj/project.pbxproj: * loader/appcache/ApplicationCacheGroup.cpp: * loader/appcache/ApplicationCacheManifestParser.cpp: Copied from Source/WebCore/loader/appcache/ManifestParser.cpp. * loader/appcache/ApplicationCacheManifestParser.h: Copied from Source/WebCore/loader/appcache/ManifestParser.h. * loader/appcache/ManifestParser.cpp: Removed. * loader/appcache/ManifestParser.h: Removed. 2020-06-30 Brady Eidson <beidson@apple.com> App-bound JavaScript and Navigation failures should have specific error codes. <rdar://problem/64940268> and https://bugs.webkit.org/show_bug.cgi?id=213808 Reviewed by Tim Hatcher. (Informally by Kate Cheney) Covered by API tests. * bindings/js/ExceptionDetails.h: 2020-06-30 Mark Lam <mark.lam@apple.com> Add handling for a case of OOME in CSSTokenizer and CSSParser. https://bugs.webkit.org/show_bug.cgi?id=213702 <rdar://problem/64808889> Reviewed by Darin Adler. We add a bool* constructionSuccess feedback argument to the private CSSTokenizer constructor. If construction fails and constructionSuccess is provided, the constructor will set *constructionSuccess to false. If construction fails and constructionSuccess is not provided, the constructor will crash with a failed RELEASE_ASSERT. In other words, the client may opt in to handle the failure to construct if it doesn't want the default behavior of crashing on failure. We also provide 2 convenience factory methods for CSSTokenizer which will return a null std::unique_ptr<CSSTokenizer> if construction fails. This is currently only used by CSSParserImpl, and ensures that its m_tokenizer is null if we fail to construct. This ensures that there isn't a pointer to a partially constructed tokenizer that some code may unknowingly use. The reason we don't force all clients of CSSTokenizer to use the factory methods instead is because there are clients that currently use on-stack instantiations of CSSTokenizer to do their work. We don't want to force them to switch to using a malloc instance. Currently, the constructors used by those clients do not provide a constructionSuccess argument to the underlying private constructor. Hence, for them, the CSSTokenizer constructor will crash if construction fails, which is how things work in pre-existing code. The only difference is that the crash is deferred till the client attempts to use the tokenizer instead of at construction time. As of this patch, only CSSParser::parseSupportsCondition() makes use of the new feedback mechanism, and handles OOME during CSSTokenizer construction by interpreting it as CSS not supporting the passed in condition string. Test: css3/out-of-memory-in-css-tokenizer.html * css/parser/CSSParser.cpp: (WebCore::CSSParser::parseSupportsCondition): * css/parser/CSSParserImpl.cpp: (WebCore::CSSParserImpl::CSSParserImpl): (WebCore::CSSParserImpl::failed const): * css/parser/CSSParserImpl.h: * css/parser/CSSTokenizer.cpp: (WebCore::CSSTokenizer::CSSTokenizer): * css/parser/CSSTokenizer.h: (WebCore::CSSTokenizer::failed const): 2020-06-30 Peng Liu <peng.liu6@apple.com> Enable the support of FULLSCREEN_API in WebKitTestRunner https://bugs.webkit.org/show_bug.cgi?id=213774 Reviewed by Youenn Fablet. Replace the definition of ENABLE_FULLSCREEN_API in FeatureDefines.xcconfig with the one in PlatformEnableCocoa.h. We have to do that because WebKitTestRunner does not have a FeatureDefines.xcconfig but it uses "ENABLE(FULLSCREEN_API)" to conditionally compile code to test the element fullscreen API. WebKitTestRunner can use the macro defined in PlatformEnableCocoa.h. * Configurations/FeatureDefines.xcconfig: 2020-06-30 Daniel Bates <dabates@apple.com> [iOS] Editable regions causes ~1% slowdown in PLT5 https://bugs.webkit.org/show_bug.cgi?id=213659 <rdar://problem/64361390> Reviewed by Simon Fraser. Fix the slowdown by only enabling editable region when Page::editableElementsInRect is called. There are two parts that make computing the editable region expensive: 1. Requires traversing descendents during painting when a normal paint may be able to avoid this. 2. Can cause more event region invalidations because it extends the invalidation criterion to include changes to element editability. Tests: editing/editable-region/hit-test-basic-without-editable-region.html editing/editable-region/iframe-without-editable-region.html editing/editable-region/text-field-basic-without-editable-region.html Tests: editing/editable-region/hit-test-basic-without-editable-region.html editing/editable-region/iframe-without-editable-region.html editing/editable-region/text-field-basic-without-editable-region.html * page/Frame.cpp: (WebCore::Frame::invalidateContentEventRegionsIfNeeded): Check if editable region is enabled. If it is then do what we do now. Otherwise, don't invalidate the region unless we were going to do so anyway. * page/Page.cpp: (WebCore::Page::setEditableRegionEnabled): Added. Update state and then invalidate the event region in all layers. (WebCore::Page::shouldBuildEditableRegion const): Added. Returns whether to build the editable region: either when Page::isEditableRegionEnabled() is true or the editable region debug overlay is enabled. (WebCore::Page::didFinishLoad): Turn off editable region as it may not be needed on the new page. * page/Page.h: (WebCore::Page::isEditableRegionEnabled const): Added. * rendering/EventRegion.cpp: (WebCore::EventRegion::unite): (WebCore::EventRegion::translate): (WebCore::EventRegion::containsEditableElementsInRect const): (WebCore::EventRegion::dump const): * rendering/EventRegion.h: (WebCore::EventRegion::hasEditableRegion const): (WebCore::EventRegion::rectsForEditableElements const): (WebCore::EventRegion::decode): (WebCore::EventRegion::ensureEditableRegion): The editable region is now an Optional<>. There will only be one if ensureEditableRegion was called, which is only when Page::isEditableRegionEnabled() returns true. * rendering/RenderBlock.cpp: (WebCore::RenderBlock::paintObject): * rendering/RenderElement.cpp: (WebCore::RenderElement::styleWillChange): * rendering/RenderLayer.h: * rendering/RenderLayerBacking.cpp: (WebCore::RenderLayerBacking::maintainsEventRegion const): Only do what we do now if Page::shouldBuildEditableRegion() returns true. (WebCore::RenderLayerBacking::updateEventRegion): Instantiate the editable region, if needed. Painting will then populate it. * rendering/RenderLayerCompositor.cpp: (WebCore::RenderLayerCompositor::applyToCompositedLayerIncludingDescendants): Added. (WebCore::RenderLayerCompositor::invalidateEventRegionForAllLayers): Added. (WebCore::RenderLayerCompositor::clearBackingForAllLayers): Wrote in terms of applyToCompositedLayerIncludingDescendants. (WebCore::RenderLayerCompositor::clearBackingForLayerIncludingDescendants): Deleted. * rendering/RenderLayerCompositor.h: * testing/InternalSettings.cpp: (WebCore::InternalSettings::setEditableRegionEnabled): * testing/InternalSettings.h: * testing/InternalSettings.idl: Add a new internal setting for testing purposes to toggle enabling/disabling editable region. 2020-06-30 Peng Liu <peng.liu6@apple.com> Scrunching a video to PiP can result in broken animation and leave Safari in a bad state https://bugs.webkit.org/show_bug.cgi?id=213175 Reviewed by Jer Noble. * html/HTMLMediaElement.cpp: (WebCore::HTMLMediaElement::setVideoFullscreenStandby): (WebCore::HTMLMediaElement::setVideoFullscreenStandby): The "standby" state is relevant to a video element only when its presentation mode is VideoFullscreenModeNone. * platform/ios/VideoFullscreenInterfaceAVKit.h: * platform/ios/VideoFullscreenInterfaceAVKit.mm: (VideoFullscreenInterfaceAVKit::exitFullscreen): (VideoFullscreenInterfaceAVKit::cleanupFullscreen): Add a flag m_enteringPictureInPicture. Function exitFullscreen() and cleanupFullscreen() will check m_enteringPictureInPicture and they will abort the process to exit fullscreen/picture-in-picture if the flag is true. However, VideoFullscreenManager will retry to exit fullscreen/picture-in-picture after it confirms that the previous starting picture-in-picture process is completed. (VideoFullscreenInterfaceAVKit::willStartPictureInPicture): Set the flag m_enteringPictureInPicture. (VideoFullscreenInterfaceAVKit::didStartPictureInPicture): Call m_fullscreenChangeObserver->didEnterFullscreen() if the entering picture-in-picture process is started by the UI process (e.g., swipe-up gesture). Clear m_standby and m_enteringPictureInPicture after the video element enters picture-in-picture. 2020-06-30 Alex Christensen <achristensen@webkit.org> Remove WTF::MD5 https://bugs.webkit.org/show_bug.cgi?id=213766 Reviewed by Youenn Fablet. * Modules/websockets/WebSocketHandshake.cpp: * platform/network/curl/CurlCacheEntry.cpp: (WebCore::CurlCacheEntry::generateBaseFilename): 2020-06-30 Youenn Fablet <youenn@apple.com> Set runtime flag m_isWebRTCPlatformCodecsInGPUProcessEnabled to false by default https://bugs.webkit.org/show_bug.cgi?id=213779 Reviewed by Alex Christensen. No change of behavior since this flag is WebKit 2 only and off by default. Move off by default WebRTC flags at the end of the section. * page/RuntimeEnabledFeatures.h: 2020-06-30 Jason Lawrence <lawrence.j@apple.com> Unreviewed, reverting r263753. This commit caused build failures across multiple platforms. Reverted changeset: "Move Color blending related functions to their own files" https://bugs.webkit.org/show_bug.cgi?id=213742 https://trac.webkit.org/changeset/263753 2020-06-30 Sam Weinig <weinig@apple.com> Move Color blending related functions to their own files https://bugs.webkit.org/show_bug.cgi?id=213742 Reviewed by Dean Jackson. - Moves Color::blend(const Color&), Color::blendWithWhite(), blend(const Color&, const Color&, double) and blendWithoutPremultiply(const Color&, const Color&, double) to their own files: ColorBlending.h/cpp - Renames Color::blend(const Color&) to blendSourceOver(const Color&, const Color&) - Renames Color::blendWithWhite() to blendWithWhite(const Color&). * Sources.txt: * WebCore.xcodeproj/project.pbxproj: Add new files. * platform/graphics/Color.cpp: (WebCore::Color::blend const): Deleted. (WebCore::Color::blendWithWhite const): Deleted. (WebCore::blend): Deleted. (WebCore::blendWithoutPremultiply): Deleted. * platform/graphics/Color.h: * platform/graphics/ColorBlending.cpp: Copied from Source/WebCore/platform/graphics/Color.cpp. * platform/graphics/ColorBlending.h: Added. Move declarations / implementations from Color.h/cpp to ColorBlending.h/cpp. * css/CSSGradientValue.cpp: * editing/FrameSelection.cpp: (WebCore::CaretBase::computeCaretColor): * page/FrameView.cpp: (WebCore::FrameView::documentBackgroundColor const): * page/TextIndicator.cpp: (WebCore::estimatedBackgroundColorForRange): * page/animation/CSSPropertyAnimation.cpp: * platform/graphics/filters/FilterOperation.cpp: * rendering/RenderBoxModelObject.cpp: (WebCore::RenderBoxModelObject::paintFillLayerExtended): * rendering/RenderMenuList.cpp: (RenderMenuList::getItemBackgroundColor const): * rendering/RenderTheme.cpp: (WebCore::RenderTheme::transformSelectionBackgroundColor const): Update for new signatures and #include ColorBlending.h as neeeded. 2020-06-30 Andy Estes <aestes@apple.com> [Xcode] Enable the "My Mac (Mac Catalyst)" destination in WebKit Xcode projects https://bugs.webkit.org/show_bug.cgi?id=213740 Reviewed by Darin Adler. * Configurations/Base.xcconfig: Set SUPPORTS_MACCATALYST to YES to tell Xcode that this project supports building for Mac Catalyst. 2020-06-30 Michael Catanzaro <mcatanzaro@gnome.org> [WPE][GTK] Update stale comment in UserAgentGLib.cpp https://bugs.webkit.org/show_bug.cgi?id=213749 Reviewed by Adrian Perez de Castro. Remove outdated comment. * platform/glib/UserAgentGLib.cpp: (WebCore::platformVersionForUAString): 2020-06-30 Youenn Fablet <youenn@apple.com> Add VP9 WebRTC codec runtime flag https://bugs.webkit.org/show_bug.cgi?id=213724 Reviewed by Eric Carlson. Add binding code to switch on/off VP9 in WebRTC factories based on runtime flag. Test: webrtc/vp9.html * page/Page.cpp: (WebCore::m_shouldRelaxThirdPartyCookieBlocking): * page/RuntimeEnabledFeatures.h: (WebCore::RuntimeEnabledFeatures::webRTCVP9CodecEnabled const): (WebCore::RuntimeEnabledFeatures::setWebRTCVP9CodecEnabled): * platform/mediastream/libwebrtc/LibWebRTCProvider.h: * platform/mediastream/libwebrtc/LibWebRTCProviderCocoa.cpp: (WebCore::LibWebRTCProviderCocoa::createDecoderFactory): (WebCore::LibWebRTCProviderCocoa::createEncoderFactory): * testing/Internals.cpp: (WebCore::Internals::setWebRTCH265Support): (WebCore::Internals::setWebRTCVP9Support): * testing/Internals.h: * testing/Internals.idl: 2020-06-29 Antoine Quint <graouts@webkit.org> [Web Animations] REGRESSION: Bootstrap Carousel component v4.1 regressed with Web Animations https://bugs.webkit.org/show_bug.cgi?id=213376 <rdar://problem/64531242> Reviewed by Dean Jackson. An older version of the Bootstrap CSS and JS library had a rather odd way to implement a completion callback for a transition: it would register a "transitionend" event but also set a timeout of the transition's duration and use whichever came first as a callback to run completion tasks for the transition. Additionally, in that callback, it would set the transitioned value to the same computed value but using a different specified value, for instance setting the "transform" CSS property to "translateX(0)" instead of "translateY(0)". In our implementation this would make the completed transition repeat. Indeed, we would first incorrectly assume that the transition was still "running" and not "finished", per the CSS Transitions spec terminology as we only update that status when we update animations under Page::updateRendering(). We now update an existing transition's status first in AnimationTimeline::updateCSSTransitionsForElementAndProperty(). Another issue is that when we considered the existing transition to be running, even though it was finished, we would use the "timeline time at creation" to compute its current progress, which would yield situations where we computed the before-change style to be the existing transition's current computed value, except that transition's progress was 0 since the "timeline time at creation" happens before the transition's resolved start time. We now only use the "timeline time at creation" in the situations it was designed to be used: either when the transition has not yet had a resolved start time, or its resolved start time is the current timeline time (ie. it was just set). To be able to compare the transition's resolved start time and the current timeline time, we also updated the internal start time getter and setter methods to use Seconds instead of double which is only needed for the JS bindings. Test: webanimations/css-transition-retargeting-to-same-value-upon-completion-with-timeout.html * animation/AnimationTimeline.cpp: (WebCore::AnimationTimeline::updateCSSTransitionsForElementAndProperty): * animation/DeclarativeAnimation.cpp: (WebCore::DeclarativeAnimation::bindingsStartTime const): (WebCore::DeclarativeAnimation::setBindingsStartTime): * animation/WebAnimation.cpp: (WebCore::WebAnimation::bindingsStartTime const): (WebCore::WebAnimation::setBindingsStartTime): (WebCore::WebAnimation::setStartTime): (WebCore::WebAnimation::startTime const): Deleted. * animation/WebAnimation.h: (WebCore::WebAnimation::startTime const): (WebCore::WebAnimation::bindingsStartTime const): Deleted. 2020-06-29 Brady Eidson <beidson@apple.com> JavaScript cannot be injected into iframes <rdar://problem/54168946> and https://bugs.webkit.org/show_bug.cgi?id=213556 Reviewed by Geoff Garen. Covered by API tests. * bindings/js/ExceptionDetails.h: Start a collection of "exception types" that will grow quickly, beginning with the specialized "missing frame" type. 2020-06-29 Sam Weinig <weinig@apple.com> Convert AppCache manifest parser over to using StringParsingBuffer https://bugs.webkit.org/show_bug.cgi?id=213680 Reviewed by Darin Adler. - Renames parseManifest to parseApplicationCacheManifest to differentiate between the manifest for the application cache and the "application manifest", which is a different thing entirely. Also renames the container struct from being called Manifest to ApplicationCacheManifest. (The file should be renamed as well, but will do that in a seperate pass). - Update parser to return an Optional<ApplicationCacheManifest> rather than using bool + out parameter. - Adopt readCharactersForParsing to replace unnecessary call to StringView::upconvertedCharacters(). - Adopt StringParsingBuffer and ParsingUtilities along with some refinements to the code to make the intent more clear. * html/parser/ParsingUtilities.h: (WebCore::skipUntil): Fix formatting, putting the whole signature on one line. * loader/appcache/ApplicationCacheGroup.cpp: (WebCore::ApplicationCacheGroup::didFinishLoadingManifest): Update for new parser function name and Optional return type. * loader/appcache/ManifestParser.cpp: (WebCore::isManifestWhitespace): (WebCore::isManifestNewline): (WebCore::isManifestWhitespaceOrNewline): (WebCore::makeManifestURL): (WebCore::parseApplicationCacheManifest): * loader/appcache/ManifestParser.h: Update parsing logic to use readCharactersForParsing (to avoid upconvesion) and rework using StringParsingBuffer/ParsingUtilities to make things more clear. 2020-06-29 Zalan Bujtas <zalan@apple.com> [LFC][TFC] Adjust baseline when the table cell itself establishes an IFC https://bugs.webkit.org/show_bug.cgi?id=213735 Reviewed by Antti Koivisto. Test: fast/layoutformattingcontext/table-cell-baseline-offset-simple2.html * layout/tableformatting/TableFormattingContextGeometry.cpp: (WebCore::Layout::TableFormattingContext::Geometry::usedBaselineForCell): 2020-06-29 Zalan Bujtas <zalan@apple.com> [LFC][TFC] Adjust baseline offset for continuation https://bugs.webkit.org/show_bug.cgi?id=213732 Reviewed by Antti Koivisto. Skip empty IFC generated for the "pre" part of the continuation (e.g. <span><div>text content</div></span>). Test: fast/layoutformattingcontext/table-cell-baseline-offset-simple.html * layout/tableformatting/TableFormattingContextGeometry.cpp: (WebCore::Layout::TableFormattingContext::Geometry::usedBaselineForCell): 2020-06-29 Guowei Yang <guowei_yang@apple.com> Adding Experimental Feature Flags for CoreImage backed SVG/CSS Filters https://bugs.webkit.org/show_bug.cgi?id=213578 Reviewed by Darin Adler, Simon Fraser, Myles C. Maxfield. Preparing to implement CoreImage backed filter rendering Needs Compiler guards and experimental feature guard. No tests are required because this is just a feature flag set up * page/Settings.yaml: added default settings for the feature flag. Default value of the feature switch is off 2020-06-29 Stephan Szabo <stephan.szabo@sony.com> Fix build when !ENABLE(ACCESSIBILITY) after r263673 https://bugs.webkit.org/show_bug.cgi?id=213759 Reviewed by Chris Fleizach. No new tests, build fix. * accessibility/AXObjectCache.h: 2020-06-29 Sam Weinig <weinig@apple.com> Simplify Color's interface by removing isDark() https://bugs.webkit.org/show_bug.cgi?id=213707 Reviewed by Darin Adler. - Move Color::isDark to RenderThemeIOS.mm, its one client and rename it to useConvexGradient() to indicate what it is actually determining. * platform/graphics/Color.cpp: (WebCore::Color::isDark const): Deleted. * platform/graphics/Color.h: * rendering/RenderThemeIOS.mm: (WebCore::useConvexGradient): (WebCore::RenderThemeIOS::paintPushButtonDecorations): (WebCore::RenderThemeIOS::paintFileUploadIconDecorations): 2020-06-29 Peng Liu <peng.liu6@apple.com> Video spills over PiP screen a little when using Picture in Picture https://bugs.webkit.org/show_bug.cgi?id=213658 Reviewed by Eric Carlson. We need to provide video content dimensions instead of video element sizes to AVPlayerController to make sure that the Picture-in-Picture window will have the correct aspect ratio. Test: media/picture-in-picture/picture-in-picture-window-aspect-ratio.html * platform/ios/VideoFullscreenInterfaceAVKit.h: * platform/ios/VideoFullscreenInterfaceAVKit.mm: (VideoFullscreenInterfaceAVKit::setupFullscreen): * platform/ios/WebVideoFullscreenControllerAVKit.mm: (VideoFullscreenControllerContext::setUpFullscreen): 2020-06-29 Tetsuharu Ohzeki <tetsuharu.ohzeki@gmail.com> Remove ENABLE_STREAMS_API compilation flag https://bugs.webkit.org/show_bug.cgi?id=213728 Reviewed by Sam Weinig. * Configurations/FeatureDefines.xcconfig: * Modules/fetch/FetchBody.cpp: * Modules/fetch/FetchBody.h: * Modules/fetch/FetchBodyOwner.cpp: (WebCore::FetchBodyOwner::isDisturbed const): (WebCore::FetchBodyOwner::isDisturbedOrLocked const): (WebCore::FetchBodyOwner::blobLoadingSucceeded): (WebCore::FetchBodyOwner::blobLoadingFailed): (WebCore::FetchBodyOwner::blobChunk): * Modules/fetch/FetchBodyOwner.h: (WebCore::FetchBodyOwner::cancel): * Modules/fetch/FetchBodySource.cpp: * Modules/fetch/FetchBodySource.h: * Modules/fetch/FetchResponse.cpp: (WebCore::FetchResponse::BodyLoader::didSucceed): (WebCore::FetchResponse::BodyLoader::didFail): (WebCore::FetchResponse::BodyLoader::didReceiveData): * Modules/fetch/FetchResponse.h: * Modules/streams/ByteLengthQueuingStrategy.idl: * Modules/streams/ByteLengthQueuingStrategy.js: * Modules/streams/CountQueuingStrategy.idl: * Modules/streams/CountQueuingStrategy.js: * Modules/streams/ReadableByteStreamController.idl: * Modules/streams/ReadableByteStreamController.js: * Modules/streams/ReadableByteStreamInternals.js: * Modules/streams/ReadableStream.idl: * Modules/streams/ReadableStream.js: * Modules/streams/ReadableStreamBYOBReader.idl: * Modules/streams/ReadableStreamBYOBReader.js: * Modules/streams/ReadableStreamBYOBRequest.idl: * Modules/streams/ReadableStreamBYOBRequest.js: * Modules/streams/ReadableStreamDefaultController.idl: * Modules/streams/ReadableStreamDefaultController.js: * Modules/streams/ReadableStreamDefaultReader.idl: * Modules/streams/ReadableStreamDefaultReader.js: * Modules/streams/ReadableStreamInternals.js: * Modules/streams/ReadableStreamSink.cpp: * Modules/streams/ReadableStreamSink.h: * Modules/streams/ReadableStreamSink.idl: * Modules/streams/ReadableStreamSource.cpp: * Modules/streams/ReadableStreamSource.h: * Modules/streams/ReadableStreamSource.idl: * Modules/streams/StreamInternals.js: * Modules/streams/WritableStream.idl: * Modules/streams/WritableStream.js: * Modules/streams/WritableStreamInternals.js: * bindings/js/JSDOMGlobalObject.cpp: (WebCore::isReadableByteStreamAPIEnabled): (WebCore::JSDOMGlobalObject::addBuiltinGlobals): * bindings/js/JSReadableStreamSourceCustom.cpp: * bindings/js/ReadableStreamDefaultController.cpp: * bindings/js/ReadableStreamDefaultController.h: * page/RuntimeEnabledFeatures.h: (WebCore::RuntimeEnabledFeatures::writableStreamAPIEnabled const): * testing/Internals.cpp: * testing/Internals.h: * testing/Internals.idl: 2020-06-29 Sam Weinig <weinig@apple.com> Remove remaining makeSimpleColorFrom* variants https://bugs.webkit.org/show_bug.cgi?id=213706 Reviewed by Darin Adler. Removed makeSimpleColorFromFloats and makeSimpleColorFromCMYKA. - Updated callers that need to pass floats to use makeSimpleColor(SRGBA { ... }); - Updated callers that don't need to pass floats, mostly compile time constant SimpleColors to use makeSimpleColor(...), passing in 0-255 based component values. - Updated callers of makeSimpleColorFromCMYKA to use makeSimpleColor(toSRGBA(CMYKA { ... })). This required adding CMYKA type to ColorTypes.h and moving conversion SRGBA to ColorUtilities with the other color conversion code. - Added deduction guides for color types to allow component type deduction. This allows us to write: function(SRGBA { redFloat, greenFloat, blueFloat, alphaFloat }) reather than the more cumbersome: function(SRGBA<float> { redFloat, greenFloat, blueFloat, alphaFloat }) - Added operator==/operator!= for each color type. Only used by CMYKA at the moment, but generally useful, so added for all of them. For all types convertable to ColorComponents, the implementation uses the conversion to ColorComponents to avoid redundancy. * html/canvas/CanvasRenderingContext2DBase.cpp: (WebCore::CanvasRenderingContext2DBase::setStrokeColor): (WebCore::CanvasRenderingContext2DBase::setFillColor): Update to call new typed color based CanvasStyle functions. (WebCore::CanvasRenderingContext2DBase::setShadow): Use makeSimpleColor rather than makeSimpleColorFromFloats/makeSimpleColorFromCMYKA. * html/canvas/CanvasStyle.cpp: (WebCore::CanvasStyle::CanvasStyle): Replace constructors taking raw floats with ones taking typed colors (SRGBA<float>/CMYKA<float>) to make it more clear what the parameters mean. (WebCore::CanvasStyle::isEquivalentColor const): Compare the cmyka components using new operator== implementation for CMYKA<float>. (WebCore::CanvasStyle::isEquivalent const): (WebCore::CanvasStyle::isEquivalentRGBA const): Deleted. (WebCore::CanvasStyle::isEquivalentCMYKA const): Deleted. Replace isEquivalentRGBA/isEquivalentCMYKA with overloaded isEquivalent. (WebCore::CanvasStyle::applyStrokeColor const): (WebCore::CanvasStyle::applyFillColor const): Update for new names of CMYKA members. * html/canvas/CanvasStyle.h: Use SRGBA<float> and CMYKA<float> to simplify interfaces * page/DebugPageOverlays.cpp: * page/linux/ResourceUsageOverlayLinux.cpp: (WebCore::ResourceUsageOverlay::platformInitialize): Use makeSimpleColor rather than makeSimpleColorFromFloats, allowing for constant expression creation of SimpleColors. * platform/graphics/Color.cpp: (WebCore::Color::lightened const): (WebCore::Color::darkened const): Use makeSimpleColor(SRGBA { ... }) rather than makeSimpleColorFromFloats. (WebCore::Color::luminance const): Fix comment. (WebCore::blendWithoutPremultiply): Use makeSimpleColor(...) rather than makeSimpleColorFromFloats. * platform/graphics/ColorTypes.h: (WebCore::operator==): (WebCore::operator!=): - Add deduction guides and operator==/operator!= for each color type. - Add CMYKA type. No conversion to ColorComponents yet, as ColorComponents only works with 4 component colors, not ones with 5 like CMYKA. * platform/graphics/ColorUtilities.cpp: (WebCore::toSRGBA): Move conversion from CMYKA to SRGBA from makeSimpleColorFromCMYKA to here. * platform/graphics/ColorUtilities.h: (WebCore::convertPrescaledToComponentByte): (WebCore::convertToComponentByte): Use std::round rather than std::lroundf, since it will have the same result and it reads nicer. * platform/graphics/SimpleColor.cpp: (WebCore::makeSimpleColorFromCMYKA): Deleted. * platform/graphics/SimpleColor.h: (WebCore::makeSimpleColor): (WebCore::makeSimpleColorFromFloats): Deleted. - Removed makeSimpleColorFromFloats and makeSimpleColorFromCMYKA. - Added constexpr overload of makeSimpleColor taking a const SRGBA<uint8_t>&. - Fixed forward declaration of makeSimpleColor that was taking ColorComponents to actually take an SRGBA<float>, which is what the inline implementation actually takes. * platform/graphics/avfoundation/InbandTextTrackPrivateAVF.cpp: (WebCore::makeSimpleColorFromARGBCFArray): * platform/graphics/cairo/GradientCairo.cpp: (WebCore::interpolateColorStop): * platform/graphics/cg/ColorCG.cpp: (WebCore::makeSimpleColorFromCGColor): * platform/graphics/win/PlatformContextDirect2D.cpp: (WebCore::PlatformContextDirect2D::brushWithColor): Use makeSimpleColor(SRGBA { ... }) rather than makeSimpleColorFromFloats. * platform/graphics/mac/ColorMac.mm: (WebCore::makeSimpleColorFromNSColor): * platform/ios/ColorIOS.mm: (WebCore::colorFromUIColor): Use makeSimpleColor(SRGBA { ... }) rather than makeSimpleColorFromFloats. Casting to float is needed, as the input types are CGFloat which is double in 64-bit environments and won't automatically narrow with the new types. * platform/ios/LegacyTileCache.mm: (WebCore::LegacyTileCache::colorForGridTileBorder const): * rendering/RenderLayer.cpp: (WebCore::RenderLayer::beginTransparencyLayers): Use makeSimpleColor rather than makeSimpleColorFromFloats, allowing for constant expression creation of SimpleColors. * rendering/RenderThemeIOS.mm: (WebCore::RenderThemeIOS::paintCheckboxDecorations): (WebCore::RenderThemeIOS::paintRadioDecorations): (WebCore::RenderThemeIOS::paintMenuListButtonDecorations): (WebCore::RenderThemeIOS::paintSystemPreviewBadge): Use Color::black/Color::white.colorWithAlpha(...) rather than makeSimpleColorFromFloats, allowing for constant expression creation of SimpleColors. 2020-06-29 Chris Fleizach <cfleizach@apple.com> AX: aria-modal nodes wrapped in aria-hidden are not honored https://bugs.webkit.org/show_bug.cgi?id=212849 <rdar://problem/64047019> Reviewed by Zalan Bujtas. Test: accessibility/aria-modal-in-aria-hidden.html If aria-modal was wrapped inside aria-hidden, we were still processing that as the modal node. Fixing that uncovered a host of very finicky issues related to aria-modal. 1. We were processing modal status immediately instead of after a delay, so visibility requirements were not correct. 2. In handleModalChange: We were processing multiple modal nodes perhaps incorrectly (the spec doesn't account for multiple modal nodes). - had to update a test to turn off modal status before adding a new modal node 3. Changed the modal node to a WeakPtr 4. In isNodeAriaVisible: We stopped processing for visibile with aria-hidden as soon as we hit a renderable block, but that means it won't account for nodes higher in the tree with aria-hidden. 5. In handleAttributeChange: if aria-hidden changes, we should update modal status if needed. 6. In focusModalNodeTimerFired: we need to verify the element is still live, otherwise it can lead to a crash. * accessibility/AXObjectCache.cpp: (WebCore::AXObjectCache::AXObjectCache): (WebCore::AXObjectCache::findModalNodes): (WebCore::AXObjectCache::currentModalNode): (WebCore::AXObjectCache::modalNode): (WebCore::AXObjectCache::remove): (WebCore::AXObjectCache::deferModalChange): (WebCore::AXObjectCache::focusModalNodeTimerFired): (WebCore::AXObjectCache::handleAttributeChange): (WebCore::AXObjectCache::handleModalChange): (WebCore::AXObjectCache::prepareForDocumentDestruction): (WebCore::AXObjectCache::performDeferredCacheUpdate): (WebCore::isNodeAriaVisible): * accessibility/AXObjectCache.h: (WebCore::AXObjectCache::handleModalChange): (WebCore::AXObjectCache::deferModalChange): * accessibility/AccessibilityRenderObject.cpp: (WebCore::AccessibilityRenderObject::firstChild const): (WebCore::AccessibilityRenderObject::lastChild const): 2020-06-29 Youenn Fablet <youenn@apple.com> Support MediaRecorder.onstart https://bugs.webkit.org/show_bug.cgi?id=213720 Reviewed by Darin Adler. Fire start event if MediaRecorder.start is successful. Do some WebIDL clean-up, in particular change timeSlice from long to unsigned long, as per spec. Covered by added test. * Modules/mediarecorder/MediaRecorder.cpp: (WebCore::MediaRecorder::startRecording): * Modules/mediarecorder/MediaRecorder.h: * Modules/mediarecorder/MediaRecorder.idl: 2020-06-29 Chris Dumez <cdumez@apple.com> On load from back/forward cache, call checkCompleted() for ALL frames inside FrameLoader::commitProvisionalLoad() https://bugs.webkit.org/show_bug.cgi?id=213657 Reviewed by Youenn Fablet. On load from back/forward cache, call checkCompleted() for ALL frames inside FrameLoader::commitProvisionalLoad(). Previously, we were doing it for the main frame in FrameLoader::commitProvisionalLoad() and for subframes in FrameLoader::open(). Doing it all in one place results in more understandable code and is less error-prone. Note that calling checkCompleted() for subframes was new in r262221 and is covered by: fast/history/multiple-back-forward-navigations.html * loader/FrameLoader.cpp: (WebCore::FrameLoader::commitProvisionalLoad): (WebCore::FrameLoader::open): 2020-06-09 Sergio Villar Senin <svillar@igalia.com> [css-flexbox] WebKit mistakenly lets pointer events (click/hover/etc) pass through flex items, if they have negative margin https://bugs.webkit.org/show_bug.cgi?id=185771 Reviewed by Javier Fernandez. When multiple child elements of a flexbox overlap (for example, due to negative margins), the element drawn in the foreground may not actually capture the hit if the element underneath it is hit-tested despite being occluded. This is because painting of flexbox children is done in order modified document order instead of raw document order. In order to achieve this we should inspect flex items in reverse order modified document order. As the OrderIterator cannot go backwards, we cache the reverse order of items when doing the layout in order to have fast hit testing in flexbox containers. As this behaviour is different to the one implemented in RenderBlock a new virtual method to perform hit testing of children was extracted from RenderBlock:nodeAtPoint() to a new method called RenderBlock::hitTestChildren. The RenderBlock implementation is identical to the current one but flexbox containers overwrite it. Two WPT flexbox hittests are passing now thanks to this patch. * rendering/RenderBlock.cpp: (WebCore::RenderBlock::hitTestChildren): Implementation of the new virtual method extracted from nodeAtPoint. (WebCore::RenderBlock::nodeAtPoint): Moved code to hit test children to hitTestChildren() * rendering/RenderBlock.h: Added hitTestChildren new virtual method. * rendering/RenderFlexibleBox.cpp: (WebCore::RenderFlexibleBox::hitTestChildren): Implemented. (WebCore::RenderFlexibleBox::layoutFlexItems): Cache the reverse of the order iterator to be used by hit testing. * rendering/RenderFlexibleBox.h: Added hitTestChildren. 2020-06-29 Xabier Rodriguez Calvar <calvaris@igalia.com> [GStreamer] imported/w3c/web-platform-tests/encrypted-media/clearkey-mp4-playback-temporary-setMediaKeys-immediately.https.html is a flaky crash https://bugs.webkit.org/show_bug.cgi?id=213385 Reviewed by Philippe Normand. Add a way to release the decryption resources when the player private is destroyed. That way we can release the secure memory allocated by libgcrypt and allow for more tests to get, which caused the crash. Tests: imported/w3c/web-platform-tests/encrypted-media/clearkey-mp4-playback-temporary-setMediaKeys-immediately.https.html. * platform/encryptedmedia/CDMProxy.h: (WebCore::CDMProxy::releaseDecryptionResources): (WebCore::CDMInstanceSessionProxy::releaseDecryptionResources): (WebCore::CDMInstanceProxy::releaseDecryptionResources): * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp: (WebCore::MediaPlayerPrivateGStreamer::~MediaPlayerPrivateGStreamer): * platform/graphics/gstreamer/eme/CDMProxyClearKey.cpp: (WebCore::CDMProxyClearKey::~CDMProxyClearKey): (WebCore::CDMProxyClearKey::releaseDecryptionResources): (WebCore::CDMProxyClearKey::closeGCryptHandle): * platform/graphics/gstreamer/eme/CDMProxyClearKey.h: 2020-06-29 Alicia Boya García <aboya@igalia.com> [MSE][GStreamer] Rename MediaSourceGStreamer to MediaSourcePrivateGStreamer https://bugs.webkit.org/show_bug.cgi?id=213722 Reviewed by Xabier Rodriguez-Calvar. It's about time to remove this FIXME: // FIXME: Should this be called MediaSourcePrivateGStreamer? Yes, it should. Because it's a MediaSourcePrivate, and that is an important fact. The MSE class diagram is confusing enough already, let's fix this. To rebase commits after this change use `git format-patch` first to get them in a patch format and then run: sed -i 's|\<MediaSourceGStreamer\>|MediaSourcePrivateGStreamer|g' *.patch This patch is a refactor that produces no behavior changes. * platform/GStreamer.cmake: * platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.cpp: (WebCore::MediaPlayerPrivateGStreamerMSE::sourceSetup): * platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.h: * platform/graphics/gstreamer/mse/MediaSourceClientGStreamerMSE.h: * platform/graphics/gstreamer/mse/MediaSourcePrivateGStreamer.cpp: Renamed from Source/WebCore/platform/graphics/gstreamer/mse/MediaSourceGStreamer.cpp. (WebCore::MediaSourcePrivateGStreamer::open): (WebCore::MediaSourcePrivateGStreamer::MediaSourcePrivateGStreamer): (WebCore::MediaSourcePrivateGStreamer::~MediaSourcePrivateGStreamer): (WebCore::MediaSourcePrivateGStreamer::addSourceBuffer): (WebCore::MediaSourcePrivateGStreamer::removeSourceBuffer): (WebCore::MediaSourcePrivateGStreamer::durationChanged): (WebCore::MediaSourcePrivateGStreamer::markEndOfStream): (WebCore::MediaSourcePrivateGStreamer::unmarkEndOfStream): (WebCore::MediaSourcePrivateGStreamer::readyState const): (WebCore::MediaSourcePrivateGStreamer::setReadyState): (WebCore::MediaSourcePrivateGStreamer::waitForSeekCompleted): (WebCore::MediaSourcePrivateGStreamer::seekCompleted): (WebCore::MediaSourcePrivateGStreamer::sourceBufferPrivateDidChangeActiveState): (WebCore::MediaSourcePrivateGStreamer::buffered): (WebCore::MediaSourcePrivateGStreamer::logChannel const): * platform/graphics/gstreamer/mse/MediaSourcePrivateGStreamer.h: Renamed from Source/WebCore/platform/graphics/gstreamer/mse/MediaSourceGStreamer.h. * platform/graphics/gstreamer/mse/PlaybackPipeline.h: * platform/graphics/gstreamer/mse/SourceBufferPrivateGStreamer.cpp: (WebCore::SourceBufferPrivateGStreamer::create): (WebCore::SourceBufferPrivateGStreamer::SourceBufferPrivateGStreamer): * platform/graphics/gstreamer/mse/SourceBufferPrivateGStreamer.h: * platform/graphics/gstreamer/mse/WebKitMediaSourceGStreamer.cpp: 2020-06-29 Youenn Fablet <youenn@apple.com> RTCDataChannel.bufferedAmount should stay the same even if channel is closed https://bugs.webkit.org/show_bug.cgi?id=213698 Reviewed by Darin Adler. bufferedAmount was set back to zero when closing. Instead, we should keep the value in RTCDataChannel and update it either when sending data or being notified or some data getting sent. Test: webrtc/datachannel/bufferedAmount-afterClose.html * Modules/mediastream/RTCDataChannel.cpp: (WebCore::RTCDataChannel::bufferedAmountIsDecreasing): * platform/mock/RTCDataChannelHandlerMock.h: 2020-06-29 Antti Koivisto <antti@apple.com> checked overflow in WebCore::findClosestFont https://bugs.webkit.org/show_bug.cgi?id=213719 <rdar://47765225> Reviewed by David Kilzer. * platform/graphics/cocoa/FontCacheCoreText.cpp: (WebCore::findClosestFont): If indexOfBestCapabilities doesn't find anything it returns notFound and indexing to the vector overflows. 2020-06-29 David Kilzer <ddkilzer@apple.com> REGRESSION (r262776): Leak of NSMutableURLRequest in -[WebCoreResourceHandleAsOperationQueueDelegate connection:willSendRequest:redirectResponse:] <https://webkit.org/b/213690> <rdar://problem/64853619> Reviewed by Anders Carlsson. * platform/network/mac/WebCoreResourceHandleAsOperationQueueDelegate.mm: (-[WebCoreResourceHandleAsOperationQueueDelegate connection:willSendRequest:redirectResponse:]): - Use RetainPtr<> for the mutable copy and autorelease the return value. 2020-06-29 Youenn Fablet <youenn@apple.com> MediaRecorder.start() Method is Ignoring the "timeslice" Parameter https://bugs.webkit.org/show_bug.cgi?id=202233 <rdar://problem/55720555> Reviewed by Eric Carlson. Use a timer to implement timeSlice parameter. Schedule timer either when start is called or as part of requestData callback. This should ensure that, if requestData is called by the application, the timer will be rescheduled appropriately. Test: http/wpt/mediarecorder/MediaRecorder-start-timeSlice.html * Modules/mediarecorder/MediaRecorder.cpp: (WebCore::MediaRecorder::MediaRecorder): (WebCore::MediaRecorder::startRecording): (WebCore::MediaRecorder::requestData): * Modules/mediarecorder/MediaRecorder.h: 2020-06-29 Rob Buis <rbuis@igalia.com> window.location.replace with invalid urls should throw https://bugs.webkit.org/show_bug.cgi?id=153121 Reviewed by Darin Adler. Throw SyntaxError if the url resulting from the location.replace operation is not valid. Behavior matches Firefox and Chrome. Tests: imported/w3c/web-platform-tests/html/browsers/history/the-location-interface/location_replace.html [1] https://html.spec.whatwg.org/multipage/history.html#dom-location-replace * page/Location.cpp: (WebCore::Location::replace): * page/Location.h: * page/Location.idl: 2020-06-28 Zalan Bujtas <zalan@apple.com> [LFC][TFC] Adjust table content vertical position to match vertical-align https://bugs.webkit.org/show_bug.cgi?id=213692 Reviewed by Antti Koivisto. Child boxes (and runs) are always in the coordinate system of the containing block's border box. The content box (where the child content lives) is inside the padding box, which is inside the border box. In order to compute the child box top/left position, we need to know both the padding and the border offsets. <div style="border: 2px solid green; padding-top: 10px;"><div></div></div> The inner div's top left position is at [12px, 2px] (let's ignore margin collapsing for now). Normally by the time we start positioning the child content, we already have computed borders and paddings for the containing block. This is different with table cells where the final padding offset depends on the content height as we use the padding box to vertically align the table cell content. Let's adjust the child boxes and runs to match the new content box position. Test: fast/layoutformattingcontext/table-cell-vertical-alignment-simple.html * layout/displaytree/DisplayLineBox.h: (WebCore::Display::LineBox::moveVertically): * layout/displaytree/DisplayRun.h: (WebCore::Display::Run::moveVertically): * layout/tableformatting/TableFormattingContext.cpp: (WebCore::Layout::TableFormattingContext::setUsedGeometryForCells): 2020-06-28 Zalan Bujtas <zalan@apple.com> [LFC][Painting] Use the table section as the paint container for table cells https://bugs.webkit.org/show_bug.cgi?id=213693 Reviewed by Antti Koivisto. The cell's containing block is the table box (skipping both the row and the section), but it's positioned relative to the table section. Let's skip the row and go right to the section box when painting the cells. * layout/displaytree/DisplayPainter.cpp: (WebCore::Display::absoluteDisplayBox): 2020-06-28 Alexey Shvayka <shvaikalesh@gmail.com> Improve error message for primitive callback interfaces https://bugs.webkit.org/show_bug.cgi?id=213684 Reviewed by Darin Adler. This patch rewords TypeError message for non-object callback interfaces because apart from function, an object with certain method is also allowed. New error message matches Chrome and Firefox. Tests: fast/dom/createNodeIterator-parameters.html fast/dom/createTreeWalker-parameters.html * bindings/js/JSDOMExceptionHandling.cpp: (WebCore::throwArgumentMustBeObjectError): * bindings/js/JSDOMExceptionHandling.h: * bindings/scripts/CodeGeneratorJS.pm: (GetArgumentExceptionFunction): * bindings/scripts/test/*: Updated. 2020-06-28 Rob Buis <rbuis@igalia.com> Setting url.search="??" (two questionmarks) has incorrect behavior https://bugs.webkit.org/show_bug.cgi?id=170452 Reviewed by Darin Adler. There is no need to strip leading "?" character since URLParser expects it to be there. This differs from the specification algorithm [1], which relies on state override, which URLParser does not support. Behavior matches Firefox and Chrome. Test: imported/w3c/web-platform-tests/url/url-setters.html [1] https://url.spec.whatwg.org/#dom-url-search * html/URLDecomposition.cpp: (WebCore::URLDecomposition::setSearch): 2020-06-28 Geoffrey Garen <ggaren@apple.com> Rename initializeThreading to initialize https://bugs.webkit.org/show_bug.cgi?id=213674 Reviewed by Mark Lam. * Modules/webdatabase/DatabaseManager.cpp: (WebCore::DatabaseManager::openDatabase): * WebCore.order: * bindings/js/CommonVM.cpp: (WebCore::commonVMSlow): * bindings/js/ScriptController.cpp: (WebCore::ScriptController::initializeMainThread): (WebCore::ScriptController::initializeThreading): Deleted. * bindings/js/ScriptController.h: * bridge/objc/WebScriptObject.mm: (+[WebScriptObject initialize]): * platform/cocoa/SharedBufferCocoa.mm: (+[WebCoreSharedBufferData initialize]): * platform/ios/wak/WebCoreThread.mm: (RunWebThread): 2020-06-28 Youenn Fablet <youenn@apple.com> MediaRecorder stopRecorder() returns empty Blob after first use https://bugs.webkit.org/show_bug.cgi?id=212274 <rdar://problem/63601298> Reviewed by Eric Carlson. Refactor code to create/destroy MediaRecorderPrivate on MediaRecorder start/stop. This allows reusing a MediaRecorder after a stop and restarting with a clean state. We introduce MediaRecorderPrivate::startRecording to do the initialization, which allows to fix a potential ref cycle as part of the error callback handling. Make some improvements to the platform implementation, in particular add default initialization to all fields. Align the code using AudioConverterRef to what is done in AudioSampleDataSource. Also call VTCompressionSessionInvalidate when destroying the VideoSampleBufferCompressor. Test: http/wpt/mediarecorder/MediaRecorder-multiple-start-stop.html * Modules/mediarecorder/MediaRecorder.cpp: (WebCore::MediaRecorder::create): (WebCore::MediaRecorder::MediaRecorder): (WebCore::MediaRecorder::startRecording): (WebCore::MediaRecorder::stopRecording): (WebCore::MediaRecorder::requestData): * Modules/mediarecorder/MediaRecorder.h: * platform/mediarecorder/MediaRecorderPrivateMock.cpp: (WebCore::MediaRecorderPrivateMock::fetchData): * platform/mediarecorder/MediaRecorderPrivate.h: (WebCore::MediaRecorderPrivate::startRecording): * platform/mediarecorder/cocoa/AudioSampleBufferCompressor.h: * platform/mediarecorder/cocoa/AudioSampleBufferCompressor.mm: (WebCore::AudioSampleBufferCompressor::~AudioSampleBufferCompressor): (WebCore::AudioSampleBufferCompressor::initAudioConverterForSourceFormatDescription): (WebCore::AudioSampleBufferCompressor::attachPrimingTrimsIfNeeded): (WebCore::AudioSampleBufferCompressor::gradualDecoderRefreshCount): (WebCore::AudioSampleBufferCompressor::sampleBufferWithNumPackets): (WebCore::AudioSampleBufferCompressor::processSampleBuffersUntilLowWaterTime): * platform/mediarecorder/cocoa/MediaRecorderPrivateWriterCocoa.h: * platform/mediarecorder/cocoa/MediaRecorderPrivateWriterCocoa.mm: (WebCore::MediaRecorderPrivateWriter::stopRecording): * platform/mediarecorder/cocoa/VideoSampleBufferCompressor.mm: (WebCore::VideoSampleBufferCompressor::~VideoSampleBufferCompressor): 2020-06-27 Zalan Bujtas <zalan@apple.com> [LFC][IFC] Replaced inline boxes sit on the baseline with their margins https://bugs.webkit.org/show_bug.cgi?id=213679 Reviewed by Antti Koivisto. Take the margin box into account when computing the top position of a baseline aligned replaced inline box. Test: fast/layoutformattingcontext/replaced-box-with-margin-on-baseline.html * layout/inlineformatting/InlineLineBuilder.cpp: (WebCore::Layout::LineBuilder::alignContentVertically): 2020-06-27 Mark Lam <mark.lam@apple.com> Fix missing exception check in createIDBKeyFromValue(). https://bugs.webkit.org/show_bug.cgi?id=213681 <rdar://problem/64804893> Reviewed by Chris Dumez. Test: storage/indexeddb/missing-exception-check-in-IDBKey.html Also fixed up miscellaneous other exception check related code to enable the new test to run with exception check validation. * bindings/js/IDBBindingUtilities.cpp: (WebCore::createIDBKeyFromValue): * bindings/js/JSDOMBindingSecurity.cpp: (WebCore::BindingSecurity::shouldAllowAccessToDOMWindow): * bindings/js/JSDOMWindowBase.cpp: (WebCore::JSDOMWindowBase::updateDocument): * bindings/js/JSDOMWindowCustom.cpp: (WebCore::JSDOMWindow::put): (WebCore::JSDOMWindow::defineOwnProperty): * bindings/js/ScriptController.cpp: (WebCore::ScriptController::initScriptForWindowProxy): * bindings/scripts/CodeGeneratorJS.pm: (GenerateAttributeGetterBodyDefinition): (GenerateAttributeSetterBodyDefinition): (GenerateOperationBodyDefinition): * bindings/scripts/test/JS/JSTestActiveDOMObject.cpp: (WebCore::jsTestActiveDOMObjectExcitingAttrGetter): (WebCore::jsTestActiveDOMObjectPrototypeFunctionExcitingFunctionBody): (WebCore::jsTestActiveDOMObjectPrototypeFunctionOverloadedMethodOverloadDispatcher): * bridge/objc/WebScriptObject.mm: (-[WebScriptObject _isSafeScript]): * testing/js/WebCoreTestSupport.cpp: (WebCoreTestSupport::injectInternalsObject): 2020-06-27 Jer Noble <jer.noble@apple.com> iOS Safari incorrectly reports "AppleCoreMedia" as UA string https://bugs.webkit.org/show_bug.cgi?id=213245 <rdar://problem/64471582> Reviewed by Youenn Fablet. Tests: TestWebKitAPI.MediaLoading.UserAgentStringCRABS TestWebKitAPI.MediaLoading.UserAgentStringHLS * platform/network/cocoa/WebCoreNSURLSession.mm: (-[WebCoreNSURLSessionDataTask initWithSession:identifier:request:]): 2020-06-27 Rob Buis <rbuis@igalia.com> Require <form> to be connected https://bugs.webkit.org/show_bug.cgi?id=177356 Reviewed by Sam Weinig. Implement step 1 of [1], i.e. do not submit form if it is not connected. Test: imported/w3c/web-platform-tests/html/semantics/forms/form-submission-0/submission-checks.html [1] https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#concept-form-submit * html/HTMLFormElement.cpp: (WebCore::HTMLFormElement::submit): 2020-06-27 Youenn Fablet <youenn@apple.com> Log capture device information in case of getUserMedia failing to select a device https://bugs.webkit.org/show_bug.cgi?id=213643 Reviewed by Eric Carlson. Log constraints and device in case of a failing getUserMedia call. No obserable change, logging addition. * platform/mediastream/mac/CoreAudioCaptureDevice.cpp: (WebCore::getDeviceInfo): (WebCore::CoreAudioCaptureDevice::deviceClock): * platform/mediastream/mac/CoreAudioCaptureDeviceManager.cpp: (WebCore::isValidCaptureDevice): * platform/mediastream/MediaConstraints.cpp: (WebCore::MediaConstraint::log const): (WebCore::BooleanConstraint::logAsBoolean const): (WebCore::DoubleConstraint::logAsDouble const): (WebCore::IntConstraint::logAsInt const): * platform/mediastream/MediaConstraints.h: * platform/mediastream/RealtimeMediaSource.cpp: (WebCore::RealtimeMediaSource::supportsSizeAndFrameRate): (WebCore::RealtimeMediaSource::selectSettings): * platform/mediastream/RealtimeMediaSourceCenter.cpp: (WebCore::RealtimeMediaSourceCenter::validateRequestConstraints): * platform/mediastream/RealtimeVideoCaptureSource.cpp: (WebCore::RealtimeVideoCaptureSource::bestSupportedSizeAndFrameRate): * platform/mediastream/VideoPreset.h: (WebCore::VideoPreset::log const): 2020-06-27 Youenn Fablet <youenn@apple.com> Protect SWServer::claim from a registration without active worker https://bugs.webkit.org/show_bug.cgi?id=213597 Reviewed by Chris Dumez. SWServerWorker might be active while being terminated. If terminated as part of SWServerRegistration::clear, the registration no longer has a service worker. SWServer::claim should therefore check for registration active worker. This is difficult to test as one needs to claim at the time the service worker is being terminated but not yet terminated. * workers/service/server/SWServer.cpp: (WebCore::SWServer::claim): 2020-06-27 Sam Weinig <weinig@apple.com> Convert SVG related parsers over to using StringParsingBuffer https://bugs.webkit.org/show_bug.cgi?id=213635 Reviewed by Darin Adler. - Adopt StringParsingBuffer across SVG code. - Remove UTF-16 upconversions in SVGAnimationElement, SVGFitToViewBox, SVGLengthList, SVGLengthValue, SVGNumberList, SVGParserUtilities, SVGPointList, SVGPreserveAspectRatioValue, SVGStringList, SVGTransformList, SVGTransformable and SVGViewSpec. * Headers.cmake: * WebCore.xcodeproj/project.pbxproj: Export ParsingUtilities.h, which is now included by SVGParserUtilities.h * Sources.txt: Add implementation files for SVGLengthList, SVGNumberList, SVGPointList, SVGStringList and SVGTransformList to hold large functions are unlikely to benefit from inlining. * html/parser/ParsingUtilities.h: (WebCore::skipCharactersExactly): Add new skipCharactersExactly, which takes a c-array (NOT null-terminated) of characters to compare against. * svg/SVGAngleValue.cpp: (WebCore::parseAngleType): (WebCore::SVGAngleValue::setValueAsString): Adopt StringParsingBuffer. * svg/SVGAnimateTransformElement.cpp: (WebCore::SVGAnimateTransformElement::parseAttribute): Adapt to new shared parseTransformType, which now returns an Optional and default to SVG_TRANSFORM_UNKNOWN on parse failure as the old parseTransformType did. * svg/SVGAnimationElement.cpp: (WebCore::parseKeySplines): Adopt StringParsingBuffer and readCharactersForParsing to replace unnecessary call to StringView::upconvertedCharacters() * svg/SVGFitToViewBox.cpp: (WebCore::SVGFitToViewBox::parseViewBox): (WebCore::SVGFitToViewBox::parseViewBoxGeneric): * svg/SVGFitToViewBox.h: Adopt StringParsingBuffer and readCharactersForParsing to replace unnecessary call to StringView::upconvertedCharacters() * svg/SVGLengthList.cpp: Added. (WebCore::SVGLengthList::parse): (WebCore::SVGLengthList::valueAsString const): * svg/SVGLengthList.h: Adopt StringParsingBuffer and readCharactersForParsing to replace unnecessary call to StringView::upconvertedCharacters(). Move parse and valueAsString out of line. * svg/SVGLengthValue.cpp: (WebCore::parseLengthType): (WebCore::SVGLengthValue::construct): (WebCore::SVGLengthValue::setValueAsString): * svg/SVGLengthValue.h: Adopt StringParsingBuffer and readCharactersForParsing to replace unnecessary call to StringView::upconvertedCharacters() * svg/SVGNumberList.cpp: Added. (WebCore::SVGNumberList::parse): (WebCore::SVGNumberList::valueAsString const): * svg/SVGNumberList.h: Adopt StringParsingBuffer and readCharactersForParsing to replace unnecessary call to StringView::upconvertedCharacters(). Move parse and valueAsString out of line. * svg/SVGParserUtilities.cpp: (WebCore::genericParseNumber): (WebCore::parseNumber): (WebCore::genericParseArcFlag): (WebCore::parseArcFlag): (WebCore::parseNumberOptionalNumber): (WebCore::parsePoint): (WebCore::parseRect): (WebCore::parseGlyphName): (WebCore::parseUnicodeRange): (WebCore::parseKerningUnicodeString): (WebCore::genericParseFloatPoint): (WebCore::parseFloatPoint): * svg/SVGParserUtilities.h: (WebCore::isSVGSpaceOrComma): (WebCore::skipOptionalSVGSpaces): (WebCore::skipOptionalSVGSpacesOrDelimiter): (WebCore::skipString): Deleted. Adopt StringParsingBuffer and readCharactersForParsing to replace unnecessary call to StringView::upconvertedCharacters(). Move parse and valueAsString out of line. * svg/SVGPathSource.h: Add missing include, which is now needed do to removing unncessary includes in other files. * svg/SVGPathStringSource.cpp: (WebCore::SVGPathStringSource::SVGPathStringSource): (WebCore::SVGPathStringSource::hasMoreData const): (WebCore::SVGPathStringSource::moveToNextToken): (WebCore::nextCommandHelper): (WebCore::SVGPathStringSource::nextCommand): (WebCore::SVGPathStringSource::parse): (WebCore::SVGPathStringSource::parseSVGSegmentType): (WebCore::SVGPathStringSource::parseMoveToSegment): (WebCore::SVGPathStringSource::parseLineToSegment): (WebCore::SVGPathStringSource::parseLineToHorizontalSegment): (WebCore::SVGPathStringSource::parseLineToVerticalSegment): (WebCore::SVGPathStringSource::parseCurveToCubicSegment): (WebCore::SVGPathStringSource::parseCurveToCubicSmoothSegment): (WebCore::SVGPathStringSource::parseCurveToQuadraticSegment): (WebCore::SVGPathStringSource::parseCurveToQuadraticSmoothSegment): (WebCore::SVGPathStringSource::parseArcToSegment): (WebCore::parseSVGSegmentTypeHelper): Deleted. * svg/SVGPathStringSource.h: Adopt StringParsingBuffer. Replace existing set of unions with a single union of StringParsingBuffers. * svg/SVGPointList.cpp: Added. (WebCore::SVGPointList::parse): (WebCore::SVGPointList::valueAsString const): * svg/SVGPointList.h: Adopt StringParsingBuffer and readCharactersForParsing to replace unnecessary call to StringView::upconvertedCharacters(). Move parse and valueAsString out of line. * svg/SVGPreserveAspectRatioValue.cpp: (WebCore::SVGPreserveAspectRatioValue::SVGPreserveAspectRatioValue): (WebCore::SVGPreserveAspectRatioValue::parse): (WebCore::SVGPreserveAspectRatioValue::parseInternal): (WebCore::SVGPreserveAspectRatioValue::valueAsString const): * svg/SVGPreserveAspectRatioValue.h: Adopt StringParsingBuffer and readCharactersForParsing to replace unnecessary call to StringView::upconvertedCharacters(). * svg/SVGStringList.cpp: Added. (WebCore::SVGStringList::parse): (WebCore::SVGStringList::valueAsString const): * svg/SVGStringList.h: Adopt StringParsingBuffer and readCharactersForParsing to replace unnecessary call to StringView::upconvertedCharacters(). Move parse and valueAsString out of line. * svg/SVGTransformList.cpp: Added. (WebCore::SVGTransformList::consolidate): (WebCore::SVGTransformList::concatenate const): (WebCore::SVGTransformList::parseGeneric): (WebCore::SVGTransformList::parse): (WebCore::SVGTransformList::valueAsString const): * svg/SVGTransformList.h: Adopt StringParsingBuffer and readCharactersForParsing to replace unnecessary call to StringView::upconvertedCharacters(). Move parse, valueAsString, consolidate and concatenate out of line. * svg/SVGTransformable.cpp: (WebCore::parseTransformParamList): (WebCore::parseTransformValueGeneric): (WebCore::SVGTransformable::parseTransformValue): (WebCore::parseTransformTypeGeneric): (WebCore::SVGTransformable::parseTransformType): (WebCore::SVGTransformable::parseAndSkipType): Deleted. * svg/SVGTransformable.h: Adopt StringParsingBuffer and readCharactersForParsing to replace unnecessary call to StringView::upconvertedCharacters(). Unify parseTransformType implementations to all use a single implementation and return an Optional<SVGTransformType>. * svg/SVGViewSpec.cpp: (WebCore::SVGViewSpec::parseViewSpec): * svg/SVGViewSpec.h: Adopt StringParsingBuffer and readCharactersForParsing to replace unnecessary call to StringView::upconvertedCharacters(). * svg/SVGZoomAndPan.cpp: (WebCore::parseZoomAndPanGeneric): (WebCore::SVGZoomAndPan::parseZoomAndPan): * svg/SVGZoomAndPan.h: Adopt StringParsingBuffer. 2020-06-26 Jer Noble <jer.noble@apple.com> CRASH: incompatible downcast<> operation in SourceBufferPrivateAVFObjC::setCDMInstance() https://bugs.webkit.org/show_bug.cgi?id=213660 <rdar://problem/63831593> Reviewed by Eric Carlson. Test: platform/mac/media/encrypted-media/fps-clearkey-crash.html * platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm: (WebCore::SourceBufferPrivateAVFObjC::setCDMInstance): 2020-06-26 Zalan Bujtas <zalan@apple.com> [LFC][BFC] Add support for <center> https://bugs.webkit.org/show_bug.cgi?id=213649 Reviewed by Antti Koivisto. Adjust the margin box to center the block content (this is very similar to [style="margin-left: auto; margin-right: auto;"]). Test: fast/layoutformattingcontext/center-alignment-with-block-content-simple.html * layout/blockformatting/BlockFormattingContextGeometry.cpp: (WebCore::Layout::BlockFormattingContext::Geometry::inFlowNonReplacedWidthAndMargin): 2020-06-26 Jason Lawrence <lawrence.j@apple.com> Unreviewed, reverting r263511, r263514, and r263565. r263511 caused MediaRecorder test crashes on internal testers. Reverted changesets: "MediaRecorder stopRecorder() returns empty Blob after first use" https://bugs.webkit.org/show_bug.cgi?id=212274 https://trac.webkit.org/changeset/263511 "Unreviewed iOS build fix after r263511." https://trac.webkit.org/changeset/263514 "MediaRecorder.start() Method is Ignoring the "timeslice" Parameter" https://bugs.webkit.org/show_bug.cgi?id=202233 https://trac.webkit.org/changeset/263565 2020-06-26 Sam Weinig <weinig@apple.com> Convert ContentSecurityPolicy related parsers over to using StringParsingBuffer https://bugs.webkit.org/show_bug.cgi?id=213631 Reviewed by Darin Adler. - Adopt StringParsingBuffer across CSP code. - Remove UTF-16 upconversions in ContentSecurityPolicy, ContentSecurityPolicyDirectiveList, ContentSecurityPolicyMediaListDirective and ContentSecurityPolicySourceList. * html/parser/ParsingUtilities.h: (WebCore::isNotASCIISpace): (WebCore::skipExactly): (WebCore::characterPredicate): (WebCore::skipUntil): (WebCore::skipExactlyIgnoringASCIICase): Add overloads for each helper that take a StringParsingBuffer. * loader/ResourceCryptographicDigest.cpp: (WebCore::parseHashAlgorithmAdvancingPosition): Convert to use an Optional return value rather than outparameter + bool. (WebCore::parseCryptographicDigestImpl): (WebCore::parseCryptographicDigest): (WebCore::parseEncodedCryptographicDigestImpl): (WebCore::parseEncodedCryptographicDigest): * loader/ResourceCryptographicDigest.h: Use StringParsingBuffer rather than raw pointers for parsing. * loader/SubresourceIntegrity.cpp: (WebCore::splitOnSpaces): (WebCore::parseIntegrityMetadata): Use StringParsingBuffer and readCharactersForParsing rather than raw pointers for parsing. * page/csp/ContentSecurityPolicy.cpp: (WebCore::ContentSecurityPolicy::didReceiveHeader): Use StringParsingBuffer and readCharactersForParsing to replace unnecessary call to StringView::upconvertedCharacters(). * page/csp/ContentSecurityPolicyDirectiveList.cpp: (WebCore::isDirectiveNameCharacter): (WebCore::isDirectiveValueCharacter): (WebCore::ContentSecurityPolicyDirectiveList::parse): (WebCore::ContentSecurityPolicyDirectiveList::parseDirective): (WebCore::ContentSecurityPolicyDirectiveList::parseReportURI): (WebCore::ContentSecurityPolicyDirectiveList::setCSPDirective): (WebCore::ContentSecurityPolicyDirectiveList::applySandboxPolicy): (WebCore::ContentSecurityPolicyDirectiveList::setUpgradeInsecureRequests): (WebCore::ContentSecurityPolicyDirectiveList::setBlockAllMixedContentEnabled): (WebCore::ContentSecurityPolicyDirectiveList::addDirective): * page/csp/ContentSecurityPolicyDirectiveList.h: Use StringParsingBuffer and readCharactersForParsing to replace unnecessary call to StringView::upconvertedCharacters(). Also switch to using Optional for return values rather than outparameter + bool. To make things read more cleanly, package up name and value pair into a new ParsedDirective struct that can be passed around more easily. * page/csp/ContentSecurityPolicyMediaListDirective.cpp: (WebCore::isMediaTypeCharacter): (WebCore::ContentSecurityPolicyMediaListDirective::parse): Use StringParsingBuffer and readCharactersForParsing to replace unnecessary call to StringView::upconvertedCharacters(). * page/csp/ContentSecurityPolicySourceList.cpp: (WebCore::isSourceCharacter): (WebCore::isHostCharacter): (WebCore::isPathComponentCharacter): (WebCore::isSchemeContinuationCharacter): (WebCore::isNotColonOrSlash): (WebCore::isSourceListNone): (WebCore::ContentSecurityPolicySourceList::parse): (WebCore::ContentSecurityPolicySourceList::parseSource): (WebCore::ContentSecurityPolicySourceList::parseScheme): (WebCore::ContentSecurityPolicySourceList::parseHost): (WebCore::ContentSecurityPolicySourceList::parsePath): (WebCore::ContentSecurityPolicySourceList::parsePort): (WebCore::isNonceCharacter): (WebCore::ContentSecurityPolicySourceList::parseNonceSource): (WebCore::ContentSecurityPolicySourceList::parseHashSource): * page/csp/ContentSecurityPolicySourceList.h: Use StringParsingBuffer and readCharactersForParsing to replace unnecessary call to StringView::upconvertedCharacters(). Also switch to using Optional for return values rather than outparameter + bool. To make things read more cleanly, package up source return values into structs that can be more easily returned / passed around. 2020-06-26 Simon Fraser <simon.fraser@apple.com> Content sometimes missing in nested scrollers with border-radius https://bugs.webkit.org/show_bug.cgi?id=213580 <rdar://problem/64460373> Reviewed by Zalan Bujtas. RenderLayer::clipToRect() has a special case for clips involving border-radius, involving an ancestor tree walk which applies the rounded clips. When inside composited overflow, don't include the border-radius from the scroller since that does its own clipping. Test: compositing/clipping/nested-overflow-with-border-radius.html * rendering/RenderLayer.cpp: (WebCore::RenderLayer::clipToRect): (WebCore::RenderLayer::calculateClipRects const): * rendering/RenderLayer.h: 2020-06-26 Geoffrey Garen <ggaren@apple.com> Initializing the main thread should initialize the main run loop https://bugs.webkit.org/show_bug.cgi?id=213637 Reviewed by Anders Carlsson. * platform/ios/wak/WebCoreThread.mm: (RunWebThread): Removed call to initializeMainThread() because the main thread calls it before starting the web thread, so it's a no-op. (And if it were an op, it would be broken.) (StartWebThread): Merged RunLoop::initializeMain and initializeThreading into initializeMainThread. 2020-06-26 Andres Gonzalez <andresg_22@apple.com> Fix for crash in AXIsolatedObject::relativeFrame. https://bugs.webkit.org/show_bug.cgi?id=213363 Reviewed by Chris Fleizach. Covered by existing testss. Between the time an isolated object dispatches the method to the main thread and the time the lambda is executed, the isolated object is detached and hence its object ID becomes invalid. Thus, trying to get the associated AX object results in an assert/crash. * accessibility/isolatedtree/AXIsolatedObject.h: 2020-06-26 Andres Gonzalez <andresg_22@apple.com> Access to AXIsolatedTree:m_readerThreadNodeMap should happen only on the secondary AX thread. https://bugs.webkit.org/show_bug.cgi?id=213575 Reviewed by Chris Fleizach. After calling AXObjectCache::initializeSecondaryAXThread, there may still be some client requests coming in on the main thread. Thus AXIsolatedTree::applyPendingchanges and nodeForID can be called on the main thread. Since these two methods access the member variable m_readerThreadNodeMap which should be accessed only on the secondary AX thread, we now check for this condition and bail out if needed. * accessibility/isolatedtree/AXIsolatedTree.cpp: (WebCore::AXIsolatedTree::nodeForID const): (WebCore::AXIsolatedTree::applyPendingChanges): * accessibility/isolatedtree/AXIsolatedTree.h: Reordered private methods above member variables to comply with WebKit coding conventions, pointed out by Darin Adler in review for https://bugs.webkit.org/show_bug.cgi?id=213435. 2020-06-26 Andres Gonzalez <andresg_22@apple.com> Fix for crash in accessibility/roles-exposed.html in isolated tree mode. https://bugs.webkit.org/show_bug.cgi?id=213648 Reviewed by Chris Fleizach. LayoutTest: accessibility/roles-exposed.html. - In layout tests, when AXObjectCache::notificationPostTimerFired is triggered, and we try to update the isolated tree, some of the underlying objects may already be gone. So this change ensure we don't try to update an isolated object that corresponds to an already detached live object. * accessibility/AXObjectCache.cpp: (WebCore::AXObjectCache::cacheAndInitializeWrapper): Sanity check. * accessibility/AccessibilityListBox.cpp: (WebCore::AccessibilityListBox::addChildren): m_renderer can be null when trying to update the isolated tree. * accessibility/AccessibilityListBoxOption.cpp: (WebCore::AccessibilityListBoxOption::computeAccessibilityIsIgnored const): Parent object may be gone when trying to update the isolated tree. * accessibility/isolatedtree/AXIsolatedTree.cpp: (WebCore::AXIsolatedTree::updateChildrenIDs): (WebCore::AXIsolatedTree::generateSubtree): (WebCore::AXIsolatedTree::updateChildren): 2020-06-26 Youenn Fablet <youenn@apple.com> MediaRecorder.start() Method is Ignoring the "timeslice" Parameter https://bugs.webkit.org/show_bug.cgi?id=202233 <rdar://problem/55720555> Reviewed by Eric Carlson. Use a timer to implement timeSlice parameter. Schedule timer either when start is called or as part of requestData callback. This should ensure that, if requestData is called by the application, the timer will be rescheduled appropriately. Test: http/wpt/mediarecorder/MediaRecorder-start-timeSlice.html * Modules/mediarecorder/MediaRecorder.cpp: (WebCore::MediaRecorder::MediaRecorder): (WebCore::MediaRecorder::startRecording): (WebCore::MediaRecorder::requestData): * Modules/mediarecorder/MediaRecorder.h: 2020-06-26 Jack Lee <shihchieh_lee@apple.com> ASSERTION FAILED: (it != m_map.end()) in TreeScopeOrderedMap::remove https://bugs.webkit.org/show_bug.cgi?id=213611 <rdar://problem/64493506> Reviewed by Geoffrey Garen. In function HTMLImageElement::parseAttribute(), empty name attribute is considered valid which makes the function skip handling of subsequent name changes. Modified the check of name attribute so only non-empty name is considered valid. This code change is to match <https://trac.webkit.org/changeset/262360>. Test: fast/images/img-change-name-assert.html * html/HTMLImageElement.cpp: (WebCore::HTMLImageElement::parseAttribute): 2020-06-26 Sihui Liu <sihui_liu@apple.com> Text manipulation should observe adjacent elements with new renderer together https://bugs.webkit.org/show_bug.cgi?id=213333 Reviewed by Geoffrey Garen. TextManipulationController only keeps track of manipulated Elements. For other types of Node, like Text, TextManipulationController does not mark them as manipulated and may manipulate it again. r263132 tried to solve the problem by marking Element with only manipulated children as manipulated, but it did not iterate all children of Element. So, if one Element has children in different paragraphs, it may fail to mark the Element manipulated. See updated test. To fix this issue completely, TextManipulationController now tracks all manipulated Nodes, so it can skip the manipulated Nodes during observation. For elements with new renderer, TextManipulationController observes them one by one. However, adjacent elements can be in the same paragraph, if there is no delimiter in their text, and should be observed together. To solve this problem, TextManipulationController now starts observing from the common ancestor of these elements. If a Node in range is manipulated, split the paragrph there. This makes sure content in paragraph is not manipulated. Relevant test is updated for this new behavior. Tests: TextManipulation.StartTextManipulationFindNewlyDisplayedParagraph TextManipulation.CompleteTextManipulationAvoidExtractingManipulatedTextAfterManipulation * dom/Node.cpp: (WebCore::Node::~Node): * editing/TextManipulationController.cpp: (WebCore::TextManipulationController::observeParagraphs): (WebCore::TextManipulationController::didCreateRendererForElement): (WebCore::TextManipulationController::scheduleObservationUpdate): (WebCore::TextManipulationController::updateInsertions): (WebCore::TextManipulationController::replace): (WebCore::TextManipulationController::removeNode): (WebCore::makePositionTuple): Deleted. (WebCore::makeHashablePositionRange): Deleted. * editing/TextManipulationController.h: 2020-06-26 Simon Fraser <simon.fraser@apple.com> Clean up some PaintBehavior-related code in RenderLayer https://bugs.webkit.org/show_bug.cgi?id=213634 Reviewed by Sam Weinig. Move the computation of paintBehavior into a lambda, and share the flags between normal painting and mask painting. * rendering/RenderLayer.cpp: (WebCore::RenderLayer::paintLayerContents): (WebCore::RenderLayer::calculateClipRects const): * rendering/RenderLayer.h: 2020-06-26 Alicia Boya García <aboya@igalia.com> [GStreamer] Initialize m_currentState and m_oldState https://bugs.webkit.org/show_bug.cgi?id=213604 Reviewed by Eric Carlson. MediaPlayerPrivateGStreamer was not initializing m_currentState and m_oldState, causing them to be checked e.g. updateStates() while they still contain garbage. Because the biggest uninitialized usage is a != comparison, in practice things still worked, but that's still a bug. I detected the bug after seeing this in the logs: playbin3SendSelectStreamsIfAppropriate:<media-player-0> Checking if to send SELECT_STREAMS, m_waitingForStreamsSelectedEvent = false, haveDifferentStreamIds = false, m_currentState = UNKNOWN!(-8421505)... shouldSendSelectStreams = false This patch fixes a slight memory error which doesn't alter TestExpectations. * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h: 2020-06-25 Commit Queue <commit-queue@webkit.org> Unreviewed, reverting r263537. https://bugs.webkit.org/show_bug.cgi?id=213640 Broke watchOS and tvOS builds Reverted changeset: "iOS Safari incorrectly reports "AppleCoreMedia" as UA string" https://bugs.webkit.org/show_bug.cgi?id=213245 https://trac.webkit.org/changeset/263537 2020-06-25 Zalan Bujtas <zalan@apple.com> [Inline] Overlapping content when margin-right is present https://bugs.webkit.org/show_bug.cgi?id=213629 <rdar://problem/64391403> Reviewed by Simon Fraser. 1. computeInlineDirectionPositionsForSegment loops through the Bidi runs and computes their logical widths. 2. Text measuring needs the current logical left position in order to compute the run width properly (e.g tab size) 3. The current logical left includes margins, boders and paddings (e.g <span style="margin: 100px;">text content</span> 'text content' starts at 100px -ignore the line offset for now) 4. The BiDi loop jumps over empty inline containers (e.g. text<span style="border: 10px solid green"></span>content) and it lacks the information to be able to resolve nested inline containers. This patch pre-computes the spacing offset for each InlineTextBox so that we could use it later to compute the logical left position for the text measuring. <span style="margin-right: 1px">[1]<span style="margin: 2px">[2]</span>[3]</span>[4] [1] -> 0px offset [2] -> 2px offset [3] -> 4px offset [4] -> 5px offset Test: fast/inline/incorrect-tab-position.html * rendering/ComplexLineLayout.cpp: (WebCore::ComplexLineLayout::computeInlineDirectionPositionsForSegment): 2020-06-25 Alex Christensen <achristensen@webkit.org> REGRESSION(r256166, r260596) WKNavigationAction.request.allHTTPHeaderFields needs to contain User-Agent and Accept https://bugs.webkit.org/show_bug.cgi?id=213626 <rdar://problem/62374208> Reviewed by Darin Adler. Those two revisions seemed to just subtly move things around, but they caused API-breaking changes that caused real problems. This effectively reverts the parts of those changes that caused the breakages. * loader/FrameLoader.cpp: (WebCore::FrameLoader::addExtraFieldsToRequest): * loader/cache/CachedResourceRequest.cpp: (WebCore::CachedResourceRequest::acceptHeaderValueFromType): (WebCore::acceptHeaderValueFromType): Deleted. * loader/cache/CachedResourceRequest.h: 2020-06-25 Simon Fraser <simon.fraser@apple.com> Convert the PaintLayerFlag enum to an enum class https://bugs.webkit.org/show_bug.cgi?id=213624 Reviewed by Zalan Bujtas. Convert enum PaintLayerFlag to an enum class. * html/shadow/MediaControlTextTrackContainerElement.cpp: (WebCore::MediaControlTextTrackContainerElement::createTextTrackRepresentationImage): * rendering/RenderLayer.cpp: (WebCore::RenderLayer::paint): (WebCore::RenderLayer::paintOverlayScrollbars): (WebCore::paintForFixedRootBackground): (WebCore::RenderLayer::paintLayer): (WebCore::RenderLayer::paintLayerWithEffects): (WebCore::RenderLayer::paintLayerContentsAndReflection): (WebCore::RenderLayer::filtersForPainting const): (WebCore::RenderLayer::paintLayerContents): (WebCore::RenderLayer::updatePaintingInfoForFragments): (WebCore::RenderLayer::paintTransformedLayerIntoFragments): (WebCore::RenderLayer::calculateClipRects const): * rendering/RenderLayer.h: * rendering/RenderLayerBacking.cpp: (WebCore::RenderLayerBacking::paintIntoLayer): (WebCore::RenderLayerBacking::paintFlagsForLayer const): * rendering/RenderReplica.cpp: (WebCore::RenderReplica::paint): 2020-06-25 Daniel Bates <dabates@apple.com> [iOS] Event region briefly missing editable element after typing second character in question field on discussions.apple.com https://bugs.webkit.org/show_bug.cgi?id=213618 <rdar://problem/62656131> Reviewed by Simon Fraser. Ensure the event region is updated for the foreground layer, if there is one. The foreground layer paints into a different backing and so will not be included in normal layer paint (i.e. RenderLayer::paintLayer() will bail out). A "z-index: -1" can create such a layer. An element with "z-index: -1" is above the background, but below other content. Although the original reported bug was only concerned about the editable region the fix is applicable to all regions tracked by EventRegion. I included a test for touch-action region too. Tests: editing/editable-region/text-field-inside-composited-negative-z-index-layer.html pointerevents/ios/touch-action-none-relative-inside-composited-negative-z-index-layer.html * rendering/RenderLayerBacking.cpp: (WebCore::RenderLayerBacking::updateEventRegion): 2020-06-25 Jer Noble <jer.noble@apple.com> iOS Safari incorrectly reports "AppleCoreMedia" as UA string https://bugs.webkit.org/show_bug.cgi?id=213245 <rdar://problem/64471582> Reviewed by Youenn Fablet. Tests: TestWebKitAPI.MediaLoading.UserAgentStringCRABS TestWebKitAPI.MediaLoading.UserAgentStringHLS * platform/network/cocoa/WebCoreNSURLSession.mm: (-[WebCoreNSURLSessionDataTask initWithSession:identifier:request:]): 2020-06-25 Megan Gardner <megan_gardner@apple.com> Unreviewed. Fixing misspellings of 'position'. * editing/DeleteSelectionCommand.cpp: (WebCore::DeleteSelectionCommand::smartDeleteParagraphSpacers): * platform/ScrollAnimator.cpp: (WebCore::ScrollAnimator::scrollToOffsetWithoutAnimation): * rendering/line/BreakingContext.h: (WebCore::BreakingContext::handleText): 2020-06-25 Daniel Bates <dabates@apple.com> [iOS] -_requestTextInputContextsInRect cannot find empty Quip spreadsheet title https://bugs.webkit.org/show_bug.cgi?id=213564 <rdar://problem/59355847> Reviewed by Simon Fraser. Special case for a focused editable inline element that has no line box, which is what the Quip spreadsheet title can become if its contents are deleted. The engine optimizes to avoid creating lines and line boxes for empty inlines, hit testing, and painting them. It's complicated to patch all this up with a 100% correct solution without forcing more line box creation. So, just add a special case. * page/Page.cpp: (WebCore::Page::editableElementsInRect const): Add the root editable element of the focused element to the result set if its rect intersects the search rect. Note that its rect can be empty e.g. <span contenteditable="true"></span>. So, I use a new function on FloatRect to perform the intersection test. I also updated the ASSERT() to also use this new function. This was not necessary, but I did it to future the proof this code should hit testing one day return empty inlines. * platform/graphics/FloatRect.cpp: (WebCore::FloatRect::inclusivelyIntersects const): Added. (WebCore::FloatRect::intersects const): While I was in this file I fixed up a comment in this function to be more precise. * platform/graphics/FloatRect.h: 2020-06-25 Wenson Hsieh <wenson_hsieh@apple.com> Unreviewed, fix the macOS 11 build after r263519 * rendering/RenderThemeMac.mm: (WebCore::createAttachmentPlaceholderImage): 2020-06-25 Megan Gardner <megan_gardner@apple.com> Cannot delete last line of Mail Message https://bugs.webkit.org/show_bug.cgi?id=213536 <rdar://problem/63420928> Reviewed by Wenson Hsieh. LayoutTests/editing/deleting/smart-delete-paragraph-005.html The smart paragraph deletion code did not take into account that the previous blank line could be the start of editable content without a paragraph before it. If this was the case, the deletion code backed up too far, and the delete command failed. This case should be handled in the same way that the deleting the last paragraph in editable content is handled, by checking if we are already at the beginning of the editable content when expanding the selection for smart paragraph deletion. * editing/DeleteSelectionCommand.cpp: (WebCore::DeleteSelectionCommand::smartDeleteParagraphSpacers): 2020-06-25 Wenson Hsieh <wenson_hsieh@apple.com> Text manipulation should exclude text rendered using icon-only fonts https://bugs.webkit.org/show_bug.cgi?id=213446 <rdar://problem/63734298> Reviewed by Myles Maxfield. See below for more details. Test: TextManipulation.StartTextManipulationExcludesTextRenderedAsIcons * editing/TextManipulationController.cpp: (WebCore::TextManipulationController::shouldExcludeNodeBasedOnStyle): (WebCore::TextManipulationController::parse): Augment token exclusion rules so that we're able to exclude certain text nodes from text manipulation, based on their style (more specifically, based on their font family). Ask the text node's primary font if it is likely to be used only for rendering icons, and cache the result in TextManipulationController to avoid running the heuristic an excessive number of times for each font that appears in the document. We currently only run this for the node's primary font when initiating translation, though we may want to change this in the future so that node exclusion is recomputed when the primary font of a node changes. Note that in the case where an icon font fails to load, we won't exclude the text node from translation, since the primary font will be a fallback. This is intentional, since the node would appear in the document as normally rendered text (rather than icons), which should be translated. * editing/TextManipulationController.h: * platform/graphics/Font.cpp: (WebCore::Font::isProbablyOnlyUsedToRenderIcons const): * platform/graphics/Font.h: * platform/graphics/FontPlatformData.cpp: (WebCore::FontPlatformData::familyName const): * platform/graphics/FontPlatformData.h: * platform/graphics/cocoa/FontCocoa.mm: (WebCore::Font::isProbablyOnlyUsedToRenderIcons const): Add a heuristic to detect whether a platform font should be excluded from text manipulation. For now, we only return true if we suspect that this font is an "icon-only" font (for instance, the "Material Icons" font). We guess that a font is *probably* an icon-only font if the font supports only characters from the basic or PUA unicode planes, and the glyph bounds for the set of supported non-control basic latin characters are all empty. * platform/graphics/cocoa/FontPlatformDataCocoa.mm: (WebCore::FontPlatformData::familyName const): Add a platform `familyName()` helper method on `FontPlatformData`. On Cocoa platforms, this wraps a call to `CTFontCopyFamilyName`. 2020-06-25 Kate Cheney <katherine_cheney@apple.com> App-bound domain service worker registrations should be limited https://bugs.webkit.org/show_bug.cgi?id=213601 <rdar://problem/64717589> Reviewed by Brent Fulgham. Limit number of service worker registrations for app-bound domains. The current proposal is 3, but this could be changed in the future. No new tests, currently TestWebKitAPI is unable to test failed service worker registration (test will timeout). Confirmed behavior manually. * workers/service/server/SWServer.cpp: (WebCore::SWServer::validateRegistrationDomain): 2020-06-25 Wenson Hsieh <wenson_hsieh@apple.com> Upstream macOS 11 additions to RenderThemeMac.mm and ThemeMac.mm https://bugs.webkit.org/show_bug.cgi?id=213608 <rdar://problem/64758299> Reviewed by Darin Adler. Replace WebKitAdditions imports with the imported code. No change in behavior. * css/html.css: (input::-webkit-contacts-auto-fill-button): * platform/mac/ThemeMac.mm: (WebCore::ThemeMac::supportsLargeFormControls): * rendering/RenderThemeMac.h: * rendering/RenderThemeMac.mm: (WebCore::createAttachmentPlaceholderImage): (WebCore::RenderThemeMac::extraDefaultStyleSheet): Deleted. Remove the override for extraDefaultStyleSheet altogether, since this was only used to temporarily hide the new contact AutoFill button appearance from open source WebKit. 2020-06-25 Sergio Villar Senin <svillar@igalia.com> Unreviewed build fix for WebXR enabled non-OpenXR builds. * platform/xr/openxr/PlatformXROpenXR.cpp: (PlatformXR::Instance::Impl::enumerateApiLayerProperties const): Guard method with USE_OPENXR. (PlatformXR::Instance::Impl::enumerateInstanceExtensionProperties const): Ditto. (PlatformXR::Instance::Impl::Impl): Guard method body with USE_OPENXR. (PlatformXR::Instance::Impl::~Impl): Ditto. 2020-06-25 Chris Dumez <cdumez@apple.com> Unreviewed iOS build fix after r263511. * platform/mediastream/MediaStreamPrivate.h: 2020-06-25 Youenn Fablet <youenn@apple.com> MediaRecorder stopRecorder() returns empty Blob after first use https://bugs.webkit.org/show_bug.cgi?id=212274 <rdar://problem/63601298> Reviewed by Eric Carlson. Refactor code to create/destroy MediaRecorderPrivate on MediaRecorder start/stop. This allows reusing a MediaRecorder after a stop and restarting with a clean state. We introduce MediaRecorderPrivate::startRecording to do the initialization, which allows to fix a potential ref cycle as part of the error callback handling. Make some improvements to the platform implementation, in particular add default initialization to all fields. Align the code using AudioConverterRef to what is done in AudioSampleDataSource. Also call VTCompressionSessionInvalidate when destroying the VideoSampleBufferCompressor. Test: http/wpt/mediarecorder/MediaRecorder-multiple-start-stop.html * Modules/mediarecorder/MediaRecorder.cpp: (WebCore::MediaRecorder::create): (WebCore::MediaRecorder::MediaRecorder): (WebCore::MediaRecorder::startRecording): (WebCore::MediaRecorder::stopRecording): (WebCore::MediaRecorder::requestData): * Modules/mediarecorder/MediaRecorder.h: * platform/mediarecorder/MediaRecorderPrivate.h: (WebCore::MediaRecorderPrivate::startRecording): * platform/mediarecorder/cocoa/AudioSampleBufferCompressor.h: * platform/mediarecorder/cocoa/AudioSampleBufferCompressor.mm: (WebCore::AudioSampleBufferCompressor::~AudioSampleBufferCompressor): (WebCore::AudioSampleBufferCompressor::initAudioConverterForSourceFormatDescription): (WebCore::AudioSampleBufferCompressor::attachPrimingTrimsIfNeeded): (WebCore::AudioSampleBufferCompressor::gradualDecoderRefreshCount): (WebCore::AudioSampleBufferCompressor::sampleBufferWithNumPackets): (WebCore::AudioSampleBufferCompressor::processSampleBuffersUntilLowWaterTime): * platform/mediarecorder/cocoa/MediaRecorderPrivateWriterCocoa.h: * platform/mediarecorder/cocoa/MediaRecorderPrivateWriterCocoa.mm: (WebCore::MediaRecorderPrivateWriter::stopRecording): * platform/mediarecorder/cocoa/VideoSampleBufferCompressor.mm: (WebCore::VideoSampleBufferCompressor::~VideoSampleBufferCompressor): 2020-06-25 Zalan Bujtas <zalan@apple.com> [LFC][TFC] Use the flexing value as the base for the available horizontal space distribution https://bugs.webkit.org/show_bug.cgi?id=213599 Reviewed by Antti Koivisto. Test: fast/layoutformattingcontext/table-min-max-flex-distribution-simple.html * layout/tableformatting/TableLayout.cpp: (WebCore::Layout::TableFormattingContext::TableLayout::distributedHorizontalSpace): 2020-06-25 Antoine Quint <graouts@webkit.org> REGRESSION (r260360): easing curves are broken on JS-originated animations https://bugs.webkit.org/show_bug.cgi?id=213495 <rdar://problem/64649747> Reviewed by Darin Adler. Prior to Web Animations, there was no way for an animation to set an animation-wide timing function while also setting a per-keyframe timing function. As such GraphicsLayerCA would sometimes decide to set the timing function on keyframes or on the entire CAAnimation. However, we can no longer do this with Web Animations where an animation can set an animation-wide timing function and also keyframe-specific timing functions. In this patch we create CAKeyframeAnimation objects for any animation that has at least two keyframes if Web Animations are enabled, whereas the legacy code path requires at least three keyframes. We allow PlatformCAAnimation::setTimingFunction() to be called in the Web Animations code path only under GraphicsLayerCA::setupAnimation() while leaving the only call sites in place only for the legacy code path. Finally, we modify GraphicsLayerCA::timingFunctionForAnimationValue() to only ever return a keyframe- specific timing function or fall back to a default linear timing function in the Web Animations code path, leaving the function to behave the same way as it used to in the legacy code path. Test: webanimations/accelerated-animation-with-easing.html * platform/animation/TimingFunction.h: * platform/graphics/ca/GraphicsLayerCA.cpp: (WebCore::isKeyframe): (WebCore::GraphicsLayerCA::createAnimationFromKeyframes): (WebCore::GraphicsLayerCA::appendToUncommittedAnimations): (WebCore::GraphicsLayerCA::createTransformAnimationsFromKeyframes): 2020-06-25 Sergio Villar Senin <svillar@igalia.com> Unreviewed, WPE Debug build fix after r263503. * platform/xr/openxr/PlatformXROpenXR.cpp: (PlatformXR::OpenXRDevice::OpenXRDevice): Use m_instance instead of m_impl->xrInstance(). 2020-06-25 Alicia Boya García <aboya@igalia.com> [GStreamer] Don't invalidate MainThreadNotifier until the streaming threads are joined https://bugs.webkit.org/show_bug.cgi?id=213197 Reviewed by Xabier Rodriguez-Calvar. ~MediaPlayerPrivateGStreamer() used to call m_notifier->invalidate() before setting the pipeline to NULL state. This caused a race where the streaming threads could post a task to the MainThreadNotifier between these two events and cause a crash in ASSERT(m_isValid.load()) -- that is, the notifier was used while invalidated. Fixing this is actually easy. ~MediaPlayerPrivateGStreamer() is always run from the main thread, so no MainThreadNotifier tasks will be run before the destructor is complete. By moving the m_notifier->invalidate() call to after the pipeline has been set to NULL (and therefore all streaming threads torn down) we are ensuring no more taks will be posted, and since the MainThreadNotifier is invalidated by that point, already posted tasks will not be run. The race fixed by this patch is rare and wide-arching, so this patch doesn't introduce TestExpectations changes, but it should avoid further crashes like the ones reported in the Bugzilla issue attached. * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp: (WebCore::MediaPlayerPrivateGStreamer::~MediaPlayerPrivateGStreamer): 2020-06-23 Sergio Villar Senin <svillar@igalia.com> [WebXR] Check device orientation support when requesting a reference space https://bugs.webkit.org/show_bug.cgi?id=213519 Reviewed by Carlos Garcia Campos. When requesting a local reference space the specs mandate us to check whether or not the device supports orientation tracking. This was not implemented in the OpenXR backend, so we were unconditionally returning true. The OpenXR devices now properly check whether or not orientation tracking is initialized. We took the chance to refactor a bit the OpenXR backend moving all the device initialization code to the OpenXRDevice class. The current tests already check this functionality. * Modules/webxr/WebXRSession.cpp: (WebCore::WebXRSession::referenceSpaceIsSupported const): Call supportsOrientationTracking() on device. * platform/xr/PlatformXR.h: (PlatformXR::Device::supportsOrientationTracking const): Added. * platform/xr/openxr/PlatformXROpenXR.cpp: (PlatformXR::Instance::enumerateImmersiveXRDevices): Just create the OpenXR device, it will automatically initialize itself. (PlatformXR::OpenXRDevice::OpenXRDevice): Get XrSystem and XrInstance as parametters. (PlatformXR::OpenXRDevice::collectSupportedSessionModes): Moved from Instance::Impl. (PlatformXR::Instance::Impl::collectSupportedSessionModes): Deleted. * platform/xr/openxr/PlatformXROpenXR.h: * testing/WebFakeXRDevice.h: Mark the SimulatedXRDevice as supporting orientation tracking. 2020-06-24 James Savage <james.savage@apple.com> Upstream iPadOS 13.0 multi-window support https://bugs.webkit.org/show_bug.cgi?id=213590 Reviewed by Alexey Proskuryakov. * platform/ios/VideoFullscreenInterfaceAVKit.mm: (VideoFullscreenInterfaceAVKit::doSetup): Always construct a UIWindow using the expected UIWindowScene. (makeWindowFromView): Deleted. 2020-06-24 Wenson Hsieh <wenson_hsieh@apple.com> Running spellcheck on https://developer.apple.com/forums/thread/650317 hangs the web process https://bugs.webkit.org/show_bug.cgi?id=213585 <rdar://problem/64681632> Reviewed by Simon Fraser. In `TextCheckingHelper::findFirstMisspellingOrBadGrammar`, we attempt to find the first misspelled piece of text by iterating over the current paragraph range; when we exhaust the current paragraph range, we try to move on to the next paragraph range by setting the current paragraph range to the start and end of the next paragraph, using `startOfNextParagraph`. However, `startOfNextParagraph` may return the null position in some cases (as seen in this bug, and the associated layout test). This logic isn't robust against this possibility, and will end up looping infinitely in the while loop, since `setStart` and `setEnd` are no-ops when given a null position, and so the current paragraph remains the same. Make this logic for finding the next misspelled word more robust by allowing us to bail out of the while loop in the case where setStart or setEnd failed to advance the paragraph range (e.g. due to a null position, or DOM exception). Test: editing/mac/spelling/advance-to-next-misspelling.html * editing/TextCheckingHelper.cpp: (WebCore::TextCheckingHelper::findFirstMisspellingOrBadGrammar): * testing/Internals.cpp: (WebCore::Internals::advanceToNextMisspelling): Add an internal testing hook to advance to the next misspelling. * testing/Internals.h: * testing/Internals.idl: 2020-06-24 David Kilzer <ddkilzer@apple.com> Use ObjectIdentifier<>instead of WebCore::nextPlaybackTargetClientContextId() in Document.cpp <https://webkit.org/b/213546> <rdar://problem/61803576> Reviewed by Youenn Fablet. Switch from uint64_t to WebCore::PlaybackTargetClientContextIdentifier for contextId values. * Headers.cmake: * WebCore.xcodeproj/project.pbxproj: - Add PlaybackTargetClientContextIdentifier.h to the project. * Modules/mediasession/PlaybackTargetClientContextIdentifier.h: Add. * Modules/mediasession/WebMediaSessionManager.cpp: (WebCore::ClientState::ClientState): (WebCore::WebMediaSessionLogger::logAlways const): (WebCore::WebMediaSessionManager::addPlaybackTargetPickerClient): (WebCore::WebMediaSessionManager::removePlaybackTargetPickerClient): (WebCore::WebMediaSessionManager::showPlaybackTargetPicker): (WebCore::WebMediaSessionManager::clientStateDidChange): (WebCore::WebMediaSessionManager::find): * Modules/mediasession/WebMediaSessionManager.h: * Modules/mediasession/WebMediaSessionManagerClient.h: * dom/Document.cpp: (WebCore::Document::addPlaybackTargetPickerClient): (WebCore::Document::removePlaybackTargetPickerClient): (WebCore::Document::playbackTargetAvailabilityDidChange): (WebCore::Document::setPlaybackTarget): (WebCore::Document::setShouldPlayToPlaybackTarget): (WebCore::Document::playbackTargetPickerWasDismissed): (WebCore::nextPlaybackTargetClientContextId): Delete. - Replace with PlaybackTargetClientContextIdentifier::generate(). * dom/Document.h: * page/ChromeClient.h: (WebCore::ChromeClient::addPlaybackTargetPickerClient): (WebCore::ChromeClient::removePlaybackTargetPickerClient): (WebCore::ChromeClient::showPlaybackTargetPicker): (WebCore::ChromeClient::playbackTargetPickerClientStateDidChange): * page/Page.cpp: (WebCore::Page::addPlaybackTargetPickerClient): (WebCore::Page::removePlaybackTargetPickerClient): (WebCore::Page::showPlaybackTargetPicker): (WebCore::Page::playbackTargetPickerClientStateDidChange): (WebCore::Page::setPlaybackTarget): (WebCore::Page::playbackTargetAvailabilityDidChange): (WebCore::Page::setShouldPlayToPlaybackTarget): (WebCore::Page::playbackTargetPickerWasDismissed): * page/Page.h: 2020-06-24 Clark Wang <clark_wang@apple.com> Removed unrestricted keyword from attributes in PannerNode https://bugs.webkit.org/show_bug.cgi?id=213523 Updated refDistance, maxDistance, rolloffFactor, coneOuterGain, coneInnerAngle, coneOuterAngle attributes according to spec: https://www.w3.org/TR/webaudio/#PannerNode-attributes. Reviewed by Darin Adler. Test: webaudio/prefixed-pannernode-basic.html * Modules/webaudio/PannerNode.cpp: (WebCore::PannerNode::setRefDistance): (WebCore::PannerNode::setMaxDistance): (WebCore::PannerNode::setRolloffFactor): (WebCore::PannerNode::setConeOuterGain): * Modules/webaudio/PannerNode.h: * Modules/webaudio/PannerNode.idl: 2020-06-24 Peng Liu <peng.liu6@apple.com> Black rectangle appears when closing PIP on iPhone https://bugs.webkit.org/show_bug.cgi?id=213570 Reviewed by Eric Carlson. * platform/ios/VideoFullscreenInterfaceAVKit.mm: (VideoFullscreenInterfaceAVKit::willStopPictureInPicture): Don't unhide the window and view of WebAVPlayerViewController before exiting Picture-in-Picture. 2020-06-24 Simon Fraser <simon.fraser@apple.com> REGRESSION (r260276): Scrolling through shelves on music.apple.com is not smooth https://bugs.webkit.org/show_bug.cgi?id=213572 Reviewed by Wenson Hsieh. The scroll position for an overflow:scroll element with scroll-snap could jump around during scrolling, if layout triggered a call to ScrollableArea::updateScrollSnapState(). The crux of the issue is that isScrollSnapInProgress() returned false for overflow:scrollers which are scrolling asynchronously. Fix by extending the existing ScrollingTree::isScrollSnapInProgress() to track all scrolling nodes by storing a HashSet<ScrollingNodeID> rather than just a flag for the main frame. RenderLayer::isScrollSnapInProgress() then consults the ScrollingCoordinator, which consults the scrolling tree for this state. Add the ability to test via internals.isScrollSnapInProgress(). Test: fast/scrolling/mac/scroll-snapping-in-progress.html * dom/Document.h: * page/FrameView.cpp: (WebCore::FrameView::isScrollSnapInProgress const): The main thread can run snapping logic even for async-scrollable frames, so consult the ScrollingCoordinator and FrameView's ScrollAnimator. * page/scrolling/AsyncScrollingCoordinator.cpp: (WebCore::AsyncScrollingCoordinator::isScrollSnapInProgress const): * page/scrolling/AsyncScrollingCoordinator.h: * page/scrolling/ScrollingCoordinator.h: (WebCore::ScrollingCoordinator::isScrollSnapInProgress const): * page/scrolling/ScrollingTree.cpp: (WebCore::ScrollingTree::isScrollSnapInProgressForNode): (WebCore::ScrollingTree::setNodeScrollSnapInProgress): (WebCore::ScrollingTree::isScrollSnapInProgress): Deleted. (WebCore::ScrollingTree::setMainFrameIsScrollSnapping): Deleted. * page/scrolling/ScrollingTree.h: * page/scrolling/ScrollingTreeScrollingNode.cpp: (WebCore::ScrollingTreeScrollingNode::setScrollSnapInProgress): (WebCore::ScrollingTreeScrollingNode::isScrollSnapInProgress const): * page/scrolling/ScrollingTreeScrollingNode.h: * page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.mm: (WebCore::ScrollingTreeFrameScrollingNodeMac::handleWheelEvent): * page/scrolling/mac/ScrollingTreeScrollingNodeDelegateMac.mm: (WebCore::ScrollingTreeScrollingNodeDelegateMac::willStartScrollSnapAnimation): (WebCore::ScrollingTreeScrollingNodeDelegateMac::didStopScrollSnapAnimation): * rendering/RenderLayer.cpp: (WebCore::RenderLayer::requestScrollPositionUpdate): (WebCore::RenderLayer::isScrollSnapInProgress const): (WebCore::RenderLayer::setupFontSubpixelQuantization): * testing/Internals.cpp: (WebCore:: const): (WebCore::Internals::scrollSnapOffsets): (WebCore::Internals::isScrollSnapInProgress): * testing/Internals.h: * testing/Internals.idl: 2020-06-24 Jason Lawrence <lawrence.j@apple.com> Unreviewed, reverting r263466. This commit caused 50+ crashes on multiple queues internally. Reverted changeset: "REGRESSION (r260360): easing curves are broken on JS- originated animations" https://bugs.webkit.org/show_bug.cgi?id=213495 https://trac.webkit.org/changeset/263466 2020-06-24 Wenson Hsieh <wenson_hsieh@apple.com> Allow the async clipboard API to write data when copying via menu action or key binding https://bugs.webkit.org/show_bug.cgi?id=213568 <rdar://problem/64711653> Reviewed by Darin Adler. Makes a couple of minor adjustments to allow `clipboard.write` and `clipboard.writeText` to work during a user- triggered copy event (that is, from menu or key binding). See below for more details. Test: editing/async-clipboard/clipboard-write-in-copy-event-handler.html * Modules/async-clipboard/Clipboard.cpp: (WebCore::shouldProceedWithClipboardWrite): Add a mechanism to keep track of when Editor is handling a copy or cut event that is the result of interacting with a key binding or menu action. Use this mechanism to grant write access via the async clipboard API. * editing/Editor.cpp: (WebCore::dispatchClipboardEvent): Only attempt to commit the static pasteboard to the platform pasteboard during a copy event when preventing default if the StaticPasteboard-backed DataTransfer actually contains data. This fixes a race condition when writing to the pasteboard using the async clipboard API during the "copy" event, where the changeCount when beginning to write is incremented due to the pasteboard getting cleared. This change will also make it so that calling `preventDefault()` on the copy event will result in no change to the system pasteboard, instead of clearing out any existing content on the pasteboard. (WebCore::Editor::cut): (WebCore::Editor::copy): * editing/Editor.h: (WebCore::Editor::isCopyingFromMenuOrKeyBinding const): * editing/EditorCommand.cpp: (WebCore::executeCopy): (WebCore::executeCut): 2020-06-24 Umar Iqbal <uiqbal@apple.com> We should resurrect the older patch that collects some statistics of web API calls https://bugs.webkit.org/show_bug.cgi?id=213319 Reviewed by Brent Fulgham. No new tests. Enabled existing tests. Enabled http/tests/webAPIStatistics that test the functionality behind WEB_API_STATISTICS flag. + Brought back WebCore::encodeHashSet(KeyedEncoder& encoder, const String& label, const String& key, const HashSet<String>& hashSet) because it was needed by WebCore::encodeFontHashSet(KeyedEncoder& encoder, const String& label, const HashSet<String>& hashSet) + Changed the type of HashCountedSet to HashSet because of earlier patch (https://bugs.webkit.org/attachment.cgi?id=363033) updated other HashCountedSet to HashSet, stating that the counted statistics were never used (see change log in the mentioned patch). + Also changed the type of topFrameRegistrableDomainsWhichAccessedWebAPIs HashSet from String to RegistrableDomain. See the earlier bug (https://bugs.webkit.org/show_bug.cgi?id=194791) that explains the switch from String to RegistrableDomain for eTLD+1's + Enabled WEB_API_STATISTICS flag in FeatureDefines.xcconfig and PlatformEnableCocoa.h + Added WTF::EnumTraits<> for OptionSet<> enum in ResourceLoadStatistics.h due to an earlier change. * loader/ResourceLoadStatistics.h: * Configurations/FeatureDefines.xcconfig: * loader/CanvasActivityRecord.h: * loader/ResourceLoadStatistics.cpp: (WebCore::encodeHashSet): (WebCore::ResourceLoadStatistics::encode const): (WebCore::decodeHashSet): (WebCore::decodeCanvasActivityRecord): (WebCore::ResourceLoadStatistics::decode): (WebCore::appendHashSet): (WebCore::ResourceLoadStatistics::toString const): 2020-06-24 Pinki Gyanchandani <pgyanchandani@apple.com> Null Ptr Deref READ @ WTF::Optional<WTF::Seconds>::clear https://bugs.webkit.org/show_bug.cgi?id=213543 Reviewed by Geoffrey Garen. While performing an animation request, the callback functions modifies the iframe's srcdoc attribute, leading to domWindow being null during rendering, and resulting into crash. Test: fast/rendering/iframe-window-animation-modifies-iframe-srcdoc-crash.html * page/Page.cpp: (WebCore::Page::updateRendering): 2020-06-24 Fujii Hironori <Hironori.Fujii@sony.com> [WinCairo] -webkit-font-smoothing:antialiased makes fonts blurry https://bugs.webkit.org/show_bug.cgi?id=206573 Reviewed by Alex Christensen. After -webkit-font-smoothing support was added to Cairo port in r254506 (Bug 54763), fonts looks jaggy and faint in WinCairo port in some web sites using -webkit-font-smoothing:antialiased, for example Google News, GMail, https://apple.com. 'antialiased' of -webkit-font-smoothing was mapped to CAIRO_ANTIALIAS_GRAY. And, CAIRO_ANTIALIAS_GRAY is mapped to ANTIALIASED_QUALITY in cairo-win32-font.c. ANTIALIASED_QUALITY makes fonts jaggy and faint. Use CAIRO_ANTIALIAS_SUBPIXEL instead of CAIRO_ANTIALIAS_GRAY for 'antialiased' as well as 'subpixel-antialiased' does. * platform/graphics/cairo/CairoOperations.cpp: (WebCore::Cairo::drawGlyphsToContext): Don't use CAIRO_ANTIALIAS_GRAY for Win32 Cairo. 2020-06-24 Antoine Quint <graouts@webkit.org> REGRESSION (r260360): easing curves are broken on JS-originated animations https://bugs.webkit.org/show_bug.cgi?id=213495 <rdar://problem/64649747> Reviewed by Darin Adler. Prior to Web Animations, there was no way for an animation to set an animation-wide timing function while also setting a per-keyframe timing function. As such GraphicsLayerCA would sometimes decide to set the timing function on keyframes or on the entire CAAnimation. However, we can no longer do this with Web Animations where an animation can set an animation-wide timing function and also keyframe-specific timing functions. In this patch we create CAKeyframeAnimation objects for any animation that has at least two keyframes if Web Animations are enabled, whereas the legacy code path requires at least three keyframes. We allow PlatformCAAnimation::setTimingFunction() to be called in the Web Animations code path only under GraphicsLayerCA::setupAnimation() while leaving the only call sites in place only for the legacy code path. Finally, we modify GraphicsLayerCA::timingFunctionForAnimationValue() to only ever return a keyframe- specific timing function or fall back to a default linear timing function in the Web Animations code path, leaving the function to behave the same way as it used to in the legacy code path. Test: webanimations/accelerated-animation-with-easing.html * platform/graphics/ca/GraphicsLayerCA.cpp: (WebCore::isKeyframe): (WebCore::GraphicsLayerCA::createAnimationFromKeyframes): (WebCore::GraphicsLayerCA::appendToUncommittedAnimations): (WebCore::GraphicsLayerCA::createTransformAnimationsFromKeyframes): 2020-06-24 Antoine Quint <graouts@webkit.org> REGRESSION: Delayed updating of the parallax images on pacificvoyages.net/posts https://bugs.webkit.org/show_bug.cgi?id=212213 <rdar://problem/63497946> Reviewed by Simon Fraser. Test: webanimations/css-transition-retargeting-during-ready-promise.html When a transition's ready promise is resolved, its start time is the same as the timeline's current time. This means that retargeting a transition at that moment will yield a progress of zero even though the transition was started before the current animation frame. This means that retargeting a property on each page rendering may start a new transition with the same from value, which can have an undesirable effect such as on the website reported in this bug. We now keep track of the timeline time when a transition is created and use this time as a start time override when applying the animation to compute the before-change style in AnimationTimeline::updateCSSTransitionsForElementAndProperty(). To do so, we pass an optional start time all the way from WebAnimation::resolve() through to WebAnimation::currentTime() and via the animation effect timing computation. * animation/AnimationEffect.cpp: (WebCore::AnimationEffect::getBasicTiming const): (WebCore::AnimationEffect::getComputedTiming const): * animation/AnimationEffect.h: * animation/AnimationTimeline.cpp: (WebCore::AnimationTimeline::updateCSSTransitionsForElementAndProperty): * animation/CSSTransition.cpp: (WebCore::CSSTransition::CSSTransition): (WebCore::CSSTransition::resolve): * animation/CSSTransition.h: * animation/KeyframeEffect.cpp: (WebCore::KeyframeEffect::apply): * animation/KeyframeEffect.h: * animation/WebAnimation.cpp: (WebCore::WebAnimation::currentTime const): (WebCore::WebAnimation::resolve): * animation/WebAnimation.h: 2020-06-24 Eric Carlson <eric.carlson@apple.com> Don't claim to support fullscreen mode unless fullScreenEnabled setting is enabled https://bugs.webkit.org/show_bug.cgi?id=213142 <rdar://63753327> Reviewed by Jer Noble. Test: media/video-supports-fullscreen.html * html/HTMLVideoElement.cpp: (WebCore::HTMLVideoElement::supportsFullscreen const): Check settings.fullScreenEnabled. 2020-06-24 Philippe Normand <pnormand@igalia.com> [GStreamer] webrtc/disable-encryption.html is a crashing flaky https://bugs.webkit.org/show_bug.cgi?id=211166 <rdar://problem/63223973> Reviewed by Xabier Rodriguez-Calvar. Simplify the process to create internal appsrc elements. I suspect something bad was ongoing with these moves of GRefPtr. * platform/mediastream/gstreamer/GStreamerMediaStreamSource.cpp: (WebCore::_WebKitMediaStreamSrc::SourceData::ensureAppSrc): (WebCore::webkitMediaStreamSrcSetupAppSrc): (WebCore::_WebKitMediaStreamSrc::SourceData::setSrc): Deleted. 2020-06-24 Antti Koivisto <antti@apple.com> Style resolution sometimes fails to create all style resolvers for shadow trees. https://bugs.webkit.org/show_bug.cgi?id=212946 <rdar://problem/60916215>> Reviewed by Anders Carlsson. This can cause problems later. * style/StyleTreeResolver.cpp: (WebCore::Style::TreeResolver::Scope::Scope): Ensure all style resolvers are constructed before traversing. 2020-06-24 Youenn Fablet <youenn@apple.com> Add logging to WebRTC video pipeline to check for frame rate stability https://bugs.webkit.org/show_bug.cgi?id=213369 Reviewed by Eric Carlson. Add a FrameRateMonitor class to compute frame stability. Use this class at end of the video pipeline (LocalSampleBufferDisplayLayer). Log messages in case a frame gets frozen at LocalSampleBufferDisplayLayer time. We compute that a frame takes too long by checking whether it is delayed by more than three expected frames. This logging is complemented with encoded frame reception logging (at the beginning of the video pipeline) and WebRTC stats logging (freezeCount, totalFreezeDuration, shortly after decoding the frames). * Sources.txt: * WebCore.xcodeproj/project.pbxproj: * platform/FrameRateMonitor.cpp: Added. (WebCore::FrameRateMonitor::newFrame): * platform/FrameRateMonitor.h: Added. (WebCore::FrameRateMonitor::frameRate const): (WebCore::FrameRateMonitor::frameCount const): (WebCore::FrameRateMonitor::FrameRateMonitor): * platform/graphics/avfoundation/objc/LocalSampleBufferDisplayLayer.h: * platform/graphics/avfoundation/objc/LocalSampleBufferDisplayLayer.mm: (WebCore::LocalSampleBufferDisplayLayer::LocalSampleBufferDisplayLayer): (WebCore::LocalSampleBufferDisplayLayer::enqueueSample): (WebCore::LocalSampleBufferDisplayLayer::enqueueSampleBuffer): (WebCore::LocalSampleBufferDisplayLayer::onFrameRateNotification): * platform/mediastream/mac/AudioMediaStreamTrackRendererUnit.h: Unified build fix. 2020-06-24 Alexey Shvayka <shvaikalesh@gmail.com> Remove [CallbackNeedsOperatorEqual] extended attribute https://bugs.webkit.org/show_bug.cgi?id=213538 Reviewed by Chris Dumez. This change removes now unused [CallbackNeedsOperatorEqual] extended attribute. It was added to accommodate MediaQueryListListener, which was removed in r260243. We are safe to remove [CallbackNeedsOperatorEqual] since its implementation expects certain constructor signature, and callback interfaces are considered legacy by spec authors anyway. Also, this patch removes 2 resolved FIXMEs: 1. OrdinaryDefineOwnProperty() is performed correctly, no dynamic dispatch there. 2. Set() is performed correctly, with `false` as last argument. (changed in https://github.com/heycam/webidl/pull/832, covered by WPT) No new tests, no behavior change. * bindings/scripts/CodeGeneratorJS.pm: (GenerateDefineOwnProperty): (GenerateAttributeSetterBodyDefinition): (GenerateCallbackHeaderContent): (GenerateCallbackImplementationContent): * bindings/scripts/IDLAttributes.json: 2020-06-23 Sergio Villar Senin <svillar@igalia.com> [WebXR] Fix PlatformXR initialization/destruction https://bugs.webkit.org/show_bug.cgi?id=213509 Reviewed by Youenn Fablet. There were two different issues, one at creation time and the other one at destruction. At creation time we were not calling construct() for the LazyNeverDestroyed object. That was making the WebProcess crash in Debug builds. At destruction time we were calling xrDestroyInstance() without checking that the passed instance was a valid one, although OpenXR implementations deal with it the spec is pretty clear. * platform/xr/PlatformXR.h: Mark LazyNeverDestroyed as friend and default constructor&destructor. * platform/xr/openxr/PlatformXROpenXR.cpp: (PlatformXR::Instance::Impl::~Impl): Check that instance is not XR_NULL_HANDLE before destroying. (PlatformXR::Instance::singleton): Call construct() on the Lazy instance. 2020-06-24 Youenn Fablet <youenn@apple.com> Use signalling thread as worker thread instead of network thread https://bugs.webkit.org/show_bug.cgi?id=213512 Reviewed by Eric Carlson. This is probably better since network thread is always busy while the siganlling thread is mostly busy at negotiation time. This also aligns with Chromium current setup. No change of behavior. * platform/mediastream/libwebrtc/LibWebRTCProvider.cpp: (WebCore::LibWebRTCProvider::createPeerConnectionFactory): 2020-06-24 Rob Buis <rbuis@igalia.com> Add referrerpolicy attribute support for <link> https://bugs.webkit.org/show_bug.cgi?id=213342 Reviewed by Darin Adler. Give the referrer policy member a clear default. * loader/LinkLoader.h: 2020-06-23 Zalan Bujtas <zalan@apple.com> [Multicol] Reset the childrenInline state on the RenderBlockFlow when destroying the multicolumn context https://bugs.webkit.org/show_bug.cgi?id=213535 <rdar://problem/64541835> Reviewed by Simon Fraser. The "childrenInline" flags tells the tree builder whether a newly inserted inline content needs an anonymous block wrapper or not. RenderBlockFlows with multicolumn content have this flag set to false as the RenderMultiColumnFlowThread is a block renderer. As part of the mulicolumn context destruction, we move all the descendants from RenderMultiColumnFlowThread back to the original parent (the parent of the RenderMultiColumnFlowThread renderer). This patch sets this flag back to the initial value of true so that we don't end up constructing redundant wrappers for the incoming inline content. * rendering/updating/RenderTreeBuilderMultiColumn.cpp: (WebCore::RenderTreeBuilder::MultiColumn::destroyFragmentedFlow): 2020-06-23 Geoffrey Garen <ggaren@apple.com> Remove WTF::setMainThreadCallbacksPaused https://bugs.webkit.org/show_bug.cgi?id=213112 Reviewed by Tim Horton. * inspector/PageScriptDebugServer.cpp: (WebCore::PageScriptDebugServer::setJavaScriptPaused): 2020-06-23 Chris Dumez <cdumez@apple.com> Unreviewed, update xcfilelist files after some recent WebXR changes. * DerivedSources-input.xcfilelist: * DerivedSources-output.xcfilelist: 2020-06-23 Chris Dumez <cdumez@apple.com> Remove a lot of unnecessary calls to Ref::copyRef() https://bugs.webkit.org/show_bug.cgi?id=213533 Reviewed by Darin Adler. Remove a lot of unnecessary calls to Ref::copyRef() now that Ref is copyable. * Modules/cache/DOMCache.cpp: (WebCore::DOMCache::addAll): * Modules/indexeddb/IDBTransaction.cpp: (WebCore::IDBTransaction::doRequestOpenCursor): (WebCore::IDBTransaction::requestGetAllObjectStoreRecords): (WebCore::IDBTransaction::requestGetAllIndexRecords): (WebCore::IDBTransaction::requestGetRecord): (WebCore::IDBTransaction::requestIndexRecord): (WebCore::IDBTransaction::requestCount): (WebCore::IDBTransaction::requestDeleteRecord): (WebCore::IDBTransaction::requestClearObjectStore): (WebCore::IDBTransaction::requestPutOrAdd): * Modules/mediarecorder/MediaRecorder.cpp: (WebCore::MediaRecorder::create): * Modules/mediastream/CanvasCaptureMediaStreamTrack.cpp: (WebCore::CanvasCaptureMediaStreamTrack::Source::create): * Modules/webdatabase/Database.cpp: (WebCore::Database::scheduleTransactionCallback): * Modules/websockets/WorkerThreadableWebSocketChannel.cpp: (WebCore::WorkerThreadableWebSocketChannel::Peer::send): (WebCore::WorkerThreadableWebSocketChannel::Peer::bufferedAmount): (WebCore::WorkerThreadableWebSocketChannel::Peer::didConnect): (WebCore::WorkerThreadableWebSocketChannel::Peer::didReceiveMessage): (WebCore::WorkerThreadableWebSocketChannel::Peer::didReceiveBinaryData): (WebCore::WorkerThreadableWebSocketChannel::Peer::didUpdateBufferedAmount): (WebCore::WorkerThreadableWebSocketChannel::Peer::didStartClosingHandshake): (WebCore::WorkerThreadableWebSocketChannel::Peer::didClose): (WebCore::WorkerThreadableWebSocketChannel::Peer::didReceiveMessageError): (WebCore::WorkerThreadableWebSocketChannel::Peer::didUpgradeURL): (WebCore::WorkerThreadableWebSocketChannel::Bridge::mainThreadInitialize): (WebCore::WorkerThreadableWebSocketChannel::Bridge::initialize): * bindings/js/ScriptController.cpp: (WebCore::ScriptController::executeAsynchronousUserAgentScriptInWorld): * crypto/SubtleCrypto.cpp: (WebCore::SubtleCrypto::wrapKey): * loader/DocumentWriter.cpp: (WebCore::DocumentWriter::begin): * loader/NetscapePlugInStreamLoader.cpp: (WebCore::NetscapePlugInStreamLoader::create): * loader/SubresourceLoader.cpp: (WebCore::SubresourceLoader::create): * platform/graphics/ImageSource.cpp: (WebCore::ImageSource::startAsyncDecodingQueue): * platform/graphics/avfoundation/objc/CDMInstanceFairPlayStreamingAVFObjC.mm: (WebCore::CDMInstanceSessionFairPlayStreamingAVFObjC::didProvideRequests): * platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp: * platform/mediastream/mac/AudioMediaStreamTrackRendererCocoa.cpp: (WebCore::AudioMediaStreamTrackRendererCocoa::pushSamples): * workers/WorkerGlobalScope.cpp: (WebCore::WorkerGlobalScope::wrapCryptoKey): (WebCore::WorkerGlobalScope::unwrapCryptoKey): * workers/service/WorkerSWClientConnection.cpp: (WebCore::WorkerSWClientConnection::matchRegistration): (WebCore::WorkerSWClientConnection::getRegistrations): (WebCore::WorkerSWClientConnection::whenRegistrationReady): (WebCore::WorkerSWClientConnection::scheduleUnregisterJobInServer): * workers/service/context/ServiceWorkerFetch.cpp: (WebCore::ServiceWorkerFetch::dispatchFetchEvent): * workers/service/context/ServiceWorkerThread.cpp: (WebCore::ServiceWorkerThread::queueTaskToFireFetchEvent): (WebCore::ServiceWorkerThread::queueTaskToPostMessage): (WebCore::ServiceWorkerThread::queueTaskToFireInstallEvent): (WebCore::ServiceWorkerThread::queueTaskToFireActivateEvent): 2020-06-23 Chris Dumez <cdumez@apple.com> Drop AudioContextBase class https://bugs.webkit.org/show_bug.cgi?id=213522 Reviewed by Geoffrey Garen. Drop AudioContextBase class and have WebKitAudioContext subclass the new BaseAudioContext class instead. We recently introduced BaseAudioContext to match the specification and keeping AudioContextBase is now confusing. No new tests, this simplifies our code but there is no Web-facing behavior change. * Modules/webaudio/AnalyserNode.cpp: (WebCore::AnalyserNode::AnalyserNode): * Modules/webaudio/AnalyserNode.h: * Modules/webaudio/AudioBasicInspectorNode.cpp: (WebCore::AudioBasicInspectorNode::AudioBasicInspectorNode): * Modules/webaudio/AudioBasicInspectorNode.h: * Modules/webaudio/AudioBasicProcessorNode.cpp: (WebCore::AudioBasicProcessorNode::AudioBasicProcessorNode): * Modules/webaudio/AudioBasicProcessorNode.h: * Modules/webaudio/AudioBufferSourceNode.cpp: (WebCore::AudioBufferSourceNode::create): (WebCore::AudioBufferSourceNode::AudioBufferSourceNode): (WebCore::AudioBufferSourceNode::setBuffer): * Modules/webaudio/AudioBufferSourceNode.h: * Modules/webaudio/AudioContext.cpp: * Modules/webaudio/AudioDestinationNode.cpp: (WebCore::AudioDestinationNode::AudioDestinationNode): * Modules/webaudio/AudioDestinationNode.h: * Modules/webaudio/AudioNode.cpp: (WebCore::AudioNode::AudioNode): (WebCore::AudioNode::connect): (WebCore::AudioNode::disconnect): (WebCore::AudioNode::setChannelCount): (WebCore::AudioNode::setChannelCountMode): (WebCore::AudioNode::setChannelInterpretation): (WebCore::AudioNode::enableOutputsIfNecessary): * Modules/webaudio/AudioNode.h: (WebCore::AudioNode::context): (WebCore::AudioNode::context const): * Modules/webaudio/AudioNode.idl: * Modules/webaudio/AudioNodeOutput.h: (WebCore::AudioNodeOutput::context): * Modules/webaudio/AudioParam.cpp: (WebCore::AudioParam::AudioParam): * Modules/webaudio/AudioParam.h: * Modules/webaudio/AudioParamTimeline.cpp: (WebCore::AudioParamTimeline::valueForContextTime): * Modules/webaudio/AudioParamTimeline.h: * Modules/webaudio/AudioScheduledSourceNode.cpp: (WebCore::AudioScheduledSourceNode::AudioScheduledSourceNode): * Modules/webaudio/AudioScheduledSourceNode.h: * Modules/webaudio/AudioSummingJunction.cpp: (WebCore::AudioSummingJunction::AudioSummingJunction): * Modules/webaudio/AudioSummingJunction.h: (WebCore::AudioSummingJunction::context): * Modules/webaudio/BaseAudioContext.cpp: (WebCore::BaseAudioContext::BaseAudioContext): (WebCore::BaseAudioContext::document const): (WebCore::BaseAudioContext::scriptExecutionContext const): * Modules/webaudio/BaseAudioContext.h: (WebCore::BaseAudioContext::isOfflineContext const): (WebCore::BaseAudioContext::isWebKitAudioContext const): (WebCore::BaseAudioContext::currentSampleFrame const): (WebCore::BaseAudioContext::currentTime const): (WebCore::BaseAudioContext::sampleRate const): (WebCore::BaseAudioContext::incrementConnectionCount): (WebCore::BaseAudioContext::setAudioThread): (WebCore::BaseAudioContext::isAudioThreadFinished): (WebCore::BaseAudioContext::behaviorRestrictions const): (WebCore::BaseAudioContext::addBehaviorRestriction): (WebCore::BaseAudioContext::removeBehaviorRestriction): (WebCore::BaseAudioContext::nextAudioNodeLogIdentifier): (WebCore::BaseAudioContext::nextAudioParameterLogIdentifier): (WebCore::BaseAudioContext::isStopped const): (WebCore::BaseAudioContext::AutoLocker::AutoLocker): (WebCore::BaseAudioContext::AutoLocker::~AutoLocker): * Modules/webaudio/BiquadFilterNode.cpp: (WebCore::BiquadFilterNode::BiquadFilterNode): * Modules/webaudio/BiquadFilterNode.h: * Modules/webaudio/BiquadProcessor.cpp: (WebCore::BiquadProcessor::BiquadProcessor): * Modules/webaudio/BiquadProcessor.h: * Modules/webaudio/ChannelMergerNode.cpp: (WebCore::ChannelMergerNode::create): (WebCore::ChannelMergerNode::ChannelMergerNode): * Modules/webaudio/ChannelMergerNode.h: * Modules/webaudio/ChannelSplitterNode.cpp: (WebCore::ChannelSplitterNode::create): (WebCore::ChannelSplitterNode::ChannelSplitterNode): * Modules/webaudio/ChannelSplitterNode.h: * Modules/webaudio/ConvolverNode.cpp: (WebCore::ConvolverNode::ConvolverNode): * Modules/webaudio/ConvolverNode.h: * Modules/webaudio/DefaultAudioDestinationNode.cpp: (WebCore::DefaultAudioDestinationNode::DefaultAudioDestinationNode): * Modules/webaudio/DefaultAudioDestinationNode.h: * Modules/webaudio/DelayNode.cpp: (WebCore::DelayNode::DelayNode): (WebCore::DelayNode::create): * Modules/webaudio/DelayNode.h: * Modules/webaudio/DelayProcessor.cpp: (WebCore::DelayProcessor::DelayProcessor): * Modules/webaudio/DelayProcessor.h: * Modules/webaudio/DynamicsCompressorNode.cpp: (WebCore::DynamicsCompressorNode::DynamicsCompressorNode): * Modules/webaudio/DynamicsCompressorNode.h: * Modules/webaudio/GainNode.cpp: (WebCore::GainNode::GainNode): * Modules/webaudio/GainNode.h: * Modules/webaudio/MediaElementAudioSourceNode.cpp: (WebCore::MediaElementAudioSourceNode::create): (WebCore::MediaElementAudioSourceNode::MediaElementAudioSourceNode): (WebCore::MediaElementAudioSourceNode::setFormat): * Modules/webaudio/MediaElementAudioSourceNode.h: * Modules/webaudio/MediaStreamAudioDestinationNode.cpp: (WebCore::MediaStreamAudioDestinationNode::create): (WebCore::MediaStreamAudioDestinationNode::MediaStreamAudioDestinationNode): * Modules/webaudio/MediaStreamAudioDestinationNode.h: * Modules/webaudio/MediaStreamAudioSourceNode.cpp: (WebCore::MediaStreamAudioSourceNode::create): (WebCore::MediaStreamAudioSourceNode::MediaStreamAudioSourceNode): * Modules/webaudio/MediaStreamAudioSourceNode.h: * Modules/webaudio/OfflineAudioDestinationNode.cpp: (WebCore::OfflineAudioDestinationNode::OfflineAudioDestinationNode): * Modules/webaudio/OfflineAudioDestinationNode.h: * Modules/webaudio/OscillatorNode.cpp: (WebCore::OscillatorNode::create): (WebCore::OscillatorNode::OscillatorNode): * Modules/webaudio/OscillatorNode.h: * Modules/webaudio/PannerNode.cpp: (WebCore::PannerNodeBase::PannerNodeBase): * Modules/webaudio/PannerNode.h: * Modules/webaudio/ScriptProcessorNode.cpp: (WebCore::ScriptProcessorNode::create): (WebCore::ScriptProcessorNode::ScriptProcessorNode): * Modules/webaudio/ScriptProcessorNode.h: * Modules/webaudio/WaveShaperNode.cpp: (WebCore::WaveShaperNode::WaveShaperNode): * Modules/webaudio/WaveShaperNode.h: * Modules/webaudio/WebKitAudioContext.cpp: (WebCore::WebKitAudioContext::WebKitAudioContext): (WebCore::WebKitAudioContext::createMediaElementSource): (WebCore::WebKitAudioContext::createMediaStreamSource): (WebCore::WebKitAudioContext::createMediaStreamDestination): (WebCore::WebKitAudioContext::createWebKitPanner): (WebCore::WebKitAudioContext::close): * Modules/webaudio/WebKitAudioContext.h: (isType): * Modules/webaudio/WebKitAudioContext.idl: * dom/EventTargetFactory.in: * testing/Internals.cpp: (WebCore::Internals::setAudioContextRestrictions): * testing/Internals.h: * testing/Internals.idl: 2020-06-22 Sergio Villar Senin <svillar@igalia.com> [WebXR] Introducing XRLayer https://bugs.webkit.org/show_bug.cgi?id=213462 Reviewed by Youenn Fablet. The most recent drafts of the WebXR spec have added a new object called XRLayer which is the base class of the already known XRWebGLLayer. The spec only defines the latter but future extensions might define some other layer subclasses. This patch fixes several checks in the IDL tests. * CMakeLists.txt: Added new files. * DerivedSources.make: Ditto. * WebCore.xcodeproj/project.pbxproj: Ditto. * Modules/webxr/WebXRLayer.cpp: Added. (WebCore::WebXRLayer::WebXRLayer): * Modules/webxr/WebXRLayer.h: Ditto. * Modules/webxr/WebXRLayer.idl: Ditto. * Modules/webxr/WebXRSession.h: Export scriptExecutionContext() so it could be used from the outside. * Modules/webxr/WebXRWebGLLayer.cpp: (WebCore::WebXRWebGLLayer::WebXRWebGLLayer): Call the superclass. * Modules/webxr/WebXRWebGLLayer.h: Inherit from WebXRLayer. * Modules/webxr/WebXRWebGLLayer.idl: Ditto. * Sources.txt: Added new files. * bindings/js/WebCoreBuiltinNames.h: Added XRLayer. * dom/EventTargetFactory.in: Ditto. 2020-06-23 Devin Rousso <drousso@apple.com> Keyframe animation doesn't 't show up in the Animations timeline https://bugs.webkit.org/show_bug.cgi?id=213441 Reviewed by Brian Burg. Test: inspector/animation/lifecycle-css-animation.html * inspector/agents/InspectorAnimationAgent.cpp: (WebCore::buildObjectForEffect): 2020-06-23 Sergio Villar Senin <svillar@igalia.com> [css-flex] Allow indefinite size flex items to be definite wrt resolving percentages inside them https://bugs.webkit.org/show_bug.cgi?id=212264 Reviewed by Manuel Rego Casasnovas. Implement https://github.com/w3c/csswg-drafts/commit/5b5db39d21f3658ae2f4d7992daaf822aca178d8 which modified the way percentages were resolved in flexible items with indefinite sizes. From now on we can pretend that they're really definite. This allows us to mark 3 tests which were testing percentages in flex items as correct. Based on Blink's crrev.com/1247184 by <cbiesinger@chromium.org> This is a reland of r262124 which got reverted due to the bug fixed in r263389. * rendering/RenderFlexibleBox.cpp: (WebCore::RenderFlexibleBox::mainSizeForPercentageResolution): Do only check flex container main size definiteness when computing the main size for percentage resolution, no need to check flex basis at all. 2020-06-18 Sergio Villar Senin <svillar@igalia.com> REGRESSION (r262124): Twitter videos go blank after exiting fullscreen https://bugs.webkit.org/show_bug.cgi?id=213110 Reviewed by Darin Adler. Test: fullscreen/video-inside-flex-item.html Setting/unsetting position:absolute on a flex/grid item can potentially create/remove flex/grid items because absolutely positioned children of those containers are out-of-flow and thus, do not generate flex/grid items. Flex/grid items are potentially stretched by their containers so the style recalculation is not enough to get a correct layout because the override size set by flex/grid containers is not reset. In the particular case of this bug we had this hierarchy (highly simplified from twitter page): Flexbox container |___DIV (absolutelly positioned) |___<video> (height: 100% width: 100%) When the <video> goes fullscreen the FullscreenManager replaces the style of the DIV because it inserts a RenderFullScreen object in between the DIV and the <video> (along with some anonymous blocks). This means that the DIV which was not a flex item (as it was absolutely positioned) became a flex item and thus its size is stretched as the flexbox container mandates. When exiting fullscreen, the original style is restored (and thus the position absolute). The DIV is then no longer a flex item but the stretched size (overrideContentSize) is still set, causing issues with the sizes of the <video>. Note that it isn't possible to reproduce this bug with the current trunk because there is a bug in the flexbox implementation (see bug 212264) preventing this to happen. However it becomes 100% reproducible with the patch for bug 212264 which is correct and fixes several tests related to wrapping in flexbox. It's also reproducible when the FULLSCREEN_API is enabled, otherwise the codepath for full screen is totally different (there are no placeholders). * rendering/RenderBox.cpp: (WebCore::RenderBox::styleDidChange): clear the override sizes for grid/flex when flex/grid items become out-of-flow, for example by changing position to absolute. 2020-06-22 Carlos Garcia Campos <cgarcia@igalia.com> REGRESSION(r258741): [GTK] anchor-file-blob-download-includes-backslash.html is failing https://bugs.webkit.org/show_bug.cgi?id=209329 Reviewed by Adrian Perez de Castro. Sanitize the suggested filename. We replace characters that can be problematic in filenames with '_' to match what Chromium and Firefox do. * platform/network/soup/ResourceResponseSoup.cpp: (WebCore::sanitizeFilename): (WebCore::ResourceResponse::platformSuggestedFilename const): 2020-06-22 John Wilander <wilander@apple.com> Storage Access API: Add the capability to call the Storage Access API as a quirk, on behalf of websites that should be doing it themselves https://bugs.webkit.org/show_bug.cgi?id=213418 <rdar://problem/64549429> Reviewed by Alex Christensen. No new tests. This patch adds quirks for specific websites. The general functionality that's touched has tests under LayoutTests/http/tests/storageAccess/. * dom/Document.h: (WebCore::Document::isTopDocument const): New convenience function. (WebCore::Document::setUserDidInteractWithPage): Use of the new convenience function. (WebCore::Document::userDidInteractWithPage const): Use of the new convenience function. * dom/DocumentStorageAccess.cpp: (WebCore::DocumentStorageAccess::hasStorageAccessQuickCheck): (WebCore::DocumentStorageAccess::hasStorageAccess): (WebCore::DocumentStorageAccess::hasStorageAccessForDocumentQuirk): (WebCore::DocumentStorageAccess::requestStorageAccess): (WebCore::DocumentStorageAccess::requestStorageAccessQuickCheck): (WebCore::DocumentStorageAccess::requestStorageAccessForDocumentQuirk): (WebCore::DocumentStorageAccess::requestStorageAccessForNonDocumentQuirk): (WebCore::DocumentStorageAccess::requestStorageAccessQuirk): These functions are split up to allow quirks to call directly into the implementation of the Storage Access API without the JavaScript promise that goes with the web API. It also allows for quirks to call the API without an iframe document. * dom/DocumentStorageAccess.h: * dom/Element.cpp: (WebCore::Element::dispatchMouseEvent): The two existing quirks are for click events. * loader/ResourceLoadObserver.h: (WebCore::ResourceLoadObserver::setDomainsWithUserInteraction): (WebCore::ResourceLoadObserver::hasHadUserInteraction const): These two new functions allow the Storage Access API quirks to synchronously check if it's worth calling the API or not. If there has been no user interaction for the requesting domain, there is no need to call the API. * page/Quirks.cpp: (WebCore::Quirks::triggerOptionalStorageAccessQuirk const): This is the new quirks function, hiding the specifics of certain elements clicked and for which websites. It also calls the Storage Access API. * page/Quirks.h: 2020-06-22 Chris Dumez <cdumez@apple.com> Introduce BaseAudioContext interface https://bugs.webkit.org/show_bug.cgi?id=213491 Reviewed by Geoffrey Garen. Introduce BaseAudioContext interface as per W3C WebAudio specification: - https://www.w3.org/TR/webaudio/#BaseAudioContext No new tests, rebaselined existing test. * CMakeLists.txt: * DerivedSources-input.xcfilelist: * DerivedSources-output.xcfilelist: * DerivedSources.make: * Modules/webaudio/AudioContext.cpp: (WebCore::AudioContext::AudioContext): (WebCore::AudioContext::close): (WebCore::AudioContext::createMediaElementSource): (WebCore::AudioContext::createMediaStreamSource): (WebCore::AudioContext::createMediaStreamDestination): * Modules/webaudio/AudioContext.h: * Modules/webaudio/AudioContext.idl: * Modules/webaudio/AudioNode.cpp: (WebCore::AudioNode::contextForBindings const): * Modules/webaudio/AudioNode.h: * Modules/webaudio/AudioNode.idl: * Modules/webaudio/BaseAudioContext.cpp: Copied from Source/WebCore/Modules/webaudio/AudioContext.cpp. (WebCore::BaseAudioContext::isSampleRateRangeGood): (WebCore::AudioContextBase::AudioContextBase): (WebCore::BaseAudioContext::BaseAudioContext): (WebCore::BaseAudioContext::constructCommon): (WebCore::BaseAudioContext::~BaseAudioContext): (WebCore::BaseAudioContext::lazyInitialize): (WebCore::BaseAudioContext::clear): (WebCore::BaseAudioContext::uninitialize): (WebCore::BaseAudioContext::isInitialized const): (WebCore::BaseAudioContext::addReaction): (WebCore::BaseAudioContext::setState): (WebCore::BaseAudioContext::stop): (WebCore::BaseAudioContext::suspend): (WebCore::BaseAudioContext::resume): (WebCore::BaseAudioContext::activeDOMObjectName const): (WebCore::AudioContextBase::document const): (WebCore::BaseAudioContext::hostingDocumentIdentifier const): (WebCore::BaseAudioContext::isSuspended const): (WebCore::BaseAudioContext::visibilityStateChanged): (WebCore::BaseAudioContext::wouldTaintOrigin const): (WebCore::BaseAudioContext::createBuffer): (WebCore::BaseAudioContext::decodeAudioData): (WebCore::BaseAudioContext::createBufferSource): (WebCore::BaseAudioContext::createScriptProcessor): (WebCore::BaseAudioContext::createBiquadFilter): (WebCore::BaseAudioContext::createWaveShaper): (WebCore::BaseAudioContext::createPanner): (WebCore::BaseAudioContext::createConvolver): (WebCore::BaseAudioContext::createDynamicsCompressor): (WebCore::BaseAudioContext::createAnalyser): (WebCore::BaseAudioContext::createGain): (WebCore::BaseAudioContext::createDelay): (WebCore::BaseAudioContext::createChannelSplitter): (WebCore::BaseAudioContext::createChannelMerger): (WebCore::BaseAudioContext::createOscillator): (WebCore::BaseAudioContext::createPeriodicWave): (WebCore::BaseAudioContext::notifyNodeFinishedProcessing): (WebCore::BaseAudioContext::derefFinishedSourceNodes): (WebCore::BaseAudioContext::refNode): (WebCore::BaseAudioContext::derefNode): (WebCore::BaseAudioContext::derefUnfinishedSourceNodes): (WebCore::BaseAudioContext::lock): (WebCore::BaseAudioContext::tryLock): (WebCore::BaseAudioContext::unlock): (WebCore::BaseAudioContext::isAudioThread const): (WebCore::BaseAudioContext::isGraphOwner const): (WebCore::BaseAudioContext::addDeferredFinishDeref): (WebCore::BaseAudioContext::handlePreRenderTasks): (WebCore::BaseAudioContext::handlePostRenderTasks): (WebCore::BaseAudioContext::handleDeferredFinishDerefs): (WebCore::BaseAudioContext::markForDeletion): (WebCore::BaseAudioContext::scheduleNodeDeletion): (WebCore::BaseAudioContext::deleteMarkedNodes): (WebCore::BaseAudioContext::markSummingJunctionDirty): (WebCore::BaseAudioContext::removeMarkedSummingJunction): (WebCore::BaseAudioContext::eventTargetInterface const): (WebCore::BaseAudioContext::markAudioNodeOutputDirty): (WebCore::BaseAudioContext::handleDirtyAudioSummingJunctions): (WebCore::BaseAudioContext::handleDirtyAudioNodeOutputs): (WebCore::BaseAudioContext::addAutomaticPullNode): (WebCore::BaseAudioContext::removeAutomaticPullNode): (WebCore::BaseAudioContext::updateAutomaticPullNodes): (WebCore::BaseAudioContext::processAutomaticPullNodes): (WebCore::AudioContextBase::scriptExecutionContext const): (WebCore::BaseAudioContext::nodeWillBeginPlayback): (WebCore::shouldDocumentAllowWebAudioToAutoPlay): (WebCore::BaseAudioContext::willBeginPlayback): (WebCore::BaseAudioContext::willPausePlayback): (WebCore::BaseAudioContext::startRendering): (WebCore::BaseAudioContext::mediaCanStart): (WebCore::BaseAudioContext::mediaState const): (WebCore::BaseAudioContext::pageMutedStateDidChange): (WebCore::BaseAudioContext::isPlayingAudioDidChange): (WebCore::BaseAudioContext::finishedRendering): (WebCore::BaseAudioContext::dispatchEvent): (WebCore::BaseAudioContext::incrementActiveSourceCount): (WebCore::BaseAudioContext::decrementActiveSourceCount): (WebCore::BaseAudioContext::suspendRendering): (WebCore::BaseAudioContext::resumeRendering): (WebCore::BaseAudioContext::suspendPlayback): (WebCore::BaseAudioContext::mayResumePlayback): (WebCore::BaseAudioContext::postTask): (WebCore::BaseAudioContext::origin const): (WebCore::BaseAudioContext::addConsoleMessage): (WebCore::BaseAudioContext::clearPendingActivity): (WebCore::BaseAudioContext::makePendingActivity): (WebCore::BaseAudioContext::logChannel const): * Modules/webaudio/BaseAudioContext.h: Copied from Source/WebCore/Modules/webaudio/AudioContext.h. (WebCore::AudioContextBase::AutoLocker::AutoLocker): (WebCore::AudioContextBase::AutoLocker::~AutoLocker): (WebCore::BaseAudioContext::destination): (WebCore::BaseAudioContext::activeSourceCount const): (WebCore::BaseAudioContext::listener): (WebCore::BaseAudioContext::state const): (WebCore::BaseAudioContext::isClosed const): (WebCore::BaseAudioContext::connectionCount const): (WebCore::BaseAudioContext::audioThread const): (WebCore::BaseAudioContext::maxNumberOfChannels): (WebCore::BaseAudioContext::destinationNode const): (WebCore::BaseAudioContext::userGestureRequiredForAudioStart const): (WebCore::BaseAudioContext::pageConsentRequiredForAudioStart const): (isType): * Modules/webaudio/BaseAudioContext.idl: Copied from Source/WebCore/Modules/webaudio/AudioContext.idl. * Modules/webaudio/OfflineAudioContext.cpp: (WebCore::OfflineAudioContext::OfflineAudioContext): * Modules/webaudio/OfflineAudioContext.h: * Modules/webaudio/OfflineAudioContext.idl: * Modules/webaudio/PannerNode.cpp: (WebCore::PannerNode::PannerNode): * Modules/webaudio/PannerNode.h: * Sources.txt: * WebCore.xcodeproj/project.pbxproj: * bindings/js/WebCoreBuiltinNames.h: * dom/EventTargetFactory.in: * testing/Internals.cpp: (WebCore::Internals::setAudioContextRestrictions): * testing/Internals.h: * testing/Internals.idl: 2020-06-22 Andres Gonzalez <andresg_22@apple.com> AXIsolatedTree::generateSubtree should properly assign the generated subtree to its parent node. https://bugs.webkit.org/show_bug.cgi?id=213435 Reviewed by Darin Adler. AXIsolatedTree::generateSubtree now properly updates the children IDs of the parent node of the subtree being generated. * accessibility/AXObjectCache.cpp: (WebCore::AXObjectCache::generateIsolatedTree): * accessibility/isolatedtree/AXIsolatedTree.cpp: (WebCore::AXIsolatedTree::updateChildrenIDs): (WebCore::AXIsolatedTree::generateSubtree): Takes the parent object instead of the parent ID. This allows to retrieve the children IDs of the parent object. (WebCore::AXIsolatedTree::createSubtree): (WebCore::AXIsolatedTree::updateSubtree): (WebCore::AXIsolatedTree::updateChildren): (WebCore::AXIsolatedTree::setRootNode): (WebCore::AXIsolatedTree::removeSubtree): (WebCore::AXIsolatedTree::appendNodeChanges): R-value parameter instead of by reference. * accessibility/isolatedtree/AXIsolatedTree.h: 2020-06-22 Tim Horton <timothy_horton@apple.com> Update macOS version macros https://bugs.webkit.org/show_bug.cgi?id=213484 Reviewed by Alexey Proskuryakov. * Configurations/Base.xcconfig: * Configurations/DebugRelease.xcconfig: * Configurations/Version.xcconfig: * Configurations/WebKitTargetConditionals.xcconfig: 2020-06-22 Clark Wang <clark_wang@apple.com> Added getFloatTimeDomainData method to AnalyserNode https://bugs.webkit.org/show_bug.cgi?id=213393 Reviewed by Chris Dumez. Added getFloatTimeDomainData method, as per spec: https://www.w3.org/TR/webaudio/#analysernode. Implementation of RealtimeAnalyser::getFloatTimeDomainData(Float32Array* destinationArray) is based on: https://source.chromium.org/chromium/chromium/src/+/master:third_party/blink/renderer/modules/webaudio/realtime_analyser.cc. Removed nullable option from some AnalyserNode methods. Re-baselined existing tests to show new passing test. * Modules/webaudio/AnalyserNode.h: * Modules/webaudio/AnalyserNode.idl: * Modules/webaudio/RealtimeAnalyser.cpp: (WebCore::RealtimeAnalyser::getFloatFrequencyData): (WebCore::RealtimeAnalyser::getByteFrequencyData): (WebCore::RealtimeAnalyser::getFloatTimeDomainData): (WebCore::RealtimeAnalyser::getByteTimeDomainData): * Modules/webaudio/RealtimeAnalyser.h: 2020-06-22 Rob Buis <rbuis@igalia.com> Add referrerpolicy attribute support for <link> https://bugs.webkit.org/show_bug.cgi?id=213342 Reviewed by Darin Adler. Add support for referrerpolicy attribute handling on link prefetch/preload/stylesheet. Tests: http/tests/security/referrer-policy-attribute-style-no-referrer.html http/wpt/preload/refferer-policy.html * html/HTMLLinkElement.cpp: (WebCore::HTMLLinkElement::process): (WebCore::HTMLLinkElement::setReferrerPolicyForBindings): (WebCore::HTMLLinkElement::referrerPolicyForBindings const): (WebCore::HTMLLinkElement::referrerPolicy const): * html/HTMLLinkElement.h: * html/parser/HTMLPreloadScanner.cpp: (WebCore::TokenPreloadScanner::StartTagScanner::processAttribute): * html/parser/HTMLResourcePreloader.cpp: (WebCore::PreloadRequest::resourceRequest): * loader/LinkLoader.cpp: (WebCore::LinkLoader::loadLinksFromHeader): (WebCore::LinkLoader::preloadIfNeeded): (WebCore::LinkLoader::prefetchIfNeeded): * loader/LinkLoader.h: 2020-06-22 Simon Fraser <simon.fraser@apple.com> Fix build error with release build and "#define LOG_DISABLED 0" https://bugs.webkit.org/show_bug.cgi?id=213420 Reviewed by Sam Weinig. AnimationBase::updateStateMachine() uses LOG_ERROR so needs to test ERROR_DISABLED not LOG_DISABLED. * page/animation/AnimationBase.cpp: (WebCore::AnimationBase::updateStateMachine): 2020-06-22 Tetsuharu Ohzeki <tetsuharu.ohzeki@gmail.com> Fix the case of "null type Blob slice" in wpt/FileAPI/blob/Blob-slice.html https://bugs.webkit.org/show_bug.cgi?id=213370 Reviewed by Darin Adler. * fileapi/Blob.h: (WebCore::Blob::slice const): Remove unnecessary default arguments These default arguments are introduced in r83873 but we don't need them because WebIDL binding handles them. * fileapi/Blob.idl: - Update the definition of `Blob.slice()` to match the latest spec. https://w3c.github.io/FileAPI/#blob-section - We should use empty string as a default value by step 4-a of https://w3c.github.io/FileAPI/#dfn-slice - In the previous code, we use `optional DOMString?` for the _contentType_ arguments for `Blob.slice()`. Then, our codegen generates a code which uses `convert<IDLNullable<IDLDOMString>>` and it returns `String()` if the JS value is `null`. This caused the failure case in this change. 2020-06-22 Andres Gonzalez <andresg_22@apple.com> Code cleanup in WebAccessibilityObjectWrapper updateObjectBackingStore and position. https://bugs.webkit.org/show_bug.cgi?id=213438 Reviewed by Darin Adler. * accessibility/mac/WebAccessibilityObjectWrapperBase.mm: (-[WebAccessibilityObjectWrapperBase updateObjectBackingStore]): Removed unnecessary call to axBackingObject. * accessibility/mac/WebAccessibilityObjectWrapperMac.mm: (-[WebAccessibilityObjectWrapper position]): Check for isIsolatedTreeEnabled instead of for the request thread, since isolated tree mode = 1 runs on the main thread. 2020-06-22 Youenn Fablet <youenn@apple.com> [WebRTC] Add support for freeze/pause receiver stats https://bugs.webkit.org/show_bug.cgi?id=212938 <rdar://problem/64141493> Reviewed by Eric Carlson. Covered by updated tests. Receiver stats are useful to check for freezes. Let's introduce it in 'track' stats for now, we will later on move all 'receiver' stats to its own object once we fully align with spec. * Modules/mediastream/RTCStatsReport.h: * Modules/mediastream/RTCStatsReport.idl: * Modules/mediastream/libwebrtc/LibWebRTCStatsCollector.cpp: (WebCore::fillRTCMediaStreamTrackStats): 2020-06-22 Rob Buis <rbuis@igalia.com> Image `crossorigin` mutations should be considered "relevant mutations" https://bugs.webkit.org/show_bug.cgi?id=213335 Reviewed by Darin Adler. As follow up to r263345, this check is not needed after all since the for loop already does the same check. * html/HTMLImageElement.cpp: (WebCore::HTMLImageElement::bestFitSourceFromPictureElement): 2020-06-22 Jason Lawrence <lawrence.j@apple.com> Unreviewed, reverting r263331. This commit was causing 50+ iOS debug tests to crash. Reverted changeset: "Convert DateComponents parsing code to use Optional based return values rather than out-parameters" https://bugs.webkit.org/show_bug.cgi?id=213440 https://trac.webkit.org/changeset/263331 2020-06-10 Sergio Villar Senin <svillar@igalia.com> [WebXR] Add a preliminary implementation of XRWebGLLayer https://bugs.webkit.org/show_bug.cgi?id=213022 Reviewed by Carlos Garcia Campos. Added a preliminary implementation of XRWebGLLayer. It does not have any functionality at the moment so it cannot be used to render WebXR stuff. This patch adds all the machinery required to create and properly initialize the layer according to the spec. Two new wpt tests are passing now. * Modules/webxr/WebXRSession.h: Expose session mode. * Modules/webxr/WebXRWebGLLayer.cpp: (WebCore::WebXRWebGLLayer::create): Implemented spec for XRWebGLLayer creation. (WebCore::WebXRWebGLLayer::computeNativeWebGLFramebufferResolution): Added with mock implementation. (WebCore::WebXRWebGLLayer::computeRecommendedWebGLFramebufferResolution): Added. (WebCore::WebXRWebGLLayer::WebXRWebGLLayer): (WebCore::WebXRWebGLLayer::framebuffer const): Returned type should be a pointer. (WebCore::WebXRWebGLLayer::framebufferWidth const): Return framebuffer width if available, otherwise return the base context width. (WebCore::WebXRWebGLLayer::framebufferHeight const): Ditto but with heights. (WebCore::WebXRWebGLLayer::getNativeFramebufferScaleFactor): Implemented. * Modules/webxr/WebXRWebGLLayer.h: New methods and type adjustments. 2020-06-22 Rob Buis <rbuis@igalia.com> Image `crossorigin` mutations should be considered "relevant mutations" https://bugs.webkit.org/show_bug.cgi?id=213335 Reviewed by Darin Adler. Make crossorigin attribute's state changes relevant mutations [1]. This change also fixes several picture related mutations to be relevant [2]. Test: imported/w3c/web-platform-tests/html/semantics/embedded-content/the-img-element/relevant-mutations.html [1] https://html.spec.whatwg.org/#reacting-to-dom-mutations:attr-img-crossorigin [2] https://html.spec.whatwg.org/#reacting-to-dom-mutations * html/HTMLImageElement.cpp: (WebCore::HTMLImageElement::bestFitSourceFromPictureElement): (WebCore::HTMLImageElement::evaluateDynamicMediaQueryDependencies): (WebCore::HTMLImageElement::selectImageSource): (WebCore::parseCrossoriginState): (WebCore::HTMLImageElement::attributeChanged): (WebCore::HTMLImageElement::parseAttribute): (WebCore::HTMLImageElement::insertedIntoAncestor): (WebCore::HTMLImageElement::removedFromAncestor): * html/HTMLImageElement.h: * html/HTMLPictureElement.cpp: (WebCore::HTMLPictureElement::sourcesChanged): * html/HTMLSourceElement.cpp: (WebCore::HTMLSourceElement::insertedIntoAncestor): (WebCore::HTMLSourceElement::removedFromAncestor): (WebCore::HTMLSourceElement::parseAttribute): * html/HTMLSourceElement.h: * loader/ImageLoader.h: 2020-06-21 Sam Weinig <weinig@apple.com> Convert much of the SVG string parsing code to use Optional based return values rather than out-parameters https://bugs.webkit.org/show_bug.cgi?id=213416 Reviewed by Darin Adler. Update SVG parsers to use Optional style return programming rather than out parameters. To make things even nicer, SVGPathSource based parsers now have a type per-parse function, which makes working with them much easier. In the future, we should consider exanding these new types to be used by SVGPathConsumer family of classes as well. * WebCore.xcodeproj/project.pbxproj: Add SVGPathSegValue.h, which was missing from the Xcode project. * svg/SVGAngleValue.cpp: (WebCore::parseAngleType): (WebCore::SVGAngleValue::setValueAsString): Adopt updated parseNumber() function, and do a drive by removal of an easy to remove upconvertedCharacters. * svg/SVGAnimateMotionElement.cpp: (WebCore::SVGAnimateMotionElement::calculateToAtEndOfDurationValue): (WebCore::SVGAnimateMotionElement::calculateFromAndToValues): (WebCore::SVGAnimateMotionElement::calculateFromAndByValues): (WebCore::SVGAnimateMotionElement::calculateDistance): Now uses new parsePoint() function. Using Optional.valueOr() where the old code would have had parsePoint() doing the clearing. * svg/SVGAnimationElement.cpp: (WebCore::parseKeySplines): Now returns an Optional<Vector<UnitBezier>>. (WebCore::SVGAnimationElement::parseAttribute): Now uses new parseKeySplines, and does an explicit clear on parse failure (old code did it implicitly in the parse function). * svg/SVGFEConvolveMatrixElement.cpp: (WebCore::SVGFEConvolveMatrixElement::parseAttribute): * svg/SVGFEDiffuseLightingElement.cpp: (WebCore::SVGFEDiffuseLightingElement::parseAttribute): * svg/SVGFEDropShadowElement.cpp: (WebCore::SVGFEDropShadowElement::parseAttribute): * svg/SVGFEGaussianBlurElement.cpp: (WebCore::SVGFEGaussianBlurElement::parseAttribute): * svg/SVGFEMorphologyElement.cpp: (WebCore::SVGFEMorphologyElement::parseAttribute): * svg/SVGFESpecularLightingElement.cpp: (WebCore::SVGFESpecularLightingElement::parseAttribute): * svg/SVGFETurbulenceElement.cpp: (WebCore::SVGFETurbulenceElement::parseAttribute): Adopt Optional based parseNumberOptionalNumber. * svg/SVGImageElement.cpp: (WebCore::SVGImageElement::parseAttribute): * svg/SVGFEImageElement.cpp: (WebCore::SVGFEImageElement::parseAttribute): Simplify by using the SVGPreserveAspectRatioValue constructor which calls parse. No need for three lines. * svg/SVGFitToViewBox.cpp: (WebCore::SVGFitToViewBox::parseAttribute): Adopt new Optional based parseViewBox. Simplify by using the SVGPreserveAspectRatioValue constructor which calls parse. No need for three lines. (WebCore::SVGFitToViewBox::parseViewBox): Convert to be Optional based, and adopt new parseNumber functions. * svg/SVGFitToViewBox.h: Updated signatures for new Optional based functions. * svg/SVGGlyphRefElement.cpp: (WebCore::parseFloat): Adopt Optional based parseNumber. * svg/SVGHKernElement.cpp: (WebCore::SVGHKernElement::buildHorizontalKerningPair const): * svg/SVGHKernElement.h: * svg/SVGVKernElement.cpp: (WebCore::SVGVKernElement::buildVerticalKerningPair const): * svg/SVGVKernElement.h: Convert to be Optional based. Update a few callers to use makeString. * svg/SVGToOTFFontConversion.cpp: (WebCore::SVGToOTFFontConverter::addKerningPair const): (WebCore::SVGToOTFFontConverter::appendKERNSubtable): Adopt new Optional based kerning pair builders. Add some moves to avoid some copies. * svg/SVGLengthValue.cpp: (WebCore::SVGLengthValue::setValueAsString): Adopt Optional based parseNumber. * svg/SVGNumberList.h: (WebCore::SVGNumberList::parse): Adopt Optional based parseNumber. * svg/SVGParserUtilities.cpp: (WebCore::genericParseNumber): (WebCore::parseNumber): (WebCore::genericParseArcFlag): (WebCore::parseArcFlag): (WebCore::parseNumberOptionalNumber): (WebCore::parsePoint): (WebCore::parseRect): (WebCore::parseGlyphName): (WebCore::parseUnicodeRange): (WebCore::parseKerningUnicodeString): (WebCore::genericParseFloatPoint): (WebCore::parseFloatPoint): (WebCore::parseSVGNumber): Deleted. (WebCore::parseNumberFromString): Deleted. (WebCore::parseDelimitedString): Deleted. (WebCore::parseFloatPoint2): Deleted. (WebCore::parseFloatPoint3): Deleted. * svg/SVGParserUtilities.h: (WebCore::isSVGSpace): (WebCore::skipOptionalSVGSpaces): (WebCore::skipOptionalSVGSpacesOrDelimiter): - Converts parse* functions to return Optional values rather than using outparameters. - Removes unused parseSVGNumber and parseDelimitedString. - Removes parseFloatPoint2 and parseFloatPoint3. They weren't useful enough to keep around. - Renames parseNumberFromString to parseNumber. The argument is a String, it's clear enough. - Replace boolean skip parameters with new enum SuffixSkippingPolicy. - Make parseFloatPoint have two overloads rather than being templatized to be consistent. * svg/SVGPathBlender.cpp: (WebCore::pullFromSources): (WebCore::SVGPathBlender::blendMoveToSegment): (WebCore::SVGPathBlender::blendLineToSegment): (WebCore::SVGPathBlender::blendLineToHorizontalSegment): (WebCore::SVGPathBlender::blendLineToVerticalSegment): (WebCore::SVGPathBlender::blendCurveToCubicSegment): (WebCore::SVGPathBlender::blendCurveToCubicSmoothSegment): (WebCore::SVGPathBlender::blendCurveToQuadraticSegment): (WebCore::SVGPathBlender::blendCurveToQuadraticSmoothSegment): (WebCore::SVGPathBlender::blendArcToSegment): (WebCore::SVGPathBlender::canBlendPaths): (WebCore::SVGPathBlender::blendAnimatedPath): Update to adopt new SVGPathSource interface. Added pullFromSources helper which substantially simplifies pulling from both the from and to source at the same time and is now possible due to all the SVGPathSource functions returning the segment types rather than taking them as out parameters. * svg/SVGPathByteStreamSource.cpp: (WebCore::SVGPathByteStreamSource::nextCommand): (WebCore::SVGPathByteStreamSource::parseSVGSegmentType): (WebCore::SVGPathByteStreamSource::parseMoveToSegment): (WebCore::SVGPathByteStreamSource::parseLineToSegment): (WebCore::SVGPathByteStreamSource::parseLineToHorizontalSegment): (WebCore::SVGPathByteStreamSource::parseLineToVerticalSegment): (WebCore::SVGPathByteStreamSource::parseCurveToCubicSegment): (WebCore::SVGPathByteStreamSource::parseCurveToCubicSmoothSegment): (WebCore::SVGPathByteStreamSource::parseCurveToQuadraticSegment): (WebCore::SVGPathByteStreamSource::parseCurveToQuadraticSmoothSegment): (WebCore::SVGPathByteStreamSource::parseArcToSegment): * svg/SVGPathByteStreamSource.h: Adopt new SVGPathSource interface. * svg/SVGPathParser.cpp: (WebCore::SVGPathParser::parseMoveToSegment): (WebCore::SVGPathParser::parseLineToSegment): (WebCore::SVGPathParser::parseLineToHorizontalSegment): (WebCore::SVGPathParser::parseLineToVerticalSegment): (WebCore::SVGPathParser::parseCurveToCubicSegment): (WebCore::SVGPathParser::parseCurveToCubicSmoothSegment): (WebCore::SVGPathParser::parseCurveToQuadraticSegment): (WebCore::SVGPathParser::parseCurveToQuadraticSmoothSegment): (WebCore::SVGPathParser::parseArcToSegment): (WebCore::SVGPathParser::parsePathData): Adapt to new SVGPathSource interface. Code reads a bit nicer now that we don't have a ton of local variables in each method. Could be made nicer in the future by adopting Segment types in the path consumer code. * svg/SVGPathSegListSource.cpp: (WebCore::SVGPathSegListSource::nextCommand): (WebCore::SVGPathSegListSource::parseSVGSegmentType): (WebCore::SVGPathSegListSource::parseMoveToSegment): (WebCore::SVGPathSegListSource::parseLineToSegment): (WebCore::SVGPathSegListSource::parseLineToHorizontalSegment): (WebCore::SVGPathSegListSource::parseLineToVerticalSegment): (WebCore::SVGPathSegListSource::parseCurveToCubicSegment): (WebCore::SVGPathSegListSource::parseCurveToCubicSmoothSegment): (WebCore::SVGPathSegListSource::parseCurveToQuadraticSegment): (WebCore::SVGPathSegListSource::parseCurveToQuadraticSmoothSegment): (WebCore::SVGPathSegListSource::parseArcToSegment): * svg/SVGPathSegListSource.h: Adopt new SVGPathSource interface. * svg/SVGPathSource.h: Update interface to return Optionals, with a specific type for segment kind that be parsed. * svg/SVGPathStringSource.cpp: (WebCore::nextCommandHelper): (WebCore::SVGPathStringSource::nextCommand): (WebCore::parseSVGSegmentTypeHelper): (WebCore::SVGPathStringSource::parseSVGSegmentType): (WebCore::SVGPathStringSource::parseMoveToSegment): (WebCore::SVGPathStringSource::parseLineToSegment): (WebCore::SVGPathStringSource::parseLineToHorizontalSegment): (WebCore::SVGPathStringSource::parseLineToVerticalSegment): (WebCore::SVGPathStringSource::parseCurveToCubicSegment): (WebCore::SVGPathStringSource::parseCurveToCubicSmoothSegment): (WebCore::SVGPathStringSource::parseCurveToQuadraticSegment): (WebCore::SVGPathStringSource::parseCurveToQuadraticSmoothSegment): (WebCore::SVGPathStringSource::parseArcToSegment): (WebCore::parseArcToSegmentHelper): Deleted. * svg/SVGPathStringSource.h: Adopt new SVGPathSource interface. Replace out of line helpers (or use of things like parseFloatPoint2) with generic lambda helpers, helping to keep the code more localized. * svg/SVGPointList.h: (WebCore::SVGPointList::parse): Adopt Optional based parseNumber. * svg/SVGTransformList.h: * svg/SVGTransformable.cpp: (WebCore::parseTransformParamList): (WebCore::SVGTransformable::parseTransformValue): (WebCore::SVGTransformable::parseAndSkipType): (WebCore::SVGTransformable::parseTransformType): * svg/SVGTransformable.h: Convert parseTransformValue/parseAndSkipType to be Optional based. * svg/SVGViewSpec.cpp: (WebCore::SVGViewSpec::parseViewSpec): Adopt Optional based parseViewBox. * svg/properties/SVGAnimationAdditiveValueFunctionImpl.h: Adopt Optional based parseNumber. * svg/properties/SVGPropertyTraits.h: (WebCore::SVGPropertyTraits<float>::fromString): (WebCore::SVGPropertyTraits<float>::parse): (WebCore::SVGPropertyTraits<FloatPoint>::fromString): (WebCore::SVGPropertyTraits<FloatPoint>::parse): (WebCore::SVGPropertyTraits<FloatRect>::fromString): (WebCore::SVGPropertyTraits<FloatRect>::parse): Adopt Optional based parsers. 2020-06-21 Sam Weinig <weinig@apple.com> Convert DateComponents parsing code to use Optional based return values rather than out-parameters https://bugs.webkit.org/show_bug.cgi?id=213440 Reviewed by Darin Adler. Rework DateComponents and Date/Time related InputTypes to use Optional based programming for parsing results. Also take the opportunity to remove unicode upconversion from DateComponent parsing and instead separate UChar and LChar variants via templates. * html/BaseDateAndTimeInputType.cpp: * html/BaseDateAndTimeInputType.h: * html/DateInputType.cpp: * html/DateInputType.h: * html/DateTimeInputType.cpp: * html/DateTimeInputType.h: * html/DateTimeLocalInputType.cpp: * html/DateTimeLocalInputType.h: * html/HTMLInputElement.cpp: * html/HTMLInputElement.h: * html/InputType.cpp: * html/InputType.h: * html/MonthInputType.cpp: * html/MonthInputType.h: * html/TimeInputType.cpp: * html/TimeInputType.h: * html/WeekInputType.cpp: * html/WeekInputType.h: - Removes parseToDateComponentsInternal. No need it and parseToDateComponents. - Makes parseToDateComponents pure virtual. The old code had a default implementations down in InputType, but it had no callers. - Remove iOS vs. non-iOS difference for dateType(). It is now available on InputType on all platforms. - Make setMillisecondToDateComponents and parseToDateComponents return an Optional. * platform/DateComponents.cpp: * platform/DateComponents.h: - Replace member function based interfaces for parsing/setting explicit time offsets with new factory functions that return Optional<DateComponents>. - These factories are implemented using the existing member functions, which are now private. - Make max/min constants constexpr. - Make parse* member functions templates to allow factory parse functions to call them without upconverting. - Replace header guard with #pragma once. 2020-06-21 Zalan Bujtas <zalan@apple.com> [LFC] Add basic support for width: fit-content https://bugs.webkit.org/show_bug.cgi?id=213444 Reviewed by Antti Koivisto. At this point this is just a shrink-to-fit sizing (missing the case when the available horizontal space is not specified). Test: fast/layoutformattingcontext/fit-content-width-simple.html * layout/FormattingContextGeometry.cpp: (WebCore::Layout::FormattingContext::Geometry::computedWidthValue): 2020-06-21 Jer Noble <jer.noble@apple.com> WebKit fails to leave audio routing arbitration during navigation, closing. https://bugs.webkit.org/show_bug.cgi?id=213426 <rdar://problem/64395051> Reviewed by Eric Carlson. When setting the AudioSession category, make sure to leave routing arbitration before bailing out early. Also, HTMLMediaElement::canProduceAudio() should return `false` when the element's document is suspended or stopped. Otherwise, the AudioSession will continue in the `MediaPlayback` category indefinitely, and routing arbitration will remain active. * html/HTMLMediaElement.cpp: (WebCore::HTMLMediaElement::canProduceAudio const): * platform/audio/mac/AudioSessionMac.mm: (WebCore::AudioSession::setCategory): 2020-06-21 Zalan Bujtas <zalan@apple.com> [LFC][TFC] Add support for percentage min/max-width https://bugs.webkit.org/show_bug.cgi?id=213436 Reviewed by Antti Koivisto. 1. The table generates a principal block container box called the table wrapper box that contains the table box itself and any caption boxes. 2. The table wrapper box establishes a block formatting context, and the table box establishes a table formatting context. 3. The computed values of properties 'position', 'float', 'margin-*', 'top', 'right', 'bottom', and 'left' on the table element are used on the table wrapper box and not the table box; all other values of non-inheritable properties are used on the table box and not the table wrapper box. 4. In a block formatting context, each box's left outer edge touches the left edge of the containing block. This is true even in the presence of floats, unless the box establishes a new block formatting context (in which case the box itself may become narrower due to the floats) Now consider the following case: <div style="display: block; width: 500px;"> <div style="float: left; width: 100px;"></div> <div style="display: table; width: 10%;"></div> </div> 1. We create a table wrapper box to wrap the "display: table" block level box (#1). 2. The table wrapper box's width property is set to auto (#3). 3. Since it establishes a new block formatting context, the available horizontal space gets shrunk by the float (#4) 4. The table wrapper box's used width computes to 500px - 100px -> 400px; Now we are inside the BFC established by the table wrapper box and try to resolve the table's width -> %10. According to the normal BFC rules, it should compute to 10% of the containing block's logical width: 400px -> 40px. However in practice it computes to 50px (10% of 500px). Similar setup with non-table content would resolve the inner block level box's width to 40px; <div style="display: block; width: 500px"> <div style="float: left; width: 100px;"></div> <div style="display: block; overflow: hidden;"> <div style="display: block; width: 10%"></div> </div> </div> This needs clarification. Test: fast/layoutformattingcontext/float-avoider-available-horizontal-space3.html * layout/FormattingContext.h: (WebCore::Layout::FormattingContext::isTableWrapperBlockFormattingContext const): * layout/blockformatting/BlockFormattingContext.cpp: (WebCore::Layout::BlockFormattingContext::layoutInFlowContent): * layout/blockformatting/tablewrapper/TableWrapperBlockFormattingContext.cpp: (WebCore::Layout::TableWrapperBlockFormattingContext::computeWidthAndMarginForTableBox): * layout/blockformatting/tablewrapper/TableWrapperBlockFormattingContext.h: 2020-06-20 Jer Noble <jer.noble@apple.com> RecoveryOS: PAL::getAVPlayerLayerClass() will crash when AVFoundation is missing https://bugs.webkit.org/show_bug.cgi?id=213437 <rdar://problem/64563064> Reviewed by Eric Carlson. Check PAL::isAVFoundationAvailable() before calling PAL::getAVPlayerLayerClass(); * platform/graphics/avfoundation/objc/VideoLayerManagerObjC.mm: (WebCore::VideoLayerManagerObjC::setVideoLayer): * platform/graphics/ca/cocoa/PlatformCALayerCocoa.mm: (WebCore::PlatformCALayerCocoa::layerTypeForPlatformLayer): (WebCore::PlatformCALayerCocoa::PlatformCALayerCocoa): (WebCore::PlatformCALayerCocoa::clone const): (WebCore::PlatformCALayerCocoa::avPlayerLayer const): 2020-06-20 Simon Fraser <simon.fraser@apple.com> Crash under ScrollController::startSnapRubberbandTimer() firing https://bugs.webkit.org/show_bug.cgi?id=213439 <rdar://problem/63986013> Reviewed by Tim Horton. A wholesale destruction of the ScrollingTree (e.g. via ScrollingCoordinatorMac::pageDestroyed()) never ran the code to stop CFRunLoopTimers in ScrollController, which could lead to this crash. Fix by calling removeAllNodes() in ThreadedScrollingTree::invalidate(). Add an assertion in ScrollController's destructor that stopAllTimers() has been called, and have ScrollAnimator's destructor call stopAllTimers() too. * page/scrolling/ScrollingTree.h: * page/scrolling/ThreadedScrollingTree.cpp: (WebCore::ThreadedScrollingTree::invalidate): * platform/ScrollAnimator.cpp: (WebCore::ScrollAnimator::~ScrollAnimator): * platform/cocoa/ScrollController.h: * platform/cocoa/ScrollController.mm: (WebCore::ScrollController::~ScrollController): (WebCore::ScrollController::stopAllTimers): 2020-06-20 Zalan Bujtas <zalan@apple.com> [LFC][TFC][Quirk] Table height needs quirk handling https://bugs.webkit.org/show_bug.cgi?id=213430 Reviewed by Antti Koivisto. In quirks mode the used table height of an empty table is 0, while in standards mode we take the specified value into account and size the table accordingly. Tests: fast/layoutformattingcontext/empty-table-with-specified-height-quirk-simple.html fast/layoutformattingcontext/empty-table-with-specified-height-standards-simple.html * Sources.txt: * WebCore.xcodeproj/project.pbxproj: * layout/FormattingContext.h: * layout/blockformatting/BlockFormattingContext.h: (WebCore::Layout::BlockFormattingContext::Quirks::geometry const): * layout/blockformatting/BlockFormattingContextQuirks.cpp: (WebCore::Layout::BlockFormattingContext::Quirks::stretchedInFlowHeight): * layout/blockformatting/tablewrapper/TableWrapperBlockFormattingContext.cpp: (WebCore::Layout::TableWrapperBlockFormattingContext::computeHeightAndMarginForTableBox): * layout/blockformatting/tablewrapper/TableWrapperBlockFormattingContext.h: (WebCore::Layout::TableWrapperBlockFormattingContext::Quirks::Quirks): * layout/blockformatting/tablewrapper/TableWrapperBlockFormattingContextQuirks.cpp: Copied from Source/WebCore/layout/blockformatting/tablewrapper/TableWrapperBlockFormattingContext.h. (WebCore::Layout::TableWrapperBlockFormattingContext::Quirks::usedTableHeight const): 2020-06-19 Chris Dumez <cdumez@apple.com> [Cocoa] Delay issuing ManagedSession & Network Extension sandbox extensions until a load is actually issued https://bugs.webkit.org/show_bug.cgi?id=213414 <rdar://problem/64548684> Reviewed by Per Arne Vollan. setHasConsumedSandboxExtensions() can now get called several times, every time a WebPage is created. Once a sandbox extension has been consumed, there is no going back so return early if the state is already "Consumed". * platform/cocoa/NetworkExtensionContentFilter.mm: (WebCore::NetworkExtensionContentFilter::setHasConsumedSandboxExtensions): * platform/cocoa/ParentalControlsContentFilter.mm: (WebCore::ParentalControlsContentFilter::setHasConsumedSandboxExtension): 2020-06-19 Zalan Bujtas <zalan@apple.com> [AutoSizing] Resolve viewport units against the preferred content size https://bugs.webkit.org/show_bug.cgi?id=213408 <rdar://problem/64267539> Reviewed by Tim Horton. Instead of resolving the viewport units against the maximum content size constraints, let's use the preferred content size. It ensures that content with vw, vh units does not grow beyond the preferred content size. Test: fast/dynamic/size-to-content-autosize-with-viewport-units.html * page/FrameView.cpp: (WebCore::FrameView::performSizeToContentAutoSize): (WebCore::FrameView::enableAutoSizeMode): Let's "ignore" viewport units during the initial pass and use the preferred width to finalize the vw vh unit values (we don't really ignore them, but they are resolved against a [ 1, 1 ] viewport). This approach fails if the main content has 100vw with overflow hidden. Such content would end up with a [ 1, 1 ] size (we might want to detect it and resolved the values against the horizontal constraint). (WebCore::FrameView::overrideViewportWidthForCSSViewportUnits): (WebCore::FrameView::resetOverriddenViewportWidthForCSSViewportUnits): * page/FrameView.h: * testing/Internals.cpp: (WebCore::Internals::enableSizeToContentAutoSizeMode): * testing/Internals.h: * testing/Internals.idl: 2020-06-19 Wenson Hsieh <wenson_hsieh@apple.com> [macOS] Move progress bar painting code off of Carbon API https://bugs.webkit.org/show_bug.cgi?id=213405 <rdar://problem/63958537> Reviewed by Tim Horton. Adopts CoreUI constants and AppKit SPI (`-[NSAppearance _drawInRect:context:options:]`) when painting progress elements. This is being done in light of recent changes around how `HIThemeDrawTrack` draws progress bars on recent versions of macOS; it has been recommended to us that we move away from using Carbon, and instead use AppKit. * rendering/RenderThemeMac.mm: (WebCore::RenderThemeMac::paintProgressBar): The `NSControlSize` to `CUISize` mapping here looks counterintuitive, but matches our current behavior. This is because `kThemeLargeProgressBar` and `kThemeLargeIndeterminateBar` both map to `kCUISizeRegular`, while `kThemeMediumIndeterminateBar` and `kThemeMediumProgressBar` map to `kCUISizeSmall`. 2020-06-19 Clark Wang <clark_wang@apple.com> Remove setVelocity() from PannerNode https://bugs.webkit.org/show_bug.cgi?id=213360 Reviewed by Chris Dumez. Removed setVelocity() and other velocity dependencies, as per spec: https://www.w3.org/TR/webaudio/#pannernode. Simplified dopplerRate, since sourceVelocity is always zero. Re-baselined previous test that now passes with velocity removed. * Modules/webaudio/PannerNode.cpp: (WebCore::PannerNode::PannerNode): (WebCore::PannerNode::dopplerRate): * Modules/webaudio/PannerNode.h: * Modules/webaudio/PannerNode.idl: 2020-06-19 Wenson Hsieh <wenson_hsieh@apple.com> REGRESSION (r263253): Search field results and cancel buttons have their own focus rings https://bugs.webkit.org/show_bug.cgi?id=213413 <rdar://problem/64548419> Reviewed by Tim Horton. After r263253, `paintCellAndSetFocusedElementNeedsRepaintIfNecessary` is used when painting the buttons in a search field's shadow root. However, the renderer that is passed in (which is used to determine whether we should additionally draw focus rings) is the input element's renderer rather than the renderers of the results and cancel buttons themselves. This means that when the search field is focused, we will draw focus rings around each of the buttons in the shadow root as well. Address this by using `box` (the buttons' RenderBoxes) instead. Test: fast/forms/search-field-buttons-do-not-have-focus-rings.html * rendering/RenderThemeMac.mm: (WebCore::RenderThemeMac::paintSearchFieldCancelButton): (WebCore::RenderThemeMac::paintSearchFieldResultsButton): 2020-06-19 Pinki Gyanchandani <pgyanchandani@apple.com> Crash in WebCore::Range::borderAndTextRects https://bugs.webkit.org/show_bug.cgi?id=209379 Reviewed by Darin Adler. When a parentless node is moved to a new document, then all ranges associated with this node and its children also should be updated with new document information. Test woould be submitted later. * dom/Document.cpp: (WebCore::Document::parentlessNodeMoveToNewDocument): * dom/Document.h: * dom/Node.cpp: (WebCore::Node::moveNodeToNewDocument): * dom/Range.cpp: (WebCore::Range::parentlessNodeMoveToNewDocumentAffectsRange): (WebCore::Range::updateRangeForParentlessNodeMoveToNewDocument): * dom/Range.h: 2020-06-19 Truitt Savell <tsavell@apple.com> Unreviewed, reverting r263121. Broke media/video-fullscreen-only-playback.html on Catalina Debug Reverted changeset: "Don't claim to support fullscreen mode unless fullScreenEnabled setting is enabled" https://bugs.webkit.org/show_bug.cgi?id=213142 https://trac.webkit.org/changeset/263121 2020-06-19 Said Abou-Hallawa <sabouhallawa@apple.com> [CG] REGRESSION (r256892): Luminance SVG mask is not applied when accelerated drawing is enabled https://bugs.webkit.org/show_bug.cgi?id=213403 <rdar://problem/64489419> Reviewed by Simon Fraser. Test: svg/masking/mask-css-luminance.html If the ImageBuffer is backed by an IOSurface, its context has to be flushed out before convertToLuminanceMask() can access its data. * platform/graphics/ConcreteImageBuffer.h: 2020-06-19 Chris Dumez <cdumez@apple.com> Avoid initializing RenderTheme singleton unnecessarily in the UIProcess https://bugs.webkit.org/show_bug.cgi?id=213406 Reviewed by Per Arne Vollan. Avoid initializing RenderTheme singleton unnecessarily in the UIProcess. Instead, introduce a static function to get the focus ring color on iOS. * rendering/RenderThemeIOS.h: * rendering/RenderThemeIOS.mm: (WebCore::RenderThemeIOS::systemFocusRingColor): (WebCore::RenderThemeIOS::platformFocusRingColor const): 2020-06-19 Andres Gonzalez <andresg_22@apple.com> AX: web process crash in AXObjectCache::postNotification. https://bugs.webkit.org/show_bug.cgi?id=213398 Reviewed by Chris Fleizach. AXObjectCache was being instantiated on the AX secondary thread. Therefore the timers for the different delayed notifications where initialized with the secondary thread. When postNotification was triggered on the main thread as it should, and the timer was accessed, the timer would assert/crash for being accessed in a thread different than where it was created. This change guaranties that AXObjectCache is always created on the main thread. * accessibility/AXObjectCache.cpp: (WebCore::AXObjectCache::enableAccessibility): (WebCore::AXObjectCache::AXObjectCache): (WebCore::AXObjectCache::postNotification): 2020-06-19 Chris Dumez <cdumez@apple.com> [iOS] RenderThemeIOS::cssValueToSystemColorMap() does an unnecessary linear search under systemColorFromCSSValueID() https://bugs.webkit.org/show_bug.cgi?id=213396 Reviewed by Timothy Hatcher. RenderThemeIOS::cssValueToSystemColorMap() does an unnecessary linear search under systemColorFromCSSValueID(). cssValueToSystemColorMap() already has the selector, yet it passes a CSSValueID to systemColorFromCSSValueID() which then does a linear search to match the CSSValueID to a selector. This was very inefficient / unfortunate. This patch introduces a systemColorFromCSSValueIDSelector() which takes in a selector instead of a CSSValueID. I have also moved the constructor of the LocalCurrentTraitCollection variable to the call site so that we don't keep constructing / destroying it for each loop iteration. The traces show us spending a lot of time in its constructor / destructor. * rendering/RenderThemeIOS.mm: (WebCore::systemColorFromCSSValueIDSelector): (WebCore::RenderThemeIOS::cssValueToSystemColorMap): 2020-06-19 James Darpinian <jdarpinian@chromium.org> [WebGL2] Uniform Buffer Objects https://bugs.webkit.org/show_bug.cgi?id=209518 Reviewed by Dean Jackson. All uniform buffer object conformance tests pass. Implemented Uniform Buffer Object related functions: bindBufferBase, bindBufferRange, getUniformIndices, getActiveUniforms, getUniformBlockIndex, getActiveUniformBlockParameter, getActiveUniformBlockName, uniformBlockBinding Additionally, fixed many tangentially related issues: getIntegeri_v and getInteger64i_v were not present. drawArraysInstances and drawElementsInstanced did not work for WebGL 2. drawRangeElements was not implemented. WebGLAny did not support Vector<unsigned>, so Uint32Arrays could not be returned from WebGL functions. The maximum uniform location length was wrong for WebGL 2. Transform feedback indexed binding points weren't being tracked. Some functions in ExtensionsGLANGLE didn't call makeContextCurrent. New WebGL 2 buffer usage types COPY and READ weren't supported in bufferData. pause/resumeTransformFeedback were unimplemented. getParameter(READ_BUFFER) was unimplemented. readBuffer conformance test was incorrect. * bindings/js/JSDOMConvertWebGL.cpp: (WebCore::convertToJSValue): * html/canvas/WebGL2RenderingContext.cpp: (WebCore::WebGL2RenderingContext::~WebGL2RenderingContext): (WebCore::WebGL2RenderingContext::initializeNewContext): (WebCore::WebGL2RenderingContext::drawRangeElements): (WebCore::WebGL2RenderingContext::setIndexedBufferBinding): (WebCore::WebGL2RenderingContext::bindBufferBase): (WebCore::WebGL2RenderingContext::bindBufferRange): (WebCore::WebGL2RenderingContext::getIndexedParameter): (WebCore::WebGL2RenderingContext::getUniformIndices): (WebCore::WebGL2RenderingContext::getActiveUniforms): (WebCore::WebGL2RenderingContext::getUniformBlockIndex): (WebCore::WebGL2RenderingContext::getActiveUniformBlockParameter): (WebCore::WebGL2RenderingContext::getActiveUniformBlockName): (WebCore::WebGL2RenderingContext::uniformBlockBinding): * html/canvas/WebGL2RenderingContext.h: * html/canvas/WebGLAny.h: * html/canvas/WebGLRenderingContextBase.cpp: (WebCore::WebGLRenderingContextBase::validateLocationLength): (WebCore::WebGLRenderingContextBase::validateBufferDataParameters): * loader/SubresourceLoader.cpp: (WebCore::SubresourceLoader::didFinishLoading): * platform/graphics/GraphicsContextGL.h: * platform/graphics/angle/ExtensionsGLANGLE.cpp: (WebCore::ExtensionsGLANGLE::getTranslatedShaderSourceANGLE): (WebCore::ExtensionsGLANGLE::blitFramebuffer): (WebCore::ExtensionsGLANGLE::renderbufferStorageMultisample): (WebCore::ExtensionsGLANGLE::drawBuffersEXT): (WebCore::ExtensionsGLANGLE::getBooleanvRobustANGLE): (WebCore::ExtensionsGLANGLE::getBufferParameterivRobustANGLE): (WebCore::ExtensionsGLANGLE::getFloatvRobustANGLE): (WebCore::ExtensionsGLANGLE::getFramebufferAttachmentParameterivRobustANGLE): (WebCore::ExtensionsGLANGLE::getIntegervRobustANGLE): (WebCore::ExtensionsGLANGLE::getProgramivRobustANGLE): (WebCore::ExtensionsGLANGLE::getRenderbufferParameterivRobustANGLE): (WebCore::ExtensionsGLANGLE::getShaderivRobustANGLE): (WebCore::ExtensionsGLANGLE::getTexParameterfvRobustANGLE): (WebCore::ExtensionsGLANGLE::getTexParameterivRobustANGLE): (WebCore::ExtensionsGLANGLE::getUniformfvRobustANGLE): (WebCore::ExtensionsGLANGLE::getUniformivRobustANGLE): (WebCore::ExtensionsGLANGLE::getVertexAttribfvRobustANGLE): (WebCore::ExtensionsGLANGLE::getVertexAttribivRobustANGLE): (WebCore::ExtensionsGLANGLE::getVertexAttribPointervRobustANGLE): (WebCore::ExtensionsGLANGLE::readPixelsRobustANGLE): (WebCore::ExtensionsGLANGLE::texImage2DRobustANGLE): (WebCore::ExtensionsGLANGLE::texParameterfvRobustANGLE): (WebCore::ExtensionsGLANGLE::texParameterivRobustANGLE): (WebCore::ExtensionsGLANGLE::texSubImage2DRobustANGLE): (WebCore::ExtensionsGLANGLE::compressedTexImage2DRobustANGLE): (WebCore::ExtensionsGLANGLE::compressedTexSubImage2DRobustANGLE): (WebCore::ExtensionsGLANGLE::compressedTexImage3DRobustANGLE): (WebCore::ExtensionsGLANGLE::compressedTexSubImage3DRobustANGLE): (WebCore::ExtensionsGLANGLE::texImage3DRobustANGLE): (WebCore::ExtensionsGLANGLE::texSubImage3DRobustANGLE): (WebCore::ExtensionsGLANGLE::getQueryivRobustANGLE): (WebCore::ExtensionsGLANGLE::getQueryObjectuivRobustANGLE): (WebCore::ExtensionsGLANGLE::getBufferPointervRobustANGLE): (WebCore::ExtensionsGLANGLE::getIntegeri_vRobustANGLE): (WebCore::ExtensionsGLANGLE::getInternalformativRobustANGLE): (WebCore::ExtensionsGLANGLE::getVertexAttribIivRobustANGLE): (WebCore::ExtensionsGLANGLE::getVertexAttribIuivRobustANGLE): (WebCore::ExtensionsGLANGLE::getUniformuivRobustANGLE): (WebCore::ExtensionsGLANGLE::getActiveUniformBlockivRobustANGLE): (WebCore::ExtensionsGLANGLE::getInteger64vRobustANGLE): (WebCore::ExtensionsGLANGLE::getInteger64i_vRobustANGLE): (WebCore::ExtensionsGLANGLE::getBufferParameteri64vRobustANGLE): (WebCore::ExtensionsGLANGLE::samplerParameterivRobustANGLE): (WebCore::ExtensionsGLANGLE::samplerParameterfvRobustANGLE): (WebCore::ExtensionsGLANGLE::getSamplerParameterivRobustANGLE): (WebCore::ExtensionsGLANGLE::getSamplerParameterfvRobustANGLE): (WebCore::ExtensionsGLANGLE::getFramebufferParameterivRobustANGLE): (WebCore::ExtensionsGLANGLE::getProgramInterfaceivRobustANGLE): (WebCore::ExtensionsGLANGLE::getBooleani_vRobustANGLE): (WebCore::ExtensionsGLANGLE::getMultisamplefvRobustANGLE): (WebCore::ExtensionsGLANGLE::getTexLevelParameterivRobustANGLE): (WebCore::ExtensionsGLANGLE::getTexLevelParameterfvRobustANGLE): (WebCore::ExtensionsGLANGLE::getPointervRobustANGLERobustANGLE): (WebCore::ExtensionsGLANGLE::readnPixelsRobustANGLE): (WebCore::ExtensionsGLANGLE::getnUniformfvRobustANGLE): (WebCore::ExtensionsGLANGLE::getnUniformivRobustANGLE): (WebCore::ExtensionsGLANGLE::getnUniformuivRobustANGLE): (WebCore::ExtensionsGLANGLE::texParameterIivRobustANGLE): (WebCore::ExtensionsGLANGLE::texParameterIuivRobustANGLE): (WebCore::ExtensionsGLANGLE::getTexParameterIivRobustANGLE): (WebCore::ExtensionsGLANGLE::getTexParameterIuivRobustANGLE): (WebCore::ExtensionsGLANGLE::samplerParameterIivRobustANGLE): (WebCore::ExtensionsGLANGLE::samplerParameterIuivRobustANGLE): (WebCore::ExtensionsGLANGLE::getSamplerParameterIivRobustANGLE): (WebCore::ExtensionsGLANGLE::getSamplerParameterIuivRobustANGLE): (WebCore::ExtensionsGLANGLE::getQueryObjectivRobustANGLE): (WebCore::ExtensionsGLANGLE::getQueryObjecti64vRobustANGLE): (WebCore::ExtensionsGLANGLE::getQueryObjectui64vRobustANGLE): * platform/graphics/angle/GraphicsContextGLANGLE.cpp: (WebCore::GraphicsContextGLOpenGL::getIntegeri_v): (WebCore::GraphicsContextGLOpenGL::getInteger64v): (WebCore::GraphicsContextGLOpenGL::getInteger64i_v): (WebCore::GraphicsContextGLOpenGL::drawArraysInstanced): (WebCore::GraphicsContextGLOpenGL::drawElementsInstanced): (WebCore::GraphicsContextGLOpenGL::getUniformBlockIndex): (WebCore::GraphicsContextGLOpenGL::getActiveUniformBlockiv): (WebCore::GraphicsContextGLOpenGL::getActiveUniformBlockName): (WebCore::GraphicsContextGLOpenGL::uniformBlockBinding): (WebCore::GraphicsContextGLOpenGL::drawRangeElements): (WebCore::GraphicsContextGLOpenGL::pauseTransformFeedback): (WebCore::GraphicsContextGLOpenGL::resumeTransformFeedback): (WebCore::GraphicsContextGLOpenGL::bindBufferRange): (WebCore::GraphicsContextGLOpenGL::getUniformIndices): * platform/graphics/opengl/GraphicsContextGLOpenGL.h: * platform/graphics/opengl/GraphicsContextGLOpenGLBase.cpp: (WebCore::GraphicsContextGLOpenGL::getIntegeri_v): * platform/graphics/opengl/GraphicsContextGLOpenGLCommon.cpp: (WebCore::GraphicsContextGLOpenGL::getInteger64v): (WebCore::GraphicsContextGLOpenGL::getInteger64i_v): 2020-06-19 Chris Dumez <cdumez@apple.com> [iOS] Drop std::call_once() from RenderThemeIOS::cssValueToSystemColorMap() https://bugs.webkit.org/show_bug.cgi?id=213392 Reviewed by Geoffrey Garen. Drop std::call_once() from RenderThemeIOS::cssValueToSystemColorMap() since this function is always called from the main thread. * rendering/RenderThemeIOS.mm: (WebCore::RenderThemeIOS::cssValueToSystemColorMap): 2020-06-19 Rob Buis <rbuis@igalia.com> Enable referrer policy attribute support by default https://bugs.webkit.org/show_bug.cgi?id=213285 Reviewed by Youenn Fablet. Enable referrer policy attribute support by default by flipping the switch. * page/RuntimeEnabledFeatures.h: 2020-06-19 Chris Dumez <cdumez@apple.com> Move Prefixed WebAudio interfaces behind their own feature flag https://bugs.webkit.org/show_bug.cgi?id=213356 Reviewed by Darin Adler. Move Prefixed WebAudio interfaces behind their own feature flag, on by default. This will allow us to easily disable the prefixed API and will also allow it to live independently from the unprefixed API. * Modules/webaudio/AudioContext.idl: * Modules/webaudio/WebKitAudioContext.idl: * Modules/webaudio/WebKitAudioPannerNode.idl: * Modules/webaudio/WebKitOfflineAudioContext.idl: * bindings/js/WebCoreBuiltinNames.h: * page/Settings.yaml: 2020-06-19 Zalan Bujtas <zalan@apple.com> [LFC][TFC] Do not special-case empty tables https://bugs.webkit.org/show_bug.cgi?id=213378 Reviewed by Antti Koivisto. Now that min/max-width support is added, empty tables can just go through the normal width computation path. Test: fast/layoutformattingcontext/table-min-max-width-empty-content-simple.html * layout/blockformatting/tablewrapper/TableWrapperBlockFormattingContext.cpp: (WebCore::Layout::TableWrapperBlockFormattingContext::computeWidthAndMarginForTableBox): 2020-06-10 Sergio Villar Senin <svillar@igalia.com> REGRESSION(r262254?): [WPE] imported/w3c/web-platform-tests/webxr/idlharness.https.window.html is failing https://bugs.webkit.org/show_bug.cgi?id=212897 Reviewed by Youenn Fablet. WPT tests were updated in r262254 and they already include the latest changes in the specs. Among others the XR interface was renamed to XRSystem. We were already using that name in the C++ code but not in the JS interface. The WPT update brings in another set of changes like the new XRLayer which is already not supported (I am adding it soon in another patch). Last but not least, the new tests include checks for the XRPermissionStatus interface which is not going to be implemented soon as it requires the Permission API which is not supported in WebKit yet. All in all, this patch renames XR to XRSystem and marks as failing the XRLayer (temporarily) and XRPermissionStatus checks. No new tests as there is no change in functionality. * Modules/webxr/WebXRSystem.idl: Rename XR to XRSystem. * bindings/js/WebCoreBuiltinNames.h: Ditto. 2020-06-19 Zalan Bujtas <zalan@apple.com> [LFC][BFC] Min/max-width should always be resolved against the containing block width https://bugs.webkit.org/show_bug.cgi?id=213365 Reviewed by Antti Koivisto. Even when neighboring floats shrink the available horizontal space, the min/max(normal) widths should be resolved against the containing block's logical width. Test: fast/layoutformattingcontext/float-avoider-available-horizontal-space2.html * layout/blockformatting/BlockFormattingContext.cpp: (WebCore::Layout::BlockFormattingContext::computeWidthAndMargin): * layout/blockformatting/BlockFormattingContext.h: * layout/blockformatting/BlockFormattingContextGeometry.cpp: (WebCore::Layout::BlockFormattingContext::Geometry::computedWidthAndMargin): * layout/blockformatting/tablewrapper/TableWrapperBlockFormattingContext.cpp: (WebCore::Layout::TableWrapperBlockFormattingContext::computeWidthAndMarginForTableBox): 2020-06-10 Sergio Villar Senin <svillar@igalia.com> [WebXR] unsigned long in IDL should be translated as unsigned in C++ code https://bugs.webkit.org/show_bug.cgi?id=213020 Reviewed by Darin Adler. The "unsigned long" type definition in IDL must be translated to unsigned in C++ code. I'm also replacing the very long XRFrameRequestCallback::Identifier by simply unsigned as it isn't adding anything. No new test required as there is no change in functionality, just removing an alias. * Modules/webxr/WebXRSession.cpp: (WebCore::WebXRSession::requestAnimationFrame): (WebCore::WebXRSession::cancelAnimationFrame): * Modules/webxr/WebXRSession.h: * Modules/webxr/XRFrameRequestCallback.h: (WebCore::XRFrameRequestCallback::callbackId): (WebCore::XRFrameRequestCallback::setCallbackId): 2020-06-19 Myles C. Maxfield <mmaxfield@apple.com> [Cocoa] Unify "font:" CSS shorthand values between macOS and iOS family https://bugs.webkit.org/show_bug.cgi?id=213332 <rdar://problem/64479189> Reviewed by Tim Horton and Darin Adler. They exist on all Cocoa platforms, so we might as well hook them up. This unifies the shorthand CSS value handling from RenderThemeMac and RenderThemeIOS into RenderThemeCocoa. This has two effects: - It hooks up the -apple-system keywords on macOS (they previously were only implemented for the iOS family). - It hooks up the CSS2 keywords (caption, menu, etc.) on the iOS family (they previously were only implemented on Mac). All these fonts have been around since Mojave, so there is no need to introduce any new platform guards. Tests: fast/text/text-styles/-apple-system/-apple-system-body.html fast/text/text-styles/-apple-system/-apple-system-caption1.html fast/text/text-styles/-apple-system/-apple-system-caption2.html fast/text/text-styles/-apple-system/-apple-system-footnote.html fast/text/text-styles/-apple-system/-apple-system-headline.html fast/text/text-styles/-apple-system/-apple-system-short-body.html fast/text/text-styles/-apple-system/-apple-system-short-caption1.html fast/text/text-styles/-apple-system/-apple-system-short-footnote.html fast/text/text-styles/-apple-system/-apple-system-short-headline.html fast/text/text-styles/-apple-system/-apple-system-short-subheadline.html fast/text/text-styles/-apple-system/-apple-system-subheadline.html fast/text/text-styles/-apple-system/-apple-system-tall-body.html fast/text/text-styles/-apple-system/-apple-system-title0.html fast/text/text-styles/-apple-system/-apple-system-title1.html fast/text/text-styles/-apple-system/-apple-system-title2.html fast/text/text-styles/-apple-system/-apple-system-title3.html fast/text/text-styles/-apple-system/-apple-system-title4.html fast/text/text-styles/-webkit-control.html fast/text/text-styles/-webkit-mini-control.html fast/text/text-styles/-webkit-small-control.html fast/text/text-styles/bogus.html fast/text/text-styles/caption.html fast/text/text-styles/icon.html fast/text/text-styles/menu.html fast/text/text-styles/message-box.html fast/text/text-styles/small-caption.html fast/text/text-styles/status-bar.html * css/CSSValueKeywords.in: All Cocoa ports should be able to parse these values * platform/graphics/cocoa/FontCacheCoreText.cpp: (WebCore::fontWithFamilySpecialCase): Move code that used to be in the Mac and iOS implementations of platformFontWithFamilySpecialCase() (inside FontCacheMac.mm and FontCacheIOS.mm) to be shared to be shared inside fontWithFamilySpecialCase(). * platform/graphics/cocoa/FontDescriptionCocoa.cpp: Remove platform guards. (WebCore::convertArray): (WebCore::matchSystemFontUse): * platform/graphics/cocoa/SystemFontDatabaseCoreText.cpp: Ditto. (WebCore::SystemFontDatabaseCoreText::createTextStyleFont): * platform/graphics/ios/FontCacheIOS.mm: Move code from here into FontCacheCoreText. (WebCore::platformFontWithFamilySpecialCase): * platform/graphics/mac/FontCacheMac.mm: Ditto. (WebCore::platformFontWithFamilySpecialCase): * platform/mac/ThemeMac.h: Delete systemFontSizeFor(NSControlSize) because <rdar://problem/60350699> is fixed. * platform/mac/ThemeMac.mm: Ditto. (WebCore::ThemeMac::controlFont const): (WebCore::ThemeMac::systemFontSizeFor): Deleted. * rendering/RenderThemeCocoa.h: Previously, code was calling RenderThemeIOS::contentSizeCategory(), which was a static function. Now, both Mac and iOS need to be able to call this. However, the implementation of this function is different between Mac and iOS. So, turn it from a static function in RenderThemeIOS into a method in RenderThemeCocoa, and give RenderThemeCocoa a singleton() function that downcasts the return of RenderTheme::singleton(). This way, instead of calling RenderThemeIOS::contentSizeCategory(), code can call RenderThemeCocoa::singleton().contentSizeCategory(). * rendering/RenderThemeCocoa.mm: Move code from RenderThemeIOS and RenderThemeMac into RenderThemeCocoa. (WebCore::RenderThemeCocoa::singleton): (WebCore::RenderThemeCocoa::cachedSystemFontDescription const): (WebCore::cssWeightOfSystemFont): (WebCore::RenderThemeCocoa::updateCachedSystemFontDescription const): * rendering/RenderThemeIOS.h: Ditto. * rendering/RenderThemeIOS.mm: Ditto. (WebCore::RenderThemeIOS::contentSizeCategory const): (WebCore::attachmentActionFont): (WebCore::attachmentTitleFont): (WebCore::RenderThemeIOS::contentSizeCategory): Deleted. (WebCore::RenderThemeIOS::cachedSystemFontDescription const): Deleted. (WebCore::cssWeightOfSystemFont): Deleted. (WebCore::RenderThemeIOS::updateCachedSystemFontDescription const): Deleted. * rendering/RenderThemeMac.h: Ditto. * rendering/RenderThemeMac.mm: Ditto. (WebCore::RenderThemeMac::contentSizeCategory const): (WebCore::RenderThemeMac::setFontFromControlSize const): (WebCore::RenderThemeMac::controlSizeForSystemFont const): (WebCore::toFontWeight): Deleted. (WebCore::RenderThemeMac::updateCachedSystemFontDescription const): Deleted. 2020-06-18 Doug Kelly <dougk@apple.com> Use paintCellAndSetFocusedElementNeedsRepaintIfNecessary() for search field buttons https://bugs.webkit.org/show_bug.cgi?id=213352 <rdar://problem/57129008> Reviewed by Simon Fraser. The search fields cancel and results buttons should use the common paintCellAndSetFocusedElementNeedsRepaintIfNecessary() function instead of directly painting the cell. This allows for an image buffer to be used for drawing specifically in cases when it becomes needed, when a scale (either via zoom or CSS transform) is applied. This also moves the logic for determining if an image buffer should be used into ThemeMac::drawCellOrFocusRingWithViewIntoContext(), which uses the current user-defined CTM (inverting the base CTM to negate the effect of a device-specific scale factor). This also negates the need for the page scale factor and the effective zoom applied to the renderer style, since it is computed into the CTM already. * platform/mac/ThemeMac.h: * platform/mac/ThemeMac.mm: (WebCore::paintToggleButton): (WebCore::paintButton): (WebCore::ThemeMac::drawCellOrFocusRingWithViewIntoContext): (WebCore::paintColorWell): (WebCore::ThemeMac::paint): * rendering/RenderThemeMac.mm: (WebCore::RenderThemeMac::paintCellAndSetFocusedElementNeedsRepaintIfNecessary): (WebCore::RenderThemeMac::paintSliderThumb): (WebCore::RenderThemeMac::paintSearchFieldCancelButton): (WebCore::RenderThemeMac::paintSearchFieldResultsButton): 2020-06-18 Devin Rousso <drousso@apple.com> Web Inspector: ASSERTION FAILED: decodedLength >= dataLength at WebCore::NetworkResourcesData::ResourceData::decodeDataToContent() https://bugs.webkit.org/show_bug.cgi?id=213271 <rdar://problem/64168350> Reviewed by Brian Burg. Remove the invalid `ASSERT(decodedLength >= dataLength)` as it's very possible for decoded content to be smaller than encoded content (e.g. something gzipped). Use `String::sizeInBytes` instead of `StringImpl::sizeInBytes` as the latter also includes `sizeof(*this)`, which is not really part of the resource's size, as it's really more of an implementation detail. * inspector/NetworkResourcesData.h: * inspector/NetworkResourcesData.cpp: (WebCore::NetworkResourcesData::ResourceData::removeContent): (WebCore::NetworkResourcesData::ResourceData::decodeDataToContent): (WebCore::NetworkResourcesData::setResourceContent): (WebCore::NetworkResourcesData::maybeDecodeDataToContent): (WebCore::contentSizeInBytes): Deleted. 2020-06-18 Andy Estes <aestes@apple.com> [Apple Pay] Fix a log message typo in PaymentCoordinator::didAuthorizePayment Rubber-stamped by Beth Dakin. * Modules/applepay/PaymentCoordinator.cpp: (WebCore::PaymentCoordinator::didAuthorizePayment): Logged the correct function name. 2020-06-18 Zalan Bujtas <zalan@apple.com> [LFC][BFC] Available space computation for the float avoider needs coordinate mapping https://bugs.webkit.org/show_bug.cgi?id=213339 Reviewed by Antti Koivisto. The FloatConstraints position values are in formatting root coordinates but the available space requires containing block coordinates. Test: fast/layoutformattingcontext/float-avoider-available-horizontal-space.html * layout/blockformatting/BlockFormattingContext.cpp: (WebCore::Layout::BlockFormattingContext::usedAvailableWidthForFloatAvoider): 2020-06-18 Stephan Szabo <stephan.szabo@sony.com> [PlayStation] Build fix for errors with structured bindings to const structure https://bugs.webkit.org/show_bug.cgi?id=213323 Reviewed by Fujii Hironori. Our system seems to have trouble with these structured bindings, similar to what was previously seen for clang-cl. No new tests, build fix. * inspector/agents/InspectorNetworkAgent.cpp: 2020-06-18 Youenn Fablet <youenn@apple.com> REGRESSION (r263098): [Win10] http/tests/security/cross-origin-clean-css-resource-timing.html and http/tests/security/cross-origin-css-resource-timing.html are failing https://bugs.webkit.org/show_bug.cgi?id=213303 <rdar://problem/64452203> Reviewed by Alex Christensen. Covered by existing tests. * loader/ResourceLoaderOptions.h: Reverting part of https://trac.webkit.org/changeset/263098/webkit that might have broken win10 bots. 2020-06-18 Víctor Manuel Jáquez Leal <vjaquez@igalia.com> [GStreamer] Avoid setting GstContext twice in GLVideoSinkGStreamer https://bugs.webkit.org/show_bug.cgi?id=213029 Reviewed by Xabier Rodriguez-Calvar. There is a reported issued in GStrearGL < 1.17 for GLBaseFilter can't handle its GLContext and Display reassignation. This patch aims to to avoid setting Display or GL Context in GL video sink multiple times by checking if the video sink bin already has those contexts. Also, instead of relying on an assert if something goes wrong at fetching the GL parameters, it returns an error at state change. No new tests required. * platform/graphics/gstreamer/GLVideoSinkGStreamer.cpp: (requestGLContext): (setGLContext): new function. (webKitGLVideoSinkChangeState): 2020-06-18 Doug Kelly <dougk@apple.com> Clamp text run width to zero https://bugs.webkit.org/show_bug.cgi?id=212655 <rdar://problem/61462335> Reviewed by Said Abou-Hallawa. It's possible to end up with a text run with negative width, if the text run is relatively short and the character spacing is relatively large (but negative). If this occurs, clamp the value to zero. This also adds additional asserts and checks to ensure the value remains non-negative. * platform/graphics/cg/GraphicsContextCG.cpp: (WebCore::GraphicsContext::drawLinesForText): * rendering/ComplexLineLayout.cpp: (WebCore::setLogicalWidthForTextRun): * rendering/RenderText.cpp: (WebCore::RenderText::width const): 2020-06-18 David Kilzer <ddkilzer@apple.com> Fix misspellings of "namespace" in comments * page/SpatialNavigation.h: * platform/gtk/RenderThemeScrollbar.cpp: 2020-06-18 David Kilzer <ddkilzer@apple.com> [IPC hardening] OptionSet<> values should be validated <https://webkit.org/b/213199> <rdar://problem/64369963> Reviewed by Anders Carlsson. Summary: - Add WTF::EnumTraits<> for all OptionSet<> enums. - Specify unsigned backing types for enum classes. * loader/CrossOriginAccessControl.h: * page/ActivityState.h: * page/AutoplayEvent.h: * page/CrossSiteNavigationDataTransfer.h: * page/LayoutMilestone.h: * page/TextIndicator.h: * platform/PlatformEvent.h: * platform/graphics/GraphicsContext.h: 2020-06-17 Clark Wang <clark_wang@apple.com> Added missing orientation attributes to PannerNode https://bugs.webkit.org/show_bug.cgi?id=213301 Reviewed by Chris Dumez. Implemented orientation attributes in PannerNode interface, as per spec: https://www.w3.org/TR/webaudio/#pannernode. Added FIXME comments for removing velocity later. Re-baselined previous tests that now have passing test cases. * Modules/webaudio/PannerNode.cpp: (WebCore::PannerNode::PannerNode): (WebCore::PannerNode::orientation const): (WebCore::PannerNode::setOrientation): (WebCore::PannerNode::distanceConeGain): * Modules/webaudio/PannerNode.h: * Modules/webaudio/PannerNode.idl: 2020-06-17 Chris Dumez <cdumez@apple.com> Add experimental feature flag for modern & unprefixed WebAudio API https://bugs.webkit.org/show_bug.cgi?id=213268 Reviewed by Jer Noble. Add experimental feature flag for modern & unprefixed WebAudio API, off by default. This patch split the AudioContext, OfflineAudioContext and PannerNode IDL interfaces into their prefixed and unprefixed versions. The unprefixed versions are behind the new experimental feature flag that is currently off by default but automatically gets turned on in the context of layout tests. This will give us more flexibility when working on the modern and unprefixed WebAudio API as we will not have to worry about backward compatibility. This also allows us to easily turn it on or off via the experimental features menu in Safari. No new tests, rebaselined existing tests. * CMakeLists.txt: * DerivedSources-input.xcfilelist: * DerivedSources-output.xcfilelist: * DerivedSources.make: * Modules/webaudio/AnalyserNode.cpp: (WebCore::AnalyserNode::AnalyserNode): * Modules/webaudio/AnalyserNode.h: * Modules/webaudio/AudioBasicInspectorNode.cpp: (WebCore::AudioBasicInspectorNode::AudioBasicInspectorNode): * Modules/webaudio/AudioBasicInspectorNode.h: * Modules/webaudio/AudioBasicProcessorNode.cpp: (WebCore::AudioBasicProcessorNode::AudioBasicProcessorNode): * Modules/webaudio/AudioBasicProcessorNode.h: * Modules/webaudio/AudioBufferSourceNode.cpp: (WebCore::AudioBufferSourceNode::create): (WebCore::AudioBufferSourceNode::AudioBufferSourceNode): (WebCore::AudioBufferSourceNode::setBuffer): (WebCore::AudioBufferSourceNode::setPannerNode): * Modules/webaudio/AudioBufferSourceNode.h: * Modules/webaudio/AudioContext.cpp: (WebCore::AudioContextBase::AudioContextBase): (WebCore::AudioContext::AudioContext): (WebCore::AudioContextBase::document const): (WebCore::AudioContextBase::scriptExecutionContext const): * Modules/webaudio/AudioContext.h: (WebCore::AudioContextBase::AutoLocker::AutoLocker): (WebCore::AudioContextBase::AutoLocker::~AutoLocker): (WebCore::AudioContext::maxNumberOfChannels): (isType): * Modules/webaudio/AudioContext.idl: * Modules/webaudio/AudioContextState.h: Copied from Source/WebCore/Modules/webaudio/OfflineAudioContext.idl. * Modules/webaudio/AudioContextState.idl: Copied from Source/WebCore/Modules/webaudio/OfflineAudioContext.idl. * Modules/webaudio/AudioDestinationNode.cpp: (WebCore::AudioDestinationNode::AudioDestinationNode): * Modules/webaudio/AudioDestinationNode.h: * Modules/webaudio/AudioNode.cpp: (WebCore::AudioNode::AudioNode): (WebCore::AudioNode::connect): (WebCore::AudioNode::disconnect): (WebCore::AudioNode::setChannelCount): (WebCore::AudioNode::setChannelCountMode): (WebCore::AudioNode::setChannelInterpretation): (WebCore::AudioNode::enableOutputsIfNecessary): (WebCore::AudioNode::deref): (WebCore::AudioNode::contextForBindings const): * Modules/webaudio/AudioNode.h: (WebCore::AudioNode::context): (WebCore::AudioNode::context const): * Modules/webaudio/AudioNode.idl: * Modules/webaudio/AudioNodeOutput.h: (WebCore::AudioNodeOutput::context): * Modules/webaudio/AudioParam.cpp: (WebCore::AudioParam::AudioParam): * Modules/webaudio/AudioParam.h: * Modules/webaudio/AudioParamTimeline.cpp: (WebCore::AudioParamTimeline::valueForContextTime): * Modules/webaudio/AudioParamTimeline.h: * Modules/webaudio/AudioScheduledSourceNode.cpp: (WebCore::AudioScheduledSourceNode::AudioScheduledSourceNode): * Modules/webaudio/AudioScheduledSourceNode.h: * Modules/webaudio/AudioSummingJunction.cpp: (WebCore::AudioSummingJunction::AudioSummingJunction): * Modules/webaudio/AudioSummingJunction.h: (WebCore::AudioSummingJunction::context): * Modules/webaudio/BiquadFilterNode.cpp: (WebCore::BiquadFilterNode::BiquadFilterNode): * Modules/webaudio/BiquadFilterNode.h: * Modules/webaudio/BiquadProcessor.cpp: (WebCore::BiquadProcessor::BiquadProcessor): * Modules/webaudio/BiquadProcessor.h: * Modules/webaudio/ChannelMergerNode.cpp: (WebCore::ChannelMergerNode::create): (WebCore::ChannelMergerNode::ChannelMergerNode): * Modules/webaudio/ChannelMergerNode.h: * Modules/webaudio/ChannelSplitterNode.cpp: (WebCore::ChannelSplitterNode::create): (WebCore::ChannelSplitterNode::ChannelSplitterNode): * Modules/webaudio/ChannelSplitterNode.h: * Modules/webaudio/ConvolverNode.cpp: (WebCore::ConvolverNode::ConvolverNode): * Modules/webaudio/ConvolverNode.h: * Modules/webaudio/DefaultAudioDestinationNode.cpp: (WebCore::DefaultAudioDestinationNode::DefaultAudioDestinationNode): * Modules/webaudio/DefaultAudioDestinationNode.h: * Modules/webaudio/DelayNode.cpp: (WebCore::DelayNode::DelayNode): (WebCore::DelayNode::create): * Modules/webaudio/DelayNode.h: * Modules/webaudio/DelayProcessor.cpp: (WebCore::DelayProcessor::DelayProcessor): * Modules/webaudio/DelayProcessor.h: * Modules/webaudio/DistanceModelType.h: Copied from Source/WebCore/Modules/webaudio/OfflineAudioContext.idl. * Modules/webaudio/DistanceModelType.idl: Copied from Source/WebCore/Modules/webaudio/OfflineAudioContext.idl. * Modules/webaudio/DynamicsCompressorNode.cpp: (WebCore::DynamicsCompressorNode::DynamicsCompressorNode): * Modules/webaudio/DynamicsCompressorNode.h: * Modules/webaudio/GainNode.cpp: (WebCore::GainNode::GainNode): * Modules/webaudio/GainNode.h: * Modules/webaudio/MediaElementAudioSourceNode.cpp: (WebCore::MediaElementAudioSourceNode::create): (WebCore::MediaElementAudioSourceNode::MediaElementAudioSourceNode): (WebCore::MediaElementAudioSourceNode::setFormat): * Modules/webaudio/MediaElementAudioSourceNode.h: * Modules/webaudio/MediaStreamAudioDestinationNode.cpp: (WebCore::MediaStreamAudioDestinationNode::create): (WebCore::MediaStreamAudioDestinationNode::MediaStreamAudioDestinationNode): * Modules/webaudio/MediaStreamAudioDestinationNode.h: * Modules/webaudio/MediaStreamAudioSourceNode.cpp: (WebCore::MediaStreamAudioSourceNode::create): (WebCore::MediaStreamAudioSourceNode::MediaStreamAudioSourceNode): * Modules/webaudio/MediaStreamAudioSourceNode.h: * Modules/webaudio/OfflineAudioContext.idl: * Modules/webaudio/OfflineAudioDestinationNode.cpp: (WebCore::OfflineAudioDestinationNode::OfflineAudioDestinationNode): * Modules/webaudio/OfflineAudioDestinationNode.h: * Modules/webaudio/OscillatorNode.cpp: (WebCore::OscillatorNode::create): (WebCore::OscillatorNode::OscillatorNode): * Modules/webaudio/OscillatorNode.h: * Modules/webaudio/PannerNode.cpp: (WebCore::PannerNodeBase::PannerNodeBase): (WebCore::PannerNode::PannerNode): * Modules/webaudio/PannerNode.h: * Modules/webaudio/PannerNode.idl: * Modules/webaudio/PanningModelType.h: Copied from Source/WebCore/Modules/webaudio/OfflineAudioContext.idl. * Modules/webaudio/PanningModelType.idl: Copied from Source/WebCore/Modules/webaudio/OfflineAudioContext.idl. * Modules/webaudio/ScriptProcessorNode.cpp: (WebCore::ScriptProcessorNode::create): (WebCore::ScriptProcessorNode::ScriptProcessorNode): * Modules/webaudio/ScriptProcessorNode.h: * Modules/webaudio/WaveShaperNode.cpp: (WebCore::WaveShaperNode::WaveShaperNode): * Modules/webaudio/WaveShaperNode.h: * Modules/webaudio/WebKitAudioContext.cpp: Copied from Source/WebCore/Modules/webaudio/AudioContext.cpp. (WebCore::WebKitAudioContext::isSampleRateRangeGood): (WebCore::WebKitAudioContext::create): (WebCore::WebKitAudioContext::WebKitAudioContext): (WebCore::WebKitAudioContext::constructCommon): (WebCore::WebKitAudioContext::~WebKitAudioContext): (WebCore::WebKitAudioContext::lazyInitialize): (WebCore::WebKitAudioContext::clear): (WebCore::WebKitAudioContext::uninitialize): (WebCore::WebKitAudioContext::isInitialized const): (WebCore::WebKitAudioContext::addReaction): (WebCore::WebKitAudioContext::setState): (WebCore::WebKitAudioContext::stop): (WebCore::WebKitAudioContext::suspend): (WebCore::WebKitAudioContext::resume): (WebCore::WebKitAudioContext::activeDOMObjectName const): (WebCore::WebKitAudioContext::hostingDocumentIdentifier const): (WebCore::WebKitAudioContext::isSuspended const): (WebCore::WebKitAudioContext::visibilityStateChanged): (WebCore::WebKitAudioContext::wouldTaintOrigin const): (WebCore::WebKitAudioContext::createBuffer): (WebCore::WebKitAudioContext::decodeAudioData): (WebCore::WebKitAudioContext::createBufferSource): (WebCore::WebKitAudioContext::createMediaElementSource): (WebCore::WebKitAudioContext::createMediaStreamSource): (WebCore::WebKitAudioContext::createMediaStreamDestination): (WebCore::WebKitAudioContext::createScriptProcessor): (WebCore::WebKitAudioContext::createBiquadFilter): (WebCore::WebKitAudioContext::createWaveShaper): (WebCore::WebKitAudioContext::createPanner): (WebCore::WebKitAudioContext::createConvolver): (WebCore::WebKitAudioContext::createDynamicsCompressor): (WebCore::WebKitAudioContext::createAnalyser): (WebCore::WebKitAudioContext::createGain): (WebCore::WebKitAudioContext::createDelay): (WebCore::WebKitAudioContext::createChannelSplitter): (WebCore::WebKitAudioContext::createChannelMerger): (WebCore::WebKitAudioContext::createOscillator): (WebCore::WebKitAudioContext::createPeriodicWave): (WebCore::WebKitAudioContext::notifyNodeFinishedProcessing): (WebCore::WebKitAudioContext::derefFinishedSourceNodes): (WebCore::WebKitAudioContext::refNode): (WebCore::WebKitAudioContext::derefNode): (WebCore::WebKitAudioContext::derefUnfinishedSourceNodes): (WebCore::WebKitAudioContext::lock): (WebCore::WebKitAudioContext::tryLock): (WebCore::WebKitAudioContext::unlock): (WebCore::WebKitAudioContext::isAudioThread const): (WebCore::WebKitAudioContext::isGraphOwner const): (WebCore::WebKitAudioContext::addDeferredFinishDeref): (WebCore::WebKitAudioContext::handlePreRenderTasks): (WebCore::WebKitAudioContext::handlePostRenderTasks): (WebCore::WebKitAudioContext::handleDeferredFinishDerefs): (WebCore::WebKitAudioContext::markForDeletion): (WebCore::WebKitAudioContext::scheduleNodeDeletion): (WebCore::WebKitAudioContext::deleteMarkedNodes): (WebCore::WebKitAudioContext::markSummingJunctionDirty): (WebCore::WebKitAudioContext::removeMarkedSummingJunction): (WebCore::WebKitAudioContext::markAudioNodeOutputDirty): (WebCore::WebKitAudioContext::handleDirtyAudioSummingJunctions): (WebCore::WebKitAudioContext::handleDirtyAudioNodeOutputs): (WebCore::WebKitAudioContext::addAutomaticPullNode): (WebCore::WebKitAudioContext::removeAutomaticPullNode): (WebCore::WebKitAudioContext::updateAutomaticPullNodes): (WebCore::WebKitAudioContext::processAutomaticPullNodes): (WebCore::WebKitAudioContext::nodeWillBeginPlayback): (WebCore::shouldDocumentAllowWebAudioToAutoPlay): (WebCore::WebKitAudioContext::willBeginPlayback): (WebCore::WebKitAudioContext::willPausePlayback): (WebCore::WebKitAudioContext::startRendering): (WebCore::WebKitAudioContext::mediaCanStart): (WebCore::WebKitAudioContext::mediaState const): (WebCore::WebKitAudioContext::pageMutedStateDidChange): (WebCore::WebKitAudioContext::isPlayingAudioDidChange): (WebCore::WebKitAudioContext::finishedRendering): (WebCore::WebKitAudioContext::dispatchEvent): (WebCore::WebKitAudioContext::incrementActiveSourceCount): (WebCore::WebKitAudioContext::decrementActiveSourceCount): (WebCore::WebKitAudioContext::suspendRendering): (WebCore::WebKitAudioContext::resumeRendering): (WebCore::WebKitAudioContext::close): (WebCore::WebKitAudioContext::suspendPlayback): (WebCore::WebKitAudioContext::mayResumePlayback): (WebCore::WebKitAudioContext::postTask): (WebCore::WebKitAudioContext::origin const): (WebCore::WebKitAudioContext::addConsoleMessage): (WebCore::WebKitAudioContext::clearPendingActivity): (WebCore::WebKitAudioContext::makePendingActivity): (WebCore::WebKitAudioContext::logChannel const): * Modules/webaudio/WebKitAudioContext.h: Copied from Source/WebCore/Modules/webaudio/AudioContext.h. (WebCore::WebKitAudioContext::destination): (WebCore::WebKitAudioContext::activeSourceCount const): (WebCore::WebKitAudioContext::listener): (WebCore::WebKitAudioContext::isClosed const): (WebCore::WebKitAudioContext::connectionCount const): (WebCore::WebKitAudioContext::audioThread const): (WebCore::WebKitAudioContext::maxNumberOfChannels): (WebCore::WebKitAudioContext::userGestureRequiredForAudioStart const): (WebCore::WebKitAudioContext::pageConsentRequiredForAudioStart const): (WebCore::WebKitAudioContext::state const): (isType): * Modules/webaudio/WebKitAudioContext.idl: Copied from Source/WebCore/Modules/webaudio/AudioContext.idl. * Modules/webaudio/WebKitAudioPannerNode.cpp: Copied from Source/WebCore/Modules/webaudio/PannerNode.cpp. (WebCore::fixNANs): (WebCore::WebKitAudioPannerNode::WebKitAudioPannerNode): (WebCore::WebKitAudioPannerNode::~WebKitAudioPannerNode): (WebCore::WebKitAudioPannerNode::pullInputs): (WebCore::WebKitAudioPannerNode::process): (WebCore::WebKitAudioPannerNode::reset): (WebCore::WebKitAudioPannerNode::initialize): (WebCore::WebKitAudioPannerNode::uninitialize): (WebCore::WebKitAudioPannerNode::listener): (WebCore::WebKitAudioPannerNode::setPanningModel): (WebCore::WebKitAudioPannerNode::distanceModel const): (WebCore::WebKitAudioPannerNode::setDistanceModel): (WebCore::WebKitAudioPannerNode::getAzimuthElevation): (WebCore::WebKitAudioPannerNode::dopplerRate): (WebCore::WebKitAudioPannerNode::distanceConeGain): (WebCore::WebKitAudioPannerNode::notifyAudioSourcesConnectedToNode): * Modules/webaudio/WebKitAudioPannerNode.h: Copied from Source/WebCore/Modules/webaudio/PannerNode.h. * Modules/webaudio/WebKitAudioPannerNode.idl: Copied from Source/WebCore/Modules/webaudio/PannerNode.idl. * Modules/webaudio/WebKitOfflineAudioContext.cpp: Copied from Source/WebCore/Modules/webaudio/DelayNode.cpp. (WebCore::WebKitOfflineAudioContext::WebKitOfflineAudioContext): (WebCore::WebKitOfflineAudioContext::create): * Modules/webaudio/WebKitOfflineAudioContext.h: Copied from Source/WebCore/Modules/webaudio/DelayNode.h. * Modules/webaudio/WebKitOfflineAudioContext.idl: Copied from Source/WebCore/Modules/webaudio/OfflineAudioContext.idl. * Sources.txt: * WebCore.xcodeproj/project.pbxproj: * bindings/js/WebCoreBuiltinNames.h: * dom/EventTargetFactory.in: * page/Settings.yaml: * testing/Internals.cpp: (WebCore::Internals::setAudioContextRestrictions): * testing/Internals.h: * testing/Internals.idl: 2020-06-17 Wenson Hsieh <wenson_hsieh@apple.com> [macOS] Shift-tab in a bullet list in Mail Compose jumps back to Subject field https://bugs.webkit.org/show_bug.cgi?id=213320 <rdar://problem/63831962> Reviewed by Tim Horton. After the changes in r262051, pressing shift-tab in a bulleted list in Mail compose on macOS no longer triggers an outdent command. This is because the default behavior of the "keydown" event will now relinquish focus to the embedding client (i.e. the "chrome"). In this case, Mail makes the Subject field above the compose web view the first responder. This is necessary on iOS, where Mail does not attempt to intercept shift+tab and move focus to the subject line. However, Mail on macOS intercepts the keypress event, and either triggers outdent (if the selection is inside a list or blockquote) or focuses the Subject line. Since focus is relinquished during "keydown", this logic no longer runs, and hitting shift+tab in a list always relinquishes focus. To address this, refactor the changes made in r262051 so that we treat the default behavior of the "keypress" event (rather than "keydown") as relinquishing focus. See WebKit/ChangeLog for more details. Test: WebKit.ShiftTabDoesNotTakeFocusFromEditableWebViewWhenPreventingKeyPress * page/EventHandler.cpp: (WebCore::EventHandler::defaultTabEventHandler): Remove a call to relinquish focus when handling tab. * page/FocusController.h: 2020-06-16 Antoine Quint <graouts@webkit.org> quikr.com: unable to select item from dropdown https://bugs.webkit.org/show_bug.cgi?id=213260 <rdar://problem/58106011> Reviewed by Zalan Bujtas. Only account for box-shadow when computing the background rect if the clipping element itself has non-zero used width and height. Tests: fast/box-shadow/hit-test-box-shadow-and-margin-on-zero-height-clipping-container.html fast/box-shadow/hit-test-box-shadow-and-margin-on-zero-width-clipping-container.html fast/box-shadow/hit-test-box-shadow-on-zero-height-clipping-container.html fast/box-shadow/hit-test-box-shadow-on-zero-width-clipping-container.html * rendering/RenderBox.cpp: (WebCore::RenderBox::addVisualEffectOverflow): 2020-06-17 David Kilzer <ddkilzer@apple.com> Replace OptionSetTraits/OptionSetValues with EnumTraits/EnumValues <https://webkit.org/b/213264> Reviewed by Brent Fulgham. * page/DragActions.h: (EnumTraits<WebCore::DragDestinationAction>): - Rename from OptionSetTraits<WebCore::DragDestinationAction>. (OptionSetTraits<WebCore::DragOperation>): (OptionSetTraits<WebCore::DragSourceAction>): - Remove since EnumTraits<> already exist for both. 2020-06-17 Geoffrey Garen <ggaren@apple.com> media/remoteplayback-target-availability.html was a flaky failure after r262904 https://bugs.webkit.org/show_bug.cgi?id=213294 Reviewed by Sam Weinig. AirPlay availability is a global that depends on a timer (and/or an external piece of hardware). Therefore, the first value RemotePlayback sees for AirPlay availability, while usually 'unavailable', is sometimes 'available'. Flaky! In this case, media/remoteplayback-prompt.html triggered an AirPlay availability check, and then media/remoteplayback-target-availability.html, if run in the same process, sometimes saw 'available' as its initial availability state. Make RemotePlayback's initial availability state deterministic by recording availability state at the time we enqueue our task, rather than at the time we dequeue our task. (By specification and implementation, RemotePlayback's initial availability state is always 'unavailable', regardless of AirPlay state.) This is OK to do because, if the state ever changes after we enqueue our task, we'll get an update notification and enqueue a new task. * Modules/remoteplayback/RemotePlayback.cpp: (WebCore::RemotePlayback::watchAvailability): Copy the availability state when we enqueue our task, and do not update it when we dequeue our task. This is the heart of the bug fix. Make sure to manually update availability state when we first register to monitor availability, since we never got an update notification for the current state. (WebCore::RemotePlayback::prompt): For consistency with watchAvailability, do not update availability state when we dequeue our task. (This means that prompting before watching availability is always an error, which is fine, and consistent with the spec, which says, "If the user agent stops monitoring the list of available remote playback devices... It SHOULD also set the availability value for all media elements to false.") Make sure to manually update availability state when we first register to monitor availability, since we never got an update notification for the current state. (WebCore::RemotePlayback::availabilityChanged): For consistency with watchAvailability, do not update availability state when we dequeue our task. (WebCore::RemotePlayback::updateAvailability): Deleted. We never synchronously update our state anymore. All state changes are queued and processed in order. * Modules/remoteplayback/RemotePlayback.h: 2020-06-17 Rob Buis <rbuis@igalia.com> Image `referrerpolicy` mutations should be considered "relevant mutations" https://bugs.webkit.org/show_bug.cgi?id=209970 Reviewed by Youenn Fablet. Make referrerpolicy state changes a relevant mutation [1]. In order to indicate that we are dealing with a relevant mutation add an enum to updateFromElement, in order to run "update the image data" algorithm [2] in case it is a relevant mutation. Tests: imported/w3c/web-platform-tests/html/semantics/embedded-content/the-img-element/relevant-mutations.html imported/w3c/web-platform-tests/html/semantics/embedded-content/the-img-element/image-loading-lazy-referrerpolicy-change.sub.html [1] https://html.spec.whatwg.org/#reacting-to-dom-mutations:attr-img-referrerpolicy [2] https://html.spec.whatwg.org/#when-to-obtain-images * html/HTMLImageElement.cpp: (WebCore::HTMLImageElement::attributeChanged): * html/HTMLImageElement.h: * loader/ImageLoader.cpp: (WebCore::ImageLoader::updateFromElement): (WebCore::ImageLoader::updateFromElementIgnoringPreviousError): (WebCore::ImageLoader::loadDeferredImage): * loader/ImageLoader.h: 2020-06-17 Chris Dumez <cdumez@apple.com> Unreviewed attempt to fix internal macOS build after r263157. * rendering/RenderThemeMac.mm: 2020-06-17 Sam Weinig <weinig@apple.com> Use constructor operations in WebIDL https://bugs.webkit.org/show_bug.cgi?id=201397 Reviewed by Eric Carlson. Add support for constructor syntax in WebIDL (https://heycam.github.io/webidl/#idl-constructors) - [Constructor(...)] extended attributes become constructor(...) operations - [JSBuiltinConstructor] becomes [JSBuiltin] constructor(...) - [CustomConstructor] becomes [Custom] constructor(...) - [ConstructorMayThrowException] becomes [MayThrowException] constructor(...) and can now be unique per-overload - [ConstructorCallWith=Foo] becomes [CallWith=Foo] constructor(...) and can now also be unique per-overload This change leaves NamedConstructor as is, but a subsequent change will replace it with the specified LegacyFactoryFunction extended attribute. * Modules/airplay/WebKitPlaybackTargetAvailabilityEvent.idl: * Modules/applepay/ApplePayError.idl: * Modules/applepay/ApplePaySession.idl: * Modules/applepay/ApplePaySetup.idl: * Modules/async-clipboard/ClipboardItem.idl: * Modules/encryptedmedia/MediaKeyMessageEvent.idl: * Modules/encryptedmedia/legacy/WebKitMediaKeyMessageEvent.idl: * Modules/encryptedmedia/legacy/WebKitMediaKeyNeededEvent.idl: * Modules/encryptedmedia/legacy/WebKitMediaKeys.idl: * Modules/fetch/FetchHeaders.idl: * Modules/fetch/FetchRequest.idl: * Modules/fetch/FetchResponse.idl: * Modules/gamepad/GamepadEvent.idl: * Modules/highlight/HighlightMap.idl: * Modules/highlight/HighlightRangeGroup.idl: * Modules/indexeddb/IDBVersionChangeEvent.idl: * Modules/mediarecorder/BlobEvent.idl: * Modules/mediarecorder/MediaRecorder.idl: * Modules/mediarecorder/MediaRecorderErrorEvent.idl: * Modules/mediasession/MediaRemoteControls.idl: * Modules/mediasession/MediaSession.idl: * Modules/mediasource/MediaSource.idl: * Modules/mediastream/MediaStream.idl: * Modules/mediastream/MediaStreamTrackEvent.idl: * Modules/mediastream/OverconstrainedError.idl: * Modules/mediastream/OverconstrainedErrorEvent.idl: * Modules/mediastream/RTCDTMFToneChangeEvent.idl: * Modules/mediastream/RTCDataChannelEvent.idl: * Modules/mediastream/RTCIceCandidate.idl: * Modules/mediastream/RTCPeerConnection.idl: * Modules/mediastream/RTCPeerConnectionIceEvent.idl: * Modules/mediastream/RTCSessionDescription.idl: * Modules/mediastream/RTCTrackEvent.idl: * Modules/notifications/Notification.idl: * Modules/paymentrequest/MerchantValidationEvent.idl: * Modules/paymentrequest/PaymentMethodChangeEvent.idl: * Modules/paymentrequest/PaymentRequest.idl: * Modules/paymentrequest/PaymentRequestUpdateEvent.idl: * Modules/pictureinpicture/EnterPictureInPictureEvent.idl: * Modules/speech/SpeechSynthesisUtterance.idl: * Modules/streams/ByteLengthQueuingStrategy.idl: * Modules/streams/CountQueuingStrategy.idl: * Modules/streams/ReadableByteStreamController.idl: * Modules/streams/ReadableStream.idl: * Modules/streams/ReadableStreamBYOBReader.idl: * Modules/streams/ReadableStreamBYOBRequest.idl: * Modules/streams/ReadableStreamDefaultController.idl: * Modules/streams/ReadableStreamDefaultReader.idl: * Modules/streams/WritableStream.idl: * Modules/webaudio/AudioContext.idl: * Modules/webaudio/OfflineAudioContext.idl: * Modules/webgpu/GPUOutOfMemoryError.idl: * Modules/webgpu/GPUUncapturedErrorEvent.idl: * Modules/webgpu/GPUValidationError.idl: * Modules/websockets/CloseEvent.idl: * Modules/websockets/WebSocket.idl: * Modules/webxr/WebXRRigidTransform.idl: * Modules/webxr/WebXRWebGLLayer.idl: * Modules/webxr/XRInputSourceEvent.idl: * Modules/webxr/XRInputSourcesChangeEvent.idl: * Modules/webxr/XRReferenceSpaceEvent.idl: * Modules/webxr/XRSessionEvent.idl: * animation/AnimationPlaybackEvent.idl: * animation/DocumentTimeline.idl: * animation/KeyframeEffect.idl: * animation/WebAnimation.idl: * bindings/scripts/CodeGeneratorJS.pm: (ShouldGenerateToJSDeclaration): (GetFullyQualifiedImplementationCallName): (GenerateParametersCheck): (GetConstructorTemplateClassName): (GenerateConstructorDefinition): (GenerateConstructorHelperMethods): (HasCustomConstructor): (IsConstructable): (HasJSBuiltinConstructor): (AddJSBuiltinIncludesIfNeeded): (IsJSBuiltinConstructor): Deleted. * bindings/scripts/IDLAttributes.json: * bindings/scripts/IDLParser.pm: (assertExtendedAttributesValidForContext): (copyExtendedAttributes): (cloneOperation): (applyTypedefs): (parseInterfaceMember): (parseConstructor): (parseExtendedAttributeRest): (applyMemberList): (applyExtendedAttributeList): * bindings/scripts/test/JS/JSTestInterface.cpp: * bindings/scripts/test/JS/JSTestNamedConstructor.cpp: (WebCore::JSTestNamedConstructorConstructor::initializeProperties): (WebCore::JSTestNamedConstructorNamedConstructor::construct): (WebCore::JSTestNamedConstructorNamedConstructor::initializeProperties): * bindings/scripts/test/TestClassWithJSBuiltinConstructor.idl: * bindings/scripts/test/TestEventConstructor.idl: * bindings/scripts/test/TestInterface.idl: * bindings/scripts/test/TestJSBuiltinConstructor.idl: * bindings/scripts/test/TestNamedConstructor.idl: * bindings/scripts/test/TestNode.idl: * bindings/scripts/test/TestObj.idl: * bindings/scripts/test/TestOverloadedConstructors.idl: * bindings/scripts/test/TestOverloadedConstructorsWithSequence.idl: * bindings/scripts/test/TestPromiseRejectionEvent.idl: * bindings/scripts/test/TestTypedefs.idl: * css/DOMMatrix.idl: * css/DOMMatrixReadOnly.idl: * css/FontFace.idl: * css/FontFaceSet.idl: * css/MediaQueryListEvent.idl: * css/WebKitCSSMatrix.idl: * css/typedom/TypedOMCSSUnitValue.idl: * css/typedom/TypedOMCSSUnparsedValue.idl: * dom/AbortController.idl: * dom/AnimationEvent.idl: * dom/BeforeLoadEvent.idl: * dom/ClipboardEvent.idl: * dom/Comment.idl: * dom/CompositionEvent.idl: * dom/CustomEvent.idl: * dom/DOMException.idl: * dom/DOMPoint.idl: * dom/DOMPointReadOnly.idl: * dom/DOMQuad.idl: * dom/DOMRect.idl: * dom/DOMRectReadOnly.idl: * dom/Document.idl: * dom/DocumentFragment.idl: * dom/DragEvent.idl: * dom/ErrorEvent.idl: * dom/Event.idl: * dom/EventTarget.idl: * dom/FocusEvent.idl: * dom/HashChangeEvent.idl: * dom/InputEvent.idl: * dom/KeyboardEvent.idl: * dom/MessageChannel.idl: * dom/MessageEvent.idl: * dom/MouseEvent.idl: * dom/MutationObserver.idl: * dom/OverflowEvent.idl: * dom/PageTransitionEvent.idl: * dom/PointerEvent.idl: * dom/PopStateEvent.idl: * dom/ProgressEvent.idl: * dom/PromiseRejectionEvent.idl: * dom/Range.idl: * dom/SecurityPolicyViolationEvent.idl: * dom/StaticRange.idl: * dom/Text.idl: * dom/TextDecoder.idl: * dom/TextEncoder.idl: * dom/TransitionEvent.idl: * dom/UIEvent.idl: * dom/WebKitAnimationEvent.idl: * dom/WebKitTransitionEvent.idl: * dom/WheelEvent.idl: * fileapi/Blob.idl: * fileapi/File.idl: * fileapi/FileReader.idl: * fileapi/FileReaderSync.idl: * html/DOMFormData.idl: * html/DOMURL.idl: * html/HTMLElement.idl: * html/HTMLOptionElement.idl: * html/ImageData.idl: * html/MediaController.idl: * html/MediaEncryptedEvent.idl: * html/OffscreenCanvas.idl: * html/URLSearchParams.idl: * html/canvas/Path2D.idl: * html/canvas/WebGLContextEvent.idl: * html/track/DataCue.idl: * html/track/TextTrackCue.idl: * html/track/TrackEvent.idl: * html/track/VTTCue.idl: * html/track/VTTRegion.idl: * page/EventSource.idl: * page/IntersectionObserver.idl: * page/IntersectionObserverEntry.idl: * page/PerformanceObserver.idl: * page/ResizeObserver.idl: * page/UndoItem.idl: * page/WebKitPoint.idl: * storage/StorageEvent.idl: * workers/Worker.idl: * workers/service/ExtendableEvent.idl: * workers/service/ExtendableMessageEvent.idl: * workers/service/FetchEvent.idl: * xml/DOMParser.idl: * xml/XMLHttpRequest.idl: * xml/XMLSerializer.idl: * xml/XPathEvaluator.idl: * xml/XSLTProcessor.idl: 2020-06-17 Darryl Pogue <darryl@dpogue.ca> IndexedDB: Support IDBFactory databases method https://bugs.webkit.org/show_bug.cgi?id=211043 Reviewed by Youenn Fablet. Add support for fetching the list of IDB database names and versions from the IDBServer, and expose the functionality as `IDBFactory.prototype.databases()`. Spec: https://w3c.github.io/IndexedDB/#dom-idbfactory-databases * Headers.cmake: * Modules/indexeddb/IDBActiveDOMObject.h: (WebCore::IDBActiveDOMObject::performCallbackOnOriginThread): * Modules/indexeddb/IDBDatabaseNameAndVersionRequest.cpp: Added. (WebCore::IDBDatabaseNameAndVersionRequest::create): (WebCore::IDBDatabaseNameAndVersionRequest::IDBDatabaseNameAndVersionRequest): (WebCore::IDBDatabaseNameAndVersionRequest::~IDBDatabaseNameAndVersionRequest): (WebCore::IDBDatabaseNameAndVersionRequest::complete): (WebCore::IDBDatabaseNameAndVersionRequest::activeDOMObjectName const): (WebCore::IDBDatabaseNameAndVersionRequest::virtualHasPendingActivity const): (WebCore::IDBDatabaseNameAndVersionRequest::stop): * Modules/indexeddb/IDBDatabaseNameAndVersionRequest.h: Added. * Modules/indexeddb/IDBFactory.cpp: (WebCore::IDBFactory::databases): (WebCore::IDBFactory::getAllDatabaseNames): * Modules/indexeddb/IDBFactory.h: * Modules/indexeddb/IDBFactory.idl: * Modules/indexeddb/client/IDBConnectionProxy.cpp: (WebCore::IDBClient::IDBConnectionProxy::connectionToServerLost): (WebCore::IDBClient::IDBConnectionProxy::getAllDatabaseNamesAndVersions): (WebCore::IDBClient::IDBConnectionProxy::didGetAllDatabaseNamesAndVersions): (WebCore::IDBClient::IDBConnectionProxy::forgetActivityForCurrentThread): (WebCore::IDBClient::IDBConnectionProxy::getAllDatabaseNames): Deleted. * Modules/indexeddb/client/IDBConnectionProxy.h: * Modules/indexeddb/client/IDBConnectionToServer.cpp: (WebCore::IDBClient::IDBConnectionToServer::getAllDatabaseNamesAndVersions): (WebCore::IDBClient::IDBConnectionToServer::didGetAllDatabaseNamesAndVersions): (WebCore::IDBClient::IDBConnectionToServer::getAllDatabaseNames): Deleted. (WebCore::IDBClient::IDBConnectionToServer::didGetAllDatabaseNames): Deleted. * Modules/indexeddb/client/IDBConnectionToServer.h: * Modules/indexeddb/client/IDBConnectionToServerDelegate.h: * Modules/indexeddb/server/IDBConnectionToClient.cpp: (WebCore::IDBServer::IDBConnectionToClient::didGetAllDatabaseNamesAndVersions): (WebCore::IDBServer::IDBConnectionToClient::didGetAllDatabaseNames): Deleted. * Modules/indexeddb/server/IDBConnectionToClient.h: * Modules/indexeddb/server/IDBConnectionToClientDelegate.h: * Modules/indexeddb/server/IDBServer.cpp: (WebCore::IDBServer::IDBServer::getAllDatabaseNamesAndVersions): (WebCore::IDBServer::IDBServer::getAllDatabaseNames): Deleted. * Modules/indexeddb/server/IDBServer.h: * Modules/indexeddb/server/SQLiteIDBBackingStore.cpp: (WebCore::IDBServer::SQLiteIDBBackingStore::databaseNameAndVersionFromFile): (WebCore::IDBServer::SQLiteIDBBackingStore::databaseNameFromFile): Deleted. * Modules/indexeddb/server/SQLiteIDBBackingStore.h: * Modules/indexeddb/shared/IDBDatabaseNameAndVersion.h: Added. (WebCore::IDBDatabaseNameAndVersion::encode const): (WebCore::IDBDatabaseNameAndVersion::decode): (WebCore::IDBDatabaseNameAndVersion::isolatedCopy const): * Sources.txt: * WebCore.xcodeproj/project.pbxproj: * inspector/agents/InspectorIndexedDBAgent.cpp: (WebCore::InspectorIndexedDBAgent::requestDatabaseNames): * loader/EmptyClients.cpp: 2020-06-17 Sam Weinig <weinig@apple.com> [WPT] infrastructure/assumptions/html-elements.html fails due to changes in style when all: initial is used https://bugs.webkit.org/show_bug.cgi?id=213171 Reviewed by Antti Koivisto. Update existing test results that now pass. * css/CSSProperties.json: Use initialStrokeColor (the default) rather than hardcoding the incorrect currentColor. The spec (and initialStrokeColor) say this should be transparent. * style/StyleBuilderCustom.h: (WebCore::Style::ApplyPropertyBorderImageModifier::applyInitialValue): Match the mask image NinePieceImage constructor, and set fill to true for mask image slices. 2020-06-17 Zalan Bujtas <zalan@apple.com> [LFC][Float] Move float avoiders' final position compute next to when the static position is computed https://bugs.webkit.org/show_bug.cgi?id=213250 Reviewed by Antti Koivisto. Now that the float avoider's final position has no dependecy on the computed height, we can move it all the way up, next to where we computed the static position. * layout/blockformatting/BlockFormattingContext.cpp: (WebCore::Layout::BlockFormattingContext::layoutInFlowContent): (WebCore::Layout::BlockFormattingContext::computePositionToAvoidFloats): (WebCore::Layout::BlockFormattingContext::computeHeightAndMargin): (WebCore::Layout::BlockFormattingContext::precomputeVerticalPositionForAncestors): Deleted. * layout/blockformatting/BlockFormattingContext.h: 2020-06-17 Antoine Quint <graouts@webkit.org> [Modern Media Controls] CSS "cursor" property shoud be respected in media controls shadow root https://bugs.webkit.org/show_bug.cgi?id=213295 <rdar://problem/61911638> Reviewed by Timothy Hatcher. Allow the "cursor" property to be inherited in the media controls shadow root, but still overriden for interactive objects in the media controls as well as placard text. Test: media/modern-media-controls/css/cursor.html * Modules/modern-media-controls/controls/controls-bar.css: (.controls-bar): * Modules/modern-media-controls/controls/media-controls.css: (.media-controls-container): (.media-controls): * Modules/modern-media-controls/controls/placard.css: (.placard .title,): 2020-06-08 Andy Estes <aestes@apple.com> [Apple Pay] Enable layout tests on more platforms https://bugs.webkit.org/show_bug.cgi?id=212955 <rdar://problem/64174156> Reviewed by Alex Christensen. Added runtime checks to determine the Apple Pay API version when installments are enabled. Enabled tests in http/tests/ssl/applepay on iOS. * Modules/applepay/ApplePayInstallmentConfiguration.idl: * Modules/applepay/ApplePayInstallmentConfigurationWebCore.h: * Modules/applepay/ApplePayInstallmentItem.h: * Modules/applepay/ApplePayInstallmentItem.idl: * Modules/applepay/ApplePayInstallmentItemType.h: * Modules/applepay/ApplePayInstallmentItemType.idl: * Modules/applepay/ApplePayInstallmentRetailChannel.h: * Modules/applepay/ApplePayInstallmentRetailChannel.idl: Removed uses of APPLE_PAY_INSTALLMENT_IDENTIFIERS and APPLE_PAY_INSTALLMENT_ITEMS (or replaced with APPLE_PAY_INSTALLMENTS). * Modules/applepay/PaymentAPIVersion.h: * Modules/applepay/cocoa/PaymentAPIVersionCocoa.mm: (WebCore::PaymentAPIVersion::current): Moved the computation of current API version from PaymentCoordinatorClient::supportsVersion to here. Added runtime checks to determine the level of PassKit installments support since we don't have enough information to tell at compile time. * Modules/applepay/PaymentCoordinatorClient.cpp: (WebCore::PaymentCoordinatorClient::supportsVersion): Changed to call PaymentAPIVersion::current. * Modules/applepay/PaymentInstallmentConfiguration.mm: (WebCore::makeNSArrayElement): (WebCore::createPlatformConfiguration): (WebCore::PaymentInstallmentConfiguration::create): (WebCore::PaymentInstallmentConfiguration::applePayInstallmentConfiguration const): Removed uses of HAVE_PASSKIT_INSTALLMENT_ITEMS and HAVE_PASSKIT_INSTALLMENT_IDENTIFIERS. Used runtime checks to determine support for PKPaymentInstallmentConfiguration and PKPaymentInstallmentItem. * SourcesCocoa.txt: * WebCore.xcodeproj/project.pbxproj: Added source files for PaymentAPIVersion. 2020-06-17 Zalan Bujtas <zalan@apple.com> [LFC][Floats] Remove redundant mapping functions https://bugs.webkit.org/show_bug.cgi?id=213249 Reviewed by Antti Koivisto. It's incorrect to map the entire display box when the height is no even computed yet. * layout/floats/FloatingContext.cpp: (WebCore::Layout::FloatingContext::positionForFloat const): (WebCore::Layout::FloatingContext::positionForNonFloatingFloatAvoider const): (WebCore::Layout::FloatingContext::verticalPositionWithClearance const): (WebCore::Layout::FloatingContext::append): (WebCore::Layout::FloatingContext::absoluteDisplayBoxCoordinates const): (WebCore::Layout::FloatingContext::mapTopLeftToFloatingStateRoot const): (WebCore::Layout::FloatingContext::mapToFloatingStateRoot const): Deleted. (WebCore::Layout::FloatingContext::mapTopToFloatingStateRoot const): Deleted. * layout/floats/FloatingContext.h: 2020-06-17 Zalan Bujtas <zalan@apple.com> [LFC]Floats] Cleanup FloatAvoider interface https://bugs.webkit.org/show_bug.cgi?id=213195 Reviewed by Antti Koivisto. Remove redundant functions/parameters. * layout/blockformatting/BlockFormattingContext.cpp: (WebCore::Layout::BlockFormattingContext::computePositionToAvoidFloats): * layout/floats/FloatAvoider.cpp: (WebCore::Layout::FloatAvoider::FloatAvoider): (WebCore::Layout::FloatAvoider::topLeftInContainingBlock const): Deleted. * layout/floats/FloatAvoider.h: * layout/floats/FloatingContext.cpp: (WebCore::Layout::findAvailablePosition): (WebCore::Layout::FloatingContext::positionForFloat const): (WebCore::Layout::FloatingContext::positionForNonFloatingFloatAvoider const): (WebCore::Layout::FloatingContext::positionForFormattingContextRoot const): Deleted. (WebCore::Layout::FloatingContext::findPositionForFloatBox const): Deleted. * layout/floats/FloatingContext.h: 2020-06-17 Zalan Bujtas <zalan@apple.com> [LFC][Floats] Remove FloatBox class https://bugs.webkit.org/show_bug.cgi?id=213184 Reviewed by Antti Koivisto. Apparently the only difference between a non-floating float avoider (regular formatting context root) and a float box is that while float boxes intersect their margin box, simple float avoiders use their border box. We can do that without subclassing FloatAvoider. This patch is also in preparation for moving "computeFloatPosition" next to the static position computation when the height value is not computed yet. So instead of passing in the display box, let's just pass in top/left and width. * Sources.txt: * WebCore.xcodeproj/project.pbxproj: * layout/floats/FloatAvoider.cpp: (WebCore::Layout::FloatAvoider::FloatAvoider): (WebCore::Layout::FloatAvoider::setHorizontalPosition): (WebCore::Layout::FloatAvoider::setVerticalPosition): (WebCore::Layout::FloatAvoider::initialHorizontalPosition const): (WebCore::Layout::FloatAvoider::overflowsContainingBlock const): (WebCore::Layout::FloatAvoider::topLeftInContainingBlock const): (WebCore::Layout::FloatAvoider::setHorizontalConstraints): Deleted. (WebCore::Layout::FloatAvoider::setVerticalConstraint): Deleted. (WebCore::Layout::FloatAvoider::horizontalPositionCandidate): Deleted. (WebCore::Layout::FloatAvoider::verticalPositionCandidate): Deleted. (WebCore::Layout::FloatAvoider::rectInContainingBlock const): Deleted. * layout/floats/FloatAvoider.h: (WebCore::Layout::FloatAvoider::resetHorizontalPosition): (WebCore::Layout::FloatAvoider::isLeftAligned const): (WebCore::Layout::FloatAvoider::borderBoxWidth const): (WebCore::Layout::FloatAvoider::marginBefore const): (WebCore::Layout::FloatAvoider::marginAfter const): (WebCore::Layout::FloatAvoider::marginStart const): (WebCore::Layout::FloatAvoider::marginEnd const): (WebCore::Layout::FloatAvoider::marginBoxWidth const): (WebCore::Layout::FloatAvoider::isFloatingBox const): (WebCore::Layout::FloatAvoider::layoutBox const): (WebCore::Layout::FloatAvoider::top const): (WebCore::Layout::FloatAvoider::left const): (WebCore::Layout::FloatAvoider::right const): (WebCore::Layout::FloatAvoider::rect const): Deleted. (WebCore::Layout::FloatAvoider::displayBox const): Deleted. (WebCore::Layout::FloatAvoider::displayBox): Deleted. * layout/floats/FloatBox.cpp: Removed. * layout/floats/FloatBox.h: Removed. * layout/floats/FloatingContext.cpp: (WebCore::Layout::FloatingContext::positionForFloat const): (WebCore::Layout::FloatingContext::positionForFormattingContextRoot const): (WebCore::Layout::findAvailablePosition): (WebCore::Layout::FloatingContext::findPositionForFloatBox const): (WebCore::Layout::FloatingContext::findPositionForFormattingContextRoot const): (WebCore::Layout::FloatPair::intersects const): (WebCore::Layout::FloatPair::horizontalConstraints const): * layout/floats/FloatingContext.h: 2020-06-17 Youenn Fablet <youenn@apple.com> Make ReadableStream robust against user code https://bugs.webkit.org/show_bug.cgi?id=212915 <rdar://problem/64133221> Reviewed by Darin Adler. Create tee source with private slots instead of public ones. When source has one of this private slot, we directly go to the creation of a ReadableStream. Covered by existing tests. * Modules/streams/ReadableStream.js: (initializeReadableStream): * Modules/streams/ReadableStreamInternals.js: (setupReadableStreamDefaultController): (readableStreamTee): (readableStreamDefaultControllerCallPullIfNeeded): (readableStreamDefaultControllerCancel): * Modules/streams/StreamInternals.js: (promiseInvokeOrNoopMethodNoCatch): (promiseInvokeOrNoopNoCatch): (promiseInvokeOrNoopMethod): (promiseInvokeOrNoop): * bindings/js/WebCoreBuiltinNames.h: 2020-06-17 Antti Koivisto <antti@apple.com> Fix spelling of evaluteDynamicMediaQueryRules https://bugs.webkit.org/show_bug.cgi?id=213287 Unreviewed. * style/RuleSet.cpp: (WebCore::Style::RuleSet::addRulesFromSheet): (WebCore::Style::RuleSet::evaluateDynamicMediaQueryRules): (WebCore::Style::RuleSet::evaluteDynamicMediaQueryRules): Deleted. * style/RuleSet.h: * style/StyleResolver.cpp: (WebCore::Style::Resolver::evaluateDynamicMediaQueries): * style/StyleScopeRuleSets.cpp: (WebCore::Style::ScopeRuleSets::evaluateDynamicMediaQueryRules): (WebCore::Style::ScopeRuleSets::evaluteDynamicMediaQueryRules): Deleted. * style/StyleScopeRuleSets.h: 2020-06-17 Diego Pino Garcia <dpino@igalia.com> REGRESSION(r262994): [GTK] More than 100 tests are failing https://bugs.webkit.org/show_bug.cgi?id=213173 Unreviewed gardening. Add default initialization for WebCore::PluginInfo::clientLoadPolicy and WebCore::PluginInfo::isApplicationPlugin. * plugins/PluginData.h: 2020-06-16 Simon Fraser <simon.fraser@apple.com> REGRESSION (r255037): Broken position while comparing watch bands on www.apple.com/shop/studio/apple-watch https://bugs.webkit.org/show_bug.cgi?id=213282 Reviewed by Antti Koivisto. Test: fast/scrolling/ios/user-then-programmatic-scroll.html * page/scrolling/ScrollingTree.cpp: (WebCore::ScrollingTree::applyLayerPositionsAfterCommit): * page/scrolling/ScrollingTree.h: (WebCore::ScrollingTree::setNeedsApplyLayerPositionsAfterCommit): (WebCore::ScrollingTree::didScrollByDelegatedScrolling): Deleted. * page/scrolling/ScrollingTreeScrollingNode.cpp: (WebCore::ScrollingTreeScrollingNode::wasScrolledByDelegatedScrolling): 2020-06-16 Zalan Bujtas <zalan@apple.com> [Subpixel] Replaced content bleeds over content box when border radius is set https://bugs.webkit.org/show_bug.cgi?id=213275 <rdar://problem/64320995> Reviewed by Simon Fraser. Snap the border to device pixels on the replaced box when border radius is set. * rendering/RenderReplaced.cpp: (WebCore::RenderReplaced::paint): 2020-06-16 Wenson Hsieh <wenson_hsieh@apple.com> Text manipulation should not re-extract elements whose children have been manipulated https://bugs.webkit.org/show_bug.cgi?id=213276 <rdar://problem/64193446> Reviewed by Tim Horton. After an element has undergone text manipulation, we have a mechanism for not extracting that element again, if the element is later hidden and shown, or relocated in the DOM. This works by adding the inserted text manipulation node to a weak element map (`m_manipulatedElements`) if the inserted node is an element. However, this mechanism is bypassed in the case where text nodes are inserted, since these child nodes are not elements. This means that if the element containing this manipulated text is hidden and later shown, we'll attempt to re- extract its contents, which is problematic for text manipulation clients. To mitigate this, when inserting content during text manipulation, if a new parent of the inserted content contains _only_ manipulated child nodes, then avoid trying to manipulate it in the future by adding it to `m_manipulatedElements`. Test: TextManipulation.CompleteTextManipulationAvoidExtractingManipulatedTextAfterManipulation * editing/TextManipulationController.cpp: (WebCore::TextManipulationController::updateInsertions): Drive-by style fix: add a space after the assignment operator. (WebCore::TextManipulationController::replace): If the parent node that we're inserting a text manipulation node underneath has only 1 child (i.e. the node that we've just inserted), then flag it as having only manipulated children. This parent may be un-flagged later when applying `NodeInsertion`s, if the `NodeInsertion`'s child has not been manipulated. 2020-06-16 Andy Estes <aestes@apple.com> FileListCreator should only be used for resolving directories https://bugs.webkit.org/show_bug.cgi?id=213259 <rdar://problem/64375709> Reviewed by David Kilzer. Depending on whether directories should be resolved, FileListCreator::create would either synchronously execute its completion handler then return nullptr or asynchronously dispatch its completion handler then return a non-null RefPtr. Interfaces with sometimes-synchronous callbacks can be hard to use correctly; e.g., r262962 fixes a problem where FileInputType::m_fileListCreator was being modified in an unexpected order. This patch makes the interface between FileInputType and FileListCreator less error-prone and more explicit by renaming FileListCreator to DirectoryFileListCreator, making its job solely to create directory FileLists on a background queue, and giving it an explicit start member function. For non-directories, FileInputType::filesChosen now bypasses DirectoryFileListCreator and directly converts from Vector<FileChooserFileInfo> to FileList. Covered by existing tests. * Sources.txt: * WebCore.xcodeproj/project.pbxproj: * html/DirectoryFileListCreator.cpp: Renamed from html/FileListCreator.cpp. (WebCore::createFileList): Removed the template and ShouldResolveDirectories parameter. (WebCore::DirectoryFileListCreator::DirectoryFileListCreator): Moved the work queue dispatching to DirectoryFileListCreator::start. (WebCore::DirectoryFileListCreator::start): Added; moved the work queue dispatching here from the ctor. * html/DirectoryFileListCreator.h: Renamed from html/FileListCreator.h. (WebCore::DirectoryFileListCreator::create): Stopped performing non-directory creation and changed the return value back to Ref<>. * html/FileInputType.cpp: (WebCore::FileInputType::filesChosen): Moved most of the work done in the FileListCreator completion handler to didCreateFileList. When !FileInputType::allowsDirectories, used Vector::map to convert paths to a Vector<Ref<File>>, used that to create a FileList, then called didCreateFileList. Otherwise, created and started a DirectoryFileListCreator that calls didCreateFileList in its completion handler. (WebCore::FileInputType::didCreateFileList): Added; sets the new file list and icon and clears m_directoryFileListCreator. * html/FileInputType.h: 2020-06-16 Dean Jackson <dino@apple.com> REGRESSION (r262643): DumpRenderTree at com.apple.WebCore: WebCore::Document::prepareCanvasesForDisplayIfNeeded https://bugs.webkit.org/show_bug.cgi?id=213221 rdar://64260400 Reviewed by Simon Fraser. A Document could still be holding a pointer to an HTMLCanvasElement after the canvas had been deleted because the CanvasObserver protocol was disconnected too early. The fix is to explicitly clear the canvas from the Document as it stops observing. Test: webgl/preparation-removed-from-document.html * dom/Document.cpp: (WebCore::Document::prepareCanvasesForDisplayIfNeeded): Copy the HashSet to a Vector just in case something weird happens to the set during iteration. (WebCore::Document::clearCanvasPreparation): Remove the canvas from the list of of elements that need preparation. * dom/Document.h: Add the new clearCanvasPreparation method. * html/HTMLCanvasElement.cpp: (WebCore::HTMLCanvasElement::~HTMLCanvasElement): Clear the document. (WebCore::HTMLCanvasElement::didMoveToNewDocument): Ditto. (WebCore::HTMLCanvasElement::removedFromAncestor): Ditto. 2020-06-16 Dean Jackson <dino@apple.com> [WebGL] Lose the context if IOSurface allocation fails https://bugs.webkit.org/show_bug.cgi?id=213265 <rdar://problem/64424742> Reviewed by Simon Fraser. If we are unable to allocate the backing store for the WebGL content, we should immediately lose the context. * platform/graphics/angle/GraphicsContextGLANGLE.cpp: (WebCore::GraphicsContextGLOpenGL::reshapeFBOs): Lose the context if the call to allocateIOSurfaceBackingStore didn't work. * platform/graphics/cocoa/GraphicsContextGLOpenGLCocoa.mm: (WebCore::GraphicsContextGLOpenGL::allocateIOSurfaceBackingStore): * platform/graphics/cocoa/WebGLLayer.h: * platform/graphics/cocoa/WebGLLayer.mm: (-[WebGLLayer allocateIOSurfaceBackingStoreWithSize:usingAlpha:]): Return a boolean so that we can detect if the allocation failed. * platform/graphics/opengl/GraphicsContextGLOpenGL.h: * platform/graphics/opengl/GraphicsContextGLOpenGLBase.cpp: (WebCore::GraphicsContextGLOpenGL::reshapeFBOs): 2020-06-16 Eric Carlson <eric.carlson@apple.com> Don't claim to support fullscreen mode unless fullScreenEnabled setting is enabled https://bugs.webkit.org/show_bug.cgi?id=213142 <rdar://63753327> Reviewed by Jer Noble. Test: media/video-supports-fullscreen.html * html/HTMLVideoElement.cpp: (WebCore::HTMLVideoElement::supportsFullscreen const): Check settings.fullScreenEnabled. 2020-06-16 Andres Gonzalez <andresg_22@apple.com> Fix for accessibility/textarea-selected-text-range.html in isolated tree mode. https://bugs.webkit.org/show_bug.cgi?id=213257 Reviewed by Chris Fleizach. accessibility/textarea-selected-text-range.html. Implementation of AXIsolatedObject::selectedTextRange. * accessibility/isolatedtree/AXIsolatedObject.cpp: (WebCore::AXIsolatedObject::selectedTextRange const): * accessibility/isolatedtree/AXIsolatedObject.h: 2020-06-16 Pavel Feldman <pavel.feldman@gmail.com> Web Inspector: replace completion handler with a function in interception. https://bugs.webkit.org/show_bug.cgi?id=213252 Reviewed by Devin Rousso. Don't use a `CompletionHandler` as it asserts that it's been called when it's destroyed. Both `Network.interceptRequestWithResponse` and `Network.interceptRequestWithError` essentially "skip" the network pipeline, so the `CompletionHandler` is not invoked for those commands. * inspector/InspectorInstrumentation.cpp: (WebCore::InspectorInstrumentation::interceptRequestImpl): * inspector/InspectorInstrumentation.h: (WebCore::InspectorInstrumentation::interceptRequest): * inspector/InspectorInstrumentationWebKit.cpp: (WebCore::InspectorInstrumentationWebKit::interceptRequestInternal): * inspector/InspectorInstrumentationWebKit.h: (WebCore::InspectorInstrumentationWebKit::interceptRequest): * inspector/agents/InspectorNetworkAgent.cpp: (WebCore::InspectorNetworkAgent::interceptRequest): (WebCore::InspectorNetworkAgent::interceptRequestWithResponse): (WebCore::InspectorNetworkAgent::interceptRequestWithError): * inspector/agents/InspectorNetworkAgent.h: (WebCore::InspectorNetworkAgent::PendingInterceptRequest::PendingInterceptRequest): (WebCore::InspectorNetworkAgent::PendingInterceptRequest::continueAsHandled): 2020-06-16 Clark Wang <clark_wang@apple.com> Added missing position attributes to PannerNode https://bugs.webkit.org/show_bug.cgi?id=213151 Reviewed by Chris Dumez. Implemented position attributes in PannerNode interface, as per spec: https://www.w3.org/TR/webaudio/#pannernode. Re-baselined tests previous tests that either now pass, or fail at a further stage than before. * Modules/webaudio/PannerNode.cpp: (WebCore::PannerNode::PannerNode): (WebCore::PannerNode::position const): (WebCore::PannerNode::setPosition): (WebCore::PannerNode::getAzimuthElevation): (WebCore::PannerNode::dopplerRate): (WebCore::PannerNode::distanceConeGain): * Modules/webaudio/PannerNode.h: * Modules/webaudio/PannerNode.idl: 2020-06-16 Mark Lam <mark.lam@apple.com> Make Options::useJIT() be the canonical source of truth on whether we should use the JIT. https://bugs.webkit.org/show_bug.cgi?id=212556 <rdar://problem/63780436> Reviewed by Saam Barati. * cssjit/SelectorCompiler.cpp: (WebCore::SelectorCompiler::compileSelector): 2020-06-16 Sam Weinig <weinig@apple.com> [WPT] form.action does not return document.url when unset (part of https://wpt.live/html/dom/reflection-forms.html) https://bugs.webkit.org/show_bug.cgi?id=213205 Reviewed by David Kilzer. Update existing test results that now pass. * html/HTMLFormControlElement.cpp: (WebCore::HTMLFormControlElement::formAction const): Call document.completeURL() directly rather than getURLAttribute() as that will cause the attribute to have to be looked up again. * html/HTMLFormElement.cpp: (WebCore::HTMLFormElement::action const): Match HTMLFormControlElement::formAction (and the spec) and return the document's url if the attribute value is missing. * html/HTMLFormElement.idl: Remove Reflect/URL extended attributes, as we need custom handling for the empty case. 2020-06-16 David Kilzer <ddkilzer@apple.com> REGRESSION (r262994): Web Inspector is killed when context-clicking anywhere <https://webkit.org/b/213224> <rdar://problem/64383320> Reviewed by Darin Adler. Test: TestWebKitAPI.WebCore.ContextMenuAction_IsValidEnum The issue is that using WTF::isValidEnum() with WTF::EnumTraits<WebCore::ContextMenuAction> didn't explicitly list all 1000 custom tags, or any application tags (besides the base), so the unlisted tags were marked as invalid during enum validation. The fix is to define a custom validation function for WebCore::ContextMenuAction enum values. * platform/ContextMenuItem.h: (WTF::isValidEnum): * platform/ContextMenuItem.cpp: (WebCore::isValidContextMenuAction): Add. - Validates CustomTag and ApplicationTag ranges. * platform/ContextMenuItem.h: (WebCore::isValidContextMenuAction): Add declaration. (WTF::EnumTraits<WebCore::ContextMenuAction>): Delete. (WTF::HasCustomIsValidEnum<WebCore::ContextMenuAction>): Add. (WTF::isValidEnum): Add. - Call WebCore::isValidContextMenuAction() to validate all enum values. 2020-06-16 Fujii Hironori <Hironori.Fujii@sony.com> [CMake][Visual Studio] CSSPropertyNames.h is generated twice in WebCore.vcxproj and WebCore_CopyPrivateHeaders.vcxproj https://bugs.webkit.org/show_bug.cgi?id=213226 Reviewed by Don Olmstead. WebCore_CopyPrivateHeaders needs to have a direct or indirect dependency of WebCore target for CMake Visual Studio generator to eliminate duplicated custom commands. * CMakeLists.txt: Added add_dependencies(WebCore_CopyPrivateHeaders WebCore). 2020-06-16 Wenson Hsieh <wenson_hsieh@apple.com> Text manipulation should handle nested item boundary elements https://bugs.webkit.org/show_bug.cgi?id=213251 <rdar://problem/63371514> Reviewed by Sihui Liu. In the case where there are nested item boundary elements (e.g. block-level list items or links), text manipulation will currently only observe that we've crossed the top-level item boundary, and proceed to extract text from the nested boundary elements as tokens in the same item. Address this by maintaining a stack of boundary elements rather than just a single item. Additionally, create and add an item when crossing into a new item boundary, rather than only when we exit a boundary; this handles the case where we descend from one boundary element into another boundary element that is a child. Test: TextManipulation.StartTextManipulationTreatsNestedInlineBlockListItemsAndLinksAsParagraphs * editing/TextManipulationController.cpp: (WebCore::TextManipulationController::observeParagraphs): 2020-06-16 Youenn Fablet <youenn@apple.com> Loads triggered by an opaque stylesheet should not be visible to service workers https://bugs.webkit.org/show_bug.cgi?id=213246 Reviewed by Alex Christensen. Test: http/wpt/service-workers/no-cors-css-with-subresources.https.html * loader/ResourceLoaderOptions.h: Move it to boolean 2020-06-16 Chris Fleizach <cfleizach@apple.com> AX: <address> element should no longer map to ARIA `contentinfo` role https://bugs.webkit.org/show_bug.cgi?id=212617 <rdar://problem/63848604> Reviewed by Joanmarie Diggs. Change the mapping of <address> to be a basic group. Update tests. * accessibility/AccessibilityRenderObject.cpp: (WebCore::AccessibilityRenderObject::determineAccessibilityRole): 2020-06-16 Truitt Savell <tsavell@apple.com> Unreviewed, reverting r263079. Broke Internal builds. Reverted changeset: "IndexedDB: Support IDBFactory databases method" https://bugs.webkit.org/show_bug.cgi?id=211043 https://trac.webkit.org/changeset/263079 2020-06-16 Antti Koivisto <antti@apple.com> O(n^2) behavior in media query resolution https://bugs.webkit.org/show_bug.cgi?id=213243 Reviewed by Anders Carlsson. We were traversing all rules in a RuleSet inside a loop over all media queries that change value. This becomes problematic when you have thousands of media queries. * style/RuleSet.cpp: (WebCore::Style::RuleSet::evaluteDynamicMediaQueryRules): Instead collect the rule positions that need flipping into a map and then traverse only once to do the actual flipping. Longer term we should maintain a data stucture that can map directly from a position to RuleDatas. This will require some data structure rethink so this patch takes a simpler approach. (WebCore::Style::RuleSet::MediaQueryCollector::pop): * style/RuleSet.h: 2020-06-16 Per Arne Vollan <pvollan@apple.com> [iOS] Collecting screen properties in the UI process introduced a Safari launch time regression. https://bugs.webkit.org/show_bug.cgi?id=213217 <rdar://problem/64374461> Reviewed by Brent Fulgham. Calling collectScreenProperties() in WebProcessPool::platformInitializeWebProcess() introduced a Safari launch time regression on iOS. It turns out that calling screenIsMonochrome on iOS is expensive, but this call can still be done in the WebContent process, since there are no sandbox restrictions making that call fail in the WebContent process. Call this function in the WebContent process instead of in the UI process. No new tests, since this change should not introduce a change in behavior. It goes back to calling the screenIsMonochrome function in the WebContent process. * platform/ScreenProperties.h: (WebCore::ScreenData::encode const): (WebCore::ScreenData::decode): * platform/ios/PlatformScreenIOS.mm: (WebCore::screenIsMonochrome): (WebCore::collectScreenProperties): * platform/mac/PlatformScreenMac.mm: (WebCore::collectScreenProperties): 2020-06-16 Xabier Rodriguez Calvar <calvaris@igalia.com> [EME] Create CDMProxyFactory https://bugs.webkit.org/show_bug.cgi?id=212695 Reviewed by Youenn Fablet. Currently in the GStreamer port we have the CDMProxy cabled in the player private and set to the instance. Setting this too late can create key sync issues that are worked around. This does not seem to be needed because it can be created in the constructor from a CDMProxyFactory if we just use the key system that we already have. This patch declares a CDMProxyFactory that is used in the CDMInstanceProxy to instantiate the proper CDMProxy in its constructor. CDMProxyFactoryClearKey is created and added to the GStreamer platform CDMProxyFactories. Initializing too fast creates flakyness in several ClearKey tests because of asking for protected memory so we need to initialize it in a lazy way. No new tests, just a rework. * platform/encryptedmedia/CDMProxy.cpp: (WebCore::CDMProxyFactory::registerFactory): (WebCore::CDMProxyFactory::unregisterFactory): (WebCore::CDMProxyFactory::createCDMProxyForKeySystem): (WebCore::CDMProxyFactory::platformRegisterFactories): * platform/encryptedmedia/CDMProxy.h: (WebCore::CDMProxyFactory::~CDMProxyFactory): (WebCore::CDMInstanceProxy::CDMInstanceProxy): * platform/encryptedmedia/clearkey/CDMClearKey.cpp: (WebCore::CDMInstanceClearKey::CDMInstanceClearKey): (WebCore::CDMInstanceClearKey::keySystem const): * platform/encryptedmedia/clearkey/CDMClearKey.h: * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp: (WebCore::MediaPlayerPrivateGStreamer::cdmInstanceAttached): * platform/graphics/gstreamer/eme/CDMFactoryGStreamer.cpp: (WebCore::CDMProxyFactory::platformRegisterFactories): * platform/graphics/gstreamer/eme/CDMProxyClearKey.cpp: (WebCore::CDMProxyFactoryClearKey::singleton): (WebCore::CDMProxyFactoryClearKey::createCDMProxy): (WebCore::CDMProxyFactoryClearKey::supportsKeySystem): * platform/graphics/gstreamer/eme/CDMProxyClearKey.h: 2020-06-16 youenn fablet <youenn@apple.com> Make sure MediaRecorder.requestData returns data with the new writer backend https://bugs.webkit.org/show_bug.cgi?id=206929 Reviewed by Darin Adler. Test: http/wpt/mediarecorder/MediaRecorder-requestData.html * platform/mediarecorder/cocoa/MediaRecorderPrivateWriterCocoa.mm: (WebCore::MediaRecorderPrivateWriter::fetchData): Flush data whenever calling fetchData. 2020-06-16 Darryl Pogue <darryl@dpogue.ca> IndexedDB: Support IDBFactory databases method https://bugs.webkit.org/show_bug.cgi?id=211043 Reviewed by Youenn Fablet. Add support for fetching the list of IDB database names and versions from the IDBServer, and expose the functionality as `IDBFactory.prototype.databases()`. Spec: https://w3c.github.io/IndexedDB/#dom-idbfactory-databases * Headers.cmake: * Modules/indexeddb/IDBActiveDOMObject.h: (WebCore::IDBActiveDOMObject::performCallbackOnOriginThread): * Modules/indexeddb/IDBDatabaseNameAndVersionRequest.cpp: Added. (WebCore::IDBDatabaseNameAndVersionRequest::create): (WebCore::IDBDatabaseNameAndVersionRequest::IDBDatabaseNameAndVersionRequest): (WebCore::IDBDatabaseNameAndVersionRequest::~IDBDatabaseNameAndVersionRequest): (WebCore::IDBDatabaseNameAndVersionRequest::complete): (WebCore::IDBDatabaseNameAndVersionRequest::activeDOMObjectName const): (WebCore::IDBDatabaseNameAndVersionRequest::virtualHasPendingActivity const): (WebCore::IDBDatabaseNameAndVersionRequest::stop): * Modules/indexeddb/IDBDatabaseNameAndVersionRequest.h: Added. * Modules/indexeddb/IDBFactory.cpp: (WebCore::IDBFactory::databases): (WebCore::IDBFactory::getAllDatabaseNames): * Modules/indexeddb/IDBFactory.h: * Modules/indexeddb/IDBFactory.idl: * Modules/indexeddb/client/IDBConnectionProxy.cpp: (WebCore::IDBClient::IDBConnectionProxy::connectionToServerLost): (WebCore::IDBClient::IDBConnectionProxy::getAllDatabaseNamesAndVersions): (WebCore::IDBClient::IDBConnectionProxy::didGetAllDatabaseNamesAndVersions): (WebCore::IDBClient::IDBConnectionProxy::forgetActivityForCurrentThread): (WebCore::IDBClient::IDBConnectionProxy::getAllDatabaseNames): Deleted. * Modules/indexeddb/client/IDBConnectionProxy.h: * Modules/indexeddb/client/IDBConnectionToServer.cpp: (WebCore::IDBClient::IDBConnectionToServer::getAllDatabaseNamesAndVersions): (WebCore::IDBClient::IDBConnectionToServer::didGetAllDatabaseNamesAndVersions): (WebCore::IDBClient::IDBConnectionToServer::getAllDatabaseNames): Deleted. (WebCore::IDBClient::IDBConnectionToServer::didGetAllDatabaseNames): Deleted. * Modules/indexeddb/client/IDBConnectionToServer.h: * Modules/indexeddb/client/IDBConnectionToServerDelegate.h: * Modules/indexeddb/server/IDBConnectionToClient.cpp: (WebCore::IDBServer::IDBConnectionToClient::didGetAllDatabaseNamesAndVersions): (WebCore::IDBServer::IDBConnectionToClient::didGetAllDatabaseNames): Deleted. * Modules/indexeddb/server/IDBConnectionToClient.h: * Modules/indexeddb/server/IDBConnectionToClientDelegate.h: * Modules/indexeddb/server/IDBServer.cpp: (WebCore::IDBServer::IDBServer::getAllDatabaseNamesAndVersions): (WebCore::IDBServer::IDBServer::getAllDatabaseNames): Deleted. * Modules/indexeddb/server/IDBServer.h: * Modules/indexeddb/server/SQLiteIDBBackingStore.cpp: (WebCore::IDBServer::SQLiteIDBBackingStore::databaseNameAndVersionFromFile): (WebCore::IDBServer::SQLiteIDBBackingStore::databaseNameFromFile): Deleted. * Modules/indexeddb/server/SQLiteIDBBackingStore.h: * Modules/indexeddb/shared/IDBDatabaseNameAndVersion.h: Added. (WebCore::IDBDatabaseNameAndVersion::encode const): (WebCore::IDBDatabaseNameAndVersion::decode): (WebCore::IDBDatabaseNameAndVersion::isolatedCopy const): * Sources.txt: * WebCore.xcodeproj/project.pbxproj: * inspector/agents/InspectorIndexedDBAgent.cpp: (WebCore::InspectorIndexedDBAgent::requestDatabaseNames): * loader/EmptyClients.cpp: 2020-06-15 ChangSeok Oh <changseok@webkit.org> [GTK] Rename GC3D to GCGL. https://bugs.webkit.org/show_bug.cgi?id=211117 Reviewed by Fujii Hironori. GraphicsContext3D has been renamed to GraphicsContextGL after r254103 but some files still follow the old name. This change reflects the new name to them for consistency. No new tests because of no new functionalities. * platform/TextureMapper.cmake: * platform/graphics/nicosia/texmap/NicosiaGCGLANGLELayer.cpp: Renamed from Source/WebCore/platform/graphics/nicosia/texmap/NicosiaGC3DANGLELayer.cpp. (Nicosia::GCGLANGLELayer::ANGLEContext::errorString): (Nicosia::GCGLANGLELayer::ANGLEContext::lastErrorString): (Nicosia::GCGLANGLELayer::ANGLEContext::createContext): (Nicosia::GCGLANGLELayer::ANGLEContext::ANGLEContext): (Nicosia::GCGLANGLELayer::ANGLEContext::~ANGLEContext): (Nicosia::GCGLANGLELayer::ANGLEContext::makeContextCurrent): (Nicosia::GCGLANGLELayer::ANGLEContext::platformContext const): (Nicosia::GCGLANGLELayer::GCGLANGLELayer): (Nicosia::GCGLANGLELayer::~GCGLANGLELayer): (Nicosia::GCGLANGLELayer::makeContextCurrent): (Nicosia::GCGLANGLELayer::platformContext const): * platform/graphics/nicosia/texmap/NicosiaGCGLANGLELayer.h: Renamed from Source/WebCore/platform/graphics/nicosia/texmap/NicosiaGC3DANGLELayer.h. * platform/graphics/nicosia/texmap/NicosiaGCGLLayer.cpp: Renamed from Source/WebCore/platform/graphics/nicosia/texmap/NicosiaGC3DLayer.cpp. (Nicosia::GCGLLayer::GCGLLayer): (Nicosia::GCGLLayer::~GCGLLayer): (Nicosia::GCGLLayer::makeContextCurrent): (Nicosia::GCGLLayer::platformContext const): (Nicosia::GCGLLayer::swapBuffersIfNeeded): * platform/graphics/nicosia/texmap/NicosiaGCGLLayer.h: Renamed from Source/WebCore/platform/graphics/nicosia/texmap/NicosiaGC3DLayer.h. (Nicosia::GCGLLayer::contentLayer const): * platform/graphics/opengl/GraphicsContextGLOpenGL.h: * platform/graphics/texmap/GraphicsContextGLTextureMapper.cpp: (WebCore::GraphicsContextGLOpenGL::GraphicsContextGLOpenGL): * platform/graphics/texmap/TextureMapperGCGLPlatformLayer.cpp: Renamed from Source/WebCore/platform/graphics/texmap/TextureMapperGC3DPlatformLayer.cpp. (WebCore::TextureMapperGCGLPlatformLayer::TextureMapperGCGLPlatformLayer): (WebCore::TextureMapperGCGLPlatformLayer::~TextureMapperGCGLPlatformLayer): (WebCore::TextureMapperGCGLPlatformLayer::makeContextCurrent): (WebCore::TextureMapperGCGLPlatformLayer::platformContext const): (WebCore::TextureMapperGCGLPlatformLayer::proxy const): (WebCore::TextureMapperGCGLPlatformLayer::swapBuffersIfNeeded): (WebCore::TextureMapperGCGLPlatformLayer::paintToTextureMapper): * platform/graphics/texmap/TextureMapperGCGLPlatformLayer.h: Renamed from Source/WebCore/platform/graphics/texmap/TextureMapperGC3DPlatformLayer.h. 2020-06-15 Megan Gardner <megan_gardner@apple.com> Text form controls can scroll by 1px when value is the same length as size. No scrolling should happen. https://bugs.webkit.org/show_bug.cgi?id=212856 <rdar://problem/63541707> Reviewed by Zalan Bujtas. We were only adding caret width to an input when determining if the input should start to be scrolled, but that additional width was not included in the initial calculation, which could result in fields being scrollable by 1px when they had the same number of fixed-width characters as the size of the field. This was incorrect, and caused fast/forms/password-scrolled-after-caps-lock-toggled.html to fail when the default size of the security dots increased to be the same as the average character width. Adding the caret width when the size of the input field is calculated brings consistency to when an input field is scrollable. Tested by fixing: fast/forms/password-scrolled-after-caps-lock-toggled.html And rebasing: * editing/editable-region/overflow-scroll-text-field-and-contenteditable-expected.txt: * editing/editable-region/search-field-basic-expected.txt: * editing/editable-region/text-field-basic-expected.txt: * fast/forms/auto-fill-button/hide-auto-fill-button-when-input-becomes-readonly-expected.html: * fast/forms/auto-fill-button/hide-auto-fill-button-when-input-becomes-readonly.html: * fast/forms/auto-fill-button/input-credit-card-auto-fill-button-expected.txt: * fast/forms/fieldset/fieldset-elements-htmlcollection-expected.txt: * fast/forms/fieldset/fieldset-elements-htmlcollection.html: * fast/forms/search/search-cancel-button-visible-when-input-becomes-disabled-expected.html: * fast/forms/search/search-cancel-button-visible-when-input-becomes-disabled.html: * fast/forms/search/search-cancel-button-visible-when-input-becomes-readonly-expected.html: * fast/forms/search/search-cancel-button-visible-when-input-becomes-readonly.html: * platform/ios-simulator/fast/forms/auto-fill-button/hide-auto-fill-strong-password-viewable-treatment-when-form-is-reset-expected.txt: * platform/ios-simulator/fast/forms/auto-fill-button/input-credit-card-auto-fill-button-expected.txt: * platform/ios-simulator/fast/forms/auto-fill-button/input-strong-password-viewable-expected.txt: * platform/ios-simulator/fast/forms/datalist/datalist-searchinput-appearance-expected.txt: * platform/ios-simulator/fast/forms/datalist/datalist-textinput-appearance-expected.txt: * platform/ios-wk2/editing/input/caret-at-the-edge-of-contenteditable-expected.txt: * platform/ios-wk2/editing/input/caret-at-the-edge-of-input-expected.txt: * platform/ios-wk2/editing/inserting/before-after-input-element-expected.txt: * platform/ios-wk2/editing/pasteboard/input-field-1-expected.txt: * platform/ios-wk2/editing/selection/4895428-3-expected.txt: * platform/ios-wk2/editing/selection/drag-select-1-expected.txt: * platform/ios-wk2/editing/selection/select-from-textfield-outwards-expected.txt: * platform/ios-wk2/fast/forms/input-appearance-preventDefault-expected.txt: * platform/ios-wk2/fast/forms/input-text-click-inside-expected.txt: * platform/ios-wk2/fast/forms/input-text-click-outside-expected.txt: * platform/ios-wk2/fast/forms/input-text-double-click-expected.txt: * platform/ios-wk2/fast/forms/input-text-drag-down-expected.txt: * platform/ios-wk2/fast/forms/input-text-option-delete-expected.txt: * platform/ios-wk2/fast/forms/input-text-self-emptying-click-expected.txt: * platform/ios-wk2/fast/forms/tabbing-input-iframe-expected.txt: * platform/ios-wk2/fast/forms/textfield-outline-expected.txt: * platform/ios-wk2/fast/overflow/overflow-focus-ring-expected.txt: * platform/ios-wk2/fast/repaint/placeholder-after-caps-lock-hidden-expected.txt: * platform/ios-wk2/fast/transforms/transformed-focused-text-input-expected.txt: * platform/ios/editing/pasteboard/4806874-expected.txt: * platform/ios/editing/selection/3690703-2-expected.txt: * platform/ios/editing/selection/3690703-expected.txt: * platform/ios/editing/selection/3690719-expected.txt: * platform/ios/editing/selection/4975120-expected.txt: * platform/ios/fast/clip/outline-overflowClip-expected.txt: * platform/ios/fast/css/focus-ring-exists-for-search-field-expected.txt: * platform/ios/fast/css/input-search-padding-expected.txt: * platform/ios/fast/css/line-height-expected.txt: * platform/ios/fast/css/text-overflow-input-expected.txt: * platform/ios/fast/events/context-no-deselect-expected.txt: * platform/ios/fast/forms/auto-fill-button/input-contacts-auto-fill-button-expected.txt: * platform/ios/fast/forms/basic-inputs-expected.txt: * platform/ios/fast/forms/box-shadow-override-expected.txt: * platform/ios/fast/forms/control-restrict-line-height-expected.txt: * platform/ios/fast/forms/encoding-test-expected.txt: * platform/ios/fast/forms/fieldset-align-expected.txt: * platform/ios/fast/forms/form-element-geometry-expected.txt: * platform/ios/fast/forms/input-align-expected.txt: * platform/ios/fast/forms/input-appearance-bkcolor-expected.txt: * platform/ios/fast/forms/input-appearance-default-bkcolor-expected.txt: * platform/ios/fast/forms/input-appearance-focus-expected.txt: * platform/ios/fast/forms/input-appearance-height-expected.txt: * platform/ios/fast/forms/input-appearance-selection-expected.txt: * platform/ios/fast/forms/input-appearance-visibility-expected.txt: * platform/ios/fast/forms/input-appearance-width-expected.txt: * platform/ios/fast/forms/input-disabled-color-expected.txt: * platform/ios/fast/forms/input-double-click-selection-gap-bug-expected.txt: * platform/ios/fast/forms/input-placeholder-visibility-1-expected.txt: * platform/ios/fast/forms/input-placeholder-visibility-3-expected.txt: * platform/ios/fast/forms/input-spaces-expected.txt: * platform/ios/fast/forms/input-table-expected.txt: * platform/ios/fast/forms/input-text-click-inside-expected.txt: * platform/ios/fast/forms/input-text-scroll-left-on-blur-expected.txt: * platform/ios/fast/forms/input-text-self-emptying-click-expected.txt: * platform/ios/fast/forms/input-type-text-min-width-expected.txt: * platform/ios/fast/forms/input-value-expected.txt: * platform/ios/fast/forms/input-width-expected.txt: * platform/ios/fast/forms/minWidthPercent-expected.txt: * platform/ios/fast/forms/number/number-appearance-rtl-expected.txt: * platform/ios/fast/forms/number/number-appearance-spinbutton-disabled-readonly-expected.txt: * platform/ios/fast/forms/number/number-appearance-spinbutton-layer-expected.txt: * platform/ios/fast/forms/placeholder-pseudo-style-expected.txt: * platform/ios/fast/forms/search-cancel-button-style-sharing-expected.txt: * platform/ios/fast/forms/search-display-none-cancel-button-expected.txt: * platform/ios/fast/forms/search-input-rtl-expected.txt: * platform/ios/fast/forms/search-styled-expected.txt: * platform/ios/fast/forms/tabbing-input-iframe-expected.txt: * platform/ios/fast/forms/text-control-intrinsic-widths-expected.txt: * platform/ios/fast/forms/textfield-focus-ring-expected.txt: * platform/ios/fast/forms/textfield-overflow-expected.txt: * platform/ios/fast/frames/take-focus-from-iframe-expected.txt: * platform/ios/fast/html/details-no-summary4-expected.txt: * platform/ios/fast/html/details-open-javascript-expected.txt: * platform/ios/fast/html/details-open2-expected.txt: * platform/ios/fast/html/details-open4-expected.txt: * platform/ios/fast/lists/dynamic-marker-crash-expected.txt: * platform/ios/fast/replaced/replaced-breaking-expected.txt: * platform/ios/fast/replaced/replaced-breaking-mixture-expected.txt: * platform/ios/fast/table/colspanMinWidth-expected.txt: * platform/ios/fast/table/spanOverlapRepaint-expected.txt: * platform/ios/fast/table/text-field-baseline-expected.txt: * platform/ios/svg/custom/inline-svg-in-xhtml-expected.txt: * platform/ios/svg/hixie/mixed/003-expected.txt: * platform/ios/tables/mozilla/bugs/bug1188-expected.txt: * platform/ios/tables/mozilla/bugs/bug12384-expected.txt: * platform/ios/tables/mozilla/bugs/bug18359-expected.txt: * platform/ios/tables/mozilla/bugs/bug24200-expected.txt: * platform/ios/tables/mozilla/bugs/bug2479-2-expected.txt: * platform/ios/tables/mozilla/bugs/bug2479-3-expected.txt: * platform/ios/tables/mozilla/bugs/bug2479-4-expected.txt: * platform/ios/tables/mozilla/bugs/bug28928-expected.txt: * platform/ios/tables/mozilla/bugs/bug4382-expected.txt: * platform/ios/tables/mozilla/bugs/bug4527-expected.txt: * platform/ios/tables/mozilla/bugs/bug46368-1-expected.txt: * platform/ios/tables/mozilla/bugs/bug46368-2-expected.txt: * platform/ios/tables/mozilla/bugs/bug51037-expected.txt: * platform/ios/tables/mozilla/bugs/bug55545-expected.txt: * platform/ios/tables/mozilla/bugs/bug59354-expected.txt: * platform/ios/tables/mozilla/bugs/bug7342-expected.txt: * platform/ios/tables/mozilla/bugs/bug96334-expected.txt: * platform/ios/tables/mozilla/bugs/bug99948-expected.txt: * platform/ios/tables/mozilla/dom/tableDom-expected.txt: * platform/ios/tables/mozilla/other/move_row-expected.txt: * platform/ios/tables/mozilla_expected_failures/bugs/bug2479-5-expected.txt: * platform/ios/tables/mozilla_expected_failures/bugs/bug92647-1-expected.txt: * platform/ios/transforms/3d/general/perspective-non-layer-expected.txt: * platform/mac-mojave/tables/mozilla_expected_failures/bugs/bug2479-5-expected.txt: * platform/mac/editing/input/caret-at-the-edge-of-input-expected.txt: * platform/mac/editing/inserting/before-after-input-element-expected.txt: * platform/mac/editing/pasteboard/4806874-expected.txt: * platform/mac/editing/pasteboard/drop-text-without-selection-expected.txt: * platform/mac/editing/pasteboard/input-field-1-expected.txt: * platform/mac/editing/selection/3690703-2-expected.txt: * platform/mac/editing/selection/3690703-expected.txt: * platform/mac/editing/selection/3690719-expected.txt: * platform/mac/editing/selection/4895428-3-expected.txt: * platform/mac/editing/selection/4975120-expected.txt: * platform/mac/editing/selection/drag-select-1-expected.txt: * platform/mac/editing/selection/select-from-textfield-outwards-expected.txt: * platform/mac/fast/css/focus-ring-exists-for-search-field-expected.txt: * platform/mac/fast/css/line-height-expected.txt: * platform/mac/fast/css/text-overflow-input-expected.txt: * platform/mac/fast/events/context-no-deselect-expected.txt: * platform/mac/fast/forms/auto-fill-button/hide-auto-fill-strong-password-viewable-treatment-when-form-is-reset-expected.txt: * platform/mac/fast/forms/auto-fill-button/input-auto-fill-button-expected.txt: * platform/mac/fast/forms/auto-fill-button/input-contacts-auto-fill-button-expected.txt: * platform/mac/fast/forms/auto-fill-button/input-strong-password-viewable-expected.txt: * platform/mac/fast/forms/basic-inputs-expected.txt: * platform/mac/fast/forms/box-shadow-override-expected.txt: * platform/mac/fast/forms/control-restrict-line-height-expected.txt: * platform/mac/fast/forms/datalist/datalist-searchinput-appearance-expected.txt: * platform/mac/fast/forms/datalist/datalist-textinput-appearance-expected.txt: * platform/mac/fast/forms/encoding-test-expected.txt: * platform/mac/fast/forms/fieldset-align-expected.txt: * platform/mac/fast/forms/form-element-geometry-expected.txt: * platform/mac/fast/forms/input-align-expected.txt: * platform/mac/fast/forms/input-appearance-bkcolor-expected.txt: * platform/mac/fast/forms/input-appearance-default-bkcolor-expected.txt: * platform/mac/fast/forms/input-appearance-focus-expected.txt: * platform/mac/fast/forms/input-appearance-height-expected.txt: * platform/mac/fast/forms/input-appearance-preventDefault-expected.txt: * platform/mac/fast/forms/input-appearance-selection-expected.txt: * platform/mac/fast/forms/input-appearance-spinbutton-expected.txt: * platform/mac/fast/forms/input-appearance-spinbutton-up-expected.txt: * platform/mac/fast/forms/input-appearance-visibility-expected.txt: * platform/mac/fast/forms/input-appearance-width-expected.txt: * platform/mac/fast/forms/input-baseline-expected.txt: * platform/mac/fast/forms/input-disabled-color-expected.txt: * platform/mac/fast/forms/input-double-click-selection-gap-bug-expected.txt: * platform/mac/fast/forms/input-placeholder-visibility-1-expected.txt: * platform/mac/fast/forms/input-placeholder-visibility-3-expected.txt: * platform/mac/fast/forms/input-spaces-expected.txt: * platform/mac/fast/forms/input-table-expected.txt: * platform/mac/fast/forms/input-text-click-inside-expected.txt: * platform/mac/fast/forms/input-text-click-outside-expected.txt: * platform/mac/fast/forms/input-text-double-click-expected.txt: * platform/mac/fast/forms/input-text-drag-down-expected.txt: * platform/mac/fast/forms/input-text-option-delete-expected.txt: * platform/mac/fast/forms/input-text-scroll-left-on-blur-expected.txt: * platform/mac/fast/forms/input-text-self-emptying-click-expected.txt: * platform/mac/fast/forms/input-text-word-wrap-expected.txt: * platform/mac/fast/forms/input-type-text-min-width-expected.txt: * platform/mac/fast/forms/input-value-expected.txt: * platform/mac/fast/forms/input-width-expected.txt: * platform/mac/fast/forms/number/number-appearance-rtl-expected.txt: * platform/mac/fast/forms/number/number-appearance-spinbutton-disabled-readonly-expected.txt: * platform/mac/fast/forms/number/number-appearance-spinbutton-layer-expected.txt: * platform/mac/fast/forms/placeholder-position-expected.txt: * platform/mac/fast/forms/placeholder-pseudo-style-expected.txt: * platform/mac/fast/forms/search-cancel-button-style-sharing-expected.txt: * platform/mac/fast/forms/search-display-none-cancel-button-expected.txt: * platform/mac/fast/forms/search-input-rtl-expected.txt: * platform/mac/fast/forms/search-styled-expected.txt: * platform/mac/fast/forms/search-vertical-alignment-expected.txt: * platform/mac/fast/forms/search/search-padding-cancel-results-buttons-expected.txt: * platform/mac/fast/forms/search/search-size-with-decorations-expected.txt: * platform/mac/fast/forms/tabbing-input-iframe-expected.txt: * platform/mac/fast/forms/text-control-intrinsic-widths-expected.txt: * platform/mac/fast/forms/textfield-focus-ring-expected.txt: * platform/mac/fast/forms/textfield-outline-expected.txt: * platform/mac/fast/forms/textfield-overflow-expected.txt: * platform/mac/fast/forms/visual-hebrew-text-field-expected.txt: * platform/mac/fast/frames/take-focus-from-iframe-expected.txt: * platform/mac/fast/html/details-no-summary4-expected.txt: * platform/mac/fast/html/details-open-javascript-expected.txt: * platform/mac/fast/html/details-open2-expected.txt: * platform/mac/fast/html/details-open4-expected.txt: * platform/mac/fast/lists/dynamic-marker-crash-expected.txt: * platform/mac/fast/repaint/renderer-destruction-by-invalidateSelection-crash-expected.txt: * platform/mac/fast/repaint/search-field-cancel-expected.txt: * platform/mac/fast/repaint/subtree-root-skipped-expected.txt: * platform/mac/fast/replaced/replaced-breaking-expected.txt: * platform/mac/fast/replaced/replaced-breaking-mixture-expected.txt: * platform/mac/fast/table/colspanMinWidth-expected.txt: * platform/mac/fast/table/spanOverlapRepaint-expected.txt: * platform/mac/fast/table/text-field-baseline-expected.txt: * platform/mac/fast/text/textIteratorNilRenderer-expected.txt: * platform/mac/fast/transforms/transformed-focused-text-input-expected.txt: * platform/mac/http/tests/navigation/javascriptlink-frames-expected.txt: * platform/mac/plugins/mouse-click-plugin-clears-selection-expected.txt: * platform/mac/svg/custom/inline-svg-in-xhtml-expected.txt: * platform/mac/svg/hixie/mixed/003-expected.txt: * platform/mac/tables/mozilla/bugs/bug1188-expected.txt: * platform/mac/tables/mozilla/bugs/bug12384-expected.txt: * platform/mac/tables/mozilla/bugs/bug18359-expected.txt: * platform/mac/tables/mozilla/bugs/bug24200-expected.txt: * platform/mac/tables/mozilla/bugs/bug2479-2-expected.txt: * platform/mac/tables/mozilla/bugs/bug2479-3-expected.txt: * platform/mac/tables/mozilla/bugs/bug2479-4-expected.txt: * platform/mac/tables/mozilla/bugs/bug28928-expected.txt: * platform/mac/tables/mozilla/bugs/bug4382-expected.txt: * platform/mac/tables/mozilla/bugs/bug4527-expected.txt: * platform/mac/tables/mozilla/bugs/bug46368-1-expected.txt: * platform/mac/tables/mozilla/bugs/bug46368-2-expected.txt: * platform/mac/tables/mozilla/bugs/bug51037-expected.txt: * platform/mac/tables/mozilla/bugs/bug55545-expected.txt: * platform/mac/tables/mozilla/bugs/bug59354-expected.txt: * platform/mac/tables/mozilla/bugs/bug7342-expected.txt: * platform/mac/tables/mozilla/bugs/bug96334-expected.txt: * platform/mac/tables/mozilla/bugs/bug99948-expected.txt: * platform/mac/tables/mozilla/dom/tableDom-expected.txt: * platform/mac/tables/mozilla/other/move_row-expected.txt: * platform/mac/tables/mozilla_expected_failures/bugs/bug2479-5-expected.txt: * platform/mac/tables/mozilla_expected_failures/bugs/bug92647-1-expected.txt: * platform/mac/transforms/3d/general/perspective-non-layer-expected.txt: * platform/win/editing/input/caret-at-the-edge-of-input-expected.txt: * platform/win/editing/inserting/before-after-input-element-expected.txt: * platform/win/fast/css/focus-ring-exists-for-search-field-expected.txt: * platform/win/fast/events/context-no-deselect-expected.txt: * platform/win/fast/forms/auto-fill-button/input-auto-fill-button-expected.txt: * platform/win/fast/forms/auto-fill-button/input-contacts-auto-fill-button-expected.txt: * platform/win/fast/forms/auto-fill-button/input-credit-card-auto-fill-button-expected.txt: * platform/win/fast/forms/basic-inputs-expected.txt: * platform/win/fast/forms/box-shadow-override-expected.txt: * platform/win/fast/forms/control-restrict-line-height-expected.txt: * platform/win/fast/forms/encoding-test-expected.txt: * platform/win/fast/forms/fieldset-align-expected.txt: * platform/win/fast/forms/form-element-geometry-expected.txt: * platform/win/fast/forms/input-align-expected.txt: * platform/win/fast/forms/input-appearance-bkcolor-expected.txt: * platform/win/fast/forms/input-appearance-default-bkcolor-expected.txt: * platform/win/fast/forms/input-appearance-disabled-expected.txt: * platform/win/fast/forms/input-appearance-focus-expected.txt: * platform/win/fast/forms/input-appearance-height-expected.txt: * platform/win/fast/forms/input-appearance-readonly-expected.txt: * platform/win/fast/forms/input-appearance-selection-expected.txt: * platform/win/fast/forms/input-appearance-visibility-expected.txt: * platform/win/fast/forms/input-appearance-width-expected.txt: * platform/win/fast/forms/input-baseline-expected.txt: * platform/win/fast/forms/input-disabled-color-expected.txt: * platform/win/fast/forms/input-double-click-selection-gap-bug-expected.txt: * platform/win/fast/forms/input-placeholder-visibility-1-expected.txt: * platform/win/fast/forms/input-placeholder-visibility-3-expected.txt: * platform/win/fast/forms/input-readonly-autoscroll-expected.txt: * platform/win/fast/forms/input-readonly-dimmed-expected.txt: * platform/win/fast/forms/input-readonly-empty-expected.txt: * platform/win/fast/forms/input-spaces-expected.txt: * platform/win/fast/forms/input-table-expected.txt: * platform/win/fast/forms/input-text-click-inside-expected.txt: * platform/win/fast/forms/input-text-click-outside-expected.txt: * platform/win/fast/forms/input-text-double-click-expected.txt: * platform/win/fast/forms/input-text-drag-down-expected.txt: * platform/win/fast/forms/input-text-option-delete-expected.txt: * platform/win/fast/forms/input-text-scroll-left-on-blur-expected.txt: * platform/win/fast/forms/input-text-self-emptying-click-expected.txt: * platform/win/fast/forms/input-text-word-wrap-expected.txt: * platform/win/fast/forms/input-type-text-min-width-expected.txt: * platform/win/fast/forms/input-value-expected.txt: * platform/win/fast/forms/input-width-expected.txt: * platform/win/fast/forms/placeholder-pseudo-style-expected.txt: * platform/win/fast/forms/search-cancel-button-style-sharing-expected.txt: * platform/win/fast/forms/search-display-none-cancel-button-expected.txt: * platform/win/fast/forms/search-styled-expected.txt: * platform/win/fast/forms/search-vertical-alignment-expected.txt: * platform/win/fast/forms/search/search-size-with-decorations-expected.txt: * platform/win/fast/forms/tabbing-input-iframe-expected.txt: * platform/win/fast/forms/text-control-intrinsic-widths-expected.txt: * platform/win/fast/forms/textfield-focus-ring-expected.txt: * platform/win/fast/forms/textfield-outline-expected.txt: * platform/win/fast/forms/textfield-overflow-expected.txt: * platform/win/fast/forms/visual-hebrew-text-field-expected.txt: * platform/win/fast/frames/take-focus-from-iframe-expected.txt: * platform/win/fast/html/details-no-summary4-expected.txt: * platform/win/fast/html/details-open-javascript-expected.txt: * platform/win/fast/html/details-open2-expected.txt: * platform/win/fast/html/details-open4-expected.txt: * platform/win/fast/lists/dynamic-marker-crash-expected.txt: * platform/win/fast/replaced/replaced-breaking-expected.txt: * platform/win/fast/replaced/replaced-breaking-mixture-expected.txt: * platform/win/fast/table/colspanMinWidth-expected.txt: * platform/win/fast/table/spanOverlapRepaint-expected.txt: * platform/win/fast/table/text-field-baseline-expected.txt: * platform/win/fast/text/textIteratorNilRenderer-expected.txt: * platform/win/fast/transforms/transformed-focused-text-input-expected.txt: * platform/win/svg/hixie/mixed/003-expected.txt: * platform/win/tables/mozilla/bugs/bug1188-expected.txt: * platform/win/tables/mozilla/bugs/bug12384-expected.txt: * platform/win/tables/mozilla/bugs/bug18359-expected.txt: * platform/win/tables/mozilla/bugs/bug24200-expected.txt: * platform/win/tables/mozilla/bugs/bug2479-2-expected.txt: * platform/win/tables/mozilla/bugs/bug2479-3-expected.txt: * platform/win/tables/mozilla/bugs/bug2479-4-expected.txt: * platform/win/tables/mozilla/bugs/bug28928-expected.txt: * platform/win/tables/mozilla/bugs/bug4382-expected.txt: * platform/win/tables/mozilla/bugs/bug4527-expected.txt: * platform/win/tables/mozilla/bugs/bug46368-1-expected.txt: * platform/win/tables/mozilla/bugs/bug46368-2-expected.txt: * platform/win/tables/mozilla/bugs/bug51037-expected.txt: * platform/win/tables/mozilla/bugs/bug55545-expected.txt: * platform/win/tables/mozilla/bugs/bug59354-expected.txt: * platform/win/tables/mozilla/bugs/bug7342-expected.txt: * platform/win/tables/mozilla/bugs/bug96334-expected.txt: * platform/win/tables/mozilla/bugs/bug99948-expected.txt: * platform/win/tables/mozilla/dom/tableDom-expected.txt: * platform/win/tables/mozilla/other/move_row-expected.txt: * platform/win/tables/mozilla_expected_failures/bugs/bug2479-5-expected.txt: * platform/win/tables/mozilla_expected_failures/bugs/bug92647-1-expected.txt: * rendering/ComplexLineLayout.cpp: (WebCore::ComplexLineLayout::addOverflowFromInlineChildren): * rendering/RenderBlockFlow.h: (WebCore::RenderBlockFlow::endPaddingWidthForCaret const): * rendering/RenderTextControlSingleLine.cpp: (WebCore::RenderTextControlSingleLine::preferredContentLogicalWidth const): 2020-06-15 Pavel Feldman <pavel.feldman@gmail.com> Web Inspector: introduce request interception https://bugs.webkit.org/show_bug.cgi?id=207446 Reviewed by Devin Rousso. This change introduces network request interception to the Network protocol domain. It adds Network.interceptWithRequest notification that can be continued, modified or fulfilled. NetworkStage enum can now have 'request' and 'response' values. Tests: http/tests/inspector/network/intercept-aborted-request.html http/tests/inspector/network/intercept-request-continue.html http/tests/inspector/network/intercept-request-fragment.html http/tests/inspector/network/intercept-request-main-resource-with-response.html http/tests/inspector/network/intercept-request-main-resource.html http/tests/inspector/network/intercept-request-properties.html http/tests/inspector/network/intercept-request-subresource-with-error.html http/tests/inspector/network/intercept-request-subresource-with-response.html http/tests/inspector/network/intercept-request-subresource.html http/tests/inspector/network/intercept-request-with-response.html * inspector/InspectorInstrumentation.cpp: (WebCore::InspectorInstrumentation::willInterceptImpl): (WebCore::InspectorInstrumentation::shouldInterceptRequestImpl): (WebCore::InspectorInstrumentation::interceptRequestImpl): * inspector/InspectorInstrumentation.h: (WebCore::InspectorInstrumentation::willIntercept): (WebCore::InspectorInstrumentation::shouldInterceptRequest): (WebCore::InspectorInstrumentation::interceptRequest): * inspector/InspectorInstrumentationWebKit.cpp: (WebCore::InspectorInstrumentationWebKit::shouldInterceptRequestInternal): (WebCore::InspectorInstrumentationWebKit::interceptRequestInternal): * inspector/InspectorInstrumentationWebKit.h: (WebCore::InspectorInstrumentationWebKit::shouldInterceptRequest): (WebCore::InspectorInstrumentationWebKit::interceptRequest): * inspector/agents/InspectorNetworkAgent.cpp: (WebCore::InspectorNetworkAgent::disable): (WebCore::InspectorNetworkAgent::shouldIntercept): (WebCore::InspectorNetworkAgent::continuePendingRequests): (WebCore::InspectorNetworkAgent::setInterceptionEnabled): (WebCore::InspectorNetworkAgent::addInterception): (WebCore::InspectorNetworkAgent::removeInterception): (WebCore::InspectorNetworkAgent::willIntercept): (WebCore::InspectorNetworkAgent::shouldInterceptRequest): (WebCore::InspectorNetworkAgent::shouldInterceptResponse): (WebCore::InspectorNetworkAgent::interceptRequest): (WebCore::InspectorNetworkAgent::interceptContinue): (WebCore::InspectorNetworkAgent::interceptWithRequest): (WebCore::InspectorNetworkAgent::interceptRequestWithResponse): (WebCore::InspectorNetworkAgent::interceptRequestWithError): * inspector/agents/InspectorNetworkAgent.h: (WebCore::InspectorNetworkAgent::PendingInterceptRequest::PendingInterceptRequest): (WebCore::InspectorNetworkAgent::PendingInterceptRequest::continueWithOriginalRequest): (WebCore::InspectorNetworkAgent::PendingInterceptRequest::continueWithRequest): (WebCore::InspectorNetworkAgent::Intercept::operator== const): * loader/cache/CachedResourceLoader.cpp: (WebCore::CachedResourceLoader::requestResource): (WebCore::CachedResourceLoader::preload): 2020-06-15 Keith Miller <keith_miller@apple.com> JIT thunks should work on arm64_32 https://bugs.webkit.org/show_bug.cgi?id=213103 Reviewed by Saam Barati. Refactor timesPtr() to ScalePtr. * cssjit/SelectorCompiler.cpp: (WebCore::SelectorCompiler::SelectorCodeGenerator::generateElementHasClasses): 2020-06-15 Sihui Liu <sihui_liu@apple.com> Text manipulation does not observe newly displayed element inside previously observed content https://bugs.webkit.org/show_bug.cgi?id=213156 Reviewed by Darin Adler. Fix two issues: 1. Some inserted nodes are marked as manipulated, but they are inserted because they get removed in the replacement process, not because they are manipulated or in the range of item. 2. TextManipulationController does not perform manipulation on an element if its ancestor is manipulated. This means the newly inserted/displayed children of a manipulated element are ruled out for manipulation. Test: TextManipulation.CompleteTextManipulationForNewlyDisplayedParagraph * editing/TextManipulationController.cpp: (WebCore::TextManipulationController::observeParagraphs): (WebCore::TextManipulationController::didCreateRendererForElement): (WebCore::TextManipulationController::updateInsertions): (WebCore::TextManipulationController::replace): (WebCore::TextManipulationController::isInManipulatedElement): Deleted. * editing/TextManipulationController.h: 2020-06-15 Víctor Manuel Jáquez Leal <vjaquez@igalia.com> Suppress compiler warnings https://bugs.webkit.org/show_bug.cgi?id=213034 Reviewed by Darin Adler. Use PRIu64 formatter for uint64_t instead of %llu. No functional changes. * Modules/indexeddb/server/UniqueIDBDatabase.cpp: (WebCore::IDBServer::UniqueIDBDatabase::putOrAdd): 2020-06-15 ChangSeok Oh <changseok@webkit.org> [GTK] Use GRefPtr for ManetteMonitor https://bugs.webkit.org/show_bug.cgi?id=213094 Reviewed by Carlos Garcia Campos. We should use GRefPtr for ManetteMonitor, but not GUniquePtr. Because it is a gobject instance. No new tests because of no functionality changed. * platform/gamepad/manette/ManetteGamepadProvider.h: 2020-06-15 Alexey Shvayka <shvaikalesh@gmail.com> super should not depend on __proto__ https://bugs.webkit.org/show_bug.cgi?id=157972 Reviewed by Saam Barati. No new tests, no behavior change. * bindings/scripts/CodeGeneratorJS.pm: (GenerateHeader): Set OverridesGetPrototype structure flag for CustomGetPrototype IDL attribute. 2020-06-15 Philippe Normand <pnormand@igalia.com> [GStreamer] ImageDecoder hits Debug ASSERTs https://bugs.webkit.org/show_bug.cgi?id=213178 Reviewed by Xabier Rodriguez-Calvar. Pass a reference of the decoder to its inner implementation instead of a WeakPtr, which can't be used across multiple threads. Covered by fast/images/animated-image-mp4{,-crash}.html tests. * platform/graphics/gstreamer/ImageDecoderGStreamer.cpp: (WebCore::ImageDecoderGStreamer::InnerDecoder::connectDecoderPad): * platform/graphics/gstreamer/ImageDecoderGStreamer.h: 2020-06-15 Youenn Fablet <youenn@apple.com> Simplify MediaRecorderPrivateWriterCocoa threading logic https://bugs.webkit.org/show_bug.cgi?id=213126 Reviewed by Eric Carlson. Always hop to the main thread when receiving compressed samples. This makes the threading model simpler and pushing enqueued samples in the writer is not very performance sensitive. Add handling of the special case of video samples being pushed but no compressed sample is yet produced. In that case, when stopping recording, the samples will be pushed and we will start the writer. Minor refactoring to remove some unnecessary checks and make sure some of the member fields gets initialized in their declaration. Covered by existing tests. * platform/mediarecorder/cocoa/AudioSampleBufferCompressor.h: * platform/mediarecorder/cocoa/AudioSampleBufferCompressor.mm: (WebCore::AudioSampleBufferCompressor::~AudioSampleBufferCompressor): * platform/mediarecorder/cocoa/MediaRecorderPrivateWriterCocoa.h: * platform/mediarecorder/cocoa/MediaRecorderPrivateWriterCocoa.mm: (WebCore::MediaRecorderPrivateWriter::compressedVideoOutputBufferCallback): (WebCore::MediaRecorderPrivateWriter::compressedAudioOutputBufferCallback): (WebCore::MediaRecorderPrivateWriter::processNewCompressedVideoSampleBuffers): (WebCore::MediaRecorderPrivateWriter::processNewCompressedAudioSampleBuffers): (WebCore::MediaRecorderPrivateWriter::stopRecording): * platform/mediarecorder/cocoa/VideoSampleBufferCompressor.h: * platform/mediarecorder/cocoa/VideoSampleBufferCompressor.mm: (WebCore::VideoSampleBufferCompressor::~VideoSampleBufferCompressor): 2020-06-15 Youenn Fablet <youenn@apple.com> Add a quirk to allow starting AudioContext if document was interacted https://bugs.webkit.org/show_bug.cgi?id=213118 Reviewed by Eric Carlson. Manually tested on bing.com. * Modules/webaudio/AudioContext.cpp: (WebCore::isDocumentAllowingAutoplayWebAudio): (WebCore::AudioContext::willBeginPlayback): * page/Quirks.cpp: (WebCore::Quirks::shouldAutoplayWebAudioForArbitraryUserGesture const): * page/Quirks.h: 2020-06-15 Tetsuharu Ohzeki <tetsuharu.ohzeki@gmail.com> Move textFromUTF8() to TextResourceDecoder from FetchBodyConsumer https://bugs.webkit.org/show_bug.cgi?id=213170 Reviewed by Youenn Fablet. This function abstracts https://encoding.spec.whatwg.org/#utf-8-decode so I think it's better to place to `TextResourceDecoder`. * Modules/fetch/FetchBodyConsumer.cpp: (WebCore::resolveWithTypeAndData): (WebCore::FetchBodyConsumer::takeAsText): * loader/TextResourceDecoder.cpp: (WebCore::shouldPrependBOM): (WebCore::TextResourceDecoder::textFromUTF8): * loader/TextResourceDecoder.h: 2020-06-15 Youenn Fablet <youenn@apple.com> MediaRecorder should not be collectable when fetching data from its backend https://bugs.webkit.org/show_bug.cgi?id=213121 Reviewed by Eric Carlson. Take a pending activity when fetching data since we might want dispatch an event when receiving the fetch data. Covered by existing tests no longer crashing in debug. * Modules/mediarecorder/MediaRecorder.cpp: (WebCore::MediaRecorder::stopRecording): (WebCore::MediaRecorder::requestData): 2020-06-14 Sergio Villar Senin <svillar@igalia.com> Unreviewed, reverting r262124. Twitter videos go blank after exiting fullscreen Reverted changeset: "[css-flex] Allow indefinite size flex items to be definite wrt resolving percentages inside them" https://bugs.webkit.org/show_bug.cgi?id=212264 https://trac.webkit.org/changeset/262124 2020-06-14 Sam Weinig <weinig@apple.com> [WPT] html/webappapis/system-state-and-capabilities/the-navigator-object/navigator-pluginarray.html fails due to lack of caching of Plugin objects https://bugs.webkit.org/show_bug.cgi?id=213185 Reviewed by Darin Adler. Tests: - Updates results for web-platform-tests/html/webappapis/system-state-and-capabilities/the-navigator-object/navigator-pluginarray.html which now passes. - Splits up http/tests/plugins/plugin-javascript-access.html, adding http/tests/plugins/plugin-javascript-access-allow-all-plugins.html which tests the internals.setShowAllPlugins(true) case. This was required now that the plugin and mimetype arrays are immutable after creation. Overhaul web exposed plugin APIs: - All DOMPlugin and DOMMimeTypes are now created together (along with the DOMPluginArray and DOMMimeTypeArray) on first access of either navigator.plugins or navigator.mimeTypes. - DOMPlugins are created and stored in the DOMPluginArray (fixing the initial lack of caching issue) - DOMMimeTypes are created and stored in the DOMMimeTypeArray. - DOMPlugins hold a strong reference to their associated DOMMimeType. The DOMMimeType has a weak reference back to the DOMPlugin. This means for a single executation context, we only ever create one DOMPlugin / DOMMimeType for each underlying plugin / mimetype. - Update GC so that DOMPlugin and DOMMimeType (in addition to DOMPluginArray and DOMMimeTypeArray which were already doing this) use navigator reachability for their lifetime. This is almost correct, except if we ever implement DOMPluginArray.refresh(false) to match the spec, in which case you could end up with some DOMPlugins and DOMMimeTypes that are marked as reachable when they really are not, but only plugins that were removed. This seems so unlikely to matter that implementing a more strict reachability function seems like the wrong way to go. * CMakeLists.txt: * DerivedSources-input.xcfilelist: * DerivedSources.make: * WebCore.xcodeproj/project.pbxproj: Add NavigatorPlugins.idl * loader/SubframeLoader.cpp: (WebCore::findPluginMIMETypeFromURL): (WebCore::logPluginRequest): Simplify and cleanup code making use of the new webVisibleMimeTypes() rather than the clunky getWebVisibleMimesAndPluginIndices(). * page/Navigator.cpp: * page/Navigator.h: (WebCore::Navigator::initializePluginAndMIMETypeArrays): (WebCore::Navigator::plugins): (WebCore::Navigator::mimeTypes): Fully initialize Navigator.plugins/mimeTypes on first access of either, following the specified behavior that they should not change after initial access for a script execution context. This also ensures we always return the same wrappers for these objects on multiple accesses, something the spec mandates but we failed to do prior. In addition, we now correctly sort the plugins by name and mimeTypes by type, also as specified. * page/Navigator.idl: * page/NavigatorPlugins.idl: Added. Split NavigatorPlugins out of Navigator.idl as specified. No functional change but makes things nicer when we match the spec closer. * plugins/DOMMimeType.cpp: (WebCore::DOMMimeType::DOMMimeType): (WebCore::DOMMimeType::suffixes const): (WebCore::DOMMimeType::enabledPlugin const): * plugins/DOMMimeType.h: (WebCore::DOMMimeType::create): (WebCore::DOMMimeType::navigator): * plugins/DOMMimeType.idl: * plugins/DOMMimeTypeArray.cpp: (WebCore::DOMMimeTypeArray::DOMMimeTypeArray): (WebCore::DOMMimeTypeArray::length const): (WebCore::DOMMimeTypeArray::item): (WebCore::DOMMimeTypeArray::namedItem): (WebCore::DOMMimeTypeArray::supportedPropertyNames): (WebCore::DOMMimeTypeArray::getPluginData const): Deleted. * plugins/DOMMimeTypeArray.h: * plugins/DOMPlugin.cpp: (WebCore::DOMPlugin::DOMPlugin): (WebCore::DOMPlugin::item): (WebCore::DOMPlugin::namedItem): (WebCore::DOMPlugin::supportedPropertyNames): * plugins/DOMPlugin.h: * plugins/DOMPlugin.idl: * plugins/DOMPluginArray.cpp: (WebCore::DOMPluginArray::DOMPluginArray): (WebCore::DOMPluginArray::length const): (WebCore::DOMPluginArray::item): (WebCore::DOMPluginArray::namedItem): (WebCore::DOMPluginArray::supportedPropertyNames): (WebCore::DOMPluginArray::pluginData const): Deleted. * plugins/DOMPluginArray.h: Rather than dynamically accessing plugin information through Page on each interaction with the DOM plugin objects, we now fully initialize them on creation, allowing for correct wrapper caching and behavior if plugins are added / removed (e.g. the arrays should not change). * plugins/PluginData.cpp: (WebCore::PluginData::initPlugins): (WebCore::PluginData::publiclyVisiblePluginsAndAdditionalWebVisiblePlugins const): (WebCore::PluginData::webVisibleMimeTypes const): (WebCore::supportsMimeTypeForPlugins): (WebCore::PluginData::supportsMimeType const): (WebCore::PluginData::supportsWebVisibleMimeType const): (WebCore::PluginData::supportsWebVisibleMimeTypeForURL const): (WebCore::PluginData::pluginFileForWebVisibleMimeType const): (WebCore::PluginData::publiclyVisiblePlugins const): Deleted. (WebCore::PluginData::getWebVisibleMimesAndPluginIndices const): Deleted. (WebCore::PluginData::getMimesAndPluginIndices const): Deleted. (WebCore::PluginData::getMimesAndPluginIndiciesForPlugins const): Deleted. (WebCore::PluginData::getPluginInfoForWebVisibleMimeType const): Deleted. * plugins/PluginData.h: Simplify interface by removing out parameter based getWebVisibleMimesAndPluginIndices (and helpers) and adding more straigtword alternatives. getWebVisibleMimesAndPluginIndices was useful for the old DOM plugin model, but now that the arrays are initialized all together, it no longer provides an optimization. Instead, all callers really just want a either a list of MimeClassInfos or to know if one is supported under a specific scenario, so we now just expose that. 2020-06-14 Sam Weinig <weinig@apple.com> [WPT] websockets/Close-reason-unpaired-surrogates.any.html fails due to failure to convert unpaired surrogates to replacement character for close reason https://bugs.webkit.org/show_bug.cgi?id=213182 Reviewed by Darin Adler. Now passing the following tests: imported/w3c/web-platform-tests/websockets/Close-reason-unpaired-surrogates.any.html imported/w3c/web-platform-tests/websockets/Close-reason-unpaired-surrogates.any.worker.html imported/w3c/web-platform-tests/websockets/Secure-Close-Reason-Unpaired-surrogates.any.html imported/w3c/web-platform-tests/websockets/Secure-Close-Reason-Unpaired-surrogates.any.worker.html * Modules/websockets/WebSocket.idl: Match spec (https://html.spec.whatwg.org/multipage/web-sockets.html#the-websocket-interface) by making the reason argument in close() a USVString rather than a DOMString. This causes all unpaired surrogates to be replaced with \uFFFD, the replacement character. 2020-06-14 Tetsuharu Ohzeki <tetsuharu.ohzeki@gmail.com> Withdraw FileReaderSync from ServiceWorker https://bugs.webkit.org/show_bug.cgi?id=213136 Reviewed by Darin Adler. `FileReaderSync` is not exposed for ServiceWorker. - https://w3c.github.io/FileAPI/#FileReaderSync - https://github.com/w3c/FileAPI/issues/16 We does not support SharedWorker. We don't have to care about it. * fileapi/FileReaderSync.idl: 2020-06-13 Rob Buis <rbuis@igalia.com> https://bugs.webkit.org/show_bug.cgi?id=213166 Rename executeIfJavaScriptURL to executeJavaScriptURL Reviewed by Darin Adler. Rename executeIfJavaScriptURL to executeJavaScriptURL in order to make the function unconditional, i.e. the passed url is expected to have the javascript protocol, this is asserted first thing in the method. This allows us to remove the return parameter since the remaining return statements all return true. * bindings/js/ScriptController.cpp: (WebCore::ScriptController::executeJavaScriptURL): (WebCore::ScriptController::executeIfJavaScriptURL): Deleted. * bindings/js/ScriptController.h: * loader/FrameLoader.cpp: (WebCore::FrameLoader::changeLocation): (WebCore::FrameLoader::submitForm): * loader/SubframeLoader.cpp: (WebCore::FrameLoader::SubframeLoader::requestFrame): 2020-06-13 Zalan Bujtas <zalan@apple.com> [LFC][Floats] Floating positioned box is always a float avoider. https://bugs.webkit.org/show_bug.cgi?id=213162 Reviewed by Darin Adler. Test: fast/layoutformattingcontext/inline-float-simple.html * layout/layouttree/LayoutBox.cpp: (WebCore::Layout::Box::isFloatAvoider const): also fix the independent formatting context case. 2020-06-13 Sam Weinig <weinig@apple.com> [WPT] dom/nodes/Document-createCDATASection-xhtml.xhtml fails due to missing exception in Document.createCDATASection() https://bugs.webkit.org/show_bug.cgi?id=213167 Reviewed by Yusuke Suzuki. Tested by existing (formerly failing) test: imported/w3c/web-platform-tests/dom/nodes/Document-createCDATASection-xhtml.xhtml Throw an "InvalidCharacterError" DOMException if the data passed to createCDATASection contains the string "]]>" as specified by https://dom.spec.whatwg.org/#dom-document-createcdatasection * dom/Document.cpp: (WebCore::Document::createCDATASection): 2020-06-13 Michael Catanzaro <mcatanzaro@gnome.org> Obsolete comment in FontCustomPlatformDataFreeType.cpp https://bugs.webkit.org/show_bug.cgi?id=213169 Unreviewed, remove the stale comment. * platform/graphics/freetype/FontCustomPlatformDataFreeType.cpp: (WebCore::defaultFontconfigOptions): 2020-06-13 Sam Weinig <weinig@apple.com> Extended Color: Experiment with strongly typed ColorComponents https://bugs.webkit.org/show_bug.cgi?id=212396 Reviewed by Darin Adler. Adds simple explicit types for sRGBA, LinearSRGBA, DisplayP3, LinearDisplayP3, XYZA and HSLA colors. Conversion to/from ColorComponents<float> is easy but explicit to make conversions easier to spot. The goal is to add type clarity (you know when you are dealing with an sRGB color vs. a DisplayP3 color) and make dealing with the colors nicer (color.red rather than color[0]). It also allows us to simplify the naming of functions that convert between color types as now only the output type needs to be in the function name. * Headers.cmake: Add new header, ColorTypes.h * WebCore.xcodeproj/project.pbxproj: Add new header, ColorTypes.h * css/parser/CSSPropertyParserHelpers.cpp: (WebCore::CSSPropertyParserHelpers::parseHSLParameters): Switch from hslToSRGB({ ... }) to toSRGBA(HSLAColor { ... }) * editing/cocoa/DataDetection.mm: (WebCore::DataDetection::detectContentInRange): Update to use toHSLA() and HSLA<float> making the code a bit more readable. * platform/graphics/Color.cpp: (WebCore::Color::lightened const): (WebCore::Color::darkened const): (WebCore::Color::isDark const): (WebCore::Color::lightness const): (WebCore::Color::luminance const): (WebCore::Color::colorSpaceAndComponents const): (WebCore::Color::toSRGBASimpleColorLossy const): (WebCore::Color::toSRGBALossy const): (WebCore::Color::toSRGBAComponentsLossy const): Deleted. * platform/graphics/Color.h: Renames toSRGBAComponentsLossy() to toSRGBALossy() which now returns a SRGBA<float>. * platform/graphics/ColorMatrix.h: (WebCore::ColorMatrix::transformColorComponents const): Deleted. Remove transformColorComponents, keeping just transformedColorComponents to simplify the interface. With late conversion to ColorComponents, the latter is more straightforward to use in most cases anyway. * platform/graphics/ColorUtilities.cpp: (WebCore::linearToRGBColorComponent): (WebCore::rgbToLinearColorComponent): (WebCore::toLinearSRGBA): (WebCore::toSRGBA): (WebCore::toLinearDisplayP3): (WebCore::toDisplayP3): (WebCore::toXYZ): (WebCore::lightness): (WebCore::luminance): (WebCore::contrastRatio): (WebCore::toHSLA): (WebCore::premultiplied): (WebCore::rgbToLinearComponents): Deleted. (WebCore::linearToRGBComponents): Deleted. (WebCore::xyzToLinearSRGB): Deleted. (WebCore::linearSRGBToXYZ): Deleted. (WebCore::XYZToLinearP3): Deleted. (WebCore::linearP3ToXYZ): Deleted. (WebCore::p3ToSRGB): Deleted. (WebCore::sRGBToP3): Deleted. (WebCore::sRGBToHSL): Deleted. (WebCore::hslToSRGB): Deleted. * platform/graphics/ColorUtilities.h: Rename / rework conversion and utility functions to operate on explicit Color types. In doing so, simplify the names of the conversion functions so only name the output type. For instance: ColorComponents<float> p3ToSRGB(const ColorComponents<float>&); is now SRGBA<float> toSRGBA(const DisplayP3<float>&); as the input type is implicit in the call. A little duplication was needed for linearToRGBColorComponent/rgbToLinearColorComponent (as it was used for both sRGB and DisplayP3 linearization), but mostly things stay the same. * platform/graphics/ExtendedColor.cpp: (WebCore::ExtendedColor::toSRGBALossy const): (WebCore::ExtendedColor::toSRGBAComponentsLossy const): Deleted. * platform/graphics/ExtendedColor.h: Renamed toSRGBAComponentsLossy() to toSRGBALossy() and have it return a SRGBA<float>. * platform/graphics/SimpleColor.h: (WebCore::SimpleColor::asSRGBA const): (WebCore::makeSimpleColor): (WebCore::SimpleColor::asSRGBFloatComponents const): Deleted. Rename asSRGBFloatComponents() to asSRGBA<T>() and have it return a SRGBA<float>. Replace makeSimpleColor taking FloatComponents with one taking a SRGBA<float>, making it much clearer that this is only valid for sRGB. * platform/graphics/filters/FELighting.cpp: (WebCore::FELighting::drawLighting): Rework to support seperate types for SRGB<float> and LinearSRGBA<float>. * platform/graphics/filters/FELighting.cpp: (WebCore::FELighting::drawLighting): * platform/graphics/filters/FilterOperation.cpp: (WebCore::BasicColorMatrixFilterOperation::transformColor const): (WebCore::BasicComponentTransferFilterOperation::transformColor const): (WebCore::InvertLightnessFilterOperation::transformColor const): (WebCore::InvertLightnessFilterOperation::inverseTransformColor const): * platform/graphics/filters/FilterOperation.h: (WebCore::FilterOperation::transformColor const): (WebCore::FilterOperation::inverseTransformColor const): * platform/graphics/filters/FilterOperations.cpp: (WebCore::FilterOperations::transformColor const): (WebCore::FilterOperations::inverseTransformColor const): Use SRGBA<float> rather than ColorComponents<float> to make it clear that the filters only work on sRGB colors right now. * rendering/RenderTheme.cpp: (WebCore::RenderTheme::disabledTextColor const): * rendering/TextPaintStyle.cpp: (WebCore::textColorIsLegibleAgainstBackgroundColor): * platform/graphics/cairo/CairoUtilities.cpp: (WebCore::setSourceRGBAFromColor): * platform/graphics/cairo/GradientCairo.cpp: (WebCore::addColorStopRGBA): (WebCore::setCornerColorRGBA): (WebCore::interpolateColorStop): * platform/graphics/gtk/ColorGtk.cpp: (WebCore::Color::operator GdkRGBA const): * platform/graphics/texmap/TextureMapperGL.cpp: (WebCore::TextureMapperGL::drawBorder): (WebCore::TextureMapperGL::drawNumber): (WebCore::prepareFilterProgram): (WebCore::TextureMapperGL::drawSolidColor): (WebCore::TextureMapperGL::clearColor): * platform/graphics/win/ColorDirect2D.cpp: (WebCore::Color::operator D2D1_COLOR_F const): (WebCore::Color::operator D2D1_VECTOR_4F const): * platform/graphics/win/GradientDirect2D.cpp: (WebCore::Gradient::generateGradient): * platform/graphics/win/GraphicsContextDirect2D.cpp: (WebCore::GraphicsContext::colorWithGlobalAlpha const): Update to call toSRGBALossy() rather than toSRGBAComponentsLossy(). 2020-06-13 Tetsuharu Ohzeki <tetsuharu.ohzeki@gmail.com> Remove FileError.h https://bugs.webkit.org/show_bug.cgi?id=213119 Reviewed by Chris Dumez. * Headers.cmake: * Modules/async-clipboard/ClipboardItemBindingsDataSource.cpp: (WebCore::ClipboardItemBindingsDataSource::ClipboardItemTypeLoader::didFail): * Modules/async-clipboard/ClipboardItemBindingsDataSource.h: * Modules/mediastream/RTCDataChannel.cpp: (WebCore::RTCDataChannel::createMessageQueue): * Modules/websockets/WebSocketChannel.cpp: (WebCore::WebSocketChannel::didFail): (WebCore::WebSocketChannel::abortOutgoingFrameQueue): * Modules/websockets/WebSocketChannel.h: * WebCore.xcodeproj/project.pbxproj: * fileapi/BlobLoader.h: (WebCore::BlobLoader::didFail): * fileapi/FileError.h: Removed. * fileapi/FileReader.cpp: (WebCore::FileReader::didFail): * fileapi/FileReader.h: * fileapi/FileReaderLoader.cpp: (WebCore::FileReaderLoader::start): (WebCore::FileReaderLoader::cancel): (WebCore::FileReaderLoader::cleanup): (WebCore::FileReaderLoader::didReceiveResponse): (WebCore::FileReaderLoader::didReceiveData): (WebCore::FileReaderLoader::didFail): (WebCore::FileReaderLoader::failed): (WebCore::FileReaderLoader::toErrorCode): (WebCore::FileReaderLoader::httpStatusCodeToErrorCode): (WebCore::FileReaderLoader::arrayBufferResult const): (WebCore::FileReaderLoader::stringResult): * fileapi/FileReaderLoader.h: (WebCore::FileReaderLoader::errorCode const): * fileapi/FileReaderLoaderClient.h: * fileapi/FileReaderSync.cpp: (WebCore::FileReaderSync::startLoading): * fileapi/FileReaderSync.h: * fileapi/NetworkSendQueue.cpp: (WebCore::NetworkSendQueue::processMessages): * fileapi/NetworkSendQueue.h: * html/ImageBitmap.cpp: 2020-06-12 Simon Fraser <simon.fraser@apple.com> REGRESSION(r261985): Unable to respond to large comments on Bugzilla with always-on scrollbars https://bugs.webkit.org/show_bug.cgi?id=213135 <rdar://problem/64302086> Reviewed by Tim Horton. The combination of programmatic scrolls (e.g. anchor click, reveal selection) and user scrolling could result in a mismatch between the main thread and scrolling thread scroll positions, resulting in missing tiles and offset cursor handling. This happened if a programmatic scroll occurred and 'scrolledSinceLastCommit' was true for the equivalent scrolling node at the start of a rendering update. synchronizeStateFromScrollingTree() would take the scrolling thread's notion of the scroll position, clobbering the position resulting from the programmatic scroll. To fix this, call commitTreeStateIfNeeded() before synchronizeStateFromScrollingTree() to ensure that any programmatic scrolls have been pushed to the scrolling tree before we fetch its state. Some infrastructure is needed for testing; getting into the state where a programmatic scroll and 'scrolledSinceLastCommit' happened in the same event loop cycle required adding internals.scrollBySimulatingWheelEvent(), which just pokes the scrolling tree directly without the complexities of wheel events dispatched via the UI process. Test: scrollingcoordinator/mac/reveal-selection-tile-coverage.html * page/scrolling/AsyncScrollingCoordinator.cpp: (WebCore::AsyncScrollingCoordinator::scrollBySimulatingWheelEventForTesting): * page/scrolling/AsyncScrollingCoordinator.h: * page/scrolling/ScrollingCoordinator.h: (WebCore::ScrollingCoordinator::scrollBySimulatingWheelEventForTesting): * page/scrolling/ScrollingTree.cpp: (WebCore::ScrollingTree::scrollBySimulatingWheelEventForTesting): * page/scrolling/ScrollingTree.h: * page/scrolling/mac/ScrollingCoordinatorMac.mm: (WebCore::ScrollingCoordinatorMac::willStartRenderingUpdate): * testing/Internals.cpp: (WebCore::Internals::scrollBySimulatingWheelEvent): * testing/Internals.h: * testing/Internals.idl: 2020-06-12 David Kilzer <ddkilzer@apple.com> [IPC hardening] Check enum values in IPC::Decoder::decodeEnum() an IPC::Encoder::encodeEnum() <https://webkit.org/b/211988> <rdar://problem/63137695> Reviewed by Darin Adler. Replace decodeEnum() with decode() and encodeEnum() with operator<<(). * Modules/applicationmanifest/ApplicationManifest.h: (WebCore::ApplicationManifest::decode): * Modules/indexeddb/IDBKeyData.h: (WebCore::IDBKeyData::encode const): (WebCore::IDBKeyData::decode): * Modules/indexeddb/shared/IDBCursorInfo.h: (WebCore::IDBCursorInfo::encode const): (WebCore::IDBCursorInfo::decode): * Modules/indexeddb/shared/IDBError.h: (WebCore::IDBError::encode const): (WebCore::IDBError::decode): * Modules/indexeddb/shared/IDBGetAllRecordsData.h: (WebCore::IDBGetAllRecordsData::encode const): (WebCore::IDBGetAllRecordsData::decode): * Modules/indexeddb/shared/IDBGetRecordData.h: (WebCore::IDBGetRecordData::encode const): (WebCore::IDBGetRecordData::decode): * Modules/indexeddb/shared/IDBIterateCursorData.h: (WebCore::IDBIterateCursorData::encode const): (WebCore::IDBIterateCursorData::decode): * Modules/indexeddb/shared/IDBRequestData.h: (WebCore::IDBRequestData::encode const): (WebCore::IDBRequestData::decode): * Modules/indexeddb/shared/IDBResultData.h: (WebCore::IDBResultData::encode const): (WebCore::IDBResultData::decode): * Modules/indexeddb/shared/IDBTransactionInfo.h: (WebCore::IDBTransactionInfo::encode const): (WebCore::IDBTransactionInfo::decode): * Modules/webauthn/PublicKeyCredentialCreationOptions.h: (WebCore::PublicKeyCredentialCreationOptions::Parameters::decode): (WebCore::PublicKeyCredentialCreationOptions::AuthenticatorSelectionCriteria::decode): * Modules/webauthn/PublicKeyCredentialDescriptor.h: (WebCore::PublicKeyCredentialDescriptor::decode): * dom/ExceptionData.h: (WebCore::ExceptionData::encode const): (WebCore::ExceptionData::decode): * html/DataListSuggestionInformation.h: (WebCore::DataListSuggestionInformation::encode const): (WebCore::DataListSuggestionInformation::decode): * page/SecurityOrigin.h: (WebCore::SecurityOrigin::encode const): (WebCore::SecurityOrigin::decode): * platform/ContextMenuItem.h: (WTF::EnumTraits<WebCore::ContextMenuAction>): - Add missing ContextMenuItemTagPasteAsPlainText that was added in r261800. * platform/LinkIcon.h: (WebCore::LinkIcon::encode const): (WebCore::LinkIcon::decode): * platform/PasteboardItemInfo.h: (WebCore::PasteboardItemInfo::encode const): (WebCore::PasteboardItemInfo::decode): * platform/ScreenProperties.h: (WebCore::ScreenData::encode const): (WebCore::ScreenData::decode): * platform/graphics/InbandGenericCue.h: (WebCore::GenericCueData::encode const): * platform/graphics/Path.h: (WebCore::Path::encode const): (WebCore::Path::decode): * platform/graphics/displaylists/DisplayListItems.h: (WebCore::DisplayList::SetState::encode const): (WebCore::DisplayList::SetState::decode): (WebCore::DisplayList::DrawTiledScaledImage::encode const): (WebCore::DisplayList::DrawTiledScaledImage::decode): * platform/mediastream/CaptureDevice.h: (WebCore::CaptureDevice::encode const): * platform/mediastream/MediaConstraints.h: (WebCore::MediaConstraint::encode const): (WebCore::MediaConstraint::decode): * platform/mediastream/MediaStreamRequest.h: (WebCore::MediaStreamRequest::encode const): (WebCore::MediaStreamRequest::decode): * platform/mediastream/RealtimeMediaSourceCapabilities.h: (WebCore::CapabilityValueOrRange::encode const): (WebCore::CapabilityValueOrRange::decode): (WebCore::RealtimeMediaSourceCapabilities::encode const): (WebCore::RealtimeMediaSourceCapabilities::decode): * platform/mediastream/RealtimeMediaSourceSettings.h: (WebCore::RealtimeMediaSourceSettings::encode const): (WebCore::RealtimeMediaSourceSettings::decode): * platform/mock/MockMediaDevice.h: (WebCore::MockDisplayProperties::encode const): * platform/network/HTTPHeaderMap.h: (WebCore::HTTPHeaderMap::CommonHeader::encode const): (WebCore::HTTPHeaderMap::CommonHeader::decode): * testing/MockWebAuthenticationConfiguration.h: (WebCore::MockWebAuthenticationConfiguration::HidConfiguration::decode): (WebCore::MockWebAuthenticationConfiguration::NfcConfiguration::decode): * workers/service/ServiceWorkerContextData.h: (WebCore::ServiceWorkerContextData::decode): * workers/service/ServiceWorkerJobData.h: (WebCore::ServiceWorkerJobData::encode const): (WebCore::ServiceWorkerJobData::decode): 2020-06-12 Chris Dumez <cdumez@apple.com> Stop allowing pages served over HTTPS with "Cache-Control: no-store" into the back/forward cache https://bugs.webkit.org/show_bug.cgi?id=213147 <rdar://problem/64249683> Reviewed by Geoffrey Garen. Stop allowing pages served over HTTPS with "Cache-Control: no-store" into the back/forward cache. This is a revert of r250437 due to push back from Web developers. No new tests, updated existing tests. * history/BackForwardCache.cpp: (WebCore::canCacheFrame): 2020-06-12 Tetsuharu Ohzeki <tetsuharu.ohzeki@gmail.com> Stop to use ActiveDOMObject::setPendingActivity() for Modules/fetch https://bugs.webkit.org/show_bug.cgi?id=213037 Reviewed by Youenn Fablet. By ActiveDOMObject's comments, these methods should be replaced with using makePendingActivity(). `JSFetchRequest`/`JSFetchResponse` (as derived class of `JSDOMWrapper`) hold `FetchRequest`/`FetchResponse`, and they have `FetchBodyOwner` as a base class and keep alive it. We can replace `setPendingActivity()` calling from `FetchBodyOwner`. * Modules/fetch/FetchBodyOwner.cpp: (WebCore::FetchBodyOwner::loadBlob): (WebCore::FetchBodyOwner::finishBlobLoading): (WebCore::FetchBodyOwner::virtualHasPendingActivity const): * Modules/fetch/FetchBodyOwner.h: * Modules/fetch/FetchBodySource.cpp: (WebCore::FetchBodySource::setActive): (WebCore::FetchBodySource::setInactive): * Modules/fetch/FetchBodySource.h: 2020-06-12 Takashi Komori <Takashi.Komori@sony.com> [Curl] Implement functions to use ResourceLoadStatistics. https://bugs.webkit.org/show_bug.cgi?id=207692 Reviewed by Don Olmstead. Implement functions which are required to implement ResourceLoadStatistics for Curl port. Tests: http/tests/resourceLoadStatistics/ * CMakeLists.txt: * platform/network/curl/CookieJarDB.cpp: (WebCore::CookieJarDB::openDatabase): (WebCore::CookieJarDB::setCookie): (WebCore::CookieJarDB::allDomains): (WebCore::CookieJarDB::deleteCookiesForHostname): * platform/network/curl/CookieJarDB.h: * platform/network/curl/NetworkStorageSessionCurl.cpp: (WebCore::NetworkStorageSession::setCookiesFromDOM const): (WebCore::NetworkStorageSession::setCookies): (WebCore::NetworkStorageSession::deleteCookiesForHostnames): (WebCore::NetworkStorageSession::getHostnamesWithCookies): 2020-06-12 Andres Gonzalez <andresg_22@apple.com> In isolated tree mode 2, AXIsolatedObject::setChildrenIDs should be called only on secondary thread. https://bugs.webkit.org/show_bug.cgi?id=213124 Reviewed by Chris Fleizach. Covered by existing tests. - AXIsolatedTree::createSubtree was calling AXIsolatedObject::setChildrenIDs which should be called only on the secondary thread. Now it is queueing the children update under lock. - The unsigned int range for object IDs was being overrun for large number of objects like in the case of the sample page in <rdar://problem/59331146>. Increased the size of AXID to size_t. - Better handle the case of invalid object IDs, although this needs more work, since we should never encounter this case. * accessibility/AccessibilityObjectInterface.h: AXID are now size_t instead of unsigned ints. * accessibility/isolatedtree/AXIsolatedObject.cpp: (WebCore::AXIsolatedObject::AXIsolatedObject): (WebCore::AXIsolatedObject::setChildrenIDs): Inlined in header. * accessibility/isolatedtree/AXIsolatedObject.h: * accessibility/isolatedtree/AXIsolatedTree.cpp: (WebCore::AXIsolatedTree::createSubtree): 2020-06-12 Andy Estes <aestes@apple.com> FileInputType should use WeakPtr for FileListCreator lambdas https://bugs.webkit.org/show_bug.cgi?id=213130 <rdar://problem/64276591> Reviewed by David Kilzer. FileInputType::filesChosen was passing a completion handler to FileListCreator::create that captured |this|. If the FileListCreator instance still existed when |this| was destroyed, FileInputType::~FileInputType would clear the captured |this| by calling FileListCreator::clear. This can be simplified by having the FileListCreator completion handler capture a WeakPtr to |this|. Also, when FileInputType::allowsDirectories is false, m_fileListCreator would not be properly cleared after creating the file list. The FileListCreator completion handler would set m_fileListCreator to nullptr, but would be executed *before* FileListCreator::create returned and set m_fileListCreator to the newly-created FileListCreator object. Fixed this by having FileListCreator::create execute the completion handler immediately and return nullptr in cases where a FileListCreator does not need to be created for directory resolution. Covered by existing tests. * html/FileInputType.cpp: (WebCore::FileInputType::~FileInputType): (WebCore::FileInputType::filesChosen): * html/FileInputType.h: * html/FileListCreator.cpp: (WebCore::createFileList): (WebCore::FileListCreator::create): (WebCore::FileListCreator::FileListCreator): (WebCore::FileListCreator::createFileList): * html/FileListCreator.h: (WebCore::FileListCreator::create): Deleted. 2020-06-12 Antti Koivisto <antti@apple.com> REGRESSION (r262618): Very slow typing in a github issue https://bugs.webkit.org/show_bug.cgi?id=213137 <rdar://problem/64214117> Reviewed by Darin Adler. Test: fast/media/media-query-keyframes-resolution-count.html If a stylesheet had multiple media queries and one of them forced static resolution (by containing @keyframes rule for example) we would end up reseting the style multiple times and forcing unneeded style resolutions. * style/RuleSet.cpp: (WebCore::Style::RuleSet::evaluteDynamicMediaQueryRules): We can't bail out from the loop. Even though the result is known we still need to loop to save the evaluation result for all media queries. 2020-06-12 Tetsuharu Ohzeki <tetsuharu.ohzeki@gmail.com> FileReader.error should be DOMException now https://bugs.webkit.org/show_bug.cgi?id=213117 Reviewed by Chris Dumez. By the [lastest spec](https://w3c.github.io/FileAPI/), `FileReader.error` should return `DOMException` and this remove obsoleted `FileError` from exposed interfaces. Internally, our codebase still depends on `fileapi/FileError.h` in everywhere. I'll plan to create a patch to refactor them. * CMakeLists.txt: * DerivedSources-input.xcfilelist: * DerivedSources-output.xcfilelist: * DerivedSources.make: * Sources.txt: * WebCore.order: * WebCore.xcodeproj/project.pbxproj: * fileapi/FileError.idl: Removed. * fileapi/FileReader.cpp: (WebCore::FileReader::abort): (WebCore::FileReader::didFail): * fileapi/FileReader.h: * fileapi/FileReader.idl: * fileapi/FileReaderSync.cpp: (WebCore::FileReaderSync::errorCodeToException): * fileapi/FileReaderSync.h: 2020-06-12 Zalan Bujtas <zalan@apple.com> [LFC][TFC] Add support for min/max-width https://bugs.webkit.org/show_bug.cgi?id=213111 Reviewed by Antti Koivisto. Apply min/max-width to constrain the available width for the table content. Test: fast/layoutformattingcontext/table-min-max-width-simple.html * layout/blockformatting/BlockFormattingContext.cpp: (WebCore::Layout::BlockFormattingContext::computeWidthAndMargin): (WebCore::Layout::BlockFormattingContext::computedWidthAndMargin): * layout/blockformatting/BlockFormattingContext.h: * layout/blockformatting/tablewrapper/TableWrapperBlockFormattingContext.cpp: (WebCore::Layout::TableWrapperBlockFormattingContext::computeWidthAndMarginForTableBox): 2020-06-12 Antti Koivisto <antti@apple.com> Relative font size values (em) within CSS animations compound https://bugs.webkit.org/show_bug.cgi?id=194749 <rdar://problem/48171898> Reviewed by Antoine Quint. The em unit should be relative to the font size of the parent style when resolving 'font-size' property. We weren't passing the parent style when resolving keyframes. Test case by Scott Kellum. Test: animations/keyframe-em-unit.html * style/StyleResolver.cpp: (WebCore::Style::Resolver::styleForKeyframe): * style/StyleResolver.h: (WebCore::Style::Resolver::overrideDocumentElementStyle const): (WebCore::Style::Resolver::setOverrideDocumentElementStyle): (WebCore::Style::Resolver::setParentElementStyleForKeyframes): Add a way to pass the parent element style directly to the style resolver. This should really be passed via the animation system like other context but that requires lots of refactoring. * style/StyleTreeResolver.cpp: (WebCore::Style::TreeResolver::createAnimatedElementUpdate): Pass it. 2020-06-11 Sam Weinig <weinig@apple.com> Document.currentScript does not work for SVGScriptElements https://bugs.webkit.org/show_bug.cgi?id=213104 Reviewed by Yusuke Suzuki. Updates results for existing tests. * WebCore.xcodeproj/project.pbxproj: Add CurrentScriptIncrementer.h to the Xcode project as it was missing. * dom/CurrentScriptIncrementer.h: (WebCore::CurrentScriptIncrementer::CurrentScriptIncrementer): (WebCore::CurrentScriptIncrementer::~CurrentScriptIncrementer): Re-work using ScriptElement, removing the HTMLScriptElement checks. Also changes scriptType check to explicitly check that against classic scripts, as they are the only supported type, and if any types other than modules are added in the future, we would not want this to change behavior. * dom/Document.cpp: (WebCore::Document::pushCurrentScript): * dom/Document.h: (WebCore::Document::currentScript const): Use an Element, rather than an HTMLScriptElement for currentScript/currentScriptStack so that either an HTMLScriptElement or an SVGScriptElement can be stored. Using a ScriptElement would be possible, but would complicate the implementation unnecessarily by requiring currentScript to have an additional checks before extracting the Element. Variant<RefPtr<HTMLScriptElement>, RefPtr<SVGScriptElement>> could also have been used but also would unnecessarily complicated the interface and caused more memory to be used. * dom/Document.idl: Update interface to use Element rather HTMLScriptElement with a comment explaining why we are not using HTMLOrSVGScriptElement but retaining the same observable behavior. * dom/ScriptElement.cpp: (WebCore::ScriptElement::executeClassicScript): (WebCore::ScriptElement::executeModuleScript): Pass *this directly to CurrentScriptIncrementer to simplify implementation. 2020-06-12 Carlos Garcia Campos <cgarcia@igalia.com> [GTK4] Make WebDriver work https://bugs.webkit.org/show_bug.cgi?id=212316 Reviewed by Adrian Perez de Castro. Add helper gtk definitions to avoid ifdefs and implement currentScreenMonitor() for GTK4. * platform/gtk/GtkVersioning.h: (gtk_window_move): (gtk_window_minimize): (gtk_window_unminimize): * platform/gtk/PlatformScreenGtk.cpp: (WebCore::currentScreenMonitor): (WebCore::screenRect): (WebCore::screenAvailableRect): (WebCore::getCurrentScreenMonitor): Deleted. 2020-06-11 David Kilzer <ddkilzer@apple.com> [IPC] Add WTF::EnumTraits<> for every enum type used in IPC <https://webkit.org/b/213093> Reviewed by Darin Adler. Summary: - Change underlying type of enum class to `bool` when there are only two values. In some cases, reorder the two values so the mapping to 0 and 1 makes more sense. Converting every enum to an enum class is not a goal of this patch, so some two-value enums stil have WTF::EnumTraits<> defined as noted below. - Add WTF::EnumTraits<> for the remaining enum types that are used by IPC::Encoder::encodeEnum() and IPC::Decoder::decodeEnum() so that WTF::isValidEnum<>() checks may be added next. - Add #include <WebCore/LibWebRTCEnumTraits.h> as needed. * Headers.cmake: * WebCore.xcodeproj/project.pbxproj: - Add LibWebRTCEnumTraits.h to project. Keep these definitions separate from the libwebrtc project cut down on changes to re-merge after updating. * platform/mediastream/libwebrtc/LibWebRTCEnumTraits.h: Add. * Modules/applepay/ApplePaySessionPaymentRequest.h: * Modules/indexeddb/IDBTransactionMode.h: * Modules/indexeddb/IndexedDB.h: (WTF::EnumTraits<WebCore::IndexedDB::IndexRecordType>): - Remove after changing enum class to bool. * Modules/indexeddb/shared/IDBGetRecordData.h: * Modules/indexeddb/shared/IDBResultData.h: * WebCore.xcodeproj/project.pbxproj: * dom/ExceptionCode.h: * editing/CompositionUnderline.h: * html/Autofill.h: * html/DataListSuggestionInformation.h: * html/EnterKeyHint.h: * html/LinkIconType.h: * loader/FrameLoaderTypes.h: - Alphabetize WTF::EnumTraits<> definitions. * loader/ResourceLoaderOptions.h: * page/SecurityOrigin.h: * page/UserStyleSheetTypes.h: (WTF::EnumTraits<WebCore::UserStyleLevel>): - Define this since UserStyleLevel is not an enum class. * page/scrolling/ScrollingCoordinatorTypes.h: * platform/ContextMenuItem.h: * platform/Cursor.h: * platform/DragData.h: * platform/FileChooser.h: * platform/PopupMenuStyle.h: * platform/ScreenProperties.h: * platform/ScrollTypes.h: * platform/SerializedPlatformDataCueValue.h: (WebCore::SerializedPlatformDataCueValue::PlatformType): - Convert from enum to enum class. * platform/UserInterfaceLayoutDirection.h: * platform/animation/TimingFunction.h: * platform/graphics/GraphicsContext.h: * platform/graphics/GraphicsLayer.h: * platform/graphics/GraphicsTypes.h: - Alphabetize WTF::EnumTraits<> definitions. * platform/graphics/Image.h: * platform/graphics/Path.h: * platform/graphics/ca/PlatformCAAnimation.h: * platform/graphics/ca/PlatformCALayer.h: * platform/graphics/filters/FilterOperation.h: * platform/mediastream/MediaConstraints.h: * platform/mediastream/MediaStreamRequest.h: (WTF::EnumTraits<WebCore::MediaStreamRequest::Type>): - Fix EnumTraits definition (missing "::Type"). * platform/mediastream/RealtimeMediaSourceCapabilities.h: * platform/mediastream/RealtimeMediaSourceSupportedConstraints.h: * platform/network/CredentialBase.h: * platform/network/ProtectionSpaceBase.h: * platform/network/ResourceErrorBase.h: * platform/network/soup/SoupNetworkProxySettings.h: * platform/text/TextChecking.h: (WTF::EnumTraits<WebCore::TextCheckingProcessType): - Define this since TextCheckingProcessType is not an enum class. * platform/text/WritingMode.h: * rendering/Pagination.h: * workers/service/ServiceWorkerJobType.h: 2020-06-11 Beth Dakin <bdakin@apple.com> Fix comment after blocklist transition https://bugs.webkit.org/show_bug.cgi?id=213100 Reviewed by Wenson Hsieh. * platform/mac/PasteboardMac.mm: (WebCore::cocoaTypeFromHTMLClipboardType): 2020-06-11 Rob Buis <rbuis@igalia.com> REGRESSION (r262776): Flaky crash under -[WebCoreResourceHandleAsOperationQueueDelegate connection:willSendRequest:redirectResponse:] https://bugs.webkit.org/show_bug.cgi?id=213059 Reviewed by Alex Christensen. My r262776 patch did not null check m_handle and it can cause crashes in some cases, so add the check. * platform/network/mac/WebCoreResourceHandleAsOperationQueueDelegate.mm: (-[WebCoreResourceHandleAsOperationQueueDelegate connection:willSendRequest:redirectResponse:]): 2020-06-11 Beth Dakin <bdakin@apple.com> Replace instances of whitelist in WebCore with allowlist https://bugs.webkit.org/show_bug.cgi?id=213068 Reviewed by Tim Horton. * Modules/webdatabase/DatabaseAuthorizer.cpp: (WebCore::DatabaseAuthorizer::DatabaseAuthorizer): (WebCore::DatabaseAuthorizer::addAllowedFunctions): (WebCore::DatabaseAuthorizer::allowFunction): (WebCore::DatabaseAuthorizer::addWhitelistedFunctions): Deleted. * Modules/webdatabase/DatabaseAuthorizer.h: * dom/ExtensionStyleSheets.cpp: (WebCore::ExtensionStyleSheets::updateInjectedStyleSheetCache const): * loader/CrossOriginAccessControl.cpp: (WebCore::isOnAccessControlSimpleRequestMethodAllowlist): (WebCore::isSimpleCrossOriginAccessRequest): (WebCore::isOnAccessControlSimpleRequestMethodWhitelist): Deleted. * loader/CrossOriginAccessControl.h: * loader/CrossOriginPreflightResultCache.cpp: (WebCore::CrossOriginPreflightResultCacheItem::allowsCrossOriginMethod const): * loader/appcache/ApplicationCache.cpp: (WebCore::ApplicationCache::setOnlineAllowlist): (WebCore::ApplicationCache::isURLInOnlineAllowlist): (WebCore::ApplicationCache::setOnlineWhitelist): Deleted. (WebCore::ApplicationCache::isURLInOnlineWhitelist): Deleted. * loader/appcache/ApplicationCache.h: (WebCore::ApplicationCache::onlineAllowlist const): (WebCore::ApplicationCache::onlineWhitelist const): Deleted. * loader/appcache/ApplicationCacheGroup.cpp: (WebCore::ApplicationCacheGroup::didFinishLoadingManifest): * loader/appcache/ApplicationCacheHost.cpp: (WebCore::ApplicationCacheHost::shouldLoadResourceFromApplicationCache): (WebCore::ApplicationCacheHost::getApplicationCacheFallbackResource): * loader/appcache/ApplicationCacheStorage.cpp: (WebCore::ApplicationCacheStorage::fallbackCacheGroupForURL): (WebCore::ApplicationCacheStorage::openDatabase): (WebCore::ApplicationCacheStorage::store): (WebCore::ApplicationCacheStorage::loadCache): * loader/appcache/ManifestParser.cpp: (WebCore::parseManifest): * loader/appcache/ManifestParser.h: * page/Frame.cpp: (WebCore::Frame::injectUserScriptImmediately): * page/SecurityOrigin.cpp: (WebCore::SecurityOrigin::canRequest const): (WebCore::SecurityOrigin::canDisplay const): * page/SecurityPolicy.cpp: (WebCore::SecurityPolicy::isAccessAllowed): (WebCore::SecurityPolicy::addOriginAccessAllowlistEntry): (WebCore::SecurityPolicy::removeOriginAccessAllowlistEntry): (WebCore::SecurityPolicy::resetOriginAccessAllowlists): (WebCore::SecurityPolicy::isAccessWhiteListed): Deleted. (WebCore::SecurityPolicy::addOriginAccessWhitelistEntry): Deleted. (WebCore::SecurityPolicy::removeOriginAccessWhitelistEntry): Deleted. (WebCore::SecurityPolicy::resetOriginAccessWhitelists): Deleted. * page/SecurityPolicy.h: * page/UserContentURLPattern.cpp: (WebCore::UserContentURLPattern::matchesPatterns): * page/UserContentURLPattern.h: * page/UserScript.h: (WebCore::UserScript::UserScript): (WebCore::UserScript::allowlist const): (WebCore::UserScript::encode const): (WebCore::UserScript::decode): (WebCore::UserScript::whitelist const): Deleted. * page/UserStyleSheet.h: (WebCore::UserStyleSheet::UserStyleSheet): (WebCore::UserStyleSheet::allowlist const): (WebCore::UserStyleSheet::whitelist const): Deleted. * platform/graphics/FontCache.h: * platform/graphics/cocoa/FontCacheCoreText.cpp: (WebCore::fontAllowlist): (WebCore::FontCache::setFontAllowlist): (WebCore::platformFontLookupWithFamily): (WebCore::fontWhitelist): Deleted. (WebCore::FontCache::setFontWhitelist): Deleted. * platform/network/HTTPParsers.cpp: (WebCore::isValidAcceptHeaderValue): * rendering/FloatingObjects.h: * style/ElementRuleCollector.cpp: (WebCore::Style::ElementRuleCollector::transferMatchedRules): * style/ElementRuleCollector.h: * style/PropertyCascade.cpp: (WebCore::Style::PropertyCascade::addMatch): * style/RuleData.cpp: (WebCore::Style::determinePropertyAllowlistType): (WebCore::Style::RuleData::RuleData): (WebCore::Style::determinePropertyWhitelistType): Deleted. * style/RuleData.h: (WebCore::Style::RuleData::propertyAllowlistType const): (WebCore::Style::RuleData::propertyWhitelistType const): Deleted. 2020-06-11 Andy Estes <aestes@apple.com> [iOS] nullptr deref in FileInputType::iconLoaded when the input's type attribute is modified by a change event listener https://bugs.webkit.org/show_bug.cgi?id=208244 <rdar://problem/41855350> Reviewed by Wenson Hsieh. When an <input> element's type attribute changes, its existing InputType is detached from the HTMLInputElement by nulling InputType::m_element. When FileInputType::filesChosen is called, it dispatches the input and change events, which can run arbitrary JavaScript that might modify the element's type attribute. If this happens, FileInputType::m_element will be null after returning from FileInputType::setFiles and if there is an icon will be dereferenced by FileInputType::iconLoaded. Fixed this by checking for a non-null m_element before calling iconLoaded. While here, also fixed a bug where we sometimes checked the length of m_fileList before FileListCreator had finished setting m_fileList. This bug resulted in missing file icons whenever an <input type=file> had the webkitdirectory attribute. Tests: fast/forms/file/file-input-type-detached-on-change.html fast/forms/file/file-input-webkitdirectory-icon.html * html/FileInputType.cpp: (WebCore::FileInputType::filesChosen): 2020-06-11 Beth Dakin <bdakin@apple.com> Remove references to "slave" in WebCore https://bugs.webkit.org/show_bug.cgi?id=213085 Reviewed by Wenson Hsieh. This feature is referred to as a mediagroup in html, so let's use that terminology here as well. * html/MediaController.cpp: (WebCore::MediaController::buffered const): (WebCore::MediaController::seekable const): (WebCore::MediaController::played): (WebCore::MediaController::duration const): (WebCore::MediaController::setCurrentTime): (WebCore::MediaController::play): (WebCore::MediaController::updateReadyState): (WebCore::MediaController::updatePlaybackState): (WebCore::MediaController::isBlocked const): (WebCore::MediaController::hasEnded const): 2020-06-11 David Kilzer <ddkilzer@apple.com> [IPC] Adopt enum class for DragSourceAction <https://webkit.org/b/212885> <rdar://problem/64094134> Reviewed by Darin Adler. Summary: - Convert DragSourceAction to enum class. - Remove DragSourceActionNone by using Optional<> and OptionSet<> (as dictated by how the code used the value). - Remove DragSourceActionAny and replace (as needed) with anyDragSourceAction(). (Some--but not all--uses were removed.) - Add both WTF::EnumTraits<> and WTF::OptionSetTraits<> for DragSourceAction since both Optional<> and OptionSet<> are used with IPC. * loader/EmptyClients.cpp: * page/DragActions.h: (WebCore::DragSourceAction): - Convert to enum class. (WebCore::anyDragSourceAction): Add. - Replaces WebCore::DragSourceActionAny. (WTF::EnumTraits<WebCore::DragSourceAction>): Add. (WTF::OptionSetTraits<WebCore::DragSourceAction>): Add. * page/DragClient.h: * page/DragController.cpp: (WebCore::DragController::delegateDragSourceAction): (WebCore::DragController::draggableElement const): (WebCore::DragController::prepareForDragStart const): (WebCore::DragController::startDrag): (WebCore::DragController::doSystemDrag): - Use OptionSet<>::toSingleValue() and add ASSERT() that it does not return WTF::nullopt. * page/DragController.h: (WebCore::DragController::dragSourceAction const): * page/DragState.h: * page/EventHandler.cpp: (WebCore::EventHandler::updateDragSourceActionsAllowed const): (WebCore::EventHandler::dragHysteresisExceeded const): - Use OptionSet<>::toSingleValue() and add ASSERT() that it does not return WTF::nullopt. - Remove case statements for DragSourceActionNone and DragSourceActionAny, along with ASSERT_NOT_REACHED(). The ASSERT() for toSingleValue() replaces the DragSourceActionNone case. (WebCore::EventHandler::didStartDrag): (WebCore::ExactlyOneBitSet): Delete. - Move to WTF::OptionSet<>::hasExactlyOneBitSet(). (WebCore::EventHandler::handleDrag): - Add code to #ifndef NDEBUG/#endif instead of modifying dragState().type in-place since it seemed weird to modify it just to check an ASSERT(), even though it was overwritten immediately after that. * page/EventHandler.h: * platform/DragItem.h: (WebCore::DragItem::encode const): (WebCore::DragItem::decode): - Stop using decodeEnum()/encodeEnum() with Optional<DragSourceAction>. 2020-06-11 Youenn Fablet <youenn@apple.com> End a remote MediaStreamTrack if its source is ended https://bugs.webkit.org/show_bug.cgi?id=213074 Reviewed by Eric Carlson. Make remote audio/video source observers of their webrtc source. In case the webrtc source ends, end the source, thus its related tracks as well. This is covered by the above test. Test: webrtc/receiver-track-should-stay-live-even-if-receiver-is-inactive.html * platform/mediastream/RealtimeIncomingAudioSource.cpp: (WebCore::RealtimeIncomingAudioSource::RealtimeIncomingAudioSource): (WebCore::RealtimeIncomingAudioSource::~RealtimeIncomingAudioSource): (WebCore::RealtimeIncomingAudioSource::startProducingData): (WebCore::RealtimeIncomingAudioSource::stopProducingData): (WebCore::RealtimeIncomingAudioSource::OnChanged): * platform/mediastream/RealtimeIncomingAudioSource.h: * platform/mediastream/RealtimeIncomingVideoSource.cpp: (WebCore::RealtimeIncomingVideoSource::RealtimeIncomingVideoSource): (WebCore::RealtimeIncomingVideoSource::~RealtimeIncomingVideoSource): (WebCore::RealtimeIncomingVideoSource::startProducingData): (WebCore::RealtimeIncomingVideoSource::stopProducingData): (WebCore::RealtimeIncomingVideoSource::OnChanged): * platform/mediastream/RealtimeIncomingVideoSource.h: * platform/mediastream/RealtimeMediaSource.cpp: (WebCore::RealtimeMediaSource::requestToEnd): (WebCore::RealtimeMediaSource::end): * platform/mediastream/RealtimeMediaSource.h: 2020-06-11 Rob Buis <rbuis@igalia.com> Improve url-setters.html WPT test https://bugs.webkit.org/show_bug.cgi?id=213046 Reviewed by Darin Adler. Improve url-setters.html WPT test by testing for failure that can occur when setting host or hostname [1]. [1] https://url.spec.whatwg.org/#host-state * html/URLDecomposition.cpp: (WebCore::URLDecomposition::setHost): (WebCore::URLDecomposition::setHostname): 2020-06-11 ChangSeok Oh <changseok@webkit.org> [GTK] Implement button-press-event, button-release-event, and absolute-axis-event of GAMEPAD API. https://bugs.webkit.org/show_bug.cgi?id=133850 Reviewed by Carlos Garcia Campos. This is a follow-up change after r261965, implementing the rest of missing GAMEPAD API for the gtk port. Buttons and analog sticks of standard gamepads work with this change. No new tests since existing tests can cover this change. * html/OffscreenCanvas.h: * platform/gamepad/manette/ManetteGamepad.cpp: (WebCore::toStandardGamepadAxis): (WebCore::onAbsoluteAxisEvent): (WebCore::toStandardGamepadButton): (WebCore::onButtonPressEvent): (WebCore::onButtonReleaseEvent): (WebCore::ManetteGamepad::ManetteGamepad): (WebCore::ManetteGamepad::~ManetteGamepad): (WebCore::ManetteGamepad::buttonPressedOrReleased): (WebCore::ManetteGamepad::absoluteAxisChanged): * platform/gamepad/manette/ManetteGamepad.h: * platform/gamepad/manette/ManetteGamepadProvider.cpp: (WebCore::ManetteGamepadProvider::ManetteGamepadProvider): (WebCore::ManetteGamepadProvider::~ManetteGamepadProvider): (WebCore::ManetteGamepadProvider::gamepadHadInput): (WebCore::ManetteGamepadProvider::inputNotificationTimerFired): * platform/gamepad/manette/ManetteGamepadProvider.h: 2020-06-10 Sergio Villar Senin <svillar@igalia.com> [WebXR] Pass an unsigned long to cancelAnimationCallback() as handle https://bugs.webkit.org/show_bug.cgi?id=212529 Reviewed by Youenn Fablet. The type of the handle returned by XRSession::requestAnimationFrame() was recently changed to unsigned long from long as there was no point in using signed integers for that. However we forgot to update the cancelAnimationFrame() in the specs as well as it receives the handle returned by requestAnimationFrame(). We landed https://github.com/immersive-web/webxr/pull/1069 in the WebXR specs so we can now safely also replace signed by unsigned integers in our implementation. No new tests as there is no change in functionality. Reland r262718. * Modules/webxr/WebXRSession.cpp: (WebCore::WebXRSession::cancelAnimationFrame): Use unsigned ids. * Modules/webxr/WebXRSession.h: Ditto. * Modules/webxr/WebXRSession.idl: Ditto. 2020-06-11 Antoine Quint <graouts@webkit.org> [Web Animations] Setting the style at the last style change event to null should not create an ElementAnimationRareData object https://bugs.webkit.org/show_bug.cgi?id=213070 <rdar://problem/63841893> Reviewed by Tim Horton. In r262154 we added code that records the pre-animation style for a given element in Style::TreeResolver::createAnimatedElementUpdate(), which is in Web Animations spec parlance the style at the last style change event. This style is set on the backing ElementAnimationRareData object for the given Element. For any element that did not actually have any animations, we would set this style to null, but the function on Element acting as a go-between would always create the backing ElementAnimationRareData even though it would set a null value. We now only creaste the ElementAnimationRareData object if there is a value to be stored, which fixes a performance regression in the Speedometer2 test. * dom/Element.cpp: (WebCore::Element::setLastStyleChangeEventStyle): 2020-06-10 Beth Dakin <bdakin@apple.com> Replace instances of blacklist in WebCore with blocklist https://bugs.webkit.org/show_bug.cgi?id=213064 Reviewed by Tim Horton. * dom/ExtensionStyleSheets.cpp: (WebCore::ExtensionStyleSheets::updateInjectedStyleSheetCache const): * page/Frame.cpp: (WebCore::Frame::injectUserScriptImmediately): * page/UserContentURLPattern.cpp: (WebCore::UserContentURLPattern::matchesPatterns): * page/UserContentURLPattern.h: * page/UserScript.h: (WebCore::UserScript::UserScript): (WebCore::UserScript::blocklist const): (WebCore::UserScript::encode const): (WebCore::UserScript::decode): (WebCore::UserScript::blacklist const): Deleted. * page/UserStyleSheet.h: (WebCore::UserStyleSheet::UserStyleSheet): (WebCore::UserStyleSheet::blocklist const): (WebCore::UserStyleSheet::blacklist const): Deleted. * platform/graphics/cocoa/GraphicsContextGLOpenGLCocoa.mm: (WebCore::GraphicsContextGLOpenGL::GraphicsContextGLOpenGL): (WebCore::GraphicsContextGLOpenGL::checkGPUStatus): * platform/mac/PasteboardMac.mm: (WebCore::cocoaTypeFromHTMLClipboardType): * platform/text/TextEncodingRegistry.cpp: (WebCore::pruneBlocklistedCodecs): (WebCore::extendTextCodecMaps): (WebCore::pruneBlacklistedCodecs): Deleted. 2020-06-10 Frank Yang <guowei_yang@apple.com> Multiple SVG Filters Unexpectedly lightens image using linearRGB https://bugs.webkit.org/show_bug.cgi?id=212649 Reviewed by Myles C. Maxfield, Simon Fraser, Darin Adler Added color space conversion of input FilterEffect ImageBuffer and ImageData for filters that directly manipulates pixel values. The conversion is missing only on CG platforms because on CG platforms, FilterEffect::transformResultColorSpace doesn't perform any operations Its author assumed all filters are using CG ImageBuffers, and that CG will handle the conversion which is not the case. The following filters operates on the raw pixels inside an ImageBuffer, and this requires an explicit color space conversion of the pixel values when the ImageData are retrieved by calling FilterEffect::copy{Pre/Un}multipliedData(). The filters affected are feComponentTransfer, feComposite, feConvolveMatrix feGaussianBlur, FELighting, feMorphology. The conversion is done by CG, by drawing the input ImageBuffer to a new ImageBuffer that has the correct color space tag. The ImageData is then pulled from this new ImageBuffer and used in platformApplySoftware() Tests: svg/filters/feComponentTransfer-clipped-expected.svg svg/filters/feComponentTransfer-clipped.svg svg/filters/feComposite-clipped-expected.svg svg/filters/feComposite-clipped.svg svg/filters/feConvolveMatrix-clipped-expected.svg svg/filters/feConvolveMatrix-clipped.svg svg/filters/feGaussianBlur-clipped-expected.svg svg/filters/feGaussianBlur-clipped.svg svg/filters/feLighting-clipped-expected.svg svg/filters/feLighting-clipped.svg svg/filters/feMorphology-clipped-expected.svg svg/filters/feMorphology-clipped.svg * platform/graphics/filters/FEComponentTransfer.cpp: (WebCore::FEComponentTransfer::platformApplySoftware): Modified function call to FilterEffect::premultipliedResult, color space conversion is required on CG platforms, so operatingColorSpace is passed in and input will be converted to that color space * platform/graphics/filters/FEComposite.cpp: (WebCore::FEComposite::platformApplySoftware): Similarly, color space conversion Required on CG color space conversion is required on CG platforms, so operatingColorSpace is passed in and input will be converted to that color space * platform/graphics/filters/FEConvolveMatrix.cpp: (WebCore::FEConvolveMatrix::platformApplySoftware): converting to operating space * platform/graphics/filters/FEGaussianBlur.cpp: (WebCore::FEGaussianBlur::platformApplySoftware): converting to operating space * platform/graphics/filters/FELighting.cpp: (WebCore::FELighting::platformApplySoftware): converting to operating space * platform/graphics/filters/FEMorphology.cpp: (WebCore::FEMorphology::platformApplyDegenerate): converting to operating space (WebCore::FEMorphology::platformApplySoftware): converting to operating space * platform/graphics/filters/FilterEffect.cpp: (WebCore::FilterEffect::unmultipliedResult): modified function signature so that The Optional ColorSpace enum could be passed in to copyUnmultipliedResult() (WebCore::FilterEffect::premultipliedResult): modified function signature so that The Optional ColorSpace enum could be passed in to copyUnmultipliedResult() (WebCore::FilterEffect::convertImageDataToColorSpace): helper function that takes an ImageData ptr as input, put it into an ImageBuffer, and calls convertImageBufferToColorSpace to perform color conversion, and returns the converted ImageData (WebCore::FilterEffect::convertImageBufferToColorSpace): helper function that takes an ImageBuffer ptr as input, create a new ImageBuffer with target color space, write input ImageBuffer to this new buffer (CG backend handles the conversion) and returns the ImageData in the buffer. (WebCore::FilterEffect::copyConvertedImageBufferToDestination): helper function that copies data from ImageBuffer whose data is converted to the correct color space, to the destination array (WebCore::FilterEffect::copyConvertedImageDataToDestination): helper function that copies data from ImageData whose data is converted to the correct color space, to the destination array (WebCore::FilterEffect::copyUnmultipliedResult): added an optional argument, colorSpace, which will be passed into requiresAdditionalColorSpaceConversion, in order to determine if color space conversion is required when obtaining the unmultiplied result. Then, added code to convert color space before writing to the destination array (WebCore::FilterEffect::copyPremultipliedResult): added an optional argument, colorSpace, which will be passed into requiresAdditionalColorSpaceConversion, in order to determine if color space conversion is required when obtaining the premultiplied result. Then, added code to convert color space before writing to the destination array. (WebCore::FilterEffect::requiresImageDataColorSpaceConversion): unction that only returns true when 1) destination color space is non-null and is different than current color space AND 2) the code is running on CG platforms This function will only be called inside copy{Un, Pre}multipliedResult, to address the issue where color space is needed for filters that modifies raw pixels. * platform/graphics/filters/FilterEffect.h: Added function declarations 2020-06-10 Zalan Bujtas <zalan@apple.com> [Line clamp] Do not apply the special anchor handling when the anchor content is visible after clamping https://bugs.webkit.org/show_bug.cgi?id=213052 <rdar://problem/59739131> Reviewed by Simon Fraser. Line clamping tries to preserve the anchor text if it is at the bottom of the paragraph to support cases like "... Read more", where the "read more" is an actual link. This patch makes sure that we only apply the special case handling if the anchor text get clamped. Test: fast/flexbox/line-clamp-with-anchor-content-only.html * rendering/RenderDeprecatedFlexibleBox.cpp: (WebCore::RenderDeprecatedFlexibleBox::applyLineClamp): 2020-06-10 Jer Noble <jer.noble@apple.com> [Cocoa] CRASH: imported/w3c/web-platform-tests/remote-playback/watch-availability-initial-callback.html is flaky crashing https://bugs.webkit.org/show_bug.cgi?id=213044 <rdar://problem/62317723> Reviewed by Eric Carlson. Add null-checks around previously non-null-checked derefs of WeakPtr<HTMLMediaElement>. * Modules/remoteplayback/RemotePlayback.cpp: (WebCore::RemotePlayback::watchAvailability): (WebCore::RemotePlayback::shouldPlayToRemoteTargetChanged): (WebCore::RemotePlayback::playbackTargetPickerWasDismissed): 2020-06-10 Sihui Liu <sihui_liu@apple.com> Text manipulation does not observe inserted elements that are invisible https://bugs.webkit.org/show_bug.cgi?id=213057 <rdar://problem/63768253> Reviewed by Wenson Hsieh. TextManipulationController gets notification when renderer of an element is created and starts observing the element. It currently sets the observing range to be the visible start position and visible end position of the element. When the invisible content becomes visible later, TextManipulationController does not get notification and will miss the content. Therefore, TextManipulationController should use the actual start and end positions of the element for range. Test: TextManipulation.StartTextManipulationFindsInsertedClippedText * editing/TextManipulationController.cpp: (WebCore::makeHashablePositionRange): (WebCore::TextManipulationController::scheduleObservationUpdate): 2020-06-10 Geoffrey Garen <ggaren@apple.com> Some style improvements to main thread code https://bugs.webkit.org/show_bug.cgi?id=213051 Reviewed by Darin Adler. Updated for rename. * WebCore.order: * platform/ios/wak/WebCoreThread.mm: (StartWebThread): 2020-06-10 Pinki Gyanchandani <pgyanchandani@apple.com> Release Assert @ WebCore::RenderTreeBuilder::RenderTreeBuilder https://bugs.webkit.org/show_bug.cgi?id=212714 Reviewed by Geoffrey Garen. Replaced call to WTFMove(widgetNewParentMap()) with std::exchange(widgetNewParentMap(), { }) in the WidgetHierarchyUpdatesSuspensionScope::moveWidgets(), thereby making it explicit to set the source map empty. Test would be added later. * rendering/RenderWidget.cpp: (WebCore::WidgetHierarchyUpdatesSuspensionScope::moveWidgets): 2020-06-10 Brent Fulgham <bfulgham@apple.com> Improve CSP compliance under PSON https://bugs.webkit.org/show_bug.cgi?id=212995 <rdar://problem/62996186> Reviewed by Chris Dumez. Tests: http/tests/security/contentSecurityPolicy/1.1/form-action-src-self-blocked.html The form submission logic was only considering CSP if the form action was a JavaScript URL. This is incorrect, as CSP might apply to any URL. This is also covered by the existing form-action CSP tests. * loader/FrameLoader.cpp: (WebCore::FrameLoader::submitForm): All URLs should be evaluted for compliance with CSP. 2020-06-10 Brian Burg <bburg@apple.com> WebDriver on non-iOS ports cannot perform ActionChain which has scrolling down to the element and click it https://bugs.webkit.org/show_bug.cgi?id=208232 <rdar://problem/59859491> Reviewed by Devin Rousso. * platform/ScrollView.h: * platform/ScrollView.cpp: (WebCore::ScrollView::rootViewToContents const): Create a version of this function that works with FloatPoint. 2020-06-10 Commit Queue <commit-queue@webkit.org> Unreviewed, reverting r262718. https://bugs.webkit.org/show_bug.cgi?id=213047 Broke WPE Debug too Reverted changeset: "[WebXR] Pass an unsigned long to cancelAnimationCallback() as handle" https://bugs.webkit.org/show_bug.cgi?id=212529 https://trac.webkit.org/changeset/262718 2020-06-10 Antoine Quint <graouts@webkit.org> Subframes should not autosize independently https://bugs.webkit.org/show_bug.cgi?id=212984 <rdar://problem/64175493> Reviewed by Simon Fraser. * page/FrameView.cpp: (WebCore::FrameView::enableAutoSizeMode): 2020-06-10 Philippe Normand <pnormand@igalia.com> Unreviewed, WPE Debug build fix attempt after r262838. Second attempt. :) Still broken because of r262718 though... * platform/xr/openxr/PlatformXROpenXR.cpp: 2020-06-10 Philippe Normand <pnormand@igalia.com> Unreviewed, WPE Debug build fix attempt after r262838. Still broken because of r262718 though... * platform/xr/openxr/PlatformXROpenXR.cpp: 2020-06-10 Youenn Fablet <youenn@apple.com> BaseAudioSharedUnit does not need to restart its audio unit at resume time. https://bugs.webkit.org/show_bug.cgi?id=213021 Reviewed by Eric Carlson. Removing a case that should not happen, and was guarded by ASSERT. Keeping ASSERT to make sure we do not break this assumption. * platform/mediastream/mac/BaseAudioSharedUnit.cpp: (WebCore::BaseAudioSharedUnit::resume): (WebCore::BaseAudioSharedUnit::suspend): 2020-06-10 Youenn Fablet <youenn@apple.com> REGRESSION(r262798): fast/mediastream/media-stream-track-interrupted.html is failing https://bugs.webkit.org/show_bug.cgi?id=213011 Reviewed by Eric Carlson. Before the patch, a source that is muted and for which its observers get ended will not be ended. This is a potential issue as the source can get unmuted, in which case, the audio shared unit might be asked to restart. This is crashing in debug as we would not have the AudioSession correct category for audio capture. Test: fast/mediastream/track-ended-while-muted.html Also covered by fast/mediastream/media-stream-track-interrupted.html no longer flakily crashing in debug. * platform/mediastream/RealtimeMediaSource.cpp: (WebCore::RealtimeMediaSource::requestToEnd): End the source even if muted. * platform/mediastream/RealtimeMediaSource.h: * testing/Internals.cpp: (WebCore::Internals::isMediaStreamSourceEnded const): * testing/Internals.h: * testing/Internals.idl: Add necessary test infrastructure. 2020-06-05 Sergio Villar Senin <svillar@igalia.com> [WebXR] Refactor OpenXR platform code https://bugs.webkit.org/show_bug.cgi?id=212470 Reviewed by Youenn Fablet. Refactored a bit the platform code because we want to extend the PlatformXR::Device for the OpenXR library. Also we're removing all the device id code because there is no need to expose it. The idea from now on is to only define interfaces in PlatformXR.h and then add all the OpenXR specifics in the newly renamed PlatformXROpenXR.[ch] files. We're also renaming PlatformXR.cpp to PlatformXROpenXR.cpp to clearly state that it's the OpenXR implementation and to differentiate it from the implementation agnostic PlatformXR.h file. No new tests as there is no change in functionality. * Sources.txt: Added renamed files. Removed PlatformXR.cpp. * WebCore.xcodeproj/project.pbxproj: Ditto. * platform/xr/PlatformXR.cpp: Removed. * platform/xr/PlatformXR.h: (PlatformXR::Device::id const): Deleted. (PlatformXR::Device::operator== const): Deleted. * platform/xr/openxr/PlatformXROpenXR.cpp: Renamed from Source/WebCore/platform/xr/openxr/PlatformXR.cpp. (PlatformXR::Instance::Impl::~Impl): Call xrDestroyInstance() on m_instance. (PlatformXR::Instance::Impl::collectSupportedSessionModes): Do not pass XrSystemId as argument as it's stored in the OpenXRDevice object. (PlatformXR::Instance::enumerateImmersiveXRDevices): Create an OpenXRDevice instead of a Device. * platform/xr/openxr/PlatformXROpenXR.h: Added. 2020-06-09 Pinki Gyanchandani <pgyanchandani@apple.com> Release Assert @ WebCore::RenderTreeBuilder::RenderTreeBuilder https://bugs.webkit.org/show_bug.cgi?id=212714 Reviewed by Geoffrey Garen. Made change in the WidgetHierarchyUpdatesSuspensionScope::moveWidgets() to handle all widgets scheduled to move, including new widgets scheduled during moveWidgets(). Test would be added later. * rendering/RenderWidget.cpp: (WebCore::WidgetHierarchyUpdatesSuspensionScope::moveWidgets): 2020-06-09 Fujii Hironori <Hironori.Fujii@sony.com> Unreviewed, reverting r262791. WinCairo WebKit1 is crashing. Reverted changeset: "[Curl] Implement functions to use ResourceLoadStatistics." https://bugs.webkit.org/show_bug.cgi?id=207692 https://trac.webkit.org/changeset/262791 2020-06-09 Simon Fraser <simon.fraser@apple.com> Minor overflow layers cleanup https://bugs.webkit.org/show_bug.cgi?id=213002 Reviewed by Zalan Bujtas. Now that we parent scrollbar and scroll corner layers into the overflowControlsContainer layer, we no need to parent these layers in RenderLayerCompositor::updateBackingAndHierarchy(). Also rename overflowControlsHostLayerBox to overflowControlsHostLayerRect to avoid ambiguity with RenderBox. * rendering/RenderLayerBacking.cpp: (WebCore::RenderLayerBacking::updateDebugIndicators): (WebCore::overflowControlsHostLayerRect): (WebCore::RenderLayerBacking::updateGeometry): (WebCore::overflowControlsHostLayerBox): Deleted. * rendering/RenderLayerBacking.h: * rendering/RenderLayerCompositor.cpp: (WebCore::RenderLayerCompositor::updateBackingAndHierarchy): 2020-06-09 Mark Lam <mark.lam@apple.com> Disambiguate the OverridesGetPropertyNames structure flag https://bugs.webkit.org/show_bug.cgi?id=212909 <rdar://problem/63823557> Reviewed by Saam Barati. 1. JSDOMWindowProperties was not defining its Base. As a result, its StructureFlags was inheriting from JSDOMObject's Base instead of from JSDOMObject as one would expect. This turns out to be harmless because JSDOMObject did not define any StructureFlags. Regardless, this is not fixed so that if JSDOMObject adds any StructureFlags, it will be inherited properly by JSDOMWindowProperties. 2. Updated CodeGeneratorJS.pm and rebased the binding test results. * bindings/js/JSDOMWindowProperties.h: * bindings/scripts/CodeGeneratorJS.pm: (GenerateHeader): * bindings/scripts/test/JS/JSTestEventTarget.h: * bindings/scripts/test/JS/JSTestIndexedSetterNoIdentifier.h: * bindings/scripts/test/JS/JSTestIndexedSetterThrowingException.h: * bindings/scripts/test/JS/JSTestIndexedSetterWithIdentifier.h: * bindings/scripts/test/JS/JSTestNamedAndIndexedSetterNoIdentifier.h: * bindings/scripts/test/JS/JSTestNamedAndIndexedSetterThrowingException.h: * bindings/scripts/test/JS/JSTestNamedAndIndexedSetterWithIdentifier.h: * bindings/scripts/test/JS/JSTestNamedDeleterNoIdentifier.h: * bindings/scripts/test/JS/JSTestNamedDeleterThrowingException.h: * bindings/scripts/test/JS/JSTestNamedDeleterWithIdentifier.h: * bindings/scripts/test/JS/JSTestNamedDeleterWithIndexedGetter.h: * bindings/scripts/test/JS/JSTestNamedGetterCallWith.h: * bindings/scripts/test/JS/JSTestNamedGetterNoIdentifier.h: * bindings/scripts/test/JS/JSTestNamedGetterWithIdentifier.h: * bindings/scripts/test/JS/JSTestNamedSetterNoIdentifier.h: * bindings/scripts/test/JS/JSTestNamedSetterThrowingException.h: * bindings/scripts/test/JS/JSTestNamedSetterWithIdentifier.h: * bindings/scripts/test/JS/JSTestNamedSetterWithIndexedGetter.h: * bindings/scripts/test/JS/JSTestNamedSetterWithIndexedGetterAndSetter.h: * bindings/scripts/test/JS/JSTestNamedSetterWithOverrideBuiltins.h: * bindings/scripts/test/JS/JSTestNamedSetterWithUnforgableProperties.h: * bindings/scripts/test/JS/JSTestNamedSetterWithUnforgablePropertiesAndOverrideBuiltins.h: * bindings/scripts/test/JS/JSTestObj.h: * bindings/scripts/test/JS/JSTestOverrideBuiltins.h: * bridge/runtime_array.h: * bridge/runtime_object.h: 2020-06-09 Dean Jackson <dino@apple.com> Stop using discriminatory names for WebGL and Plugin blocking https://bugs.webkit.org/show_bug.cgi?id=213000 Reviewed by Simon Fraser. * SourcesCocoa.txt: * WebCore.xcodeproj/project.pbxproj: * platform/mac/BlocklistUpdater.h: Renamed from Source/WebCore/platform/mac/BlacklistUpdater.h. (WebCore::BlocklistUpdater::pluginBlocklist): (WebCore::BlocklistUpdater::webGLBlocklist): * platform/mac/BlocklistUpdater.mm: Renamed from Source/WebCore/platform/mac/BlacklistUpdater.mm. (WebCore::BlocklistUpdater::readBlocklistData): (WebCore::BlocklistUpdater::reloadIfNecessary): (WebCore::BlocklistUpdater::initializeQueue): * platform/mac/PluginBlocklist.h: Renamed from Source/WebCore/platform/mac/PluginBlacklist.h. * platform/mac/PluginBlocklist.mm: Renamed from Source/WebCore/platform/mac/PluginBlacklist.mm. (WebCore::PluginBlocklist::loadPolicyForPluginVersion): (WebCore::PluginBlocklist::isPluginUpdateAvailable): (WebCore::PluginBlocklist::create): (WebCore::PluginBlocklist::~PluginBlocklist): (WebCore::PluginBlocklist::splitOSVersion): (WebCore::PluginBlocklist::loadPolicyForPlugin const): (WebCore::PluginBlocklist::isUpdateAvailable const): (WebCore::PluginBlocklist::PluginBlocklist): * platform/mac/WebGLBlocklist.h: Renamed from Source/WebCore/platform/mac/WebGLBlacklist.h. * platform/mac/WebGLBlocklist.mm: Renamed from Source/WebCore/platform/mac/WebGLBlacklist.mm. (WebCore::buildInfoFromOSBuildString): (WebCore::WebGLBlocklist::shouldBlockWebGL): (WebCore::WebGLBlocklist::shouldSuggestBlockingWebGL): (WebCore::matchesBuildInfo): (WebCore::WebGLBlocklist::create): (WebCore::WebGLBlocklist::shouldBlock const): (WebCore::WebGLBlocklist::shouldSuggestBlocking const): (WebCore::WebGLBlocklist::WebGLBlocklist): (WebCore::WebGLBlocklist::~WebGLBlocklist): 2020-06-09 Simon Fraser <simon.fraser@apple.com> Logging and tree dumping crash fix https://bugs.webkit.org/show_bug.cgi?id=212988 Reviewed by Zalan Bujtas. Add scrolling logging to RenderLayer::requestScrollPositionUpdate(). Null-check the scrollerImp in ScrollbarThemeMac::isLayoutDirectionRTL, because this is called from renderTreeAsText() which can be invoked from the debugger, and should not crash. * platform/mac/ScrollbarThemeMac.mm: (WebCore::ScrollbarThemeMac::isLayoutDirectionRTL): * rendering/RenderLayer.cpp: (WebCore::RenderLayer::requestScrollPositionUpdate): 2020-06-09 Andy Estes <aestes@apple.com> Unreviewed change for post-commit feedback after r262682. * DerivedSources.make: Replaced tabs with spaces. 2020-06-09 Frank Yang <guowei_yang@apple.com> WebKit Crashes when SVG Filter Logging is Turned On https://bugs.webkit.org/show_bug.cgi?id=212415 Reviewed by Darin Adler. No new tests are required because this is just fixing a simple pointer access inside logging code * html/ImageData.cpp: (WebCore::operator<<): Overloaded << operator to print the address of pixel data it stores * html/ImageData.h: Declare overloaded << operator * platform/graphics/filters/FilterEffect.cpp: (WebCore::FilterEffect::imageBufferResult): Modified logging code so that it does a null check by calling ValueOrNull on m_premultipliedImageResult and m_unmultipliedImageResult (WebCore::FilterEffect::copyUnmultipliedResult): Modified logging code so that it does a null check by calling ValueOrNull on m_premultipliedImageResult and m_unmultipliedImageResult (WebCore::FilterEffect::copyPremultipliedResult): Modified logging code so that it does a null check by calling ValueOrNull on m_premultipliedImageResult and m_unmultipliedImageResult 2020-06-09 Dean Jackson <dino@apple.com> REGRESSION: [Safari Mojave for High Sierra] Accessing some of the featured pages on apple.com causes the webpage to crash https://bugs.webkit.org/show_bug.cgi?id=212940 rdar://63839405 Reviewed by Tim Horton. The code to use the singleton for a SwitchingGPUClient was assuming it has always been set, which was not the case when ENABLE(WEBPROCESS_WINDOWSERVER_BLOCKING) was not true. * platform/graphics/opengl/GraphicsContextGLOpenGLManager.cpp: Check the state of the singleton before calling it. (WebCore::GraphicsContextGLOpenGLManager::updateHighPerformanceState): (WebCore::GraphicsContextGLOpenGLManager::disableHighPerformanceGPUTimerFired): * platform/graphics/mac/SwitchingGPUClient.h: Return a pointer to the singleton which will allow the code to check for its existence. (WebCore::SwitchingGPUClient::singletonIfExists): 2020-06-09 Sam Weinig <weinig@apple.com> Extended Color: Streamline SimpleColor premulitply/unpremultiply code https://bugs.webkit.org/show_bug.cgi?id=212945 Reviewed by Darin Adler. Simplify / streamline the premulitply/unpremultiply code by: - Removing the overloads that didn't take individual components, keeping only the ones taking a SimpleColor. - Replacing the "ceiling" bool in makePremultipliedSimpleColor and converting it into two functions. - Simplifying the names from makePremultipliedSimpleColor/makeUnpremultipliedSimpleColor to premultiplyFlooring/premultiplyCeiling/unpremultiply. - Where component order is important, use valueAsARGB() explicitly to show what the resulting value's format will be. * platform/graphics/Color.cpp: (WebCore::blend): Update to call premultiplyCeiling/unpremultiply. * platform/graphics/ImageBackingStore.h: (WebCore::ImageBackingStore::blendPixel): (WebCore::ImageBackingStore::pixelValue const): Update to call premultiplyFlooring/unpremultiply and valueAsARGB(). * platform/graphics/SimpleColor.h: * platform/graphics/SimpleColor.cpp: (WebCore::premultiplyFlooring): (WebCore::premultiplyCeiling): (WebCore::unpremultiplyChannel): (WebCore::unpremultiply): (WebCore::premultipliedChannel): Deleted. (WebCore::unpremultipliedChannel): Deleted. (WebCore::makePremultipliedSimpleColor): Deleted. (WebCore::makeUnpremultipliedSimpleColor): Deleted. Simplify premulitply/unpremultiply interfaces. Use structured bindings to make the code a bit easier to follow as well. * platform/graphics/cairo/ImageBufferCairoImageSurfaceBackend.cpp: (WebCore::ImageBufferCairoImageSurfaceBackend::platformTransformColorSpace): Update to call premultiplyFlooring/unpremultiply and valueAsARGB(). * platform/graphics/cairo/NativeImageCairo.cpp: (WebCore::nativeImageSinglePixelSolidColor): Update to call premultiplyFlooring/unpremultiply and valueAsARGB(). Also removes reinterpret cast to SimpleColor, instead following the model in ImageBufferCairoImageSurfaceBackend and casting to unsigned, and building the SimpleColor from that. This will allow SimpleColor to change its underlying representation in the future without breaking things. 2020-06-09 Commit Queue <commit-queue@webkit.org> Unreviewed, reverting r261841. https://bugs.webkit.org/show_bug.cgi?id=212991 Caused spotify pages to scroll to the top (<http://webkit.org/b/212983|webkit.org/b/212983>) Reverted changeset: "[css-grid] Clear the override width for computing percent margins" https://bugs.webkit.org/show_bug.cgi?id=209461 https://trac.webkit.org/changeset/261841 2020-06-09 Fujii Hironori <Hironori.Fujii@sony.com> [Win] ComplexTextControllerUniscribe: Retry ScriptShape with SCRIPT_UNDEFINED if it failed as USP_E_SCRIPT_NOT_IN_FONT https://bugs.webkit.org/show_bug.cgi?id=212947 Reviewed by Don Olmstead. If the given font doesn't support the givin text, ScriptShape API fails as USP_E_SCRIPT_NOT_IN_FONT. In the case, the complex run was simply ignored and nothing was drawn for the text. According to Uniscribe document, We should retry ScriptShape with SCRIPT_UNDEFINED to get missing glyphs. <https://docs.microsoft.com/en-us/windows/win32/intl/displaying-text-with-uniscribe> * platform/graphics/win/ComplexTextControllerUniscribe.cpp: (WebCore::shapeByUniscribe): 2020-06-09 Fujii Hironori <Hironori.Fujii@sony.com> ComplexTextController: Use std::sort to calculate m_runIndices https://bugs.webkit.org/show_bug.cgi?id=212944 Reviewed by Myles C. Maxfield. ComplexTextController was using O(n²) sort to lazily calculate m_runIndices. And, exact matching stringBegin and stringEnd can cause infinite loop (Bug 212670 and Bug 108877). Use std::sort instead. * platform/graphics/ComplexTextController.cpp: (WebCore::ComplexTextController::finishConstruction): (WebCore::ComplexTextController::indexOfCurrentRun): 2020-06-09 Youenn Fablet <youenn@apple.com> BaseAudioSharedUnit should unmute its clients in case of suspension even if not having any audio unit https://bugs.webkit.org/show_bug.cgi?id=212970 Reviewed by Eric Carlson. CoreAudioCaptureSource(s), when muted, are now calling stopProducingData. This will, in turn, make the BaseAudioSharedUnit stop and no longer have any audio unit. In that case, when resume is called on the BaseAudioSharedUnit, it will exit early as the audio unit is null. This will prevent to unmute the CoreAudioCaptureSource(s). Fix this by removing the audio unit check in BaseAudioSharedUnit::resume. Add infrastructure testing to be able to write a test. Covered by added test. * platform/mediastream/RealtimeMediaSource.h: * platform/mediastream/mac/BaseAudioSharedUnit.cpp: (WebCore::BaseAudioSharedUnit::resume): * platform/mediastream/mac/CoreAudioCaptureSource.cpp: (WebCore::CoreAudioCaptureSource::setInterruptedForTesting): * platform/mediastream/mac/CoreAudioCaptureSource.h: * testing/Internals.cpp: (WebCore::Internals::isMediaStreamSourceInterrupted const): * testing/Internals.h: * testing/Internals.idl: 2020-06-09 Myles C. Maxfield <mmaxfield@apple.com> lang=zh needs to defer to system preferences to know whether it should be simplified or traditional https://bugs.webkit.org/show_bug.cgi?id=212626 <rdar://problem/60227623> Reviewed by Darin Adler. If the content says lang="zh" font-family: sans-serif, we have no signal for whether the content should be traditional or simplified. In this case, we should pick based on system preferences to make it more likely that we get the right answer. This is actually what some Cocoa platform text functions were doing, but not all of them. We need to do it at our level in WebKit to make sure that all our calls to the platform have consistent behavior. Also, we can cache the result at our level, which is more performant than if the platform cached it at each platform entry point. We already started consulting with system preferences to make this decision in r189038. This patch extends that and fixes it to throughout WebKit. This doesn't expose any new fingerprinting data, because this information was already exposed (e.g. by drawing fallback fonts to the canvas and then reading back the pixels). Tests: fast/text/locale-getComputedStyle.html fast/text/international/generic-font-family-language-traditional.html * css/CSSComputedStyleDeclaration.cpp: (WebCore::ComputedStyleExtractor::valueForPropertyInStyle): * css/CSSFontSelector.cpp: (WebCore::resolveGenericFamily): * css/CSSProperties.json: * layout/inlineformatting/InlineLineBreaker.cpp: (WebCore::Layout::LineBreaker::wordBreakBehavior const): (WebCore::Layout::LineBreaker::tryBreakingTextRun const): * platform/graphics/Font.cpp: (WebCore::Font::systemFallbackFontForCharacter const): * platform/graphics/FontCache.h: (WebCore::FontDescriptionKey::FontDescriptionKey): * platform/graphics/FontCascade.cpp: (WebCore::FontCascade::widthForSimpleText const): * platform/graphics/FontCascadeDescription.cpp: * platform/graphics/FontCascadeDescription.h: (WebCore::FontCascadeDescription::initialSpecifiedLocale): (WebCore::FontCascadeDescription::initialLocale): Deleted. * platform/graphics/FontDescription.cpp: (WebCore::computeSpecializedChineseLocale): (WebCore::cachedSpecializedChineseLocale): (WebCore::fontDescriptionLanguageChanged): (WebCore::specializedChineseLocale): (WebCore::FontDescription::setSpecifiedLocale): (WebCore::FontDescription::setLocale): Deleted. * platform/graphics/FontDescription.h: (WebCore::FontDescription::computedLocale const): (WebCore::FontDescription::specifiedLocale const): (WebCore::FontDescription::operator== const): (WebCore::FontDescription::encode const): (WebCore::FontDescription::decode): (WebCore::FontDescription::locale const): Deleted. * platform/graphics/WidthIterator.cpp: (WebCore::WidthIterator::applyFontTransforms): * platform/graphics/cocoa/FontCacheCoreText.cpp: (WebCore::FontCache::systemFallbackForCharacters): * platform/graphics/cocoa/FontDescriptionCocoa.cpp: (WebCore::FontDescription::platformResolveGenericFamily): (WebCore::computeSpecializedChineseLocale): Deleted. (WebCore::cachedSpecializedChineseLocale): Deleted. (WebCore::languageChanged): Deleted. * platform/graphics/cocoa/SystemFontDatabaseCoreText.cpp: (WebCore::SystemFontDatabaseCoreText::systemFontParameters): * platform/graphics/mac/ComplexTextControllerCoreText.mm: (WebCore::ComplexTextController::collectComplexTextRunsForCharacters): * rendering/RenderQuote.cpp: (WebCore::RenderQuote::computeText const): * rendering/RenderText.cpp: (WebCore::maxWordFragmentWidth): (WebCore::RenderText::computePreferredLogicalWidths): (WebCore::applyTextTransform): * rendering/RenderThemeCocoa.mm: (WebCore::RenderThemeCocoa::paintApplePayButton): * rendering/SimpleLineLayoutTextFragmentIterator.cpp: (WebCore::SimpleLineLayout::TextFragmentIterator::Style::Style): (WebCore::SimpleLineLayout::TextFragmentIterator::TextFragmentIterator): * rendering/line/BreakingContext.h: (WebCore::BreakingContext::handleText): * rendering/style/RenderStyle.h: (WebCore::RenderStyle::computedLocale const): (WebCore::RenderStyle::specifiedLocale const): (WebCore::RenderStyle::locale const): Deleted. * style/StyleBuilderCustom.h: (WebCore::Style::BuilderCustom::applyValueWebkitLocale): * style/StyleResolveForDocument.cpp: (WebCore::Style::resolveForDocument): 2020-06-09 Zalan Bujtas <zalan@apple.com> [LFC][TFC] Add support for empty table https://bugs.webkit.org/show_bug.cgi?id=212971 Reviewed by Antti Koivisto. No need to run formatting context layout when the table box has no descendant. Test: fast/layoutformattingcontext/empty-table-box.html * layout/blockformatting/tablewrapper/TableWrapperBlockFormattingContext.cpp: (WebCore::Layout::TableWrapperBlockFormattingContext::layoutTableBox): (WebCore::Layout::TableWrapperBlockFormattingContext::computeBorderAndPaddingForTableBox): (WebCore::Layout::TableWrapperBlockFormattingContext::computeWidthAndMarginForTableBox): * layout/tableformatting/TableFormattingContext.cpp: (WebCore::Layout::TableFormattingContext::ensureTableGrid): * layout/tableformatting/TableGrid.h: (WebCore::Layout::TableGrid::isEmpty const): 2020-06-09 Youenn Fablet <youenn@apple.com> Forward declare MediaKeys/MediaKeySession in Internals.h https://bugs.webkit.org/show_bug.cgi?id=212965 Reviewed by Xabier Rodriguez-Calvar. No change of behavior. * testing/Internals.cpp: * testing/Internals.h: 2020-06-09 Youenn Fablet <youenn@apple.com> Fix two MediaStream tests https://bugs.webkit.org/show_bug.cgi?id=208926 <rdar://problem/60329008> Reviewed by Eric Carlson. Previously, the mock capture sample rate was the one of the mock audio shared unit, which is the sample rate of the audio session by default. This sample rate may change according the bots. For that reason, explicitly set the mock shared unit sample rate to the default sample rate of the device, just before creating the source. MediaConstraints may still apply after this step. Fix an issue where we would use the real core audio unit in CoreAudioCaptureSource constructor. We now pass the unit override if any in constructor. Covered by unflaked tests. * platform/mediastream/mac/BaseAudioSharedUnit.cpp: (WebCore::BaseAudioSharedUnit::BaseAudioSharedUnit): * platform/mediastream/mac/BaseAudioSharedUnit.h: * platform/mediastream/mac/CoreAudioCaptureSource.cpp: (WebCore::initializeCoreAudioCaptureSource): (WebCore::CoreAudioSharedUnit::CoreAudioSharedUnit): (WebCore::CoreAudioCaptureSource::create): (WebCore::CoreAudioCaptureSource::createForTesting): (WebCore::CoreAudioCaptureSource::CoreAudioCaptureSource): * platform/mediastream/mac/CoreAudioCaptureSource.h: * platform/mediastream/mac/MockAudioSharedUnit.mm: (WebCore::MockRealtimeAudioSource::create): (WebCore::MockAudioSharedUnit::MockAudioSharedUnit): Do not disable echo cancellation to mimick what the real unit is doing. 2020-06-09 Zalan Bujtas <zalan@apple.com> [LFC][Table][Floats] Multi-pass table layout needs clean floating state https://bugs.webkit.org/show_bug.cgi?id=212889 Reviewed by Antti Koivisto. When laying out the cell content multiple times to accommodate flex table layout, the float state needs be cleared to avoid having redundant float content. Test: fast/layoutformattingcontext/float-inside-table-cell-simple.html * layout/floats/FloatingState.cpp: (WebCore::Layout::FloatingState::append): * layout/floats/FloatingState.h: (WebCore::Layout::FloatingState::FloatItem::floatBox const): * layout/layouttree/LayoutTreeBuilder.cpp: (WebCore::Layout::TreeBuilder::createLayoutBox): * layout/tableformatting/TableFormattingContext.cpp: (WebCore::Layout::TableFormattingContext::layoutCell): 2020-06-09 Takashi Komori <Takashi.Komori@sony.com> [Curl] Implement functions to use ResourceLoadStatistics. https://bugs.webkit.org/show_bug.cgi?id=207692 Reviewed by Don Olmstead. Implement functions which are required to implement ResourceLoadStatistics for Curl port. Tests: http/tests/resourceLoadStatistics/ * CMakeLists.txt: * platform/network/curl/CookieJarDB.cpp: (WebCore::CookieJarDB::openDatabase): (WebCore::CookieJarDB::setCookie): (WebCore::CookieJarDB::allDomains): (WebCore::CookieJarDB::deleteCookiesForHostname): * platform/network/curl/CookieJarDB.h: * platform/network/curl/NetworkStorageSessionCurl.cpp: (WebCore::NetworkStorageSession::setCookiesFromDOM const): (WebCore::NetworkStorageSession::setCookies): (WebCore::NetworkStorageSession::deleteCookiesForHostnames): (WebCore::NetworkStorageSession::getHostnamesWithCookies): 2020-06-09 Sam Weinig <weinig@apple.com> Extended Color: Switch ColorMac.mm's nsColor() function over to using TinyLRUCache https://bugs.webkit.org/show_bug.cgi?id=212918 Reviewed by Darin Adler. * platform/graphics/Color.h: (WebCore::Color::isExtended const): Make asSimple() public, so nsColor() can use it. This also allows us to unfriend cachedCGColor(). * platform/graphics/mac/ColorMac.mm: (WTF::RetainPtr<NSColor>>::createValueForKey): (WebCore::nsColor): Mimic the structure of cachedCGColor() by switching over simpleColor values for common colors and using a 32 value TinyLRUCache for the rest. 2020-06-09 Xabier Rodriguez Calvar <calvaris@igalia.com> [EME] CDMProxyInstance should not keep CDMInstanceSessions hard referenced https://bugs.webkit.org/show_bug.cgi?id=212689 Reviewed by Youenn Fablet. Sessions are now tracked as WeakPtr inside the CDMInstanceProxy instead of RefPtr because this creates referencing issues as the internal objects should be released when the backing JS object is garbage collected. Test: media/encrypted-media/clearKey/clearKey-session-life-cycle.html * Modules/encryptedmedia/MediaKeySession.h: * Modules/encryptedmedia/MediaKeySession.idl: * Modules/encryptedmedia/MediaKeys.h: * Modules/encryptedmedia/MediaKeys.idl: * platform/encryptedmedia/CDMProxy.cpp: (WebCore::CDMInstanceProxy::trackSession): * platform/encryptedmedia/CDMProxy.h: (WebCore::CDMInstanceProxy::trackSession): * platform/encryptedmedia/clearkey/CDMClearKey.cpp: (WebCore::CDMInstanceClearKey::createSession): * platform/encryptedmedia/clearkey/CDMClearKey.h: * testing/Internals.cpp: (WebCore::Internals::mediaKeysInternalInstanceObjectRefCount const): (WebCore::Internals::mediaKeySessionInternalInstanceSessionObjectRefCount const): * testing/Internals.h: * testing/Internals.idl: 2020-06-09 Sihui Liu <sihui_liu@apple.com> TextManipulationController range of paragraph may be wrong after r262601 https://bugs.webkit.org/show_bug.cgi?id=212874 Reviewed by Wenson Hsieh. Start and end position of item are not properly set in r262601. Test: TextManipulation.CompleteTextManipulationSuccedsWhenContentOutOfParagraphIsAdded * editing/TextManipulationController.cpp: (WebCore::TextManipulationController::addItemIfPossible): 2020-06-08 Sihui Liu <sihui_liu@apple.com> TextManipulation should only convert text from Node's text content to tokens https://bugs.webkit.org/show_bug.cgi?id=212928 Reviewed by Wenson Hsieh. TextIterator may emit text like line breaks between nodes. This kind of text is generated based on the range of TextIterator and style of node. We need this text for splitting tokens or splitting paragraphs, but we should not convert it to normal tokens. This is because tokens should be created from content of node and text manipulation fails if content does not match. The change of this kind of text does not indicate change in content and we may still be able to finish text manipulation. Test: TextManipulation.CompleteTextManipulationReplaceTwoSimpleParagraphs * editing/TextManipulationController.cpp: (WebCore::isInPrivateUseArea): (WebCore::isTokenDelimiter): (WebCore::ParagraphContentIterator::currentContent): (WebCore::ParagraphContentIterator::appendToText): (WebCore::ParagraphContentIterator::advanceIteratorNodeAndUpdateText): (WebCore::TextManipulationController::createUnit): (WebCore::TextManipulationController::parse): (WebCore::TextManipulationController::observeParagraphs): (WebCore::TextManipulationController::replace): * editing/TextManipulationController.h: 2020-06-08 Rob Buis <rbuis@igalia.com> XMLHTTPRequest.send should not send Content-Type headers when Blob has no type https://bugs.webkit.org/show_bug.cgi?id=211999 Reviewed by Alex Christensen. XMLHTTPRequest.send should not send Content-Type headers when Blob has no type [1, 2]. This behavior overrides the behavior of the File API spec [3]. Behavior matches Firefox and Chrome. Test: imported/w3c/web-platform-tests/xhr/send-blob-with-no-mime-type.html [1] https://xhr.spec.whatwg.org/#dom-xmlhttprequest-send [2] https://fetch.spec.whatwg.org/#concept-bodyinit-extract [3] http://dev.w3.org/2006/webapi/FileAPI/#dfn-type * platform/network/mac/WebCoreResourceHandleAsOperationQueueDelegate.mm: (-[WebCoreResourceHandleAsOperationQueueDelegate connection:willSendRequest:redirectResponse:]): * xml/XMLHttpRequest.cpp: (WebCore::XMLHttpRequest::send): 2020-06-08 Simon Fraser <simon.fraser@apple.com> Horizontally scrolling elements are broken when revealed by toggling visibility https://bugs.webkit.org/show_bug.cgi?id=212439 <rdar://problem/63739559> Reviewed by Zalan Bujtas. When revealing an overflow:scroll by toggling the visibility property, make sure that we use composited scrolling. computeScrollDimensions() is only updated on layout, so we need to recompute m_hasCompositedScrollableOverflow on style change as well. Test: compositing/scrolling/async-overflow-scrolling/toggle-visibility-on-scroller.html * rendering/RenderLayer.cpp: (WebCore::RenderLayer::computeScrollDimensions): (WebCore::RenderLayer::computeHasCompositedScrollableOverflow): (WebCore::RenderLayer::calculateClipRects const): * rendering/RenderLayer.h: 2020-06-08 Sam Weinig <weinig@apple.com> Extended Color: Rename Color::lighten() and Color::darken() to Color::lightened() and Color::darkened() https://bugs.webkit.org/show_bug.cgi?id=212917 Reviewed by Darin Adler. Addresses feedback from Darin. * platform/graphics/Color.cpp: (WebCore::Color::lightened const): (WebCore::Color::darkened const): (WebCore::Color::lighten const): Deleted. (WebCore::Color::darken const): Deleted. * platform/graphics/Color.h: * rendering/RenderObject.cpp: (WebCore::RenderObject::calculateBorderStyleColor): * rendering/RenderTheme.cpp: (WebCore::RenderTheme::disabledTextColor const): * rendering/TextPaintStyle.cpp: (WebCore::adjustColorForVisibilityOnBackground): 2020-06-08 Devin Rousso <drousso@apple.com> Remove unnecessary variable in `WindowProxy::createJSWindowProxy` https://bugs.webkit.org/show_bug.cgi?id=212929 Reviewed by Darin Adler. * bindings/js/WindowProxy.cpp: (WebCore::WindowProxy::createJSWindowProxy): 2020-06-08 Pinki Gyanchandani <pgyanchandani@apple.com> Release Assert @ WebCore::RenderTreeBuilder::RenderTreeBuilder https://bugs.webkit.org/show_bug.cgi?id=212714 Reviewed by Geoffrey Garen. Widget removal in the middle of building a Render Tree causes side effects, leading to Release Assert. Moved the scope for suspension of widgets update to RenderTreeBuilder instead of having it in RenderTreeUpdater. Test would be added later. * rendering/updating/RenderTreeBuilder.h: * rendering/updating/RenderTreeUpdater.cpp: (WebCore::RenderTreeUpdater::tearDownRenderers): 2020-06-08 Yusuke Suzuki <ysuzuki@apple.com> Use usual promise in readableStreamTee https://bugs.webkit.org/show_bug.cgi?id=212715 Reviewed by Mark Lam. The spec[1] is organized to be OK to use usual promises here. This patch uses usual promises instead of internal ones. [1]: https://streams.spec.whatwg.org/#readable-stream-tee * Modules/streams/ReadableStreamInternals.js: (readableStreamTee): 2020-06-08 David Kilzer <ddkilzer@apple.com> [IPC] Adopt enum class for DragOperation <https://webkit.org/b/212870> <rdar://problem/64069940> Reviewed by Darin Adler. * dom/DataTransfer.cpp: (WebCore::dragOpFromIEOp): (WebCore::IEOpFromDragOp): (WebCore::DataTransfer::sourceOperationMask const): (WebCore::DataTransfer::destinationOperationMask const): (WebCore::DataTransfer::setSourceOperationMask): (WebCore::DataTransfer::setDestinationOperationMask): (WebCore::DataTransfer::setEffectAllowed): * page/DragActions.h: (WebCore::DragOperation): - Convert to enum class. (WebCore::anyDragOperation): * page/DragController.cpp: (WebCore::DragController::platformGenericDragOperation): (WebCore::DragController::dragEnteredOrUpdated): (WebCore::DragController::tryDocumentDrag): (WebCore::defaultOperationForDrag): (WebCore::DragController::startDrag): * page/EventHandler.cpp: (WebCore::convertDropZoneOperationToDragOperation): (WebCore::convertDragOperationToDropZoneOperation): * page/gtk/DragControllerGtk.cpp: (WebCore::DragController::dragOperation): * page/mac/DragControllerMac.mm: (WebCore::DragController::dragOperation): (WebCore::DragController::platformGenericDragOperation): * page/win/DragControllerWin.cpp: (WebCore::DragController::dragOperation): * platform/gtk/GtkUtilities.cpp: (WebCore::gdkDragActionToDragOperation): (WebCore::dragOperationToGdkDragActions): (WebCore::dragOperationToSingleGdkDragAction): 2020-06-08 Sam Weinig <weinig@apple.com> Extended Color: Unify rounding / clamping conversions between 0-1 float components and 0-255 byte components https://bugs.webkit.org/show_bug.cgi?id=212871 Reviewed by Simon Fraser. Unify all conversions of 0.0f - 1.0f float based color components to 0-255 int based color components to use the new convertToComponentByte() function which scales, rounds (using lroundf) and clamps the value. For consistency, a convertToComponentFloat() function, which just scales down an int based value to a float based value, is also added. - Removes *UsingAlternativeRounding variants (actually, we now only have this variant) for color functions which allowed callers to pick from truncation vs. rounding when overriding alpha. - Replaces all uses of scaleRoundAndClampColorChannel() with convertToComponentByte() (really just a rename). - Replaces uses of nextafter(256, 0) based conversions with convertToComponentByte(). Also: - Moves roundAndClampColorChannel() functions to SVGAnimationAdditiveValueFunctionImpl.h, which was the only places they were used. - Removes areEssentiallyEqual() overload taking ColorComponents<float>. It was ununsed. - Removes makeSimpleColorFromHSLA(...) and just inlines makeSimpleColor(hslToSRGB(...)) which now does the same thing. * css/parser/CSSPropertyParserHelpers.cpp: (WebCore::CSSPropertyParserHelpers::clampRGBComponent): Use convertPrescaledToComponentByte() to round and clamp the components. (WebCore::CSSPropertyParserHelpers::parseRGBParameters): Use uint8_t more consistently now that helpers ensure that is the return type of conversion functions. (WebCore::CSSPropertyParserHelpers::parseHSLParameters): Switch to using makeSimpleColor(hslToSRGB(...)) directly. * editing/cocoa/DataDetection.mm: (WebCore::DataDetection::detectContentInRange): Switch to using makeSimpleColor(hslToSRGB(...)) directly. * html/HTMLElement.cpp: (WebCore::parseLegacyColorValue): Use uint8_t since that is what toASCIIHexValue() returns. * html/canvas/CanvasRenderingContext2DBase.cpp: (WebCore::CanvasRenderingContext2DBase::setStrokeStyle): (WebCore::CanvasRenderingContext2DBase::setFillStyle): (WebCore::CanvasRenderingContext2DBase::setShadow): * html/canvas/CanvasStyle.cpp: (WebCore::CanvasStyle::createFromStringWithOverrideAlpha): Replaces uses of colorWithAlphaUsingAlternativeRounding() with colorWithAlpha(). * inspector/agents/InspectorDOMAgent.cpp: (WebCore::parseColor): Use convertToComponentByte() rather than a simple truncating cast. * platform/graphics/Color.cpp: (WebCore::Color::light const): (WebCore::Color::dark const): Use makeSimpleColorFromFloats() rather than nextafterf(256.0f, 0.0f) conversion. (WebCore::Color::colorWithAlpha const): (WebCore::Color::invertedColorWithAlpha const): Use convertToComponentByte() for alpha conversion. (WebCore::Color::toSRGBASimpleColorLossy const): Call asExtended().toSRGBAComponentsLossy() directly to avoid unnecessary branch. (WebCore::Color::colorWithAlphaMultipliedBy const): Deleted. (WebCore::Color::colorWithAlphaMultipliedByUsingAlternativeRounding const): Deleted. (WebCore::Color::colorWithAlphaUsingAlternativeRounding const): Deleted. Remove UsingAlternativeRounding variants. * platform/graphics/Color.h: (WebCore::Color::alpha const): Use convertToComponentByte() for alpha conversion. (WebCore::Color::invertedColorWithAlpha const): Add an overload taking an Optional<float> for consistency. (WebCore::Color::colorWithAlphaMultipliedBy const): (WebCore::Color::colorWithAlpha const): Simplify by inlining all variants except the main colorWithAlpha(). * platform/graphics/ColorUtilities.cpp: (WebCore::areEssentiallyEqual): Deleted. Remove unused function. * platform/graphics/ColorUtilities.h: (WebCore::convertPrescaledToComponentByte): Added. Useful for callers who already have prescaled values but need rounding/clamping. (WebCore::convertToComponentByte): Added. Bottleneck for float to byte based color component conversions. (WebCore::convertToComponentFloat): Added. Bottleneck for byte to float based color component conversions. * platform/graphics/SimpleColor.cpp: (WebCore::makeSimpleColorFromCMYKA): Use makeSimpleColorFromFloats() rather than nextafterf(256.0f, 0.0f) conversion. Eventually, when we probably want this to go away and store CMYKA colors as ExtendedColors with their own color space. (WebCore::makeSimpleColorFromFloats): Moved to header. * platform/graphics/SimpleColor.h: (WebCore::SimpleColor::alphaComponentAsFloat const): Use convertToComponentFloat(). (WebCore::SimpleColor::asSRGBFloatComponents const): Use convertToComponentFloat(). (WebCore::makeSimpleColor): Avoid unncessary clamping of the alpha component by calling constructor directly. (WebCore::makeSimpleColorFromFloats): Inlined. Calls convertToComponentByte now rather than the older (identical) scaleRoundAndClampColorChannel(). * platform/graphics/cairo/CairoOperations.cpp: (WebCore::Cairo::prepareCairoContextSource): Replaces use of colorWithAlphaMultipliedByUsingAlternativeRounding with colorWithAlphaMultipliedBy(). * platform/graphics/cg/ColorCG.cpp: (WebCore::makeSimpleColorFromCGColor): Use makeSimpleColorFromFloats() rather than nextafter(256.0, 0.0) conversion. * platform/graphics/filters/FEFlood.cpp: (WebCore::FEFlood::platformApplySoftware): Replaces use of colorWithAlphaMultipliedByUsingAlternativeRounding with colorWithAlphaMultipliedBy(). * platform/graphics/mac/ColorMac.mm: (WebCore::makeSimpleColorFromNSColor): Use makeSimpleColorFromFloats() rather than nextafter(256.0, 0.0) conversion. * platform/ios/ColorIOS.mm: (WebCore::colorFromUIColor): Use makeSimpleColorFromFloats() rather than nextafter(256.0, 0.0) conversion. * svg/SVGStopElement.cpp: (WebCore::SVGStopElement::stopColorIncludingOpacity const): Replaces use of colorWithAlphaMultipliedByUsingAlternativeRounding with colorWithAlphaMultipliedBy(). * svg/properties/SVGAnimationAdditiveValueFunctionImpl.h: (WebCore::SVGAnimationColorFunction::roundAndClampColorChannel): Moved from ColorUtilities.h as this was the only use. 2020-06-08 Sam Weinig <weinig@apple.com> Extended Color: Replace uses of differenceSquared() with luminance based computations https://bugs.webkit.org/show_bug.cgi?id=212872 Reviewed by Darin Adler. Replace all uses of differenceSquared() with luminance based comparisons. This is possible because all of the uses of differenceSquared() were about identifying a distance from black or white to determine relative brightness. It is more accurate to do this in terms of luminance, and has the added benefit of being something that is expressible in all colorspaces (since luminance is defined as the Y-component of the XYZ colorspace which all colorspaces are convertable to). * platform/graphics/Color.cpp: (WebCore::Color::lighten const): Renamed Color::light() to Color::lighten(), which makes more sense. The algorithm used should be updated at some point to also use luminance, but is unchanged for now. (WebCore::Color::darken const): Renamed Color::dark() to Color::darken(), which makes more sense. The algorithm used should be updated at some point to also use luminance, but is unchanged for now. (WebCore::Color::luminance const): Added. Converts to sRGB for now, but can be updated to work with other color spaces when needed. * platform/graphics/Color.h: Removed differenceSquared. * platform/graphics/ColorUtilities.cpp: (WebCore::luminance): Updated to use the standard conversion to linear-sRGB. While there are certainly some places that specify a 0.03928 cutoff, the much more accepted value (and value specified by the IEC) is 0.04045, which we use for all other gamma correction. (See https://entropymine.com/imageworsener/srgbformula/ or https://en.wikipedia.org/wiki/SRGB#The_forward_transformation_(CIE_XYZ_to_sRGB) for more information on this). Also added a FIXME about how in the future we can avoid hardcoding the specific values multiple times by extracting them from the linear-sRGB to XYZ matrix. * rendering/RenderObject.cpp: (WebCore::RenderObject::calculateBorderStyleColor): Use luminance, rather than distance as a better comparison for whether the color is too dark or too light for modification. * rendering/RenderTheme.cpp: (WebCore::RenderTheme::disabledTextColor const): Use luminance, rather than distance as a better comparison for whether the color is too dark or too light for modification. Also us the contrastRatio utility function to determine illegibility issues due to contrast, picking a new minimum that roughly matches the old one based fast/forms/input-disabled-color.html * rendering/TextPaintStyle.cpp: (WebCore::adjustColorForVisibilityOnBackground): Use luminance, rather than distance as a better comparison for whether the color is too dark or too light for modification. 2020-06-08 Youenn Fablet <youenn@apple.com> Missing WebRTC Metrics in iOS Safari https://bugs.webkit.org/show_bug.cgi?id=212668 <rdar://problem/63902458> Reviewed by Eric Carlson. Expose more transports related stats. Covered by updated test. * Modules/mediastream/RTCStatsReport.h: * Modules/mediastream/RTCStatsReport.idl: * Modules/mediastream/libwebrtc/LibWebRTCStatsCollector.cpp: (WebCore::fillRTCTransportStats): 2020-06-08 Youenn Fablet <youenn@apple.com> Add missed WebRTC media-source and remote-inbound-rtp stats https://bugs.webkit.org/show_bug.cgi?id=206645 <rdar://problem/58833958> Reviewed by Eric Carlson. Update stats according latest spec and webrtc backend. We still expose obsolete trackId for consistency with existing WPT tests. Covered by existing and updated tests. * Modules/mediastream/RTCStatsReport.h: (WebCore::RTCStatsReport::InboundRtpStreamStats::InboundRtpStreamStats): (WebCore::RTCStatsReport::RemoteInboundRtpStreamStats::RemoteInboundRtpStreamStats): (WebCore::RTCStatsReport::OutboundRtpStreamStats::OutboundRtpStreamStats): (WebCore::RTCStatsReport::InboundRTPStreamStats::InboundRTPStreamStats): Deleted. (WebCore::RTCStatsReport::OutboundRTPStreamStats::OutboundRTPStreamStats): Deleted. * Modules/mediastream/RTCStatsReport.idl: * Modules/mediastream/libwebrtc/LibWebRTCStatsCollector.cpp: (WebCore::fillRtpStreamStats): (WebCore::fillReceivedRtpStreamStats): (WebCore::fillInboundRtpStreamStats): (WebCore::fillRemoteInboundRtpStreamStats): (WebCore::fillSentRtpStreamStats): (WebCore::fillOutboundRtpStreamStats): (WebCore::initializeRTCStatsReportBackingMap): (WebCore::fillRTCRTPStreamStats): Deleted. (WebCore::fillInboundRTPStreamStats): Deleted. (WebCore::fillOutboundRTPStreamStats): Deleted. 2020-06-08 Jonathan Bedard <jbedard@apple.com> WebCore: Add tvOS and watchOS SPI headers https://bugs.webkit.org/show_bug.cgi?id=212853 <rdar://problem/64048485> Reviewed by Andy Estes. No new tests, no behavior changed. * platform/ios/WebCoreMotionManager.h: Forward-declare CMMotionManager. * platform/ios/WebCoreMotionManager.mm: Include CoreMotionSPI.h. 2020-06-08 Zalan Bujtas <zalan@apple.com> [LFC][IFC] Add support for min/max-width/height https://bugs.webkit.org/show_bug.cgi?id=212904 Reviewed by Antti Koivisto. Test: fast/layoutformattingcontext/inline-max-width-height-simple.html * layout/FormattingContextGeometry.cpp: (WebCore::Layout::FormattingContext::Geometry::computedWidthValue): Adjust assert to check inline, non-replaced boxes only (inline-block is an inline level element but not an inline element) * layout/inlineformatting/InlineFormattingContext.cpp: (WebCore::Layout::InlineFormattingContext::computeWidthAndMargin): (WebCore::Layout::InlineFormattingContext::computeHeightAndMargin): 2020-06-05 Sergio Villar Senin <svillar@igalia.com> [WebXR] Add missing interfaces from the AR module https://bugs.webkit.org/show_bug.cgi?id=212826 Reviewed by Youenn Fablet. Added the XRInteractionMode partial interface from the WebXR AR module spec. This spec https://immersive-web.github.io/webxr-ar-module/ expands the WebXR Device API with functionality available in AR hardware. Some WebXR wpt tests are now passing. * CMakeLists.txt: Added new files. * DerivedSources.make: Ditto. * Modules/webxr/WebXRSession.cpp: (WebCore::WebXRSession::interactionMode const): Added. * Modules/webxr/WebXRSession.h: Added interactionMode attribute and getter; * Modules/webxr/WebXRSession.idl: Added interactionMode attribute; * Modules/webxr/XRInteractionMode.h: Added. * Modules/webxr/XRInteractionMode.idl: Added. * Sources.txt: Added new files. * WebCore.xcodeproj/project.pbxproj: Ditto. 2020-05-29 Sergio Villar Senin <svillar@igalia.com> [WebXR] Pass an unsigned long to cancelAnimationCallback() as handle https://bugs.webkit.org/show_bug.cgi?id=212529 Reviewed by Youenn Fablet. The type of the handle returned by XRSession::requestAnimationFrame() was recently changed to unsigned long from long as there was no point in using signed integers for that. However we forgot to update the cancelAnimationFrame() in the specs as well as it receives the handle returned by requestAnimationFrame(). We landed https://github.com/immersive-web/webxr/pull/1069 in the WebXR specs so we can now safely also replace signed by unsigned integers in our implementation. No new tests as there is no change in functionality. * Modules/webxr/WebXRSession.cpp: (WebCore::WebXRSession::cancelAnimationFrame): Use unsigned ids. * Modules/webxr/WebXRSession.h: Ditto. * Modules/webxr/WebXRSession.idl: Ditto. 2020-06-01 Sergio Villar Senin <svillar@igalia.com> [css-flexbox] align-content should apply even when there's just a single line https://bugs.webkit.org/show_bug.cgi?id=209871 Reviewed by Manuel Rego Casasnovas. The 'align-content' property should have no effect on single line flex containers according to the specs https://drafts.csswg.org/css-flexbox/#propdef-align-content. The current code was not differentiating between single-line containers and multi-line containers with just 1 line. Also in order not to introduce regressions and properly support replaced elements as flex items we replaced the computation of child's width for 'flex-direction:column' by a direct call to computeLogicalWidthForFragment() which already properly handles all the cases. It used to be just the shrink-to-fit computation but that was not enough for replaced elements for example or elements with min/max-size restrictions. Several align-content-wrap-* subtests are working now. Updated expectations. * rendering/RenderFlexibleBox.cpp: (WebCore::initialAlignContentOffset): Removed check for #lines <= 1, as it is incorrect because it is true for multi-line containers with just 1 line. (WebCore::RenderFlexibleBox::alignFlexLines): Use isMultiline() instead of "#lines == 1". (WebCore::RenderFlexibleBox::childIntrinsicLogicalWidth const): Replace shrink-to-fit computation by a call computeLogicalWidthForFragment(). (WebCore::RenderFlexibleBox::repositionLogicalHeightDependentFlexItems): Use the whole crossAxisExtent for single line containers. Moved from alignFlexLines() as it fits much better here. 2020-06-08 Andy Estes <aestes@apple.com> [Apple Pay] Remove ENABLE_APPLE_PAY_SETUP, ENABLE_APPLE_PAY_SESSION_V7, and HAVE_PASSKIT_PAYMENT_SETUP https://bugs.webkit.org/show_bug.cgi?id=212883 <rdar://problem/64090763> Reviewed by Youenn Fablet. These macros evaluate to true whenever ENABLE(APPLE_PAY) is true on platforms supported by trunk WebKit, so we can either remove them or replace them with ENABLE(APPLE_PAY). * Modules/applepay/ApplePaySetup.cpp: * Modules/applepay/ApplePaySetup.idl: * Modules/applepay/ApplePaySetupConfiguration.h: * Modules/applepay/ApplePaySetupConfiguration.idl: * Modules/applepay/ApplePaySetupFeature.idl: * Modules/applepay/ApplePaySetupFeature.mm: * Modules/applepay/ApplePaySetupFeatureState.h: * Modules/applepay/ApplePaySetupFeatureState.idl: * Modules/applepay/ApplePaySetupFeatureType.idl: * Modules/applepay/ApplePaySetupFeatureTypeWebCore.h: * Modules/applepay/ApplePaySetupFeatureWebCore.h: * Modules/applepay/ApplePaySetupWebCore.h: * Modules/applepay/PaymentCoordinator.cpp: * Modules/applepay/PaymentCoordinator.h: * Modules/applepay/PaymentCoordinatorClient.cpp: (WebCore::PaymentCoordinatorClient::supportsVersion): * Modules/applepay/PaymentCoordinatorClient.h: (WebCore::PaymentCoordinatorClient::endApplePaySetup): * testing/MockApplePaySetupFeature.cpp: * testing/MockApplePaySetupFeature.h: * testing/MockPaymentCoordinator.cpp: * testing/MockPaymentCoordinator.h: * testing/MockPaymentCoordinator.idl: 2020-06-08 Antti Koivisto <antti@apple.com> Pseudo-elements (::after) in shadow roots don't animate https://bugs.webkit.org/show_bug.cgi?id=173027 <rdar://problem/42842994> Reviewed by Antoine Quint. Test: animations/keyframe-pseudo-shadow.html * animation/AnimationTimeline.cpp: (WebCore::shouldConsiderAnimation): We should use the actual element instead of the PseudoElement when calling Style::Scope::forOrdinal. The keyframe code that computes the style already does this correctly. 2020-06-08 Youenn Fablet <youenn@apple.com> Use one audio unit for all tracks of a given process https://bugs.webkit.org/show_bug.cgi?id=212406 Reviewed by Eric Carlson. Before the patch, we were creating one audio unit per track to render. This is potentially inefficient as this requires to IPC on iOS each audio data. Instead, we could have one single remote unit that will receive the mixed content of all tracks. For that purpose, introduce AudioMediaStreamTrackRendererUnit as a singleton. AudioMediaStreamTrackRendererCocoa will just register/unregister sources to AudioMediaStreamTrackRendererUnit. AudioMediaStreamTrackRendererUnit will then start/stop as needed and do the mixing. This requires a change in AudioSampleDataSource to support mixing in case track volumes are different. If we have to mix and with different volumes, we first pull the samples in a scratch buffer, apply volume and then mix it with the other tracks. In the future, we might also do the audio rendering with the CoreAudioSharedUnit directly so as to improve as much as possible echo cancellation. Interruption is handled by the fact that all tracks should stop playing, thus stop their renderer, thus unregister themselves from the renderer unit. it might be more future proof to add the unit as an interruption observer as a follow-up. Manually tested plus LayoutTests/webrtc/multi-audio.html * SourcesCocoa.txt: * WebCore.xcodeproj/project.pbxproj: * platform/audio/mac/AudioSampleBufferList.cpp: (WebCore::mixBuffers): (WebCore::AudioSampleBufferList::mixFrom): * platform/audio/mac/AudioSampleBufferList.h: * platform/audio/mac/AudioSampleDataSource.mm: (WebCore::AudioSampleDataSource::pullSamplesInternal): * platform/mediastream/mac/AudioMediaStreamTrackRendererCocoa.cpp: (WebCore::AudioMediaStreamTrackRendererCocoa::start): (WebCore::AudioMediaStreamTrackRendererCocoa::stop): (WebCore::AudioMediaStreamTrackRendererCocoa::clear): (WebCore::AudioMediaStreamTrackRendererCocoa::setVolume): (WebCore::AudioMediaStreamTrackRendererCocoa::pushSamples): (WebCore::AudioMediaStreamTrackRendererCocoa::createAudioUnit): Deleted. (WebCore::AudioMediaStreamTrackRendererCocoa::render): Deleted. (WebCore::AudioMediaStreamTrackRendererCocoa::inputProc): Deleted. * platform/mediastream/mac/AudioMediaStreamTrackRendererCocoa.h: (): Deleted. * platform/mediastream/mac/AudioMediaStreamTrackRendererUnit.cpp: Added. (WebCore::AudioMediaStreamTrackRendererUnit::singleton): (WebCore::AudioMediaStreamTrackRendererUnit::~AudioMediaStreamTrackRendererUnit): (WebCore::AudioMediaStreamTrackRendererUnit::addSource): (WebCore::AudioMediaStreamTrackRendererUnit::removeSource): (WebCore::AudioMediaStreamTrackRendererUnit::createAudioUnitIfNeeded): (WebCore::AudioMediaStreamTrackRendererUnit::start): (WebCore::AudioMediaStreamTrackRendererUnit::stop): (WebCore::AudioMediaStreamTrackRendererUnit::formatDescription): (WebCore::AudioMediaStreamTrackRendererUnit::createAudioUnit): (WebCore::AudioMediaStreamTrackRendererUnit::render): (WebCore::AudioMediaStreamTrackRendererUnit::inputProc): * platform/mediastream/mac/AudioMediaStreamTrackRendererUnit.h: Copied from Source/WebCore/platform/mediastream/mac/AudioMediaStreamTrackRendererCocoa.h. 2020-06-08 youenn fablet <youenn@apple.com> [Cocoa] Use AVAssetWriterDelegate to implement MediaRecorder https://bugs.webkit.org/show_bug.cgi?id=206582 <rdar://problem/58985368> Reviewed by Eric Carlson. AVAssetWriterDelegate allows to grab recorded data whenever wanted. This delegate requires passing compressed samples to AVAssetWriter. Implement video encoding and audio encoding in dedicated classes and use these classes before adding buffers to AVAssetWriter. These classes are AudioSampleBufferCompressor and VideoSampleBufferCompressor. They support AAC and H264 so far and should be further improved to support more encoding options. Instantiate real writer only for platforms supporting AVAssetWriterDelegate, since it is not supported everywhere. The writer, doing the pacakging, is receiving compressed buffer from the audio/video compressors. It then sends data when being request to flush to its delegate, which will send data to the MediaRecorderPrivateWriter. The MediaRecorderPrivateWriter stores the data in a SharedBuffer until MediaRecorder asks for data. Note that, whenever we request data, we flush the writer and insert an end of video sample to make sure video data gets flushed. Therefore data should not be requested too fast to get adequate video compression. Covered by existing tests. * Modules/mediarecorder/MediaRecorderProvider.cpp: (WebCore::MediaRecorderProvider::createMediaRecorderPrivate): * WebCore.xcodeproj/project.pbxproj: * platform/mediarecorder/MediaRecorderPrivateAVFImpl.cpp: (WebCore::MediaRecorderPrivateAVFImpl::create): * platform/mediarecorder/MediaRecorderPrivateAVFImpl.h: * platform/mediarecorder/cocoa/AudioSampleBufferCompressor.h: Added. * platform/mediarecorder/cocoa/AudioSampleBufferCompressor.mm: Added. (WebCore::AudioSampleBufferCompressor::create): (WebCore::AudioSampleBufferCompressor::AudioSampleBufferCompressor): (WebCore::AudioSampleBufferCompressor::~AudioSampleBufferCompressor): (WebCore::AudioSampleBufferCompressor::initialize): (WebCore::AudioSampleBufferCompressor::finish): (WebCore::AudioSampleBufferCompressor::initAudioConverterForSourceFormatDescription): (WebCore::AudioSampleBufferCompressor::computeBufferSizeForAudioFormat): (WebCore::AudioSampleBufferCompressor::attachPrimingTrimsIfNeeded): (WebCore::AudioSampleBufferCompressor::gradualDecoderRefreshCount): (WebCore::AudioSampleBufferCompressor::sampleBufferWithNumPackets): (WebCore::AudioSampleBufferCompressor::audioConverterComplexInputDataProc): (WebCore::AudioSampleBufferCompressor::provideSourceDataNumOutputPackets): (WebCore::AudioSampleBufferCompressor::processSampleBuffersUntilLowWaterTime): (WebCore::AudioSampleBufferCompressor::processSampleBuffer): (WebCore::AudioSampleBufferCompressor::addSampleBuffer): (WebCore::AudioSampleBufferCompressor::getOutputSampleBuffer): (WebCore::AudioSampleBufferCompressor::takeOutputSampleBuffer): * platform/mediarecorder/cocoa/MediaRecorderPrivateWriterCocoa.h: * platform/mediarecorder/cocoa/MediaRecorderPrivateWriterCocoa.mm: (-[WebAVAssetWriterDelegate initWithWriter:]): (-[WebAVAssetWriterDelegate assetWriter:didProduceFragmentedHeaderData:]): (-[WebAVAssetWriterDelegate assetWriter:didProduceFragmentedMediaData:fragmentedMediaDataReport:]): (-[WebAVAssetWriterDelegate close]): (WebCore::MediaRecorderPrivateWriter::create): (WebCore::MediaRecorderPrivateWriter::compressedVideoOutputBufferCallback): (WebCore::MediaRecorderPrivateWriter::compressedAudioOutputBufferCallback): (WebCore::MediaRecorderPrivateWriter::MediaRecorderPrivateWriter): (WebCore::MediaRecorderPrivateWriter::~MediaRecorderPrivateWriter): (WebCore::MediaRecorderPrivateWriter::initialize): (WebCore::MediaRecorderPrivateWriter::processNewCompressedVideoSampleBuffers): (WebCore::MediaRecorderPrivateWriter::processNewCompressedAudioSampleBuffers): (WebCore::MediaRecorderPrivateWriter::startAssetWriter): (WebCore::MediaRecorderPrivateWriter::appendCompressedAudioSampleBuffer): (WebCore::MediaRecorderPrivateWriter::appendCompressedVideoSampleBuffer): (WebCore::MediaRecorderPrivateWriter::appendCompressedSampleBuffers): (WebCore::appendEndsPreviousSampleDurationMarker): (WebCore::MediaRecorderPrivateWriter::appendEndOfVideoSampleDurationIfNeeded): (WebCore::MediaRecorderPrivateWriter::flushCompressedSampleBuffers): (WebCore::MediaRecorderPrivateWriter::clear): (WebCore::copySampleBufferWithCurrentTimeStamp): (WebCore::MediaRecorderPrivateWriter::appendVideoSampleBuffer): (WebCore::createAudioFormatDescription): (WebCore::createAudioSampleBuffer): (WebCore::MediaRecorderPrivateWriter::appendAudioSampleBuffer): (WebCore::MediaRecorderPrivateWriter::stopRecording): (WebCore::MediaRecorderPrivateWriter::appendData): * platform/mediarecorder/cocoa/VideoSampleBufferCompressor.h: Copied from Source/WebCore/platform/mediarecorder/MediaRecorderPrivateAVFImpl.h. * platform/mediarecorder/cocoa/VideoSampleBufferCompressor.mm: Added. (WebCore::VideoSampleBufferCompressor::create): (WebCore::VideoSampleBufferCompressor::VideoSampleBufferCompressor): (WebCore::VideoSampleBufferCompressor::~VideoSampleBufferCompressor): (WebCore::VideoSampleBufferCompressor::initialize): (WebCore::VideoSampleBufferCompressor::finish): (WebCore::VideoSampleBufferCompressor::videoCompressionCallback): (WebCore::VideoSampleBufferCompressor::initCompressionSession): (WebCore::VideoSampleBufferCompressor::processSampleBuffer): (WebCore::VideoSampleBufferCompressor::addSampleBuffer): (WebCore::VideoSampleBufferCompressor::getOutputSampleBuffer): (WebCore::VideoSampleBufferCompressor::takeOutputSampleBuffer): 2020-06-08 Youenn Fablet <youenn@apple.com> File URLs with hostnames are misleading https://bugs.webkit.org/show_bug.cgi?id=212739 <rdar://problem/63754917> Reviewed by Alex Christensen. Showing a file URL like file://example.org/test is misleading to users. To prevent this, we just do a redirection to the same file URL with an empty host. Remove the port at the same time. Covered by added API test. * loader/DocumentLoader.cpp: (WebCore::DocumentLoader::willSendRequest): 2020-06-08 Rob Buis <rbuis@igalia.com> Simplify fallback content handling in FrameLoader https://bugs.webkit.org/show_bug.cgi?id=212880 Reviewed by Youenn Fablet. Simplify fallback content handling in FrameLoader, this can be inlined and some HTMLObjectElement checks can be combined. * loader/DocumentLoader.cpp: (WebCore::DocumentLoader::continueAfterContentPolicy): * loader/FrameLoader.cpp: (WebCore::FrameLoader::receivedMainResourceError): (WebCore::FrameLoader::handleFallbackContent): Deleted. (WebCore::FrameLoader::isHostedByObjectElement const): Deleted. * loader/FrameLoader.h: * loader/HistoryController.cpp: (WebCore::FrameLoader::HistoryController::createItemTree): 2020-06-07 Zalan Bujtas <zalan@apple.com> [LFC][Height percentage] Skip anonymous wrappers when searching for fixed height https://bugs.webkit.org/show_bug.cgi?id=212881 Reviewed by Antti Koivisto. When the block level box is a direct child of an inline level box (<span><div></div></span>) and we wrap it into a continuation, the containing block (anonymous wrapper) is not the box we need to check for fixed height. Test: fast/layoutformattingcontext/height-precentage-with-anonymous-wrapper.html * layout/FormattingContextGeometry.cpp: (WebCore::Layout::FormattingContext::Geometry::computedHeightValue const): 2020-06-07 Zalan Bujtas <zalan@apple.com> [LFC][BFC] Intrinsic width computation should take min/max-width into account. https://bugs.webkit.org/show_bug.cgi?id=212876 Reviewed by Antti Koivisto. Test: fast/layoutformattingcontext/min-max-content-width-simple2.html * layout/FormattingContextGeometry.cpp: (WebCore::Layout::FormattingContext::Geometry::computedWidthValue): Address Sam's post-landing comment. * layout/blockformatting/BlockFormattingContextGeometry.cpp: (WebCore::Layout::BlockFormattingContext::Geometry::intrinsicWidthConstraints): 2020-06-07 Zalan Bujtas <zalan@apple.com> [LFC] Pass in the element attributes to Layout::ReplacedBox https://bugs.webkit.org/show_bug.cgi?id=212879 Reviewed by Antti Koivisto. The information whether the replace box is an image box is required to see if the box has intrinsic ratio (used for sizing inflow replaced content). * layout/layouttree/LayoutReplacedBox.cpp: (WebCore::Layout::ReplacedBox::ReplacedBox): (): Deleted. * layout/layouttree/LayoutReplacedBox.h: * layout/layouttree/LayoutTreeBuilder.cpp: (WebCore::Layout::TreeBuilder::createReplacedBox): (WebCore::Layout::TreeBuilder::createLayoutBox): * layout/layouttree/LayoutTreeBuilder.h: 2020-06-07 Philippe Normand <pnormand@igalia.com> Remove ENABLE_VIDEO_TRACK ifdef guards https://bugs.webkit.org/show_bug.cgi?id=212568 Reviewed by Youenn Fablet. * CMakeLists.txt: * Configurations/FeatureDefines.xcconfig: * Modules/mediacontrols/MediaControlsHost.cpp: * Modules/mediasource/AudioTrackMediaSource.h: * Modules/mediasource/AudioTrackMediaSource.idl: * Modules/mediasource/SourceBuffer.h: * Modules/mediasource/SourceBuffer.idl: * Modules/mediasource/TextTrackMediaSource.h: * Modules/mediasource/TextTrackMediaSource.idl: * Modules/mediasource/VideoTrackMediaSource.h: * Modules/mediasource/VideoTrackMediaSource.idl: * Modules/pictureinpicture/HTMLVideoElementPictureInPicture.cpp: (WebCore::HTMLVideoElementPictureInPicture::requestPictureInPicture): * Sources.txt: * WebCore.xcodeproj/project.pbxproj: * bindings/js/JSAudioTrackCustom.cpp: * bindings/js/JSAudioTrackListCustom.cpp: * bindings/js/JSTextTrackCueCustom.cpp: * bindings/js/JSTextTrackCustom.cpp: * bindings/js/JSTextTrackListCustom.cpp: * bindings/js/JSTrackCustom.cpp: * bindings/js/JSTrackCustom.h: * bindings/js/JSVideoTrackCustom.cpp: * bindings/js/JSVideoTrackListCustom.cpp: * css/CSSSelector.cpp: (WebCore::CSSSelector::pseudoId): (WebCore::CSSSelector::selectorText const): * css/CSSSelector.h: * css/SelectorChecker.cpp: (WebCore::SelectorChecker::checkOne const): * css/SelectorCheckerTestFunctions.h: (WebCore::matchesLangPseudoClass): * css/SelectorPseudoClassAndCompatibilityElementMap.in: * css/SelectorPseudoElementTypeMap.in: * css/parser/CSSParserSelector.h: (WebCore::CSSParserSelector::needsImplicitShadowCombinatorForMatching const): (WebCore::CSSParserSelector::isPseudoElementCueFunction const): * css/parser/CSSSelectorParser.cpp: (WebCore::CSSSelectorParser::consumePseudo): * cssjit/SelectorCompiler.cpp: (WebCore::SelectorCompiler::addPseudoClassType): * dom/Document.cpp: * dom/Document.h: * dom/EventNames.in: * dom/EventTargetFactory.in: * dom/Node.h: * history/BackForwardCache.cpp: * history/BackForwardCache.h: * history/CachedPage.cpp: (WebCore::CachedPage::restore): (WebCore::CachedPage::clear): * history/CachedPage.h: * html/HTMLLinkElement.cpp: (WebCore::HTMLLinkElement::as const): * html/HTMLMediaElement.cpp: (WebCore::HTMLMediaElement::HTMLMediaElement): (WebCore::HTMLMediaElement::~HTMLMediaElement): (WebCore::HTMLMediaElement::registerWithDocument): (WebCore::HTMLMediaElement::unregisterWithDocument): (WebCore::HTMLMediaElement::finishParsingChildren): (WebCore::HTMLMediaElement::prepareForLoad): (WebCore::HTMLMediaElement::selectMediaResource): (WebCore::HTMLMediaElement::canTransitionFromAutoplayToPlay const): (WebCore::HTMLMediaElement::setReadyState): (WebCore::HTMLMediaElement::mediaPlayerKeyNeeded): (WebCore::HTMLMediaElement::playInternal): (WebCore::HTMLMediaElement::setVolume): (WebCore::HTMLMediaElement::playbackProgressTimerFired): (WebCore::HTMLMediaElement::configureTextTracks): (WebCore::HTMLMediaElement::mediaPlayerTimeChanged): (WebCore::HTMLMediaElement::mediaPlayerCharacteristicChanged): (WebCore::HTMLMediaElement::userCancelledLoad): (WebCore::HTMLMediaElement::clearMediaPlayer): (WebCore::HTMLMediaElement::syncTextTrackBounds): (WebCore::HTMLMediaElement::setVideoFullscreenStandby): (WebCore::HTMLMediaElement::setVideoFullscreenLayer): (WebCore::HTMLMediaElement::hasClosedCaptions const): (WebCore::HTMLMediaElement::setClosedCaptionsVisible): (WebCore::HTMLMediaElement::createMediaPlayer): (WebCore::HTMLMediaElement::bufferingPolicy const): * html/HTMLMediaElement.h: * html/HTMLMediaElement.idl: * html/HTMLTagNames.in: * html/HTMLTrackElement.cpp: * html/HTMLTrackElement.h: * html/HTMLTrackElement.idl: * html/canvas/WebGLRenderingContextBase.cpp: (WebCore::WebGLRenderingContextBase::texImageSourceHelper): (WebCore::WebGLRenderingContextBase::validateTexFuncParameters): * html/shadow/MediaControlTextTrackContainerElement.cpp: * html/shadow/MediaControlTextTrackContainerElement.h: * html/track/AudioTrack.cpp: * html/track/AudioTrack.h: * html/track/AudioTrack.idl: * html/track/AudioTrackList.cpp: * html/track/AudioTrackList.h: * html/track/AudioTrackList.idl: * html/track/DataCue.cpp: * html/track/DataCue.h: * html/track/DataCue.idl: * html/track/InbandDataTextTrack.cpp: * html/track/InbandDataTextTrack.h: * html/track/InbandGenericTextTrack.cpp: * html/track/InbandGenericTextTrack.h: * html/track/InbandTextTrack.cpp: * html/track/InbandTextTrack.h: * html/track/InbandWebVTTTextTrack.cpp: * html/track/InbandWebVTTTextTrack.h: * html/track/LoadableTextTrack.cpp: * html/track/LoadableTextTrack.h: * html/track/TextTrack.cpp: * html/track/TextTrack.h: * html/track/TextTrack.idl: * html/track/TextTrackCue.cpp: * html/track/TextTrackCue.h: * html/track/TextTrackCue.idl: * html/track/TextTrackCueGeneric.cpp: * html/track/TextTrackCueGeneric.h: * html/track/TextTrackCueGeneric.idl: * html/track/TextTrackCueList.cpp: * html/track/TextTrackCueList.h: * html/track/TextTrackCueList.idl: * html/track/TextTrackList.cpp: * html/track/TextTrackList.h: * html/track/TextTrackList.idl: * html/track/TrackBase.cpp: * html/track/TrackBase.h: * html/track/TrackEvent.cpp: * html/track/TrackEvent.h: * html/track/TrackEvent.idl: * html/track/TrackListBase.cpp: * html/track/TrackListBase.h: * html/track/VTTCue.cpp: * html/track/VTTCue.h: * html/track/VTTCue.idl: * html/track/VTTRegion.cpp: * html/track/VTTRegion.h: * html/track/VTTRegion.idl: * html/track/VTTRegionList.cpp: * html/track/VTTRegionList.h: * html/track/VTTRegionList.idl: * html/track/VideoTrack.cpp: * html/track/VideoTrack.h: * html/track/VideoTrack.idl: * html/track/VideoTrackList.cpp: * html/track/VideoTrackList.h: * html/track/VideoTrackList.idl: * html/track/WebVTTElement.cpp: * html/track/WebVTTElement.h: * html/track/WebVTTParser.cpp: * html/track/WebVTTParser.h: * html/track/WebVTTToken.h: * html/track/WebVTTTokenizer.cpp: * html/track/WebVTTTokenizer.h: * loader/LinkLoader.cpp: (WebCore::LinkLoader::resourceTypeFromAsAttribute): (WebCore::createLinkPreloadResourceClient): (WebCore::LinkLoader::isSupportedType): * loader/ResourceLoadInfo.cpp: (WebCore::ContentExtensions::toResourceType): * loader/SubresourceLoader.cpp: (WebCore::logResourceLoaded): * loader/TextTrackLoader.cpp: * loader/TextTrackLoader.h: * loader/cache/CachedResource.cpp: (WebCore::CachedResource::defaultPriorityForResourceType): * loader/cache/CachedResource.h: * loader/cache/CachedResourceLoader.cpp: (WebCore::createResource): (WebCore::contentTypeFromResourceType): (WebCore::CachedResourceLoader::checkInsecureContent const): (WebCore::CachedResourceLoader::allowedByContentSecurityPolicy const): (WebCore::destinationForType): * loader/cache/CachedResourceLoader.h: * loader/cache/CachedTextTrack.cpp: * loader/cache/CachedTextTrack.h: * page/CaptionUserPreferences.cpp: * page/CaptionUserPreferences.h: * page/CaptionUserPreferencesMediaAF.cpp: * page/CaptionUserPreferencesMediaAF.h: * page/Page.cpp: (WebCore::Page::setPageScaleFactor): (WebCore::Page::setUserInterfaceLayoutDirection): (WebCore::Page::doAfterUpdateRendering): (WebCore::Page::forEachMediaElement): * page/Page.h: * page/PageGroup.cpp: * page/PageGroup.h: * page/Settings.yaml: * platform/LocalizedStrings.cpp: * platform/LocalizedStrings.h: * platform/MIMETypeRegistry.cpp: (WebCore::MIMETypeRegistry::isSupportedImageVideoOrSVGMIMEType): * platform/SerializedPlatformDataCue.cpp: * platform/graphics/AudioTrackPrivate.h: * platform/graphics/ImageDecoder.cpp: (WebCore::ImageDecoder::create): (WebCore::ImageDecoder::supportsMediaType): * platform/graphics/InbandGenericCue.cpp: * platform/graphics/InbandGenericCue.h: * platform/graphics/InbandTextTrackPrivate.h: * platform/graphics/InbandTextTrackPrivateClient.h: * platform/graphics/MediaPlayer.cpp: (WebCore::buildMediaEnginesVector): * platform/graphics/MediaPlayer.h: (WebCore::MediaPlayerClient::textTrackRepresentationBoundsChanged): * platform/graphics/MediaPlayerPrivate.h: (WebCore::MediaPlayerPrivateInterface::tracksChanged): * platform/graphics/TextTrackRepresentation.cpp: * platform/graphics/TextTrackRepresentation.h: * platform/graphics/TrackPrivateBase.cpp: * platform/graphics/TrackPrivateBase.h: * platform/graphics/VideoTrackPrivate.h: * platform/graphics/avfoundation/AVTrackPrivateAVFObjCImpl.h: * platform/graphics/avfoundation/AVTrackPrivateAVFObjCImpl.mm: * platform/graphics/avfoundation/AudioTrackPrivateAVF.h: * platform/graphics/avfoundation/MediaSelectionGroupAVFObjC.h: * platform/graphics/avfoundation/MediaSelectionGroupAVFObjC.mm: * platform/graphics/avfoundation/VideoTrackPrivateAVF.h: * platform/graphics/avfoundation/objc/AudioTrackPrivateAVFObjC.h: * platform/graphics/avfoundation/objc/AudioTrackPrivateAVFObjC.mm: * platform/graphics/avfoundation/objc/AudioTrackPrivateMediaSourceAVFObjC.cpp: * platform/graphics/avfoundation/objc/AudioTrackPrivateMediaSourceAVFObjC.h: * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h: * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm: * platform/graphics/avfoundation/objc/VideoTrackPrivateAVFObjC.cpp: * platform/graphics/avfoundation/objc/VideoTrackPrivateAVFObjC.h: * platform/graphics/avfoundation/objc/VideoTrackPrivateMediaSourceAVFObjC.h: * platform/graphics/avfoundation/objc/VideoTrackPrivateMediaSourceAVFObjC.mm: * platform/graphics/cocoa/TextTrackRepresentationCocoa.h: * platform/graphics/cocoa/TextTrackRepresentationCocoa.mm: * platform/graphics/gstreamer/AudioTrackPrivateGStreamer.cpp: * platform/graphics/gstreamer/AudioTrackPrivateGStreamer.h: * platform/graphics/gstreamer/GStreamerCommon.cpp: (WebCore::initializeGStreamer): * platform/graphics/gstreamer/ImageDecoderGStreamer.cpp: * platform/graphics/gstreamer/ImageDecoderGStreamer.h: * platform/graphics/gstreamer/InbandMetadataTextTrackPrivateGStreamer.h: * platform/graphics/gstreamer/InbandTextTrackPrivateGStreamer.cpp: * platform/graphics/gstreamer/InbandTextTrackPrivateGStreamer.h: * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp: (WebCore::MediaPlayerPrivateGStreamer::~MediaPlayerPrivateGStreamer): (WebCore::MediaPlayerPrivateGStreamer::notifyPlayerOfVideo): (WebCore::MediaPlayerPrivateGStreamer::notifyPlayerOfAudio): (WebCore::MediaPlayerPrivateGStreamer::newTextSample): (WebCore::MediaPlayerPrivateGStreamer::updateTracks): (WebCore::MediaPlayerPrivateGStreamer::handleMessage): (WebCore::MediaPlayerPrivateGStreamer::purgeInvalidTextTracks): (WebCore::MediaPlayerPrivateGStreamer::createGSTPlayBin): * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h: * platform/graphics/gstreamer/TextCombinerGStreamer.cpp: * platform/graphics/gstreamer/TextCombinerGStreamer.h: * platform/graphics/gstreamer/TextSinkGStreamer.cpp: * platform/graphics/gstreamer/TextSinkGStreamer.h: * platform/graphics/gstreamer/TrackPrivateBaseGStreamer.cpp: * platform/graphics/gstreamer/TrackPrivateBaseGStreamer.h: * platform/graphics/gstreamer/VideoTrackPrivateGStreamer.cpp: * platform/graphics/gstreamer/VideoTrackPrivateGStreamer.h: * platform/mac/SerializedPlatformDataCueMac.h: * platform/mac/SerializedPlatformDataCueMac.mm: * platform/mediastream/AudioMediaStreamTrackRenderer.cpp: * platform/mediastream/AudioMediaStreamTrackRenderer.h: * platform/mediastream/AudioTrackPrivateMediaStream.cpp: * platform/mediastream/AudioTrackPrivateMediaStream.h: * platform/mediastream/VideoTrackPrivateMediaStream.h: * platform/mediastream/mac/AudioMediaStreamTrackRendererCocoa.cpp: * platform/mediastream/mac/AudioMediaStreamTrackRendererCocoa.h: * rendering/RenderVTTCue.cpp: * rendering/RenderVTTCue.h: * style/ElementRuleCollector.cpp: (WebCore::Style::ElementRuleCollector::collectMatchingShadowPseudoElementRules): * style/PropertyCascade.cpp: (WebCore::Style::PropertyCascade::addMatch): * style/RuleData.cpp: (WebCore::Style::determinePropertyWhitelistType): * style/RuleData.h: * style/RuleSet.cpp: (WebCore::Style::RuleSet::addRule): (WebCore::Style::RuleSet::traverseRuleDatas): (WebCore::Style::RuleSet::hasShadowPseudoElementRules const): (WebCore::Style::RuleSet::shrinkToFit): * style/RuleSet.h: * style/StyleAdjuster.cpp: (WebCore::Style::Adjuster::adjustForSiteSpecificQuirks const): * testing/InternalSettings.cpp: (WebCore::InternalSettings::Backup::Backup): (WebCore::InternalSettings::Backup::restoreTo): (WebCore::InternalSettings::setShouldDisplayTrackKind): (WebCore::InternalSettings::shouldDisplayTrackKind): * testing/InternalSettings.h: * testing/InternalSettings.idl: * testing/Internals.cpp: (WebCore::Internals::resetToConsistentState): (WebCore::Internals::Internals): (WebCore::Internals::userPreferredAudioCharacteristics const): (WebCore::Internals::setUserPreferredAudioCharacteristic): (WebCore::Internals::captionsStyleSheetOverride): (WebCore::Internals::setCaptionsStyleSheetOverride): (WebCore::Internals::setPrimaryAudioTrackLanguageOverride): (WebCore::Internals::setCaptionDisplayMode): (WebCore::Internals::textTrackBCP47Language): (WebCore::Internals::getCurrentMediaControlsStatusForElement): * testing/Internals.h: * testing/Internals.idl: 2020-06-06 Yusuke Suzuki <ysuzuki@apple.com> Crash when running web-apis data collection https://bugs.webkit.org/show_bug.cgi?id=212458 Reviewed by Mark Lam. Test: js/dom/dom-attribute-getter-setter.html For properties using DOMAttribute property attribute in the table, code generator must use DOMAttributeGetterSetter instead of CustomGetterSetter. * bindings/scripts/CodeGeneratorJS.pm: (GenerateImplementation): * bindings/scripts/test/JS/JSTestObj.cpp: (WebCore::JSTestObjPrototype::finishCreation): 2020-06-06 Zalan Bujtas <zalan@apple.com> [LFC] Add support for width: min/max-content https://bugs.webkit.org/show_bug.cgi?id=212869 Reviewed by Antti Koivisto. Use the existing intrinsic width logic to compute min/max-content width. Test: fast/layoutformattingcontext/min-max-content-width-simple.html * layout/FormattingContext.h: * layout/FormattingContextGeometry.cpp: (WebCore::Layout::FormattingContext::Geometry::computedWidthValue): (WebCore::Layout::FormattingContext::Geometry::computedWidth): (WebCore::Layout::FormattingContext::Geometry::fixedValue const): (WebCore::Layout::FormattingContext::Geometry::computedMinWidth): (WebCore::Layout::FormattingContext::Geometry::computedMaxWidth): (WebCore::Layout::FormattingContext::Geometry::outOfFlowReplacedHorizontalGeometry): (WebCore::Layout::FormattingContext::Geometry::floatingReplacedWidthAndMargin): (WebCore::Layout::FormattingContext::Geometry::inlineReplacedWidthAndMargin): (WebCore::Layout::FormattingContext::Geometry::computedWidth const): Deleted. (WebCore::Layout::FormattingContext::Geometry::computedMinWidth const): Deleted. (WebCore::Layout::FormattingContext::Geometry::computedMaxWidth const): Deleted. (WebCore::Layout::FormattingContext::Geometry::outOfFlowReplacedHorizontalGeometry const): Deleted. (WebCore::Layout::FormattingContext::Geometry::floatingReplacedWidthAndMargin const): Deleted. (WebCore::Layout::FormattingContext::Geometry::inlineReplacedWidthAndMargin const): Deleted. * layout/blockformatting/BlockFormattingContext.h: * layout/blockformatting/BlockFormattingContextGeometry.cpp: (WebCore::Layout::BlockFormattingContext::Geometry::inFlowNonReplacedWidthAndMargin): (WebCore::Layout::BlockFormattingContext::Geometry::inFlowReplacedWidthAndMargin): (WebCore::Layout::BlockFormattingContext::Geometry::inFlowNonReplacedWidthAndMargin const): Deleted. (WebCore::Layout::BlockFormattingContext::Geometry::inFlowReplacedWidthAndMargin const): Deleted. * layout/tableformatting/TableFormattingContext.h: * layout/tableformatting/TableFormattingContextGeometry.cpp: (WebCore::Layout::TableFormattingContext::Geometry::computedColumnWidth): (WebCore::Layout::TableFormattingContext::Geometry::computedColumnWidth const): Deleted. 2020-06-06 Devin Rousso <drousso@apple.com> [ macOS wk2 ] inspector/page/setBootstrapScript-sub-frame.html is flaky failing https://bugs.webkit.org/show_bug.cgi?id=207053 <rdar://problem/59064908> Reviewed by Timothy Hatcher. Test: inspector/page/setBootstrapScript-sub-frame.html * inspector/InspectorInstrumentation.cpp: (WebCore::InspectorInstrumentation::didCommitLoadImpl): Ensure the `InspectorPageAgent` sends the new `Page.Frame` payload to the frontend before the `PageRuntimeAgent` so that a `WI.Frame` exists before adding any `WI.ExecutionContext`. 2020-06-06 Jer Noble <jer.noble@apple.com> REGRESSION (r262364): Disney Plus crashes playing videos https://bugs.webkit.org/show_bug.cgi?id=212862 <rdar://problem/64044841> Reviewed by Eric Carlson. In r262364, we specified an incorrect number size for CFNumberGetValue, which nevertheless worked fine in debug builds, but overwrote stack data in release builds, leading to a crash when the returned pointer was ref()d. The correct size for a FourCharCode is a kCFNumberSInt32Type, not a kCFNumberLongType. * platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm: 2020-06-06 David Kilzer <ddkilzer@apple.com> [IPC] Adopt enum class for GradientSpreadMethod <https://webkit.org/b/212868> <rdar://problem/64069035> Reviewed by Anders Carlsson. Summary: - Convert GradientSpreadMethod to an enum class. - Add WTF::EnumTraits<AutocapitalizeType> for IPC. - Remove use of decodeEnum() and encodeEnum(). * platform/graphics/Gradient.h: (WebCore::Gradient::encode const): (WebCore::Gradient::decode): * platform/graphics/GraphicsTypes.h: * platform/graphics/cairo/GradientCairo.cpp: (WebCore::Gradient::createPlatformGradient): * platform/graphics/cg/GradientCG.cpp: (WebCore::Gradient::paint): * rendering/svg/RenderSVGResourceGradient.cpp: (WebCore::RenderSVGResourceGradient::applyResource): 2020-06-06 Rob Buis <rbuis@igalia.com> Reduce includes for CustomHeaderFields https://bugs.webkit.org/show_bug.cgi?id=212691 Reviewed by Joseph Pecoraro. Reduce includes for CustomHeaderFields, I guess these were needed at some point but not anymore. * Modules/applepay/ApplePaySession.cpp: * Modules/applepay/PaymentSession.cpp: * bindings/js/ScriptController.cpp: * contentextensions/ContentExtensionsBackend.cpp: * dom/Document.cpp: * editing/cocoa/EditorCocoa.mm: * editing/cocoa/HTMLConverter.mm: * editing/cocoa/WebContentReaderCocoa.mm: * editing/markup.cpp: * history/CachedFrame.cpp: * html/HTMLDocument.cpp: * html/HTMLHtmlElement.cpp: * html/HTMLMediaElement.cpp: * html/ImageDocument.cpp: * html/MediaDocument.cpp: * html/PluginDocument.cpp: * html/parser/HTMLDocumentParser.cpp: * html/parser/XSSAuditor.cpp: * inspector/InspectorInstrumentation.cpp: * inspector/agents/InspectorApplicationCacheAgent.cpp: * inspector/agents/InspectorNetworkAgent.cpp: * inspector/agents/InspectorPageAgent.cpp: * inspector/agents/page/PageNetworkAgent.cpp: * loader/ApplicationManifestLoader.cpp: * loader/FrameLoader.cpp: * loader/LoadTiming.cpp: * loader/NetscapePlugInStreamLoader.cpp: * loader/ResourceLoader.cpp: * loader/SubresourceLoader.cpp: * loader/appcache/ApplicationCacheHost.cpp: * loader/archive/cf/LegacyWebArchive.cpp: * loader/icon/IconLoader.cpp: * page/ContextMenuController.cpp: * page/FrameView.cpp: * page/Page.cpp: * page/Performance.cpp: * page/PerformanceNavigation.cpp: * page/Quirks.cpp: * page/UserContentProvider.cpp: * page/csp/ContentSecurityPolicy.cpp: * page/mac/PageMac.mm: * platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.cpp: * svg/graphics/SVGImage.cpp: * testing/Internals.cpp: 2020-06-06 Andy Estes <aestes@apple.com> [Apple Pay] Add testing and logging for ApplePaySetup https://bugs.webkit.org/show_bug.cgi?id=211972 <rdar://problem/63291965> Reviewed by Alex Christensen. Test: http/tests/ssl/applepay/ApplePaySetup.https.html * DerivedSources-input.xcfilelist: * DerivedSources-output.xcfilelist: * DerivedSources.make: * Modules/applepay/ApplePaySetup.cpp: (WebCore::ApplePaySetup::getSetupFeatures): (WebCore::ApplePaySetup::begin): (WebCore::ApplePaySetup::ApplePaySetup): (WebCore::ApplePaySetup::stop): * Modules/applepay/ApplePaySetup.idl: * Modules/applepay/ApplePaySetupConfiguration.h: Copied from Source/WebCore/Modules/applepay/ApplePaySetupFeatureType.idl. * Modules/applepay/ApplePaySetupConfiguration.idl: Copied from Source/WebCore/Modules/applepay/ApplePaySetupFeatureType.idl. * Modules/applepay/ApplePaySetupFeature.idl: * Modules/applepay/ApplePaySetupFeature.mm: (WebCore::ApplePaySetupFeature::state const): * Modules/applepay/ApplePaySetupFeatureState.h: Copied from Source/WebCore/Modules/applepay/ApplePaySetupFeatureType.idl. * Modules/applepay/ApplePaySetupFeatureState.idl: Copied from Source/WebCore/Modules/applepay/ApplePaySetupFeatureType.idl. * Modules/applepay/ApplePaySetupFeatureType.idl: * Modules/applepay/ApplePaySetupFeatureWebCore.h: * Modules/applepay/ApplePaySetupWebCore.h: (WebCore::ApplePaySetup::create): * Modules/applepay/PaymentCoordinator.cpp: (WebCore::PaymentCoordinator::setApplePayIsActiveIfAllowed const): (WebCore::PaymentCoordinator::getSetupFeatures): (WebCore::PaymentCoordinator::beginApplePaySetup): (WebCore::PaymentCoordinator::endApplePaySetup): * Modules/applepay/PaymentCoordinator.h: * Modules/applepay/PaymentCoordinatorClient.h: (WebCore::PaymentCoordinatorClient::getSetupFeatures): (WebCore::PaymentCoordinatorClient::beginApplePaySetup): * SourcesCocoa.txt: * WebCore.xcodeproj/project.pbxproj: * testing/MockApplePaySetupFeature.cpp: Copied from Source/WebCore/Modules/applepay/ApplePaySetupFeatureWebCore.h. (WebCore::MockApplePaySetupFeature::create): (WebCore::MockApplePaySetupFeature::MockApplePaySetupFeature): * testing/MockApplePaySetupFeature.h: Copied from Source/WebCore/Modules/applepay/ApplePaySetupFeatureWebCore.h. * testing/MockPaymentCoordinator.cpp: (WebCore::MockPaymentCoordinator::addSetupFeature): (WebCore::MockPaymentCoordinator::getSetupFeatures): (WebCore::MockPaymentCoordinator::beginApplePaySetup): * testing/MockPaymentCoordinator.h: * testing/MockPaymentCoordinator.idl: 2020-06-06 David Kilzer <ddkilzer@apple.com> Follow-up: Use OptionSet<DragOperation> for mask values <https://webkit.org/b/212605> <rdar://problem/64069091> * dom/DataTransfer.cpp: (WebCore::DataTransfer::destinationOperationMask const): - Don't compare to anyDragOperation(). Darin suggested this change during patch review, but this use was missed. 2020-06-06 David Kilzer <ddkilzer@apple.com> Use OptionSet<DragOperation> for mask values <https://webkit.org/b/212605> Reviewed by Darin Adler. In broad strokes: - Replace use of DragOperation with OptionSet<DragOperation> or Optional<DragOperation>. - Rename function parameters and local variables to denote use of mask values. - Remove DragOperationNone enum value. - Replace DragOperationEvery enum value with anyDragOperation(). * dom/DataTransfer.cpp: (WebCore::DataTransfer::createForDrop): (WebCore::DataTransfer::createForUpdatingDropTarget): (WebCore::dragOpFromIEOp): (WebCore::IEOpFromDragOp): (WebCore::DataTransfer::sourceOperation const): Rename. (WebCore::DataTransfer::sourceOperationMask const): (WebCore::DataTransfer::destinationOperation const): Rename. (WebCore::DataTransfer::destinationOperationMask const): (WebCore::DataTransfer::setSourceOperation): Rename. (WebCore::DataTransfer::setSourceOperationMask): (WebCore::DataTransfer::setDestinationOperation): Rename. (WebCore::DataTransfer::setDestinationOperationMask): * dom/DataTransfer.h: (WebCore::DataTransfer::createForDrop): (WebCore::DataTransfer::createForUpdatingDropTarget): (WebCore::DataTransfer::sourceOperation const): Rename. (WebCore::DataTransfer::sourceOperationMask const): (WebCore::DataTransfer::destinationOperation const): Rename. (WebCore::DataTransfer::destinationOperationMask const): (WebCore::DataTransfer::setSourceOperation): Rename. (WebCore::DataTransfer::setSourceOperationMask): (WebCore::DataTransfer::setDestinationOperation): Rename. (WebCore::DataTransfer::setDestinationOperationMask): * page/DragActions.h: (WebCore::anyDragOperation): Add. (WTF::EnumTraits<WebCore::DragOperation>): Add. (WTF::OptionSet<WebCore::DragOperation>): Add. * page/DragController.cpp: (WebCore::DragController::dragEntered): (WebCore::DragController::dragUpdated): (WebCore::DragController::performDragOperation): (WebCore::DragController::dragEnteredOrUpdated): (WebCore::DragController::tryDocumentDrag): (WebCore::DragController::operationForLoad): (WebCore::defaultOperationForDrag): (WebCore::DragController::tryDHTMLDrag): - Change logic to call defaultOperationForDrag() to convert targetResponse.operationMask to a single operation when targetResponse.operationMask but doesn't contain with any bit values set in sourceOperationMask. (WebCore::DragController::startDrag): * page/DragController.h: (WebCore::DragController::dragEntered): (WebCore::DragController::dragUpdated): (WebCore::DragController::sourceDragOperation const): Rename. (WebCore::DragController::sourceDragOperationMask const): (WebCore::DragController::startDrag): (WebCore::DragController::dragEnteredOrUpdated): (WebCore::DragController::operationForLoad): (WebCore::DragController::tryDocumentDrag): (WebCore::DragController::tryDHTMLDrag): (WebCore::DragController::dragOperation): * page/EventHandler.cpp: (WebCore::convertDropZoneOperationToDragOperation): (WebCore::convertDragOperationToDropZoneOperation): (WebCore::findDropZone): (WebCore::EventHandler::dispatchDragEnterOrDragOverEvent): (WebCore::EventHandler::updateDragAndDrop): (WebCore::EventHandler::cancelDragAndDrop): (WebCore::EventHandler::performDragAndDrop): (WebCore::EventHandler::dragSourceEndedAt): (WebCore::EventHandler::handleDrag): * page/EventHandler.h: (WebCore::EventHandler::updateDragAndDrop): (WebCore::EventHandler::cancelDragAndDrop): (WebCore::EventHandler::performDragAndDrop): (WebCore::EventHandler::dragSourceEndedAt): (WebCore::EventHandler::dispatchDragEnterOrDragOverEvent): * page/gtk/DragControllerGtk.cpp: (WebCore::DragController::dragOperation): * page/mac/DragControllerMac.mm: (WebCore::DragController::dragOperation): * page/win/DragControllerWin.cpp: (WebCore::DragController::dragOperation): - Clean up comment. * platform/DragData.cpp: (WebCore::DragData::DragData): * platform/DragData.h: (WebCore::DragData::DragData): (WebCore::DragData::draggingSourceOperationMask const): * platform/cocoa/DragDataCocoa.mm: (WebCore::DragData::DragData): * platform/gtk/GtkUtilities.cpp: (WebCore::gdkDragActionToDragOperation): (WebCore::dragOperationToGdkDragActions): (WebCore::dragOperationToSingleGdkDragAction): * platform/gtk/GtkUtilities.h: (WebCore::gdkDragActionToDragOperation): (WebCore::dragOperationToGdkDragActions): (WebCore::dragOperationToSingleGdkDragAction): * platform/win/DragDataWin.cpp: (WebCore::DragData::DragData): 2020-06-06 Zalan Bujtas <zalan@apple.com> [LFC] FormattingContext::Geometry::computedValue should not try to resolve values when layout is required https://bugs.webkit.org/show_bug.cgi?id=212867 Reviewed by Antti Koivisto. This is in preparation for adding min/max/fit-content support. * layout/FormattingContext.h: * layout/FormattingContextGeometry.cpp: (WebCore::Layout::FormattingContext::Geometry::computedWidth const): (WebCore::Layout::FormattingContext::Geometry::computedValue const): (WebCore::Layout::FormattingContext::Geometry::computedMinWidth const): (WebCore::Layout::FormattingContext::Geometry::computedMaxWidth const): (WebCore::Layout::FormattingContext::Geometry::outOfFlowNonReplacedVerticalGeometry const): (WebCore::Layout::FormattingContext::Geometry::outOfFlowNonReplacedHorizontalGeometry): (WebCore::Layout::FormattingContext::Geometry::outOfFlowReplacedVerticalGeometry const): (WebCore::Layout::FormattingContext::Geometry::outOfFlowReplacedHorizontalGeometry const): (WebCore::Layout::FormattingContext::Geometry::inFlowPositionedPositionOffset const): (WebCore::Layout::FormattingContext::Geometry::computedHorizontalMargin const): (WebCore::Layout::FormattingContext::Geometry::computedVerticalMargin const): (WebCore::Layout::FormattingContext::Geometry::computedValueIfNotAuto const): Deleted. * layout/inlineformatting/InlineFormattingContextGeometry.cpp: (WebCore::Layout::InlineFormattingContext::Geometry::inlineBlockWidthAndMargin): 2020-06-06 Devin Rousso <drousso@apple.com> Web Inspector: unify the naming scheme for agents used by instrumentation https://bugs.webkit.org/show_bug.cgi?id=212859 Reviewed by Timothy Hatcher. Inspector agents fall into one of three categories: - "persistent" when Web Inspector is connected - "enabled" when that agent is `enable`d, such as if the corresponding tab is visible - "tracking" when that agent is part of a timeline recording. The only exception to this is the Console agent, as that exists regardless of whether Web Inspector is connected as it needs to preserve messages logged before Web Inspector connects. Also remove the "Inspector" prefix from getter/setter methods as it adds confusion if that agent also has subclasses (e.g. `InspectorRuntimeAgent` and `PageRuntimeAgent`). * inspector/InstrumentingAgents.h: * inspector/InstrumentingAgents.cpp: Use macros to simplify the process of adding an agent. * inspector/CommandLineAPIHost.cpp: * inspector/InspectorController.h: * inspector/InspectorController.cpp: * inspector/InspectorInstrumentation.cpp: * inspector/agents/InspectorAnimationAgent.cpp: * inspector/agents/InspectorApplicationCacheAgent.cpp: * inspector/agents/InspectorCPUProfilerAgent.cpp: * inspector/agents/InspectorCSSAgent.cpp: * inspector/agents/InspectorCanvasAgent.cpp: * inspector/agents/InspectorDOMAgent.cpp: * inspector/agents/InspectorDOMDebuggerAgent.cpp: * inspector/agents/InspectorDOMStorageAgent.cpp: * inspector/agents/InspectorDatabaseAgent.cpp: * inspector/agents/InspectorLayerTreeAgent.cpp: * inspector/agents/InspectorMemoryAgent.cpp: * inspector/agents/InspectorNetworkAgent.cpp: * inspector/agents/InspectorPageAgent.cpp: * inspector/agents/InspectorTimelineAgent.cpp: * inspector/agents/InspectorWorkerAgent.cpp: * inspector/agents/WebDebuggerAgent.cpp: * inspector/agents/WebHeapAgent.cpp: * inspector/agents/page/PageConsoleAgent.cpp: * inspector/agents/page/PageDOMDebuggerAgent.cpp: * inspector/agents/page/PageDebuggerAgent.cpp: * inspector/agents/page/PageHeapAgent.cpp: * inspector/agents/page/PageNetworkAgent.cpp: * inspector/agents/page/PageRuntimeAgent.cpp: Simple naming changes elided to avoid a long ChangeLog. 2020-06-05 Andy Estes <aestes@apple.com> REGRESSION (r256648): Apple Pay <button> elements no longer use the default corner radius on iOS (affects Stripe.js) https://bugs.webkit.org/show_bug.cgi?id=212860 <rdar://problem/64054728> Reviewed by Wenson Hsieh. As part of drawing iOS native form controls, RenderThemeIOS applies a round border to un-styled <button> elements in RenderThemeIOS::adjustRoundBorderRadius. Prior to r256648, this adjusted border radius would be ignored by RenderThemeCocoa::paintApplePayButton when painting <button> elements with the ApplePayButtonPart appearance, but now it's respected. Apple Pay <button>s with default width and height previously had a 4px corner radius but now have a 15px corner radius. Fixed the issue by skipping RenderThemeIOS::adjustRoundBorderRadius for elements with the ApplePayButtonPart appearance so that the correct border radius adjustment can be made by RenderThemeCocoa::adjustApplePayButtonStyle. Four existing tests were skipped on iOS that would have caught this; un-skipped them. Un-skipped tests: fast/css/appearance-apple-pay-button.html fast/css/appearance-apple-pay-button-border-radius.html fast/css/appearance-apple-pay-button-default-corners.html fast/css/getComputedStyle/computed-style-apple-pay-button.html * rendering/RenderThemeIOS.mm: (WebCore::canAdjustBorderRadiusForAppearance): Added a helper to check if border radius can be adjusted for a given ControlPart. Added ApplePayButtonPart to the list of appearances where border radius cannot be adjusted. (WebCore::RenderThemeIOS::adjustRoundBorderRadius): Changed to call canAdjustBorderRadiusForAppearance. 2020-06-05 Peng Liu <peng.liu6@apple.com> HTMLMediaElement::m_waitingToEnterFullscreen is not initialized in the constructor https://bugs.webkit.org/show_bug.cgi?id=212861 Reviewed by Jer Noble. Covered by existing tests. * html/HTMLMediaElement.cpp: (WebCore::HTMLMediaElement::HTMLMediaElement): 2020-06-05 David Kilzer <ddkilzer@apple.com> [IPC] Adopt enum class for AutocapitalizeType <https://webkit.org/b/212846> <rdar://problem/64042825> Reviewed by Darin Adler. Summary: - Move AutocapitalizeType into WebCore namespace. - Convert AutocapitalizeType to an enum class. - Add WTF::EnumTraits<AutocapitalizeType> for IPC. * html/Autocapitalize.cpp: (WebCore::autocapitalizeTypeForAttributeValue): (WebCore::stringForAutocapitalizeType): * html/AutocapitalizeTypes.h: * html/HTMLFormControlElement.cpp: (WebCore::HTMLFormControlElement::autocapitalizeType const): 2020-06-05 Ryan Haddad <ryanhaddad@apple.com> Unreviewed, reverting r262619, r262625, and r262641. Caused mediarecorder layout test crashes. Reverted changesets: "[Cocoa] Use AVAssetWriterDelegate to implement MediaRecorder" https://bugs.webkit.org/show_bug.cgi?id=206582 https://trac.webkit.org/changeset/262619 "[Cocoa] Use AVAssetWriterDelegate to implement MediaRecorder" https://bugs.webkit.org/show_bug.cgi?id=206582 https://trac.webkit.org/changeset/262625 "Unreviewed, silence deprecation warning to fix build with latest SDK." https://trac.webkit.org/changeset/262641 2020-06-05 Kate Cheney <katherine_cheney@apple.com> ITP SQLite Database should only vacuum once per day https://bugs.webkit.org/show_bug.cgi?id=212712 <rdar://problem/63939711> Reviewed by Brent Fulgham. Add WEBCORE_EXPORT macro to function needed in WebKit. * platform/sql/SQLiteDatabase.h: 2020-06-05 Sam Weinig <weinig@apple.com> Some tests in css/css-color/parsing/system-color-valid.html are failing https://bugs.webkit.org/show_bug.cgi?id=212703 Reviewed by Darin Adler. Add support for the following system color keywords, added in CSS Color 4 (https://www.w3.org/TR/css-color-4/#css-system-colors): ActiveText (Text in active links) Implemented identically to -webkit-activelink Canvas (Background of application content or documents) [NSColor textBackgroundColor] on macOS, Color::white by default. CanvasText (Text in application content or documents) [NSColor textBackgroundColor] on macOS, Color::black by default. Field [NSColor controlColor] on macOS, Color::white by default. FieldText [NSColor controlTextColor] on macOS, Color::black by default. LinkText [NSColor linkColor] on macOS (when UseSystemAppearance is true), same as -webkit-link (non-visited) by default. VisitedText [NSColor systemPurpleColor] on macOS (when UseSystemAppearance is true), same as -webkit-link (visited) by default. * css/CSSValueKeywords.in: * platform/ThemeTypes.cpp: (WebCore::operator<<): * platform/ThemeTypes.h: * rendering/RenderTheme.cpp: (WebCore::RenderTheme::systemColor const): * rendering/RenderThemeMac.mm: (WebCore::RenderThemeMac::systemColor const): 2020-06-05 Jason Lawrence <lawrence.j@apple.com> Unreviewed, reverting r262524. Reverting because this commit may have caused issues with other tests. Reverted changeset: "Release Assert @ WebCore::RenderTreeBuilder::RenderTreeBuilder" https://bugs.webkit.org/show_bug.cgi?id=212714 https://trac.webkit.org/changeset/262524 2020-06-05 Jonathan Bedard <jbedard@apple.com> WebCore: Link to framework stubs for watchOS and tvOS https://bugs.webkit.org/show_bug.cgi?id=212834 <rdar://problem/64033712> Reviewed by Tim Horton. No new tests, no behavior changed. * Configurations/Base.xcconfig: Ignore 64 to 32 bit conversion errors for watchOS simulators, add tvOS and watchOS major version macros. * Configurations/WebCore.xcconfig: Link to framework stubs for watchOS and tvOS. 2020-06-05 David Kilzer <ddkilzer@apple.com> [IPC] Adopt enum class for PluginLoadClientPolicy <https://webkit.org/b/212827> <rdar://problem/64030431> Reviewed by Alex Christensen. * plugins/PluginData.h: (WebCore::PluginLoadClientPolicy): - Make this an enum class. (WTF::EnumTraits<WebCore::PluginLoadClientPolicy>): - Add for use with strongly-typed IPC parameters. 2020-06-05 Wenson Hsieh <wenson_hsieh@apple.com> Text manipulation should exclude characters outside of the unicode private use area https://bugs.webkit.org/show_bug.cgi?id=212800 <rdar://problem/63736417> Reviewed by Sihui Liu. Consider characters that fall outside of unicode PUA (in addition to line breaks) as excluded when extracting tokens during text manipulation. In doing this, we also rename a few member variables in `ManipulationUnit` to refer to "token delimiters" rather than line breaks. Test: TextManipulation.StartTextManipulationExtractsPrivateUseCharactersAsExcludedTokens * editing/TextManipulationController.cpp: (WebCore::isInPrivateUseArea): (WebCore::isTokenDelimiter): (WebCore::TextManipulationController::parse): (WebCore::TextManipulationController::observeParagraphs): * editing/TextManipulationController.h: 2020-06-05 Dean Jackson <dino@apple.com> REGRESSION (r262366): [ Mac wk1 ] webgl/webgl-backing-store-size-update.html is failing https://bugs.webkit.org/show_bug.cgi?id=212647 <rdar://problem/63882960> Reviewed by Eric Carlson. In some unusual cases, specifically WebKit 1, a WebGLLayer could prepareForDisplay but never get told to actually display, producing incorrect results. Fix this by simply calling setNeedsDisplay. While here, address some comments from Simon Fraser that were made after r262366. * dom/Document.cpp: (WebCore::Document::prepareCanvasesForDisplayIfNeeded): * platform/graphics/cocoa/WebGLLayer.h: Move the instance variables into the implementation file since they are not exposed as an interface. * platform/graphics/cocoa/WebGLLayer.mm: (-[WebGLLayer initWithGraphicsContextGL:]): (-[WebGLLayer prepareForDisplay]): (-[WebGLLayer display]): 2020-06-05 Chris Dumez <cdumez@apple.com> Unreviewed, silence deprecation warning to fix build with latest SDK. * platform/mediarecorder/cocoa/MediaRecorderPrivateWriterCocoa.mm: (WebCore::MediaRecorderPrivateWriter::stopRecording): 2020-06-05 Andres Gonzalez <andresg_22@apple.com> Accessibility isolated tree mode: crashes when navigating websites, com.apple.AppKit: ConvertOutgoingValueForAttribute. https://bugs.webkit.org/show_bug.cgi?id=212829 <rdar://problem/63756267> Reviewed by Chris Fleizach. - [WebAccessibilityObjectWrapper textMarkerRangeFromVisiblePositions] must retrieve an autoreleased id from the main thread. - [WebAccessibilityObjectWrapper textMarkerRangeForSelection] must also retrieve an autoreleased id from the main thread. * accessibility/mac/WebAccessibilityObjectWrapperMac.mm: (-[WebAccessibilityObjectWrapper textMarkerRangeFromVisiblePositions:endPosition:]): (-[WebAccessibilityObjectWrapper textMarkerRangeForSelection]): (-[WebAccessibilityObjectWrapper accessibilityAttributeValue:]): (-[WebAccessibilityObjectWrapper accessibilityAttributeValue:forParameter:]): 2020-06-05 Jonathan Bedard <jbedard@apple.com> WebCore: Guard variable declarations on ENABLE(VIDEO_PRESENTATION_MODE) https://bugs.webkit.org/show_bug.cgi?id=212831 <rdar://problem/64033028> Reviewed by Tim Horton. No new tests, no behavior changed. * html/HTMLVideoElement.h: 2020-06-05 Peng Liu <peng.liu6@apple.com> Fix a tvOS build failure https://bugs.webkit.org/show_bug.cgi?id=212833 Reviewed by Jer Noble. * platform/cocoa/PlaybackSessionModelMediaElement.mm: (WebCore::PlaybackSessionModelMediaElement::togglePictureInPicture): 2020-06-05 Yusuke Suzuki <ysuzuki@apple.com> DOM constructor should only accept Ref<> / ExceptionOr<Ref<>> for creation to ensure toJSNewlyCreated is always returning object https://bugs.webkit.org/show_bug.cgi?id=212767 Reviewed by Darin Adler. When using toJSNewlyCreated in DOM constructor, we should ensure that this only returns JSObject* (if exception is not happening) to avoid `isObject()` check after that. However AudioContext and ImageData is not following this and can return nullptr from `create` factory function. We should not allow this. In this patch, 1. AudioContext should throw an error instead of returning null. AudioContext had a limit derived from OS, but this limit is reasonable only in Windows. We should insert `OS(WINDOWS)` around this check, and throw an error instead of returning null. 2. ImageData::create can return nullptr potentially, and it can be converted to null. This is not acceptable for DOM constructor. We should throw an error if we failed to create ImageData. 3. We inserted static_asserts in CodeGeneratorJS.pm to ensure that XXX::create only returns Ref<> or ExceptionOr<Ref<>>. This ensures that toJSNewlyCreated will return JSObject*. This patch is relanding of the completely same patch since internal build is fixed. * Modules/webaudio/AudioContext.cpp: (WebCore::AudioContext::create): * Modules/webaudio/AudioContext.h: * Modules/webaudio/AudioContext.idl: * bindings/scripts/CodeGeneratorJS.pm: (GenerateConstructorDefinition): * bindings/scripts/test/JS/JSTestEventConstructor.cpp: (WebCore::JSTestEventConstructorConstructor::construct): * bindings/scripts/test/JS/JSTestInterface.cpp: (WebCore::JSTestInterfaceConstructor::construct): * bindings/scripts/test/JS/JSTestNamedConstructor.cpp: (WebCore::JSTestNamedConstructorNamedConstructor::construct): * bindings/scripts/test/JS/JSTestNode.cpp: (WebCore::JSTestNodeConstructor::construct): * bindings/scripts/test/JS/JSTestObj.cpp: (WebCore::JSTestObjConstructor::construct): * bindings/scripts/test/JS/JSTestOverloadedConstructors.cpp: (WebCore::constructJSTestOverloadedConstructors1): (WebCore::constructJSTestOverloadedConstructors2): (WebCore::constructJSTestOverloadedConstructors3): (WebCore::constructJSTestOverloadedConstructors4): (WebCore::constructJSTestOverloadedConstructors5): * bindings/scripts/test/JS/JSTestOverloadedConstructorsWithSequence.cpp: (WebCore::constructJSTestOverloadedConstructorsWithSequence1): (WebCore::constructJSTestOverloadedConstructorsWithSequence2): * bindings/scripts/test/JS/JSTestPromiseRejectionEvent.cpp: (WebCore::JSTestPromiseRejectionEventConstructor::construct): * bindings/scripts/test/JS/JSTestTypedefs.cpp: (WebCore::JSTestTypedefsConstructor::construct): * dom/ExceptionOr.h: * html/ImageData.cpp: (WebCore::ImageData::create): * html/ImageData.h: * testing/Internals.cpp: (WebCore::Internals::videoSampleAvailable): 2020-06-05 Tyler Wilcock <twilco.o@protonmail.com> CSS Variables: Color on specific `border` properties does not work. https://bugs.webkit.org/show_bug.cgi?id=211672 Reviewed by Antti Koivisto. Properly mark CSSPropertyBorderBlockStart, CSSPropertyBorderBlockEnd, CSSPropertyBorderInlineStart, and CSSPropertyBorderInlineEnd as direction-aware properties in CSSProperty::isDirectionAwareProperty. Also reordered a few properties in this switch so it's more alphabetically ordered. Prior to this change, CSS variables were not able to be resolved when used in these properties. Test: fast/borders/logical-border-props-with-variables.html * css/CSSProperty.cpp: (WebCore::CSSProperty::isDirectionAwareProperty): Add CSSPropertyBorderBlockStart, CSSPropertyBorderBlockEnd, CSSPropertyBorderInlineStart, CSSPropertyBorderInlineEnd. 2020-06-05 Andres Gonzalez <andresg_22@apple.com> AXIsolatedTree::updateChildren should not call nodeForID. https://bugs.webkit.org/show_bug.cgi?id=212794 Reviewed by Chris Fleizach. AXIsolatedTree::updateChildren is executed on the main thread and therfore should not call nodeForID. Since it requires the children IDs for the isolated object whose children are being updated, we need to store those children IDs outside the isolated object. For this reason we added the m_nodeMap member variable which will maintain a map between object ID and its children IDs. In addition, since retrieving the root node happens very often and required also a call to nodeForID, we now store a pointer to the root node instead of its ID, so there is no need to look it up in the reading map. * accessibility/AXLogger.cpp: (WebCore::operator<<): * accessibility/isolatedtree/AXIsolatedObject.cpp: (WebCore::AXIsolatedObject::setChildrenIDs): (WebCore::AXIsolatedObject::appendChild): Renamed setChildrenIDs. * accessibility/isolatedtree/AXIsolatedObject.h: * accessibility/isolatedtree/AXIsolatedTree.cpp: (WebCore::AXIsolatedTree::clear): (WebCore::AXIsolatedTree::create): (WebCore::AXIsolatedTree::removeTreeForPageID): (WebCore::AXIsolatedTree::nodeForID const): (WebCore::AXIsolatedTree::generateSubtree): (WebCore::AXIsolatedTree::createSubtree): (WebCore::AXIsolatedTree::updateChildren): (WebCore::AXIsolatedTree::rootNode): (WebCore::AXIsolatedTree::setRootNode): (WebCore::AXIsolatedTree::removeSubtree): (WebCore::AXIsolatedTree::applyPendingChanges): (WebCore::AXIsolatedTree::nodeInTreeForID): Deleted, not used. (WebCore::AXIsolatedTree::setRootNodeID): Renamed setRootNode. * accessibility/isolatedtree/AXIsolatedTree.h: * accessibility/mac/WebAccessibilityObjectWrapperBase.mm: (-[WebAccessibilityObjectWrapperBase attachIsolatedObject:]): 2020-06-05 Youenn Fablet <youenn@apple.com> [Cocoa] Use AVAssetWriterDelegate to implement MediaRecorder https://bugs.webkit.org/show_bug.cgi?id=206582 <rdar://problem/58985368> Unreviewed. * platform/mediarecorder/cocoa/MediaRecorderPrivateWriterCocoa.mm: (WebCore::MediaRecorderPrivateWriter::initialize): Allow deprecation warnings. 2020-06-05 Michael Catanzaro <mcatanzaro@gnome.org> Unreviewed, fix unused parameter warnings in EventRegion.cpp and RenderLayerBacking.cpp https://bugs.webkit.org/show_bug.cgi?id=212823 * rendering/EventRegion.cpp: (WebCore::EventRegion::unite): * rendering/RenderLayerBacking.cpp: (WebCore::RenderLayerBacking::paintDebugOverlays): 2020-06-05 Adrian Perez de Castro <aperez@igalia.com> Non-unified build fixes, early summer 2020 edition https://bugs.webkit.org/show_bug.cgi?id=212819 Unreviewed build fix. No new tests needed. * animation/ElementAnimationRareData.cpp: Add missing RenderStyle.h header. * animation/ElementAnimationRareData.h: Add forward declaration for RenderStyle. * editing/TextManipulationController.cpp: Sprinkle missing HTMLNames:: prefixes. (WebCore::shouldExtractValueForTextManipulation): (WebCore::TextManipulationController::observeParagraphs): (WebCore::makePositionTuple): (WebCore::TextManipulationController::replace): * platform/graphics/SimpleColor.h: Add missing ColorComponents.h and wtf/text/WTFString.h headers. * workers/service/context/ServiceWorkerThread.cpp: Add missing Logging.h header. 2020-06-05 Andy Estes <aestes@apple.com> [Apple Pay] Remove conditionals for ENABLE_APPLE_PAY_SESSION_V(3|4) https://bugs.webkit.org/show_bug.cgi?id=212541 <rdar://problem/63781452> Reviewed by Darin Adler. APPLE_PAY_SESSION_V(3|4) is now enabled whenever APPLE_PAY itself is enabled. * Configurations/FeatureDefines.xcconfig: * Modules/applepay/ApplePayError.idl: * Modules/applepay/ApplePayPaymentAuthorizationResult.idl: * Modules/applepay/ApplePayPaymentContact.idl: * Modules/applepay/ApplePayPaymentMethodUpdate.idl: * Modules/applepay/ApplePayRequestBase.idl: * Modules/applepay/ApplePaySession.idl: * Modules/applepay/ApplePayShippingContactUpdate.idl: * Modules/applepay/ApplePayShippingMethodUpdate.idl: * Modules/applepay/PaymentCoordinatorClient.cpp: (WebCore::PaymentCoordinatorClient::supportsVersion): * Modules/applepay/paymentrequest/ApplePayPaymentHandler.cpp: (WebCore::ApplePayPaymentHandler::computePaymentMethodErrors const): * accessibility/AccessibilityRenderObject.cpp: (WebCore::AccessibilityRenderObject::applePayButtonDescription const): * css/CSSPrimitiveValueMappings.h: (WebCore::CSSPrimitiveValue::CSSPrimitiveValue): (WebCore::CSSPrimitiveValue::operator ApplePayButtonType const): * css/CSSValueKeywords.in: * css/parser/CSSParserFastPaths.cpp: (WebCore::CSSParserFastPaths::isValidKeywordPropertyAndValue): * rendering/RenderThemeCocoa.mm: (WebCore::toPKPaymentButtonType): * rendering/style/RenderStyleConstants.cpp: (WebCore::operator<<): * rendering/style/RenderStyleConstants.h: 2020-06-05 youenn fablet <youenn@apple.com> [Cocoa] Use AVAssetWriterDelegate to implement MediaRecorder https://bugs.webkit.org/show_bug.cgi?id=206582 <rdar://problem/58985368> Reviewed by Eric Carlson. AVAssetWriterDelegate allows to grab recorded data whenever wanted. This delegate requires passing compressed samples to AVAssetWriter. Implement video encoding and audio encoding in dedicated classes and use these classes before adding buffers to AVAssetWriter. These classes are AudioSampleBufferCompressor and VideoSampleBufferCompressor. They support AAC and H264 so far and should be further improved to support more encoding options. Instantiate real writer only for platforms supporting AVAssetWriterDelegate, since it is not supported everywhere. The writer, doing the pacakging, is receiving compressed buffer from the audio/video compressors. It then sends data when being request to flush to its delegate, which will send data to the MediaRecorderPrivateWriter. The MediaRecorderPrivateWriter stores the data in a SharedBuffer until MediaRecorder asks for data. Note that, whenever we request data, we flush the writer and insert an end of video sample to make sure video data gets flushed. Therefore data should not be requested too fast to get adequate video compression. Covered by existing tests. * Modules/mediarecorder/MediaRecorderProvider.cpp: (WebCore::MediaRecorderProvider::createMediaRecorderPrivate): * WebCore.xcodeproj/project.pbxproj: * platform/mediarecorder/MediaRecorderPrivateAVFImpl.cpp: (WebCore::MediaRecorderPrivateAVFImpl::create): * platform/mediarecorder/MediaRecorderPrivateAVFImpl.h: * platform/mediarecorder/cocoa/AudioSampleBufferCompressor.h: Added. * platform/mediarecorder/cocoa/AudioSampleBufferCompressor.mm: Added. (WebCore::AudioSampleBufferCompressor::create): (WebCore::AudioSampleBufferCompressor::AudioSampleBufferCompressor): (WebCore::AudioSampleBufferCompressor::~AudioSampleBufferCompressor): (WebCore::AudioSampleBufferCompressor::initialize): (WebCore::AudioSampleBufferCompressor::finish): (WebCore::AudioSampleBufferCompressor::initAudioConverterForSourceFormatDescription): (WebCore::AudioSampleBufferCompressor::computeBufferSizeForAudioFormat): (WebCore::AudioSampleBufferCompressor::attachPrimingTrimsIfNeeded): (WebCore::AudioSampleBufferCompressor::gradualDecoderRefreshCount): (WebCore::AudioSampleBufferCompressor::sampleBufferWithNumPackets): (WebCore::AudioSampleBufferCompressor::audioConverterComplexInputDataProc): (WebCore::AudioSampleBufferCompressor::provideSourceDataNumOutputPackets): (WebCore::AudioSampleBufferCompressor::processSampleBuffersUntilLowWaterTime): (WebCore::AudioSampleBufferCompressor::processSampleBuffer): (WebCore::AudioSampleBufferCompressor::addSampleBuffer): (WebCore::AudioSampleBufferCompressor::getOutputSampleBuffer): (WebCore::AudioSampleBufferCompressor::takeOutputSampleBuffer): * platform/mediarecorder/cocoa/MediaRecorderPrivateWriterCocoa.h: * platform/mediarecorder/cocoa/MediaRecorderPrivateWriterCocoa.mm: (-[WebAVAssetWriterDelegate initWithWriter:]): (-[WebAVAssetWriterDelegate assetWriter:didProduceFragmentedHeaderData:]): (-[WebAVAssetWriterDelegate assetWriter:didProduceFragmentedMediaData:fragmentedMediaDataReport:]): (-[WebAVAssetWriterDelegate close]): (WebCore::MediaRecorderPrivateWriter::create): (WebCore::MediaRecorderPrivateWriter::compressedVideoOutputBufferCallback): (WebCore::MediaRecorderPrivateWriter::compressedAudioOutputBufferCallback): (WebCore::MediaRecorderPrivateWriter::MediaRecorderPrivateWriter): (WebCore::MediaRecorderPrivateWriter::~MediaRecorderPrivateWriter): (WebCore::MediaRecorderPrivateWriter::initialize): (WebCore::MediaRecorderPrivateWriter::processNewCompressedVideoSampleBuffers): (WebCore::MediaRecorderPrivateWriter::processNewCompressedAudioSampleBuffers): (WebCore::MediaRecorderPrivateWriter::startAssetWriter): (WebCore::MediaRecorderPrivateWriter::appendCompressedAudioSampleBuffer): (WebCore::MediaRecorderPrivateWriter::appendCompressedVideoSampleBuffer): (WebCore::MediaRecorderPrivateWriter::appendCompressedSampleBuffers): (WebCore::appendEndsPreviousSampleDurationMarker): (WebCore::MediaRecorderPrivateWriter::appendEndOfVideoSampleDurationIfNeeded): (WebCore::MediaRecorderPrivateWriter::flushCompressedSampleBuffers): (WebCore::MediaRecorderPrivateWriter::clear): (WebCore::copySampleBufferWithCurrentTimeStamp): (WebCore::MediaRecorderPrivateWriter::appendVideoSampleBuffer): (WebCore::createAudioFormatDescription): (WebCore::createAudioSampleBuffer): (WebCore::MediaRecorderPrivateWriter::appendAudioSampleBuffer): (WebCore::MediaRecorderPrivateWriter::stopRecording): (WebCore::MediaRecorderPrivateWriter::appendData): * platform/mediarecorder/cocoa/VideoSampleBufferCompressor.h: Copied from Source/WebCore/platform/mediarecorder/MediaRecorderPrivateAVFImpl.h. * platform/mediarecorder/cocoa/VideoSampleBufferCompressor.mm: Added. (WebCore::VideoSampleBufferCompressor::create): (WebCore::VideoSampleBufferCompressor::VideoSampleBufferCompressor): (WebCore::VideoSampleBufferCompressor::~VideoSampleBufferCompressor): (WebCore::VideoSampleBufferCompressor::initialize): (WebCore::VideoSampleBufferCompressor::finish): (WebCore::VideoSampleBufferCompressor::videoCompressionCallback): (WebCore::VideoSampleBufferCompressor::initCompressionSession): (WebCore::VideoSampleBufferCompressor::processSampleBuffer): (WebCore::VideoSampleBufferCompressor::addSampleBuffer): (WebCore::VideoSampleBufferCompressor::getOutputSampleBuffer): (WebCore::VideoSampleBufferCompressor::takeOutputSampleBuffer): 2020-06-05 Antti Koivisto <antti@apple.com> REGRESSION (r253875?): Element styles incorrect after media query evaluation changes https://bugs.webkit.org/show_bug.cgi?id=211505 <rdar://problem/62983242> Reviewed by Zalan Bujtas. If there are keyframe rules in media queries we fall back to wiping the style resolver when something changes. This fallback code didn't work correctly when a rule flipped from matching to non-matching because MediaQueryCollector bailed out and didn't create DynamicMediaQueryRules structure needed to detect something has changed. Test: fast/media/media-query-dynamic-with-keyframes.html * style/RuleSet.cpp: (WebCore::Style::RuleSet::addChildRules): (WebCore::Style::RuleSet::addRulesFromSheet): Call both push and pop even when the rule doesn't match. (WebCore::Style::RuleSet::MediaQueryCollector::pushAndEvaluate): Collect the MediaQuerySet in non-matching case too. (WebCore::Style::RuleSet::MediaQueryCollector::pop): Record the DynamicMediaQueryRules when resolving all rules statically. 2020-06-05 Youenn Fablet <youenn@apple.com> Ad support for media-source stats https://bugs.webkit.org/show_bug.cgi?id=212702 Reviewed by Eric Carlson. Expose 'media-source' stats which come in audio and video flavours. Covered by updated test. * Modules/mediastream/RTCStatsReport.h: (WebCore::RTCStatsReport::AudioSourceStats::AudioSourceStats): (WebCore::RTCStatsReport::VideoSourceStats::VideoSourceStats): * Modules/mediastream/RTCStatsReport.idl: * Modules/mediastream/libwebrtc/LibWebRTCStatsCollector.cpp: (WebCore::fillRTCRTPStreamStats): (WebCore::fillRTCMediaSourceStats): (WebCore::fillRTCAudioSourceStats): (WebCore::fillRTCVideoSourceStats): (WebCore::initializeRTCStatsReportBackingMap): 2020-06-04 Sihui Liu <sihui_liu@apple.com> Text manipulation: first and last unit in a paragraph should not contain only excluded tokens https://bugs.webkit.org/show_bug.cgi?id=212759 Reviewed by Wenson Hsieh. In r262398, we literally made text of one Node as the minimum unit for text manipulation. This patches introduce a struct ManipulationUnit for that. Now a paragraph can be represented as multiple ManipulationUnits. When all tokens in a ManipulationUnit are excluded, it means the ManipulationUnit is excluded and should not be manipulated. To record ManipulationUnits in a paragraph based on our current implementation, we need to keep the excluded ManipulationUnits surrounded by non-excluded ManipulationUnits, but we can safely remove the leading and trailing excluded ManipulationUnits. In this case, we can limit the range of paragraph further and thus less text replacement work. Covered by existing test. * editing/TextManipulationController.cpp: (WebCore::TextManipulationController::parse): (WebCore::TextManipulationController::addItemIfPossible): (WebCore::TextManipulationController::observeParagraphs): * editing/TextManipulationController.h: 2020-06-04 Peng Liu <peng.liu6@apple.com> A YouTube video gets stuck after rapidly tapping on touchbar’s PIP button https://bugs.webkit.org/show_bug.cgi?id=212729 Reviewed by Darin Adler. Call HTMLVideoElement::setFullscreenMode() instead of HTMLMediaElement::enterFullscreen() and HTMLMediaElement::exitFullscreen() to toggle picture-in-picture mode. HTMLVideoElement::setFullscreenMode() is robust under stress test after r262456. Manually tested. * platform/cocoa/PlaybackSessionModelMediaElement.mm: (WebCore::PlaybackSessionModelMediaElement::togglePictureInPicture): 2020-06-04 Commit Queue <commit-queue@webkit.org> Unreviewed, reverting r262583. https://bugs.webkit.org/show_bug.cgi?id=212799 Internal source code has the same bug, needs to be landed after fixing internal source Reverted changeset: "DOM constructor should only accept Ref<> / ExceptionOr<Ref<>> for creation to ensure toJSNewlyCreated is always returning object" https://bugs.webkit.org/show_bug.cgi?id=212767 https://trac.webkit.org/changeset/262583 2020-06-04 Zalan Bujtas <zalan@apple.com> HTMLAppletElement::updateWidget should check for renderer after the overlapping test. https://bugs.webkit.org/show_bug.cgi?id=212789 <rdar://problem/61854614> Reviewed by Simon Fraser. createJavaAppletWidget needs to check if the plugin(replacement) is obscured. Since the overlapping test requires up-to-date geometry, it initiates a top level style recalc/layout. We need to check if the apple element still has a renderer after the style recalc. * html/HTMLAppletElement.cpp: (WebCore::HTMLAppletElement::updateWidget): 2020-06-04 Jack Lee <shihchieh_lee@apple.com> Nullptr crash in DeleteSelectionCommand::doApply() when ending position is disconnected. https://bugs.webkit.org/show_bug.cgi?id=212723 <rdar://problem/63866653> Reviewed by Geoffrey Garen. In this test case, while merging paragraphs after deleting a text element, we need call removeNodeAndPruneAncestors() to remove a BR node. However, the ancestor of BR is also removed. Later we try to insert a node at the parent of the removed ancestor in function DeleteSelectionCommand::doApply(). For now we just check the parentless inserting position and bail out. The proper fix should be re-designing removeNodeAndPruneAncestors() or select a different inserting position after removeNodeAndPruneAncestors() is called. Test: editing/deleting/delete-txt-in-dl-crash.html * editing/DeleteSelectionCommand.cpp: (WebCore::DeleteSelectionCommand::doApply): 2020-06-04 Ross Kirsling <ross.kirsling@sony.com> [PlayStation] Unreviewed revert of build fix. Missing include was not the cause. * platform/graphics/ColorUtilities.cpp: 2020-06-04 Sihui Liu <sihui_liu@apple.com> REGRESSION:(r262398) Text manipulation crashes when content is added https://bugs.webkit.org/show_bug.cgi?id=212785 Reviewed by Ryosuke Niwa. r262398 accidentally removed the bound check on array index and was not caught by existing tests. Test: TextManipulation.CompleteTextManipulationFailWhenContentIsAdded * editing/TextManipulationController.cpp: (WebCore::TextManipulationController::replace): 2020-06-04 Ross Kirsling <ross.kirsling@sony.com> [PlayStation] Unreviewed build fix following r262352. * platform/graphics/ColorUtilities.cpp: 2020-06-04 Yusuke Suzuki <ysuzuki@apple.com> DOM constructor should only accept Ref<> / ExceptionOr<Ref<>> for creation to ensure toJSNewlyCreated is always returning object https://bugs.webkit.org/show_bug.cgi?id=212767 Reviewed by Darin Adler. When using toJSNewlyCreated in DOM constructor, we should ensure that this only returns JSObject* (if exception is not happening) to avoid `isObject()` check after that. However AudioContext and ImageData is not following this and can return nullptr from `create` factory function. We should not allow this. In this patch, 1. AudioContext should throw an error instead of returning null. AudioContext had a limit derived from OS, but this limit is reasonable only in Windows. We should insert `OS(WINDOWS)` around this check, and throw an error instead of returning null. 2. ImageData::create can return nullptr potentially, and it can be converted to null. This is not acceptable for DOM constructor. We should throw an error if we failed to create ImageData. 3. We inserted static_asserts in CodeGeneratorJS.pm to ensure that XXX::create only returns Ref<> or ExceptionOr<Ref<>>. This ensures that toJSNewlyCreated will return JSObject*. * Modules/webaudio/AudioContext.cpp: (WebCore::AudioContext::create): * Modules/webaudio/AudioContext.h: * Modules/webaudio/AudioContext.idl: * bindings/scripts/CodeGeneratorJS.pm: (GenerateConstructorDefinition): * dom/ExceptionOr.h: * html/ImageData.cpp: (WebCore::ImageData::create): * html/ImageData.h: * testing/Internals.cpp: (WebCore::Internals::videoSampleAvailable): 2020-06-04 Kate Cheney <katherine_cheney@apple.com> REGRESSION (r262212): [ iOS Debug wk2 ] ASSERTION FAILED: !isSynchronous() || !m_synchronousLoadData->delayedReply in WebKit::NetworkResourceLoader https://bugs.webkit.org/show_bug.cgi?id=212678 <rdar://problem/63797758> Reviewed by Chris Dumez. No new tests, this will fix http/tests/xmlhttprequest/access-control-preflight-credential-sync.html. Refactor the bundle identifier setters and getters in RuntimeApplicationChecksCocoa.mm so that a separate function sets an override bundle identifier, and clearing the override identifier does not clear the UI process bundle identifier as well. * platform/RuntimeApplicationChecks.h: * platform/cocoa/RuntimeApplicationChecksCocoa.mm: (WebCore::bundleIdentifierOverride): (WebCore::bundleIdentifier): (WebCore::applicationBundleIdentifier): (WebCore::setApplicationBundleIdentifier): (WebCore::setApplicationBundleIdentifierOverride): (WebCore::clearApplicationBundleIdentifierTestingOverride): (WebCore::applicationBundleIdentifierOverride): Deleted. 2020-06-04 Yusuke Suzuki <ysuzuki@apple.com> MessageEvent should tell its memory cost to GC https://bugs.webkit.org/show_bug.cgi?id=203990 Reviewed by Mark Lam. This patch fixes two issues to make MessageEvent's memoryCost working. 1. MessageEvent does not have memoryCost function. So even if ArrayBuffer etc. is held as a SerializedScriptValue, it does not communicate memory pressure to GC. This patch adds ReportExtraMemoryCost to MessageEvent.idl and memoryCost function to MessageEvent. And we implement SerializedScriptValue::memoryCost function to obtain rough memory cost for SerializedScriptValue. 2. IDL code generator puts `reportExtraMemoryAllocated` function call in `toJSNewlyCreated`. However, `toJSNewlyCreated` is not always used when creating JS wrapper. For example, JSMessageEvent can be created from toJSNewlyCreated for MessageEvent. But it can be also be created from toJSNewlyCreated for Event through EventFactory. If the latter path is taken, we won't properly report memory cost even if IDL has ReportExtraMemoryCost. In JSC, we put `reportExtraMemoryAllocated` at the end of JSXXX::finishCreation. IDL code should follow this convention. * bindings/js/SerializedScriptValue.cpp: (WebCore::SerializedScriptValue::SerializedScriptValue): (WebCore::SerializedScriptValue::computeMemoryCost const): * bindings/js/SerializedScriptValue.h: (WebCore::SerializedScriptValue::memoryCost const): * bindings/scripts/CodeGeneratorJS.pm: (GenerateImplementation): * bindings/scripts/test/JS/JSInterfaceName.cpp: (WebCore::JSInterfaceName::finishCreation): (WebCore::toJSNewlyCreated): * dom/MessageEvent.cpp: (WebCore::MessageEvent::memoryCost const): * dom/MessageEvent.h: * dom/MessageEvent.idl: * html/OffscreenCanvas.h: (WebCore::DetachedOffscreenCanvas::memoryCost const): 2020-06-04 Wenson Hsieh <wenson_hsieh@apple.com> [macOS] Add a way to override the contact AutoFill button image https://bugs.webkit.org/show_bug.cgi?id=212775 <rdar://problem/60381452> Reviewed by Tim Horton. Rename `SYSTEM_ATTACHMENT_PLACEHOLDER_ICON` to `ALTERNATE_ICONS`, and use it to additionally guard an alternate appearance for the contact AutoFill button icon. * css/html.css: (input::-webkit-contacts-auto-fill-button): * rendering/RenderThemeMac.h: * rendering/RenderThemeMac.mm: (WebCore::RenderThemeMac::extraDefaultStyleSheet): 2020-06-04 Tetsuharu Ohzeki <tetsuharu.ohzeki@gmail.com> Rename BlobLineEndings to EndingType to match the latest spec https://bugs.webkit.org/show_bug.cgi?id=212644 Reviewed by Sam Weinig. By the latest File API spec, the role of `BlobLineEndings` is named as `EndingType`. https://w3c.github.io/FileAPI/#enumdef-endingtype * CMakeLists.txt: * DerivedSources-input.xcfilelist: * DerivedSources-output.xcfilelist: * DerivedSources.make: * Headers.cmake: * Sources.txt: * WebCore.xcodeproj/project.pbxproj: * fileapi/BlobBuilder.cpp: (WebCore::BlobBuilder::BlobBuilder): (WebCore::BlobBuilder::append): * fileapi/BlobBuilder.h: * fileapi/BlobPropertyBag.h: * fileapi/BlobPropertyBag.idl: * fileapi/EndingType.h: Renamed from Source/WebCore/fileapi/BlobLineEndings.h. * fileapi/EndingType.idl: Renamed from Source/WebCore/fileapi/BlobLineEndings.idl. 2020-06-04 Chris Dumez <cdumez@apple.com> [iOS] Validate index parameter in PlatformPasteboard https://bugs.webkit.org/show_bug.cgi?id=212713 <rdar://problem/60068765> Reviewed by Alex Christensen. Follow-up to r262529 to also make sure that the index is not negative after casting to NSInteger. * platform/ios/PlatformPasteboardIOS.mm: (WebCore::PlatformPasteboard::readBuffer const): (WebCore::PlatformPasteboard::readString const): (WebCore::PlatformPasteboard::readURL const): 2020-06-04 Xabier Rodriguez Calvar <calvaris@igalia.com> [EME][GStreamer] cdmProxyAttached does not need to force a bump ref in the signature https://bugs.webkit.org/show_bug.cgi?id=212754 Reviewed by Philippe Normand. cdmProxyAttached is currently receiving a RefPtr<CDMProxy> in the signature, what causes a ref bump when the function is called. A const RefPtr<CDMProxy>& is more suitable cause the reference is already bumped when the CDMProxy assigned in the decryptor attribute. No new tests, just a rework. * platform/graphics/gstreamer/eme/WebKitClearKeyDecryptorGStreamer.cpp: (cdmProxyAttached): * platform/graphics/gstreamer/eme/WebKitCommonEncryptionDecryptorGStreamer.h: 2020-06-04 Tim Horton <timothy_horton@apple.com> Work around broken system version macro https://bugs.webkit.org/show_bug.cgi?id=212726 Reviewed by Dan Bernstein. * Configurations/DebugRelease.xcconfig: 2020-06-04 Andy Estes <aestes@apple.com> [watchOS] Re-enable content filtering in the simulator build https://bugs.webkit.org/show_bug.cgi?id=212711 <rdar://problem/63938350> Reviewed by Wenson Hsieh. * Configurations/FeatureDefines.xcconfig: 2020-06-04 Zalan Bujtas <zalan@apple.com> Reset fragment line info when the relatively positioned inline box becomes static with block child. https://bugs.webkit.org/show_bug.cgi?id=212724 <rdar://problem/62847534> Reviewed by Simon Fraser. adjustFragmentedFlowStateOnContainingBlockChangeIfNeeded was missing the case when the block container was inside an inline box. It happens when the inline box is relatively positioned while the child block box is absolutely positioned. RenderFragmentedFlow keeps track of the associated root lineboxes in m_lineToFragmentMap. In adjustFragmentedFlowStateOnContainingBlockChangeIfNeeded, when the block is no longer part of the fragment we remove these cached lineboxes from the m_lineToFragmentMap. This patch fixes the case when the cached lineboxes are generated by a child block box. * rendering/RenderElement.cpp: (WebCore::RenderElement::adjustFragmentedFlowStateOnContainingBlockChangeIfNeeded): 2020-06-04 Youenn Fablet <youenn@apple.com> Read MediaPlayerPrivateMediaStreamAVFObjC::m_canEnqueueDisplayLayer after the lock https://bugs.webkit.org/show_bug.cgi?id=212693 Reviewed by Eric Carlson. In case destroyLayers is called and shortly after ensureLayers is also called, the m_canEnqueueDisplayLayer check in enqueueVideoSample might be bypassed. Make sure to lock before checking m_canEnqueueDisplayLayer in enqueueVideoSample. For good measure, set m_canEnqueueDisplayLayer to false after locking in destroyLayers. * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm: (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::enqueueVideoSample): (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::destroyLayers): 2020-06-03 Chris Dumez <cdumez@apple.com> [iOS] Validate index parameter in PlatformPasteboard https://bugs.webkit.org/show_bug.cgi?id=212713 <rdar://problem/60068765> Reviewed by Wenson Hsieh. Validate index parameter in PlatformPasteboard, before calling [NSIndexSet indexSetWithIndex:]. Per documentation, index needs to be in the range [0 .. NSNotFound-1]. * platform/ios/PlatformPasteboardIOS.mm: (WebCore::PlatformPasteboard::readBuffer const): (WebCore::PlatformPasteboard::readString const): (WebCore::PlatformPasteboard::readURL const): 2020-06-03 Andy Estes <aestes@apple.com> [Apple Pay] Add new values for -apple-pay-button-type https://bugs.webkit.org/show_bug.cgi?id=212684 <rdar://problem/63908535> Reviewed by Anders Carlsson. Where available, added new values for -apple-pay-button-type and introduced ApplePaySession v10. New test: http/tests/ssl/applepay/ApplePayButton.html * Modules/applepay/PaymentCoordinatorClient.cpp: (WebCore::PaymentCoordinatorClient::supportsVersion): * accessibility/AccessibilityRenderObject.cpp: (WebCore::AccessibilityRenderObject::applePayButtonDescription const): * css/CSSPrimitiveValueMappings.h: (WebCore::CSSPrimitiveValue::CSSPrimitiveValue): (WebCore::CSSPrimitiveValue::operator ApplePayButtonType const): * css/CSSValueKeywords.in: * css/parser/CSSParserFastPaths.cpp: (WebCore::CSSParserFastPaths::isValidKeywordPropertyAndValue): * en.lproj/Localizable.strings: * platform/LocalizedStrings.cpp: (WebCore::AXApplePayReloadLabel): (WebCore::AXApplePayAddMoneyLabel): (WebCore::AXApplePayTopUpLabel): (WebCore::AXApplePayOrderLabel): (WebCore::AXApplePayRentLabel): (WebCore::AXApplePaySupportLabel): (WebCore::AXApplePayContributeLabel): (WebCore::AXApplePayTipLabel): * platform/LocalizedStrings.h: * rendering/RenderThemeCocoa.mm: (WebCore::toPKPaymentButtonType): * rendering/style/RenderStyleConstants.cpp: (WebCore::operator<<): * rendering/style/RenderStyleConstants.h: * rendering/style/StyleRareNonInheritedData.h: 2020-06-03 Daniel Bates <dabates@apple.com> Inserted text placeholder should vertically align to top and behave like block-level element when it has 0 width https://bugs.webkit.org/show_bug.cgi?id=212716 <rdar://problem/62672479> Reviewed by Darin Adler. Refine the appearance of a text placeholder based on feedback: 1. If the width of the placeholder is 0 then put it on its own line. This is accomplished by making it CSS "display: block". 2. Vertically align the placeholder with the top of the line. Both of these refinements are to make the rendering more like TextKit's rendering. Tests: editing/text-placeholder/insert-into-content-editable-non-zero-width-and-height.html editing/text-placeholder/insert-into-content-editable-zero-width.html * html/shadow/TextPlaceholderElement.cpp: 2020-06-03 Pinki Gyanchandani <pgyanchandani@apple.com> Release Assert @ WebCore::RenderTreeBuilder::RenderTreeBuilder https://bugs.webkit.org/show_bug.cgi?id=212714 Reviewed by Geoffrey Garen. Widget removal in the middle of building a Render Tree causes side effects, leading to Release Assert. Moved the scope for suspension of widgets update to RenderTreeBuilder instead of having it in RenderTreeUpdater. Also made sure that the WidgetHierarchyUpdatesSuspensionScope::moveWidgets() should handle all widgets scheduled to move, including new widgets scheduled during moveWidgets(). Test: fast/rendering/widget-removal-in-render-tree-builder-crash.html * rendering/RenderWidget.cpp: (WebCore::WidgetHierarchyUpdatesSuspensionScope::moveWidgets): * rendering/updating/RenderTreeBuilder.h: * rendering/updating/RenderTreeUpdater.cpp: (WebCore::RenderTreeUpdater::tearDownRenderers): 2020-06-03 Wenson Hsieh <wenson_hsieh@apple.com> [Text manipulation] Extract the value attribute in inputs of type "text" and "search" https://bugs.webkit.org/show_bug.cgi?id=212706 <rdar://problem/63876969> Reviewed by Tim Horton. Allow text manipulation to extract text for the value of text fields that were not last modified by user input. Aside from button types, it generally doesn't make sense to perform text manipulation over arbitrary input element values, especially for text field types such as passwords, URLs, emails, and numbers. However, some webpages set the `value` of inputs to implement `placeholder`-like behavior in text fields, and we need to be compatible with this. Tests: TextManipulation.StartTextManipulationExtractsValuesFromTextInputs TextManipulation.CompleteTextManipulationInButtonsAndTextFields * editing/TextManipulationController.cpp: (WebCore::shouldExtractValueForTextManipulation): Unfortunately, we need to check the type attribute here against "text", since inputs of type "date" and "time" fall back to text fields on macOS, and we still want to avoid extracting values for these. (WebCore::isAttributeForTextManipulation): Pull the `value` attribute of this out into a separate method, above. (WebCore::TextManipulationController::observeParagraphs): (WebCore::TextManipulationController::replace): Treat the text field value separately from other attributes by calling `HTMLInputElement::value()` upon extraction, and `HTMLInputElement::setValue()` upon replacement. 2020-06-03 Rob Buis <rbuis@igalia.com> Disallow responses when a response contains invalid header values https://bugs.webkit.org/show_bug.cgi?id=184493 Reviewed by Darin Adler. From the Fetch specification [1]: "A value is a byte sequence that matches the following conditions: "- Contains no 0x00 (NUL) or HTTP newline bytes." [1] https://fetch.spec.whatwg.org/#concept-header-value Tests: imported/w3c/web-platform-tests/fetch/h1-parsing/resources-with-0x00-in-header.window.html imported/web-platform-tests/fetch/api/basic/header-value-combining.any.html imported/web-platform-tests/fetch/api/basic/header-value-combining.any.worker.html imported/web-platform-tests/fetch/api/basic/header-value-null-byte.any.html imported/web-platform-tests/fetch/api/basic/header-value-null-byte.any.worker.html imported/web-platform-tests/xhr/headers-normalize-response.htm * Modules/fetch/FetchHeaders.cpp: (WebCore::canWriteHeader): (WebCore::appendToHeaderMap): (WebCore::FetchHeaders::filterAndFill): * loader/DocumentThreadableLoader.cpp: (WebCore::DocumentThreadableLoader::loadRequest): * loader/SubresourceLoader.cpp: (WebCore::SubresourceLoader::didReceiveResponse): * platform/network/HTTPParsers.cpp: (WebCore::isValidHTTPHeaderValue): * platform/network/ResourceResponseBase.cpp: (WebCore::ResourceResponseBase::containsInvalidHTTPHeaders const): * platform/network/ResourceResponseBase.h: 2020-06-03 Wenson Hsieh <wenson_hsieh@apple.com> dataTransfer.types is empty when handling the "dragstart" event https://bugs.webkit.org/show_bug.cgi?id=212685 <rdar://problem/61368402> Reviewed by Andy Estes. Implements several currently stubbed methods on StaticPasteboard, so that the DataTransfer provided to the page on the "dragstart" event contains the DOM-exposed data types that will be written to the system pasteboard. This includes "text/html", "text/plain", and "text/uri-list". Tests: DragAndDropTests.DataTransferTypesOnDragStartForTextSelection DragAndDropTests.DataTransferTypesOnDragStartForImage DragAndDropTests.DataTransferTypesOnDragStartForLink ...as well as several existing tests in DragAndDropTestsIOS.mm that attempt to set pasteboard data during the dragstart event: DragAndDropTests.DataTransferSanitizeHTML DragAndDropTests.DataTransferSetDataCannotWritePlatformTypes DragAndDropTests.DataTransferSetDataInvalidURL DragAndDropTests.DataTransferSetDataUnescapedURL DragAndDropTests.DataTransferSetDataValidURL * dom/DataTransfer.cpp: (WebCore::DataTransfer::commitToPasteboard): Only commit data to the native pasteboard if the page actually tried to write or modify the data. This allows us to preserve existing behavior by allowing DragController to write dragged data to the pasteboard normally in the case where the page didn't specify any custom data. In the case where the page does specify custom data, we will write this custom data *in addition* to any default data that was written to the static pasteboard. While this is a departure from our current behavior (which is to treat the pasteboard as a blank slate that contains only whatever custom data was provided by the page), it matches behavior in both Chrome and Firefox, and is likely more compatible with webpages that don't have UA-specific logic targeting WebKit. * editing/cocoa/EditorCocoa.mm: (WebCore::Editor::writeSelectionToPasteboard): Avoid calling into the injected bundle (as well as writing a few particular non-web-exposed types, such as web archive data) in the case where we're writing to a static pasteboard (there's no point in doing this for the static pasteboard, and in the worst case, it could confuse some internal clients). * editing/ios/EditorIOS.mm: (WebCore::Editor::writeImageToPasteboard): Ditto. * editing/mac/EditorMac.mm: (WebCore::Editor::writeImageToPasteboard): Ditto. But additionally, introduce a markup string to PasteboardImage, so that we will expose the "text/html" type when starting a drag on an image element. * page/DragController.cpp: (WebCore::DragController::startDrag): Only attempt to call into `Pasteboard::writeTrustworthyWebURLsPboardType` in the case where the pasteboard supports this type (i.e. on macOS). This fixes an existing assertion that was hit by my new API test, which attempts to override the contents of the pasteboard with custom data while starting a drag on a link. * page/EventHandler.cpp: (WebCore::EventHandler::handleDrag): Since the StaticPasteboard contains data before the page has written anything, don't use `Pasteboard::hasData()` to determine whether there's custom data; instead, use the new `hasNonDefaultData()` method on `StaticPasteboard` (see below). * platform/Pasteboard.cpp: (WebCore::Pasteboard::canWriteTrustworthyWebURLsPboardType): On non-macOS ports, return false. * platform/Pasteboard.h: * platform/StaticPasteboard.cpp: (WebCore::StaticPasteboard::hasNonDefaultData const): Keep track of whether the page attempted to stage any custom data during "dragstart" by maintaining the set of types written by the page, via calls to `writeString()` and similar. I'm using a set of types here instead of a simple `bool` flag to ensure correctness in the case where the page adds a type, and then later removes that same custom type, such that there is no longer non-default data. (WebCore::StaticPasteboard::writeString): (WebCore::StaticPasteboard::writeData): (WebCore::StaticPasteboard::writeStringInCustomData): (WebCore::StaticPasteboard::clear): See above. (WebCore::StaticPasteboard::writeMarkup): (WebCore::StaticPasteboard::writePlainText): (WebCore::StaticPasteboard::write): Implement these methods by writing to the `PasteboardCustomData`. These methods are invoked by our own code rather than the bindings, and should only be used to stage default data types when starting a drag. * platform/StaticPasteboard.h: * platform/mac/PasteboardMac.mm: (WebCore::Pasteboard::write): (WebCore::Pasteboard::canWriteTrustworthyWebURLsPboardType): 2020-06-03 Jer Noble <jer.noble@apple.com> Crash with uncaught exception: *** -[AVSampleBufferAudioRenderer enqueueSampleBuffer:] Sample buffer has media type 'vide' instead of 'soun' https://bugs.webkit.org/show_bug.cgi?id=212646 <rdar://problem/63040834> Reviewed by Eric Carlson. Protect against the possibility of AVStreamDataParser generating non-video or -audio samples in an otherwise video- or audio-track. Check the format description attached to the sample before appending, and ASSERT in debug builds and ERROR_LOG in release builds, as this is an exceptional condition. * platform/graphics/FourCC.h: (WTF::LogArgument<WebCore::FourCC>::toString): * platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm: (WebCore::SourceBufferPrivateAVFObjC::enqueueSample): 2020-06-03 Kate Cheney <katherine_cheney@apple.com> Any active sqlite transactions for the ITP database should be aborted when the network process suspends. https://bugs.webkit.org/show_bug.cgi?id=212608 <rdar://problem/60540768> Reviewed by Chris Dumez. Add WEBCORE_EXPORT macro to use interrupt() function in ResourceLoadStatisticsDatabaseStore. * platform/sql/SQLiteDatabase.h: 2020-06-03 Andres Gonzalez <andresg_22@apple.com> AX: SVG text node with content is described as "empty group" even if it's not empty https://bugs.webkit.org/show_bug.cgi?id=210315 Reviewed by Darin Adler. Test: accessibility/svg-text.html SVGText elements are conveyed as AXGroups and cannot have a description or help property, but instead the content of the element is exposed as static text. * accessibility/AccessibilitySVGElement.cpp: (WebCore::AccessibilitySVGElement::accessibilityDescription const): (WebCore::AccessibilitySVGElement::helpText const): * accessibility/AccessibilitySVGElement.h: 2020-06-03 Sihui Liu <sihui_liu@apple.com> Text manipulation sometimes fails to replace text in attributes https://bugs.webkit.org/show_bug.cgi?id=212701 Reviewed by Wenson Hsieh. Concatenate replacement tokens of same identifier for attribute like we do for title and option element in r260393. Covered by test: TextManipulation.CompleteTextManipulationShouldReplaceTextContentWithMultipleTokens * editing/TextManipulationController.cpp: (WebCore::TextManipulationController::replace): 2020-06-02 Dean Jackson <dino@apple.com> [ macOS ] REGRESSION(r262366): webgl/1.0.3/conformance/canvas/buffer-offscreen-test.html & webgl/2.0.0/conformance/canvas/buffer-offscreen-test.html are constant failures https://bugs.webkit.org/show_bug.cgi?id=212594 <rdar://problem/63828783> Reviewed by Eric Carlson. The change in r262366 split the OpenGL work to prepare a canvas for rendering from the actual painting (or compositing in this case). Canvas elements were being "prepared" at the end of the HTML run loop if they'd done anything that would change pixels. The problem is that canvas elements that are not in the document body are never composited, and thus should never be prepared, otherwise they will clear their drawing buffer. In other words, a canvas in this state must keep the same buffer through each rendering frame. The solution is to check if the canvas is in the tree scope at the time we consider preparing it for display. * dom/Document.cpp: (WebCore::Document::prepareCanvasesForDisplayIfNeeded): 2020-06-03 John Wilander <wilander@apple.com> Storage Access API: Add setting for per-page storage access scope https://bugs.webkit.org/show_bug.cgi?id=212682 <rdar://problem/63904824> Reviewed by Brent Fulgham. This is a follow-up patch to https://bugs.webkit.org/show_bug.cgi?id=212114, adding an off-by-default setting and a test case for per-page storage access. Test: http/tests/storageAccess/request-and-grant-access-with-per-page-scope-access-from-another-frame.html * dom/DocumentStorageAccess.cpp: (WebCore::DocumentStorageAccess::requestStorageAccess): * page/Settings.yaml: * testing/InternalSettings.cpp: (WebCore::InternalSettings::setStorageAccessAPIPerPageScopeEnabled): * testing/InternalSettings.h: * testing/InternalSettings.idl: 2020-06-03 Rob Buis <rbuis@igalia.com> Make generated C++ code use modern C++ https://bugs.webkit.org/show_bug.cgi?id=190714 Reviewed by Jonathan Bedard. Replace typedef usage by alias-declaration. No new tests. No change in behavior. * css/makeprop.pl: * dom/make_names.pl: (printHeaderHead): (printInit): (printTypeHelpersHeaderFile): (printFactoryCppFile): (printFactoryHeaderFile): (printWrapperFactoryCppFile): (printWrapperFactoryHeaderFile): 2020-06-03 Javier Fernandez <jfernandez@igalia.com> [css-grid] Dynamically setting "position: absolute" in a grid item doesn't trigger a relayout of that element https://bugs.webkit.org/show_bug.cgi?id=191465 Reviewed by Manuel Rego Casasnovas. From Blink r484620 by Sergio Villar <svillar@igalia.com> Containing block overrides not cleared for position:absolute Whenever a position:absolute block gets a new containing block the previously set containing block overrides are not cleared. This causes the block not to be properly layout for its new containing block (for example when using relative sizes). In particular this affects grid items which always get a containing block override size (which represent the grid areas) in case their containing block switches from the grid container to a grid ancestor. No new tests, as this change is covered by current web platform tests. * rendering/RenderBlock.cpp: (WebCore::RenderBlock::insertPositionedObject): Clear the containing block's override width and height. 2020-06-03 Youenn Fablet <youenn@apple.com> Add more logging related to service worker fetch event handling https://bugs.webkit.org/show_bug.cgi?id=212632 Reviewed by Chris Dumez. Add logging related to creating/canceling/deleting fetch event handler related client. No change of behavior. * workers/service/context/ServiceWorkerThreadProxy.cpp: (WebCore::ServiceWorkerThreadProxy::startFetch): (WebCore::ServiceWorkerThreadProxy::cancelFetch): (WebCore::ServiceWorkerThreadProxy::removeFetch): 2020-06-02 Yusuke Suzuki <ysuzuki@apple.com> ASSERTION FAILED: isCell() under WebCore::JSDOMConstructor seen with webaudio/the-audio-api/the-audiocontext-interface/audiocontextoptions.html https://bugs.webkit.org/show_bug.cgi?id=212650 Reviewed by Mark Lam. Some DOM constructor can return jsNull. For example, AudioContext constructor can return jsNull when it exceeds # of hardware audio contexts. However CodeGeneratorJS assumes that DOM constructor always returns an object, or throws an exception. This patch adds object check after DOM constructor call to handle the jsNull case while it does not change the existing semantics. * bindings/scripts/CodeGeneratorJS.pm: (GenerateConstructorDefinition): 2020-06-02 Simon Fraser <simon.fraser@apple.com> EventRegion::translate() needs to offset the wheel event regions https://bugs.webkit.org/show_bug.cgi?id=212683 Reviewed by Zalan Bujtas. EventRegion::translate() failed to offset the wheel event regions, which resulted in wrong reasons for GraphicsLayers with a non-zero offsetFromRenderer. Test: fast/scrolling/mac/wheel-event-listener-region-layer-offset.html * rendering/EventRegion.cpp: (WebCore::EventRegion::translate): 2020-06-02 Wenson Hsieh <wenson_hsieh@apple.com> Add a helper method to populate a DataTransfer before dispatching a "dragstart" event https://bugs.webkit.org/show_bug.cgi?id=212614 Work towards <rdar://problem/61368402> Reviewed by Tim Horton. Add a helper method in DragController to pre-populate the StaticPasteboard-backed DataTransfer before dispatching the "dragstart" event. There should be no change in behavior yet, since StaticPasteboard doesn't implement methods for writing data to the pasteboard, which this new method uses. * page/DragController.cpp: (WebCore::DragController::prepareForDragStart const): (WebCore::DragController::hitTestResultForDragStart const): (WebCore::DragController::startDrag): * page/DragController.h: * page/EventHandler.cpp: (WebCore::EventHandler::dispatchDragStartEventOnSourceElement): 2020-06-02 Andres Gonzalez <andresg_22@apple.com> AXIsolatedTree::updateNode should not call nodeForID. https://bugs.webkit.org/show_bug.cgi?id=212662 Reviewed by Chris Fleizach. In isolated tree mode AXIsolatedTree::nodeForID should be called only on the secondary AX thread. So removing the need to call nodeForID in updateNode by using AXCoreObject::childrenIDs() instead of retrieving the isolated node to access its children IDs. * accessibility/isolatedtree/AXIsolatedTree.cpp: (WebCore::AXIsolatedTree::updateNode): 2020-06-02 Keith Rollin <krollin@apple.com> Revert FEATURES_DEFINES related changes https://bugs.webkit.org/show_bug.cgi?id=212664 <rdar://problem/63893033> Reviewed by Andy Estes. Bug 262310, Bug 262311, Bug 262318, and Bug 262331 involve changes to FEATURE_DEFINES and how the values there relate to those found in the Platform*.h files. Those changes break XCBuild (by removing the .xcfilelist related to UnifiedSources and the process for generating them), and so are being reverted. No new tests -- build changes. * Configurations/FeatureDefines.xcconfig: * Configurations/GenerateUnifiedSources.xcconfig: Added. * DerivedSources-input.xcfilelist: * DerivedSources-output.xcfilelist: * DerivedSources.make: * Modules/applepay/ApplePayError.idl: * Modules/applepay/ApplePayPaymentAuthorizationResult.idl: * Modules/applepay/ApplePayPaymentContact.idl: * Modules/applepay/ApplePayPaymentMethodUpdate.idl: * Modules/applepay/ApplePayRequestBase.idl: * Modules/applepay/ApplePaySession.idl: * Modules/applepay/ApplePayShippingContactUpdate.idl: * Modules/applepay/ApplePayShippingMethodUpdate.idl: * Modules/applepay/PaymentCoordinatorClient.cpp: (WebCore::PaymentCoordinatorClient::supportsVersion): * Modules/applepay/paymentrequest/ApplePayPaymentHandler.cpp: (WebCore::ApplePayPaymentHandler::computePaymentMethodErrors const): * Scripts/generate-unified-sources.sh: * UnifiedSources-output.xcfilelist: Added. * WebCore.xcodeproj/project.pbxproj: * accessibility/AccessibilityRenderObject.cpp: (WebCore::AccessibilityRenderObject::applePayButtonDescription const): * css/CSSPrimitiveValueMappings.h: (WebCore::CSSPrimitiveValue::CSSPrimitiveValue): (WebCore::CSSPrimitiveValue::operator ApplePayButtonType const): * css/CSSValueKeywords.in: * css/parser/CSSParserFastPaths.cpp: (WebCore::CSSParserFastPaths::isValidKeywordPropertyAndValue): * rendering/RenderThemeCocoa.mm: (WebCore::toPKPaymentButtonType): * rendering/style/RenderStyleConstants.cpp: (WebCore::operator<<): * rendering/style/RenderStyleConstants.h: 2020-06-02 Ryan Haddad <ryanhaddad@apple.com> Unreviewed, reverting r262424. Caused webkitpy test failure Reverted changeset: "Make generated C++ code use modern C++" https://bugs.webkit.org/show_bug.cgi?id=190714 https://trac.webkit.org/changeset/262424 2020-06-02 Peng Liu <peng.liu6@apple.com> Stressing webkitSetPresentationMode leads to wrong inline video dimensions https://bugs.webkit.org/show_bug.cgi?id=202425 Reviewed by Eric Carlson. Make the HTMLVideoElement::setFullscreenMode() robust under stress tests by ignoring a request when the video element is not ready yet. Manually tested. * dom/Element.h: (WebCore::Element::didStopBeingFullscreenElement): Add a callback to indicate that the element has exited fullscreen. * dom/FullscreenManager.cpp: (WebCore::FullscreenManager::didExitFullscreen): Call Element::didStopBeingFullscreenElement() when the element has exited fullscreen. * html/HTMLMediaElement.cpp: (WebCore::HTMLMediaElement::enterFullscreen): * html/HTMLMediaElement.h: * html/HTMLVideoElement.cpp: (WebCore::HTMLVideoElement::webkitDisplayingFullscreen): This function will return true when a video element is in the process to exit fullscreen/picture-in-picture until it has completed the process. Therefore, a page can safely request the video element to enter fullscreen/picture-in-picture when this function returns false. (WebCore::HTMLVideoElement::setFullscreenMode): (WebCore::HTMLVideoElement::didBecomeFullscreenElement): (WebCore::HTMLVideoElement::didStopBeingFullscreenElement): (WebCore::HTMLVideoElement::didEnterFullscreen): Deleted. (WebCore::HTMLVideoElement::didExitFullscreen): Deleted. * html/HTMLVideoElement.h: Add a flag m_isChangingPresentationMode. webkitSetPresentationMode() will only change the presentation mode when the flag is false. 2020-06-01 Simon Fraser <simon.fraser@apple.com> Add ENABLE(WHEEL_EVENT_REGIONS), enabled on macOS which is the only platform that needs wheel event regions for scrolling thread hit-testing https://bugs.webkit.org/show_bug.cgi?id=212620 Reviewed by Tim Horton. Surround code related to wheel event regions with ENABLE(WHEEL_EVENT_REGIONS). Eventually we'll use this same code for touch event regions, and when we do, we can rejigger the #ifdefs. * rendering/EventRegion.cpp: (WebCore::EventRegion::operator== const): (WebCore::EventRegion::unite): (WebCore::EventRegion::containsEditableElementsInRect const): (WebCore::EventRegion::dump const): * rendering/EventRegion.h: * rendering/RenderLayerBacking.cpp: (WebCore::RenderLayerBacking::paintDebugOverlays): 2020-06-02 Andres Gonzalez <andresg_22@apple.com> Avoid calling axBackingObject multiple times in [WebAccessibilityObjectWrapper roleDescription]. https://bugs.webkit.org/show_bug.cgi?id=212643 Reviewed by Chris Fleizach. No new functionality. Avoid unnecessary overhead of calling axBackingObject multiple times in roleDescription. axBackingObject is not just a getter but involves checking whether isolated tree mode is enabled. * accessibility/mac/WebAccessibilityObjectWrapperMac.mm: (-[WebAccessibilityObjectWrapper subrole]): (-[WebAccessibilityObjectWrapper roleDescription]): 2020-06-02 Tetsuharu Ohzeki <tetsuharu.ohzeki@gmail.com> Pass nullptr for the 2nd argument of FileReaderLoader https://bugs.webkit.org/show_bug.cgi?id=212642 Reviewed by Darin Adler. Instead of passing `0`, `nullptr` is better because `FileReaderLoader` takes a pointer. * fileapi/FileReaderSync.cpp: (WebCore::FileReaderSync::readAsArrayBuffer): (WebCore::FileReaderSync::readAsBinaryString): (WebCore::FileReaderSync::readAsText): (WebCore::FileReaderSync::readAsDataURL): 2020-06-02 Tim Horton <timothy_horton@apple.com> UIColor and NSColor WebCore::Color factories should return invalid colors for nil input colors https://bugs.webkit.org/show_bug.cgi?id=212631 Reviewed by Anders Carlsson. * platform/graphics/mac/ColorMac.mm: (WebCore::colorFromNSColor): (WebCore::semanticColorFromNSColor): * platform/ios/ColorIOS.mm: (WebCore::colorFromUIColor): This doesn't affect any code currently in WebKit, but it is very, very surprising that these functions happily accept a null color, assert in debug, but in release do crazy things like try to paint the null color into a small bitmap to figure out what it really is. Also, this matches the behavior of the Color constructors that take CGColorRef. 2020-06-02 Rob Buis <rbuis@igalia.com> Make generated C++ code use modern C++ https://bugs.webkit.org/show_bug.cgi?id=190714 Reviewed by Sam Weinig. Replace typedef usage by alias-declaration. No new tests. No change in behavior. * css/makeprop.pl: * dom/make_names.pl: (printHeaderHead): (printInit): (printTypeHelpersHeaderFile): (printFactoryCppFile): (printFactoryHeaderFile): (printWrapperFactoryCppFile): (printWrapperFactoryHeaderFile): 2020-06-02 Tetsuharu Ohzeki <tetsuharu.ohzeki@gmail.com> Remove unused BlobURL::getIdentifier https://bugs.webkit.org/show_bug.cgi?id=212635 Reviewed by Youenn Fablet. * fileapi/BlobURL.cpp: * fileapi/BlobURL.h: 2020-06-02 Mark Lam <mark.lam@apple.com> Fix broken Windows build. https://bugs.webkit.org/show_bug.cgi?id=212633 Reviewed by Yusuke Suzuki. * html/HTMLCanvasElement.cpp: (WebCore::HTMLCanvasElement::needsPreparationForDisplay): (WebCore::HTMLCanvasElement::prepareForDisplay): 2020-06-02 Youenn Fablet <youenn@apple.com> Add some logging to ServiceWorkerThread to track install/activate event handling https://bugs.webkit.org/show_bug.cgi?id=212523 Reviewed by Chris Dumez. Add some logging for firing install/activate events and when these events are handled. No change of behavior. * workers/service/context/ServiceWorkerThread.cpp: (WebCore::ServiceWorkerThread::queueTaskToFireInstallEvent): (WebCore::ServiceWorkerThread::queueTaskToFireActivateEvent): 2020-06-02 Carlos Garcia Campos <cgarcia@igalia.com> [GTK4] Make popup menus work https://bugs.webkit.org/show_bug.cgi?id=211178 Reviewed by Adrian Perez de Castro. * platform/gtk/GtkVersioning.h: (gtk_tree_view_column_cell_get_size): 2020-06-01 Sergio Villar Senin <svillar@igalia.com> [css-flexbox] ChildIntrinsicLogicalWidth should use fit-content, not max-content https://bugs.webkit.org/show_bug.cgi?id=210465 Reviewed by Javier Fernandez. When computing the hypothetical cross size of each item in the flexbox algorithm the current code was using the max-size. However the specs state clearly that we should use fit-content instead, i.e., the shrink-to-fit size. See https://drafts.csswg.org/css-flexbox/#algo-cross-item. Based on Blink's crrev.com/1327746 by <cbiesinger@chromium.org> * rendering/RenderFlexibleBox.cpp: (WebCore::RenderFlexibleBox::childIntrinsicLogicalWidth const): Use the shrink-to-fit size instead just the max-size. 2020-06-02 Youenn Fablet <youenn@apple.com> MediaPlayerPrivateMediaStreamAVFObjC should enqueue samples in a background thread https://bugs.webkit.org/show_bug.cgi?id=212073 Reviewed by Eric Carlson. Do not hop to the main thread when rendering video samples anymore. Instead, we enqueue to the display layer in the background thread but still hop to the main thread for two things: - Update of various states of the player - keep a ref to the video sample if canvas rendering is needed. Most display layer operations stay in the main thread (creation, flushing...). Deletion of the display layer and access from a background are covered by a lock. The m_canEnqueueDisplayLayer boolean ensures we do not enqueue too early when the display layer is not yet properly initialized. LocalSampleBufferDisplayLayer needs to handle the fact that enqueueing might be done in a background thread. Instead of introducing a lock, we introduce a work queue and we hop to this queue whenever we need to enqueue/mutate the pending samples. Covered by existing tests and manual testing. * platform/graphics/avfoundation/objc/LocalSampleBufferDisplayLayer.h: * platform/graphics/avfoundation/objc/LocalSampleBufferDisplayLayer.mm: (-[WebAVSampleBufferStatusChangeListener observeValueForKeyPath:ofObject:change:context:]): (WebCore::LocalSampleBufferDisplayLayer::enqueueSample): (WebCore::LocalSampleBufferDisplayLayer::enqueueSampleBuffer): (WebCore::LocalSampleBufferDisplayLayer::requestNotificationWhenReadyForVideoData): * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.h: * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm: (WebCore::videoTransformationMatrix): (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::processNewVideoSampleAvailable): (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::videoSampleAvailable): (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::applicationDidBecomeActive): (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::flushRenderers): (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::ensureLayers): (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::destroyLayers): (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::updateRenderingMode): (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::checkSelectedVideoTrack): (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::paintCurrentFrameInContext): (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::setBufferingPolicy): (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::rootLayerBoundsDidChange): (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::videoTransformationMatrix): Deleted. (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::enqueueCorrectedVideoSample): Deleted. (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::updateDisplayLayer): Deleted. 2020-06-02 Youenn Fablet <youenn@apple.com> [ Mac wk2 ] http/wpt/service-workers/service-worker-spinning-fetch.https.html is flaky failing. https://bugs.webkit.org/show_bug.cgi?id=207515 <rdar://problem/59329307> Reviewed by Chris Dumez. When a service worker is terminated, we remove it from the map in SWContextManager. Shortly after a new service worker may be added to the map. In that case, previously, we were potentially trying to decrement the message count of the old service worker thread, which is confusing the new service worker thread. Instead, use WeakPtr to decrement if the service worker thread is still valid. Covered by existing tests. * workers/service/context/ServiceWorkerThread.cpp: (WebCore::ServiceWorkerThread::queueTaskToPostMessage): (WebCore::ServiceWorkerThread::queueTaskToFireInstallEvent): (WebCore::ServiceWorkerThread::queueTaskToFireActivateEvent): (WebCore::ServiceWorkerThread::start): * workers/service/context/ServiceWorkerThread.h: 2020-06-01 Myles C. Maxfield <mmaxfield@apple.com> [WebGPU] Update texture creation validation according to the discussion at https://github.com/gpuweb/gpuweb/pull/799/files https://bugs.webkit.org/show_bug.cgi?id=212390 Reviewed by Dean Jackson. Two new rules: Multisampled textures can't have the STORAGE flag, and sampleCount must be either 1 or 4. Test: webgpu/texture-creation.html * platform/graphics/gpu/GPUDevice.cpp: (WebCore::GPUDevice::tryCreateTexture const): 2020-06-01 Noam Rosenthal <noam@webkit.org> Make unicode-bidi:isolate the default for an element with a dir attribute (instead of unicode-bidi:embed) https://bugs.webkit.org/show_bug.cgi?id=134630 Reviewed by Simon Fraser. Unskipped 11 dir-isolation w3c tests. * html/HTMLElement.cpp: (WebCore::HTMLElement::collectStyleForPresentationAttribute): Use isolate instead of embed for unicode-bidi when dir attribute is present. 2020-06-01 Devin Rousso <drousso@apple.com> Web Inspector: Graphics: should use the `id` (name) of the animation if it exists https://bugs.webkit.org/show_bug.cgi?id=212618 Reviewed by Timothy Hatcher. Test: inspector/animation/lifecycle-css-animation.html: inspector/animation/lifecycle-css-transition.html: inspector/animation/lifecycle-web-animation.html: inspector/animation/nameChanged.html * animation/WebAnimation.h: (WebCore::WebAnimation::setId): Deleted. * animation/WebAnimation.cpp: (WebCore::WebAnimation::setId): Added. * inspector/InspectorInstrumentation.h: (WebCore::InspectorInstrumentation::didChangeWebAnimationName): Added. * inspector/InspectorInstrumentation.cpp: (WebCore::InspectorInstrumentation::didChangeWebAnimationNameImpl): Added. * inspector/agents/InspectorAnimationAgent.h: * inspector/agents/InspectorAnimationAgent.cpp: (WebCore::InspectorAnimationAgent::didChangeWebAnimationName): Added. (WebCore::InspectorAnimationAgent::bindAnimation): 2020-06-01 Andres Gonzalez <andresg_22@apple.com> [WebAccessibilityObjectWrapper subrole] should check for the nullity of the underlying AXCoreObject before dereferencing. https://bugs.webkit.org/show_bug.cgi?id=212607 Reviewed by Chris Fleizach. Covered by existing tests. - Check for nullity of the backingObject before dereferencing. - self.axBackingObject is now called only once, instead of many times unnecessarily. * accessibility/mac/WebAccessibilityObjectWrapperMac.mm: (-[WebAccessibilityObjectWrapper subrole]): 2020-06-01 Sihui Liu <sihui_liu@apple.com> TextManipulationController should put one Node in only one paragraph https://bugs.webkit.org/show_bug.cgi?id=212548 Reviewed by Wenson Hsieh. TextManipulationController mainly uses line break as delimiter to split paragraphs. In our current implementation, if text of a Node has line break, the part before the line break is in one paragraph and the part after the line break is in another paragraph, which means the Node is in the ranges of two paragraphs. In this case, when TextManipulationController manipulates the first paragraph, it replaces all the Nodes in the range of first paragraph with new Nodes. Then when it manipulates the second paragraph, if will find Node in the range of second paragraph does not exist and fail (because the Node is removed when handling the first paragraph.). Also, TextManipulationController currently does not preserve line breaks in text, which can be an issue if these line breaks are visible. This patch makes the ParagraphContentIterator iterate over Nodes instead of text, so a Node can only be in the range of one paragraph. To do this, it makes line break and spaces around it as a special excluded token. Here are the rules for splitting paragraphs by line break now: 1. If the special token is the first token in a Node, text in Nodes before the Node will make a paragraph. 2. If the special token is the last token in a Node, text in Nodes before the Node and in the Node will make a paragraph. 3. If the special token in the middle of tokens in a Node, then we don't make a new paragraph until next special token meets condition 1 or 2. This patch also fixes the issue that Nodes out of the paragraph range can be removed due to the preorder Node traversal, by finding and adding those Nodes back. * editing/TextManipulationController.cpp: (WebCore::ParagraphContentIterator::m_pastEndNode): (WebCore::ParagraphContentIterator::advance): (WebCore::ParagraphContentIterator::currentContent): (WebCore::ParagraphContentIterator::atEnd const): (WebCore::ParagraphContentIterator::advanceNode): (WebCore::ParagraphContentIterator::advanceIteratorNodeAndUpdateText): (WebCore::isEnclosingItemBoundaryElement): (WebCore::TextManipulationController::parse): (WebCore::TextManipulationController::observeParagraphs): (WebCore::TextManipulationController::addItem): (WebCore::TextManipulationController::getPath): (WebCore::TextManipulationController::updateInsertions): (WebCore::TextManipulationController::replace): (WebCore::ParagraphContentIterator::startPosition): Deleted. (WebCore::ParagraphContentIterator::endPosition): Deleted. (WebCore::ParagraphContentIterator::moveCurrentNodeForward): Deleted. (WebCore::containsOnlyHTMLSpaces): Deleted. * editing/TextManipulationController.h: 2020-06-01 David Kilzer <ddkilzer@apple.com> Don't use casts to convert between WebCore::DragDestinationAction and {Web,WK}DragDestinationAction types <https://webkit.org/b/212507> Reviewed by Darin Adler. * page/DragActions.h: (WebCore::anyDragDestinationAction): Add. (WebCore::DragDestinationActionAny): Delete. - Rename DragDestinationActionAny() to anyDragDestinationAction() to match WebKit style. * platform/DragData.h: - Update to use anyDragDestinationAction(). 2020-06-01 Simon Fraser <simon.fraser@apple.com> Add ENABLE(TOUCH_ACTION_REGIONS) to wrap code that's only relevant for platforms that consult touch-action for event handling https://bugs.webkit.org/show_bug.cgi?id=212572 Reviewed by Andy Estes. This will allow for optimizations in event region painting without ambiguity. * dom/Document.h: * page/Frame.cpp: (WebCore::Frame::invalidateContentEventRegionsIfNeeded): * page/scrolling/ScrollingTreeNode.h: * rendering/EventRegion.cpp: (WebCore::EventRegion::operator== const): (WebCore::EventRegion::unite): (WebCore::EventRegion::translate): (WebCore::EventRegion::dump const): * rendering/EventRegion.h: (WebCore::EventRegion::encode const): (WebCore::EventRegion::decode): * rendering/RenderBlock.cpp: (WebCore::RenderBlock::paintObject): * rendering/RenderElement.cpp: (WebCore::RenderElement::styleWillChange): * rendering/RenderLayerBacking.cpp: (WebCore::RenderLayerBacking::maintainsEventRegion const): (WebCore::RenderLayerBacking::paintDebugOverlays): * style/StyleTreeResolver.cpp: (WebCore::Style::TreeResolver::resolveElement): 2020-06-01 Tetsuharu Ohzeki <tetsuharu.ohzeki@gmail.com> Implement ParentNode.prototype.replaceChildren https://bugs.webkit.org/show_bug.cgi?id=198578 Reviewed by Darin Adler. Ideally, we can use `ContainerNode::replaceAllChildren` to implement this simply but the current of it does not have a path to support `DocumentFragment`. Hence, we call related methods from `ParentNode.prototype.replaceChildren` directly. * dom/ContainerNode.cpp: (WebCore::ContainerNode::replaceChildren): * dom/ContainerNode.h: * dom/ParentNode.idl: 2020-05-25 Sergio Villar Senin <svillar@igalia.com> [css-flexbox] Tables as flex items should obey the flex container sizing https://bugs.webkit.org/show_bug.cgi?id=212355 Reviewed by Manuel Rego Casasnovas. For most of the boxes, "width:auto" means use all the available space from your container in the inline direction. This means that a flex container does not need to do anything in particular to stretch them in the inline axis. However that is not true for tables because their width mostly depend on the sum of the sizes of their columns (whichever algorithm is used). That's why the layout code of tables should check whether or not it has an override for the content logical width which is the way flexbox uses to stretch flex items (and use that override width). * rendering/RenderTable.cpp: (WebCore::RenderTable::updateLogicalWidth): Stretch till overrideContentLogicalWidth() if needed. 2020-06-01 Sam Weinig <weinig@apple.com> Extended Color: Replace Color constructors taking numeric values with type specific factory functions https://bugs.webkit.org/show_bug.cgi?id=212576 Reviewed by Tim Horton. Replaces all remaining implicit and explicit uses of the Color constructors taking numeric values with explicit calls to makeSimpleColor/makeSimpleColorFromFloats/makeExtendedColor, giving us a consistent way to create colors. Also addes use constexpr SimpleColors where possible. * accessibility/isolatedtree/AXIsolatedObject.cpp: (WebCore::AXIsolatedObject::initializeAttributeData): * css/CSSValuePool.cpp: (WebCore::StaticCSSValuePool::StaticCSSValuePool): * css/parser/CSSPropertyParserHelpers.cpp: (WebCore::CSSPropertyParserHelpers::parseColorFunctionParameters): * html/HTMLInputElement.cpp: (WebCore::HTMLInputElement::createInnerTextStyle): * html/canvas/CanvasRenderingContext2DBase.cpp: (WebCore::CanvasRenderingContext2DBase::shadowColor const): (WebCore::CanvasRenderingContext2DBase::setShadow): * html/canvas/CanvasStyle.cpp: (WebCore::CanvasStyle::CanvasStyle): (WebCore::CanvasStyle::isEquivalentRGBA const): * inspector/InspectorOverlay.cpp: (WebCore::drawOutlinedQuadWithClip): (WebCore::drawShapeHighlight): (WebCore::InspectorOverlay::paint): (WebCore::InspectorOverlay::drawPaintRects): (WebCore::InspectorOverlay::drawBounds): (WebCore::InspectorOverlay::drawRulers): (WebCore::InspectorOverlay::drawElementTitle): * inspector/agents/InspectorDOMAgent.cpp: (WebCore::parseColor): * layout/integration/LayoutIntegrationLineLayout.cpp: (WebCore::LayoutIntegration::LineLayout::debugTextShadow): * page/CaptionUserPreferencesMediaAF.cpp: (WebCore::CaptionUserPreferencesMediaAF::captionsBackgroundCSS const): * page/DebugPageOverlays.cpp: (WebCore::touchEventRegionColors): (WebCore::NonFastScrollableRegionOverlay::drawRect): * page/FrameView.cpp: (WebCore::FrameView::paintContents): * page/PrintContext.cpp: (WebCore::PrintContext::spoolAllPagesWithBoundaries): * page/linux/ResourceUsageOverlayLinux.cpp: (WebCore::ResourceUsageOverlay::platformInitialize): * platform/graphics/BitmapImage.cpp: (WebCore::BitmapImage::draw): * platform/graphics/Color.cpp: (WebCore::Color::light const): (WebCore::Color::dark const): (WebCore::Color::blendWithWhite const): (WebCore::Color::colorWithAlphaMultipliedBy const): (WebCore::Color::colorWithAlphaMultipliedByUsingAlternativeRounding const): (WebCore::Color::colorWithAlpha const): (WebCore::Color::colorWithAlphaUsingAlternativeRounding const): (WebCore::blendWithoutPremultiply): (WebCore::extendedColorsEqual): Deleted. (WebCore::Color::tagAsValid): Deleted. * platform/graphics/Color.h: (WebCore::Color::Color): (WebCore::Color::tagAsSemantic): (WebCore::Color::tagAsValid): (WebCore::extendedColorsEqual): (WebCore::Color::decode): (WebCore::Color::setIsSemantic): Deleted. * platform/graphics/ExtendedColor.cpp: (WebCore::makeExtendedColor): * platform/graphics/ExtendedColor.h: (WebCore::ExtendedColor::ExtendedColor): (): Deleted. * platform/graphics/GraphicsLayer.cpp: (WebCore::GraphicsLayer::getDebugBorderInfo const): * platform/graphics/ca/GraphicsLayerCA.cpp: (WebCore::GraphicsLayerCA::recursiveCommitChanges): (WebCore::contentsLayerDebugBorderColor): (WebCore::cloneLayerDebugBorderColor): (WebCore::GraphicsLayerCA::createTransformAnimationsFromKeyframes): * platform/graphics/ca/PlatformCALayer.cpp: (WebCore::PlatformCALayer::drawRepaintIndicator): * platform/graphics/ca/TileCoverageMap.cpp: (WebCore::TileCoverageMap::TileCoverageMap): (WebCore::TileCoverageMap::update): * platform/graphics/ca/win/PlatformCALayerWinInternal.cpp: (PlatformCALayerWinInternal::drawRepaintCounters): * platform/graphics/cairo/GradientCairo.cpp: (WebCore::interpolateColorStop): * platform/graphics/cg/ColorCG.cpp: (WebCore::Color::Color): * platform/graphics/cg/NativeImageCG.cpp: (WebCore::nativeImageSinglePixelSolidColor): * platform/graphics/cocoa/GraphicsContextCocoa.mm: (WebCore::colorForMarkerLineStyle): * platform/graphics/filters/FilterOperation.cpp: (WebCore::DropShadowFilterOperation::blend): * platform/graphics/mac/ColorMac.mm: (WebCore::colorFromNSColor): * platform/graphics/texmap/TextureMapperPlatformLayerBuffer.cpp: (WebCore::TextureMapperPlatformLayerBuffer::paintToTextureMapper): * platform/ios/DragImageIOS.mm: (WebCore::createDragImageForLink): * platform/ios/LegacyTileCache.mm: (WebCore::LegacyTileCache::colorForGridTileBorder const): * platform/win/DragImageWin.cpp: (WebCore::createDragImageForLink): * rendering/PaintInfo.h: (WebCore::PaintInfo::forcedTextColor const): * rendering/RenderEmbeddedObject.cpp: (WebCore::RenderEmbeddedObject::paintReplaced): (WebCore::replacementTextRoundedRectPressedColor): Deleted. (WebCore::replacementTextRoundedRectColor): Deleted. (WebCore::replacementTextColor): Deleted. (WebCore::unavailablePluginBorderColor): Deleted. * rendering/RenderFrameSet.cpp: (WebCore::RenderFrameSet::paintColumnBorder): (WebCore::RenderFrameSet::paintRowBorder): (WebCore::borderStartEdgeColor): Deleted. (WebCore::borderEndEdgeColor): Deleted. (WebCore::borderFillColor): Deleted. * rendering/RenderLayer.cpp: (WebCore::RenderLayer::beginTransparencyLayers): * rendering/RenderLayerBacking.cpp: (WebCore::RenderLayerBacking::paintDebugOverlays): * rendering/RenderTheme.cpp: (WebCore::RenderTheme::platformActiveSelectionBackgroundColor const): (WebCore::RenderTheme::platformInactiveSelectionBackgroundColor const): (WebCore::RenderTheme::platformTextSearchHighlightColor const): (WebCore::RenderTheme::paintSystemPreviewBadge): (WebCore::RenderTheme::platformTapHighlightColor const): * rendering/RenderTheme.h: (WebCore::RenderTheme::platformFocusRingColor const): * rendering/RenderThemeIOS.h: * rendering/RenderThemeIOS.mm: (WebCore::RenderThemeIOS::paintCheckboxDecorations): (WebCore::RenderThemeIOS::paintRadioDecorations): (WebCore::RenderThemeIOS::paintMenuListButtonDecorations): (WebCore::RenderThemeIOS::paintSliderTrack): (WebCore::RenderThemeIOS::paintProgressBar): (WebCore::paintAttachmentProgress): (WebCore::paintAttachmentBorder): (WebCore::RenderThemeIOS::paintSystemPreviewBadge): (WebCore::RenderThemeIOS::shadowColor const): Deleted. (WebCore::attachmentBorderColor): Deleted. (WebCore::attachmentProgressColor): Deleted. * rendering/RenderThemeMac.mm: (WebCore::RenderThemeMac::paintMenuListButtonDecorations): (WebCore::titleTextColorForAttachment): (WebCore::AttachmentLayout::layOutSubtitle): (WebCore::paintAttachmentIconBackground): (WebCore::paintAttachmentTitleBackground): (WebCore::paintAttachmentProgress): (WebCore::paintAttachmentPlaceholderBorder): (WebCore::attachmentIconBackgroundColor): Deleted. (WebCore::attachmentIconBorderColor): Deleted. (WebCore::attachmentTitleInactiveBackgroundColor): Deleted. (WebCore::attachmentTitleInactiveTextColor): Deleted. (WebCore::attachmentSubtitleTextColor): Deleted. (WebCore::attachmentProgressBarBackgroundColor): Deleted. (WebCore::attachmentProgressBarFillColor): Deleted. (WebCore::attachmentProgressBarBorderColor): Deleted. (WebCore::attachmentPlaceholderBorderColor): Deleted. * rendering/RenderThemeWin.cpp: (WebCore::RenderThemeWin::platformActiveSelectionBackgroundColor const): (WebCore::RenderThemeWin::platformInactiveSelectionBackgroundColor const): (WebCore::RenderThemeWin::platformActiveSelectionForegroundColor const): (WebCore::RenderThemeWin::systemColor const): * rendering/SimpleLineLayoutFunctions.cpp: (WebCore::SimpleLineLayout::paintFlow): * rendering/mathml/RenderMathMLBlock.cpp: (WebCore::RenderMathMLBlock::paint): * rendering/style/RenderStyle.cpp: (WebCore::RenderStyle::colorResolvingCurrentColor const): * rendering/style/RenderStyle.h: (WebCore::RenderStyle::initialStrokeColor): * rendering/style/SVGRenderStyle.h: (WebCore::SVGRenderStyle::initialStopColor): (WebCore::SVGRenderStyle::initialFloodColor): (WebCore::SVGRenderStyle::initialLightingColor): * svg/SVGStopElement.cpp: (WebCore::SVGStopElement::stopColorIncludingOpacity const): * svg/properties/SVGAnimationAdditiveValueFunctionImpl.h: (WebCore::SVGAnimationColorFunction::animate): * testing/MockPageOverlayClient.cpp: (WebCore::MockPageOverlayClient::drawRect): * testing/cocoa/WebViewVisualIdentificationOverlay.mm: (-[WebViewVisualIdentificationOverlay initWithWebView:kind:deprecated:]): 2020-06-01 Per Arne Vollan <pvollan@apple.com> [Win] When GraphicsLayerCA::m_uncommittedChanges is initialized with a non-zero value, nothing is painted. https://bugs.webkit.org/show_bug.cgi?id=168666 Reviewed by Maciej Stachowiak. When m_uncommittedChanges is initialized with a non-zero value, client().notifyFlushRequired() will not be called in the first call to noteLayerPropertyChanged(), see https://bugs.webkit.org/show_bug.cgi?id=64808. Covered by existing tests. * platform/graphics/ca/GraphicsLayerCA.cpp: (WebCore::GraphicsLayerCA::initialize): * platform/graphics/ca/GraphicsLayerCA.h: 2020-06-01 Carlos Garcia Campos <cgarcia@igalia.com> [GTK4] Add printing support https://bugs.webkit.org/show_bug.cgi?id=212320 Reviewed by Adrian Perez de Castro. Add gtk_dialog_run() to GTK4. * platform/gtk/GtkVersioning.h: (gtk_dialog_run): 2020-06-01 Carlos Garcia Campos <cgarcia@igalia.com> [GTK4] Make inspector work https://bugs.webkit.org/show_bug.cgi?id=212321 Reviewed by Adrian Perez de Castro. Add gtk_native_dialog_run() for GTK4. * platform/gtk/GtkVersioning.h: (gtk_native_dialog_run): 2020-06-01 Rob Buis <rbuis@igalia.com> Rename ResourceResponseBase::isHTTP to isInHTTPFamily https://bugs.webkit.org/show_bug.cgi?id=208782 Reviewed by Sam Weinig. As the comment says, the method name is misleading and the method is inconsistent with the API of ResourceRequestBase, so rename it to make it clear the method can be used for both http and https protocols. No tests since no change in behavior. * loader/DocumentLoader.cpp: (WebCore::DocumentLoader::continueAfterContentPolicy): * loader/NetscapePlugInStreamLoader.cpp: (WebCore::NetscapePlugInStreamLoader::didReceiveResponse): * platform/network/ResourceResponseBase.cpp: (WebCore::ResourceResponseBase::isInHTTPFamily const): (WebCore::ResourceResponseBase::isHTTP const): Deleted. * platform/network/ResourceResponseBase.h: * xml/XMLHttpRequest.cpp: (WebCore::XMLHttpRequest::responseMIMEType const): * xml/parser/XMLDocumentParserLibxml2.cpp: (WebCore::externalEntityMimeTypeAllowed): 2020-05-31 Wenson Hsieh <wenson_hsieh@apple.com> Tidy up Source/WebCore/page/DragController.h https://bugs.webkit.org/show_bug.cgi?id=212584 Reviewed by Anders Carlsson. Unindent the `DragController` class by 1 indentation level, to adhere with <https://webkit.org/code-style-guidelines/#indentation-namespace>. Also, remove some stray trailing whitespace. No change in behavior. * page/DragController.h: (WebCore::DragController::mouseIsOverFileInput const): (WebCore::DragController::numberOfItemsToBeAccepted const): (WebCore::DragController::setDidInitiateDrag): (WebCore::DragController::didInitiateDrag const): (WebCore::DragController::sourceDragOperation const): (WebCore::DragController::draggingImageURL const): (WebCore::DragController::setDragOffset): (WebCore::DragController::dragOffset const): (WebCore::DragController::dragSourceAction const): (WebCore::DragController::dragHandlingMethod const): (WebCore::DragController::documentUnderMouse const): (WebCore::DragController::dragDestinationActionMask const): (WebCore::DragController::droppedImagePlaceholders const): (WebCore::DragController::droppedImagePlaceholderRange const): (WebCore::DragController::canLoadDataFromDraggingPasteboard const): (WebCore::DragController::client const): 2020-05-31 Dean Jackson <dino@apple.com> AutoTrader crashed while browsing search results https://bugs.webkit.org/show_bug.cgi?id=212461 rdar://60733185 Reviewed by Sam Weinig. On iOS, when using WebKit1 (UIWebView), CoreAnimation would call WebGLLayer's display method from a thread that is not the Web Thread. That method was performing some GL work using ANGLE, causing a crash. Since all the WebGLLayer's display method really needs to do is swap buffers for compositing, the fix is to separate all the GL operations into a method that can be called after painting but before compositing. This should also have the added benefit that by the time CoreAnimation comes to call display on all the dirty layers, we will have already executed our expensive GPU work. The total amount of work done on the GPU is the same, but hopefully it is now all done in WebKit's paint cycle, rather than when the Window Server is trying to get CA to composite things. Covered by a new API test: WebGLPrepareDisplayOnWebThread * html/HTMLCanvasElement.h: * html/HTMLCanvasElement.cpp: (WebCore::HTMLCanvasElement::HTMLCanvasElement): (WebCore::HTMLCanvasElement::~HTMLCanvasElement): (WebCore::HTMLCanvasElement::didMoveToNewDocument): (WebCore::HTMLCanvasElement::removedFromAncestor): Add or remove the document as a CanvasObserver. (WebCore::HTMLCanvasElement::needsPreparationForDisplay): Signals whether this element is the type that needs preparation. (WebCore::HTMLCanvasElement::prepareForDisplay): Tell the WebGLRenderingContext it must prepare. * html/canvas/WebGLRenderingContextBase.h: * html/canvas/WebGLRenderingContextBase.cpp: (WebCore::WebGLRenderingContextBase::prepareForDisplay): The WebGLRenderingContext must forward the call to prepare down to the GraphicsContextGLOpenGL. * platform/graphics/opengl/GraphicsContextGLOpenGL.h: * platform/graphics/opengl/GraphicsContextGLOpenGL.cpp: * platform/graphics/cocoa/GraphicsContextGLOpenGLCocoa.mm: (WebCore::GraphicsContextGLOpenGL::prepareForDisplay): And the GraphicsContextGLOpenGL forwards the call into the WebGLLayer. * platform/graphics/cocoa/WebGLLayer.h: * platform/graphics/cocoa/WebGLLayer.mm: (-[WebGLLayer prepareForDisplay]): (-[WebGLLayer display]): Split the parts of the `display` method that deal with flushing the GL commands, preparing the framebuffer texture, and swapping the IOSurfaces into a new `prepareForDisplay`. This method is invoked at the end of the rendering/layout tasks, leaving the `display` method to only tell CoreAnimation about a new buffer to composite. * dom/Document.cpp: * dom/Document.h: (WebCore::Document::prepareCanvasesForDisplayIfNeeded): (WebCore::Document::canvasChanged): (WebCore::Document::canvasDestroyed): Keep a set of HTMLCanvasElements that need to be prepared so we can tell them when they need to prepare. Do this by becoming a CanvasObserver, thus getting notified when a canvas has done something that would cause painting. * page/Page.cpp: (WebCore::Page::doAfterUpdateRendering): Add a new task that asks the Document to notify all relevant canvas objects that they should prepare for display. 2020-05-31 Jer Noble <jer.noble@apple.com> [Cocoa] EME should return more helpful error code during key exchange https://bugs.webkit.org/show_bug.cgi?id=212535 <rdar://problem/60439979> Reviewed by Eric Carlson. Clients have requested that the EME API provide more helpful information when the FairPlay CDM is unable to provide the requested level of key security. Currently, we reject the update() promise with a generic "failed" error code. Instead, resolve the promise, but mark the key as "output-restricted" in the key status map, indicating that the key cannot be used with required level of security. Drive-by fix: We currently ASSERT() that the callback from removeSessionData() isn't called if the session is not a PUR session. When calling removeSessionData() on a non-PUR session, call the callback with a generic "failed" error. * platform/graphics/avfoundation/objc/CDMInstanceFairPlayStreamingAVFObjC.mm: (WebCore::CDMInstanceSessionFairPlayStreamingAVFObjC::removeSessionData): (WebCore::CDMInstanceSessionFairPlayStreamingAVFObjC::didFailToProvideRequest): (WebCore::CDMInstanceSessionFairPlayStreamingAVFObjC::keyStatuses const): 2020-05-31 Jer Noble <jer.noble@apple.com> [Cocoa] Transition between encrypted and clear codecs throws error from SourceBuffer.appendBuffer() https://bugs.webkit.org/show_bug.cgi?id=212550 <rdar://problem/62207260> Reviewed by Eric Carlson. CoreMedia returns a different codec 4CC code for "encrypted AVC" than it does for "clear AVC", though the underlying codec used for both is the same. While CoreMedia does use different codec implementations for each, it is capable of freely switching between the two, and the codec string used by web developers for encrypted vs. clear content is identical. So we will treat these two codecs as "the same" as it pertains to the MSE requirement that codecs contained in new initialization segments are "the same" as previous ones. Adopt kCMFormatDescriptionExtension_ProtectedContentOriginalFormat, which can query the "original" codec used for encrypted codec playback. * platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm: 2020-05-31 Zalan Bujtas <zalan@apple.com> [iBooks] Empty pages appear in book https://bugs.webkit.org/show_bug.cgi?id=212573 <rdar://problem/62912623> Reviewed by Antti Koivisto. Do not add a page break for orphan content unless the line does not fit anymore. Test: fast/multicol/orphans-ignored.html * rendering/SimpleLineLayoutPagination.cpp: (WebCore::SimpleLineLayout::setPageBreakForLine): (WebCore::SimpleLineLayout::adjustLinePositionsForPagination): 2020-05-31 Rob Buis <rbuis@igalia.com> Implement named item condition for images https://bugs.webkit.org/show_bug.cgi?id=212473 Reviewed by Maciej Stachowiak. Implement named item condition for images, not only should we check there are both an id and a name attribute, but also that the name attribute is non-empty [1]. Behavior matches Chrome and Firefox. [1] https://html.spec.whatwg.org/multipage/dom.html#dom-document-nameditem-filter Test: imported/w3c/web-platform-tests/html/dom/documents/dom-tree-accessors/nameditem-06.html * html/HTMLNameCollection.cpp: (WebCore::DocumentNameCollection::elementMatchesIfIdAttributeMatch): 2020-05-31 Rob Buis <rbuis@igalia.com> <area> needs to be connected in order to navigate https://bugs.webkit.org/show_bug.cgi?id=177357 Reviewed by Maciej Stachowiak. Implement second step of cannot navigate algorithm: https://html.spec.whatwg.org/#cannot-navigate Test: web-platform-tests/html/semantics/links/following-hyperlinks/activation-behavior.window.html * html/HTMLAnchorElement.cpp: (WebCore::HTMLAnchorElement::handleClick): 2020-05-30 Sam Weinig <weinig@apple.com> Extended Color: Additional color cleanups https://bugs.webkit.org/show_bug.cgi?id=212567 Reviewed by Simon Fraser. A few unrelated quality-of-life cleanups to Color and related classes: - Rename Color::asSimpleColor() to Color::asSimple() for parity with Color::asExtended(). - Move SimpleColor implementations of invertedColorWithAlpha() and asSRGBFloatComponents() to SimpleColor for parity with ExtenedColor. - Rename ExtendedColor::channels() to ExtendedColor::components() to consistency. - Adds operator[] to ColorComponents to allow direct access to components rather than requiring and additional .components[] - Using std::minmax() where possible. - Renaming colorFloatToSimpleColorByte to scaleRoundAndClampColorChannel to have a consistent naming and location of conversion to 8-bit color channels. * platform/graphics/Color.cpp: (WebCore::Color::serialized const): (WebCore::Color::cssText const): (WebCore::Color::nameForRenderTreeAsText const): (WebCore::Color::light const): (WebCore::Color::dark const): (WebCore::Color::colorWithAlpha const): (WebCore::Color::colorWithAlphaUsingAlternativeRounding const): (WebCore::Color::invertedColorWithAlpha const): (WebCore::Color::colorSpaceAndComponents const): (WebCore::Color::toSRGBASimpleColorLossy const): (WebCore::Color::toSRGBAComponentsLossy const): * platform/graphics/Color.h: (WebCore::Color::isOpaque const): (WebCore::Color::isVisible const): (WebCore::Color::alpha const): (WebCore::Color::alphaAsFloat const): (WebCore::Color::asSimple const): (WebCore::Color::isBlackColor): (WebCore::Color::isWhiteColor): (WebCore::Color::encode const): (WebCore::Color::asSimpleColor const): Deleted. * platform/graphics/ColorComponents.h: (WebCore::ColorComponents::operator[]): (WebCore::ColorComponents::operator[] const): (WebCore::=): (WebCore::perComponentMax): (WebCore::perComponentMin): * platform/graphics/ColorMatrix.h: (WebCore::Rows>::transformedColorComponents const): * platform/graphics/ColorUtilities.cpp: (WebCore::areEssentiallyEqual): (WebCore::rgbToLinearComponents): (WebCore::linearToRGBComponents): (WebCore::lightness): (WebCore::luminance): (WebCore::sRGBToHSL): (WebCore::hslToSRGB): * platform/graphics/ColorUtilities.h: (WebCore::scaleRoundAndClampColorChannel): (WebCore::scaleRoundAndClampColorChannelUsingAlternativeRounding): (WebCore::colorFloatToSimpleColorByte): Deleted. * platform/graphics/ExtendedColor.cpp: (WebCore::ExtendedColor::hash const): (WebCore::ExtendedColor::cssText const): (WebCore::ExtendedColor::colorWithAlpha const): (WebCore::ExtendedColor::invertedColorWithAlpha const): (WebCore::ExtendedColor::toSRGBAComponentsLossy const): (WebCore::ExtendedColor::isWhite const): (WebCore::ExtendedColor::isBlack const): * platform/graphics/ExtendedColor.h: (WebCore::ExtendedColor::alpha const): (WebCore::ExtendedColor::components const): (WebCore::ExtendedColor::ExtendedColor): (WebCore::operator==): (WebCore::ExtendedColor::channels const): Deleted. * platform/graphics/SimpleColor.cpp: (WebCore::makeSimpleColorFromFloats): (WebCore::makeSimpleColorFromHSLA): * platform/graphics/SimpleColor.h: (WebCore::SimpleColor::SimpleColor): (WebCore::SimpleColor::valueAsARGB const): (WebCore::SimpleColor::colorWithAlpha const): (WebCore::SimpleColor::invertedColorWithAlpha const): (WebCore::SimpleColor::asSRGBFloatComponents const): (WebCore::makeSimpleColor): * platform/graphics/cg/ColorCG.cpp: (WebCore::cachedCGColor): * platform/graphics/filters/FELighting.cpp: (WebCore::FELighting::drawLighting): * platform/graphics/filters/FETurbulence.cpp: (WebCore::toIntBasedColorComponents): * platform/graphics/filters/FilterOperation.cpp: (WebCore::BasicComponentTransferFilterOperation::transformColor const): (WebCore::InvertLightnessFilterOperation::transformColor const): (WebCore::InvertLightnessFilterOperation::inverseTransformColor const): * platform/graphics/filters/FilterOperations.cpp: (WebCore::FilterOperations::transformColor const): (WebCore::FilterOperations::inverseTransformColor const): 2020-05-30 Commit Queue <commit-queue@webkit.org> Unreviewed, reverting r262335. https://bugs.webkit.org/show_bug.cgi?id=212571 Triggered assertions in WebKit1 Reverted changeset: "Disallow responses when a response contains invalid header values" https://bugs.webkit.org/show_bug.cgi?id=184493 https://trac.webkit.org/changeset/262335 2020-05-30 Simon Fraser <simon.fraser@apple.com> For scroll container and scrolled contents layers, use the renderer style to set up the event regions https://bugs.webkit.org/show_bug.cgi?id=212570 Reviewed by Antti Koivisto. RenderLayerBacking::updateEventRegion() sets up event regions on the scroll container and scrolled contents layer using the default style, in order to fill up the m_region part of EventRegion, but we might as well pass the renderer style so that it fills up the touch-action and wheel event regions as well. Also re-use the existing event region trace points for region building. * rendering/RenderLayerBacking.cpp: (WebCore::RenderLayerBacking::updateEventRegion): 2020-05-30 Andy Estes <aestes@apple.com> [Apple Pay] Support percentage border-radius values in -apple-pay-button https://bugs.webkit.org/show_bug.cgi?id=212559 <rdar://problem/63781881> Reviewed by Antti Koivisto. Added test cases to fast/css/appearance-apple-pay-button-border-radius.html. * rendering/RenderThemeCocoa.mm: (WebCore::RenderThemeCocoa::paintApplePayButton): Used floatValueForLength() to ensure percentage lengths are resolved before passing a corner radius to PassKit. 2020-05-29 Yusuke Suzuki <ysuzuki@apple.com> [JSC] JSBigInt allocation should be graceful for OOM https://bugs.webkit.org/show_bug.cgi?id=212512 Reviewed by Mark Lam. * bindings/js/SerializedScriptValue.cpp: (WebCore::CloneDeserializer::readBigInt): 2020-05-29 Simon Fraser <simon.fraser@apple.com> Event region painting should use the same paint flags as normal painting https://bugs.webkit.org/show_bug.cgi?id=212547 Reviewed by Sam Weinig. There are cases (see r260118) where we need to send down the correct paint flags when painting the scrolled contents layer to avoid unwanted clipping. We need to send down the one paint flag relevant for event region paints, CompositedOverflowScrollContent, for the same reasons. I could not make a testcase that shows a behavior change, but I did copy the testcase from r260118 and adapt it for event-region generation to detect future behavior changes. Test: fast/scrolling/mac/wheel-event-listener-region-inside-overflow-scroll-clipped-out.html * rendering/RenderLayer.cpp: (WebCore::RenderLayer::paintLayerContents): (WebCore::RenderLayer::collectEventRegionForFragments): * rendering/RenderLayer.h: 2020-05-29 Simon Fraser <simon.fraser@apple.com> Elements with wheel event handlers inside overflow:scroll are missing from the event region https://bugs.webkit.org/show_bug.cgi?id=212545 Reviewed by Zalan Bujtas. RenderBlock::paintObject() needs to traverse into descendants if there are are wheel event handlers on the document, just as it does for elements with touch-action. Test: fast/scrolling/mac/wheel-event-listener-region-inside-overflow-scroll.html * dom/Document.h: (WebCore::Document::hasTouchEventHandlers const): (WebCore::Document::hasWheelEventHandlers const): * rendering/RenderBlock.cpp: (WebCore::RenderBlock::paintObject): 2020-05-29 Rob Buis <rbuis@igalia.com> Disallow responses when a response contains invalid header values https://bugs.webkit.org/show_bug.cgi?id=184493 Reviewed by Youenn Fablet. From the Fetch specification [1]: "A value is a byte sequence that matches the following conditions: "- Contains no 0x00 (NUL) or HTTP newline bytes." [1] https://fetch.spec.whatwg.org/#concept-header-value Tests: imported/w3c/web-platform-tests/fetch/h1-parsing/resources-with-0x00-in-header.window.html imported/web-platform-tests/fetch/api/basic/header-value-combining.any.html imported/web-platform-tests/fetch/api/basic/header-value-combining.any.worker.html imported/web-platform-tests/fetch/api/basic/header-value-null-byte.any.html imported/web-platform-tests/fetch/api/basic/header-value-null-byte.any.worker.html imported/web-platform-tests/xhr/headers-normalize-response.htm * Modules/fetch/FetchHeaders.cpp: (WebCore::canWriteHeader): (WebCore::appendToHeaderMap): (WebCore::FetchHeaders::filterAndFill): * loader/DocumentThreadableLoader.cpp: (WebCore::DocumentThreadableLoader::loadRequest): * loader/SubresourceLoader.cpp: (WebCore::SubresourceLoader::didReceiveResponse): * platform/network/ResourceResponseBase.cpp: (WebCore::ResourceResponseBase::containsInvalidHTTPHeaders const): * platform/network/ResourceResponseBase.h: 2020-05-29 Andy Estes <aestes@apple.com> [Apple Pay] Remove conditionals for ENABLE_APPLE_PAY_SESSION_V(3|4) https://bugs.webkit.org/show_bug.cgi?id=212541 Reviewed by Darin Adler. APPLE_PAY_SESSION_V(3|4) is now enabled whenever APPLE_PAY itself is enabled. * Configurations/FeatureDefines.xcconfig: * Modules/applepay/ApplePayError.idl: * Modules/applepay/ApplePayPaymentAuthorizationResult.idl: * Modules/applepay/ApplePayPaymentContact.idl: * Modules/applepay/ApplePayPaymentMethodUpdate.idl: * Modules/applepay/ApplePayRequestBase.idl: * Modules/applepay/ApplePaySession.idl: * Modules/applepay/ApplePayShippingContactUpdate.idl: * Modules/applepay/ApplePayShippingMethodUpdate.idl: * Modules/applepay/PaymentCoordinatorClient.cpp: (WebCore::PaymentCoordinatorClient::supportsVersion): * Modules/applepay/paymentrequest/ApplePayPaymentHandler.cpp: (WebCore::ApplePayPaymentHandler::computePaymentMethodErrors const): * accessibility/AccessibilityRenderObject.cpp: (WebCore::AccessibilityRenderObject::applePayButtonDescription const): * css/CSSPrimitiveValueMappings.h: (WebCore::CSSPrimitiveValue::CSSPrimitiveValue): (WebCore::CSSPrimitiveValue::operator ApplePayButtonType const): * css/CSSValueKeywords.in: * css/parser/CSSParserFastPaths.cpp: (WebCore::CSSParserFastPaths::isValidKeywordPropertyAndValue): * rendering/RenderThemeCocoa.mm: (WebCore::toPKPaymentButtonType): * rendering/style/RenderStyleConstants.cpp: (WebCore::operator<<): * rendering/style/RenderStyleConstants.h: 2020-05-29 Jer Noble <jer.noble@apple.com> [EME] navigator.requestMediaKeySystemAccess() should reject PUR sessionTypes in private browsing mode. https://bugs.webkit.org/show_bug.cgi?id=212540 <rdar://problem/61125757> Reviewed by Eric Carlson. A MediaKeySystemAccess with a PUR session type will never be able to create media keys when created in private browsing mode. Allow clients to fail over to non-PUR session by rejecting the promise returned by requestMediaKeySystemAccess() when in private browsing mode. Test: platform/mac/media/encrypted-media/fps-ephemeral-requestMediaKeySystemAccess.html * Modules/encryptedmedia/CDM.cpp: (WebCore::CDM::getSupportedConfiguration): 2020-05-29 Wenson Hsieh <wenson_hsieh@apple.com> [iOS] Unable to paste images when composing mail at yahoo.com https://bugs.webkit.org/show_bug.cgi?id=212544 <rdar://problem/63511613> Reviewed by Megan Gardner and Andy Estes. When pasting images in the mobile version of the mail compose editor on mail.yahoo.com, mail.yahoo.com's script handles the paste by allowing images to be inserted into the DOM (i.e. by not preventing the "paste" event), and then stripping away the `src` attribute of the pasted image afterwards. This leaves behind a blank space in the email. Work around this by avoiding images when converting the contents of the pasteboard into web content on iOS. Instead, we fall back to inserting (sanitized) text, or nothing at all if there is no other representation suitable for converting into web content. Unfortunately, the mobile version of the website is loaded on iPad as well, even when the desktop website has been requested (through sending the macOS user agent and "MacIntel" navigator platform). * editing/cocoa/WebContentReaderCocoa.mm: (WebCore::WebContentReader::readImage): * page/Quirks.cpp: (WebCore::Quirks::shouldAvoidPastingImagesAsWebContent const): * page/Quirks.h: 2020-05-29 Darin Adler <darin@apple.com> Remove things from FeatureDefines.xcconfig that are covered by PlatformEnableCocoa.h https://bugs.webkit.org/show_bug.cgi?id=212418 Rubber-stamped by Simon Fraser. * Configurations/FeatureDefines.xcconfig: Add back ENABLE_CSS_CONIC_GRADIENTS, removed by accident. 2020-05-29 Jacob Uphoff <jacob_uphoff@apple.com> Unreviewed, reverting r262289. This commit caused a test to crash internally Reverted changeset: "MediaPlayerPrivateMediaStreamAVFObjC should enqueue samples in a background thread" https://bugs.webkit.org/show_bug.cgi?id=212073 https://trac.webkit.org/changeset/262289 2020-05-27 Darin Adler <darin@apple.com> Remove things from FeatureDefines.xcconfig that are covered by PlatformEnableCocoa.h https://bugs.webkit.org/show_bug.cgi?id=212418 Reviewed by Andy Estes. * Configurations/FeatureDefines.xcconfig: Removed 83 of the 119 things defined in this file. There are 36 more that are slightly more complex that we can remove carefully later. 2020-05-29 Darin Adler <darin@apple.com> Make generate-unified-sources.sh not depend on features being listed in FEATURE_DEFINES environment variable https://bugs.webkit.org/show_bug.cgi?id=212420 Currently any #if in the Sources.txt and SourcesCocoa.txt files can check only features defined in the FeatureDefines.xcconfig file, which sets up the FEATURE_DEFINES environment variable. Instead, we'd like to pass in all the things defined in the Platform.h headers as well. We accomplish that using the FEATURE_AND_PLATFORM_DEFINES variable from the DerivedSources.make file. This was the last place using FEATURE_DEFINES directly, so it frees us up to reduce FeatureDefines.xcconfig and move feature definitions to PlatformEnableCocoa.h instead, which will be less repetitive. Reviewed by Andy Estes. * Configurations/GenerateUnifiedSources.xcconfig: Deleted. * DerivedSources-input.xcfilelist: Updated. * DerivedSources-output.xcfilelist: Updated. * DerivedSources.make: Added a rule to invoke generate-unified-sources.sh, passing FEATURE_AND_PLATFORM_DEFINES. * Scripts/generate-unified-sources.sh: Removed hard-coded use of FEATURE_DEFINES. * UnifiedSources-output.xcfilelist: Deleted. * WebCore.xcodeproj/project.pbxproj: Removed Generate Unified Sources build step, since it's now part of Generate Derived Sources. 2020-05-29 Darin Adler <darin@apple.com> [Cocoa] Pass all defines from Platform.h to various scripts, not just the ones from .xcconfig https://bugs.webkit.org/show_bug.cgi?id=212451 Reviewed by Sam Weinig. * DerivedSources.make: Run the preprocessor on Platform.h and parse the output into FEATURE_AND_PLATFORM_DEFINES. Use that and FEATURE_AND_PLATFORM_DEFINE_DEPENDENCIES whenever we need a list of defines. Also took out some Windows-specific stuff since this is now only used on Mac platforms. Use ":=" when calling $(shell) to make sure the same shell command is not invoked over and over again. 2020-05-29 Keith Rollin <krollin@apple.com> Revert switch to XCBuild https://bugs.webkit.org/show_bug.cgi?id=212530 <rdar://problem/63764632> Unreviewed build fix. Bug 209890 enabled the use of XCBuild by default. Since then, some build issues have shown up. While addressing them, temporarily turn off the use of XCBuild by default. No new tests -- build fix. * WebCore.xcodeproj/project.pbxproj: 2020-05-29 Myles C. Maxfield <mmaxfield@apple.com> REGRESSION(r261940): PLT5 is 2% regressed https://bugs.webkit.org/show_bug.cgi?id=212504 <rdar://problem/63685637> Reviewed by Wenson Hsieh. We were causing spurious style recalcs on every main frame load. No new tests because there is no behavior change. * page/Settings.yaml: 2020-05-29 Sam Weinig <weinig@apple.com> Extended Color: ColorMatrix should support smaller matrices and be constexpr https://bugs.webkit.org/show_bug.cgi?id=212477 Reviewed by Simon Fraser. - Adds the ability to specify a ColorMatrix with any number of rows or columns, useful as most of the uses ColorMatrix did not need the full 5x4. Transformation act as-if the the ColorMatrix is the identify matrix for any rows or columns not present. For example, when transforming a ColorComponents, which is 4x1, a 3x3 ColorMatrix of the form: [ a, b, c ] [ d, e, f ] [ g, h, i ] will behave as-if it looks like: [ a, b, c, 0 ] [ d, e, f, 0 ] [ g, h, i, 0 ] [ 0, 0, 0, 1 ] In practice, this means that the last component of the input vector is left unmodified. - Adds ability to use ColorMatrix in constexpr statements, which will be useful for compile time concatenation of colorspace conversion matrices in a future change but is also useful for improved space efficiency of constant matrices already used. * Sources.txt: * WebCore.xcodeproj/project.pbxproj: Remove ColorMatrix.cpp * platform/graphics/ColorComponents.h: (WebCore::ColorComponents::ColorComponents): (WebCore::ColorComponents::operator+=): (WebCore::ColorComponents::operator+ const): (WebCore::ColorComponents::operator/ const): (WebCore::ColorComponents::operator* const): (WebCore::ColorComponents::abs const): (WebCore::ColorComponents::get const): (WebCore::perComponentMax): (WebCore::perComponentMin): (WebCore::operator==): (WebCore::operator!=): Make everything constexpr and move implementations out of the declarations for clarity. * platform/graphics/ColorMatrix.cpp: Removed. * platform/graphics/ColorMatrix.h: (WebCore::ColorMatrix::ColorMatrix): (WebCore::ColorMatrix::at const): (WebCore::grayscaleColorMatrix): (WebCore::sepiaColorMatrix): (WebCore::saturationColorMatrix): (WebCore::hueRotateColorMatrix): (WebCore::ColorMatrix::transformColorComponents): (WebCore::ColorMatrix::transformedColorComponents): Re-write as a class templatized on the number of rows and columns. Moves factory functions out of the class to avoid awkwardness of having to specify a dummy size when calling them (e.g. we wouldn't want you to have to write ColorMatrix<3, 3>::grayscaleMatrix(), instead just grayscaleColorMatrix() is much nicer). * platform/graphics/ColorUtilities.cpp: (WebCore::xyzToLinearSRGB): (WebCore::linearSRGBToXYZ): (WebCore::XYZToLinearP3): (WebCore::linearP3ToXYZ): * platform/graphics/filters/FilterOperation.cpp: (WebCore::BasicColorMatrixFilterOperation::transformColor const): (WebCore::InvertLightnessFilterOperation::transformColor const): (WebCore::InvertLightnessFilterOperation::inverseTransformColor const): Adopt new ColorMatrix interface. * platform/graphics/filters/FilterOperation.h: Remove unnecessary T in forward declaration. * platform/graphics/ColorUtilities.h: (WebCore::fastMultiplyBy255): (WebCore::fastDivideBy255): Add some missing constexprs. 2020-05-29 Commit Queue <commit-queue@webkit.org> Unreviewed, reverting r262245. https://bugs.webkit.org/show_bug.cgi?id=212531 "Caused WebCore's 'Check .xcfilelists' build phase to be ~100x slower" Reverted changeset: "[Cocoa] Pass all defines from Platform.h to various scripts, not just the ones from .xcconfig" https://bugs.webkit.org/show_bug.cgi?id=212451 https://trac.webkit.org/changeset/262245 2020-05-29 Sergio Villar Senin <svillar@igalia.com> Unreviewed build fix after r262299 We replaced ScriptExecutionContext* by Document& in WebXRSpace hierarchy, so the failing ASSERT() was: 1. Invalid, there is no "context" parameter but "document" 2. Not needed anymore, as we're passing a reference * Modules/webxr/WebXRSpace.cpp: (WebCore::WebXRSpace::WebXRSpace): Removed invalid ASSERT(). 2020-05-27 Sergio Villar Senin <svillar@igalia.com> [WebXR] Implement XRSession::requestReferenceSpace() https://bugs.webkit.org/show_bug.cgi?id=212407 Reviewed by Youenn Fablet. This patch implements the requestReferenceSpace() method of the XRSession which is used to create reference spaces. A reference space establishes a space where pose data will be defined and thus is mandatory to retrieve that pose information. There are still some bits that have to implementated in follow up patches using platform code. * Modules/webxr/WebXRBoundedReferenceSpace.cpp: (WebCore::WebXRBoundedReferenceSpace::create): Added. (WebCore::WebXRBoundedReferenceSpace::WebXRBoundedReferenceSpace): Ditto. * Modules/webxr/WebXRBoundedReferenceSpace.h: * Modules/webxr/WebXRReferenceSpace.cpp: (WebCore::WebXRReferenceSpace::create): Added. (WebCore::WebXRReferenceSpace::WebXRReferenceSpace): Ditto. (WebCore::WebXRReferenceSpace::getOffsetReferenceSpace): Use the create() method. * Modules/webxr/WebXRReferenceSpace.h: * Modules/webxr/WebXRSession.cpp: (WebCore::WebXRSession::referenceSpaceIsSupported const): New method to check whether a reference. space is supported by session and device. (WebCore::WebXRSession::requestReferenceSpace): New method that creates reference spaces for pose data. * Modules/webxr/WebXRSession.h: * Modules/webxr/WebXRSpace.cpp: (WebCore::WebXRSpace::WebXRSpace): Store a reference to the session creating the space. * Modules/webxr/WebXRSpace.h: 2020-05-29 Simon Fraser <simon.fraser@apple.com> Update debug overlays at rendering update time https://bugs.webkit.org/show_bug.cgi?id=212510 Reviewed by Antoine Quint. Don't eagerly update the regions in debug overlays when things change; this triggers assertions for touch event overlays. Instead, just mark them dirty and update the regions at "update the rendering" time. * page/DebugPageOverlays.cpp: (WebCore::RegionOverlay::setRegionChanged): (WebCore::RegionOverlay::didMoveToPage): (WebCore::RegionOverlay::recomputeRegion): (WebCore::DebugPageOverlays::regionChanged): (WebCore::DebugPageOverlays::updateRegionIfNecessary): * page/DebugPageOverlays.h: (WebCore::DebugPageOverlays::doAfterUpdateRendering): * page/Page.cpp: (WebCore::Page::doAfterUpdateRendering): 2020-05-29 Simon Fraser <simon.fraser@apple.com> Prepare for async scrolling in passive wheel event handler regions https://bugs.webkit.org/show_bug.cgi?id=212455 Reviewed by Tim Horton. Clarify the processing for wheel events by adding OptionSet<WheelEventProcessingSteps>, which will, in future, allow us to describe the processing for an event in the passive event handler region which does scrolling on the scrolling thread, and is then sent to the main thread for DOM event dispatch. Removed ScrollingEventResult, which conflated "handled" with "send to another thread". The thread sending behavior is now encoded in the WheelEventProcessingSteps, and we can just use a bool for handled. Scrolling tree and node handleWheelEvent() functions return a WheelEventHandlingResult, which is a tuple of OptionSet<WheelEventProcessingSteps> and 'handled', allowing for a node with background-attachment:fixed to add the "send to main thread" processing step. * page/FrameView.cpp: (WebCore::FrameView::wheelEvent): * page/scrolling/ScrollingCoordinator.h: (WebCore::ScrollingCoordinator::handleWheelEvent): * page/scrolling/ScrollingCoordinatorTypes.h: * page/scrolling/ScrollingTree.cpp: (WebCore::ScrollingTree::determineWheelEventProcessing): (WebCore::ScrollingTree::handleWheelEvent): (WebCore::ScrollingTree::shouldHandleWheelEventSynchronously): Deleted. * page/scrolling/ScrollingTree.h: (WebCore::WheelEventHandlingResult::needsMainThreadProcessing const): (WebCore::WheelEventHandlingResult::handled): (WebCore::WheelEventHandlingResult::unhandled): (WebCore::WheelEventHandlingResult::result): * page/scrolling/ScrollingTreeScrollingNode.cpp: (WebCore::ScrollingTreeScrollingNode::handleWheelEvent): * page/scrolling/ScrollingTreeScrollingNode.h: * page/scrolling/ThreadedScrollingTree.cpp: (WebCore::ThreadedScrollingTree::handleWheelEvent): (WebCore::ThreadedScrollingTree::handleWheelEventAfterMainThread): * page/scrolling/ThreadedScrollingTree.h: * page/scrolling/mac/ScrollingCoordinatorMac.h: * page/scrolling/mac/ScrollingCoordinatorMac.mm: (WebCore::ScrollingCoordinatorMac::handleWheelEvent): * page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.h: * page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.mm: (WebCore::ScrollingTreeFrameScrollingNodeMac::handleWheelEvent): * page/scrolling/mac/ScrollingTreeOverflowScrollingNodeMac.h: * page/scrolling/mac/ScrollingTreeOverflowScrollingNodeMac.mm: (WebCore::ScrollingTreeOverflowScrollingNodeMac::handleWheelEvent): * platform/PlatformWheelEvent.cpp: (WebCore::operator<<): * platform/PlatformWheelEvent.h: 2020-05-29 Sergio Villar Senin <svillar@igalia.com> [WebXR] ActiveDOMObjects must call suspendIfNeeded() upon creation https://bugs.webkit.org/show_bug.cgi?id=212517 Reviewed by Žan Doberšek. We weren't calling suspendIfNeeded() upon ActiveDOMObjects creation (XRSession and XRSystem) and that was triggering ASSERTION FAILED: m_suspendIfNeededWasCalled. No new tests required as this was already detected by existing tests. * Modules/webxr/WebXRSession.cpp: (WebCore::WebXRSession::WebXRSession): Call suspendIfNeeded(). * Modules/webxr/WebXRSystem.cpp: (WebCore::WebXRSystem::WebXRSystem): Call suspendIfNeeded(). 2020-05-29 Sergio Villar Senin <svillar@igalia.com> [WebXR] WebXRSystem::unregisterSimulatedXRDeviceForTesting() ASSERTs in m_immersiveDevices.contains(device) https://bugs.webkit.org/show_bug.cgi?id=212516 Reviewed by Žan Doberšek. The ASSERT that was failing was wrong. It was assuming that every simulated device should be part of the list of immersive devices. That's wrong, as devices only supporting inline sessions are not in that list. Apart from that, fake devices were not removed from the list of available devices in WebXRTest after disconnecting them all. That could potentially cause flakiness in the tests. No new test required as the current tests were properly detecting the issue. * Modules/webxr/WebXRSystem.cpp: (WebCore::WebXRSystem::registerSimulatedXRDeviceForTesting): Use XRSessionMode directly. (WebCore::WebXRSystem::unregisterSimulatedXRDeviceForTesting): Fixed the ASSERT. A simulated device might not be in the list of immersive devices if only supports inline sessions. * testing/WebXRTest.cpp: (WebCore::WebXRTest::disconnectAllDevices): Clear the list of devices after disconnecting. 2020-05-29 Youenn Fablet <youenn@apple.com> MediaPlayerPrivateMediaStreamAVFObjC should enqueue samples in a background thread https://bugs.webkit.org/show_bug.cgi?id=212073 Reviewed by Eric Carlson. Do not hop to the main thread when rendering video samples anymore. Instead, we enqueue to the display layer in the background thread but still hop to the main thread for two things: - Update of various states of the player - keep a ref to the video sample if canvas rendering is needed. Most display layer operations stay in the main thread (creation, flushing...). Deletion of the display layer and access from a background are covered by a lock. The m_canEnqueueDisplayLayer boolean ensures we do not enqueue too early when the display layer is not yet properly initialized. LocalSampleBufferDisplayLayer needs to handle the fact that enqueueing might be done in a background thread. Instead of introducing a lock, we introduce a work queue and we hop to this queue whenever we need to enqueue/mutate the pending samples. Covered by existing tests and manual testing. * platform/graphics/avfoundation/objc/LocalSampleBufferDisplayLayer.h: * platform/graphics/avfoundation/objc/LocalSampleBufferDisplayLayer.mm: (-[WebAVSampleBufferStatusChangeListener observeValueForKeyPath:ofObject:change:context:]): (WebCore::LocalSampleBufferDisplayLayer::enqueueSample): (WebCore::LocalSampleBufferDisplayLayer::enqueueSampleBuffer): (WebCore::LocalSampleBufferDisplayLayer::requestNotificationWhenReadyForVideoData): * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.h: * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm: (WebCore::videoTransformationMatrix): (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::processNewVideoSampleAvailable): (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::videoSampleAvailable): (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::applicationDidBecomeActive): (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::flushRenderers): (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::ensureLayers): (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::destroyLayers): (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::updateRenderingMode): (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::checkSelectedVideoTrack): (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::paintCurrentFrameInContext): (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::setBufferingPolicy): (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::rootLayerBoundsDidChange): (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::videoTransformationMatrix): Deleted. (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::enqueueCorrectedVideoSample): Deleted. (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::updateDisplayLayer): Deleted. 2020-05-29 Carlos Garcia Campos <cgarcia@igalia.com> [GTK4] Implement script dialogs https://bugs.webkit.org/show_bug.cgi?id=212318 Reviewed by Adrian Perez de Castro. Add more definitions to avoid ifdefs. * platform/gtk/GtkVersioning.h: (gtk_entry_set_text): (gtk_entry_get_text): (gtk_label_set_line_wrap): (gtk_window_set_default): (gtk_widget_add_css_class): 2020-05-28 Andy Estes <aestes@apple.com> [Apple Pay] Buttons render with a corner radius of PKApplePayButtonDefaultCornerRadius even when explicitly specifying "border-radius: 0px" https://bugs.webkit.org/show_bug.cgi?id=212476 <rdar://problem/63401433> Reviewed by Antti Koivisto. r256648 added support for customizing the corner radius of Apple Pay buttons using the border-radius CSS property. PassKit buttons have a default corner radius of 4, but border-radius has an initial value of 0, so to maintain web compatibility with existing buttons we only want to customize the corner radius when a border-radius value has been explicitly specified (otherwise, previously rounded buttons would all become squared off due to border-radius's initial value). r256648 checked for a non-initial border-radius by calling RenderStyle::hasBorderRadius, but this check does not distinguish between an initial value and an explicit declaration of "border-radius: 0px". As a result, authors are unable to create Apple Pay buttons with square corners. This patch adds a flag to RenderStyle::NonInheritedFlags that tracks whether any border-radius longhand has been explicitly set (or has explicitly inherited an explicitly set value), and uses that flag to adjust the computed border radius for Apple Pay buttons. The addition of RenderStyle::NonInheritedFlags::hasExplicitlySetBorderRadius did not change the size of RenderStyle. Tests: fast/css/appearance-apple-pay-button-border-radius.html fast/css/getComputedStyle/computed-style-apple-pay-button.html * css/CSSProperties.json: * rendering/RenderThemeCocoa.mm: (WebCore::RenderThemeCocoa::adjustApplePayButtonStyle const): (WebCore::RenderThemeCocoa::paintApplePayButton): (WebCore::largestCornerRadius): Deleted. * rendering/style/RenderStyle.cpp: (WebCore::RenderStyle::RenderStyle): * rendering/style/RenderStyle.h: (WebCore::RenderStyle::hasExplicitlySetBorderRadius const): (WebCore::RenderStyle::setHasExplicitlySetBorderRadius): (WebCore::RenderStyle::NonInheritedFlags::operator== const): (WebCore::RenderStyle::NonInheritedFlags::copyNonInheritedFrom): * style/StyleBuilderCustom.h: (WebCore::Style::BuilderCustom::applyInheritBorderBottomLeftRadius): (WebCore::Style::BuilderCustom::applyValueBorderBottomLeftRadius): (WebCore::Style::BuilderCustom::applyInheritBorderBottomRightRadius): (WebCore::Style::BuilderCustom::applyValueBorderBottomRightRadius): (WebCore::Style::BuilderCustom::applyInheritBorderTopLeftRadius): (WebCore::Style::BuilderCustom::applyValueBorderTopLeftRadius): (WebCore::Style::BuilderCustom::applyInheritBorderTopRightRadius): (WebCore::Style::BuilderCustom::applyValueBorderTopRightRadius): 2020-05-28 Andy Estes <aestes@apple.com> Shrink StyleRareNonInheritedData by 8 bytes (on 64-bit platforms) https://bugs.webkit.org/show_bug.cgi?id=212484 Reviewed by Tim Horton. There were 4 bytes of padding after shapeImageThreshold, enough to fit order and shrink the overall size of StyleRareNonInheritedData by 8 bytes on 64-bit platforms. Before: Total byte size: 480 Total pad bytes: 50 Padding percentage: 10.42 % After: Total byte size: 472 Total pad bytes: 42 Padding percentage: 8.90 % * rendering/style/StyleRareNonInheritedData.cpp: (WebCore::StyleRareNonInheritedData::StyleRareNonInheritedData): (WebCore::StyleRareNonInheritedData::operator== const): * rendering/style/StyleRareNonInheritedData.h: 2020-05-28 Megan Gardner <megan_gardner@apple.com> Responding to post commit review comments for https://bugs.webkit.org/show_bug.cgi?id=212060 * editing/InsertIntoTextNodeCommand.cpp: (WebCore::InsertIntoTextNodeCommand::doApply): 2020-05-28 Simon Fraser <simon.fraser@apple.com> Simplify EventDispatcher wheel event dispatch https://bugs.webkit.org/show_bug.cgi?id=212490 Reviewed by Tim Horton. The various cross-thread bounces and completion lambdas in EventDispatcher::wheelEvent() and ScrollingTree code made the logic very hard to follow. Moving the ScrollingThread::dispatch() into EventHandler code simplifies things a little, and allows for removal of the hokey "try to handle" ScrollingTree function, as well as the clunky completion function. Now, EventHandler call shouldHandleWheelEventSynchronously(), then does the ScrollingThread::dispatch() which allows the lambda to easily call back into EventHandler for the main thread dispatch. * page/scrolling/ScrollingTree.h: * page/scrolling/ThreadedScrollingTree.cpp: (WebCore::ThreadedScrollingTree::tryToHandleWheelEvent): Deleted. * page/scrolling/ThreadedScrollingTree.h: 2020-05-28 Oriol Brufau <obrufau@igalia.com> [css-grid] Fix referencing grid line names with auto repeat() https://bugs.webkit.org/show_bug.cgi?id=209572 Reviewed by Darin Adler. This patch fixes multiple problems when referencing named grid lines with the presence of the auto repeat() syntax: - If the 1st track was defined with auto repeat(), then the code used to assume that the referenced line appeared after the repeated tracks. But it may actually precede them. - If the referenced line appeared both inside and outside the auto repeat(), then it could resolve to the outside raw index, without expanding the auto repeat(). - The logic for placing a placement property set to both an integer and an identifier was wrong with auto repeat(). This patch fixes it by using the same proper logic that was already implemented in OrderedNamedLinesCollectorInGridLayout::collectLineNamesForIndex - The indices of both implicit grid lines defined with grid-template-areas and explicit ones defined with grid-template-rows/columns used to be stored together in NamedGridColumnLines and NamedGridRowLines. This was problematic because the former indices already refer to the final explicit grid so they don't have to be increased when expanding an auto repeat(), but the latter ones should. Therefore, this patch stores the indices in separate fields and uses the correct logic for each one. This also fixes 'grid-template-areas: inherit'. This patch is a port of these Chromium patches: - https://crrev.com/744426 - https://crrev.com/745925 - https://crrev.com/747631 - https://crrev.com/747669 - https://crrev.com/771984 Tests: imported/w3c/web-platform-tests/css/css-grid/placement/grid-placement-using-named-grid-lines-002.html imported/w3c/web-platform-tests/css/css-grid/placement/grid-placement-using-named-grid-lines-004.html imported/w3c/web-platform-tests/css/css-grid/placement/grid-placement-using-named-grid-lines-005.html imported/w3c/web-platform-tests/css/css-grid/placement/grid-placement-using-named-grid-lines-008.html imported/w3c/web-platform-tests/css/css-grid/placement/grid-placement-using-named-grid-lines-009.html * rendering/style/GridPositionsResolver.cpp: (WebCore::NamedLineCollection::NamedLineCollection): (WebCore::NamedLineCollection::hasExplicitNamedLines const): (WebCore::NamedLineCollection::hasNamedLines const): (WebCore::NamedLineCollection::contains const): (WebCore::NamedLineCollection::firstExplicitPosition const): (WebCore::NamedLineCollection::firstPosition const): * rendering/style/GridPositionsResolver.h: * rendering/style/RenderStyle.h: (WebCore::RenderStyle::implicitNamedGridColumnLines const): (WebCore::RenderStyle::implicitNamedGridRowLines const): (WebCore::RenderStyle::setImplicitNamedGridColumnLines): (WebCore::RenderStyle::setImplicitNamedGridRowLines): * rendering/style/StyleGridData.cpp: (WebCore::StyleGridData::StyleGridData): * rendering/style/StyleGridData.h: (WebCore::StyleGridData::operator== const): * style/StyleBuilderCustom.h: (WebCore::Style::BuilderCustom::applyInitialGridTemplateAreas): (WebCore::Style::BuilderCustom::applyInheritGridTemplateAreas): (WebCore::Style::BuilderCustom::applyValueGridTemplateAreas): 2020-05-28 Andres Gonzalez <andresg_22@apple.com> [ macOS Debug ] accessibility/roles-exposed.html is a flaky timeout https://bugs.webkit.org/show_bug.cgi?id=212478 <rdar://problem/63411656> Reviewed by Chris Fleizach. Logging the backingObject in every call to accessibilityAttributeValue seems to be causing this long test to take too long and timeout in slow systems. * accessibility/mac/WebAccessibilityObjectWrapperMac.mm: (-[WebAccessibilityObjectWrapper accessibilityAttributeValue:]): 2020-05-27 Keith Miller <keith_miller@apple.com> for-of should check the iterable is a JSArray for FastArray in DFG iterator_open https://bugs.webkit.org/show_bug.cgi?id=212383 Reviewed by Saam Barati. Update various InheritsTraits specializations to contain a typeRange member. Also, change the inherits function to use inheritsJSTypeImpl like the JSC variants. * bindings/js/JSDocumentCustom.h: (JSC::JSCastingHelpers::InheritsTraits<WebCore::JSDocument>::inherits): * bindings/js/JSElementCustom.h: (JSC::JSCastingHelpers::InheritsTraits<WebCore::JSElement>::inherits): * bindings/js/JSEventCustom.h: (JSC::JSCastingHelpers::InheritsTraits<WebCore::JSEvent>::inherits): * bindings/js/JSNodeCustom.h: (JSC::JSCastingHelpers::InheritsTraits<WebCore::JSNode>::inherits): * bindings/scripts/CodeGeneratorJS.pm: (GenerateHeader): 2020-05-27 Darin Adler <darin@apple.com> [Cocoa] Pass all defines from Platform.h to various scripts, not just the ones from .xcconfig https://bugs.webkit.org/show_bug.cgi?id=212451 Reviewed by Sam Weinig. * DerivedSources.make: Run the preprocessor on Platform.h and parse the output into FEATURE_AND_PLATFORM_DEFINES. Use that and FEATURE_AND_PLATFORM_DEFINE_DEPENDENCIES whenever we need a list of defines. Also took out some Windows-specific stuff since this is now only used on Mac platforms. 2020-05-27 Simon Fraser <simon.fraser@apple.com> ScrollingTreeMac::eventListenerRegionTypesForPoint() needs to convert the point to local coordinates https://bugs.webkit.org/show_bug.cgi?id=212440 Reviewed by Tim Horton. ScrollingTreeMac::eventListenerRegionTypesForPoint() needs to convert the point to local coordinates before consulting the event region. Also made EventListenerRegionType loggabale. Will be tested by wheel event tests once we switch to using these kinds of regions. * page/scrolling/mac/ScrollingTreeMac.mm: (collectDescendantLayersAtPoint): (ScrollingTreeMac::scrollingNodeForPoint): (ScrollingTreeMac::eventListenerRegionTypesForPoint const): * rendering/style/RenderStyleConstants.cpp: (WebCore::operator<<): * rendering/style/RenderStyleConstants.h: 2020-05-28 Youenn Fablet <youenn@apple.com> RealtimeIncomingVideoSourceCocoa::OnFrame should use video frame timestamp https://bugs.webkit.org/show_bug.cgi?id=212402 Reviewed by Eric Carlson. Use timestamp provided from the libwebrtc backend instread of marking the frames as display immediately. Update LocalSampleBufferDisplayLayer to mark the frame as display immediately if their presentation time is in the past since we guarantee the frames are in order. Remove the offset correction in MediaPlayerPrivateMediaStreamAVFObjC. This does not work well when the display layer is in GPU process and it is simpler to use the system clock which is what AVSampleBufferDisplayLayser is using if controlTimebase is not set. Manually tested. * platform/graphics/avfoundation/SampleBufferDisplayLayer.h: * platform/graphics/avfoundation/objc/LocalSampleBufferDisplayLayer.mm: (WebCore::LocalSampleBufferDisplayLayer::enqueueSample): (WebCore::LocalSampleBufferDisplayLayer::removeOldSamplesFromPendingQueue): * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.h: * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm: (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::enqueueVideoSample): (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::videoSampleAvailable): (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::sampleBufferDisplayLayerStatusDidChange): (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::applicationDidBecomeActive): * platform/mediastream/VideoTrackPrivateMediaStream.h: * platform/mediastream/mac/RealtimeIncomingVideoSourceCocoa.mm: (WebCore::RealtimeIncomingVideoSourceCocoa::OnFrame): 2020-05-28 Antti Koivisto <antti@apple.com> Incorrect clipping of absolute and fixed elements inside stacking-context composited overflow:hidden https://bugs.webkit.org/show_bug.cgi?id=212419 <rdar://problem/55856170> Reviewed by Simon Fraser. We incorrectly clip descendants that are not in containing block chain. There is already code to do the correct clipping, it just needs be enabled in this case. Tests: compositing/overflow/non-contained-descendant-clipping-absolute.html compositing/overflow/non-contained-descendant-clipping-fixed.html * rendering/RenderLayer.cpp: (WebCore::RenderLayer::RenderLayer): * rendering/RenderLayer.h: Add hasCompositedNonContainedDescendants bit. * rendering/RenderLayerCompositor.cpp: (WebCore::RenderLayerCompositor::CompositingState::stateForPaintOrderChildren const): (WebCore::RenderLayerCompositor::CompositingState::updateWithDescendantStateAndLayer): Check if the parent layer is for a containing block of this layer. (WebCore::RenderLayerCompositor::computeCompositingRequirements): Update the bit. (WebCore::RenderLayerCompositor::traverseUnchangedSubtree): (WebCore::RenderLayerCompositor::clipsCompositingDescendants): Pick the clipping path where descendants are not clipped. 2020-05-27 Noam Rosenthal <noam@webkit.org> Implement AccessKeyLabel attribute. https://bugs.webkit.org/show_bug.cgi?id=72715 Spec: https://html.spec.whatwg.org/multipage/interaction.html#dom-accesskeylabel As per spec, return the modifiers+accessKey when requesting the element accessKeyLabel. Equivalent to the existing Firefox implementation and (pending) Chrome implementation. Alt is the hardcoded modifier for any non-cocoa platform, so hardcode it also for the label. Use modifier text for Mac/iOS as it can change (e.g. for voice-over). Reviewed by Darin Adler. Test: fast/forms/access-key-label.html * html/HTMLElement.cpp: (WebCore::HTMLElement::accessKeyLabel const): * html/HTMLElement.h: * html/HTMLElement.idl: 2020-05-27 Sam Weinig <weinig@apple.com> Extended Color: Refactor FloatComponents and ColorComponents into a single templatized ColorComponents class https://bugs.webkit.org/show_bug.cgi?id=212446 Reviewed by Simon Fraser. Merge FloatComponents and ColorComponents into ColorComponents<T> and move them to their own header. This avoids duplicate code and paves the way for further generalization down the line. Also moves some utility functions to ColorUtilities.h from SimpleColor.h as they make more sense in the former. * Headers.cmake: * WebCore.xcodeproj/project.pbxproj: Add ColorComponents.h * platform/graphics/ColorComponents.h: Copied from Source/WebCore/platform/graphics/ColorUtilities.h. Moved ColorComponents to its own header and templatized it to allow it to serve the needs of both the old ColorComponents and old FloatComponents classes. * platform/graphics/ColorUtilities.cpp: * platform/graphics/ColorUtilities.h: Removed ColorComponents/FloatComponents and update existing usages to their new names. Also moved roundAndClampColorChannel, fastMultiplyBy255, fastDivideBy255 and colorFloatToSimpleColorByte here from SimpleColor to make it clear where general helper functions can go. * platform/graphics/Color.h: * platform/graphics/Color.cpp: (WebCore::Color::colorSpaceAndComponents const): (WebCore::Color::toSRGBAComponentsLossy const): * platform/graphics/ExtendedColor.h: (WebCore::ExtendedColor::channels const): Update for rename of FloatComponents to ColorComponents<float>. * platform/graphics/SimpleColor.cpp: (WebCore::makeSimpleColorFromHSLA): Use structured bindings and simplify code. * platform/graphics/SimpleColor.h: (WebCore::roundAndClampColorChannel): Deleted. (WebCore::fastMultiplyBy255): Deleted. (WebCore::fastDivideBy255): Deleted. (WebCore::colorFloatToSimpleColorByte): Deleted. As noted above, moved roundAndClampColorChannel, fastMultiplyBy255, fastDivideBy255 and colorFloatToSimpleColorByte to ColorUtilities.h * platform/graphics/filters/FEColorMatrix.cpp: Update for rename of FloatComponents to ColorComponents<float>. * platform/graphics/filters/FEDisplacementMap.cpp: (WebCore::byteOffsetOfPixel): Moved byteOffsetOfPixel here from ColorUtilities. This file is the only user and it wasn't general in a way that was clear for other users. * platform/graphics/filters/FELighting.cpp: (WebCore::FELighting::drawLighting): Update for rename of FloatComponents to ColorComponents<float>. * platform/graphics/filters/FEMorphology.cpp: (WebCore::makeColorComponentsfromPixelValue): Added. Used to be ColorComponents::fromRGBA(), but was only used here and didn't seem generally useful. (WebCore::makePixelValueFromColorComponents): Added. Used to be ColorComponents::toRGBA(), but was only used here and didn't seem generally useful. (WebCore::minOrMax): (WebCore::columnExtremum): (WebCore::kernelExtremum): (WebCore::FEMorphology::platformApplyGeneric): Update for rename of FloatComponents to ColorComponents<float> and ColorComponents to ColorComponents<uint8_t>. * platform/graphics/filters/FETurbulence.cpp: (WebCore::FETurbulence::noise2D const): (WebCore::toIntBasedColorComponents): (WebCore::FETurbulence::calculateTurbulenceValueForPoint const): (WebCore::FETurbulence::fillRegion const): * platform/graphics/filters/FETurbulence.h: Update for rename of FloatComponents to ColorComponents<float> and ColorComponents to ColorComponents<uint8_t>. Also renames toColorComponents to toIntBasedColorComponents as the former was no longer specific enough. Updated to use std::clamp. * platform/graphics/filters/FilterOperation.cpp: (WebCore::BasicColorMatrixFilterOperation::transformColor const): (WebCore::BasicComponentTransferFilterOperation::transformColor const): (WebCore::InvertLightnessFilterOperation::transformColor const): (WebCore::InvertLightnessFilterOperation::inverseTransformColor const): * platform/graphics/filters/FilterOperation.h: (WebCore::FilterOperation::transformColor const): (WebCore::FilterOperation::inverseTransformColor const): * platform/graphics/filters/FilterOperations.cpp: (WebCore::FilterOperations::transformColor const): (WebCore::FilterOperations::inverseTransformColor const): Update for rename of FloatComponents to ColorComponents<float>. 2020-05-27 David Kilzer <ddkilzer@apple.com> REGRESSION (r260023): ITP sparse plist decoding. <https://bugs.webkit.org/show_bug.cgi?id=212424> <rdar://problem/63683055> Reviewed by John Wilander. Reverted changeset: "KeyedDecoder functions in ResourceLoadStatistics.{cpp,h} should return bool and use WARN_UNUSED_RETURN" https://bugs.webkit.org/show_bug.cgi?id=210414 https://trac.webkit.org/changeset/260023 The revert did not compile due to changes in the KeyedDecoder class that require checking the return value of its methods, so additional changes were made below. * loader/ResourceLoadStatistics.cpp: (WebCore::decodeHashCountedSet): (WebCore::decodeHashSet): - Use IGNORE_WARNINGS_BEGIN("unused-result")/IGNORE_WARNINGS_END to suppress warning about ignoring the return value from KeyeDecoder::decodeObjects() since decoding these objects is optional. (WebCore::decodeOptionSet): - Check return value of KeyedDecoder::decodeUInt64() before setting `optionSet` parameter. 2020-05-27 Andres Gonzalez <andresg_22@apple.com> Empty alt attribute does not ignore the image for accessibility clients in Safari. https://bugs.webkit.org/show_bug.cgi?id=212432 Reviewed by Chris Fleizach. Test: accessibility/img-alt-attribute-unassigned-empty.html - AccessibilityRenderObject::computeAccessibilityIsIgnored was handling the case of images too late, after checking for ariaRoleAttribute(). So if an image had a role attribute, it was exposed regardless whether its alt attribute was an empty string. This change moves the handling of images above the check for ariaroleAttribute and hence honors the empty alt attribute rule. - Also images that have an aria-label attribute are now exposed. - Added logging of AccessibilityObjectInclusion. - Changed signature of log(RefPtr<AXCoreObject>) as pointed out by Darin Adler in a separate review. * accessibility/AXLogger.cpp: (WebCore::AXLogger::log): (WebCore::operator<<): * accessibility/AXLogger.h: * accessibility/AccessibilityNodeObject.cpp: (WebCore::AccessibilityNodeObject::determineAccessibilityRole): (WebCore::AccessibilityNodeObject::isImage const): Moved to base class. * accessibility/AccessibilityNodeObject.h: * accessibility/AccessibilityObject.h: * accessibility/AccessibilityObjectInterface.h: (WebCore::AXCoreObject::isImage const): * accessibility/AccessibilityRenderObject.cpp: (WebCore::objectInclusionFromAltText): (WebCore::AccessibilityRenderObject::computeAccessibilityIsIgnored const): (WebCore::AccessibilityRenderObject::determineAccessibilityRole): (WebCore::AccessibilityRenderObject::updateRoleAfterChildrenCreation): * accessibility/isolatedtree/AXIsolatedObject.cpp: (WebCore::AXIsolatedObject::initializeAttributeData): * accessibility/isolatedtree/AXIsolatedObject.h: 2020-05-27 Chris Dumez <cdumez@apple.com> pageshow only fires the first time the back button is pressed https://bugs.webkit.org/show_bug.cgi?id=156356 <rdar://problem/29256489> Reviewed by Alexey Proskuryakov. When FrameLoader::commitProvisionalLoad() would restore a page from the back/forward cache, it would only call FrameLoader::checkCompleted() in the main frame and fail to do so in subframes. Calling checkCompleted() is important, not only because it sets m_isComplete to true but also because it calls checkCallImplicitClose(), which resets m_didCallImplicitClose to true and m_wasUnloadEventEmitted to false. Because checkCompleted() was not called, FrameLoader::dispatchUnloadEvents() would then fail to fire the pagehide event because the `m_didCallImplicitClose && !m_wasUnloadEventEmitted` was not met. Also, even though checkCompleted() was called for the main frame, if there are subframes, it would just return early because allChildrenAreComplete() returned false. Later on, when trying to fire the pageshow event, it would fail to because we have logic in DOMWindow::dispatchEvent() to avoid firing a pageshow event if we did not previously send a pagehide event. To address the issue, I now call checkCompleted() in FrameLoader::open() for subframes, as this gets called for every frame during restoration from the back/forward cache. For the main frame, we keep calling checkCompleted(), after we've called sendRemainingDelegateMessages(). Test: fast/history/multiple-back-forward-navigations.html * loader/FrameLoader.cpp: (WebCore::FrameLoader::open): 2020-05-27 Sam Weinig <weinig@apple.com> Extended Color: Move ColorMatrix to its own files https://bugs.webkit.org/show_bug.cgi?id=212431 Reviewed by Dean Jackson. Move ColorMatrix to its own files from ColorUtilities.h/cpp * Headers.cmake: * Sources.txt: * WebCore.xcodeproj/project.pbxproj: * platform/graphics/ColorMatrix.cpp: Copied from Source/WebCore/platform/graphics/ColorUtilities.cpp. * platform/graphics/ColorMatrix.h: Copied from Source/WebCore/platform/graphics/ColorUtilities.h. * platform/graphics/ColorUtilities.cpp: * platform/graphics/ColorUtilities.h: * platform/graphics/filters/FilterOperation.cpp: 2020-05-27 David Kilzer <ddkilzer@apple.com> Add OptionSetTraits<> and use with WebCore::DragDestinationAction <https://webkit.org/b/212397> Reviewed by Alex Christensen. * page/DragActions.h: (WTF::OptionSetTraits<WebCore::DragDestinationAction>): - Add for use with OptionSet<>. 2020-05-27 Wenson Hsieh <wenson_hsieh@apple.com> [Clipboard API] Support reading "image/png" on ClipboardItem https://bugs.webkit.org/show_bug.cgi?id=212339 <rdar://problem/63588957> Reviewed by Tim Horton. Adds support for reading "image/png" data via ClipboardItem.getType(). See below for more details. Tests: ClipboardTests.ConvertTIFFToPNGWhenPasting editing/async-clipboard/clipboard-read-write-images.html * Modules/async-clipboard/Clipboard.cpp: (WebCore::Clipboard::getType): (WebCore::Clipboard::updateSessionValidity): Factor out logic for invalidating the `Clipboard`'s active `Pasteboard` object into a helper method. This is invoked after reading data from the clipboard, and verifies that the changeCount of the pasteboard is still the same as it was upon initially reading the contents of the clipboard. If the clipboard contents changed, we invalidate the session, and `Clipboard` is subsequently denied pasteboard access (until the next time the user explicitly grants programmatic pasteboard access). Note that this step is here for correctness rather than security. While it is true that a compromised web process could fake the changeCount at any given moment, other fairly recent changes around WebPasteboardProxy in the UI process makes it impossible to take advantage of this fact to arbitrarily read content from the system pasteboard. Instead of simply reading the empty string, this invalidation ensures that we actually reject the promise returned by the async clipboard API. * Modules/async-clipboard/Clipboard.h: * Modules/async-clipboard/ClipboardImageReader.cpp: Added. Add a PasteboardFileReader subclass that is responsible for sanitizing image data from the pasteboard into data that may be exposed to the page via clipboard API. On both macOS and iOS, this ensures that potentially sensitive EXIF data is stripped via conversion to the platform image type and back. On macOS, this additionally allows us to handle transcoding TIFF data on the pasteboard to PNG (this is covered by the new API test). (WebCore::ClipboardImageReader::readBuffer): Add a stub implementation for non-Cocoa platforms for now, which don't implement this part of the API. (WebCore::ClipboardImageReader::shouldReadBuffer const): Add a new hook to skip over certain types when reading pasteboard data into Files. In particular, `ClipboardImageReader` skips over any MIME type that does not match the MIME type specified (for now, this is limited to "image/png", but may be extended to include more image types in the future after we implement more transcoding logic). * Modules/async-clipboard/ClipboardImageReader.h: Added. (WebCore::ClipboardImageReader::ClipboardImageReader): (WebCore::ClipboardImageReader::takeResult): * Modules/async-clipboard/ios/ClipboardImageReaderIOS.mm: Added. (WebCore::ClipboardImageReader::readBuffer): Add iOS-specific `(PNG) => PNG` transcoding logic. * Modules/async-clipboard/mac/ClipboardImageReaderMac.mm: Added. (WebCore::ClipboardImageReader::readBuffer): Add macOS-specific `(PNG, TIFF) => PNG` transcoding logic. * Sources.txt: * SourcesCocoa.txt: * WebCore.xcodeproj/project.pbxproj: * platform/Pasteboard.h: (WebCore::PasteboardFileReader::shouldReadBuffer const): * platform/cocoa/PasteboardCocoa.mm: (WebCore::Pasteboard::read): Add support for targeting a given pasteboard item index when reading files on Cocoa platforms. * platform/gtk/PasteboardGtk.cpp: (WebCore::Pasteboard::read): * platform/ios/PlatformPasteboardIOS.mm: (WebCore::safeTypeForDOMToReadAndWriteForPlatformType): (WebCore::webSafeTypes): (WebCore::PlatformPasteboard::informationForItemAtIndex): Expose "image/png" as one of the readable pasteboard types on iOS when using the async clipboard API. For some reason, this adjustment was made on macOS, but wasn't done on iOS, which led to a missing "image/png" type when asking for `ClipboardItem.types`. (WebCore::PlatformPasteboard::typesSafeForDOMToReadAndWrite const): Add support for writing "image/png "data to the system pasteboard (note that this data has been sanitized already, as it has been processed through `ClipboardItemTypeLoader::sanitizeDataIfNeeded()`). We simply needed to use `forEachPlatformStringOrBuffer` instead of just `forEachPlatformString` when writing the custom pasteboard data. (WebCore::createItemProviderRegistrationList): * platform/libwpe/PasteboardLibWPE.cpp: (WebCore::Pasteboard::read): * platform/win/PasteboardWin.cpp: (WebCore::Pasteboard::read): 2020-05-27 Said Abou-Hallawa <sabouhallawa@apple.com> REGRESSION (r254541): Valid mime types can only be added to the HashSet of the supported types for encoding https://bugs.webkit.org/show_bug.cgi?id=212427 Reviewed by Darin Adler. Add back a check for the mime type validity which was removed in r254541. * platform/MIMETypeRegistry.cpp: (WebCore::MIMETypeRegistry::createMIMETypeRegistryThreadGlobalData): 2020-05-27 Devin Rousso <drousso@apple.com> Web Inspector: replace `featureGuard` and `availability` with a combined `condition` that accepts any macro https://bugs.webkit.org/show_bug.cgi?id=210014 Reviewed by Brian Burg. Previously, the generated InspectorBackendCommands.js would include code for things that the backend doesn't actually support. By using actual macros and preprocessing that file, we can ensure that the frontend doesn't incorrectly think that something is supported by the page being inspected: - the `Canvas` commands and events related to shader programs/pipelines should only exist when the corresponding context type exists, namely `ENABLE(WEBGL)` and `ENABLE(WEBGPU)`. - iOS doesn't support showing rulers, so create a variant of `DOM.setInspectModeEnabled` that only exists for `PLATFORM(IOS_FAMILY)` that doesn't have the `showRulers` optional parameter, as well as removing `Page.setShowRulers` entirely. - setting the forced appearance should only be possible if dark mode is supported. - web archives only exist if CF is used. * inspector/InspectorInstrumentation.h: * inspector/InspectorInstrumentation.cpp: * inspector/agents/InspectorCanvasAgent.h: * inspector/agents/InspectorCanvasAgent.cpp: (WebCore::InspectorCanvasAgent::InspectorCanvasAgent): (WebCore::InspectorCanvasAgent::enable): (WebCore::InspectorCanvasAgent::startRecording): (WebCore::InspectorCanvasAgent::reset): (WebCore::InspectorCanvasAgent::unbindCanvas): * inspector/InspectorShaderProgram.h: * inspector/InspectorShaderProgram.cpp: (WebCore::InspectorShaderProgram::requestShaderSource): (WebCore::InspectorShaderProgram::updateShader): * inspector/agents/InspectorDOMAgent.h: * inspector/agents/InspectorDOMAgent.cpp: (WebCore::InspectorDOMAgent::setInspectModeEnabled): * inspector/agents/InspectorPageAgent.h: * inspector/agents/InspectorPageAgent.cpp: (WebCore::InspectorPageAgent::enable): (WebCore::InspectorPageAgent::disable): (WebCore::InspectorPageAgent::setForcedAppearance): (WebCore::InspectorPageAgent::archive): * Configurations/FeatureDefines.xcconfig: Add `ENABLE_WEB_ARCHIVE` since it's always enabled in wtf/PlatformEnableCocoa.h. * inspector/InspectorFrontendHost.idl: Drive-by: replace the `#if` with the IDL `[Conditional=]`. 2020-05-27 Miguel Gomez <magomez@igalia.com> [WPE] REGRESSION(r253675) Crash when using threaded rendering https://bugs.webkit.org/show_bug.cgi?id=212404 Reviewed by Carlos Garcia Campos. Check whether the GraphicsContext has a PlatformGraphicsContext before trying to paint with it. If there's no PlatformGraphicsContext, paint using the GraphicsContext methods instead. * platform/graphics/cairo/ImageBufferCairoBackend.cpp: (WebCore::ImageBufferCairoBackend::draw): (WebCore::ImageBufferCairoBackend::drawPattern): 2020-05-27 Carlos Garcia Campos <cgarcia@igalia.com> Unreviewed. Fix build warning with GTK4 * platform/gtk/GtkUtilities.cpp: (WebCore::widgetRootCoords): 2020-05-27 David Kilzer <ddkilzer@apple.com> Use OptionSet<DragDestinationAction> for mask values <https://webkit.org/b/212115> <rdar://problem/63423380> Reviewed by Alex Christensen. DragDestinationAction is used as both individual values and as a bit mask. This changes bit mask uses to OptionSet<> and renames variables to denote masks. * page/DragActions.h: (WebCore::DragDestinationAction): - Convert to enum class and remove *None and *Any values. (WebCore::DragDestinationActionAny): - Add helper function to return OptionSet<DragDestinationAction> with all values set. * page/DragController.cpp: (WebCore::DragController::performDragOperation): (WebCore::DragController::dragEnteredOrUpdated): (WebCore::DragController::tryDocumentDrag): (WebCore::DragController::concludeEditDrag): * page/DragController.h: (WebCore::DragController::dragDestinationAction const): Rename. (WebCore::DragController::dragDestinationActionMask const): - Rename dragDestinationAction() to dragDestinationActionMask(). * platform/DragData.cpp: (WebCore::DragData::DragData): * platform/DragData.h: (WebCore::DragData::DragData): - Use DragDestinationActionAny() in place of removed DragDestinationActionAny. (WebCore::DragData::dragDestinationAction const): Rename. (WebCore::DragData::dragDestinationActionMask const): - Rename dragDestinationAction() to dragDestinationActionMask(). (WebCore::DragData::operator =): * platform/cocoa/DragDataCocoa.mm: (WebCore::DragData::DragData): 2020-05-27 Youenn Fablet <youenn@apple.com> Video freezes when attaching a local MediaStream to multiple elements https://bugs.webkit.org/show_bug.cgi?id=194802 <rdar://problem/63613107> Reviewed by Eric Carlson. AVSampleBufferDisplayLayer sometimes does not update the rendering when the same local source is rendered several times. To workaround this, we set kCMSampleAttachmentKey_DisplayImmediately to true, which fixes the issue as per my testing. We clone the sample buffer before setting this property as it might not be thread safe to modify the attachments of a sample that might also be encoded. We implement this at LocalSampleBufferDisplayLayer level and enable this for local capture sources only. Manually tested. * platform/graphics/avfoundation/SampleBufferDisplayLayer.h: (WebCore::SampleBufferDisplayLayer::setRenderPolicy): * platform/graphics/avfoundation/objc/LocalSampleBufferDisplayLayer.h: (WebCore::LocalSampleBufferDisplayLayer::setRenderPolicy): * platform/graphics/avfoundation/objc/LocalSampleBufferDisplayLayer.mm: (WebCore::LocalSampleBufferDisplayLayer::enqueueSample): (WebCore::LocalSampleBufferDisplayLayer::removeOldSamplesFromPendingQueue): * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm: (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::ensureLayers): (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::checkSelectedVideoTrack): * platform/graphics/avfoundation/objc/MediaSampleAVFObjC.h: * platform/graphics/avfoundation/objc/MediaSampleAVFObjC.mm: (WebCore::setSampleBufferAsDisplayImmediately): (WebCore::MediaSampleAVFObjC::setAsDisplayImmediately): (WebCore::MediaSampleAVFObjC::cloneSampleBuffer): 2020-05-19 Sergio Villar Senin <svillar@igalia.com> [WebXR] Implement XRSession::requestAnimationFrame() https://bugs.webkit.org/show_bug.cgi?id=212099 Reviewed by Youenn Fablet. The WebXR spec defines a requestAnimationFrame() mechanism to provide information about XR tracking devices using callbacks. It's pretty similar to the requestAnimationFrame() exposed by Window but only used to update WebXR content. We're adding a basic implementation of this mechanism as long as cancellation support. It requires some platform code that will be added in follow up patches. That platform code will provide information like devices' refresh rates, pose (position & orientation), display resolution, etc... This patch also replaces the type of the callback id from int to unsigned int as per the following change in specs https://github.com/immersive-web/webxr/pull/1062. Apart from that we're adding a missing adoptRef() in the testing code that was causing assertions in some of the tests that are being unskipped as part of this change. * Modules/webxr/WebXRSession.cpp: (WebCore::WebXRSession::WebXRSession): (WebCore::WebXRSession::animationTimerFired): Added. (WebCore::WebXRSession::scheduleAnimation): Ditto. (WebCore::WebXRSession::requestAnimationFrame): Ditto. (WebCore::WebXRSession::cancelAnimationFrame): * Modules/webxr/WebXRSession.h: * Modules/webxr/XRFrameRequestCallback.h: (WebCore::XRFrameRequestCallback::callbackId): (WebCore::XRFrameRequestCallback::setCallbackId): (WebCore::XRFrameRequestCallback::cancel): (WebCore::XRFrameRequestCallback::isCancelled const): * testing/WebFakeXRDevice.cpp: (WebCore::WebFakeXRDevice::simulateInputSourceConnection): * testing/WebFakeXRDevice.h: * testing/WebFakeXRInputController.h: 2020-05-27 Carlos Garcia Campos <cgarcia@igalia.com> [GTK4] Make PointerLock work https://bugs.webkit.org/show_bug.cgi?id=212314 Reviewed by Adrian Perez de Castro. * platform/gtk/GtkUtilities.cpp: (WebCore::widgetDevicePosition): Helper function to avoid #ifdefs due to GTK version differences. * platform/gtk/GtkUtilities.h: 2020-05-27 Peng Liu <peng.liu6@apple.com> VideoFullscreenInterfaceAVKit is leaking when a video element enters and exits fullscreen/picture-in-picture https://bugs.webkit.org/show_bug.cgi?id=212293 Reviewed by Youenn Fablet. WebAVPlayerViewControllerDelegate is created and retained by VideoFullscreenInterfaceAVKit, but it has a RefPtr to VideoFullscreenInterfaceAVKit. This leads to a memory leak when a video element enters and exit fullscreen or Picture-in-Picture. This patch replaces the RefPtr with a WeakPtr to fix the leak. With this patch, we config playerController in VideoFullscreenInterfaceAVKit::setupFullscreen() and VideoFullscreenInterfaceAVKit::cleanupFullscreen(), so that we can avoid relying on VideoFullscreenManagerProxy::setHasVideo() and VideoFullscreenManagerProxy::setVideoDimensions(). Those two functions are driven by IPC messages from the Web process, which may come before VideoFullscreenInterfaceAVKit is constructed or after VideoFullscreenInterfaceAVKit is destroyed. Manually tested. * platform/ios/VideoFullscreenInterfaceAVKit.h: * platform/ios/VideoFullscreenInterfaceAVKit.mm: (-[WebAVPlayerViewControllerDelegate setFullscreenInterface:]): (VideoFullscreenInterfaceAVKit::setupFullscreen): (VideoFullscreenInterfaceAVKit::cleanupFullscreen): 2020-05-27 Carlos Garcia Campos <cgarcia@igalia.com> [GTK][WTR] EventSender: stop using GdkEvent API in preparation for GTK4 https://bugs.webkit.org/show_bug.cgi?id=212298 Reviewed by Adrian Perez de Castro. Add helpers to GtkUtilities to avoid #ifdefs due to GTK version differences. * platform/gtk/GtkUtilities.cpp: (WebCore::widgetRootCoords): (WebCore::widgetKeyvalToKeycode): * platform/gtk/GtkUtilities.h: 2020-05-26 Said Abou-Hallawa <sabouhallawa@apple.com> SMILTimeContainer must protect its m_scheduledAnimations while it does updateAnimations() https://bugs.webkit.org/show_bug.cgi?id=212192 <rdar://problem/56717734> Reviewed by Youenn Fablet. updateAnimations() needs to protect m_scheduledAnimations while processing the scheduled animations. m_scheduledAnimations may be changed from JavaScript callbacks. This will invalidate the HashMap iterators while the one used by the for-loop in updateAnimations() is still in use. To allow copying m_scheduledAnimations, the value of the entry has to be of type AnimationVector instead of std::unique_ptr<AnimationVector>. Test: svg/animations/css-animation-reinsert-target.html * svg/animation/SMILTimeContainer.cpp: (WebCore::SMILTimeContainer::schedule): (WebCore::SMILTimeContainer::unschedule): (WebCore::SMILTimeContainer::processScheduledAnimations): (WebCore::SMILTimeContainer::updateAnimations): * svg/animation/SMILTimeContainer.h: 2020-05-26 Alex Christensen <achristensen@webkit.org> MacApplication::isSafari should allow safari bundle id variants https://bugs.webkit.org/show_bug.cgi?id=212401 Reviewed by Timothy Hatcher. There is a test environment with bundle ID com.apple.Safari.something. This change is blocking rdar://problem/63574451 * platform/cocoa/RuntimeApplicationChecksCocoa.mm: (WebCore::MacApplication::isSafari): 2020-05-26 Simon Fraser <simon.fraser@apple.com> Rendering artifacts when scrolling overlays https://bugs.webkit.org/show_bug.cgi?id=204120 <rdar://problem/57121358> Reviewed by Zalan Bujtas. RenderLayerBacking::setContentsNeedDisplayInRect() needs to adjust repaint rects in the scrolled contents layer by the RenderLayer's scrollOffset, because that's what's used during repaint rect computation. We haven't yet pushed the new scroll offset onto the GraphicsLayer, so m_scrolledContentsLayer->scrollOffset() would be stale here. I tested RTL to make sure that scrollOffset(), and not scrollPosition() is the correct function to tall. Test: compositing/repaint/compositing-toggle-in-overflow-scroll-repaint.html * rendering/RenderLayerBacking.cpp: (WebCore::RenderLayerBacking::setContentsNeedDisplayInRect): 2020-05-26 Said Abou-Hallawa <sabouhallawa@apple.com> An SVG animated property animator can stop animation while other animators are still running https://bugs.webkit.org/show_bug.cgi?id=207417 <rdar://problem/59278306> Reviewed by Simon Fraser. An SVG animated property can be animated by multiple animators. When one animator stops the animation, the animVal should not be deleted since it will be used by other animators. SVGAnimatedProperty will maintain a WeakHashSet<SVGAttributeAnimator> in which the animator will be added when the animation starts and will be removed when the the animation stops. When all the animators stops their animations, the animated property may delete the animVal or keep it if it can be referenced by JavaScript. Tests: svg/animations/animated-enum-mutiple-animators.svg svg/animations/animated-length-mutiple-animators.svg * svg/properties/SVGAnimatedDecoratedProperty.h: * svg/properties/SVGAnimatedPrimitiveProperty.h: * svg/properties/SVGAnimatedProperty.h: (WebCore::SVGAnimatedProperty::isAnimating const): (WebCore::SVGAnimatedProperty::startAnimation): (WebCore::SVGAnimatedProperty::stopAnimation): (WebCore::SVGAnimatedProperty::instanceStartAnimation): (WebCore::SVGAnimatedProperty::instanceStopAnimation): * svg/properties/SVGAnimatedPropertyAnimator.h: * svg/properties/SVGAnimatedPropertyList.h: * svg/properties/SVGAnimatedValueProperty.h: * svg/properties/SVGAttributeAnimator.h: 2020-05-26 Simon Fraser <simon.fraser@apple.com> REGRESSION (async oveflow): scrubber missing from inline video inside overflow scroll https://bugs.webkit.org/show_bug.cgi?id=212391 <rdar://problem/63089859> Reviewed by Zalan Bujtas. backgroundClipRect() is in the coordinate space of the ClipRectContext's rootLayer, not the receiver, so when converting to absolute coordinates we must use the ClipRectContext's rootLayer. Test: compositing/layer-creation/overlap-in-scroller.html * rendering/RenderLayerCompositor.cpp: (WebCore::RenderLayerCompositor::addToOverlapMap const): 2020-05-26 Jer Noble <jer.noble@apple.com> Can't scrub video on https://www.judiciary.senate.gov https://bugs.webkit.org/show_bug.cgi?id=212270 <rdar://problem/57922919> Reviewed by Eric Carlson. Test: media/video-duration-seekable.html www.judiciary.senate.gov uses the Akamai Media Player, which doesn't query HTMLMediaElement.duration directly. Rather, when it receives a "durationchange" event, it calculates the duration by using the HTMLMediaElement.seekable ranges to determine the effective media duration. But no event is fired when the seekable ranges change, and when they first query HTMLMediaElement.seekable, AVFoundation hasn't yet updated seekable ranges, so we report an empty set of seekable ranges. The HTML specification suggests that UAs "should adopt a very liberal and optimistic view of what is seekable." With that advice in mind, when we are asked by the page for our seekable ranges, and we do not yet have the official ranges from AVPlayerItem, lets just respond with [0, duration). * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm: (WebCore::MediaPlayerPrivateAVFoundationObjC::platformMaxTimeSeekable const): 2020-05-25 Darin Adler <darin@apple.com> Eliminate Color constructors that take strings, moving color parsing entirely into the CSS parser https://bugs.webkit.org/show_bug.cgi?id=212296 Reviewed by Sam Weinig. * css/parser/CSSParser.cpp: (WebCore::CSSParser::parseColor): Moved more of the logic into CSSParserFastPaths::parseSimpleColor. Also added a FIXME about what seems to be a mistake about strict mode. (WebCore::CSSParser::parseColorWorkerSafe): Ditto. (WebCore::CSSParser::parseSystemColor): Removed unused context argument. (WebCore::CSSParser::parseNamedColor): Added. (WebCore::CSSParser::parseHexColor): Added. (WebCore::CSSParser::parseSingleValue): Use auto. (WebCore::CSSParser::parseValue): Ditto. * css/parser/CSSParser.h: Exported parseColor. Removed unused value pool and strict arguments from parseColorWorkerSafe. Removed unused context argument from parseSystemColor. Added parseNamedColor and parseHexColor. * css/parser/CSSParserFastPaths.cpp: (WebCore::parseSimpleLengthValue): Take a StringView. (WebCore::finishParsingHexColor): Added, logic moved from Color constructor. (WebCore::parseHexColorInternal): Ditto. (WebCore::parseNumericColor): Added, logic moved from fastParseColorInternal. (WebCore::parseColor): Turned into a non-member function since it's private to this file. Use auto a bit more, and removed unneeded value pool argument. (WebCore::finishParsingNamedColor): Added, logic moved from Color constructor. (WebCore::parseNamedColorInternal): Ditto. (WebCore::parseSimpleColorInternal): Ditto. (WebCore::CSSParserFastPaths::parseSimpleColor): Ditto. (WebCore::CSSParserFastPaths::parseHexColor): Ditto. (WebCore::CSSParserFastPaths::parseNamedColor): Ditto. (WebCore::isUniversalKeyword): Take a StringView. (WebCore::parseKeywordValue): Ditto. (WebCore::parseSimpleTransform): Ditto. (WebCore::parseCaretColor): Ditto. Also take a parser context rather than a parser mode. (WebCore::CSSParserFastPaths::maybeParseValue): Take a StringView. * css/parser/CSSParserFastPaths.h: Cut down includes. Use StringView. Added parseSimpleColor, parseHexColor, and parseNamedColor. * css/parser/CSSPropertyParserHelpers.cpp: (WebCore::CSSPropertyParserHelpers::parseHexColor): Return an Optional<SimpleColor> instead of a Color. (WebCore::CSSPropertyParserHelpers::consumeColor): Refactor a bit for clarity. * html/HTMLElement.cpp: (WebCore::parseLegacyColorValue): Renamed from parseColorStringWithCrazyLegacyRules and refactored a bit. Made this match the HTML specification more closely. (WebCore::HTMLElement::addHTMLColorToStyle): Simplify now that more of the logic was moved into parseLegacyColorValue. * html/canvas/CanvasStyle.cpp: (WebCore::parseColor): Removed unneeded arguments for parseColorWorkerSafe and for parseSystemColor. * platform/graphics/Color.cpp: (WebCore::findNamedColor): Deleted. (WebCore::Color::Color): Deleted overloadds that take strings. * platform/graphics/Color.h: Updated for the above. * platform/graphics/SimpleColor.cpp: (WebCore::parseHexColorInternal): Deleted. (WebCore::SimpleColor::parseHexColor): Deleted. * platform/graphics/SimpleColor.h: Removed parseHexColor functions. 2020-05-26 Antoine Quint <graouts@apple.com> Hardware fill-forwards animation and transitions don't interact correctly https://bugs.webkit.org/show_bug.cgi?id=187839 <rdar://problem/42410412> Reviewed by Simon Fraser. Test: webanimations/updating-property-targeted-by-css-transition-during-css-animation.html We didn't follow the CSS Transitions spec closely enough when it came to defining the correct before and after change styles during a style change event. We now correctly set the before-change style as one of three possible values: 1. if there are running CSS-originated animations, we ensure those are updated to the current time and resolve them to get the style, 2. otherwise we use the RenderStyle recorded in Style::TreeResolver::createAnimatedElementUpdate() prior to applying animations during the last style change event, 3. otherwise we use the previous computed style, which should not have any animated values. As for the after-change style, we also need to ensure any running CSS Animations are update to the current time and resolve them to get the style. Otherwise, we just use the current computed style prior to applying animations. Finally, we can exit from AnimationTimeline::updateCSSTransitionsForElementAndProperty() early if we find that we have a JS-originated animation running for the given property on the given element since we know that that animation will yield an overriding value for both the before and after change styles since JS-originated animations have the hightest composite order. This means we no longer need to track the unanimated style on KeyframeEffect. * animation/AnimationTimeline.cpp: (WebCore::AnimationTimeline::updateCSSAnimationsForElement): (WebCore::AnimationTimeline::updateCSSTransitionsForElementAndProperty): (WebCore::AnimationTimeline::updateCSSTransitionsForElement): * animation/AnimationTimeline.h: * animation/ElementAnimationRareData.h: (WebCore::ElementAnimationRareData::lastStyleChangeEventStyle const): (WebCore::ElementAnimationRareData::setLastStyleChangeEventStyle): * animation/KeyframeEffect.cpp: (WebCore::KeyframeEffect::clearBlendingKeyframes): (WebCore::KeyframeEffect::apply): (WebCore::KeyframeEffect::applyPendingAcceleratedActions): * animation/KeyframeEffect.h: (WebCore::KeyframeEffect::unanimatedStyle const): Deleted. * dom/Element.cpp: (WebCore::Element::lastStyleChangeEventStyle const): (WebCore::Element::setLastStyleChangeEventStyle): * dom/Element.h: * style/StyleTreeResolver.cpp: (WebCore::Style::TreeResolver::createAnimatedElementUpdate): 2020-05-26 Sam Weinig <weinig@apple.com> Extended Color Cleanup: Remove red()/green()/blue() accessors from ExtendedColor in preperation for supporting non-RGB based ColorSpaces https://bugs.webkit.org/show_bug.cgi?id=212366 Reviewed by Simon Fraser. * platform/graphics/Color.cpp: (WebCore::differenceSquared): Switch to using toSRGBASimpleColorLossy() rather than poking at the ExtendedColor components directly. The old code was already incorrect if the two colors had differing color spaces so this at least now gives reasonable results. (WebCore::Color::colorWithAlpha const): (WebCore::Color::colorWithAlphaUsingAlternativeRounding const): Delegate to ExtendedColor completely for colorWithAlpha() to allow for more control over how the components might be stored in the future. * platform/graphics/Color.h: (WebCore::Color::isBlackColor): (WebCore::Color::isWhiteColor): Delegate to ExtendedColor for isBlack()/isWhite() to allow per-color space interpretations of the predicate. (WebCore::Color::encode const): (WebCore::Color::decode): Use c1, c2, c3 rather than red/green/blue. This should be acceptable for the forseeable future, as all expected colorspaces only have 3 channels, but at some point, it may make sense to delegate coding to ExtendedColor completely. * platform/graphics/ExtendedColor.cpp: * platform/graphics/ExtendedColor.h: (WebCore::ExtendedColor::channels const): (WebCore::ExtendedColor::red const): Deleted. (WebCore::ExtendedColor::green const): Deleted. (WebCore::ExtendedColor::blue const): Deleted. (WebCore::ExtendedColor::colorWithAlpha const): Added. (WebCore::ExtendedColor::isWhite const): Added. (WebCore::ExtendedColor::isBlack const): Added. Use channels() with structured bindings rather than the red()/green()/blue() accessors everywhere. 2020-05-26 Peng Liu <peng.liu6@apple.com> ASSERTION FAILED: m_clientCounts.contains(contextId) - WebKit::VideoFullscreenManagerProxy::removeClientForContext() https://bugs.webkit.org/show_bug.cgi?id=212308 Reviewed by Jer Noble. Call m_videoFullscreenModel->didExitPictureInPicture() after the video player completes the process to exit Picture-in-Picture. Covered by existing tests. * platform/ios/VideoFullscreenInterfaceAVKit.mm: (VideoFullscreenInterfaceAVKit::cleanupFullscreen): (VideoFullscreenInterfaceAVKit::didStopPictureInPicture): 2020-05-26 Zalan Bujtas <zalan@apple.com> [LFC][TFC] Use padding to space out sections https://bugs.webkit.org/show_bug.cgi?id=212377 Reviewed by Antti Koivisto. Use fake padding before/after to space out sections. Test: fast/layoutformattingcontext/table-simple-multiple-sections-with-border-spacing-and-collapse.html * layout/tableformatting/TableFormattingContext.cpp: (WebCore::Layout::TableFormattingContext::setUsedGeometryForSections): 2020-05-26 Keith Rollin <krollin@apple.com> Enable the use of XCBuild by default in Apple builds https://bugs.webkit.org/show_bug.cgi?id=209890 <rdar://problem/44182078> Reviewed by Darin Adler. Switch from the "legacy" Xcode build system to the "new" build system (also known as "XCBuild"). Switching to the new system speeds up builds by a small percentage, better validates projects for build-related issues (such as dependency cycles), lets WebKit benefit from future improvements in XCBuild such as those coming from the underlying llbuild open source project, and prepares us for any other tools built for this new ecosystem. Specific changes: - Remove Xcode project and workspace settings that selected the Build system, allowing the default to take hold (which is currently the New build system). - Updated webkitdirs.pm with a terser check for Xcode version. - Update build-webkit and Makefile.shared to be explicit when using the old build system (no longer treat it as a default or fall-back configuration). - Update various xcconfig files similarly to treat the default as using the new build system. - Update various post-processing build steps to check for Xcode 11.4 and to no longer treat the default as using the old build system. No new tests -- no changed functionality. * WebCore.xcodeproj/project.pbxproj: 2020-05-26 Zalan Bujtas <zalan@apple.com> [LFC][TFC] Add support for multiple sections https://bugs.webkit.org/show_bug.cgi?id=212354 Reviewed by Antti Koivisto. Let's keep the grid about rows and columns and about distributing available space. Use the layout tree to find sections. Test: fast/layoutformattingcontext/table-simple-multiple-sections.html * layout/blockformatting/tablewrapper/TableWrapperBlockFormattingContext.cpp: (WebCore::Layout::TableWrapperBlockFormattingContext::computeBorderAndPaddingForTableBox): * layout/tableformatting/TableFormattingContext.cpp: (WebCore::Layout::TableFormattingContext::setUsedGeometryForCells): (WebCore::Layout::TableFormattingContext::setUsedGeometryForRows): (WebCore::Layout::TableFormattingContext::setUsedGeometryForSections): * layout/tableformatting/TableGrid.cpp: (WebCore::Layout::TableGrid::appendCell): (WebCore::Layout::TableGrid::Section::Section): Deleted. * layout/tableformatting/TableGrid.h: (WebCore::Layout::TableGrid::Section::box const): Deleted. (WebCore::Layout::TableGrid::sections const): Deleted. (WebCore::Layout::TableGrid::sections): Deleted. 2020-05-26 Carlos Garcia Campos <cgarcia@igalia.com> [GTK4] Use screen font options as default https://bugs.webkit.org/show_bug.cgi?id=212332 Reviewed by Adrian Perez de Castro. There's no gdk_screen_get_font_options() in GTK4, so we need to get the individual properties from the settings and build a cairo_font_options_t. We can just do the same in GTK3 to avoid ifdefs. Add a helper SystemFontOptions singleton class to monitor and parse the font settings. * platform/graphics/gtk/GdkCairoUtilities.cpp: (WebCore::SystemFontOptions::singleton): (WebCore::SystemFontOptions::SystemFontOptions): (WebCore::SystemFontOptions::fontOptions const): (WebCore::SystemFontOptions::updateFontOptions): (WebCore::getDefaultCairoFontOptions): 2020-05-25 Simon Fraser <simon.fraser@apple.com> Use an Optional<> for LayerFragment::boundingBox https://bugs.webkit.org/show_bug.cgi?id=212358 Reviewed by Zalan Bujtas. Replace a bool + LayoutRect with Optional<LayoutRect>. * rendering/LayerFragment.h: (WebCore::LayerFragment::setRects): (WebCore::LayerFragment::moveBy): (WebCore::LayerFragment::intersect): * rendering/RenderLayer.cpp: (WebCore::RenderLayer::collectFragments): (WebCore::RenderLayer::updatePaintingInfoForFragments): (WebCore::RenderLayer::calculateClipRects const): * rendering/RenderLayer.h: 2020-05-25 Simon Fraser <simon.fraser@apple.com> Make isTableRow() an inline function https://bugs.webkit.org/show_bug.cgi?id=212360 Reviewed by Darin Adler. isTableCell() is a virtual function that's called in some hot code paths, like RenderLayer::localBoundingBox(), so make it inline by using a spare bit on RenderObject. * rendering/RenderObject.h: (WebCore::RenderObject::isTableCaption const): (WebCore::RenderObject::isTableRow const): (WebCore::RenderObject::setIsTableRow): (WebCore::RenderObject::RenderObjectBitfields::RenderObjectBitfields): * rendering/RenderTableRow.cpp: (WebCore::RenderTableRow::RenderTableRow): * rendering/RenderTableRow.h: 2020-05-25 Alex Christensen <achristensen@webkit.org> Expose more network metrics to WebCoreNSURLSession https://bugs.webkit.org/show_bug.cgi?id=212359 <rdar://problem/62909440> Reviewed by Darin Adler. * platform/network/NetworkLoadMetrics.h: (WebCore::NetworkLoadMetrics::isolatedCopy const): (WebCore::NetworkLoadMetrics::operator== const): (WebCore::NetworkLoadMetrics::encode const): (WebCore::NetworkLoadMetrics::decode): * platform/network/cocoa/WebCoreNSURLSession.mm: (-[WebCoreNSURLSessionTaskTransactionMetrics networkProtocolName]): (-[WebCoreNSURLSessionTaskTransactionMetrics isReusedConnection]): (-[WebCoreNSURLSessionTaskTransactionMetrics cellular]): (-[WebCoreNSURLSessionTaskTransactionMetrics expensive]): (-[WebCoreNSURLSessionTaskTransactionMetrics constrained]): (-[WebCoreNSURLSessionTaskTransactionMetrics multipath]): 2020-05-25 Oriol Brufau <obrufau@igalia.com> [css-grid] Prevent grid-template-rows from serializing adjacent <line-names> https://bugs.webkit.org/show_bug.cgi?id=212345 Reviewed by Manuel Rego Casasnovas. The parser for the grid-template shorthand has this code: // Persists between loop iterations so we can use the same value for // consecutive <line-names> values RefPtr<CSSGridLineNamesValue> lineNames; However, this wasn't working because of a lineNames.releaseNonNull() at the end of the loop. So each iteration started with a null lineNames, and consecutive <line-names> values were not merged together. Tests: fast/css-grid-layout/grid-template-shorthand-get-set.html imported/w3c/web-platform-tests/css/css-grid/parsing/grid-shorthand.html imported/w3c/web-platform-tests/css/css-grid/parsing/grid-shorthand-valid.html imported/w3c/web-platform-tests/css/css-grid/parsing/grid-template-shorthand.html imported/w3c/web-platform-tests/css/css-grid/parsing/grid-template-shorthand-valid.html * css/parser/CSSPropertyParser.cpp: (WebCore::CSSPropertyParser::consumeGridTemplateRowsAndAreasAndColumns): 2020-05-25 Sam Weinig <weinig@apple.com> Extended Color Cleanup: Assert !isExtended() in Color::asSimpleColor()...finally https://bugs.webkit.org/show_bug.cgi?id=212357 Reviewed by Simon Fraser. Reap the reward of the cleanup, and add the ASSERT(!isExtended()) to Color::asSimpleColor() as was the original goal of this effort. Only tree non-checked places remained and were trivial to add isExtended() checks for. * platform/graphics/Color.cpp: (WebCore::Color::nameForRenderTreeAsText const): Use ExtenedColor::cssText() for the RenderTree representation. It is stable and as good as any, no need to re-invent the wheel here. (WebCore::Color::light const): (WebCore::Color::dark const): Add isExtended() checks before doing white/black checks, * platform/graphics/Color.h: (WebCore::Color::asSimpleColor const): Add ASSERT. 2020-05-24 Sam Weinig <weinig@apple.com> Extended Color Cleanup: Use the name SimpleColor consistently https://bugs.webkit.org/show_bug.cgi?id=212337 Reviewed by Anders Carlsson. - Removes RGBA32 type alias, updating all remaining users of it. - Renames functions that take/return SimpleColor to use the name SimpleColor rather than RGB (e.g. makeRGBA -> makeSimpleColor) - Moves hex color parsing from Color to SimpleColor, as that is the type it returns. Also took the opportunity to make it return an Optional<SimpleColor> instead of using a bool/out parameter. - Move Color::compositionFill to editing/CompositionHighlight.h It makes no real sense to keep it in Color.h - Replaces rgb() function in Color with asSimpleColor() for symmetry with asExtended(). - Replaced std::max(a, std::min(value, b)) with std::clamp(value, a, b) for clarity. * css/parser/CSSParserFastPaths.cpp: (WebCore::fastParseColorInternal): (WebCore::CSSParserFastPaths::parseColor): * css/parser/CSSPropertyParserHelpers.cpp: (WebCore::CSSPropertyParserHelpers::parseRGBParameters): (WebCore::CSSPropertyParserHelpers::parseHSLParameters): (WebCore::CSSPropertyParserHelpers::parseHexColor): * editing/CompositionHighlight.h: * editing/cocoa/DataDetection.mm: (WebCore::DataDetection::detectContentInRange): * html/ColorInputType.cpp: (WebCore::parseSimpleColorValue): * html/HTMLElement.cpp: (WebCore::parseColorStringWithCrazyLegacyRules): * platform/adwaita/ScrollbarThemeAdwaita.cpp: * platform/adwaita/ThemeAdwaita.cpp: (WebCore::ThemeAdwaita::activeSelectionForegroundColor const): (WebCore::ThemeAdwaita::activeSelectionBackgroundColor const): (WebCore::ThemeAdwaita::inactiveSelectionForegroundColor const): * platform/graphics/Color.cpp: (WebCore::differenceSquared): (WebCore::Color::Color): (WebCore::Color::operator=): (WebCore::Color::serialized const): (WebCore::Color::cssText const): (WebCore::Color::nameForRenderTreeAsText const): (WebCore::Color::light const): (WebCore::Color::dark const): (WebCore::Color::blend const): (WebCore::Color::blendWithWhite const): (WebCore::Color::colorWithAlpha const): (WebCore::Color::colorWithAlphaUsingAlternativeRounding const): (WebCore::Color::invertedColorWithAlpha const): (WebCore::Color::colorSpaceAndComponents const): (WebCore::Color::toSRGBASimpleColorLossy const): (WebCore::blend): (WebCore::Color::tagAsValid): (WebCore::parseHexColorInternal): Deleted. (WebCore::Color::parseHexColor): Deleted. (WebCore::Color::asExtended const): Deleted. * platform/graphics/Color.h: (WebCore::Color::Color): (WebCore::Color::isHashTableDeletedValue const): (WebCore::Color::isValid const): (WebCore::Color::isOpaque const): (WebCore::Color::isVisible const): (WebCore::Color::alpha const): (WebCore::Color::alphaAsFloat const): (WebCore::Color::isSemantic const): (WebCore::Color::isExtended const): (WebCore::Color::setIsSemantic): (WebCore::operator==): (WebCore::equalIgnoringSemanticColor): (WebCore::Color::hash const): (WebCore::Color::asExtended const): (WebCore::Color::asSimpleColor const): (WebCore::Color::setSimpleColor): (WebCore::Color::isBlackColor): (WebCore::Color::isWhiteColor): (WebCore::Color::encode const): (WebCore::Color::decode): (WebCore::Color::setRGB): Deleted. (WebCore::Color::rgb const): Deleted. * platform/graphics/ColorUtilities.h: (WebCore::clampedColorComponent): * platform/graphics/ImageBackingStore.h: (WebCore::ImageBackingStore::blendPixel): (WebCore::ImageBackingStore::pixelValue const): * platform/graphics/SimpleColor.cpp: (WebCore::makePremultipliedSimpleColor): (WebCore::makeUnpremultipliedSimpleColor): (WebCore::makeSimpleColorFromFloats): (WebCore::makeSimpleColorFromHSLA): (WebCore::makeSimpleColorFromCMYKA): (WebCore::parseHexColorInternal): (WebCore::SimpleColor::parseHexColor): (WebCore::makePremultipliedRGBA): Deleted. (WebCore::makeUnPremultipliedRGBA): Deleted. (WebCore::makeRGBA32FromFloats): Deleted. (WebCore::makeRGBAFromHSLA): Deleted. (WebCore::makeRGBAFromCMYKA): Deleted. * platform/graphics/SimpleColor.h: (WebCore::roundAndClampColorChannel): (WebCore::colorFloatToSimpleColorByte): (WebCore::makeSimpleColor): (WebCore::colorFloatToRGBAByte): Deleted. (WebCore::makeRGB): Deleted. (WebCore::makeRGBA): Deleted. * platform/graphics/avfoundation/InbandTextTrackPrivateAVF.cpp: (WebCore::makeSimpleColorFromARGBCFArray): (WebCore::InbandTextTrackPrivateAVF::processCueAttributes): (WebCore::makeRGBA32FromARGBCFArray): Deleted. * platform/graphics/cairo/ImageBufferCairoImageSurfaceBackend.cpp: (WebCore::ImageBufferCairoImageSurfaceBackend::platformTransformColorSpace): * platform/graphics/cairo/NativeImageCairo.cpp: (WebCore::nativeImageSinglePixelSolidColor): * platform/graphics/cg/ColorCG.cpp: (WebCore::makeSimpleColorFromCGColor): (WebCore::Color::Color): (WebCore::cachedCGColor): (WebCore::makeRGBAFromCGColor): Deleted. * platform/graphics/gtk/ColorGtk.cpp: (WebCore::Color::Color): * platform/graphics/mac/ColorMac.mm: (WebCore::makeSimpleColorFromNSColor): (WebCore::colorFromNSColor): (WebCore::semanticColorFromNSColor): (WebCore::makeRGBAFromNSColor): Deleted. * platform/graphics/win/ColorDirect2D.cpp: (WebCore::Color::Color): * platform/graphics/win/GraphicsContextCGWin.cpp: (WebCore::GraphicsContext::drawDotsForDocumentMarker): * platform/graphics/win/PlatformContextDirect2D.cpp: (WebCore::PlatformContextDirect2D::brushWithColor): * platform/ios/ColorIOS.mm: (WebCore::colorFromUIColor): * rendering/InlineTextBox.cpp: (WebCore::InlineTextBox::paintCompositionBackground): * rendering/RenderLayer.cpp: (WebCore::RenderLayer::paintResizer): * rendering/RenderLayerBacking.cpp: (WebCore::patternForTouchAction): (WebCore::patternForEventListenerRegionType): * rendering/RenderThemeAdwaita.cpp: * rendering/RenderThemeMac.mm: (WebCore::menuBackgroundColor): 2020-05-25 Zalan Bujtas <zalan@apple.com> [Subpixel layout] Bad scrolling on mercurynews.com article https://bugs.webkit.org/show_bug.cgi?id=201038 <rdar://problem/28489812> Reviewed by Dean Jackson. The scrolling is caused by the mismatching subpixel handling between block and inline content. Inline content (and in this particular case ascent/descent handling) is still integral based while block content supports fractional pixel values. When the (inline)line height relies on the (block)inline-block height, we need to make sure that the computed line height encloses the inline-block. This patch changes the rounding behavior of computed the line height from floor to round. Test: fast/inline/hidpi-inline-block-is-subpixel-while-line-is-not.html * rendering/RenderBox.cpp: (WebCore::RenderBox::baselinePosition const): * rendering/RootInlineBox.cpp: (WebCore::RootInlineBox::ascentAndDescentForBox const): 2020-05-25 Rob Buis <rbuis@igalia.com> Use child text content when determining whether to bail early in running a script https://bugs.webkit.org/show_bug.cgi?id=182695 Reviewed by Youenn Fablet. Check that the text content is not empty instead of just checking for the first child [1]. Behavior matches Chrome and Firefox. [1] https://html.spec.whatwg.org/#prepare-a-script step 5 and 6 Test: web-platform-tests/html/semantics/scripting-1/the-script-element/emptyish-script-elements.html * dom/ScriptElement.cpp: (WebCore::ScriptElement::prepareScript): 2020-05-22 Sergio Villar Senin <svillar@igalia.com> [css-flex] Allow indefinite size flex items to be definite wrt resolving percentages inside them https://bugs.webkit.org/show_bug.cgi?id=212264 Reviewed by Manuel Rego Casasnovas. Implement https://github.com/w3c/csswg-drafts/commit/5b5db39d21f3658ae2f4d7992daaf822aca178d8 which modified the way percentages were resolved in flexible items with indefinite sizes. From now on we can pretend that they're really definite. This allows us to mark 3 tests which were testing percentages in flex items as correct. Based on Blink's crrev.com/1247184 by <cbiesinger@chromium.org> * rendering/RenderFlexibleBox.cpp: (WebCore::RenderFlexibleBox::mainSizeForPercentageResolution): Do only check flex container main size definiteness when computing the main size for percentage resolution, no need to check flex basis at all. 2020-05-25 Youenn Fablet <youenn@apple.com> AVVideoCaptureSource should notify of video samples in a background thread https://bugs.webkit.org/show_bug.cgi?id=212072 Reviewed by Eric Carlson. Do not hop to the main thread to send samples. Instead, directly call the observer callback. Manually tested. * platform/mediastream/mac/AVVideoCaptureSource.h: * platform/mediastream/mac/AVVideoCaptureSource.mm: (WebCore::AVVideoCaptureSource::captureOutputDidOutputSampleBufferFromConnection): 2020-05-25 Adrian Perez de Castro <aperez@igalia.com> Non-unified build fixes, late May 2020 edition https://bugs.webkit.org/show_bug.cgi?id=212342 Unreviewed build fix. No new tests needed. * loader/ImageLoader.h: Add missing inclusion of Element.h and remove forward declaration. * page/PageConfiguration.h: Add missing inclusion of ShouldRelaxThirdPartyCookieBlocking.h 2020-05-25 Youenn Fablet <youenn@apple.com> MediaPlayerPrivateMediaStreamAVFObjC::m_activeVideoTrack should be a VideoTrackPrivateMediaStream https://bugs.webkit.org/show_bug.cgi?id=212129 Reviewed by Eric Carlson. Instead of looking in the map when wanting to get the VideoTrackPrivateMediaStream corresponding to the active video track, store directly the VideoTrackPrivateMediaStream as the active video track and use streamTrack() to get the corresponding MediaStreamTrack. Small refactoring to use more Ref<>. Covered by existing tests. * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.h: * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm: (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::~MediaPlayerPrivateMediaStreamAVFObjC): (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::videoSampleAvailable): (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::sampleBufferDisplayLayerStatusDidChange): (WebCore::updateTracksOfType): (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::checkSelectedVideoTrack): * platform/mediastream/AudioTrackPrivateMediaStream.h: * platform/mediastream/VideoTrackPrivateMediaStream.h: 2020-05-24 Youenn Fablet <youenn@apple.com> Do not allocate a WebAudioBufferList in the AudioContext rendering thread https://bugs.webkit.org/show_bug.cgi?id=212132 Reviewed by Eric Carlson. Instead of allocating the buffer in the rendering thread, we do that in the audio sample producer thread. Also, we do it only once versus one for each rendering call previously. Covered by existing tests. * platform/mediastream/mac/WebAudioSourceProviderAVFObjC.h: * platform/mediastream/mac/WebAudioSourceProviderAVFObjC.mm: (WebCore::WebAudioSourceProviderAVFObjC::provideInput): (WebCore::WebAudioSourceProviderAVFObjC::prepare): (WebCore::WebAudioSourceProviderAVFObjC::unprepare): 2020-05-24 Wenson Hsieh <wenson_hsieh@apple.com> Add some missing includes due to unified sources https://bugs.webkit.org/show_bug.cgi?id=212306 Reviewed by Anders Carlsson. * Modules/pictureinpicture/HTMLVideoElementPictureInPicture.cpp: Include EnterPictureInPictureEvent.h. * platform/PictureInPictureObserver.h: Include WeakPtr and forward declare the IntSize class. 2020-05-24 Sam Weinig <weinig@apple.com> Extended Color Cleanup: Move SimpleColor into its own files https://bugs.webkit.org/show_bug.cgi?id=212309 Reviewed by Simon Fraser. Move SimpleColor into its own files. It's about time. * Headers.cmake: * Sources.txt: * WebCore.xcodeproj/project.pbxproj: * platform/graphics/Color.cpp: (WebCore::premultipliedChannel): Deleted. (WebCore::unpremultipliedChannel): Deleted. (WebCore::makePremultipliedRGBA): Deleted. (WebCore::makeUnPremultipliedRGBA): Deleted. (WebCore::colorFloatToRGBAByte): Deleted. (WebCore::makeRGBA32FromFloats): Deleted. (WebCore::makeRGBAFromHSLA): Deleted. (WebCore::makeRGBAFromCMYKA): Deleted. (WebCore::SimpleColor::serializationForHTML const): Deleted. (WebCore::decimalDigit): Deleted. (WebCore::fractionDigitsForFractionalAlphaValue): Deleted. (WebCore::SimpleColor::serializationForCSS const): Deleted. (WebCore::RGBA32::serializationForRenderTreeAsText const): Deleted. * platform/graphics/Color.h: (WebCore::SimpleColor::SimpleColor): Deleted. (WebCore::SimpleColor::value const): Deleted. (WebCore::SimpleColor::redComponent const): Deleted. (WebCore::SimpleColor::greenComponent const): Deleted. (WebCore::SimpleColor::blueComponent const): Deleted. (WebCore::SimpleColor::alphaComponent const): Deleted. (WebCore::SimpleColor::alphaComponentAsFloat const): Deleted. (WebCore::SimpleColor::isOpaque const): Deleted. (WebCore::SimpleColor::isVisible const): Deleted. (WebCore::SimpleColor::colorWithAlpha const): Deleted. (WebCore::SimpleColor::get const): Deleted. (WebCore::roundAndClampColorChannel): Deleted. (WebCore::fastMultiplyBy255): Deleted. (WebCore::fastDivideBy255): Deleted. (WebCore::makeRGB): Deleted. (WebCore::makeRGBA): Deleted. * platform/graphics/SimpleColor.cpp: Copied from platform/graphics/Color.cpp. (WebCore::SimpleColor::serializationForRenderTreeAsText const): (): Deleted. (WebCore::colorFloatToRGBAByte): Deleted. (WebCore::parseHexColorInternal): Deleted. (WebCore::Color::parseHexColor): Deleted. (WebCore::differenceSquared): Deleted. (WebCore::findNamedColor): Deleted. (WebCore::Color::Color): Deleted. (WebCore::Color::operator=): Deleted. (WebCore::Color::serialized const): Deleted. (WebCore::Color::cssText const): Deleted. (WebCore::RGBA32::serializationForRenderTreeAsText const): Deleted. (WebCore::Color::nameForRenderTreeAsText const): Deleted. (WebCore::Color::light const): Deleted. (WebCore::Color::dark const): Deleted. (WebCore::Color::isDark const): Deleted. (WebCore::Color::lightness const): Deleted. (WebCore::blendComponent): Deleted. (WebCore::Color::blend const): Deleted. (WebCore::Color::blendWithWhite const): Deleted. (WebCore::Color::colorWithAlphaMultipliedBy const): Deleted. (WebCore::Color::colorWithAlphaMultipliedByUsingAlternativeRounding const): Deleted. (WebCore::Color::colorWithAlpha const): Deleted. (WebCore::Color::colorWithAlphaUsingAlternativeRounding const): Deleted. (WebCore::Color::colorSpaceAndComponents const): Deleted. (WebCore::Color::toSRGBASimpleColorLossy const): Deleted. (WebCore::Color::toSRGBAComponentsLossy const): Deleted. (WebCore::extendedColorsEqual): Deleted. (WebCore::blend): Deleted. (WebCore::blendWithoutPremultiply): Deleted. (WebCore::Color::tagAsValid): Deleted. (WebCore::Color::asExtended const): Deleted. (WebCore::operator<<): Deleted. * platform/graphics/SimpleColor.h: Copied from platform/graphics/Color.h. (WebCore::SimpleColor::alphaComponentAsFloat const): (WebCore::SimpleColor::colorWithAlpha const): (WebCore::SimpleColor::get const): (WebCore::colorFloatToRGBAByte): (WebCore::Color::Color): Deleted. (WebCore::Color::isHashTableDeletedValue const): Deleted. (WebCore::Color::~Color): Deleted. (WebCore::Color::isValid const): Deleted. (WebCore::Color::isOpaque const): Deleted. (WebCore::Color::isVisible const): Deleted. (WebCore::Color::red const): Deleted. (WebCore::Color::green const): Deleted. (WebCore::Color::blue const): Deleted. (WebCore::Color::alpha const): Deleted. (WebCore::Color::alphaAsFloat const): Deleted. (WebCore::Color::opaqueColor const): Deleted. (WebCore::Color::isSemantic const): Deleted. (WebCore::Color::isExtended const): Deleted. (WebCore::Color::setRGB): Deleted. (WebCore::Color::setIsSemantic): Deleted. (WebCore::equalIgnoringSemanticColor): Deleted. (WebCore::Color::hash const): Deleted. (WebCore::Color::colorWithAlphaMultipliedByUsingAlternativeRounding const): Deleted. (WebCore::Color::colorWithAlphaUsingAlternativeRounding const): Deleted. (WebCore::Color::rgb const): Deleted. (WebCore::Color::isBlackColor): Deleted. (WebCore::Color::isWhiteColor): Deleted. (WebCore::Color::encode const): Deleted. (WebCore::Color::decode): Deleted. 2020-05-24 Zalan Bujtas <zalan@apple.com> [LFC][TFC] Ignore section borders even when border collapse is off. https://bugs.webkit.org/show_bug.cgi?id=212336 Reviewed by Antti Koivisto. Test: fast/layoutformattingcontext/table-simple-thead-border-ignore.html * layout/Verification.cpp: (WebCore::Layout::outputMismatchingBlockBoxInformationIfNeeded): * layout/tableformatting/TableFormattingContext.cpp: (WebCore::Layout::TableFormattingContext::setUsedGeometryForSections): 2020-05-24 Sam Weinig <weinig@apple.com> Extended Color Cleanup: Stop allowing direct access to the underlying SimpleColor (it is almost always incorrect with respect to extended colors) https://bugs.webkit.org/show_bug.cgi?id=212184 Reviewed by Dean Jackson. - Makes Color::rgb() private, removing a class of extended color bugs from users of the Color class. To get the equivilent functionality, users of the class must now use toSRGBASimpleColorLossy() which does actually does the conversion to sRGB if necessary and makes it clear to the caller that precision is being lost. - Removes Color::red()/green()/blue() entirely. They were just calling down to Color::rgb(), and going forward, it won't make sense to think about rgb components of Colors in general, since some extended color spaces don't deal in them (e.g. Lab) Color::alpha() was kept (and fixed to work even with ExtendedColor) since all ExtendedColors do need to have alpha. * accessibility/AccessibilityNodeObject.cpp: (WebCore::AccessibilityNodeObject::colorValue const): Use toSRGBASimpleColorLossy() to get access to color components. * accessibility/atk/WebKitAccessibleInterfaceText.cpp: (getAttributeSetForAccessibilityObject): Use toSRGBASimpleColorLossy() to get access to color components. * accessibility/isolatedtree/AXIsolatedObject.cpp: (WebCore::AXIsolatedObject::colorValue const): Use toSRGBASimpleColorLossy() to get access to color components. * css/DeprecatedCSSOMRGBColor.h: Use toSRGBASimpleColorLossy() to get access to color components. * page/CaptionUserPreferencesMediaAF.cpp: (WebCore::CaptionUserPreferencesMediaAF::captionsWindowCSS const): (WebCore::CaptionUserPreferencesMediaAF::captionsBackgroundCSS const): (WebCore::CaptionUserPreferencesMediaAF::captionsTextColor const): User Color::colorWithAlpha() to avoid the need to muck with components directly. * platform/graphics/Color.cpp: (WebCore::differenceSquared): Use rgb() directly, which is ok, since this is explicitly checking isExtended(). This code is still wrong (there is a FIXME) as it assumes the two colors are in the same color space. (WebCore::Color::Color): Add constructor which takes an ExtendedColor to allow functions like Color::invertedColorWithAlpha to delegate their functionality to ExtendedColor. (WebCore::Color::light const): Use new SimpleColor::colorWithAlpha() to avoid hardcoding constants here. (WebCore::Color::blend const): (WebCore::Color::blendWithWhite const): Use toSRGBASimpleColorLossy() to get access to color components. These are still not ideal implementations, as they don't preserve extended colors as well as they could, but now they don't return bogus values for extended colors. Minor cleanup bringing constants and lambda inside the function they are used in. (WebCore::Color::colorWithAlpha const): (WebCore::Color::colorWithAlphaUsingAlternativeRounding const): Minor cleanups to use a more consistent style and make use of the new SimpleColor::colorWithAlpha. (WebCore::Color::invertedColorWithAlpha const): Added. Used to avoid direct component usage in line box code. (WebCore::Color::semanticColor const): Added. Hopefully temporary. Used by RenderThemeIOS.mm to convert a Color from a map into a Color with the semantic bit set. This should not be necessary as every color in the map should already have it set, but to avoid uncessary possible behavior changes this preserves that functionality until it can be researched further. Fixing coders to preserve the semantic bit may be required to elliminate the need. (WebCore::Color::colorSpaceAndComponents const): Use rgb() rather than the individual components which have been removed. * platform/graphics/Color.h: (WebCore::SimpleColor::alphaComponentAsFloat const): Added. Needed by DeprecatedCSSOMRGBColor and useful to Color. (WebCore::SimpleColor::colorWithAlpha const): Useful to simplify Color::colorWithAlpha implementations and in Color::dark(). (WebCore::SimpleColor::get const): Added tuple interface to SimpleColor to support structure bindings. NOTE: Unlike the storage of SimpleColor (ARGB), this produces the bindings in the more familiar [r,g,b,a] to match FloatComponents. (WebCore::Color::alpha const): Made work with ExtendedColor as well. (WebCore::Color::red const): Deleted. (WebCore::Color::green const): Deleted. (WebCore::Color::blue const): Deleted. Removed. (CGColorRef cachedCGColor): (int differenceSquared): Made friends so they could use Color::rgb(). (WebCore::Color::rgb const): Made private. * platform/graphics/ExtendedColor.cpp: (WebCore::ExtendedColor::invertedColorWithAlpha const): * platform/graphics/ExtendedColor.h: Added invertedColorWithAlpha to allow inversion to be encapsulated. When future color spaces are added, we may need to choose per-colorspace algorithms for this instead of the trivial one used today. * platform/graphics/ca/cocoa/PlatformCAAnimationCocoa.mm: (WebCore::PlatformCAAnimationCocoa::setFromValue): (WebCore::PlatformCAAnimationCocoa::setToValue): (WebCore::PlatformCAAnimationCocoa::setValues): Use toSRGBASimpleColorLossy() to get access to color components. * platform/graphics/ca/win/PlatformCAAnimationWin.cpp: (PlatformCAAnimationWin::setFromValue): (PlatformCAAnimationWin::setToValue): (PlatformCAAnimationWin::setValues): Use toSRGBASimpleColorLossy() to get access to color components. * platform/graphics/cairo/CairoOperations.cpp: (WebCore::Cairo::drawFocusRing): Use Color::colorWithAlpha() to avoid needing access to components. * platform/graphics/cpu/arm/filters/FELightingNEON.h: (WebCore::FELighting::platformApplyNeon): Use toSRGBASimpleColorLossy() to get access to color components. * platform/graphics/texmap/TextureMapperGL.cpp: (WebCore::TextureMapperGL::clearColor): Use toSRGBASimpleColorLossy() to get access to color components. * platform/graphics/win/Direct2DOperations.cpp: (WebCore::Direct2D::drawGlyphs): Use colorWithAlphaMultipliedBy() to avoid needing access to components. * platform/graphics/win/FontCGWin.cpp: (WebCore::FontCascade::drawGlyphs): Use colorWithAlphaMultipliedBy() to avoid needing access to components. * platform/graphics/win/FontCascadeDirect2D.cpp: (WebCore::FontCascade::drawGlyphs): Use colorWithAlphaMultipliedBy() to avoid needing access to components. * rendering/EllipsisBox.cpp: (WebCore::EllipsisBox::paintSelection): Use invertedColorWithAlpha() to avoid needing access to components. * rendering/InlineTextBox.cpp: (WebCore::InlineTextBox::resolveStyleForMarkedText): Use invertedColorWithAlpha() to avoid needing access to components. * rendering/RenderBoxModelObject.cpp: (WebCore::RenderBoxModelObject::paintBoxShadow): Use opaqueColor() to avoid needing access to components. * rendering/RenderThemeIOS.mm: (WebCore::RenderThemeIOS::systemColor const): Use opaqueColor() to avoid needing access to components. * svg/properties/SVGAnimationAdditiveValueFunctionImpl.h: (WebCore::SVGAnimationColorFunction::animate): Use toSRGBASimpleColorLossy() to get access to color components. 2020-05-24 Zalan Bujtas <zalan@apple.com> [LFC][TFC] Take sections into account when computing collapsed border. https://bugs.webkit.org/show_bug.cgi?id=212311 Reviewed by Antti Koivisto. Test: fast/layoutformattingcontext/table-simple-collapsed-tbody-border.html * layout/Verification.cpp: (WebCore::Layout::LayoutContext::verifyAndOutputMismatchingLayoutTree): * layout/blockformatting/tablewrapper/TableWrapperBlockFormattingContext.cpp: (WebCore::Layout::TableWrapperBlockFormattingContext::computeBorderAndPaddingForTableBox): * layout/tableformatting/TableFormattingContext.cpp: (WebCore::Layout::TableFormattingContext::setUsedGeometryForSections): * layout/tableformatting/TableGrid.cpp: (WebCore::Layout::TableGrid::Section::Section): (WebCore::Layout::TableGrid::appendCell): * layout/tableformatting/TableGrid.h: (WebCore::Layout::TableGrid::Section::box const): (WebCore::Layout::TableGrid::sections const): (WebCore::Layout::TableGrid::sections): 2020-05-24 Zalan Bujtas <zalan@apple.com> [LFC][TFC] Take collapsed in-between row border into account when computing cell height https://bugs.webkit.org/show_bug.cgi?id=212307 Reviewed by Antti Koivisto. Test: fast/layoutformattingcontext/table-simple-collapsed-row-border2.html * layout/tableformatting/TableFormattingContextGeometry.cpp: (WebCore::Layout::TableFormattingContext::Geometry::computedCellBorder const): 2020-05-23 Zalan Bujtas <zalan@apple.com> [LFC][TFC] Take row border into account when computing collapsed borders. https://bugs.webkit.org/show_bug.cgi?id=212305 Reviewed by Antti Koivisto. Test: fast/layoutformattingcontext/table-simple-collapsed-row-border.html * layout/blockformatting/tablewrapper/TableWrapperBlockFormattingContext.cpp: (WebCore::Layout::TableWrapperBlockFormattingContext::computeBorderAndPaddingForTableBox): 2020-05-23 Jack Lee <shihchieh_lee@apple.com> ASSERTION FAILED: (!s_current || &m_view != &s_current->m_view) in RenderTreeBuilder::RenderTreeBuilder https://bugs.webkit.org/show_bug.cgi?id=212163 Unreviewed. Improve readability. Replace comments with curly brackets for scoping. * dom/Document.cpp: (WebCore::Document::updateRenderTree): 2020-05-23 Zalan Bujtas <zalan@apple.com> [LFC][TFC] Maximum constraint of a cell should never be smaller than the minimum width https://bugs.webkit.org/show_bug.cgi?id=212304 Reviewed by Antti Koivisto. Test: fast/layoutformattingcontext/table-simple-fixed-width-with-wide-content.html * layout/tableformatting/TableFormattingContextGeometry.cpp: (WebCore::Layout::TableFormattingContext::Geometry::intrinsicWidthConstraintsForCell): 2020-05-23 Zalan Bujtas <zalan@apple.com> [LFC][TFC] Used height of a cell is the maximum of the computed and the content height. https://bugs.webkit.org/show_bug.cgi?id=212302 Reviewed by Antti Koivisto. Test: fast/layoutformattingcontext/table-simple-tall-cell-content-with-fixed-height.html * layout/FormattingContextGeometry.cpp: (WebCore::Layout::FormattingContext::Geometry::contentHeightForFormattingContextRoot const): * layout/tableformatting/TableFormattingContextGeometry.cpp: (WebCore::Layout::TableFormattingContext::Geometry::cellHeigh const): 2020-05-23 Zalan Bujtas <zalan@apple.com> [LFC][TFC] Non-collapsing row border should not make the table wider/taller https://bugs.webkit.org/show_bug.cgi?id=212263 Reviewed by Antti Koivisto. Non-collapsing row border eats into the content box but oddly it does not constraint the cell boxes, so we can end up with smaller row content box than the cell box it contains. Test: fast/layoutformattingcontext/table-simple-row-border.html * layout/LayoutUnits.h: (WebCore::Layout::Edges::width const): (WebCore::Layout::Edges::height const): (WebCore::Layout::HorizontalEdges::width const): Deleted. (WebCore::Layout::VerticalEdges::height const): Deleted. * layout/tableformatting/TableFormattingContext.cpp: (WebCore::Layout::TableFormattingContext::setUsedGeometryForRows): * layout/tableformatting/TableFormattingContextGeometry.cpp: (WebCore::Layout::TableFormattingContext::Geometry::intrinsicWidthConstraintsForCell): 2020-05-22 Jack Lee <shihchieh_lee@apple.com> ASSERTION FAILED: (!s_current || &m_view != &s_current->m_view) in RenderTreeBuilder::RenderTreeBuilder https://bugs.webkit.org/show_bug.cgi?id=212163 <rdar://problem/57028096> Reviewed by Geoffrey Garen. Calling ~PostResolutionCallbackDisabler() before completing render tree updating and releasing RenderTreeBuilder triggers this assertion. Therefore we added a utility function "updateRenderTree" in which PostResolutionCallback is delayed until RenderTreeUpdater is released and m_inRenderTreeUpdate is cleared. Test: fast/rendering/nested-render-tree-update-crash.html * Headers.cmake: * WebCore.xcodeproj/project.pbxproj: * dom/Document.cpp: (WebCore::Document::updateRenderTree): (WebCore::Document::resolveStyle): (WebCore::Document::updateTextRenderer): * dom/Document.h: * rendering/updating/RenderTreeUpdater.cpp: (WebCore::RenderTreeUpdater::RenderTreeUpdater): (WebCore::RenderTreeUpdater::commit): * rendering/updating/RenderTreeUpdater.h: 2020-05-22 Simon Fraser <simon.fraser@apple.com> Stuttery overflow scrolling in slow-scrolling regions (facebook messenger, feedly.com) https://bugs.webkit.org/show_bug.cgi?id=212291 <rdar://problem/61940624> Reviewed by Tim Horton. Now that we do scrolling tree commits on the main thread, ThreadedScrollingTree::scrollingTreeNodeDidScroll() can be called on the main thread. In this case, don't do an RunLoop::main().dispatch() which introduces asynchrony; just call into the ScrollingCoordinator synchronously. Do some minor refactoring to move noteScrollingThreadSyncCompleteForNode() into updateScrollPositionAfterAsyncScroll(). Hard to test because it involves scrolling thread/main thread interactions. * page/scrolling/AsyncScrollingCoordinator.cpp: (WebCore::AsyncScrollingCoordinator::requestScrollPositionUpdate): (WebCore::AsyncScrollingCoordinator::synchronizeStateFromScrollingTree): (WebCore::AsyncScrollingCoordinator::scheduleUpdateScrollPositionAfterAsyncScroll): (WebCore::AsyncScrollingCoordinator::updateScrollPositionAfterAsyncScrollTimerFired): (WebCore::AsyncScrollingCoordinator::updateScrollPositionAfterAsyncScroll): * page/scrolling/AsyncScrollingCoordinator.h: * page/scrolling/ThreadedScrollingTree.cpp: (WebCore::ThreadedScrollingTree::scrollingTreeNodeDidScroll): 2020-05-22 Zalan Bujtas <zalan@apple.com> Nullptr deref in WebCore::RenderTreeBuilder::Block::attachIgnoringContinuation when parent and beforeChild are siblings https://bugs.webkit.org/show_bug.cgi?id=212116 <rdar://problem/62993844> Reviewed by Simon Fraser. This patch fixes the case when a nested fragmented context has a spanner and we try to form a continuation while this nested fragmented context is being destroyed. 1. The continuation is triggered by a style change that turns a previously out-of-flow block container into an inflow box (and the parent inline level container can't have the box as a direct child anymore). 2. An unrelated style change nukes the nested fragmented context. We need to "re-assign" the spanner to the parent fragment. These 2 changes are split into 2 phases; first we take care of the tree mutation triggered by the continuation (updateRendererStyle), while we do the fragmented context cleanup (updateAfterDescendants) in a separate step. This 2 phase setup confuses the "where to put this spanner" logic. This patch addresses the issue by keeping the spanner inside the about-to-be-destroyed fragmented context while forming the continuation (phase #1) and let the second phase (updateAfterDescendants) deal with the spanner moving. Test: fast/multicol/nested-multicol-with-spanner-and-continuation.html * rendering/updating/RenderTreeBuilderMultiColumn.cpp: (WebCore::isValidColumnSpanner): 2020-05-22 Chris Dumez <cdumez@apple.com> Revoking an object URL immediately after triggering navigation causes navigation to fail https://bugs.webkit.org/show_bug.cgi?id=212279 <rdar://problem/63553090> Reviewed by Geoffrey Garen. When doing a policy check for a Blob URL, we clone the blob and create a new temporary Blob URL that stays alive for the duration of the policy check. We made sure to update the ResourceRequest URL with the new Blob URL, however, we were failing to update the DocumentLoader's request. As a result, if the client responded with Policy USE, the DocumentLoader would still attempt to navigate to the old Blob URL. Test: fast/loader/revoke-blob-url-after-navigation.html * loader/PolicyChecker.cpp: (WebCore::FrameLoader::PolicyChecker::extendBlobURLLifetimeIfNecessary const): (WebCore::FrameLoader::PolicyChecker::checkNavigationPolicy): (WebCore::FrameLoader::PolicyChecker::checkNewWindowPolicy): * loader/PolicyChecker.h: 2020-05-22 Simon Fraser <simon.fraser@apple.com> Make sure we clean up CFTimerRefs when destroying scrolling tree nodes https://bugs.webkit.org/show_bug.cgi?id=212278 <rdar://problem/63548212> Reviewed by Tim Horton. When destroying scrolling tree nodes, make sure we explicitly stop the RunLoop::Timers, and do this for all nodes when clearing the m_nodeMap, not just for orphaned nodes as was done in r262042. * page/scrolling/ScrollingTree.cpp: (WebCore::ScrollingTree::commitTreeState): (WebCore::ScrollingTree::updateTreeFromStateNodeRecursive): (WebCore::ScrollingTree::removeAllNodes): * page/scrolling/ScrollingTree.h: * page/scrolling/ScrollingTreeNode.h: (WebCore::ScrollingTreeNode::willBeDestroyed): (WebCore::ScrollingTreeNode::wasRemovedFromTree): Deleted. * page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.h: * page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.mm: (WebCore::ScrollingTreeFrameScrollingNodeMac::willBeDestroyed): (WebCore::ScrollingTreeFrameScrollingNodeMac::wasRemovedFromTree): Deleted. * page/scrolling/mac/ScrollingTreeOverflowScrollingNodeMac.h: * page/scrolling/mac/ScrollingTreeOverflowScrollingNodeMac.mm: (WebCore::ScrollingTreeOverflowScrollingNodeMac::willBeDestroyed): (WebCore::ScrollingTreeOverflowScrollingNodeMac::wasRemovedFromTree): Deleted. 2020-05-22 Andres Gonzalez <andresg_22@apple.com> Updates to the isolated tree must happen before posting notifications to clients. https://bugs.webkit.org/show_bug.cgi?id=212266 Reviewed by Chris Fleizach. Multiple tests. In AXObjectCache::notificationPostTimerFired we were updating the isolated tree after the notifications were posted to the platform clients. This caused that in some cases when the client requested info as the result of those notifications, the isolated tree was out-of-date. In this patch updateIsolatedTree is called before notifying platform clients. * accessibility/AXObjectCache.cpp: (WebCore::AXObjectCache::notificationPostTimerFired): (WebCore::AXObjectCache::postNotification): (WebCore::AXObjectCache::postTextStateChangeNotification): (WebCore::AXObjectCache::updateIsolatedTree): 2020-05-22 Sam Weinig <weinig@apple.com> Extended Color Cleanup: Make alpha premultiplication code more consistent and clear regarding what works with extended colors https://bugs.webkit.org/show_bug.cgi?id=212265 Reviewed by Simon Fraser. - Adds premultiplied(const FloatComponents&) to do premutiplication directly on FloatComponents rather than doing it on the ints and losing precision. - Makes non-FloatComponent alpha premultiplication all take place only for SimpleColors as that is what callers need. The existing premulitplication for ExtendedColors in blend() was incorrect as it never did a conversion to sRGB. - Adds new toSRGBASimpleColorLossy() (to complement toSRGBAComponentsLossy()). Will make it easy to find all the conversions in the future. - Broke non-premultiplying blend() out of blend() (removing parameter) and made a new blendWithoutPremultiply() function for it (no callers needed to make this decision dynamically). * css/CSSGradientValue.cpp: (WebCore::CSSGradientValue::computeStops): Use blendWithoutPremultiply() explicitly. * platform/graphics/Color.h: * platform/graphics/Color.cpp: (WebCore::makePremultipliedRGBA): Renamed from premultipliedARGBFromColor and now only operates on SimpleColors. (WebCore::makeUnPremultipliedRGBA): Renamed from colorFromPremultipliedARGB and now only operates on SimpleColors. (WebCore::colorFromPremultipliedARGB): Deleted. (WebCore::premultipliedARGBFromColor): Deleted. (WebCore::Color::toSRGBASimpleColorLossy const): Added. Useful for finding all non-colorspace preserving users of the color channels. (WebCore::blend): (WebCore::blendWithoutPremultiply): Split these out from each other. Made blend() use toSRGBASimpleColorLossy() and do all operations on SimpleColors directly. The old code that preported to work with extended colors was nonsense as it didn't actually take the colorspaces into account, just grabbed the channels regardless of space. * platform/graphics/cairo/ImageBufferCairoImageSurfaceBackend.cpp: (WebCore::ImageBufferCairoImageSurfaceBackend::platformTransformColorSpace): Adopt update premulitiplication names and stay in SimpleColor for entire conversion. * platform/graphics/cairo/NativeImageCairo.cpp: (WebCore::nativeImageSinglePixelSolidColor): Adopt update premulitiplication names. * platform/graphics/ColorUtilities.cpp: (WebCore::premultiplied): * platform/graphics/ColorUtilities.h: * platform/graphics/texmap/TextureMapperGL.cpp: (WebCore::TextureMapperGL::drawBorder): (WebCore::prepareFilterProgram): (WebCore::TextureMapperGL::drawSolidColor): Add and adopt premultiplied(const FloatComponents&). 2020-05-22 Andy Estes <aestes@apple.com> [Apple Pay] Add new ApplePayInstallmentConfiguration members https://bugs.webkit.org/show_bug.cgi?id=212160 <rdar://problem/60703650> Reviewed by Alex Christensen. Test: http/tests/ssl/applepay/ApplePayInstallmentItems.https.html * DerivedSources-input.xcfilelist: * DerivedSources-output.xcfilelist: * DerivedSources.make: * SourcesCocoa.txt: * WebCore.xcodeproj/project.pbxproj: Added IDLs, headers, and derived sources for ApplePayInstallment{Item,ItemType,RetailChannel}. * Modules/applepay/ApplePayInstallmentConfiguration.idl: * Modules/applepay/ApplePayInstallmentConfigurationWebCore.h: Added items, applicationMetadata, and retailChannel members. Added missing conditionals to merchantIdentifier and referrerIdentifier. * Modules/applepay/ApplePayInstallmentItem.h: * Modules/applepay/ApplePayInstallmentItem.idl: * Modules/applepay/ApplePayInstallmentItemType.h: * Modules/applepay/ApplePayInstallmentItemType.idl: * Modules/applepay/ApplePayInstallmentRetailChannel.h: * Modules/applepay/ApplePayInstallmentRetailChannel.idl: Added. * Modules/applepay/ApplePayRequestBase.cpp: (WebCore::convertAndValidate): Changed to call PaymentInstallmentConfiguration::create, returning an exception if present. * Modules/applepay/PaymentInstallmentConfiguration.mm: (WebCore::fromDecimalNumber): Allowed for a large maximum number of fractional digits to support formatting high-precision currency and APRs (note that this formatter is only used for test support). (WebCore::applePayItemType): (WebCore::platformItemType): Added to convert between PKInstallmentItemType and ApplePayInstallmentItemType. (WebCore::applePayRetailChannel): (WebCore::platformRetailChannel): Added to convert between PKInstallmentRetailChannel and ApplePayInstallmentRetailChannel. (WebCore::makeNSArrayElement): (WebCore::makeVectorElement): Added to convert between NSArray<PKPaymentInstallmentItem *> and Vector<ApplePayInstallmentItem>. (WebCore::createPlatformConfiguration): Added a parameter for passing in applicationMetadata as an NSDictionary. Set properties on PKPaymentInstallmentConfiguration for new ApplePayInstallmentConfiguration members. (WebCore::PaymentInstallmentConfiguration::create): Added; converts the applicationMetadata JSON string (if present) to an NSDictionary, returning a TypeError if the JSON string does not deserialize to an NSDictionary (as PassKit requires). (WebCore::PaymentInstallmentConfiguration::PaymentInstallmentConfiguration): Added a parameter for passing in applicationMetadata as an NSDictionary. Made private. (WebCore::PaymentInstallmentConfiguration::applePayInstallmentConfiguration const): Set members on ApplePayInstallmentConfiguration for new PKPaymentInstallmentConfiguration properties. * Modules/applepay/PaymentInstallmentConfigurationWebCore.h: 2020-05-22 Alex Christensen <achristensen@webkit.org> Add SPI to unblock third party cookies from WKWebViews with ResourceLoadStatistics turned on https://bugs.webkit.org/show_bug.cgi?id=212058 <rdar://problem/60595539> Reviewed by John Wilander. * WebCore.xcodeproj/project.pbxproj: * loader/CookieJar.cpp: (WebCore::shouldRelaxThirdPartyCookieBlocking): (WebCore::CookieJar::cookies const): (WebCore::CookieJar::setCookies): (WebCore::CookieJar::cookieRequestHeaderFieldValue const): (WebCore::CookieJar::getRawCookies const): * page/Page.cpp: (WebCore::m_shouldRelaxThirdPartyCookieBlocking): * page/Page.h: (WebCore::Page::shouldRelaxThirdPartyCookieBlocking const): * page/PageConfiguration.h: * platform/network/CacheValidation.cpp: (WebCore::cookieRequestHeaderFieldValue): * platform/network/NetworkStorageSession.cpp: (WebCore::NetworkStorageSession::shouldBlockCookies const): (WebCore::NetworkStorageSession::maxAgeCacheCap): * platform/network/NetworkStorageSession.h: * platform/network/ShouldRelaxThirdPartyCookieBlocking.h: Added. * platform/network/cf/NetworkStorageSessionCFNetWin.cpp: (WebCore::NetworkStorageSession::setCookiesFromDOM const): (WebCore::NetworkStorageSession::cookiesForDOM const): (WebCore::NetworkStorageSession::cookieRequestHeaderFieldValue const): (WebCore::NetworkStorageSession::getRawCookies const): * platform/network/cocoa/NetworkStorageSessionCocoa.mm: (WebCore::NetworkStorageSession::cookiesForURL const): (WebCore::NetworkStorageSession::cookiesForSession const): (WebCore::NetworkStorageSession::cookiesForDOM const): (WebCore::NetworkStorageSession::cookieRequestHeaderFieldValue const): (WebCore::NetworkStorageSession::setCookiesFromDOM const): (WebCore::NetworkStorageSession::getRawCookies const): * platform/network/curl/NetworkStorageSessionCurl.cpp: (WebCore::NetworkStorageSession::setCookiesFromDOM const): (WebCore::NetworkStorageSession::cookiesForDOM const): (WebCore::NetworkStorageSession::getRawCookies const): (WebCore::NetworkStorageSession::cookieRequestHeaderFieldValue const): * platform/network/curl/ResourceHandleCurl.cpp: (WebCore::ResourceHandle::createCurlRequest): * platform/network/soup/NetworkStorageSessionSoup.cpp: (WebCore::NetworkStorageSession::setCookiesFromDOM const): (WebCore::NetworkStorageSession::getRawCookies const): (WebCore::cookiesForSession): (WebCore::NetworkStorageSession::cookiesForDOM const): (WebCore::NetworkStorageSession::cookieRequestHeaderFieldValue const): 2020-05-22 Oriol Brufau <obrufau@igalia.com> Don't put out-of-flow boxes in anonymous flex/grid items https://bugs.webkit.org/show_bug.cgi?id=205386 Reviewed by Manuel Rego Casasnovas. A single anonymous flex/grid item should just contain a contiguous sequence of text runs. This patch is based on https://crrev.com/533825 from Chromium. Tests: imported/w3c/web-platform-tests/css/css-flexbox/anonymous-flex-item-004.html imported/w3c/web-platform-tests/css/css-grid/grid-items/anonymous-grid-item-001.html * rendering/updating/RenderTreeBuilderBlock.cpp: (WebCore::RenderTreeBuilder::Block::attachIgnoringContinuation): 2020-05-22 Tim Horton <timothy_horton@apple.com> iOS: Pressing tab in the Mail subject field moves focus to the body, but pressing shift tab doesn't move it back https://bugs.webkit.org/show_bug.cgi?id=212243 <rdar://problem/59127764> Reviewed by Wenson Hsieh. New API Tests: WebKit.ShiftTabTakesFocusFromEditableWebView and WebKit.TabDoesNotTakeFocusFromEditableWebView * page/FocusController.cpp: (WebCore::FocusController::relinquishFocusToChrome): (WebCore::FocusController::advanceFocusInDocumentOrder): * page/FocusController.h: Factor out the code that decides whether the Chrome might accept focus, and transfers focus out to the Chrome, for use in EventHandler. * page/EventHandler.cpp: (WebCore::EventHandler::defaultTabEventHandler): In the case where we are shift-tabbing out of an editable web view, allow focus to pass to the Chrome. Previously, we would not allow this, because tabKeyCyclesThroughElements is false in editable web views. However, focus exiting the web view entirely needn't be covered by "cycles through elements" behavior. We can't do this for plain "tab", because that needs to be allowed to insert a tab character instead. 2020-05-22 Tyler Wilcock <twilco.o@protonmail.com> Cannot style ::selection for a flex container https://bugs.webkit.org/show_bug.cgi?id=209822 Reviewed by Antti Koivisto. When needing to query for pseudostyles, RenderText used to unconditionally check the parent's pseudostyles. The parent of RenderText objects is often an anonymous box, depending on the presence of siblings, `display` type, etc. This is problematic as pseudostyles are associated with an element of the DOM, meaning RenderText elements would often fail to find any pseudostyle thanks to their anonymous parent. This patch changes RenderText to traverse its tree of ancestry upwards until it finds a non-anonymous ancestor and gets those pseudostyles, rather than unconditionally trying to get pseudostyles from its direct parent. Blink does something similar when retrieving pseudostyles: https://github.com/chromium/chromium/blob/793cb59c18334f8b506863192bf630776da0f4d2/third_party/blink/renderer/core/paint/selection_painting_utils.cc#L54 Tests: editing/selection/selection-display-block-sibling.html editing/selection/selection-display-flex.html * rendering/RenderObject.cpp: (WebCore::RenderObject::firstNonAnonymousAncestor const): * rendering/RenderObject.h: * rendering/RenderText.h: (WebCore::RenderText::getCachedPseudoStyle const): getCachedPseudoStyle from first non-anonymous ancestor, rather than only checking the direct parent. (WebCore::RenderText::selectionBackgroundColor const): Retrieve selectionBackgroundColor from first non-anonymous ancestor rather than only checking the direct parent. (WebCore::RenderText::selectionForegroundColor const): Retrieve selectionForegroundColor from first non-anonymous ancestor rather than only checking the direct parent. (WebCore::RenderText::selectionEmphasisMarkColor const): Retrieve selectionEmphasisMarkColor from first non-anonymous ancestor rather than only checking the direct parent. (WebCore::RenderText::selectionPseudoStyle const): Retrieve selectionPseudoStyle from first non-anonymous ancestor rather than only checking the direct parent. 2020-05-21 Wenson Hsieh <wenson_hsieh@apple.com> DataTransfer.files contains multiple files when pasting a single image with multiple representations https://bugs.webkit.org/show_bug.cgi?id=212245 <rdar://problem/60240436> Reviewed by Tim Horton. When pasting or dropping a single image that is backed by multiple representations in NSPasteboard (or UIPasteboard), we currently report more than one `File` to the page via `DataTransfer.files`. This is because `Pasteboard::read(PasteboardFileReader&)`, which is responsible for converting the contents of the pasteboard into a list of files, currently iterates over every pasteboard type and adds each of them as a file. This is wrong when an item has multiple type representations. To differentiate the case where a single item has multiple representations from the case where it has multiple pasteboard items, we use `allPasteboardItemInfo()` instead to grab a per-item list of types from the pasteboard on Cocoa platforms, and only create at most 1 file per item using the highest fidelity type that contains data. Test: PasteImage.PasteImageWithMultipleRepresentations * platform/cocoa/PasteboardCocoa.mm: (WebCore::Pasteboard::read): 2020-05-21 Simon Fraser <simon.fraser@apple.com> Fix rare scrolling thread crash firing the m_delayedRenderingUpdateDetectionTimer timer https://bugs.webkit.org/show_bug.cgi?id=212250 Reviewed by Tim Horton. It seems that we can fire the m_delayedRenderingUpdateDetectionTimer timer after the ScrollingTree has been destroyed (possibly because it's destroyed on another thread and CFRunLoopTimerRef isn't threadsafe), so explicitly clear the timer in invalidate() while holding m_treeMutex. * page/scrolling/ThreadedScrollingTree.cpp: (WebCore::ThreadedScrollingTree::invalidate): 2020-05-21 Sam Weinig <weinig@apple.com> Extended Color Cleanup: Move Color coder definitions to Color to allow for future encaspulation improvements https://bugs.webkit.org/show_bug.cgi?id=212247 Reviewed by Simon Fraser. Move IPC encoder/decoder definitions from WebKit down into Color itself to move closer to making Color::rgb() private. * platform/graphics/Color.h: (WebCore::Color::encode const): (WebCore::Color::decode): 2020-05-21 Simon Fraser <simon.fraser@apple.com> Scrolling thread scrolls on sync-scrolling scrollers don't get to the main thread https://bugs.webkit.org/show_bug.cgi?id=212225 Fix builds that use Nicosia after r262041. * page/scrolling/nicosia/ScrollingTreeFrameScrollingNodeNicosia.cpp: (WebCore::ScrollingTreeFrameScrollingNodeNicosia::currentScrollPositionChanged): * page/scrolling/nicosia/ScrollingTreeFrameScrollingNodeNicosia.h: 2020-05-21 Simon Fraser <simon.fraser@apple.com> Fix some thread safety issues with ScrollController timers https://bugs.webkit.org/show_bug.cgi?id=212238 Reviewed by Wenson Hsieh. There were some problems with the timers fired by ScrollController, used for rubber-banding and scroll snap. First, they could fire on the main thread when we intended them to fire on the scrolling thread. This happened because in r260716 I made the scrolling tree commit on the main thread, so we'd construct the ScrollingTreeScrollingNodeDelegateMac and its ScrollController there and its timers would grab the main thread runloop. Fix by creating the timers on demand. Secondly, the timer callbacks called into scrolling tree code, but without taking the scrolling tree lock, and without any guarantee that the node would stay alive for the duration of the callback. Fix by having the ScrollControllerClient create the timers, allowing the client to have a callback wrapper that locks, and to ensure object lifetime (or make a weak ref). Now that scrolling tree nodes could be extended by a pending timer, we need to explicitly clear the timers when nodes are removed from the tree. Finally, rename some confusingly named ScrollControllerClient functions. * page/scrolling/ScrollingTree.cpp: (WebCore::ScrollingTree::commitTreeState): * page/scrolling/ScrollingTree.h: (WebCore::ScrollingTree::treeMutex): * page/scrolling/ScrollingTreeNode.h: (WebCore::ScrollingTreeNode::wasBeRemovedFromTree): * page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.h: * page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.mm: (WebCore::ScrollingTreeFrameScrollingNodeMac::wasBeRemovedFromTree): * page/scrolling/mac/ScrollingTreeOverflowScrollingNodeMac.h: * page/scrolling/mac/ScrollingTreeOverflowScrollingNodeMac.mm: (WebCore::ScrollingTreeOverflowScrollingNodeMac::wasBeRemovedFromTree): * page/scrolling/mac/ScrollingTreeScrollingNodeDelegateMac.h: * page/scrolling/mac/ScrollingTreeScrollingNodeDelegateMac.mm: (WebCore::ScrollingTreeScrollingNodeDelegateMac::nodeWillBeDestroyed): (WebCore::ScrollingTreeScrollingNodeDelegateMac::createTimer): (WebCore::ScrollingTreeScrollingNodeDelegateMac::didStopRubberbandSnapAnimation): (WebCore::ScrollingTreeScrollingNodeDelegateMac::willStartScrollSnapAnimation): (WebCore::ScrollingTreeScrollingNodeDelegateMac::didStopScrollSnapAnimation): (WebCore::ScrollingTreeScrollingNodeDelegateMac::stopSnapRubberbandTimer): Deleted. (WebCore::ScrollingTreeScrollingNodeDelegateMac::startScrollSnapTimer): Deleted. (WebCore::ScrollingTreeScrollingNodeDelegateMac::stopScrollSnapTimer): Deleted. * platform/ScrollAnimator.cpp: (WebCore::ScrollAnimator::createTimer): * platform/ScrollAnimator.h: * platform/cocoa/ScrollController.h: (WebCore::ScrollControllerTimer::ScrollControllerTimer): (WebCore::ScrollControllerClient::willStartRubberBandSnapAnimation): (WebCore::ScrollControllerClient::didStopRubberbandSnapAnimation): (WebCore::ScrollControllerClient::willStartScrollSnapAnimation): (WebCore::ScrollControllerClient::didStopScrollSnapAnimation): (WebCore::ScrollControllerClient::startSnapRubberbandTimer): Deleted. (WebCore::ScrollControllerClient::stopSnapRubberbandTimer): Deleted. (WebCore::ScrollControllerClient::startScrollSnapTimer): Deleted. (WebCore::ScrollControllerClient::stopScrollSnapTimer): Deleted. * platform/cocoa/ScrollController.mm: (WebCore::ScrollController::ScrollController): (WebCore::ScrollController::stopAllTimers): (WebCore::ScrollController::handleWheelEvent): (WebCore::ScrollController::snapRubberBandTimerFired): (WebCore::ScrollController::isRubberBandInProgress const): (WebCore::ScrollController::isScrollSnapInProgress const): (WebCore::ScrollController::startSnapRubberbandTimer): (WebCore::ScrollController::stopSnapRubberbandTimer): (WebCore::ScrollController::snapRubberBand): (WebCore::ScrollController::scheduleStatelessScrollSnap): (WebCore::ScrollController::statelessSnapTransitionTimerFired): (WebCore::ScrollController::startScrollSnapTimer): (WebCore::ScrollController::stopScrollSnapTimer): * platform/mac/ScrollAnimatorMac.h: 2020-05-21 Simon Fraser <simon.fraser@apple.com> Scrolling thread scrolls on sync-scrolling scrollers don't get to the main thread https://bugs.webkit.org/show_bug.cgi?id=212225 Reviewed by Tim Horton. Some scrolls on nodes with synchronousScrollingReasons failed to set the m_scrolledSinceLastCommit bit, because ScrollingTreeFrameScrollingNodeMac::currentScrollPositionChanged() bypassed a call to the superclass. Fix by passing ScrollingLayerPositionAction so that it can just call super. This will be tested by existing tests after some upcoming scroll snap changes. * page/scrolling/ScrollingTreeScrollingNode.cpp: (WebCore::ScrollingTreeScrollingNode::currentScrollPositionChanged): * page/scrolling/ScrollingTreeScrollingNode.h: * page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.h: * page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.mm: (WebCore::ScrollingTreeFrameScrollingNodeMac::currentScrollPositionChanged): 2020-05-21 Peng Liu <peng.liu6@apple.com> Fix issues of the Picture-in-Picture API under stress tests https://bugs.webkit.org/show_bug.cgi?id=212191 Reviewed by Eric Carlson. The current implementation of the Picture-in-Picture API is not robust under stress tests. Changing the video presentation mode of a video element between inline and picture-in-picture continuously may corrupt the internal states of the video element. This patch refactors the approach to tracking the progress of video presentation mode changes and make sure no new requestPictureInPicture() or exitPictureInPicture() will trigger a presentation mode change unless the previous operations are completed. This patch also removes the code for testing purposes in the HTMLVideoElement class. Covered by existing tests. * html/HTMLMediaElement.h: * html/HTMLVideoElement.cpp: (WebCore::toPresentationMode): (WebCore::HTMLVideoElement::setFullscreenMode): (WebCore::HTMLVideoElement::fullscreenModeChanged): (WebCore::HTMLVideoElement::didEnterFullscreen): (WebCore::HTMLVideoElement::didExitFullscreen): (WebCore::HTMLVideoElement::setPictureInPictureObserver): (WebCore::HTMLVideoElement::setVideoFullscreenFrame): (WebCore::HTMLVideoElement::didBecomeFullscreenElement): Deleted. (WebCore::HTMLVideoElement::setPictureInPictureAPITestEnabled): Deleted. * html/HTMLVideoElement.h: * testing/Internals.cpp: (WebCore::Internals::setPictureInPictureAPITestEnabled): Deleted. * testing/Internals.h: * testing/Internals.idl: Remove setPictureInPictureAPITestEnabled(). 2020-05-21 Sam Weinig <weinig@apple.com> Extended Color Cleanup: Remove trivial uses of Color::rgb() https://bugs.webkit.org/show_bug.cgi?id=212231 Reviewed by Darin Adler Replaces a few unnecessary uses of Color::rgb(): - Uses of an idiom where code round-tripped a Color via Color(myColor.rgb()). This is not compatible with extended colors and seems to be unnecessary. - Uses of colorWithOverrideAlpha(). This function requires a SimpleColor, so required using color.rgb(). We can't transition to Color::colorWithAlpha due to a slightly different rounding of the alpha, so a new function Color::colorWithAlphaUsingAlternativeRounding was added to which implements the alternative rounding. A later change can reconcile the two versions. - Creation of D2D1::ColorF. D2D1::ColorF has a constructor that takes a four floats that is used instead. - Comparing two colors using rgb() for each to avoid comparing the semantic bit. equalIgnoringSemanticColor exists for just this use. * editing/cocoa/HTMLConverter.mm: (HTMLConverterCaches::colorPropertyValueForNode): * html/HTMLElement.cpp: (WebCore::HTMLElement::addHTMLColorToStyle): * html/canvas/CanvasRenderingContext2DBase.cpp: (WebCore::CanvasRenderingContext2DBase::setStrokeStyle): (WebCore::CanvasRenderingContext2DBase::setFillStyle): (WebCore::CanvasRenderingContext2DBase::setShadow): * html/canvas/CanvasStyle.cpp: (WebCore::CanvasStyle::createFromStringWithOverrideAlpha): * html/track/InbandGenericTextTrack.cpp: (WebCore::InbandGenericTextTrack::updateCueFromCueData): * platform/graphics/Color.cpp: (WebCore::Color::colorWithAlphaMultipliedByUsingAlternativeRounding const): (WebCore::Color::colorWithAlpha const): (WebCore::Color::colorWithAlphaUsingAlternativeRounding const): (WebCore::colorWithOverrideAlpha): Deleted. * platform/graphics/Color.h: (WebCore::colorWithOverrideAlpha): Deleted. * platform/graphics/cairo/CairoOperations.cpp: (WebCore::Cairo::prepareCairoContextSource): * platform/graphics/filters/FEFlood.cpp: (WebCore::FEFlood::platformApplySoftware): * platform/graphics/win/ColorDirect2D.cpp: (WebCore::Color::operator D2D1_COLOR_F const): (WebCore::Color::operator D2D1_VECTOR_4F const): * platform/graphics/win/GraphicsContextDirect2D.cpp: (WebCore::GraphicsContext::colorWithGlobalAlpha const): * platform/mac/ThemeMac.mm: (WebCore::drawCellFocusRingWithFrameAtTime): * rendering/RenderThemeIOS.mm: (WebCore::RenderThemeIOS::paintFileUploadIconDecorations): * rendering/RenderThemeMac.mm: (WebCore::RenderThemeMac::platformFocusRingColor const): * rendering/RenderTreeAsText.cpp: (WebCore::RenderTreeAsText::writeRenderObject): * svg/SVGStopElement.cpp: (WebCore::SVGStopElement::stopColorIncludingOpacity const): 2020-05-21 Oriol Brufau <obrufau@igalia.com> [css-grid] Don't create renderers for whitespace nodes https://bugs.webkit.org/show_bug.cgi?id=212220 Reviewed by Manuel Rego Casasnovas. Even with 'white-space: pre' we shouldn't create RenderTexts for whitespace-only nodes in grid layout, according to https://drafts.csswg.org/css-grid/#grid-items This patch is based on https://codereview.chromium.org/16888008 Tests: fast/text/simple-line-layout-with-zero-sized-font.html imported/w3c/web-platform-tests/css/css-grid/grid-items/whitespace-in-grid-item-001.html * rendering/updating/RenderTreeUpdater.cpp: (WebCore::RenderTreeUpdater::textRendererIsNeeded): 2020-05-21 Simon Fraser <simon.fraser@apple.com> Fix rare crash in TileGrid::platformCALayerShowRepaintCounter() https://bugs.webkit.org/show_bug.cgi?id=212182 <rdar://problem/55618414> Reviewed by Darin Adler. Crash data suggest that owner() can be null in platformCALayerShowRepaintCounter(), so null-check in these functions. * platform/graphics/ca/TileGrid.cpp: (WebCore::TileGrid::platformCALayerDeviceScaleFactor const): (WebCore::TileGrid::platformCALayerShowDebugBorders const): (WebCore::TileGrid::platformCALayerShowRepaintCounter const): (WebCore::TileGrid::isUsingDisplayListDrawing const): 2020-05-21 Youenn Fablet <youenn@apple.com> Incorrect location.origin in blob workers https://bugs.webkit.org/show_bug.cgi?id=211876 <rdar://problem/63284717> Reviewed by Sihui Liu. Instead of computing the origin from the location URL in worker, get it directly from the WorkerGlobalScope origin. This ensures we unwrap properly blob URLs. Test: http/tests/security/contentSecurityPolicy/worker-blob-location.html * workers/WorkerGlobalScope.cpp: (WebCore::WorkerGlobalScope::location const): * workers/WorkerLocation.cpp: (WebCore::WorkerLocation::origin const): * workers/WorkerLocation.h: (WebCore::WorkerLocation::create): (WebCore::WorkerLocation::url const): (WebCore::WorkerLocation::WorkerLocation): 2020-05-21 John Wilander <wilander@apple.com> Storage Access API: Allow configurable storage access scope https://bugs.webkit.org/show_bug.cgi?id=212114 <rdar://problem/63423063> Reviewed by Alex Christensen. The scope of storage access as per-frame or per-page was discussed in the standards process here: https://github.com/privacycg/storage-access/issues/3 The decision was to have per-page storage access by default. Recent feedback from Google and conversation with Mozilla suggest that we might want to support the caller choosing the scope. This patch adds support for different scope configurations while keeping the existing default as per-frame. A later patch will switch the default and add test cases for per-page scope. A new struct is added WebCore::RequestStorageAccessResult which carries full information about the storage access request result. A new enum is added WebCore::StorageAccessScope to encode per-frame and per-page access. No new tests. No changed functionality. Tests already exist. * dom/DocumentStorageAccess.cpp: (WebCore::DocumentStorageAccess::requestStorageAccess): * dom/DocumentStorageAccess.h: (WebCore::RequestStorageAccessResult::encode const): (WebCore::RequestStorageAccessResult::decode): * page/ChromeClient.h: (WebCore::ChromeClient::requestStorageAccess): 2020-05-21 Yoshiaki Jitsukawa <yoshiaki.jitsukawa@sony.com> [PlayStation] Add minimal WKView API to enable TestWebKitAPI https://bugs.webkit.org/show_bug.cgi?id=211868 Reviewed by Alex Christensen. Enable TestWebKitAPI * PlatformPlayStation.cmake: Add WebKitRequirements library to WebCore_CopySharedLibs. 2020-05-21 Chris Dumez <cdumez@apple.com> ASSERTION FAILED: m_wrapper on fast/events/scoped/editing-commands.html https://bugs.webkit.org/show_bug.cgi?id=209862 <rdar://problem/61164607> Reviewed by Darin Adler. Make sure ScopedEventQueue keeps its event targets alive using a GCReachableRef<Node> so that it keeps alive both the target and its JS wrapper. No new tests, covered by existing test. * dom/ScopedEventQueue.cpp: (WebCore::ScopedEventQueue::enqueueEvent): (WebCore::ScopedEventQueue::dispatchEvent const): (WebCore::ScopedEventQueue::dispatchAllEvents): * dom/ScopedEventQueue.h: 2020-05-21 Sihui Liu <sihui_liu@apple.com> SQLite database fails to close in SQLiteIDBBackingStore::databaseNameFromFile https://bugs.webkit.org/show_bug.cgi?id=212090 Reviewed by Darin Adler. We should finish SQLite statement before closing database. * Modules/indexeddb/server/SQLiteIDBBackingStore.cpp: (WebCore::IDBServer::SQLiteIDBBackingStore::databaseNameFromFile): 2020-05-21 Doug Kelly <dougk@apple.com> Dispatch pending events only for current page https://bugs.webkit.org/show_bug.cgi?id=211975 <rdar://problem/58942759> Reviewed by Chris Dumez. Document::implicitClose() should not dispatch events globally. The EventSender class operates as a singleton pattern for each event queue, so to add some means to restrict which documents are handling events, we can send the current page pointer and only dispatch the event if the event is for the same page. Other events are simply re-enqueued to be triggered at a later time. * dom/Document.cpp: (WebCore::Document::implicitClose): * dom/EventSender.h: (WebCore::EventSender::timerFired): (WebCore::EventSender<T>::dispatchPendingEvents): * html/HTMLLinkElement.cpp: (WebCore::HTMLLinkElement::dispatchPendingLoadEvents): * html/HTMLLinkElement.h: * html/HTMLStyleElement.cpp: (WebCore::HTMLStyleElement::dispatchPendingLoadEvents): * html/HTMLStyleElement.h: * loader/ImageLoader.cpp: (WebCore::ImageLoader::dispatchPendingBeforeLoadEvents): (WebCore::ImageLoader::dispatchPendingLoadEvents): (WebCore::ImageLoader::dispatchPendingErrorEvents): * loader/ImageLoader.h: (WebCore::ImageLoader::document): * xml/parser/XMLDocumentParser.cpp: (WebCore::XMLDocumentParser::append): 2020-05-21 Simon Fraser <simon.fraser@apple.com> [macOS] Scrolling synchronization part 2: Have the scrolling thread detect when the main thread is slow to respond to start a rendering update https://bugs.webkit.org/show_bug.cgi?id=212175 Reviewed by Tim Horton. The scrolling thread now detects when a main thread rendering update is taking too long, going into desynchronized mode when that happens. However, there's another state that needs to be handled, which is the main thread being busy and taking too long to start the rendering update. The scrolling thread gets a "displayDidRefresh" ping and expects that the main thread will get the same ping, and use it to start the rendering update, but a busy main thread won't respond to this ping promptly. Detect this with a short-duration (1ms) timer that fires on the scrolling thread; if the timer fires we go into desynchronized mode until the next update. The timer is canceled if the scrolling thread receives the willStartRenderingUpdate(). * page/scrolling/ThreadedScrollingTree.cpp: (WebCore::ThreadedScrollingTree::waitForRenderingUpdateCompletionOrTimeout): (WebCore::ThreadedScrollingTree::scheduleDelayedRenderingUpdateDetectionTimer): (WebCore::ThreadedScrollingTree::delayedRenderingUpdateDetectionTimerFired): (WebCore::ThreadedScrollingTree::displayDidRefreshOnScrollingThread): * page/scrolling/ThreadedScrollingTree.h: 2020-05-21 Sergio Villar Senin <svillar@igalia.com> [css-grid] [css-flex] Width of table as grid/flex item is infinite when the sum of columns' width exceed 100% https://bugs.webkit.org/show_bug.cgi?id=191365 Reviewed by Manuel Rego Casasnovas. Automatic table layout algorithm generates infinite width tables (tableMaxWidth to be more exact) when the sum of the columns percentages exceed the 100% value and there is at least one non-percentage based column with positive width as in those cases it's impossible to fulfill the table constrains. That should not be done in the case of the table being a flex or a grid item because they both define new formatting contexts. Based on Blink's crrev.com/1095220 by <mstensho@chromium.org> * rendering/AutoTableLayout.cpp: (WebCore::shouldScaleColumnsForParent): return false when the table is either a grid or a flex item. 2020-05-21 Zalan Bujtas <zalan@apple.com> [ macOS debug ] REGRESSION: fast/layoutformattingcontext/table-basic-row-baseline-with-nested-table.html is a flaky crash https://bugs.webkit.org/show_bug.cgi?id=212139 <rdar://problem/63447683> Reviewed by Antti Koivisto. Uninitialized row baseline value caused unexpected cell height in nested tables. * layout/tableformatting/TableFormattingContext.cpp: (WebCore::Layout::TableFormattingContext::setUsedGeometryForRows): * layout/tableformatting/TableGrid.h: 2020-05-21 Zalan Bujtas <zalan@apple.com> [LFC][TFC] Collapse in-between cell borders https://bugs.webkit.org/show_bug.cgi?id=212183 Reviewed by Antti Koivisto. This patch expands border collapsing to in-between cell borders. Test: fast/layoutformattingcontext/table-simple-border-collapse3.html * layout/tableformatting/TableFormattingContext.cpp: (WebCore::Layout::TableFormattingContext::layoutCell): * layout/tableformatting/TableFormattingContext.h: * layout/tableformatting/TableFormattingContextGeometry.cpp: (WebCore::Layout::TableFormattingContext::Geometry::computedCellBorder const): (WebCore::Layout::TableFormattingContext::Geometry::intrinsicWidthConstraintsForCell): 2020-05-21 Enrique Ocaña González <eocanha@igalia.com> [GStreamer][GTK][WPE] Expose and honor the media content types requiring hardware support setting https://bugs.webkit.org/show_bug.cgi?id=211950 Reviewed by Adrian Perez de Castro. Provide the needed information about media content types requiring hardware support when asking the MediaPlayer about what types are supported. This was already being done from HTMLMediaElement for player selection, but not in MediaSource nor in MediaSource::addSourceBuffer() when the webpage used the MSE API to check type support. In order to ask for the mediaContentTypesRequiringHardwareSupport setting we need a reference to the current Document in all the places where we need to check type support. * Modules/mediasource/MediaSource.cpp: (WebCore::MediaSource::addSourceBuffer): Provide hardware content types extra info. (WebCore::MediaSource::isTypeSupported): Get hardware content types extra info from ScriptExecutionContext and provide it to a new refactored private version of isTypeSupported() which can also be reused from addSourceBuffer(). * Modules/mediasource/MediaSource.h: Changed isTypeSupported() prototype to take ScriptExecutionContext and added a new overloaded version of the method. * Modules/mediasource/MediaSource.idl: isTypeSupported() now provides a reference to ScriptExecutionContext. It's the only way to access the required document settings from a static method. * platform/graphics/gstreamer/GStreamerRegistryScanner.cpp: (WebCore::GStreamerRegistryScanner::isContentTypeSupported const): Factor ContentType discrimination logic common to MediaPlayerPrivateGStreamer and MediaPlayerPrivateGStreamerMSE. * platform/graphics/gstreamer/GStreamerRegistryScanner.h: Added new method. * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp: (WebCore::MediaPlayerPrivateGStreamer::supportsType): Provide hardware content types extra info when asking for type support. * platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.cpp: (WebCore::MediaPlayerPrivateGStreamerMSE::supportsType): Ditto. 2020-05-20 Simon Fraser <simon.fraser@apple.com> [macOS] Scrolling synchronization part 1: Have the scrolling thread wait half a frame for the main thread to complete the rendering update https://bugs.webkit.org/show_bug.cgi?id=212168 Reviewed by Tim Horton. Currently the scrolling thread is a free-running thread that moves layers around in response to wheel events, and asynchronously posts data about scrolled layers back to the main thread. That results in an almost guaranteed lack of synchronization between the displayed layer positions, and the web-exposed values for scroll position (element.scrollTop, window.pageYOffset etc). This is a frequent source of stuttering or jumpy web content when scrolling. The first step to fixing this is to synchronize the scrolling thread layer positions and the main thread state for the case where the main thread is responsive enough to render once per frame. This is achieved as follow: - When the main thread is starting a rendering update, Page::updateRendering() informs the scrolling tree via ScrollingCoordinatorMac::willStartRenderingUpdate(). This atomically waits for the scrolling thread to take the m_treeMutex (via a BinarySemaphore) and starts waiting on the m_stateCondition Condition. Now the main thread pulls the state of the scrolling tree via synchronizeStateFromScrollingTree() and uses it for the rendering update. - If the rendering update finishes within half a frame (8ms), then m_stateCondition is released, and the scrolling thread assumes that the main thread is going to commit layers rapidly enough to preserve 60fps scrolling. - If the rendering update takes too long, m_stateCondition times out, and the scrolling thread applies layer positions, triggering a CA commit on that thread. We no longer apply layer positions directly when handling wheel events. synchronizeStateFromScrollingTree() has to only pull state from nodes that have moved on the scrolling thread, so track that via ScrollingTreeScrollingNode::scrolledSinceLastCommit() and adjust the visitor function to make it available during scrolling tree traversal. * page/Page.cpp: (WebCore::Page::updateRendering): (WebCore::Page::finalizeRenderingUpdate): * page/scrolling/AsyncScrollingCoordinator.cpp: (WebCore::AsyncScrollingCoordinator::synchronizeStateFromScrollingTree): * page/scrolling/AsyncScrollingCoordinator.h: * page/scrolling/ScrollingCoordinator.h: (WebCore::ScrollingCoordinator::willStartRenderingUpdate): (WebCore::ScrollingCoordinator::didCompleteRenderingUpdate): (WebCore::ScrollingCoordinator::synchronizeStateFromScrollingTree): Deleted. * page/scrolling/ScrollingTree.cpp: (WebCore::ScrollingTree::handleWheelEvent): (WebCore::ScrollingTree::traverseScrollingTreeRecursive): (WebCore::ScrollingTree::commitTreeState): (WebCore::ScrollingTree::updateTreeFromStateNodeRecursive): (WebCore::ScrollingTree::applyLayerPositionsInternal): (WebCore::ScrollingTree::nominalFramesPerSecond): * page/scrolling/ScrollingTree.h: * page/scrolling/ScrollingTreeNode.h: (WebCore::ScrollingTreeNode::didCompleteCommitForNode): * page/scrolling/ScrollingTreeScrollingNode.cpp: (WebCore::ScrollingTreeScrollingNode::didCompleteCommitForNode): (WebCore::ScrollingTreeScrollingNode::currentScrollPositionChanged): * page/scrolling/ScrollingTreeScrollingNode.h: * page/scrolling/ThreadedScrollingTree.cpp: (WebCore::ThreadedScrollingTree::willStartRenderingUpdate): (WebCore::ThreadedScrollingTree::maxAllowableRenderingUpdateDurationForSynchronization): (WebCore::ThreadedScrollingTree::waitForRenderingUpdateCompletionOrTimeout): (WebCore::ThreadedScrollingTree::didCompleteRenderingUpdate): (WebCore::ThreadedScrollingTree::displayDidRefreshOnScrollingThread): * page/scrolling/ThreadedScrollingTree.h: (WebCore::ThreadedScrollingTree::treeMutex): * page/scrolling/mac/ScrollingCoordinatorMac.h: * page/scrolling/mac/ScrollingCoordinatorMac.mm: (WebCore::ScrollingCoordinatorMac::willStartRenderingUpdate): (WebCore::ScrollingCoordinatorMac::didCompleteRenderingUpdate): 2020-05-20 Chris Fleizach <cfleizach@apple.com> REGRESSION (iOS 13.4.1): SpeechSynthesisUtterance.onend event won't fire on cancel(). https://bugs.webkit.org/show_bug.cgi?id=211776 <rdar://problem/63130249> Reviewed by Per Arne Vollan. With the move to having speech synthesis happen in the client, the cancel case hits a snag. We cancel the speech job and clear out the current utterance. By the time the cancel callback comes back, the current utterance is gone and nothing happens. The fix is to process the speechError event immediately and not wait on the speech synthesizer -- which seems sane, since we're just cancelling a speech job. * Modules/speech/SpeechSynthesis.cpp: (WebCore::SpeechSynthesis::cancel): 2020-05-20 Darin Adler <darin@apple.com> Dictation context should be an object identifier, not a type-punned pointer https://bugs.webkit.org/show_bug.cgi?id=212174 Reviewed by Anders Carlsson. * Headers.cmake: Added DictationContext.h. * Sources.txt: Removed DictationAlternative.cpp. * WebCore.xcodeproj/project.pbxproj: Added DictationContext.h, removed DictationAlternative.cpp. * dom/DocumentMarker.h: Use DictationContext instead of uint64_t. * editing/AlternativeTextController.cpp: (WebCore::AlternativeTextController::timerFired): Ditto. * editing/AlternativeTextController.h: Ditto. * editing/DictationAlternative.h: Use DictationContext instead of uint64_t, but also use CharacterRange rather than two "unsigned" values. Also convert into a simple struct without constructors; don't really need those. * editing/DictationAlternative.cpp: Removed. * editing/DictationCommand.cpp: (WebCore::DictationCommand::collectDictationAlternativesInRange): Updated for changes to DictationAlternative. * editing/DictationContext.h: Added. * editing/Editor.h: Forward declare DictationAlternative rather than including its header. * editing/cocoa/AlternativeTextContextController.h: Use a pair of maps to bind NSTextAlternatives objects to object identifiers. Remove unnecessary explicit constructor and destructor. Also removed unnecessary use of WTF_MAKE_FAST_ALLOCATED, since this is only used as a data member of another class. Removed unused invalidContext constant. * editing/cocoa/AlternativeTextContextController.mm: Removed the unneeded includes. This file treats NSTextAlternatives as an opaque Objective-C type and so doesn't need any details of that class. (WebCore::AlternativeTextContextController::addAlternatives): Changed to return a DictationContext and use two maps, using HashMap::ensure to avoid double hashing. (WebCore::AlternativeTextContextController::alternativesForContext): Added a null check. (WebCore::AlternativeTextContextController::removeAlternativesForContext): Ditto. Also updated to remove from both maps. (WebCore::AlternativeTextContextController::clear): Clear both maps. * editing/cocoa/AlternativeTextUIController.h: Since this header is used only from Objective-C, removed use of OBJC_CLASS. Put showAlternatives inside a macOS-specific block. Use DictationContext instead of uint64_t. * editing/cocoa/AlternativeTextUIController.mm: (WebCore::AlternativeTextUIController::addAlternatives): Use DictationContext instead of uint64_t. (WebCore::AlternativeTextUIController::alternativesForContext): Ditto. (WebCore::AlternativeTextUIController::showAlternatives): Ditto. (WebCore::AlternativeTextUIController::handleAcceptedAlternative): Ditto. (WebCore::AlternativeTextUIController::removeAlternatives): Ditto. * page/AlternativeTextClient.h: Use DictationContext instead of uint64_t. 2020-05-20 Zalan Bujtas <zalan@apple.com> [LFC][TFC] Preferred width computation should take border collapsing into account https://bugs.webkit.org/show_bug.cgi?id=212141 Reviewed by Antti Koivisto. Test: fast/layoutformattingcontext/table-simple-border-collapse2.html * layout/tableformatting/TableFormattingContext.cpp: (WebCore::Layout::TableFormattingContext::computedPreferredWidthForColumns): * layout/tableformatting/TableFormattingContext.h: (WebCore::Layout::TableFormattingContext::Geometry::Geometry): * layout/tableformatting/TableFormattingContextGeometry.cpp: (WebCore::Layout::TableFormattingContext::Geometry::intrinsicWidthConstraintsForCell): 2020-05-20 Zalan Bujtas <zalan@apple.com> Repaint issues when the login field collapses on music.apple.com https://bugs.webkit.org/show_bug.cgi?id=212101 <rdar://problem/62874369> Reviewed by Simon Fraser. RenderWidgets (e.g iframe) are painted on integral pixel boundaries. When we issue the repaints on such renderers, we need to make sure that the repaint rectangles are also snapped to integral pixel values. Currently trunk only covers the case when the renderer itself is positioned on a subpixel position (e.g when the containing block's content box has a non-integral position value). This patch ensures that we repaint the RenderWidgets properly when a non-direct ancestor puts the renderer on a subpixel position. Test: fast/repaint/iframe-on-subpixel-position.html * page/FrameView.h: * rendering/RenderBox.cpp: (WebCore::RenderBox::computeVisibleRectInContainer const): * rendering/RenderLayerBacking.cpp: (WebCore::RenderLayerBacking::setContentsNeedDisplay): (WebCore::RenderLayerBacking::setContentsNeedDisplayInRect): * rendering/RenderObject.h: * testing/Internals.cpp: (WebCore::Internals::enableSubframeRepaintTracking): add subframe repaint tracking (WebCore::Internals::disableSubframeRepaintTracking): * testing/Internals.h: * testing/Internals.idl: 2020-05-20 Oriol Brufau <obrufau@igalia.com> Computed min-width/height for auto depends on box https://bugs.webkit.org/show_bug.cgi?id=209651 Reviewed by Manuel Rego Casasnovas. Resolved value of min-width and min-height for auto min sizing of flex and grid items may be 'auto'. We based this on the computed style of the shadow including parent. Instead we should rely on whether the element will actually be a rendered flex/grid item. The difference matters e.g. when the parent has 'display: contents' and thus is not a flex nor grid container, but the element can still be a flex or grid item, depending on the grand-parent. This patch is based on https://crrev.com/540901 from Chromium. Tests: imported/w3c/web-platform-tests/css/css-flexbox/getcomputedstyle/flexbox_computedstyle_min-auto-size.html imported/w3c/web-platform-tests/css/css-grid/grid-items/grid-item-min-auto-size-001.html * css/CSSComputedStyleDeclaration.cpp: (WebCore::isFlexOrGridItem): (WebCore::ComputedStyleExtractor::valueForPropertyInStyle): 2020-05-20 Alex Christensen <achristensen@webkit.org> Remove implicit URL->String conversion operators https://bugs.webkit.org/show_bug.cgi?id=211033 Reviewed by Darin Adler. * accessibility/AccessibilityRenderObject.cpp: (WebCore::AccessibilityRenderObject::stringValueForMSAA const): * html/DOMURL.cpp: (WebCore::DOMURL::create): * html/HTMLPlugInElement.cpp: (WebCore::pluginReplacementForType): * html/URLUtils.h: (WebCore::URLUtils<T>::protocol const): (WebCore::URLUtils<T>::setUsername): (WebCore::URLUtils<T>::setPassword): * page/Location.cpp: (WebCore::Location::setProtocol): (WebCore::Location::setHost): (WebCore::Location::setHostname): (WebCore::Location::setPort): (WebCore::Location::setPathname): (WebCore::Location::setSearch): (WebCore::Location::setHash): * platform/graphics/MediaPlayer.cpp: (WebCore::MediaPlayer::load): 2020-05-20 Sam Weinig <weinig@apple.com> Replace Color::getHSL() with sRGBToHSL to ensure it at least gives somewhat sensible results for ExtendedColors and reduce code duplication https://bugs.webkit.org/show_bug.cgi?id=212143 Reviewed by Simon Fraser. - Updated API tests to test sRGBToHSL() rather than Color::getHSL() and extended the tests to include lightness tests and round tripping tests. - Update editing/pasteboard/paste-dark-mode-color-filtered.html with extended color test cases. Replaces Color::getHSL() with sRGBToHSL(color.toSRGBAComponentsLossy()) and adds an optimized variant, lightness(...) that just extracts the lightness component for callers that only needed that. It is now required to explicitly use color.toSRGBAComponentsLossy() to indicate that for non-SRGB colors, this will be a lossy transformation and give us an easy way to find all these sites in the future, if we want to make a better conversion for other color spaces. * editing/ReplaceSelectionCommand.cpp: (WebCore::fragmentNeedsColorTransformed): Switch to using lightness(). This was previously broken for extended colors but now works (though in a lossy way through sRGB). Update editing/pasteboard/paste-dark-mode-color-filtered.html with extended colors. * editing/cocoa/DataDetection.mm: (WebCore::DataDetection::detectContentInRange): Switch to using sRGBToHSL(color.toSRGBAComponentsLossy()). * page/FrameView.cpp: (WebCore::FrameView::recalculateScrollbarOverlayStyle): Switch to using lightness(). * platform/graphics/Color.cpp: (WebCore::Color::getHSL const): Deleted. * platform/graphics/Color.h: Remove Color::getHSL(). * platform/graphics/ColorUtilities.cpp: (WebCore::lightness): Added optimized subset of sRGBToHSL which just computes the lightness component for callers that only need that. (WebCore::sRGBToHSL): Simplify/cleanup code a little using initialize-list based std::max/std::min and structured bindings. * platform/graphics/ColorUtilities.h: Export functions to allow testing them directly. 2020-05-20 Megan Gardner <megan_gardner@apple.com> Hide password echo when screen is being captured. https://bugs.webkit.org/show_bug.cgi?id=212060 <rdar://problem/47653578> Reviewed by Wenson Hsieh. When the screen is being captured, turn off the password echo. * editing/InsertIntoTextNodeCommand.cpp: (WebCore::InsertIntoTextNodeCommand::doApply): * page/EditorClient.h: (WebCore::EditorClient::isScreenCaptured const): 2020-05-20 ChangSeok Oh <changseok@webkit.org> [GTK] Implement connected and disconnected events of GAMEPAD API with libmanette https://bugs.webkit.org/show_bug.cgi?id=133854 Reviewed by Carlos Garcia Campos. This patch brings initial GAMEPAD API support to the gtk port. We use libmanette, a simple GObject game controller library to handle gamepad connection and input. This change aims to implement two GAMEPAD API events: 'gamepadconnected' and 'gamepaddisconnected' on top of libmanette. Rest of API will be implemented by following patches. No new tests since existing tests can cover this change. * PlatformGTK.cmake: Add header & library paths for libmanette. * SourcesGTK.txt: * platform/gamepad/manette/GUniquePtrManette.h: Added to define a smart pointer for ManetteMonitor. * platform/gamepad/manette/ManetteGamepad.cpp: Added. A wrapper class for ManetteDevice. A ManetteGamepad instance is created per a physically connected gamepad. Currently, it is empty but input handling login will be placed in this class. (WebCore::ManetteGamepad::ManetteGamepad): * platform/gamepad/manette/ManetteGamepad.h: Added. * platform/gamepad/manette/ManetteGamepadProvider.cpp: Added. A manager class for ManetteGamepad instances. This class represents ManetteMonitor that handles connection and disconnection of gamepads. Many parts of this class implementation is brought from HIDGamepad.cpp (WebCore::ManetteGamepadProvider::singleton): (WebCore::onDeviceConnected): (WebCore::onDeviceDisconnected): (WebCore::ManetteGamepadProvider::ManetteGamepadProvider): (WebCore::ManetteGamepadProvider::startMonitoringGamepads): (WebCore::ManetteGamepadProvider::stopMonitoringGamepads): (WebCore::ManetteGamepadProvider::deviceConnected): (WebCore::ManetteGamepadProvider::deviceDisconnected): (WebCore::ManetteGamepadProvider::indexForNewlyConnectedDevice): (WebCore::ManetteGamepadProvider::connectionDelayTimerFired): (WebCore::ManetteGamepadProvider::removeGamepadForDevice): * platform/gamepad/manette/ManetteGamepadProvider.h: Added. 2020-05-20 Antoine Quint <graouts@apple.com> Potential crash in PointerCaptureController::cancelPointer() https://bugs.webkit.org/show_bug.cgi?id=208347 <rdar://problem/59866247> Reviewed by David Kilzer and Daniel Bates. * page/PointerCaptureController.cpp: (WebCore::PointerCaptureController::cancelPointer): 2020-05-20 Oriol Brufau <obrufau@igalia.com> [css-grid] Fix auto repeat with multiple tracks and gutters https://bugs.webkit.org/show_bug.cgi?id=182922 Reviewed by Manuel Rego Casasnovas. The code that computes the number of auto repeat tracks wrongly assumes that the second argument of the repeat() notation is a single track function. That was true in the beginning, however specs were later on modified to allow a <track-list>. We support a <track-list> as a second argument since long ago but the code that computes the number of auto-repeat tracks was never updated. This patch modifies two places that relate to the gaps between the auto-repeat tracks, which ensures the proper total length. This is a port of https://crrev.com/620278 from Chromium. Tests: fast/css-grid-layout/grid-auto-repeat-huge-grid.html imported/w3c/web-platform-tests/css/css-grid/grid-definition/grid-auto-repeat-multiple-values-001.html * rendering/RenderGrid.cpp: (WebCore::RenderGrid::computeAutoRepeatTracksCount const): 2020-05-20 Simon Fraser <simon.fraser@apple.com> Plumb the display's nominal refresh rate down to ScrollingTree for use in scroll synchronization https://bugs.webkit.org/show_bug.cgi?id=212159 Reviewed by Tim Horton. Plumb an Optional<unsigned> down windowScreenDidChange, which contains the nominal display refresh rate (as frames per second) if available. On macOS, we get this from CVDisplayLinkGetNominalOutputVideoRefreshPeriod(). To read it, WebProcessPool::nominalFramesPerSecondForDisplay() makes a DisplayLink that doesn't get any observers, but that DisplayLink will very likely get used as soon as we schedule a rendering update. * page/Chrome.cpp: (WebCore::Chrome::windowScreenDidChange): * page/Chrome.h: * page/Page.cpp: (WebCore::Page::scrollingCoordinator): (WebCore::Page::windowScreenDidChange): * page/Page.h: (WebCore::Page::displayNominalFramesPerSecond const): * page/scrolling/AsyncScrollingCoordinator.cpp: (WebCore::AsyncScrollingCoordinator::windowScreenDidChange): * page/scrolling/AsyncScrollingCoordinator.h: * page/scrolling/ScrollingCoordinator.h: (WebCore::ScrollingCoordinator::windowScreenDidChange): * page/scrolling/ScrollingTree.cpp: (WebCore::ScrollingTree::windowScreenDidChange): * page/scrolling/ScrollingTree.h: * platform/HostWindow.h: 2020-05-20 Chris Dumez <cdumez@apple.com> Disable support for BeforeLoadEvent https://bugs.webkit.org/show_bug.cgi?id=212140 <rdar://problem/62847577> Reviewed by Antti Koivisto. Disable support for BeforeLoadEvent. Other browsers do not support it and Chrome dropped it shortly after the fork: - https://bugs.chromium.org/p/chromium/issues/detail?id=333318 This is a synchronous event and therefore very dangerous. Test: fast/frames/didBecomeCurrentDocumentInFrame-crash.html * bindings/js/WebCoreBuiltinNames.h: * dom/BeforeLoadEvent.idl: * dom/Node.cpp: (WebCore::Node::dispatchBeforeLoadEvent): * page/RuntimeEnabledFeatures.h: (WebCore::RuntimeEnabledFeatures::setLegacyBeforeLoadEventEnabled): (WebCore::RuntimeEnabledFeatures::legacyBeforeLoadEventEnabled const): 2020-05-20 Zalan Bujtas <zalan@apple.com> RenderObject::VisibleRectContext members should not be prefixed with m_ https://bugs.webkit.org/show_bug.cgi?id=212154 Reviewed by Simon Fraser. * rendering/RenderBox.cpp: (WebCore::RenderBox::applyCachedClipAndScrollPosition const): (WebCore::RenderBox::computeVisibleRectInContainer const): * rendering/RenderInline.cpp: (WebCore::RenderInline::computeVisibleRectInContainer const): * rendering/RenderObject.cpp: (WebCore::RenderObject::computeVisibleRectInContainer const): * rendering/RenderObject.h: * rendering/RenderTableCell.cpp: (WebCore::RenderTableCell::computeVisibleRectInContainer const): * rendering/RenderView.cpp: (WebCore::RenderView::computeVisibleRectInContainer const): * rendering/svg/RenderSVGRoot.cpp: (WebCore::RenderSVGRoot::computeFloatVisibleRectInContainer const): 2020-05-20 Myles C. Maxfield <mmaxfield@apple.com> [iPadOS] -webkit-text-size-adjust:percentage doesn't work https://bugs.webkit.org/show_bug.cgi?id=212122 <rdar://problem/54560875> Reviewed by Wenson Hsieh. We've gotten many bug reports that -webkit-text-size-adjust:X% no longer works in WebKit on iPads. We don't want to just start honoring the value, because our testing indicates that, with desktop-class browsing on iPad, more sites work better when we don't honor percentages. However, if Safari is using the mobile content mode, or if a native app has local content, it should be possible to get the old behavior of honoring percentages. This patch adds a new Setting, idempotentModeAutosizingOnlyHonorsPercentages, which is hooked up to the desktop-class browsing feature. When WebPageProxy::effectiveContentModeAfterAdjustingPolicies() determines that the WebContentMode::Mobile mode should be used, it sets the new setting, which causes idempotent text autosizing mode to have the same behavior that WKWebViews on iPadOS used to have: -w-t-s-a:auto and -w-t-s-a:none have no effect, but -w-t-s-a:X% is honored. This affects both Safari and WKWebView apps. If a native app wants the old behavior, they can set WKWebpagePreferences.preferredContentMode = WKContentModeMobile to force the old iPad behavior. It's expected that apps with legacy content would be doing this anyway. Tests: fast/text-autosizing/ios/idempotentmode/idempotent-percentage.html TestWebKitAPI.PreferredContentMode.IdempotentModeAutosizingOnlyHonorsPercentages * loader/DocumentLoader.cpp: (WebCore::DocumentLoader::applyPoliciesToSettings): * loader/DocumentLoader.h: (WebCore::DocumentLoader::setIdempotentModeAutosizingOnlyHonorsPercentages): (WebCore::DocumentLoader::idempotentModeAutosizingOnlyHonorsPercentages const): * page/Settings.yaml: * style/StyleAdjuster.cpp: (WebCore::Style::Adjuster::adjustmentForTextAutosizing): * style/StyleBuilderCustom.h: (WebCore::Style::computeBaseSpecifiedFontSize): * style/StyleBuilderState.cpp: (WebCore::Style::BuilderState::updateFontForTextSizeAdjust): 2020-05-20 ChangSeok Oh <changseok@webkit.org> Move the TextStream logging definition in VisibleSelection.cpp to the outside of the TREE_DEBUGGING guard https://bugs.webkit.org/show_bug.cgi?id=212127 Reviewed by Simon Fraser. A linking failure occurs after r261819 where ENABLE_TREE_DEBUGGING is disabled. The TextStream logging defining is placed inside the guard while its declaration is not since r218976. Build fix, no functionality changed. * editing/VisibleSelection.cpp: (WebCore::operator<<): 2020-05-20 Andres Gonzalez <andresg_22@apple.com> Fix for accessibility-node-memory-management.html in isolated tree mode. https://bugs.webkit.org/show_bug.cgi?id=212142 Reviewed by Chris Fleizach. LayoutTests/accessibility/accessibility-node-memory-management.html. - Fix in applyPendingChanges that was not removing removed nodes from the nodes map. This was causing that some detached AXIsolatedObjects were being returned. - Also handle the case where pending changes can come from a detached AXObject with invalid ID and no platform wrapper. - updateChildren better handles the case when the notification target is not in the isolated tree by walking up the object hierarchy until it finds an associated object that does have a corresponding isolated object. * accessibility/isolatedtree/AXIsolatedTree.cpp: (WebCore::AXIsolatedTree::treeForPageID): (WebCore::AXIsolatedTree::updateChildren): (WebCore::AXIsolatedTree::applyPendingChanges): 2020-05-20 Antoine Quint <graouts@apple.com> [Web Animations] Animation engine should not wake up every tick for steps timing functions https://bugs.webkit.org/show_bug.cgi?id=212103 <rdar://problem/62737868> Unreviewed. Clean up some stray FIXMEs mistakenly commited in the previous commit. * animation/AnimationTimeline.cpp: (WebCore::AnimationTimeline::updateCSSTransitionsForElementAndProperty): * style/StyleTreeResolver.cpp: (WebCore::Style::TreeResolver::createAnimatedElementUpdate): 2020-05-20 Antoine Quint <graouts@apple.com> [Web Animations] Animation engine should not wake up every tick for steps timing functions https://bugs.webkit.org/show_bug.cgi?id=212103 <rdar://problem/62737868> Reviewed by Simon Fraser. Tests: webanimations/scheduling-of-animation-with-steps-timing-function-on-effect.html webanimations/scheduling-of-animation-with-steps-timing-function-on-keyframe.html webanimations/scheduling-of-css-animation-with-explicit-steps-timing-function-on-some-keyframes.html webanimations/scheduling-of-css-animation-with-implicit-steps-timing-function.html When an animation uses a steps() timing function, it will appear to animate discretely between values such that there is only n visual changes, where n is the number of steps provided. This gives us an opportunity to be more efficient when scheduling animations using steps() timing functions. In WebAnimation::timeToNextTick() we now ask the associated effect for the amount of progress until the next step. For an effect-wide steps() timing function, we can use the provided iteration progress. For animations with a linear effect-wide timing function (the default), we have to map the provided iteration progress to a keyframe interval, provided that interval uses a steps() timing function. The new {Animation|Keyframe}Effect::progressUntilNextStep() method returns WTF::nullopt for any other case. In order to test this, we add a new internals.timeToNextAnimationTick(animation) method which we use in the two new tests. * animation/AnimationEffect.cpp: (WebCore::AnimationEffect::progressUntilNextStep const): * animation/AnimationEffect.h: * animation/KeyframeEffect.cpp: (WebCore::KeyframeEffect::setBlendingKeyframes): (WebCore::KeyframeEffect::computeSomeKeyframesUseStepsTimingFunction): (WebCore::KeyframeEffect::timingFunctionForKeyframeAtIndex const): Avoid any out-of-bounds use of the underlying data structures by returning nullptr for cases where we don't have an explicit keyframe. We also make the function const such that it may be called from progressUntilNextStep(), it always was const but wasn't marked as such. (WebCore::KeyframeEffect::progressUntilNextStep const): * animation/KeyframeEffect.h: * animation/WebAnimation.cpp: (WebCore::WebAnimation::timeToNextTick const): * animation/WebAnimation.h: * animation/WebAnimation.idl: * testing/Internals.cpp: (WebCore::Internals::timeToNextAnimationTick const): * testing/Internals.h: * testing/Internals.idl: 2020-05-20 Noam Rosenthal <noam@webkit.org> Fix table sizing when 'max-width' is used https://bugs.webkit.org/show_bug.cgi?id=115156 Reviewed by Zalan Bujtas. Based on previous patch by László Langó <lango@inf.u-szeged.hu> Test: fast/table/html-table-width-max-width-constrained.html A table should always be wide enough to contain its content (preferred logical width). This constraint should be stronger than the table style's specified min-width/width. The behavior matches the spec, and behavior on Firefox/Chrome. * rendering/RenderTable.cpp: (WebCore::RenderTable::updateLogicalWidth): Max-width should only affect the table's max preferred width. (WebCore::RenderTable::computePreferredLogicalWidths): Change the order of constraints so that content constraint is stronger than style width/max-width constraint. 2020-05-20 Carlos Garcia Campos <cgarcia@igalia.com> REGRESSION(r261554): [GTK] Version 2.29.1 crashes using drag-n-drop API https://bugs.webkit.org/show_bug.cgi?id=212136 Reviewed by Adrian Perez de Castro. * platform/gtk/PasteboardGtk.cpp: (WebCore::Pasteboard::read): Use m_selectionData if present. 2020-05-20 Philippe Normand <pnormand@igalia.com> [GStreamer] <img> tag needs to support video formats https://bugs.webkit.org/show_bug.cgi?id=180370 Reviewed by Xabier Rodriguez-Calvar. GStreamer implementation of the ImageDecoder. It currently doesn't support zero-copy rendering though due to the the NativeImagePtr requirement. * platform/GStreamer.cmake: * platform/MIMETypeRegistry.cpp: (WebCore::MIMETypeRegistry::isSupportedImageVideoOrSVGMIMEType): * platform/graphics/ImageDecoder.cpp: (WebCore::ImageDecoder::create): (WebCore::ImageDecoder::supportsMediaType): * platform/graphics/gstreamer/ImageDecoderGStreamer.cpp: Added. (WebCore::toSample): (WebCore::ImageDecoderGStreamer::create): (WebCore::ImageDecoderGStreamer::ImageDecoderGStreamer): (WebCore::ImageDecoderGStreamer::supportsContainerType): (WebCore::ImageDecoderGStreamer::canDecodeType): (WebCore::ImageDecoderGStreamer::encodedDataStatus const): (WebCore::ImageDecoderGStreamer::size const): (WebCore::ImageDecoderGStreamer::repetitionCount const): (WebCore::ImageDecoderGStreamer::uti const): (WebCore::ImageDecoderGStreamer::frameOrientationAtIndex const): (WebCore::ImageDecoderGStreamer::frameDurationAtIndex const): (WebCore::ImageDecoderGStreamer::frameHasAlphaAtIndex const): (WebCore::ImageDecoderGStreamer::frameBytesAtIndex const): (WebCore::ImageDecoderGStreamer::createFrameImageAtIndex): (WebCore::ImageDecoderGStreamer::setData): (WebCore::ImageDecoderGStreamer::clearFrameBufferCache): (WebCore::ImageDecoderGStreamer::sampleAtIndex const): (WebCore::ImageDecoderGStreamer::InnerDecoder::decodebinPadAddedCallback): (WebCore::ImageDecoderGStreamer::InnerDecoder::connectDecoderPad): (WebCore::ImageDecoderGStreamer::handleSample): (WebCore::ImageDecoderGStreamer::InnerDecoder::handleMessage): (WebCore::ImageDecoderGStreamer::InnerDecoder::preparePipeline): (WebCore::ImageDecoderGStreamer::InnerDecoder::run): (WebCore::ImageDecoderGStreamer::InnerDecoder::encodedDataStatus const): (WebCore::ImageDecoderGStreamer::pushEncodedData): * platform/graphics/gstreamer/ImageDecoderGStreamer.h: Added. * platform/graphics/gstreamer/ImageGStreamer.h: (WebCore::ImageGStreamer::createImage): (WebCore::ImageGStreamer::image): (WebCore::ImageGStreamer::setCropRect): (WebCore::ImageGStreamer::rect): (WebCore::ImageGStreamer::hasAlpha const): * platform/graphics/gstreamer/ImageGStreamerCairo.cpp: (WebCore::ImageGStreamer::ImageGStreamer): * platform/graphics/gstreamer/MediaSampleGStreamer.h: 2020-05-20 Andy Estes <aestes@apple.com> [Mac] UI processes spin when creating the "Share" context menu item https://bugs.webkit.org/show_bug.cgi?id=212137 <rdar://problem/54498394> Reviewed by Wenson Hsieh. Ran update-webkit-localizable-strings. * en.lproj/Localizable.strings: 2020-05-20 Zalan Bujtas <zalan@apple.com> [LFC][TFC] Internal table boxes should take collapsed border into account https://bugs.webkit.org/show_bug.cgi?id=212135 Reviewed by Antti Koivisto. Use the collapsed border value to compute the borders for sections, rows and cells. The collapsed border is propagated to the table box and the adjacent cell boxes. Test: fast/layoutformattingcontext/table-simple-border-collapse.html * layout/LayoutUnits.h: (WebCore::Layout::operator/): * layout/blockformatting/tablewrapper/TableWrapperBlockFormattingContext.cpp: (WebCore::Layout::TableWrapperBlockFormattingContext::computeBorderAndPaddingForTableBox): * layout/tableformatting/TableFormattingContext.cpp: (WebCore::Layout::TableFormattingContext::setUsedGeometryForRows): (WebCore::Layout::TableFormattingContext::setUsedGeometryForSections): (WebCore::Layout::TableFormattingContext::layoutCell): * layout/tableformatting/TableGrid.h: (WebCore::Layout::TableGrid::setCollapsedBorder): (WebCore::Layout::TableGrid::collapsedBorder const): 2020-05-20 Youenn Fablet <youenn@apple.com> [Mac] Use preferedPixelBufferFormat for AVVideoCaptureSource https://bugs.webkit.org/show_bug.cgi?id=212071 Reviewed by Eric Carlson. Manually tested. * platform/mediastream/mac/AVVideoCaptureSource.mm: (WebCore::avVideoCapturePixelBufferFormat): 2020-05-20 Carlos Garcia Campos <cgarcia@igalia.com> Unreviewed. Fix GTK4 build with GTK 3.98.4 * platform/gtk/GtkUtilities.cpp: (WebCore::convertWidgetPointToScreenPoint): * platform/gtk/GtkVersioning.h: (gtk_widget_destroy): * platform/gtk/PlatformScreenGtk.cpp: (WebCore::screenDPI): 2020-05-12 Carlos Garcia Campos <cgarcia@igalia.com> [GTK4] Add support for drag and drop operations https://bugs.webkit.org/show_bug.cgi?id=211779 Reviewed by Adrian Perez de Castro. Move the code to create a GdkTexture from an Image from CursorGtk to ImageGtk and add Image::gdkTexture(). * platform/graphics/BitmapImage.h: * platform/graphics/Image.h: (WebCore::Image::gdkTexture): * platform/graphics/gtk/ImageGtk.cpp: (WebCore::BitmapImage::gdkTexture): * platform/gtk/CursorGtk.cpp: (WebCore::createCustomCursor): 2020-05-20 Sam Weinig <weinig@apple.com> Remove unused Color::getHSV function https://bugs.webkit.org/show_bug.cgi?id=212119 Reviewed by Simon Fraser. * platform/graphics/Color.cpp: (WebCore::Color::getHSV const): Deleted. * platform/graphics/Color.h: Remove Color::getHSV(). It was unused outside of the API test for it. 2020-05-20 Youenn Fablet <youenn@apple.com> Allow calling VideoSampleObserver::videoSampleAvailable from a background thread https://bugs.webkit.org/show_bug.cgi?id=212024 Reviewed by Eric Carlson. Allow RealtimeMediaSource::videoSampleAvailable to be called on a background thread, typically the capture thread. Make WebRTC remote sources and mock capture sources do that. RealtimeMediaSource is then updating its intrinsic size from the generation thread while updating its size in the main thread. The size() getter can be called from both threads. Existing consumers do the following: - media player will hop to the main thread. - media recorder will do processing from the background thread. - WebRTC sender will do processing from the background thread, except when sending black frames where this will still be done on the main thread. This is ok as we ensure either we send black frames on the main thread (and we do not observe the source) or we observe the source to send. Follow-ups will migrate the real capture sources as well as migrating media player processing out of the main thread. Covered by existing tests. * platform/MediaSample.h: * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm: (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::MediaPlayerPrivateMediaStreamAVFObjC): (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::videoSampleAvailable): * platform/mediastream/RealtimeMediaSource.cpp: (WebCore::RealtimeMediaSource::videoSampleAvailable): (WebCore::RealtimeMediaSource::setIntrinsicSize): * platform/mediastream/RealtimeMediaSource.h: * platform/mediastream/mac/MockRealtimeVideoSourceMac.h: * platform/mediastream/mac/MockRealtimeVideoSourceMac.mm: (WebCore::MockRealtimeVideoSourceMac::MockRealtimeVideoSourceMac): (WebCore::MockRealtimeVideoSourceMac::updateSampleBuffer): * platform/mediastream/mac/RealtimeIncomingVideoSourceCocoa.h: * platform/mediastream/mac/RealtimeIncomingVideoSourceCocoa.mm: (WebCore::RealtimeIncomingVideoSourceCocoa::OnFrame): (WebCore::RealtimeIncomingVideoSourceCocoa::processNewSample): Deleted. 2020-05-20 Oriol Brufau <obrufau@igalia.com> Fix computeMarginLogicalSizeForChild to check auto margins in the right axis https://bugs.webkit.org/show_bug.cgi?id=212113 Reviewed by Manuel Rego Casasnovas. GridLayoutFunctions::computeMarginLogicalSizeForChild checks for 'auto' margins before retrieving the margin size, since these should be treated as 0. However, for orthogonal grid items, it used to check the wrong axis. So if an item had 'margin-top: auto' and 'margin-left: 5px', when asking for the horizontal margin we could get 0px instead of 5px due to the auto margin in the vertical axis. Test: imported/w3c/web-platform-tests/css/css-grid/grid-items/grid-items-minimum-width-orthogonal-001.html * rendering/GridLayoutFunctions.cpp: (WebCore::GridLayoutFunctions::computeMarginLogicalSizeForChild): (WebCore::GridLayoutFunctions::marginLogicalSizeForChild): 2020-05-19 Fujii Hironori <Hironori.Fujii@sony.com> [WinCairo] ASSERT(m_eglDisplay == EGL_NO_DISPLAY) fails in ~PlatformDisplay() https://bugs.webkit.org/show_bug.cgi?id=212065 Reviewed by Don Olmstead. PlatformDisplay destoys m_eglDisplay by using std::atexit to ensure they are destructed before EGL's atexit handler (Bug 157973). However, calling eglTerminate in atexit handler causes a crash on Windows (Bug 145832, Bug 170331). Then, r214688 added shutDownEglDisplays() and explicitly call it in shutDownWebKit() to destory m_eglDisplay in Windows WebKit1. However, Windows WebKit2 may call _exit() in IPC::Connection's WorkQueue thread. It doesn't seem a good idea that explicitly destructing m_eglDisplay by calling shutDownEglDisplays(). Remove shutDownEglDisplays() and the assertion for Windows. * platform/graphics/PlatformDisplay.cpp: (WebCore::PlatformDisplay::~PlatformDisplay): Conditioned out the assertion for PLATFORM(WIN). (WebCore::PlatformDisplay::initializeEGLDisplay): Restored the original atexit handler of r201595. (WebCore::PlatformDisplay::shutDownEglDisplays): Deleted. * platform/graphics/PlatformDisplay.h: 2020-05-19 Darin Adler <darin@apple.com> REGRESSION (r259930): Dictation marker at start of text is removed when added trailing whitespace is collapsed https://bugs.webkit.org/show_bug.cgi?id=212093 Reviewed by Daniel Bates. * dom/DocumentMarkerController.cpp: (WebCore::DocumentMarkerController::shiftMarkers): Use int to do the math before clamping to unsigned. This protects against underflow. 2020-05-19 Sam Weinig <weinig@apple.com> Remove almost always incorrect Color::getRGBA https://bugs.webkit.org/show_bug.cgi?id=212059 Reviewed by Darin Adler and Simon Fraser. Removes the awkward and almost always incorrect out parameter based Color::getRGBA. Most existing callsites were updated to use Color::toSRGBAComponentsLossy() or other more ExtendedColor supporting functions (like cachedCGColor()). Also adds tuple-like adaptors for FloatComponents to allow it to be used with structured bindings. For example: auto [r, g, b, a] = myFloatComponents; * platform/graphics/Color.h: * platform/graphics/Color.cpp: (WebCore::Color::light const): (WebCore::Color::dark const): (WebCore::Color::isDark const): Adopt toSRGBAComponentsLossy() to make these not return totally incorrect values. (WebCore::Color::colorSpaceAndComponents const): Added. Returns a std::pair<ColorSpace, FloatComponents> for functions that need to operate on the components in a ColorSpace aware way. Used by toSRGBAComponentsLossy and leakCGColor() for now, but will be useful going forward as well. (WebCore::Color::toSRGBAComponentsLossy const): Re-implement using colorSpaceAndComponents() to simplify implementation. (WebCore::Color::getRGBA const): Deleted. * platform/graphics/ColorUtilities.cpp: (WebCore::FloatComponents::FloatComponents): Deleted. (WebCore::sRGBColorToLinearComponents): Deleted. * platform/graphics/ColorUtilities.h: (WebCore::FloatComponents::get const): Remove uses of the Color class to simplify inlining (Color.h already needs to know about FloatComponents). - FloatComponents constructor replaced by Color::toSRGBAComponentsLossy(). - sRGBColorToLinearComponents replaced by calling rgbToLinearComponents(color.toSRGBAComponentsLossy()). Also adds std::tuple adaptors for FloatComponents to allow using with stuctured bindings. * page/cocoa/ResourceUsageOverlayCocoa.mm: (WebCore::HistoricMemoryCategoryInfo::HistoricMemoryCategoryInfo): Replace getRGBA with cachedCGColor. * platform/graphics/ca/win/PlatformCALayerWin.cpp: (PlatformCALayerWin::setBackgroundColor): Replace getRGBA with cachedCGColor. * platform/graphics/ca/win/PlatformCALayerWinInternal.cpp: (PlatformCALayerWinInternal::setBorderColor): Replace getRGBA with cachedCGColor. * platform/graphics/cairo/CairoUtilities.cpp: (WebCore::setSourceRGBAFromColor): Replace getRGBA with toSRGBAComponentsLossy. * platform/graphics/cairo/GradientCairo.cpp: (WebCore::addColorStopRGBA): (WebCore::setCornerColorRGBA): (WebCore::interpolateColorStop): Replace getRGBA with toSRGBAComponentsLossy. * platform/graphics/cg/ColorCG.cpp: (WebCore::leakCGColor): (WebCore::cachedCGColor): Simplify implementation (and remove use of getRGBA) by using colorSpaceAndComponents(). * platform/graphics/cg/GradientCG.cpp: (WebCore::Gradient::platformGradient): Replace getRGBA with colorSpaceAndComponent(). * platform/graphics/filters/FELighting.cpp: (WebCore::FELighting::drawLighting): Replace FloatComponents constructor taking a Color (which used getRGBA) with toSRGBAComponentsLossy. * platform/graphics/filters/FilterOperations.cpp: (WebCore::FilterOperations::transformColor const): (WebCore::FilterOperations::inverseTransformColor const): Replace getRGBA with toSRGBAComponentsLossy. * platform/graphics/gtk/ColorGtk.cpp: (WebCore::Color::operator GdkRGBA const): Replace getRGBA with toSRGBAComponentsLossy. * platform/graphics/texmap/TextureMapperGL.cpp: (WebCore::TextureMapperGL::drawBorder): (WebCore::TextureMapperGL::drawNumber): (WebCore::prepareFilterProgram): (WebCore::TextureMapperGL::drawSolidColor): Replace getRGBA with toSRGBAComponentsLossy. * platform/graphics/win/GradientDirect2D.cpp: (WebCore::Gradient::generateGradient): Replace getRGBA with toSRGBAComponentsLossy. * platform/graphics/win/GraphicsContextCGWin.cpp: (WebCore::GraphicsContext::drawDotsForDocumentMarker): (WebCore::setCGStrokeColor): Deleted. (WebCore::spellingPatternColor): Deleted. (WebCore::grammarPatternColor): Deleted. Replace use of getRGBA with direct use of SimpleColor instead. * rendering/TextPaintStyle.cpp: (WebCore::textColorIsLegibleAgainstBackgroundColor): Replace implicit FloatComponents construction taking a Color (which used getRGBA) with explicit toSRGBAComponentsLossy. 2020-05-19 Eric Carlson <eric.carlson@apple.com> Update some media logging https://bugs.webkit.org/show_bug.cgi?id=212109 Reviewed by Jer Noble. No new tests, no functional change. * html/HTMLMediaElement.cpp: (WebCore::HTMLMediaElement::insertedIntoAncestor): (WebCore::HTMLMediaElement::didFinishInsertingNode): (WebCore::HTMLMediaElement::removedFromAncestor): (WebCore::HTMLMediaElement::checkPlaybackTargetCompatablity): (WebCore::HTMLMediaElement::canPlayType const): (WebCore::HTMLMediaElement::waitForSourceChange): (WebCore::HTMLMediaElement::noneSupported): (WebCore::HTMLMediaElement::mediaLoadingFailed): (WebCore::HTMLMediaElement::fastSeek): (WebCore::HTMLMediaElement::seek): (WebCore::HTMLMediaElement::seekInternal): (WebCore::HTMLMediaElement::seekTask): (WebCore::HTMLMediaElement::finishSeek): (WebCore::HTMLMediaElement::currentMediaTime const): (WebCore::HTMLMediaElement::setPreload): (WebCore::HTMLMediaElement::playInternal): (WebCore::HTMLMediaElement::pauseInternal): (WebCore::HTMLMediaElement::setLoop): (WebCore::HTMLMediaElement::setControls): (WebCore::HTMLMediaElement::setVolume): (WebCore::HTMLMediaElement::setMuted): (WebCore::HTMLMediaElement::hardwareMutedStateDidChange): (WebCore::HTMLMediaElement::configureTextTrackGroup): (WebCore::HTMLMediaElement::mediaPlayerTimeChanged): (WebCore::HTMLMediaElement::mediaPlayerVolumeChanged): (WebCore::HTMLMediaElement::mediaPlayerMuteChanged): (WebCore::HTMLMediaElement::mediaPlayerDurationChanged): (WebCore::HTMLMediaElement::mediaPlayerRateChanged): (WebCore::HTMLMediaElement::mediaPlayerPlaybackStateChanged): (WebCore::HTMLMediaElement::mediaPlayerResourceNotSupported): (WebCore::HTMLMediaElement::mediaPlayerSizeChanged): (WebCore::HTMLMediaElement::mediaPlayerRenderingModeChanged): (WebCore::HTMLMediaElement::mediaPlayerEngineUpdated): (WebCore::HTMLMediaElement::mediaPlayerFirstVideoFrameAvailable): (WebCore::HTMLMediaElement::mediaPlayerCharacteristicChanged): (WebCore::HTMLMediaElement::updatePlayState): (WebCore::HTMLMediaElement::stop): (WebCore::HTMLMediaElement::suspend): (WebCore::HTMLMediaElement::resume): (WebCore::HTMLMediaElement::visibilityStateChanged): (WebCore::HTMLMediaElement::addEventListener): (WebCore::HTMLMediaElement::removeEventListener): (WebCore::HTMLMediaElement::enqueuePlaybackTargetAvailabilityChangedEvent): (WebCore::HTMLMediaElement::setShouldPlayToPlaybackTarget): (WebCore::HTMLMediaElement::remoteHasAvailabilityCallbacksChanged): (WebCore::HTMLMediaElement::enterFullscreen): (WebCore::HTMLMediaElement::exitFullscreen): (WebCore::HTMLMediaElement::didBecomeFullscreenElement): (WebCore::HTMLMediaElement::setClosedCaptionsVisible): (WebCore::HTMLMediaElement::mediaCanStart): (WebCore::HTMLMediaElement::setShouldDelayLoadEvent): (WebCore::HTMLMediaElement::suspendPlayback): (WebCore::HTMLMediaElement::resumeAutoplaying): (WebCore::HTMLMediaElement::mayResumePlayback): (WebCore::HTMLMediaElement::didReceiveRemoteControlCommand): (WebCore::HTMLMediaElement::setBufferingPolicy): (WebCore::HTMLMediaElement::purgeBufferedDataIfPossible): * platform/audio/PlatformMediaSession.cpp: (WebCore::PlatformMediaSession::setState): (WebCore::PlatformMediaSession::beginInterruption): (WebCore::PlatformMediaSession::endInterruption): (WebCore::PlatformMediaSession::clientWillBeginAutoplaying): (WebCore::PlatformMediaSession::clientWillBeginPlayback): (WebCore::PlatformMediaSession::processClientWillPausePlayback): (WebCore::PlatformMediaSession::clientWillPausePlayback): (WebCore::PlatformMediaSession::clientWillBeDOMSuspended): (WebCore::PlatformMediaSession::pauseSession): (WebCore::PlatformMediaSession::stopSession): (WebCore::PlatformMediaSession::didReceiveRemoteControlCommand): 2020-05-19 Daniel Bates <dabates@apple.com> Blue dotted underline with alternatives only shown for last word, gets lost for previous insertions https://bugs.webkit.org/show_bug.cgi?id=212097 <rdar://problem/61913405> Reviewed by Darin Adler. Fix up two cases, <space> is a literal ' ' and | is the position of the caret: 1. Space inserted after marker, here's what it looks like BEFORE insertion (i.e. endOfFirstWord == startOfSelection): hello| This case is detected when the end of the next word (relative to caret) would be at the start of the word that begins before or on the caret. 2. Space inserted before marker, here's what it looks like BEFORE insertion (i.e. startOfLastWord == endOfSelection): |hello This case is detected when the end of the previous word (relative to caret) would be at the end of the word that ends after or on the caret. Note ^^^ example uses a caret, but code is slightly more general and works when the current selection is a range. Though I didn't explicitly test that because my bug is specific to having a caret selection. * editing/Editor.cpp: (WebCore::Editor::insertTextWithoutSendingTextEvent): Do not remove markers if selection starts at the beginning of a new word. This is detected by looking at the character before the selection start to see if it is a space or newline. This will be false when there is no preceding character (e.g. start of document), but that's OK because it doesn't matter what we pass to updateMarkersForWordsAffectedByEditing() - there's no markers to remove anyway, let alone text for markers to exist in. I don't use isStartOfWord() here because that would incorrectly return false if the current selection is at the end of a paragraph. I could have fixed that up by checking isEndOfParagraph() as well, but isStartOfWord() + isEndOfParagraph() is less efficient than just looking at the previous character directly. So, I did that instead. (WebCore::Editor::updateMarkersForWordsAffectedByEditing): Save off the original end of the first word and start of the last word positions before mutating them. Update early return checks to use these saved values instead of comparing against the start and end of the current selection, which weren't correct. Saved positioned are aligned by word, but start and end of current selection may NOT be. So, comparison was asymmetric: lhs was word aligned position, but rhs may not be. * editing/Editor.h: While I am here, fix up a param name to match what it is called in the .cpp. * testing/Internals.cpp: (WebCore::Internals::hasDictationAlternativesMarker): Added * testing/Internals.h: * testing/Internals.idl: Add new functionality for testing purposes. 2020-05-19 Oriol Brufau <obrufau@igalia.com> Fix marginLogicalSizeForChild to check auto margins in the right axis https://bugs.webkit.org/show_bug.cgi?id=212055 Reviewed by Manuel Rego Casasnovas. GridLayoutFunctions::marginLogicalSizeForChild checks for 'auto' margins before retrieving the margin size, since these should be treated as 0. However, for orthogonal grid items, it used to check the wrong axis. So if an item had 'margin-top: auto' and 'margin-left: 5px', when asking for the horizontal margin we could get 0px instead of 5px due to the auto margin in the vertical axis. Test: imported/w3c/web-platform-tests/css/css-grid/grid-items/grid-items-minimum-height-orthogonal-001.html * rendering/GridLayoutFunctions.cpp: (WebCore::GridLayoutFunctions::marginLogicalSizeForChild): 2020-05-19 Jacob Uphoff <jacob_uphoff@apple.com> Unreviewed, reverting r261856. This caused internal assertion failures. Reverted changeset: "Allow calling VideoSampleObserver::videoSampleAvailable from a background thread" https://bugs.webkit.org/show_bug.cgi?id=212024 https://trac.webkit.org/changeset/261856 2020-05-19 David Kilzer <ddkilzer@apple.com> IDBRequestData and IDBClient::TransactionOperation should initialize IndexedDB::IndexRecordType field <https://webkit.org/b/212096> <rdar://problem/63406376> Reviewed by Geoffrey Garen. IDBRequestData tested by IPC::Decoder::decode() and IPC::Encoder::operator<<() running on WebKit2 API and layout tests. * Modules/indexeddb/IndexedDB.h: (WTF::EnumTraits<WebCore::IndexedDB::IndexRecordType>): Add. * Modules/indexeddb/client/TransactionOperation.h: (WebCore::IDBClient::TransactionOperation::m_indexRecordType): - Add default initializer. * Modules/indexeddb/shared/IDBRequestData.h: (WebCore::IDBRequestData::m_indexRecordType): - Add default initializer. (WebCore::IDBRequestData::encode const): (WebCore::IDBRequestData::decode): - Switch from encodeEnum() and decodeEnum() to modern equivalents that check for valid enum values. 2020-05-19 Simon Fraser <simon.fraser@apple.com> Push a PlatformDisplayID to scrolling trees, and allow the scrolling thread to get displayDidRefresh notifications https://bugs.webkit.org/show_bug.cgi?id=211034 Reviewed by Sam Weinig. As work towards scrolling thread synchronization with main thread (webkit.org/b210884), allow ScrollingTree to get a displayDidRefresh() call on the scrolling thread. Each tree is associated with a Page which is associated with a display, so the ScrollingTree needs to have a PlatformDisplayID to know which notifications to respond to. Eventually, displayDidRefresh() will be used to trigger layer updates on the scrolling thread if the main thread is periodically unresponsive. * page/Page.cpp: (WebCore::Page::scrollingCoordinator): (WebCore::Page::windowScreenDidChange): * page/scrolling/AsyncScrollingCoordinator.cpp: (WebCore::AsyncScrollingCoordinator::windowScreenDidChange): * page/scrolling/AsyncScrollingCoordinator.h: * page/scrolling/ScrollingCoordinator.h: (WebCore::ScrollingCoordinator::windowScreenDidChange): * page/scrolling/ScrollingTree.cpp: (WebCore::ScrollingTree::windowScreenDidChange): (WebCore::ScrollingTree::displayID): * page/scrolling/ScrollingTree.h: (WebCore::ScrollingTree::displayDidRefresh): * page/scrolling/ThreadedScrollingTree.cpp: (WebCore::ThreadedScrollingTree::displayDidRefresh): * page/scrolling/ThreadedScrollingTree.h: 2020-05-19 Simon Fraser <simon.fraser@apple.com> [iOS] Programmaic scroll of "scrolling=no" iframe fails https://bugs.webkit.org/show_bug.cgi?id=212063 <rdar://problem/57049514> Reviewed by Antti Koivisto. ScrollView::setScrollPosition() calls requestScrollPositionUpdate(), and if this returns false it relies on the confusingly-named updateScrollbars() to actually do the scroll. This code path is hit for "scrolling=no" frames, which are not scroll-coordinated. ScrollView::updateScrollbars() fails to set the scroll position on iOS, where managesScrollbars() returns false, so fix that. Test: fast/scrolling/progammatic-scroll-scrolling-no-frame.html * platform/ScrollView.cpp: (WebCore::ScrollView::updateScrollbars): 2020-05-19 Andy Estes <aestes@apple.com> [Apple Pay] Add testing and logging for ApplePaySetup https://bugs.webkit.org/show_bug.cgi?id=211972 <rdar://problem/63291965> Reviewed by Alex Christensen. Test: http/tests/ssl/applepay/ApplePaySetup.https.html * DerivedSources-input.xcfilelist: * DerivedSources-output.xcfilelist: * DerivedSources.make: * Modules/applepay/ApplePaySetup.cpp: (WebCore::ApplePaySetup::getSetupFeatures): (WebCore::ApplePaySetup::begin): (WebCore::ApplePaySetup::ApplePaySetup): (WebCore::ApplePaySetup::stop): * Modules/applepay/ApplePaySetup.idl: * Modules/applepay/ApplePaySetupConfiguration.h: Copied from Source/WebCore/Modules/applepay/ApplePaySetupFeatureType.idl. * Modules/applepay/ApplePaySetupConfiguration.idl: Copied from Source/WebCore/Modules/applepay/ApplePaySetupFeatureType.idl. * Modules/applepay/ApplePaySetupFeature.idl: * Modules/applepay/ApplePaySetupFeature.mm: (WebCore::ApplePaySetupFeature::state const): * Modules/applepay/ApplePaySetupFeatureState.h: Copied from Source/WebCore/Modules/applepay/ApplePaySetupFeatureType.idl. * Modules/applepay/ApplePaySetupFeatureState.idl: Copied from Source/WebCore/Modules/applepay/ApplePaySetupFeatureType.idl. * Modules/applepay/ApplePaySetupFeatureType.idl: * Modules/applepay/ApplePaySetupFeatureWebCore.h: * Modules/applepay/ApplePaySetupWebCore.h: (WebCore::ApplePaySetup::create): * Modules/applepay/PaymentCoordinator.cpp: (WebCore::PaymentCoordinator::setApplePayIsActiveIfAllowed const): (WebCore::PaymentCoordinator::getSetupFeatures): (WebCore::PaymentCoordinator::beginApplePaySetup): (WebCore::PaymentCoordinator::endApplePaySetup): * Modules/applepay/PaymentCoordinator.h: * Modules/applepay/PaymentCoordinatorClient.h: (WebCore::PaymentCoordinatorClient::getSetupFeatures): (WebCore::PaymentCoordinatorClient::beginApplePaySetup): * SourcesCocoa.txt: * WebCore.xcodeproj/project.pbxproj: * testing/MockApplePaySetupFeature.cpp: Copied from Source/WebCore/Modules/applepay/ApplePaySetupFeatureWebCore.h. (WebCore::MockApplePaySetupFeature::create): (WebCore::MockApplePaySetupFeature::MockApplePaySetupFeature): * testing/MockApplePaySetupFeature.h: Copied from Source/WebCore/Modules/applepay/ApplePaySetupFeatureWebCore.h. * testing/MockPaymentCoordinator.cpp: (WebCore::MockPaymentCoordinator::addSetupFeature): (WebCore::MockPaymentCoordinator::getSetupFeatures): (WebCore::MockPaymentCoordinator::beginApplePaySetup): * testing/MockPaymentCoordinator.h: * testing/MockPaymentCoordinator.idl: 2020-05-19 Sergio Villar Senin <svillar@igalia.com> [WebXR] Implement requestSession() https://bugs.webkit.org/show_bug.cgi?id=211888 Reviewed by Youenn Fablet. This patch adds a preliminar implementation of the requestSession() API used to get a WebXRSession from the UA. It includes a fairly good amount of checks to verify that the request can be satisfied given the device's enabled features per session modes. The specs also describe how to request persmission for some actions using the Permissions API which WebKit does not currently implement. That should be done in a follow up patch perhaps using a similar approach to other APIs as Geolocation for example. In order to get some of the requestSession() tests passing the session finalization (shutdown) had to be implemented too. Several tests where unskipped for WPE port as they're now passing. * Modules/webxr/WebXRRenderState.cpp: (WebCore::WebXRRenderState::create): Pass XRSessionMode as argument instead of a WebXRSession. * Modules/webxr/WebXRRenderState.h: Ditto. * Modules/webxr/WebXRSession.cpp: (WebCore::WebXRSession::create): Added. (WebCore::WebXRSession::WebXRSession): Added. (WebCore::WebXRSession::renderState const): (WebCore::WebXRSession::inputSources const): (WebCore::WebXRSession::shutdown): Shutdown process called on session end. (WebCore::WebXRSession::end): Implemented session ending. * Modules/webxr/WebXRSession.h: Added create() and private constructor. Fixed some naming. * Modules/webxr/WebXRSystem.cpp: (WebCore::WebXRSystem::DummyInlineDevice::DummyInlineDevice): Contructor for the dummy inline device. (WebCore::WebXRSystem::ensureImmersiveXRDeviceIsSelected): Use a counter instead of a boolean to track testing devices as there might be more than 1. (WebCore::WebXRSystem::obtainCurrentDevice): Implemented from specs text. (WebCore::WebXRSystem::immersiveSessionRequestIsAllowedForGlobalObject const): Ditto. (WebCore::WebXRSystem::inlineSessionRequestIsAllowedForGlobalObject const): Ditto. (WebCore::WebXRSystem::resolveRequestedFeatures const): Ditto. (WebCore::WebXRSystem::isXRPermissionGranted const): Ditto. (WebCore::WebXRSystem::requestSession): Ditto. (WebCore::WebXRSystem::registerSimulatedXRDeviceForTesting): Use a counter instead of a bool. Also use a reference in the method argument. (WebCore::WebXRSystem::unregisterSimulatedXRDeviceForTesting): Ditto. (WebCore::WebXRSystem::sessionEnded): Added, used by sessions to notify the XRSystem. * Modules/webxr/WebXRSystem.h: * Modules/webxr/WebXRSystem.idl: Call requestSession with Document. * dom/TaskSource.h: Added a WebXR task source. * platform/xr/PlatformXR.h: Specs state that devices have a list of enabled features per session mode so store them in a hashmap instead of in a Vector. (PlatformXR::Device::supports const): Use the new Hashmap of session modes. (PlatformXR::Device::setEnabledFeatures): Ditto. (PlatformXR::Device::enabledFeatures const): Ditto. (PlatformXR::Device::setSupportedModes): Deleted. * platform/xr/openxr/PlatformXR.cpp: (PlatformXR::Instance::Impl::collectSupportedSessionModes): Return session modes if any. (PlatformXR::Instance::enumerateImmersiveXRDevices): Fill in features per session mode. * testing/WebXRTest.cpp: (WebCore::WebXRTest::simulateDeviceConnection): Fill in features per session mode. (WebCore::WebXRTest::disconnectAllDevices): Pass a reference to unregister. 2020-05-19 Antti Koivisto <antti@apple.com> Animation of font-size with rem values is incorrect https://bugs.webkit.org/show_bug.cgi?id=194765 <rdar://problem/48171742> Reviewed by Antoine Quint. Test: animations/keyframe-rem-unit.html 'rem' computation fails on first style resolution because the document element style is not available. * style/StyleResolver.cpp: (WebCore::Style::Resolver::styleForKeyframe): Provide the override value, needed because the style can't be found from DOM tree yet. 2020-05-19 Andy Estes <aestes@apple.com> [Apple Pay] Add testing and logging for ApplePaySetup https://bugs.webkit.org/show_bug.cgi?id=211972 <rdar://problem/63291965> Reviewed by Alex Christensen. Added support for ApplePaySetup to MockPaymentCoordinator and wrote a test. Added release logging for ApplePaySetup and removed a noisy log message from setApplePayIsActiveIfAllowed. Test: http/tests/ssl/applepay/ApplePaySetup.https.html * DerivedSources-input.xcfilelist: * DerivedSources-output.xcfilelist: * DerivedSources.make: * Modules/applepay/ApplePaySetup.cpp: (WebCore::ApplePaySetup::getSetupFeatures): (WebCore::ApplePaySetup::begin): (WebCore::ApplePaySetup::ApplePaySetup): (WebCore::ApplePaySetup::stop): * Modules/applepay/ApplePaySetup.idl: * Modules/applepay/ApplePaySetupConfiguration.h: Copied from Source/WebCore/Modules/applepay/ApplePaySetupFeatureType.idl. * Modules/applepay/ApplePaySetupConfiguration.idl: Copied from Source/WebCore/Modules/applepay/ApplePaySetupFeatureType.idl. * Modules/applepay/ApplePaySetupFeature.idl: * Modules/applepay/ApplePaySetupFeature.mm: (WebCore::ApplePaySetupFeature::state const): * Modules/applepay/ApplePaySetupFeatureState.h: Copied from Source/WebCore/Modules/applepay/ApplePaySetupFeatureType.idl. * Modules/applepay/ApplePaySetupFeatureState.idl: Copied from Source/WebCore/Modules/applepay/ApplePaySetupFeatureType.idl. * Modules/applepay/ApplePaySetupFeatureType.idl: * Modules/applepay/ApplePaySetupFeatureWebCore.h: * Modules/applepay/ApplePaySetupWebCore.h: (WebCore::ApplePaySetup::create): * Modules/applepay/PaymentCoordinator.cpp: (WebCore::PaymentCoordinator::setApplePayIsActiveIfAllowed const): (WebCore::PaymentCoordinator::getSetupFeatures): (WebCore::PaymentCoordinator::beginApplePaySetup): (WebCore::PaymentCoordinator::endApplePaySetup): * Modules/applepay/PaymentCoordinator.h: * Modules/applepay/PaymentCoordinatorClient.h: (WebCore::PaymentCoordinatorClient::getSetupFeatures): (WebCore::PaymentCoordinatorClient::beginApplePaySetup): * SourcesCocoa.txt: * WebCore.xcodeproj/project.pbxproj: * testing/MockApplePaySetupFeature.cpp: Copied from Source/WebCore/Modules/applepay/ApplePaySetup.idl. (WebCore::MockApplePaySetupFeature::create): (WebCore::MockApplePaySetupFeature::MockApplePaySetupFeature): * testing/MockApplePaySetupFeature.h: Copied from Source/WebCore/Modules/applepay/ApplePaySetupFeatureWebCore.h. * testing/MockPaymentCoordinator.cpp: (WebCore::MockPaymentCoordinator::addSetupFeature): (WebCore::MockPaymentCoordinator::getSetupFeatures): (WebCore::MockPaymentCoordinator::beginApplePaySetup): * testing/MockPaymentCoordinator.h: * testing/MockPaymentCoordinator.idl: 2020-05-19 Youenn Fablet <youenn@apple.com> Allow calling VideoSampleObserver::videoSampleAvailable from a background thread https://bugs.webkit.org/show_bug.cgi?id=212024 Reviewed by Eric Carlson. Allow RealtimeMediaSource::videoSampleAvailable to be called on a background thread, typically the capture thread. Make WebRTC remote sources and mock capture sources do that. RealtimeMediaSource is then updating its intrinsic size from the generation thread while updating its size in the main thread. The size() getter can be called from both threads. Existing consumers do the following: - media player will hop to the main thread. - media recorder will do processing from the background thread. - WebRTC sender will do processing from the background thread, except when sending black frames where this will still be done on the main thread. This is ok as we ensure either we send black frames on the main thread (and we do not observe the source) or we observe the source to send. Follow-ups will migrate the real capture sources as well as migrating media player processing out of the main thread. Covered by existing tests. * platform/MediaSample.h: * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm: (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::MediaPlayerPrivateMediaStreamAVFObjC): (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::videoSampleAvailable): * platform/mediastream/RealtimeMediaSource.cpp: (WebCore::RealtimeMediaSource::videoSampleAvailable): (WebCore::RealtimeMediaSource::setIntrinsicSize): * platform/mediastream/RealtimeMediaSource.h: * platform/mediastream/mac/MockRealtimeVideoSourceMac.h: * platform/mediastream/mac/MockRealtimeVideoSourceMac.mm: (WebCore::MockRealtimeVideoSourceMac::MockRealtimeVideoSourceMac): (WebCore::MockRealtimeVideoSourceMac::updateSampleBuffer): * platform/mediastream/mac/RealtimeIncomingVideoSourceCocoa.h: * platform/mediastream/mac/RealtimeIncomingVideoSourceCocoa.mm: (WebCore::RealtimeIncomingVideoSourceCocoa::OnFrame): (WebCore::RealtimeIncomingVideoSourceCocoa::processNewSample): Deleted. 2020-05-19 Michael Catanzaro <mcatanzaro@gnome.org> REGRESSION(r257463): [GTK] Build failure with -DENABLE_GLES2=ON https://bugs.webkit.org/show_bug.cgi?id=212043 Reviewed by Philippe Normand. Fix the typo "Platfom" -> "Platform" * platform/graphics/gstreamer/PlatformDisplayGStreamer.cpp: (createGstGLDisplay): 2020-05-18 Simon Fraser <simon.fraser@apple.com> Move some of the more chatty Scrolling logging to a ScrollingTree channel https://bugs.webkit.org/show_bug.cgi?id=212061 Reviewed by Tim Horton. Move logging about the scrolling tree to a new channel. * page/FrameView.cpp: (WebCore::FrameView::scrollToFragmentInternal): (WebCore::FrameView::scrollToAnchor): * page/scrolling/AsyncScrollingCoordinator.cpp: (WebCore::AsyncScrollingCoordinator::createNode): (WebCore::AsyncScrollingCoordinator::insertNode): * page/scrolling/ScrollingStateTree.cpp: (WebCore::ScrollingStateTree::createUnparentedNode): (WebCore::ScrollingStateTree::insertNode): (WebCore::ScrollingStateTree::unparentNode): (WebCore::ScrollingStateTree::unparentChildrenAndDestroyNode): (WebCore::ScrollingStateTree::detachAndDestroySubtree): * page/scrolling/ScrollingTree.cpp: (WebCore::ScrollingTree::commitTreeState): * page/scrolling/ScrollingTreeScrollingNode.cpp: (WebCore::ScrollingTreeScrollingNode::scrollTo): * page/scrolling/ThreadedScrollingTree.cpp: (WebCore::ThreadedScrollingTree::scrollingTreeNodeDidScroll): * page/scrolling/cocoa/ScrollingTreeOverflowScrollProxyNode.mm: (WebCore::ScrollingTreeOverflowScrollProxyNode::applyLayerPositions): * page/scrolling/mac/ScrollingCoordinatorMac.mm: (WebCore::ScrollingCoordinatorMac::commitTreeStateIfNeeded): * platform/Logging.h: * rendering/RenderLayerCompositor.cpp: (WebCore::RenderLayerCompositor::attachScrollingNode): 2020-05-18 David Kilzer <ddkilzer@apple.com> Replace TextIndicatorOptions with OptionSet<TextIndicatorOption> <https://webkit.org/b/212051> <rdar://problem/63368556> Reviewed by Simon Fraser. Use OptionSet<TextIndicatorOption> everywhere TextIndicatorOptions was previously used, plus: - Make TextIndicatorOption an enum class. Remove "TextIndicatorOption" prefix so TextIndicatorOptionBar becomes TextIndicatorOption::Bar. - Remove TextIndicatorOptionDefault because OptionSet<> initializes to zero. - Replace static variables (including two globals in WebCore) with constexpr variables. * page/TextIndicator.cpp: (WebCore::TextIndicator::createWithRange): (WebCore::TextIndicator::createWithSelectionInFrame): (WebCore::snapshotOptionsForTextIndicatorOptions): (WebCore::takeSnapshots): (WebCore::hasAnyIllegibleColors): (WebCore::initializeIndicator): * page/TextIndicator.h: * platform/ios/DragImageIOS.mm: (WebCore::createDragImageForLink): (WebCore::createDragImageForSelection): (WebCore::createDragImageForRange): * testing/Internals.h: 2020-05-18 Andy Estes <aestes@apple.com> http/tests/ssl/applepay/ApplePayInstallmentConfiguration.https.html fails in public SDK builds https://bugs.webkit.org/show_bug.cgi?id=212000 <rdar://problem/63323082> Reviewed by Youenn Fablet. * Configurations/FeatureDefines.xcconfig: * bindings/js/WebCoreBuiltinNames.h: 2020-05-18 Myles C. Maxfield <mmaxfield@apple.com> [WebGPU] Validation for GPUDevice.createTexture() https://bugs.webkit.org/show_bug.cgi?id=211882 <rdar://problem/63215999> Reviewed by Dean Jackson. Add lots of validation for texture creation. The logic was gathered by trial and error. Before this patch, we didn't have any validation. This is a first pass, as the validation logic isn't spelled out in the spec. Next, I will make a pull request to the spec to match this patch. This patch also updates three pieces of our IDL files to match the spec for WebGPU: One to remove GPUTextureUsage.NONE which was replaced with just 0, one to remove GPUTextureDescriptor.arrayLayerCount, which was deleted in favor of using regular dimension fields, and one to add [EnforceRange] to various values. This patch also updates GPUDevice to have a GPUErrorScopes object, which is required for good error messages. Test: webgpu/texture-creation.html * Modules/webgpu/GPUExtent3D.idl: * Modules/webgpu/GPUTextureDescriptor.idl: * Modules/webgpu/WebGPUDevice.cpp: (WebCore::WebGPUDevice::tryCreate): (WebCore::WebGPUDevice::createTexture const): * Modules/webgpu/WebGPUDevice.h: * platform/graphics/gpu/GPUDevice.cpp: (WebCore::maximumMipLevelCount): (WebCore::GPUDevice::tryCreateTexture const): * platform/graphics/gpu/GPUDevice.h: (WebCore::GPUDevice::setErrorScopes): * platform/graphics/gpu/GPUExtent3D.h: * platform/graphics/gpu/GPUObjectBase.h: (WebCore::GPUObjectBase::errorScopes const): (WebCore::GPUObjectBase::errorScopes): Deleted. * platform/graphics/gpu/GPUTexture.h: * platform/graphics/gpu/GPUTextureDescriptor.h: * platform/graphics/gpu/cocoa/GPUTextureMetal.mm: (WebCore::mtlTextureTypeForGPUTextureDescriptor): (WebCore::mtlTextureUsageForGPUTextureUsageFlags): (WebCore::tryCreateMtlTextureDescriptor): (WebCore::GPUTexture::tryCreate): 2020-05-18 Oriol Brufau <obrufau@igalia.com> [css-grid] Clear the override width for computing percent margins https://bugs.webkit.org/show_bug.cgi?id=209461 Reviewed by Manuel Rego Casasnovas. When calculating the min-content contribution of a grid item of an auto sized grid track we must consider the grid item's margin. When the grid item's area is indefinite, a percent margin is resolved to zero. However, when performing a relayout, the percent margin may be solved against the previously computed grid area, since the grid item has already an OverrideContainingBlockLogicalWidth value. In order to re-compute the percent margin properly, we need to clear the previously override value. It's important to be careful of not clearing the override value set during intrinsic size, since we need it for the actual layout phase. Hence, we only reset the 'override' value when we are executing a definite strategy. Tests: imported/w3c/web-platform-tests/css/css-grid/grid-definition/grid-minimum-contribution-with-percentages.html imported/w3c/web-platform-tests/css/css-grid/grid-items/grid-item-dynamic-min-contribution-001.html imported/w3c/web-platform-tests/css/css-grid/grid-items/grid-items-percentage-margins-003.html imported/w3c/web-platform-tests/css/css-grid/grid-items/grid-items-percentage-margins-004.html imported/w3c/web-platform-tests/css/css-grid/grid-items/grid-items-percentage-margins-005.html imported/w3c/web-platform-tests/css/css-grid/grid-items/grid-items-percentage-margins-006.html imported/w3c/web-platform-tests/css/css-grid/grid-items/grid-items-percentage-margins-007.html imported/w3c/web-platform-tests/css/css-grid/grid-items/grid-items-percentage-margins-008.html imported/w3c/web-platform-tests/css/css-grid/grid-items/grid-items-percentage-margins-009.html imported/w3c/web-platform-tests/css/css-grid/grid-items/grid-items-percentage-margins-010.html imported/w3c/web-platform-tests/css/css-grid/grid-items/grid-items-percentage-margins-011.html imported/w3c/web-platform-tests/css/css-grid/grid-items/grid-items-percentage-margins-012.html imported/w3c/web-platform-tests/css/css-grid/grid-items/grid-items-percentage-margins-013.html imported/w3c/web-platform-tests/css/css-grid/grid-items/grid-items-percentage-margins-014.html imported/w3c/web-platform-tests/css/css-grid/grid-items/grid-items-percentage-paddings-003.html imported/w3c/web-platform-tests/css/css-grid/grid-items/grid-items-percentage-paddings-004.html imported/w3c/web-platform-tests/css/css-grid/grid-items/grid-items-percentage-paddings-005.html imported/w3c/web-platform-tests/css/css-grid/grid-items/grid-items-percentage-paddings-006.html imported/w3c/web-platform-tests/css/css-grid/grid-items/grid-items-percentage-paddings-007.html imported/w3c/web-platform-tests/css/css-grid/grid-items/grid-items-percentage-paddings-008.html imported/w3c/web-platform-tests/css/css-grid/grid-items/grid-items-percentage-paddings-009.html imported/w3c/web-platform-tests/css/css-grid/grid-items/grid-items-percentage-paddings-010.html imported/w3c/web-platform-tests/css/css-grid/grid-items/grid-items-percentage-paddings-011.html imported/w3c/web-platform-tests/css/css-grid/grid-items/grid-items-percentage-paddings-012.html imported/w3c/web-platform-tests/css/css-grid/grid-items/grid-items-percentage-paddings-013.html imported/w3c/web-platform-tests/css/css-grid/grid-items/grid-items-percentage-paddings-014.html * rendering/GridTrackSizingAlgorithm.cpp: (WebCore::hasRelativeMarginOrPaddingForChild): (WebCore::hasRelativeOrIntrinsicSizeForChild): (WebCore::shouldClearOverrideContainingBlockContentSizeForChild): (WebCore::GridTrackSizingAlgorithmStrategy::minSizeForChild const): (WebCore::GridTrackSizingAlgorithmStrategy::minLogicalSizeForChild const): (WebCore::DefiniteSizeStrategy::minLogicalSizeForChild const): (WebCore::DefiniteSizeStrategy::minContentForChild const): * rendering/GridTrackSizingAlgorithm.h: 2020-05-18 David Kilzer <ddkilzer@apple.com> Follow-up: Use default initializers in TextIndicatorData <https://webkit.org/b/212039> <rdar://problem/63355619> * page/TextIndicator.h: (WebCore::TextIndicatorData::contentImageScaleFactor): - Simon Fraser says 1 is a better default than 0. 2020-05-18 Peng Liu <peng.liu6@apple.com> Add a quirk to allow an embedded Twitter video to play with one tapping https://bugs.webkit.org/show_bug.cgi?id=211932 Reviewed by Maciej Stachowiak. * html/MediaElementSession.cpp: (WebCore::MediaElementSession::playbackPermitted const): Need to check the topDocument for the existence of user interactions. (WebCore::MediaElementSession::updateMediaUsageIfChanged): Ditto. * page/Quirks.cpp: (WebCore::Quirks::needsPerDocumentAutoplayBehavior const): Add the missing needsQuirks() checking. (WebCore::Quirks::shouldAutoplayForArbitraryUserGesture const): Add a the quirk for twitter.com. * platform/audio/ios/MediaSessionManagerIOS.mm: (WebCore::MediaSessionManageriOS::sessionWillBeginPlayback): Clarify the log message. 2020-05-18 Simon Fraser <simon.fraser@apple.com> Content disappears on CSS parallax example https://bugs.webkit.org/show_bug.cgi?id=212045 <rdar://problem/63194217> Reviewed by Tim Horton. In r261632 I fixed parallax scrolling by migrating the perspective transform onto the scroll container layer, and making the scrolled contents layer a "preserve3D" layer. However, scrolling is achieved by changing the boundsOrigin of the scrolled contents layer, so the computation of the perspective matrix, which is a "child layer transform", has to take this boundsOrigin into account, otherwise we compute bad coverage rects, and drop backing store erroneously. Test: compositing/tiling/perspective-on-scroller-tile-coverage.html * platform/graphics/FloatPoint3D.h: (WebCore::FloatPoint3D::FloatPoint3D): (WebCore::FloatPoint3D::move): (WebCore::operator +=): (WebCore::operator -=): (WebCore::operator+): (WebCore::operator-): * platform/graphics/ca/GraphicsLayerCA.cpp: (WebCore::GraphicsLayerCA::recursiveVisibleRectChangeRequiresFlush const): (WebCore::GraphicsLayerCA::layerTransform const): (WebCore::GraphicsLayerCA::adjustCoverageRect const): (WebCore::GraphicsLayerCA::setVisibleAndCoverageRects): 2020-05-18 David Kilzer <ddkilzer@apple.com> Use default initializers in TextIndicatorData <https://webkit.org/b/212039> <rdar://problem/63355619> Reviewed by Alex Christensen. Tested by IPC::Decoder::decode() and IPC::Encoder::operator<<() running on WebKit2 API and layout tests. * page/TextIndicator.h: (WebCore::TextIndicatorData): - Add default initializers. (WTF::EnumTraits<WebCore::TextIndicatorPresentationTransition>): - Add EnumTraits so TextIndicatorPresentationTransition may be used by IPC::Decoder::decode() and IPC::Encoder::operator<<(). 2020-05-18 Simon Fraser <simon.fraser@apple.com> Fix operator== and hash() for ExtendedColor https://bugs.webkit.org/show_bug.cgi?id=211993 Post-landing followup. ExtendedColor operator== has to do exact comparison to be consistent with hash(). * platform/graphics/ExtendedColor.h: (WebCore::operator==): 2020-05-18 Wenson Hsieh <wenson_hsieh@apple.com> Replace uses of +self with +class https://bugs.webkit.org/show_bug.cgi?id=212041 Reviewed by Darin Adler. No change in behavior. * accessibility/mac/WebAccessibilityObjectWrapperMac.mm: (-[WebAccessibilityObjectWrapper _accessibilitySetValue:forAttribute:]): (-[WebAccessibilityObjectWrapper accessibilityAttributeValue:forParameter:]): * platform/graphics/ca/cocoa/PlatformCALayerCocoa.mm: (WebCore::PlatformCALayer::isWebLayer): 2020-05-18 Ross Kirsling <ross.kirsling@sony.com> Unreviewed restabilization of non-unified build. * accessibility/AXObjectCache.cpp: * html/HTMLAttachmentElement.h: * inspector/agents/InspectorCSSAgent.cpp: * layout/blockformatting/tablewrapper/TableWrapperBlockFormattingContext.cpp: * layout/tableformatting/TableFormattingContextGeometry.cpp: * layout/tableformatting/TableFormattingState.cpp: * rendering/RenderTextFragment.h: * rendering/style/KeyframeList.h: 2020-05-18 Pinki Gyanchandani <pgyanchandani@apple.com> Null Ptr Deref @ WebCore::CSSValue::classType https://bugs.webkit.org/show_bug.cgi?id=212036 Reviewed by Geoffrey Garen. Calculated value for a primitive value type can be NULL for a CSS property. Added a null check before dereferencing it. Test: editing/execCommand/null_calc_primitive_value_for_css_property.html * css/CSSPrimitiveValue.cpp: (WebCore::CSSPrimitiveValue::formatNumberForCustomCSSText const): 2020-05-18 Simon Fraser <simon.fraser@apple.com> Implement conversion between P3 and sRGB color https://bugs.webkit.org/show_bug.cgi?id=211998 Reviewed by Daniel Bates. Color::toSRGBAComponentsLossy() was a lie because it didn't actually convert extended colors into sRGB. Fix that by converting P3 and linaerRGB colors into sRGB, using the color math from CSS Color 4. Renamed the various "linear to sRGB" functions because they work for any RGB colors, not just sRGB. * platform/graphics/Color.cpp: (WebCore::Color::toSRGBAComponentsLossy const): * platform/graphics/Color.h: * platform/graphics/ColorUtilities.cpp: (WebCore::linearToRGBColorComponent): (WebCore::RGBToLinearColorComponent): (WebCore::sRGBColorToLinearComponents): (WebCore::RGBToLinearComponents): (WebCore::linearToRGBComponents): (WebCore::XYZToLinearSRGB): (WebCore::linearSRGBToXYZ): (WebCore::XYZToLinearP3): (WebCore::linearP3ToXYZ): (WebCore::P3ToSRGB): (WebCore::sRGBToP3): (WebCore::ColorMatrix::transformedColorComponents const): (WebCore::linearToSRGBColorComponent): Deleted. (WebCore::sRGBToLinearColorComponent): Deleted. (WebCore::sRGBToLinearComponents): Deleted. (WebCore::linearToSRGBComponents): Deleted. * platform/graphics/ColorUtilities.h: 2020-05-18 Wenson Hsieh <wenson_hsieh@apple.com> Allow clipboard API access when pasting from a menu item or key binding https://bugs.webkit.org/show_bug.cgi?id=211990 <rdar://problem/63308916> Reviewed by Megan Gardner. Allow the contents of the clipboard to be programmatically requested by the page while pasting from trusted UI (i.e. the paste menu item, or when WebKit API is called by the app to trigger the paste). This allows the 'reading' part of the async clipboard API (`read` and `readText`) to be used when the user pastes in an editable element, without having to fall back to showing the DOM paste access menu. Note that this change should not have an effect on the pasteboard security model, since it only grants the page programmatic access to the contents of the pasteboard in the case where access to the pasteboard has already been granted by the user. Additionally, even in the event that the web process is compromised, even if the web process can be tricked into believing it has been granted pasteboard access, the changes in r259151 will prevent it from being able to request pasteboard data, unless the user (or the application, on behalf of the user) has explicitly pasted via trusted API calls that are inaccessible from the web process. Test: editing/async-clipboard/clipboard-read-while-pasting.html * editing/Editor.cpp: (WebCore::Editor::paste): (WebCore::Editor::pasteAsPlainText): (WebCore::Editor::pasteAsQuotation): If `FromMenuOrKeyBinding::Yes` is passed in, set the `m_pastingFromMenuOrKeyBinding` flag to true during the scope of the paste command. * editing/Editor.h: (WebCore::Editor::isPastingFromMenuOrKeyBinding const): * editing/EditorCommand.cpp: (WebCore::executePaste): (WebCore::executePasteAndMatchStyle): (WebCore::executePasteAsPlainText): (WebCore::executePasteAsQuotation): Pass in `FromMenuOrKeyBinding::Yes` when triggering the paste from a menu item or key binding. * page/Frame.cpp: (WebCore::Frame::requestDOMPasteAccess): When pasting from menu or key binding, grant the page DOM paste access without requiring the DOM paste access UI to be shown and confirmed. 2020-05-18 Per Arne Vollan <pvollan@apple.com> [Win] Fix AppleWin build https://bugs.webkit.org/show_bug.cgi?id=212030 Reviewed by Brent Fulgham. The build fails because the number of bitfields in GreaterThanOrSameSizeAsStyleRareInheritedData does not match the actual number of bitfields in StyleRareInheritedData. * rendering/style/StyleRareInheritedData.cpp: 2020-05-18 Rob Buis <rbuis@igalia.com> Remove certain headers when a redirect causes a request method change https://bugs.webkit.org/show_bug.cgi?id=205119 Reviewed by Youenn Fablet. Implement step 11 of HTTP-redirect fetch [1] to redirect to GET method, remove body and strip certain headers for 301, 302 and 303 redirects. Tests: imported/w3c/web-platform-tests/fetch/api/redirect/redirect-method.any.html imported/w3c/web-platform-tests/fetch/api/redirect/redirect-method.any.worker.html * loader/SubresourceLoader.cpp: (WebCore::SubresourceLoader::checkRedirectionCrossOriginAccessControl): * platform/network/HTTPHeaderNames.in: * platform/network/ResourceRequestBase.cpp: (WebCore::shouldUseGet): (WebCore::ResourceRequestBase::redirectAsGETIfNeeded): (WebCore::ResourceRequestBase::redirectedRequest const): * platform/network/ResourceRequestBase.h: 2020-05-18 Antti Koivisto <antti@apple.com> [Wheel event region] Invalidation for root style https://bugs.webkit.org/show_bug.cgi?id=212029 Reviewed by Simon Fraser. Test: fast/scrolling/mac/wheel-event-listener-region-root-invalidation.html Invalidate the region when event listeners change on Document or Window. * dom/Document.cpp: (WebCore::Document::invalidateEventListenerRegions): * dom/Document.h: (isType): * dom/Element.cpp: (WebCore::Element::invalidateEventListenerRegions): * dom/Element.h: * dom/EventTarget.cpp: (WebCore::EventTarget::addEventListener): (WebCore::EventTarget::removeEventListener): (WebCore::EventTarget::removeAllEventListeners): (WebCore::EventTarget::invalidateEventListenerRegions): * dom/EventTarget.h: * style/StyleAdjuster.cpp: (WebCore::Style::Adjuster::adjustEventListenerRegionTypesForRootStyle): * style/StyleAdjuster.h: * style/StyleResolveForDocument.cpp: (WebCore::Style::resolveForDocument): 2020-05-18 Simon Fraser <simon.fraser@apple.com> Find doesn't always scroll search results into view https://bugs.webkit.org/show_bug.cgi?id=212007 <rdar://problem/36333321> Reviewed by Wenson Hsieh. HighlightData::collectBounds() could produce overly large bounds, causing the selection to fail to scroll into view. This happened when multiple block ancestors were added to 'renderers', with empty rects. The process of mapping that empty rect to a quad via localToAbsoluteQuad() could produce an empty quad at a fractional offset, then calling enclosingBoundingBox() on the quad would create a 1x1 rectangle, which got unioned with selectionRect. Fix by skipping entries with empty rects. Add a Selection log channel and some logging that makes this trivial to see. Test: editing/selection/selection-bounds-fractional-containing-blocks.html * platform/Logging.h: * rendering/HighlightData.cpp: (WebCore::HighlightData::collectBounds const): 2020-05-18 Darin Adler <darin@apple.com> Add iterator checking to ListHashSet https://bugs.webkit.org/show_bug.cgi?id=211669 Reviewed by Anders Carlsson. * page/ios/ContentChangeObserver.h: Added an include of Element.h, needed to call makeWeakPtr in an inline function. This is due to a change in the way makeWeakPtr now checks the type of the argument. It's possible we could refine it further to relax this requirement, but it seems OK to include Element.h here. 2020-05-18 Zalan Bujtas <zalan@apple.com> [LFC][TFC] Add support for computing the collapsed table border https://bugs.webkit.org/show_bug.cgi?id=212003 Reviewed by Antti Koivisto. UAs must compute an initial left and right border width for the table by examining the first and last cells in the first row of the table. The left border width of the table is half of the first cell's collapsed left border, and the right border width of the table is half of the last cell's collapsed right border. The top border width of the table is computed by examining all cells who collapse their top borders with the top border of the table. The top border width of the table is equal to half of the maximum collapsed top border. The bottom border width is computed by examining all cells whose bottom borders collapse with the bottom of the table. The bottom border width is equal to half of the maximum collapsed bottom border. https://www.w3.org/TR/CSS22/tables.html#collapsing-borders This patch implements the table box part of the border collapsing. Inner table elements need to implement collapsing as well. * layout/LayoutState.cpp: (WebCore::Layout::LayoutState::ensureTableFormattingState): * layout/blockformatting/tablewrapper/TableWrapperBlockFormattingContext.cpp: (WebCore::Layout::TableWrapperBlockFormattingContext::layoutTableBox): (WebCore::Layout::TableWrapperBlockFormattingContext::computeBorderAndPaddingForTableBox): (WebCore::Layout::TableWrapperBlockFormattingContext::computeWidthAndMarginForTableBox): * layout/blockformatting/tablewrapper/TableWrapperBlockFormattingContext.h: * layout/tableformatting/TableFormattingContext.cpp: (WebCore::Layout::TableFormattingContext::computedIntrinsicWidthConstraints): (WebCore::Layout::TableFormattingContext::ensureTableGrid): * layout/tableformatting/TableFormattingContext.h: * layout/tableformatting/TableFormattingState.cpp: (WebCore::Layout::TableFormattingState::TableFormattingState): * layout/tableformatting/TableFormattingState.h: 2020-05-18 Antoine Quint <graouts@apple.com> Clean up media controls content for Apple platforms https://bugs.webkit.org/show_bug.cgi?id=212011 <rdar://problem/63298588> Reviewed by Dean Jackson. We strip Copyright and other comments from the CSS and JS media controls files. * WebCore.xcodeproj/project.pbxproj: 2020-05-18 Alicia Boya García <aboya@igalia.com> [GStreamer][MediaSource] Remove orphaned tracks in updateTracks() https://bugs.webkit.org/show_bug.cgi?id=211980 Reviewed by Xabier Rodriguez-Calvar. This patch ensures tracks missing from a subsequent updateTracks() calls are removed from the player. This fixes regressions on the following tests caused on r261683. imported/w3c/web-platform-tests/mediacapture-streams/MediaStream-removetrack.https.html imported/w3c/web-platform-tests/mediacapture-streams/MediaStreamTrack-applyConstraints.https.html * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp: (WebCore::hashSetFromHashMapKeys): (WebCore::MediaPlayerPrivateGStreamer::updateTracks): 2020-05-18 Carlos Garcia Campos <cgarcia@igalia.com> [GTK] "ASSERTION FAILED: !m_adoptionIsRequired" when double clicking on a word https://bugs.webkit.org/show_bug.cgi?id=211957 Reviewed by Adrian Perez de Castro. Make SelectionData non-refcounted. We can just move in most of the cases to avoid copies. * platform/Pasteboard.h: * platform/gtk/PasteboardGtk.cpp: (WebCore::Pasteboard::createForDragAndDrop): (WebCore::Pasteboard::Pasteboard): (WebCore::Pasteboard::selectionData const): * platform/gtk/SelectionData.h: 2020-05-18 Carlos Garcia Campos <cgarcia@igalia.com> [GTK] Add WebKitContextMenuItemType for paste as plaintext https://bugs.webkit.org/show_bug.cgi?id=177638 Reviewed by Michael Catanzaro. Add paste as plain text context menu item for rich editable content. * page/ContextMenuController.cpp: (WebCore::ContextMenuController::contextMenuItemSelected): (WebCore::ContextMenuController::populate): (WebCore::ContextMenuController::checkOrEnableIfNeeded const): * platform/ContextMenuItem.h: * platform/LocalizedStrings.h: * platform/gtk/LocalizedStringsGtk.cpp: (WebCore::contextMenuItemTagPasteAsPlainText): 2020-05-17 Simon Fraser <simon.fraser@apple.com> Fix operator== and hash() for ExtendedColor https://bugs.webkit.org/show_bug.cgi?id=211993 Reviewed by Sam Weinig. Color::operator== and hash() were wrong for extended color. Fix operator== to compare extended colors. Extended and non-extended colors have to always conpare as non-equal to preserve computed style behavior, currently. Fix hash() to hash the color components and colorspace for ExtendedColor. Add some API tests for these code paths. * platform/graphics/Color.cpp: (WebCore::extendedColorsEqual): * platform/graphics/Color.h: (WebCore::operator==): (WebCore::Color::hash const): * platform/graphics/ColorUtilities.cpp: (WebCore::areEssentiallyEqual): * platform/graphics/ColorUtilities.h: (WebCore::operator==): (WebCore::operator!=): * platform/graphics/ExtendedColor.cpp: (WebCore::ExtendedColor::hash const): * platform/graphics/ExtendedColor.h: (WebCore::operator==): (WebCore::operator!=): 2020-05-17 Zalan Bujtas <zalan@apple.com> [LFC][BFC] Introduce TableWrapperBlockFormattingContext https://bugs.webkit.org/show_bug.cgi?id=211996 Reviewed by Antti Koivisto. Table wrapper box establishes a special BFC with only captions and the actual table box in it. It mostly behaves like a normal BFC but the table box requires some special handing when it comes to padding/border and width/height computation. This patch moves the table box specific code from generic BFC to this new subclass. * Sources.txt: * WebCore.xcodeproj/project.pbxproj: * layout/FormattingContext.h: * layout/LayoutContext.cpp: (WebCore::Layout::LayoutContext::createFormattingContext): * layout/blockformatting/BlockFormattingContext.cpp: (WebCore::Layout::BlockFormattingContext::computeHeightAndMargin): * layout/blockformatting/BlockFormattingContext.h: (): Deleted. * layout/blockformatting/BlockFormattingContextGeometry.cpp: (WebCore::Layout::BlockFormattingContext::Geometry::inFlowWidthAndMargin): * layout/blockformatting/tablewrapper/TableWrapperBlockFormattingContext.cpp: Added. (WebCore::Layout::TableWrapperBlockFormattingContext::TableWrapperBlockFormattingContext): (WebCore::Layout::TableWrapperBlockFormattingContext::layoutInFlowContent): (WebCore::Layout::TableWrapperBlockFormattingContext::layoutTableBox): (WebCore::Layout::TableWrapperBlockFormattingContext::computeWidthAndMarginForTableBox): (WebCore::Layout::TableWrapperBlockFormattingContext::computeHeightAndMarginForTableBox): * layout/blockformatting/tablewrapper/TableWrapperBlockFormattingContext.h: Added. 2020-05-17 Carlos Garcia Campos <cgarcia@igalia.com> [GTK] Move to new Pasteboard API https://bugs.webkit.org/show_bug.cgi?id=177633 Reviewed by Adrian Perez de Castro. Add support for custom data and remove the support for unknown data types that is currently unused. * editing/gtk/EditorGtk.cpp: (WebCore::Editor::writeSelectionToPasteboard): Set the contentOrigin. * editing/gtk/WebContentReaderGtk.cpp: (WebCore::shouldReplaceSubresourceURL): Helper to decide whether to replace the subresource URL. (WebCore::WebContentMarkupReader::readHTML): Create a fragment for HTML sanitizing it if needed. * platform/Pasteboard.h: * platform/PasteboardCustomData.h: (WebCore::PasteboardCustomData::gtkType): Mime type name for GTK custom pasteboard data. * platform/SharedBuffer.h: * platform/glib/SharedBufferGlib.cpp: (WebCore::SharedBuffer::createGBytes const): Create a GBytes wrapping the SharedBuffer data. * platform/gtk/PasteboardGtk.cpp: (WebCore::Pasteboard::writeString): (WebCore::Pasteboard::write): (WebCore::Pasteboard::read): (WebCore::Pasteboard::hasData): (WebCore::Pasteboard::typesSafeForBindings): (WebCore::Pasteboard::typesForLegacyUnsafeBindings): (WebCore::Pasteboard::readOrigin): (WebCore::Pasteboard::readString): (WebCore::Pasteboard::readStringInCustomData): (WebCore::Pasteboard::fileContentState): (WebCore::Pasteboard::writeCustomData): * platform/gtk/SelectionData.cpp: (WebCore::SelectionData::clearAllExceptFilenames): * platform/gtk/SelectionData.h: (WebCore::SelectionData::setCustomData): (WebCore::SelectionData::customData const): (WebCore::SelectionData::hasCustomData const): (WebCore::SelectionData::clearCustomData): 2020-05-16 Simon Fraser <simon.fraser@apple.com> Some color-related cleanup https://bugs.webkit.org/show_bug.cgi?id=211991 Reviewed by Sam Weinig. Change FloatComponents and ColorComponents to use std::array<>. Add Color::toSRGBAComponentsLossy() to make explicit potentially lossy conversions between P3 and sRGB colors, and call it in places where we do that conversion. Add const in a few places. * Headers.cmake: * WebCore.xcodeproj/project.pbxproj: * platform/graphics/Color.cpp: (WebCore::Color::Color): (WebCore::Color::toSRGBAComponentsLossy const): (WebCore::Color::asExtended const): * platform/graphics/Color.h: * platform/graphics/ColorUtilities.cpp: (WebCore::ColorMatrix::ColorMatrix): * platform/graphics/ColorUtilities.h: (WebCore::FloatComponents::FloatComponents): (): Deleted. * platform/graphics/ExtendedColor.cpp: (WebCore::ExtendedColor::create): (WebCore::ExtendedColor::cssText const): * platform/graphics/ExtendedColor.h: (WebCore::ExtendedColor::red const): (WebCore::ExtendedColor::green const): (WebCore::ExtendedColor::blue const): (WebCore::ExtendedColor::alpha const): (WebCore::ExtendedColor::channels const): (WebCore::ExtendedColor::ExtendedColor): * platform/graphics/cg/ColorCG.cpp: (WebCore::leakCGColor): * platform/graphics/filters/FETurbulence.cpp: (WebCore::FETurbulence::fillRegion const): * platform/graphics/filters/FilterOperation.cpp: (WebCore::InvertLightnessFilterOperation::transformColor const): (WebCore::InvertLightnessFilterOperation::inverseTransformColor const): * platform/graphics/gtk/ColorGtk.cpp: (WebCore::Color::operator GdkRGBA const): * platform/graphics/win/ColorDirect2D.cpp: (WebCore::Color::operator D2D1_COLOR_F const): (WebCore::Color::operator D2D1_VECTOR_4F const): 2020-05-16 Andy Estes <aestes@apple.com> Fix the build after r261785. * Modules/applepay/PaymentInstallmentConfiguration.mm: (WebCore::fromDecimalNumber): 2020-05-16 David Kilzer <ddkilzer@apple.com> Let Xcode have its way with WebCore project * WebCore.xcodeproj/project.pbxproj: - Resort TableLayout.cpp. 2020-05-16 Zalan Bujtas <zalan@apple.com> Add missing is<RenderTableSection> check. Unreviewed. * layout/Verification.cpp: (WebCore::Layout::outputMismatchingBlockBoxInformationIfNeeded): 2020-05-16 Andy Estes <aestes@apple.com> REGRESSION (r260717): installmentConfiguration member is no longer available on ApplePayPaymentRequest https://bugs.webkit.org/show_bug.cgi?id=211911 <rdar://problem/63236367> Reviewed by Tim Horton. Prior to r260717, installmentConfiguration was a member of ApplePayRequestBase, making it available on ApplePayRequest and ApplePayPaymentRequest. In r260717, it was mistakenly moved to ApplePayRequest. This change moves it back to ApplePayRequestBase, adds infrastructure for regression testing ApplePayInstallmentConfiguration, and adds a regression test. Test: http/tests/ssl/applepay/ApplePayInstallmentConfiguration.https.html * Modules/applepay/ApplePayInstallmentConfiguration.idl: * Modules/applepay/ApplePayRequestBase.cpp: (WebCore::convertAndValidate): (WebCore::finishConverting): Deleted. * Modules/applepay/ApplePayRequestBase.idl: * Modules/applepay/PaymentInstallmentConfiguration.mm: (WebCore::fromDecimalNumber): (WebCore::applePaySetupFeatureType): (WebCore::PaymentInstallmentConfiguration::applePayInstallmentConfiguration const): * Modules/applepay/PaymentInstallmentConfigurationWebCore.h: * Modules/applepay/paymentrequest/ApplePayRequest.idl: * testing/MockPaymentCoordinator.cpp: (WebCore::MockPaymentCoordinator::showPaymentUI): * testing/MockPaymentCoordinator.h: * testing/MockPaymentCoordinator.idl: 2020-05-16 Zalan Bujtas <zalan@apple.com> [LFC][TFC] Ignore table padding when borders are collapsed https://bugs.webkit.org/show_bug.cgi?id=211984 Reviewed by Antti Koivisto. Table padding has no room left when the table border is collapsed with the inner table elements. Test: fast/layoutformattingcontext/table-simple-border-collapse-with-padding.html * layout/Verification.cpp: (WebCore::Layout::outputMismatchingBlockBoxInformationIfNeeded): * layout/layouttree/LayoutBox.cpp: (WebCore::Layout::Box::isPaddingApplicable const): 2020-05-16 Zalan Bujtas <zalan@apple.com> [LFC][TFC] Take vertical spacing into account when setting the height of a cell with rowspan https://bugs.webkit.org/show_bug.cgi?id=211976 Reviewed by Antti Koivisto. When a cell spans over multiple rows, the height of the cell includes the vertical spacing between those spanned rows as well. Test: fast/layoutformattingcontext/table-simple-rowspan-with-spacing.html * layout/tableformatting/TableFormattingContext.cpp: (WebCore::Layout::TableFormattingContext::setUsedGeometryForCells): 2020-05-15 Antti Koivisto <antti@apple.com> Nullptr crash in MediaQueryMatcher::evaluateAll https://bugs.webkit.org/show_bug.cgi?id=211963 <rdar://problem/62850977> Reviewed by Brent Fulgham. Test: fast/media/media-query-list-mutation.html * css/MediaQueryMatcher.cpp: (WebCore::MediaQueryMatcher::evaluateAll): Copy the vector before iterating. 2020-05-15 Jack Lee <shihchieh_lee@apple.com> Nullptr crash in WebCore::Node::treeScope() when processing nested list insertion commands. https://bugs.webkit.org/show_bug.cgi?id=211964 <rdar://problem/63224871> Reviewed by Geoffrey Garen. Load event may fire in fixOrphanedListChild() and change the node tree. In doApplyForSingleParagraph check for disconnected node returned by fixOrphanedListChild() and bail out. Test: editing/inserting/nested-list-insertion-crash.html * editing/InsertListCommand.cpp: (WebCore::InsertListCommand::doApplyForSingleParagraph): 2020-05-15 Alex Christensen <achristensen@webkit.org> Use enum serialization instead of casting to/from uint32_t https://bugs.webkit.org/show_bug.cgi?id=211885 <rdar://problem/60106629> and <rdar://problem/60107663> Reviewed by Geoffrey Garen. This doesn't change anything except make stricter checks at IPC boundaries. * accessibility/AccessibilityRenderObject.cpp: (WebCore::AccessibilityRenderObject::visiblePositionRangeForLine const): * accessibility/ios/WebAccessibilityObjectWrapperIOS.mm: (-[WebAccessibilityObjectWrapper accessibilityModifySelection:increase:]): * editing/EditingBehavior.h: * editing/Editor.cpp: (WebCore::Editor::shouldSmartDelete): (WebCore::Editor::deleteWithDirection): (WebCore::Editor::misspelledWordAtCaretOrRange const): (WebCore::Editor::guessesForMisspelledOrUngrammatical): (WebCore::Editor::markMisspellingsAfterTypingToWord): (WebCore::Editor::markAndReplaceFor): (WebCore::Editor::handleAcceptedCandidate): * editing/EditorCommand.cpp: (WebCore::executeDeleteBackward): (WebCore::executeDeleteBackwardByDecomposingPreviousCharacter): (WebCore::executeDeleteForward): (WebCore::executeDeleteToBeginningOfLine): (WebCore::executeDeleteToBeginningOfParagraph): (WebCore::executeDeleteToEndOfLine): (WebCore::executeDeleteToEndOfParagraph): (WebCore::executeDeleteWordBackward): (WebCore::executeDeleteWordForward): (WebCore::executeForwardDelete): (WebCore::executeMoveBackward): (WebCore::executeMoveBackwardAndModifySelection): (WebCore::executeMoveDown): (WebCore::executeMoveDownAndModifySelection): (WebCore::executeMoveForward): (WebCore::executeMoveForwardAndModifySelection): (WebCore::executeMoveLeft): (WebCore::executeMoveLeftAndModifySelection): (WebCore::executeMoveRight): (WebCore::executeMoveRightAndModifySelection): (WebCore::executeMoveToBeginningOfDocument): (WebCore::executeMoveToBeginningOfDocumentAndModifySelection): (WebCore::executeMoveToBeginningOfLine): (WebCore::executeMoveToBeginningOfLineAndModifySelection): (WebCore::executeMoveToBeginningOfParagraph): (WebCore::executeMoveToBeginningOfParagraphAndModifySelection): (WebCore::executeMoveToBeginningOfSentence): (WebCore::executeMoveToBeginningOfSentenceAndModifySelection): (WebCore::executeMoveToEndOfDocument): (WebCore::executeMoveToEndOfDocumentAndModifySelection): (WebCore::executeMoveToEndOfSentence): (WebCore::executeMoveToEndOfSentenceAndModifySelection): (WebCore::executeMoveToEndOfLine): (WebCore::executeMoveToEndOfLineAndModifySelection): (WebCore::executeMoveToEndOfParagraph): (WebCore::executeMoveToEndOfParagraphAndModifySelection): (WebCore::executeMoveParagraphBackwardAndModifySelection): (WebCore::executeMoveParagraphForwardAndModifySelection): (WebCore::executeMoveUp): (WebCore::executeMoveUpAndModifySelection): (WebCore::executeMoveWordBackward): (WebCore::executeMoveWordBackwardAndModifySelection): (WebCore::executeMoveWordForward): (WebCore::executeMoveWordForwardAndModifySelection): (WebCore::executeMoveWordLeft): (WebCore::executeMoveWordLeftAndModifySelection): (WebCore::executeMoveWordRight): (WebCore::executeMoveWordRightAndModifySelection): (WebCore::executeMoveToLeftEndOfLine): (WebCore::executeMoveToLeftEndOfLineAndModifySelection): (WebCore::executeMoveToRightEndOfLine): (WebCore::executeMoveToRightEndOfLineAndModifySelection): (WebCore::executeSelectLine): (WebCore::executeSelectParagraph): (WebCore::executeSelectSentence): (WebCore::executeSelectWord): * editing/FrameSelection.cpp: (WebCore::FrameSelection::FrameSelection): (WebCore::FrameSelection::willBeModified): (WebCore::FrameSelection::modifyExtendingRight): (WebCore::FrameSelection::modifyExtendingForward): (WebCore::FrameSelection::modifyMovingRight): (WebCore::FrameSelection::modifyMovingForward): (WebCore::FrameSelection::modifyExtendingLeft): (WebCore::FrameSelection::modifyExtendingBackward): (WebCore::FrameSelection::modifyMovingLeft): (WebCore::FrameSelection::modifyMovingBackward): (WebCore::isBoundary): (WebCore::FrameSelection::textSelectionIntent): (WebCore::textSelectionWithDirectionAndGranularity): (WebCore::FrameSelection::modify): (WebCore::FrameSelection::clear): (WebCore::FrameSelection::willBeRemovedFromFrame): (WebCore::FrameSelection::updateAppearance): (WebCore::FrameSelection::wordSelectionContainingCaretSelection): (WebCore::FrameSelection::rangeByAlteringCurrentSelection const): * editing/FrameSelection.h: * editing/TextGranularity.h: (): Deleted. * editing/TypingCommand.cpp: (WebCore::editActionForTypingCommand): (WebCore::TypingCommand::deleteKeyPressed): (WebCore::TypingCommand::forwardDeleteKeyPressed): (WebCore::TypingCommand::insertTextRunWithoutNewlines): (WebCore::TypingCommand::insertLineBreak): (WebCore::TypingCommand::insertParagraphSeparator): (WebCore::TypingCommand::insertParagraphSeparatorInQuotedContent): (WebCore::TypingCommand::deleteSelection): * editing/TypingCommand.h: * editing/VisibleSelection.cpp: (WebCore::VisibleSelection::setStartAndEndFromBaseAndExtentRespectingGranularity): * editing/VisibleSelection.h: * editing/VisibleUnits.cpp: (WebCore::directionIsDownstream): (WebCore::atBoundaryOfGranularity): (WebCore::withinTextUnitOfGranularity): (WebCore::nextWordBoundaryInDirection): (WebCore::nextSentenceBoundaryInDirection): (WebCore::nextParagraphBoundaryInDirection): (WebCore::positionOfNextBoundaryOfGranularity): (WebCore::enclosingTextUnitOfGranularity): (WebCore::charactersAroundPosition): (WebCore::wordRangeFromPosition): (WebCore::closestWordBoundaryForPosition): (WebCore::rangeExpandedByCharactersInDirectionAtWordBoundary): (WebCore::wordBoundaryForPositionWithoutCrossingLine): * editing/cocoa/DataDetection.mm: (WebCore::DataDetection::detectItemAroundHitTestResult): * editing/cocoa/DictionaryLookup.mm: * editing/mac/DictionaryLookupLegacy.mm: * html/canvas/WebGLRenderingContextBase.cpp: (WebCore::WebGLRenderingContextBase::create): * loader/FrameLoaderClient.h: (WebCore::FrameLoaderClient::webGLPolicyForURL const): (WebCore::FrameLoaderClient::resolveWebGLPolicyForURL const): (): Deleted. * loader/FrameLoaderTypes.h: * page/ContextMenuController.cpp: (WebCore::ContextMenuController::contextMenuItemSelected): * page/DOMSelection.cpp: (WebCore::DOMSelection::modify): * page/DragController.cpp: (WebCore::DragController::concludeEditDrag): * page/EventHandler.cpp: (WebCore::EventHandler::updateSelectionForMouseDownDispatchingSelectStart): (WebCore::EventHandler::selectClosestWordFromHitTestResult): (WebCore::EventHandler::selectClosestContextualWordFromMouseEvent): (WebCore::EventHandler::selectClosestContextualWordOrLinkFromMouseEvent): (WebCore::EventHandler::handleMousePressEventTripleClick): (WebCore::EventHandler::handleMousePressEventSingleClick): (WebCore::EventHandler::updateSelectionForMouseDrag): (WebCore::setInitialKeyboardSelection): (WebCore::handleKeyboardSelectionMovement): * rendering/HitTestResult.cpp: (WebCore::HitTestResult::isOverTextInsideFormControlElement const): 2020-05-15 Simon Fraser <simon.fraser@apple.com> Rename the mapLocalToContainer() container argument, since it's not just used for repaint https://bugs.webkit.org/show_bug.cgi?id=211974 Reviewed by Zalan Bujtas. mapLocalToContainer() is a generic geometry mapping function, and not just used for repaint, so rename the "repaintContainer" argument to "ancestorContainer". Also fix some weirdly named variables in RenderMultiColumnFlow. * rendering/RenderBox.cpp: (WebCore::RenderBox::mapLocalToContainer const): * rendering/RenderBox.h: * rendering/RenderFragmentedFlow.cpp: (WebCore::RenderFragmentedFlow::mapLocalToContainer const): * rendering/RenderFragmentedFlow.h: * rendering/RenderInline.cpp: (WebCore::RenderInline::mapLocalToContainer const): (WebCore::RenderInline::pushMappingToContainer const): * rendering/RenderMultiColumnFlow.cpp: (WebCore::RenderMultiColumnFlow::addFragmentToThread): (WebCore::RenderMultiColumnFlow::mapFromFlowToFragment const): (WebCore::RenderMultiColumnFlow::physicalTranslationOffsetFromFlowToFragment const): (WebCore::RenderMultiColumnFlow::physicalTranslationFromFlowToFragment const): * rendering/RenderObject.cpp: (WebCore::RenderObject::mapLocalToContainer const): (WebCore::RenderObject::localToContainerQuad const): (WebCore::RenderObject::localToContainerPoint const): * rendering/RenderObject.h: * rendering/RenderView.cpp: (WebCore::RenderView::mapLocalToContainer const): * rendering/svg/RenderSVGForeignObject.cpp: (WebCore::RenderSVGForeignObject::mapLocalToContainer const): * rendering/svg/RenderSVGForeignObject.h: * rendering/svg/RenderSVGInline.cpp: (WebCore::RenderSVGInline::mapLocalToContainer const): * rendering/svg/RenderSVGInline.h: * rendering/svg/RenderSVGModelObject.cpp: (WebCore::RenderSVGModelObject::mapLocalToContainer const): * rendering/svg/RenderSVGModelObject.h: * rendering/svg/RenderSVGRoot.cpp: (WebCore::RenderSVGRoot::mapLocalToContainer const): * rendering/svg/RenderSVGRoot.h: * rendering/svg/RenderSVGText.cpp: (WebCore::RenderSVGText::mapLocalToContainer const): * rendering/svg/RenderSVGText.h: * rendering/svg/SVGRenderSupport.cpp: (WebCore::SVGRenderSupport::mapLocalToContainer): * rendering/svg/SVGRenderSupport.h: 2020-05-15 Simon Fraser <simon.fraser@apple.com> REGRESSION (r249091): Can't click on a video in the second column of a paginated web view https://bugs.webkit.org/show_bug.cgi?id=211973 <rdar://problem/61418775> Reviewed by Zalan Bujtas. In r249091 I made clip layer computation use offsetFromAncestor() by default, but this turns out to give different behavior from mapping via renderers in columns. The bug was that accumulateOffsetTowardsAncestor() would map through the RenderMultiColumnFlow columns if the ancestorLayer was the one that was using columns, but mapping via renderers only maps through columns if converting to some ancestor of the columnated renderer. I did not investigate why this only affects video. Test: fast/multicol/clipped-video-in-second-column.html * rendering/RenderLayer.cpp: (WebCore::accumulateOffsetTowardsAncestor): (WebCore::RenderLayer::calculateClipRects const): 2020-05-15 Kenneth Russell <kbr@chromium.org> OES_texture_float internal format conversion must depend on WEBGL_color_buffer_float https://bugs.webkit.org/show_bug.cgi?id=211971 Reviewed by Dean Jackson. Only adjust the internal formats of textures created for the WebGL 1.0 OES_texture_float extension if the WEBGL_color_buffer_float extension has been enabled. Covered by the WebGL 1.0 OES_texture_float conformance tests when run on iOS with another forthcoming fix to ANGLE which will enable the OES_texture_float extension on that platform. * platform/graphics/angle/ExtensionsGLANGLE.cpp: (WebCore::ExtensionsGLANGLE::ensureEnabled): (WebCore::ExtensionsGLANGLE::adjustWebGL1TextureInternalFormat): * platform/graphics/angle/ExtensionsGLANGLE.h: * platform/graphics/angle/GraphicsContextGLANGLE.cpp: (WebCore::GraphicsContextGLOpenGL::texImage2DDirect): 2020-05-15 Oriol Brufau <obrufau@igalia.com> [css-grid] Treat percentages as auto for the minimum contribution https://bugs.webkit.org/show_bug.cgi?id=195967 Reviewed by Manuel Rego Casasnovas. The minimum contribution of a grid item is the outer size resulting from the minimum size if the computed preferred size behaves as auto, or the min-content contribution otherwise. If the preferred size is a percentage, it should be resolved with respect to the grid area, which depends on the minimum contribution of the item. Thus the percentage is cyclic and behaves as auto. Before this change, WebKit only checked whether the preferred size is auto, not whether it behaves as auto. In fact this was according to an older version of the spec, but it was changed in https://github.com/w3c/csswg-drafts/issues/2367 Test: imported/w3c/web-platform-tests/css/css-grid/grid-definition/grid-minimum-contribution-with-percentages.html Some cases in the test still fail due to bug 209461. * rendering/GridTrackSizingAlgorithm.cpp: (WebCore::GridTrackSizingAlgorithmStrategy::minSizeForChild const): 2020-05-15 Antoine Quint <graouts@apple.com> [Web Animations] Animation with a single keyframe is not accelerated https://bugs.webkit.org/show_bug.cgi?id=188730 <rdar://problem/43481113> Reviewed by Dean Jackson. Test: webanimations/accelerated-animation-single-keyframe.html Prior to attempting to run an accelerated effect, ensure that the KeyframeList passed to RenderLayerModelObject::startAnimation() does not have implicit keyframes since eventually GraphicsLayerCA::animationCanBeAccelerated() would be called and would reject a single-keyframe animation. To do this, we use the same code used in Style::Resolver::keyframeStylesForAnimation() which we refactor in the new KeyframeList::fillImplicitKeyframes() method. * animation/KeyframeEffect.cpp: (WebCore::KeyframeEffect::copyPropertiesFromSource): (WebCore::KeyframeEffect::applyPendingAcceleratedActions): * rendering/style/KeyframeList.cpp: (WebCore::KeyframeList::hasImplicitKeyframes const): (WebCore::KeyframeList::copyKeyframes): (WebCore::zeroPercentKeyframe): (WebCore::hundredPercentKeyframe): (WebCore::KeyframeList::fillImplicitKeyframes): * rendering/style/KeyframeList.h: * style/StyleResolver.cpp: (WebCore::Style::Resolver::keyframeStylesForAnimation): 2020-05-15 Said Abou-Hallawa <sabouhallawa@apple.com> The initial value of "transform-box" should be "view-box" https://bugs.webkit.org/show_bug.cgi?id=211927 Reviewed by Simon Fraser. Specs: https://drafts.csswg.org/css-transforms/#transform-box. Test: svg/transforms/svg-transform-box-initial.html * css/CSSProperties.json: * rendering/style/RenderStyle.h: (WebCore::RenderStyle::initialTransformBox): 2020-05-15 Andres Gonzalez <andresg_22@apple.com> Fix for crash in accessibility/mac/replace-text-with-range-on-webarea-element.html in isolated tree mode. https://bugs.webkit.org/show_bug.cgi?id=211954 Reviewed by Chris Fleizach. Fixes crash in isolated tree mode in accessibility/mac/replace-text-with-range-on-webarea-element.html. * accessibility/AXObjectCache.cpp: (WebCore::AXObjectCache::postTextStateChangeNotification): Check for null object before dereferencing. (WebCore::AXObjectCache::rootWebArea): Reverted to returning an AXObject since it is not needed to return AXCoreObject. * accessibility/AXObjectCache.h: 2020-05-15 Zalan Bujtas <zalan@apple.com> [LFC][TFC] Move column and row balancing logic to a dedicated class https://bugs.webkit.org/show_bug.cgi?id=211937 Reviewed by Antti Koivisto. * Sources.txt: * WebCore.xcodeproj/project.pbxproj: * layout/tableformatting/TableFormattingContext.cpp: (WebCore::Layout::TableFormattingContext::layoutInFlowContent): (WebCore::Layout::TableFormattingContext::setUsedGeometryForRows): (WebCore::Layout::TableFormattingContext::computeAndDistributeExtraSpace): (WebCore::Layout::ColumnSpan::hasSpan): Deleted. (WebCore::Layout::ColumnSpan::isSpanned): Deleted. (WebCore::Layout::ColumnSpan::spanCount): Deleted. (WebCore::Layout::ColumnSpan::startSpan): Deleted. (WebCore::Layout::ColumnSpan::endSpan): Deleted. (WebCore::Layout::ColumnSpan::index): Deleted. (WebCore::Layout::ColumnSpan::size): Deleted. (WebCore::Layout::ColumnSpan::spacing): Deleted. (WebCore::Layout::RowSpan::hasSpan): Deleted. (WebCore::Layout::RowSpan::isSpanned): Deleted. (WebCore::Layout::RowSpan::spanCount): Deleted. (WebCore::Layout::RowSpan::startSpan): Deleted. (WebCore::Layout::RowSpan::endSpan): Deleted. (WebCore::Layout::RowSpan::index): Deleted. (WebCore::Layout::RowSpan::size): Deleted. (WebCore::Layout::RowSpan::spacing): Deleted. (WebCore::Layout::GridSpace::isEmpty const): Deleted. (): Deleted. (WebCore::Layout::max): Deleted. (WebCore::Layout::operator-): Deleted. (WebCore::Layout::operator+=): Deleted. (WebCore::Layout::operator-=): Deleted. (WebCore::Layout::operator/): Deleted. (WebCore::Layout::distributeAvailableSpace): Deleted. (WebCore::Layout::TableFormattingContext::computeAndDistributeExtraHorizontalSpace): Deleted. (WebCore::Layout::TableFormattingContext::computeAndDistributeExtraVerticalSpace): Deleted. * layout/tableformatting/TableFormattingContext.h: * layout/tableformatting/TableFormattingState.h: (WebCore::Layout::TableFormattingState::tableGrid const): * layout/tableformatting/TableGrid.h: (WebCore::Layout::TableGrid::widthConstraints const): (WebCore::Layout::TableGrid::Rows::list const): (WebCore::Layout::TableGrid::widthConstraints): Deleted. (WebCore::Layout::TableGrid::Rows::rowList const): Deleted. 2020-05-15 Alicia Boya García <aboya@igalia.com> [GStreamer][MediaStream] Fix missing video size https://bugs.webkit.org/show_bug.cgi?id=211938 Reviewed by Philippe Normand. r261683 redefined m_currentVideoStreamId. Under the new design, tracks have several states: - "wanted": a track has been selected from JavaScript, or chosen by default. - "requested": a track that is expected to be chosen by the next STREAMS_SELECTED message. - "current": a track that has been selected after the STREAMS_SELECTED message has been handled. naturalSize() used to check m_currentVideoStreamId to look for the video size, but this is called relatively early before the track becomes "current" under the new design. Since the size tags can't be queried at any time, it makes sense to use m_wantedVideoStreamId instead. This fixes the following tests which were previously regressed: fast/mediastream/get-user-media-constraints.html fast/mediastream/getUserMedia-video-rescaling.html fast/mediastream/mediastreamtrack-video-clone.html imported/w3c/web-platform-tests/mediacapture-streams/MediaStream-MediaElement-firstframe.https.html fast/mediastream/media-stream-renders-first-frame.html * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp: (WebCore::MediaPlayerPrivateGStreamer::naturalSize const): 2020-05-15 Antti Koivisto <antti@apple.com> [Wheel event region] Invalidation when changing listeners on elements https://bugs.webkit.org/show_bug.cgi?id=211895 Reviewed by Simon Fraser. Doesn't handle root (window/document) invalidation yet. Test: fast/scrolling/mac/wheel-event-listener-region-element-invalidation.html * dom/EventTarget.cpp: (WebCore::EventTarget::addEventListener): (WebCore::EventTarget::removeEventListener): (WebCore::EventTarget::removeAllEventListeners): Invalidate element style on wheel event changes. * rendering/RenderElement.cpp: (WebCore::RenderElement::styleWillChange): * rendering/RenderLayer.cpp: (WebCore::RenderLayer::invalidateEventRegion): Build on non-iOS platforms. * rendering/RenderLayerBacking.cpp: (WebCore::RenderLayerBacking::maintainsEventRegion const): Factor into function so it can be shared with RenderLayer::invalidateEventRegion. (WebCore::RenderLayerBacking::updateEventRegion): * rendering/RenderLayerBacking.h: 2020-05-15 Antoine Quint <graouts@apple.com> Cursor should not update on a 20ms timer https://bugs.webkit.org/show_bug.cgi?id=211884 <rdar://problem/63220368> Reviewed by Simon Fraser. Test: fast/events/mouse-cursor-udpate-during-raf.html Update cursors after rAF callbacks have been serviced and layout has been updated. * page/Page.cpp: (WebCore::Page::updateRendering): (WebCore::Page::doAfterUpdateRendering): 2020-05-15 Andres Gonzalez <andresg_22@apple.com> Update the isolated tree only if isolated tree mode is enabled. https://bugs.webkit.org/show_bug.cgi?id=211936 Reviewed by Chris Fleizach. Check for isIsolatedTreeEnabled before updating the isolated tree. * accessibility/AXObjectCache.cpp: (WebCore::AXObjectCache::updateIsolatedTree): 2020-05-15 Adrian Perez de Castro <aperez@igalia.com> [GTK3] Bring back usage of GtkMenu for context menus https://bugs.webkit.org/show_bug.cgi?id=211557 Reviewed by Carlos Garcia Campos. No new tests needed. * platform/gtk/GtkVersioning.h: Remove GtkPopover functions used only for context menus. 2020-05-14 Said Abou-Hallawa <sabouhallawa@apple.com> Unreviewed. Fix build warning after r261113 Remove unused variable. * dom/ScriptedAnimationController.cpp: (WebCore::ScriptedAnimationController::preferredScriptedAnimationInterval const): 2020-05-14 Andres Gonzalez <andresg_22@apple.com> Expose isColumnHeaderCell and isRowHeaderCell through AXCoreObject. https://bugs.webkit.org/show_bug.cgi?id=211919 Reviewed by Chris Fleizach. Multiple tests including accessibility/crash-table-recursive-layout.html. - Expose isColumn/RowHeaderCell through AXCoreObject in order to make the return value of AccessibilityTable::cellForColumnAndRow an AXCoreObject. - Implemented these methods for AXIsolatedObject. - isolatedCopy the accessibilityDescription property. * accessibility/AccessibilityObject.h: * accessibility/AccessibilityObjectInterface.h: * accessibility/AccessibilityTable.cpp: (WebCore::AccessibilityTable::cellForColumnAndRow): Removed incorrect assert since children are AXCoreObjects and not necessarily AccessibilityTableCells. * accessibility/AccessibilityTable.h: * accessibility/AccessibilityTableCell.cpp: (WebCore::AccessibilityTableCell::isTableCellInSameRowGroup): (WebCore::AccessibilityTableCell::isTableCellInSameColGroup): (WebCore::AccessibilityTableCell::columnHeaders): (WebCore::AccessibilityTableCell::rowHeaders): * accessibility/AccessibilityTableCell.h: * accessibility/AccessibilityTableColumn.cpp: (WebCore::AccessibilityTableColumn::addChildren): * accessibility/ios/WebAccessibilityObjectWrapperIOS.mm: (-[WebAccessibilityObjectWrapper accessibilityElementForRow:andColumn:]): * accessibility/isolatedtree/AXIsolatedObject.cpp: (WebCore::AXIsolatedObject::initializeAttributeData): * accessibility/isolatedtree/AXIsolatedObject.h: 2020-05-14 Timothy Hatcher <timothy@apple.com> Add baseURL version of _WKUserStyleSheet forWKWebView. https://bugs.webkit.org/show_bug.cgi?id=211926 rdar://problem/62074675 Reviewed by Devin Rousso. Consolidate the paths taken for adding a UserStyleSheet. The m_injectedStyleSheetToSource was missing for page specific style sheets since it was another loop. * dom/ExtensionStyleSheets.cpp: (WebCore::ExtensionStyleSheets::updateInjectedStyleSheetCache const): (WebCore::ExtensionStyleSheets::injectPageSpecificUserStyleSheet): (WebCore::ExtensionStyleSheets::removePageSpecificUserStyleSheet): (WebCore::ExtensionStyleSheets::detachFromDocument): * dom/ExtensionStyleSheets.h: 2020-05-14 Jiewen Tan <jiewen_tan@apple.com> [WebAuthn] Relaxing signature length requirements for U2fRegister https://bugs.webkit.org/show_bug.cgi?id=209645 <rdar://problem/63204591> Reviewed by Brent Fulgham. It turns out the length range specified from the spec, i.e., [71, 73] is wrong. https://fidoalliance.org/specs/fido-u2f-v1.2-ps-20170411/fido-u2f-raw-message-formats-v1.2-ps-20170411.html#registration-response-message-success It should actually be [70, 72]. However, as a middleware to relay the messages, user agents are not necessary to check the length. Therefore, the check is relaxed to make the code more robust. Covered by existing tests. * Modules/webauthn/fido/U2fResponseConverter.cpp: (fido::WebCore::createFidoAttestationStatementFromU2fRegisterResponse): 2020-05-14 Timothy Hatcher <timothy@apple.com> Add sourceURL to _evaluateJavaScript: so the scripts appear in Web Inspector. https://bugs.webkit.org/show_bug.cgi?id=211904 rdar://problem/62074376 Reviewed by Devin Rousso. Added sourceURL to RunJavaScriptParameters. Use it instead of the frame's document URL. * bindings/js/RunJavaScriptParameters.h: (WebCore::RunJavaScriptParameters::RunJavaScriptParameters): (WebCore::RunJavaScriptParameters::encode const): (WebCore::RunJavaScriptParameters::decode): * bindings/js/ScriptController.cpp: (WebCore::ScriptController::executeScriptInWorldIgnoringException): (WebCore::ScriptController::executeScriptInWorld): (WebCore::ScriptController::callInWorld): (WebCore::ScriptController::executeUserAgentScriptInWorld): 2020-05-14 Eric Carlson <eric.carlson@apple.com> [Cocoa] Don't clear NowPlaying state unless it was set https://bugs.webkit.org/show_bug.cgi?id=211899 <rdar://problem/62249870> Reviewed by Jer Noble. Test: media/now-playing-status-without-media.html * platform/audio/PlatformMediaSessionManager.h: (WebCore::PlatformMediaSessionManager::haveEverRegisteredAsNowPlayingApplication const): Method added for testing. * platform/audio/cocoa/MediaSessionManagerCocoa.h: * platform/audio/cocoa/MediaSessionManagerCocoa.mm: (WebCore::MediaSessionManagerCocoa::updateNowPlayingInfo): Don't clear NowPlaying state unless it was setup in the first place. * testing/Internals.cpp: (WebCore::Internals::nowPlayingState const): Add new property. * testing/Internals.h: * testing/Internals.idl: 2020-05-14 Andres Gonzalez <andresg_22@apple.com> AXCoreObject font comparison methods should take another AXCoreObject instead of a RenderObject. https://bugs.webkit.org/show_bug.cgi?id=211909 Reviewed by Chris Fleizach. Covered by existing tests. - In order for font comparison methods to be implementted for both AXObjects and AXIsolatedObjects, they should take another AXCoreObject to compare against, instead of a RenderObject. - The AXIsolatedObject implementation of these methods is forwarded to the associated AXObject and dispatched to the main thread. - Implemented AXIsolatedObject::accessibilityDescription, hasUnderline and isUnvisited. * accessibility/AccessibilityObject.cpp: (WebCore::Accessibility::isAccessibilityObjectSearchMatchAtIndex): * accessibility/AccessibilityObject.h: * accessibility/AccessibilityObjectInterface.h: (WebCore::AXCoreObject::isNativeListBox const): * accessibility/AccessibilityRenderObject.cpp: (WebCore::AccessibilityRenderObject::hasSameFont const): (WebCore::AccessibilityRenderObject::hasSameFontColor const): (WebCore::AccessibilityRenderObject::hasSameStyle const): * accessibility/AccessibilityRenderObject.h: * accessibility/isolatedtree/AXIsolatedObject.cpp: (WebCore::AXIsolatedObject::initializeAttributeData): (WebCore::AXIsolatedObject::hasSameFont const): (WebCore::AXIsolatedObject::hasSameFontColor const): (WebCore::AXIsolatedObject::hasSameStyle const): (WebCore::AXIsolatedObject::isNativeListBox const): Deleted, implemented in base class. (WebCore::AXIsolatedObject::isUnvisited const): Deleted, inlined in header. (WebCore::AXIsolatedObject::hasUnderline const): Deleted, inlined in header. (WebCore::AXIsolatedObject::accessibilityDescription const): Deleted, inlined in header. * accessibility/isolatedtree/AXIsolatedObject.h: 2020-05-14 Nikita Vasilyev <nvasilyev@apple.com> Web Inspector: front-end shouldn't change the order of User Style Sheet rules https://bugs.webkit.org/show_bug.cgi?id=210893 <rdar://problem/61937118> Reviewed by Devin Rousso. Previously, some style sheets were falsly detected as Inspector::Protocol::CSS::StyleSheetOrigin::User causing incorrect order of style rules in Web Inspector. Test: inspector/css/getMatchedStylesForNode.html * inspector/agents/InspectorCSSAgent.cpp: (WebCore::InspectorCSSAgent::detectOrigin): 2020-05-14 Wenson Hsieh <wenson_hsieh@apple.com> [macOS] Update the placeholder icon image for attachment elements with progress="0" https://bugs.webkit.org/show_bug.cgi?id=211898 <rdar://problem/63203900> Reviewed by Timothy Hatcher. Refactor logic for creating an attachment placeholder image into a separate helper method, with a WebKitAdditions implementation when HAVE(SYSTEM_ATTACHMENT_PLACEHOLDER_ICON) is defined. * rendering/RenderThemeMac.mm: (WebCore::createAttachmentPlaceholderImage): (WebCore::paintAttachmentIconPlaceholder): 2020-05-14 Chris Dumez <cdumez@apple.com> Regression(r254856) Family Health iOS app is broken due to lack for WebSQL support https://bugs.webkit.org/show_bug.cgi?id=211896 <rdar://problem/63025045> Reviewed by Maciej Stachowiak. Add RuntimeApplicationChecks function to identify Family Health app on iOS. * platform/RuntimeApplicationChecks.h: * platform/cocoa/RuntimeApplicationChecksCocoa.mm: (WebCore::IOSApplication::isFamilyHealthApp): 2020-05-14 Andres Gonzalez <andresg_22@apple.com> AXIsolatedTree::updateChildren needs to apply pending changes before updating the given node. https://bugs.webkit.org/show_bug.cgi?id=211790 Reviewed by Chris Fleizach. Covered by multiple tests. AXIsolatedTree::updateChildren may be fired for an isolated object that is still in the pending changes list, and thus nodeForID would fail, causing the isolated tree to not be updated. This patch calls applyPendingChanges before updating the given node's children. Additional logging was added including the logging of the AXObjectCache object hierarchy. * accessibility/AXLogger.cpp: (WebCore::AXLogger::log): (WebCore::operator<<): * accessibility/AXLogger.h: * accessibility/AXObjectCache.cpp: (WebCore::AXObjectCache::remove): (WebCore::AXObjectCache::postNotification): (WebCore::AXObjectCache::performDeferredCacheUpdate): (WebCore::AXObjectCache::updateIsolatedTree): * accessibility/AXObjectCache.h: * accessibility/isolatedtree/AXIsolatedTree.cpp: (WebCore::AXIsolatedTree::updateNode): (WebCore::AXIsolatedTree::updateSubtree): (WebCore::AXIsolatedTree::updateChildren): (WebCore::AXIsolatedTree::focusedNode): (WebCore::AXIsolatedTree::removeNode): (WebCore::AXIsolatedTree::removeSubtree): (WebCore::AXIsolatedTree::applyPendingChanges): * accessibility/mac/WebAccessibilityObjectWrapperMac.mm: (-[WebAccessibilityObjectWrapper accessibilityAttributeValue:]): 2020-05-14 Andres Gonzalez <andresg_22@apple.com> Fix for crash in LayoutTest in isolated tree mode. https://bugs.webkit.org/show_bug.cgi?id=211894 Reviewed by Chris Fleizach. Several LayoutTests. * accessibility/mac/WebAccessibilityObjectWrapperMac.mm: (-[WebAccessibilityObjectWrapper accessibilityArrayAttributeValues:index:maxCount:]): Check backing object for nullity before dereferencing. 2020-05-14 Andres Gonzalez <andresg_22@apple.com> AXIsolatedObject::isOnScreen needs to be dispatched to the main thread. https://bugs.webkit.org/show_bug.cgi?id=211893 Reviewed by Chris Fleizach. Covered by existing tests. * accessibility/isolatedtree/AXIsolatedObject.cpp: (WebCore::AXIsolatedObject::children): Split assert into two lines for readability. (WebCore::AXIsolatedObject::isOnScreen const): Forward to associated AXObject and dispatch to the main thread. 2020-05-14 Andres Gonzalez <andresg_22@apple.com> Implementation of AXIsolatedObject::hasPlainText. https://bugs.webkit.org/show_bug.cgi?id=211892 Reviewed by Chris Fleizach. Covered by existing tests. Adding hasPlainText to the cached properties map. * accessibility/isolatedtree/AXIsolatedObject.cpp: (WebCore::AXIsolatedObject::initializeAttributeData): (WebCore::AXIsolatedObject::hasPlainText const): Deleted, inlined in header. * accessibility/isolatedtree/AXIsolatedObject.h: 2020-05-14 Sergio Villar Senin <svillar@igalia.com> Unreviewed build fix. * html/HTMLCanvasElement.cpp: (WebCore::HTMLCanvasElement::createContextWebGL): downcast m_context to WebGLRenderingContextBase before calling isXRCompatible(). It's created as a WebGLRenderingContextBase but stored in a CanvasRenderingContext. 2020-05-14 Andres Gonzalez <andresg_22@apple.com> Replacing and inserting text need to be dispatched to the main thread. https://bugs.webkit.org/show_bug.cgi?id=211863 Reviewed by Chris Fleizach. Covered by existing tests. In isolated tree mode WebAccessibilityObjectWrapper accessibilityReplaceRange and InsertText may be called on the secondary thread. Thus the AXIsolatedObject implementation of this functionality needs to forward these calls to the associated AXObject on the main thread. * accessibility/isolatedtree/AXIsolatedObject.cpp: (WebCore::AXIsolatedObject::replaceTextInRange): (WebCore::AXIsolatedObject::insertText): * accessibility/mac/WebAccessibilityObjectWrapperMac.mm: (-[WebAccessibilityObjectWrapper accessibilityReplaceRange:withText:]): (-[WebAccessibilityObjectWrapper accessibilityInsertText:]): 2020-05-14 Antoine Quint <graouts@apple.com> Cursor should not update on a 20ms timer https://bugs.webkit.org/show_bug.cgi?id=211884 <rdar://problem/63220368> Reviewed by Antti Koivisto. Update the cursor during page rendering rather than using a 20ms timer. * page/EventHandler.cpp: (WebCore::EventHandler::EventHandler): (WebCore::EventHandler::clear): (WebCore::EventHandler::updateCursorIfNeeded): (WebCore::EventHandler::handleMouseMoveEvent): (WebCore::EventHandler::scheduleCursorUpdate): (WebCore::EventHandler::cursorUpdateTimerFired): Deleted. * page/EventHandler.h: * page/Page.cpp: (WebCore::Page::updateRendering): 2020-05-14 Philippe Normand <pnormand@igalia.com> [GStreamer] webrtc/disable-encryption.html is a crashing flaky https://bugs.webkit.org/show_bug.cgi?id=211166 Reviewed by Xabier Rodriguez-Calvar. Make sure the audio and video mediastream source elements are correctly removed and disposed from their parent bin when resetting the track sources. Before this change there was a possibility of disposing the elements while they were still in PLAYING state. * platform/mediastream/gstreamer/GStreamerMediaStreamSource.cpp: (WebCore::_WebKitMediaStreamSrc::SourceData::reset): (WebCore::webkitMediaStreamSrcDispose): (WebCore::webkitMediaStreamSrcRemoveTrackByType): 2020-05-14 Adrian Perez de Castro <aperez@igalia.com> Non-unified build fixed, mid May 2020 edition https://bugs.webkit.org/show_bug.cgi?id=211859 Unreviewed build. No new tests needed. * Modules/indexeddb/server/UniqueIDBDatabase.cpp: Add missing IDBBindingUtilities.h and IDBSerializationContext.h includes. * accessibility/AccessibilityRenderObject.cpp: Add missing EventHandler.h include. * css/parser/CSSParserToken.cpp: Add missing RuntimeEnabledFeatures.h include. * editing/gtk/WebContentReaderGtk.cpp: Add missing Blob.h include. * html/canvas/OESTextureHalfFloat.cpp: Add missing ExtensionsGL.h include. * page/ShareDataReader.h: Add missing ExceptionOr.h include. * rendering/ContentfulPaintChecker.cpp: Add missing RenderView.h include. * rendering/style/StyleRareInheritedData.h: Add missing RenderStyleConstants.h and wtf/OptionSet.h includes. * rendering/style/StyleRareNonInheritedData.h: Add missing TouchAction.h and wtf/OptionSet.h includes. * style/StyleAdjuster.h: Add missing RenderStyleConstants.h include and forward declaration for WebCore::EventTarget. 2020-05-14 Alicia Boya García <aboya@igalia.com> [GStreamer] Playbin3 track switch rework https://bugs.webkit.org/show_bug.cgi?id=211623 Reviewed by Philippe Normand. This patch reworks how track selection and reporting of selected tracks is done in the player. The following found limitations and assumptions in current GStreamer have informed this patch: a) Although the API for playbin3 is designed to be able to accept any number of tracks of any kind, this is not supported in practice. b) The first track of each type is always selected. Even in playbin3 mode, looking for GST_STREAM_FLAG_SELECT is not a reliable method, as in most cases the demuxer does not set it at all. [qtdemux never sets it at all, and matroskademux only sets it in certain cases.] c) Sending GST_EVENT_SELECT_STREAMS is only safe at certain moments. It's not safe before pre-roll, after EOS or during the handling of another SELECT_STREAMS. d) Selecting text tracks with playbin APIs is not relevant. All text tracks are already being picked by WebKitTextCombiner, unaffected by playbin track selection. e) Tracks requested in a GST_EVENT_SELECT_STREAMS are eventually selected. On the other hand, looking at GST_MESSAGE_STREAMS_SELECTED's content is not reliable, as this has been seen to miss tracks depending on thread luck. This patch takes the points above into account to rework how track selection is handled in MediaPlayerPrivateGStreamer and fix the following issues: 1) In playbin3 mode, no track was marked as selected initially, because of reliance on GST_STREAM_FLAG_SELECT. 2) In playbin2 mode, sometimes tracks would not be initially marked as selected. This occurred because of reliance on the "selected" property in inputselector sinkpads, whose initialization is racy -- it can occur after the track has been added and picked up by WebKit. 3) In playbin3 mode, the limitations explained before has been honored to make track selection stable, delaying SELECT_STREAMS events until they are safe to send. This patch doesn't introduce significative behavior changes, rather aiming for improving the stabilitity of the player. Existing tests should provide enough coverage. * platform/graphics/gstreamer/AudioTrackPrivateGStreamer.cpp: (WebCore::AudioTrackPrivateGStreamer::AudioTrackPrivateGStreamer): (WebCore::AudioTrackPrivateGStreamer::setEnabled): * platform/graphics/gstreamer/AudioTrackPrivateGStreamer.h: * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp: (WebCore::MediaPlayerPrivateGStreamer::notifyPlayerOfVideo): (WebCore::MediaPlayerPrivateGStreamer::notifyPlayerOfAudio): (WebCore::MediaPlayerPrivateGStreamer::updateEnabledVideoTrack): (WebCore::MediaPlayerPrivateGStreamer::updateEnabledAudioTrack): (WebCore::MediaPlayerPrivateGStreamer::playbin3SendSelectStreamsIfAppropriate): (WebCore::MediaPlayerPrivateGStreamer::updateTracks): (WebCore::MediaPlayerPrivateGStreamer::handleSyncMessage): (WebCore::MediaPlayerPrivateGStreamer::handleMessage): (WebCore::MediaPlayerPrivateGStreamer::didEnd): * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h: * platform/graphics/gstreamer/TrackPrivateBaseGStreamer.cpp: (WebCore::TrackPrivateBaseGStreamer::TrackPrivateBaseGStreamer): * platform/graphics/gstreamer/TrackPrivateBaseGStreamer.h: * platform/graphics/gstreamer/VideoTrackPrivateGStreamer.cpp: (WebCore::VideoTrackPrivateGStreamer::VideoTrackPrivateGStreamer): (WebCore::VideoTrackPrivateGStreamer::setSelected): * platform/graphics/gstreamer/VideoTrackPrivateGStreamer.h: 2020-05-14 Philippe Normand <pnormand@igalia.com> [GStreamer] Can't replay blob videos in web.whatsapp.com https://bugs.webkit.org/show_bug.cgi?id=192540 Reviewed by Xabier Rodriguez-Calvar. This is a variant of bug 211627 but I could reproduce it only for videos. Unfortunately I wasn't able to write a reliable test for this. * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp: (WebCore::MediaPlayerPrivateGStreamer::updateBufferingStatus): Prevent the fill timer from running forever after buffering completed. * platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp: (webKitWebSrcMakeRequest): Don't buffer blobs, this doesn't seem useful as they're already in memory anyway. 2020-05-06 Sergio Villar Senin <svillar@igalia.com> [WebXR] Implement WebGLRenderingContextBase::makeXRCompatible() https://bugs.webkit.org/show_bug.cgi?id=211506 Reviewed by Youenn Fablet. The WebXR spec defines a way to mark a WebGLRenderingContext as compatible with WebXR. This can be made at creation time (by setting the xrCompatible) attribute or by calling makeXRCompatible(). There are several web-platform-tests testing/using this feature, however we cannot enable them right now as we need some other features to be implemented first. * Modules/webxr/NavigatorWebXR.cpp: (WebCore::NavigatorWebXR::xr): Do not pass ScriptExecutionContext and use the Navigator's instead. * Modules/webxr/NavigatorWebXR.h: Ditto. * Modules/webxr/NavigatorWebXR.idl: Ditto. * Modules/webxr/WebXRSystem.h: expose ensureImmersiveXRDeviceIsSelected() and hasActiveImmersiveXRDevice() to be used from canvas and the rendering context. * html/HTMLCanvasElement.cpp: (WebCore::HTMLCanvasElement::createContextWebGL): call ensureImmersiveXRDeviceIsSelected() if xrCompatible is set. * html/canvas/WebGLContextAttributes.idl: Added xrCompatible. * html/canvas/WebGLRenderingContextBase.cpp: (WebCore::WebGLRenderingContextBase::WebGLRenderingContextBase): Initialize m_isXRCompatible. (WebCore::WebGLRenderingContextBase::makeXRCompatible): Implemented. * html/canvas/WebGLRenderingContextBase.h: Defined makeXRCompatible(). * html/canvas/WebGLRenderingContextBase.idl: Added makeXRCompatible(). * platform/graphics/GraphicsContextGLAttributes.h: Added xrCompatible. * testing/Internals.cpp: (WebCore::Internals::xrTest): Simplified the usage of NavigatorWebXR. 2020-05-13 Zalan Bujtas <zalan@apple.com> [LFC][TFC] Add support for cases when the balancing is not based on the initial width https://bugs.webkit.org/show_bug.cgi?id=211878 Reviewed by Antti Koivisto. This patch adds support for the cases when the table stretches all the way to the maximum content size, and we still choose the minimum width as the initial width and the maximum width as the base for balancing the extra space. Consider the following 2 tables: <table> <tr><td style="width: 20px"></td><td>some long long long content</td></tr> <tr><td style="width: 20px"></td><td>22px width content</td></tr> </table> <table> <tr><td style="width: 20px"></td><td>some long long long content</td></tr> <tr><td style="width: 20px"></td><td id=fixed_width style="width: 22px;">22px width content</td></tr> </table> These tables have the same maximum widths and they both stretch to that size. However the second table will end up with a wider first and narrower second column because of the width property on the [fixed_width] cell. While the first table applies the maximum width for each columns, the second table uses the minimum width as the initial width and balances the extra space using the maximum width (as the distribution ratio). This produces a very different layout where the first table has no line wrapping, while the second table wraps the "some long long long content" text (even though the used max widths are the same for each cells). Test: fast/layoutformattingcontext/table-fixed-width-with-max-distribution.html * layout/tableformatting/TableFormattingContext.cpp: (WebCore::Layout::ColumnSpan::spacing): (WebCore::Layout::RowSpan::spacing): (WebCore::Layout::distributeAvailableSpace): (WebCore::Layout::TableFormattingContext::computeAndDistributeExtraHorizontalSpace): (WebCore::Layout::TableFormattingContext::computeAndDistributeExtraVerticalSpace): 2020-05-13 Zalan Bujtas <zalan@apple.com> Do not clear selection/repaint when the renderer gets moved during tree normalization. https://bugs.webkit.org/show_bug.cgi?id=211865 <rdar://problem/62849044> Reviewed by Antti Koivisto. While detachFromRenderElement should really be about "this renderer is being detached from its parent", some code in here assumes the renderer is not only going to be detached but also going to be destroyed. Ideally such code should live in RenderObject::willBeDestroyed(), but no tree walk is possible in there anymore. The reason for the crash is that when we split the inline for continuation, we construct new anonymous containers and move subtrees over to these new renderers. However at this point these new parent containers are not yet attached to the tree so any tree-walking cleanup code will fail (in detachFromRenderElement). Test: fast/repaint/do-no-repaint-on-internal-move.html * rendering/updating/RenderTreeBuilder.cpp: (WebCore::RenderTreeBuilder::detachFromRenderElement): * rendering/updating/RenderTreeBuilder.h: * rendering/updating/RenderTreeBuilderInline.cpp: (WebCore::RenderTreeBuilder::Inline::splitInlines): 2020-05-13 Devin Rousso <drousso@apple.com> Web Inspector: show EventTarget listeners as an internal property https://bugs.webkit.org/show_bug.cgi?id=211766 Reviewed by Timothy Hatcher. Test: inspector/runtime/getProperties-internalProperties.html Add a `listeners` internal property for `EventTarget` objects with the value ``` listeners: { <event>: [ { callback: <function> capture: <boolean> passive: <boolean> once: <boolean> } ... ] ... } ``` so long as at least one `JSEventListener` has been added prior to that point. * inspector/WebInjectedScriptHost.cpp: (WebCore::objectForEventTargetListeners): Added. (WebCore::WebInjectedScriptHost::getInternalProperties): Drive-by: only add the `name` internal property if the `Worker` actually has a name. 2020-05-13 Devin Rousso <drousso@apple.com> Web Inspector: rename CSS.StyleSheetOrigin.Regular to CSS.StyleSheetOrigin.Author to match the spec https://bugs.webkit.org/show_bug.cgi?id=211827 Reviewed by Timothy Hatcher. Tests: inspector/css/add-rule.html inspector/css/getMatchedStylesForNode.html * inspector/agents/InspectorCSSAgent.cpp: (WebCore::InspectorCSSAgent::asInspectorStyleSheet): (WebCore::InspectorCSSAgent::detectOrigin): * inspector/InspectorStyleSheet.cpp: (WebCore::InspectorStyleSheet::buildObjectForRule): 2020-05-13 Yusuke Suzuki <ysuzuki@apple.com> JSDOMWindowBase m_windowCloseWatchpoints must be Ref<> https://bugs.webkit.org/show_bug.cgi?id=211844 Reviewed by Mark Lam. JSDOMWindowBase::m_windowCloseWatchpoints is WatchpointSet, not Ref<WatchpointSet>. And it is passed to JSC IC layer via PropertySlot::setWatchpoint(...). And ProxyableAccessCase can hold it as `RefPtr<WatchpointSet> m_additionalSet;`, this is wrong. This patch hides WatchpointSet constructor behind `protected` to disallow non Ref<> WatchpointSet construction. We made it `protected` since InferredValueWatchpointSet inherits WatchpointSet and uses this constructor. Possibly, this does not matter: ProxyableAccessCase keeps Structure, which points to JSDOMWindowBase. So, it would not happen that ProxyableAccessCase has a wrong pointer to WatchpointSet since JSDOMWindowBase is kept alive anyway. But avoid using RefCounted objects without RefCount allocation is better since this can cause bugs easily. * bindings/js/JSDOMWindowBase.cpp: (WebCore::JSDOMWindowBase::JSDOMWindowBase): (WebCore::JSDOMWindowBase::fireFrameClearedWatchpointsForWindow): * bindings/js/JSDOMWindowBase.h: * bindings/js/JSDOMWindowCustom.cpp: (WebCore::JSDOMWindow::getOwnPropertySlot): 2020-05-13 Jack Lee <shihchieh_lee@apple.com> Nullptr crash in InsertParagraphSeparatorCommand::doApply when the canonical position is uneditable https://bugs.webkit.org/show_bug.cgi?id=211864 <rdar://problem/62982161> Reviewed by Geoffrey Garen. The position returned by positionAvoidingSpecialElementBoundary() is uneditable so we need to check for uneditable insertion position and bail out before calling insertNodeAt to avoid assertion. Test: editing/inserting/insert-img-uneditable-canonical-position-crash.html * editing/InsertParagraphSeparatorCommand.cpp: (WebCore::InsertParagraphSeparatorCommand::doApply): 2020-05-13 Jack Lee <shihchieh_lee@apple.com> Nullptr crash in DeleteSelectionCommand::doApply() when merge node is disconnected. https://bugs.webkit.org/show_bug.cgi?id=211793 <rdar://problem/62993645> Reviewed by Geoffrey Garen. Check for disconnected merge destination and endingSelection() after mergeParagraph is Called and bail out to avoid using corrupted positions for node insertion. Test: editing/inserting/insert-text-merge-node-removed-crash.html * editing/CompositeEditCommand.cpp: (WebCore::CompositeEditCommand::moveParagraphs): * editing/DeleteSelectionCommand.cpp: (WebCore::DeleteSelectionCommand::mergeParagraphs): 2020-05-13 Said Abou-Hallawa <sabouhallawa@apple.com> Re-enable 'OutsideViewport' rAF throttling https://bugs.webkit.org/show_bug.cgi?id=211482 Reviewed by Darin Adler. Test: fast/animation/request-animation-frame-throttling-outside-viewport.html Make preferredFrameInterval return AggressiveThrottlingAnimationInterval if the OutsideViewport throttling reason exists. Add an internal setting for enabling 'OutsideViewport' rAF throttling. It is on by default but it is off by default for DRT and WTR. An Internals API is added to enable it for specific tests which want to test its functionality. * page/FrameView.cpp: (WebCore::FrameView::updateScriptedAnimationsAndTimersThrottlingState): * page/Page.cpp: (WebCore::Page::setOutsideViewportThrottlingEnabledForTesting): * page/Page.h: (WebCore::Page::canUpdateThrottlingReason const): * platform/graphics/AnimationFrameRate.h: (WebCore::preferredFrameInterval): (WebCore::operator<<): * testing/Internals.cpp: (WebCore::Internals::resetToConsistentState): (WebCore::Internals::setOutsideViewportThrottlingEnabled): * testing/Internals.h: * testing/Internals.idl: 2020-05-13 Andres Gonzalez <andresg_22@apple.com> Remove unnecessary assert in {WebAccessibilityObjectWrapper attachmentView]. https://bugs.webkit.org/show_bug.cgi?id=211857 Reviewed by Chris Fleizach. This assert is unnecessary since the backing object that is relevant is the one on the main thread. This was causing crashes in LayoutTest in isolated tree mode. * accessibility/mac/WebAccessibilityObjectWrapperMac.mm: (-[WebAccessibilityObjectWrapper attachmentView]): 2020-05-13 Jer Noble <jer.noble@apple.com> Replace isNullFunctionPointer with real weak-linking support https://bugs.webkit.org/show_bug.cgi?id=211751 Reviewed by Sam Weinig. Use the new WTF_WEAK_LINK_FORCE_IMPORT macro. * platform/mediastream/libwebrtc/LibWebRTCProviderCocoa.cpp: (WebCore::LibWebRTCProvider::webRTCAvailable): 2020-05-13 Andres Gonzalez <andresg_22@apple.com> Implementation of AXIsolatedObject::hasBoldFont and hasItalicFont. https://bugs.webkit.org/show_bug.cgi?id=211858 Reviewed by Chris Fleizach. Added hasBoldFont and hasItalicFont to the cached properties map. * accessibility/isolatedtree/AXIsolatedObject.cpp: (WebCore::AXIsolatedObject::initializeAttributeData): Added properties to cache. (WebCore::AXIsolatedObject::hasBoldFont const): Deleted. Inlined in header. (WebCore::AXIsolatedObject::hasItalicFont const): Deleted. Inlined in header. * accessibility/isolatedtree/AXIsolatedObject.h: 2020-05-13 Tim Horton <timothy_horton@apple.com> Add SPI for reverting to touch events for iPad trackpad interactions https://bugs.webkit.org/show_bug.cgi?id=211824 <rdar://problem/61363084> Reviewed by Megan Gardner. * loader/DocumentLoader.h: (WebCore::DocumentLoader::mouseEventPolicy const): (WebCore::DocumentLoader::setMouseEventPolicy): 2020-05-13 Kenneth Russell <kbr@chromium.org> Bad flicker on three.js example https://bugs.webkit.org/show_bug.cgi?id=183151 Reviewed by Dean Jackson. With preserveDrawingBuffer:true and antialias:false, allocate an intermediate texture and FBO, and blit from it to the destination texture in prepareTexture(). Use wipeAlphaChannelFromPixels on iOS as well as macOS. In addition to fixing the test case from the bug, this also fixes the webgl/2.0.0/conformance2/textures/webgl_canvas/ layout tests, which will be re-enabled in a subsequent patch. It also passes the more stringent webgl_canvas conformance tests in https://github.com/KhronosGroup/WebGL/pull/3071 . * platform/graphics/angle/GraphicsContextGLANGLE.cpp: (WebCore::GraphicsContextGLOpenGL::readPixelsAndConvertToBGRAIfNecessary): (WebCore::GraphicsContextGLOpenGL::reshapeFBOs): (WebCore::GraphicsContextGLOpenGL::resolveMultisamplingIfNecessary): (WebCore::GraphicsContextGLOpenGL::readPixels): (WebCore::GraphicsContextGLOpenGL::validateDepthStencil): (WebCore::GraphicsContextGLOpenGL::prepareTexture): (WebCore::GraphicsContextGLOpenGL::reshape): * platform/graphics/cocoa/GraphicsContextGLOpenGLCocoa.mm: (WebCore::GraphicsContextGLOpenGL::GraphicsContextGLOpenGL): (WebCore::GraphicsContextGLOpenGL::~GraphicsContextGLOpenGL): * platform/graphics/opengl/GraphicsContextGLOpenGL.h: 2020-05-13 Wenson Hsieh <wenson_hsieh@apple.com> [iOS] "Copy" context menu action for attachment element does not work in Mail https://bugs.webkit.org/show_bug.cgi?id=211817 <rdar://problem/58043110> Reviewed by Tim Horton. Minor refactoring to help support writing attachment data to the pasteboard when using context menu actions to copy an attachment element on iOS. See below for more details, as well as the WebKit ChangeLog entry. Test: WKAttachmentTestsIOS.CopyAttachmentUsingElementAction * editing/Editor.cpp: (WebCore::Editor::platformContentTypeForBlobType const): (WebCore::Editor::promisedAttachmentInfo): Move promisedAttachmentInfo out of DragController and into Editor, so that it is accessible outside of drag and drop code. * editing/Editor.h: * editing/cocoa/EditorCocoa.mm: (WebCore::Editor::platformContentTypeForBlobType const): Move this private helper function out of DragController as well, and into Editor. * page/DragClient.h: * page/DragController.cpp: (WebCore::DragController::startDrag): Refactor this to use Editor::promisedAttachmentInfo(). (WebCore::DragController::platformContentTypeForBlobType const): Deleted. (WebCore::DragController::promisedAttachmentInfo): Deleted. * page/DragController.h: * page/mac/DragControllerMac.mm: (WebCore::DragController::platformContentTypeForBlobType const): Deleted. 2020-05-13 Antoine Quint <graouts@apple.com> [Web Animations] Calling reverse() on an accelerated animation has no effect https://bugs.webkit.org/show_bug.cgi?id=204717 <rdar://problem/62503582> Reviewed by Dean Jackson. Test: webanimations/accelerated-animation-playback-rate.html We completely ignored the playbackRate set on a WebAnimation object when considering whether we could run an accelerated animation. To address this we do several things. First, we now add a playbackRate() on Animation objects such that we can make GraphicsLayerCA aware of the originating WebAnimation's playback rate and use this data to opt out of running CA animations for animations with a playbackRate other than 1 in GraphicsLayerCA::animationCanBeAccelerated(). We'll be looking to add support for variable playback rates for CA animations in https://bugs.webkit.org/show_bug.cgi?id=211839. Then, we make sure to completely replace an accelerated animation whenever one of the properties affected timing would change. Up until now we would onyl do this for a change in the effective currentTime, but this needs to also happen when the current time doesn't change but the animation may have changed playback rate or any of its timing properties that could change the duration of the animation. So we remove the "Seek" command and instead use an "UpdateTiming" command that will remove the existing animation and add a new one. This allows us to remove any notion of seeking in GraphicsLayer since now we'll just create a new animation when its timing attributes changed. This revealed an issue where if we called animationFinished() and startAnimation() on a RenderLayerModelObject in succession, theanimation removal would not occur on the GraphicsLayerCA because we disregarded any pending accelerated action for an animation we knew would be replaced. We now ensure we honor the removal in GraphicsLayerCA::appendToUncommittedAnimations(). * animation/AnimationEffect.cpp: (WebCore::AnimationEffect::updateTiming): * animation/AnimationEffect.h: * animation/CSSAnimation.cpp: (WebCore::CSSAnimation::syncPropertiesWithBackingAnimation): * animation/KeyframeEffect.cpp: (WebCore::KeyframeEffect::addPendingAcceleratedAction): (WebCore::KeyframeEffect::animationDidChangeTimingProperties): (WebCore::KeyframeEffect::applyPendingAcceleratedActions): (WebCore::KeyframeEffect::backingAnimationForCompositedRenderer const): (WebCore::KeyframeEffect::animationDidSeek): Deleted. * animation/KeyframeEffect.h: * animation/WebAnimation.cpp: (WebCore::WebAnimation::effectTimingDidChange): (WebCore::WebAnimation::setCurrentTime): (WebCore::WebAnimation::setPlaybackRate): (WebCore::WebAnimation::updatePlaybackRate): (WebCore::WebAnimation::reverse): * animation/WebAnimation.h: * platform/animation/Animation.h: (WebCore::Animation::playbackRate const): (WebCore::Animation::setPlaybackRate): * platform/graphics/GraphicsLayer.h: (WebCore::GraphicsLayer::pauseAnimation): (WebCore::GraphicsLayer::seekAnimation): Deleted. * platform/graphics/ca/GraphicsLayerCA.cpp: (WebCore::GraphicsLayerCA::animationCanBeAccelerated const): (WebCore::GraphicsLayerCA::updateAnimations): (WebCore::GraphicsLayerCA::pauseCAAnimationOnLayer): (WebCore::GraphicsLayerCA::createTransformAnimationsFromKeyframes): (WebCore::GraphicsLayerCA::seekAnimation): Deleted. (WebCore::GraphicsLayerCA::seekCAAnimationOnLayer): Deleted. * platform/graphics/ca/GraphicsLayerCA.h: * rendering/RenderElement.h: (WebCore::RenderElement::animationPaused): (WebCore::RenderElement::animationSeeked): Deleted. * rendering/RenderLayerBacking.cpp: (WebCore::RenderLayerBacking::animationSeeked): Deleted. * rendering/RenderLayerBacking.h: * rendering/RenderLayerModelObject.cpp: (WebCore::RenderLayerModelObject::animationSeeked): Deleted. * rendering/RenderLayerModelObject.h: 2020-05-13 Antti Koivisto <antti@apple.com> [Wheel event region] Debug overlay https://bugs.webkit.org/show_bug.cgi?id=211850 Reviewed by Simon Fraser. This is tied to the existing Wheel event handler overlay debug flag. * platform/graphics/Color.cpp: (WebCore::makeRGB): Deleted. (WebCore::makeRGBA): Deleted. * platform/graphics/Color.h: (WebCore::makeRGB): (WebCore::makeRGBA): Make constexpr. * rendering/EventRegion.cpp: (WebCore::EventRegion::eventListenerRegionForType const): * rendering/EventRegion.h: * rendering/RenderLayerBacking.cpp: (WebCore::patternForDescription): Factor into a function. (WebCore::patternForTouchAction): (WebCore::patternForEventListenerRegionType): (WebCore::RenderLayerBacking::paintDebugOverlays): (WebCore::RenderLayerBacking::paintContents): 2020-05-13 Antoine Quint <graouts@apple.com> [Web Animations] Fix refactoring issue with animation suspension following r261336 https://bugs.webkit.org/show_bug.cgi?id=211842 <rdar://problem/63118326> Reviewed by Dean Jackson. We moved up the suspension code up from DocumentTimeline to DocumentTimelinesController in r261336 and forgot to move the code that set the initial suspension state from the DocumentTimeline constructor to the DocumentTimelinesController constructor. This is problematic because the suspension state is only recorded on DocumentTimelinesController itself. * animation/DocumentTimeline.cpp: (WebCore::DocumentTimeline::DocumentTimeline): * animation/DocumentTimelinesController.cpp: (WebCore::DocumentTimelinesController::DocumentTimelinesController): (WebCore::DocumentTimelinesController::addTimeline): 2020-05-13 Simon Fraser <simon.fraser@apple.com> composited scrolling interferes with the propagation of perspective https://bugs.webkit.org/show_bug.cgi?id=156435 <rdar://problem/25642222> Reviewed by Antti Koivisto. When we made RenderLayerBacking-internal layers for composited scrolling (m_scrollContainerLayer, m_scrolledContentsLayer) we'd lose the effects of the sublayer transform, which was applied to the primary layer, causing perspective on the scroller to not propagate to transformed descendants. Fix by moving the sublayer transform to the scroll container layer (adjusting the perspective matrix as appropriate), and making the scrolled contents layer a "preserve3D" layer so that it doesn't flatten. This fixes both macOS and iOS. Test: compositing/transforms/perspective-with-scrolling.html * rendering/RenderLayerBacking.cpp: (WebCore::RenderLayerBacking::updateChildrenTransformAndAnchorPoint): 2020-05-13 Youenn Fablet <youenn@apple.com> Allow WebAudioBufferList to dynamically change its number of frames https://bugs.webkit.org/show_bug.cgi?id=211720 Reviewed by Eric Carlson. We sometimes create WebAudioBufferList on the stack which triggers allocation of several vectors. Instead of doing that for every audio sample chunk, we should allocate the WebAudioBufferList and resize it as necessary. For that purpose, we introduce WebAudioBufferList::updateWithNumberOfFrames and use it in two places: - When creating an audio track into WebAudio. - When receiving audio chunks from another process. Covered by existing tests. * Modules/webaudio/MediaStreamAudioSource.cpp: (WebCore::MediaStreamAudioSource::~MediaStreamAudioSource): * Modules/webaudio/MediaStreamAudioSource.h: * Modules/webaudio/MediaStreamAudioSourceCocoa.cpp: (WebCore::streamDescription): (WebCore::MediaStreamAudioSource::consumeAudio): * platform/audio/cocoa/WebAudioBufferList.cpp: (WebCore::WebAudioBufferList::WebAudioBufferList): (WebCore::WebAudioBufferList::updateWithNumberOfFrames): (WebCore::WebAudioBufferList::channelCount const): * platform/audio/cocoa/WebAudioBufferList.h: * platform/mediastream/mac/MockAudioSharedUnit.mm: (WebCore::MockAudioSharedUnit::reconfigure): Drive-by fix, we do not need to give the size in bytes but the size in samples. 2020-05-13 Andres Gonzalez <andresg_22@apple.com> Check for accessibilityEnabled() before posting notifications asynchronously. https://bugs.webkit.org/show_bug.cgi?id=211848 Reviewed by Chris Fleizach. Covered by multiple tests. Fixes crashes in LayoutTests in isolated tree mode. During LayoutTests, accessibility may be disabled between the time the notifications are queued and the timer fires. Thus it is necessary to check for accessibilityEnabled() before posting the notifications asynchronously. Not doing so was causing crashes in isolated mode. * accessibility/AXObjectCache.cpp: (WebCore::AXObjectCache::notificationPostTimerFired): 2020-05-13 Simon Fraser <simon.fraser@apple.com> The perspective matrix is affected by overflow:hidden on a box with borders https://bugs.webkit.org/show_bug.cgi?id=211828 Reviewed by Zalan Bujtas. For a box with non-uniform borders, the layer created for overflow:hidden is not centered in its parent layer. However, we push the childrenTransform onto this clipping layer, so that transform needs to be adjusted to account for the geometry of the clipping layer. Test: compositing/transforms/perspective-with-clipping.html * rendering/RenderLayer.cpp: (WebCore::RenderLayer::perspectiveTransform const): * rendering/RenderLayerBacking.cpp: (WebCore::scrollContainerLayerBox): (WebCore::clippingLayerBox): (WebCore::overflowControlsHostLayerBox): (WebCore::RenderLayerBacking::updateChildrenTransformAndAnchorPoint): 2020-05-13 Tomoki Imai <Tomoki.Imai@sony.com> Selected element on Web Inspector is not highlighted with CPU Rendering. https://bugs.webkit.org/show_bug.cgi?id=195933 Reviewed by Devin Rousso. Expose InspectorOverlay::shouldShowOverlay via InspectorController. It's used to determine whether WebPage needs a transparency layer to draw highlight. * inspector/InspectorController.cpp: (WebCore::InspectorController::shouldShowOverlay const): * inspector/InspectorController.h: * inspector/InspectorOverlay.h: 2020-05-13 Zan Dobersek <zdobersek@igalia.com> REGRESSION(r261023): [GTK][WPE] Several WebGL tests are failing https://bugs.webkit.org/show_bug.cgi?id=211338 Reviewed by Dean Jackson. For non-ANGLE-backed WebGL, we are still required to query the internal format of the target texture for the texture sub-image commands. Falling back to that behavior on !USE(ANGLE) removes regressions in a bunch of WebGL tests. * html/canvas/WebGLRenderingContextBase.cpp: (WebCore::WebGLRenderingContextBase::texImageSourceHelper): (WebCore::WebGLRenderingContextBase::texImageArrayBufferViewHelper): 2020-05-13 Carlos Garcia Campos <cgarcia@igalia.com> Unreviewed. Fix GTK debug build after r261554 Remove writeToClipboard that receives a const SelectionData& that is no longer used. Make readBufferFromClipboard pure virtual and remove the GTK leftovers from PlatformPasteboard. * platform/PasteboardStrategy.h: * platform/PlatformPasteboard.h: 2020-05-13 Antti Koivisto <antti@apple.com> [Wheel event region] Add support for getting wheel event region from ScrollingTree https://bugs.webkit.org/show_bug.cgi?id=211785 Reviewed by Simon Fraser. Add ScrollingTree::eventListenerRegionTypesForPoint. It is not used yet. * page/scrolling/ScrollingTree.cpp: (WebCore::ScrollingTree::eventListenerRegionTypesForPoint const): * page/scrolling/ScrollingTree.h: * page/scrolling/mac/ScrollingTreeMac.h: * page/scrolling/mac/ScrollingTreeMac.mm: (collectDescendantLayersAtPoint): (ScrollingTreeMac::eventListenerRegionTypesForPoint const): * platform/graphics/ca/PlatformCALayer.h: * platform/graphics/ca/cocoa/PlatformCALayerCocoa.h: * platform/graphics/ca/cocoa/PlatformCALayerCocoa.mm: (WebCore::PlatformCALayerCocoa::eventRegionContainsPoint const): Deleted. * rendering/EventRegion.cpp: (WebCore::EventRegion::eventListenerRegionTypesForPoint const): * rendering/EventRegion.h: 2020-05-12 Alex Christensen <achristensen@webkit.org> Give some NetworkLoadMetrics to WebCoreNSURLSession's delegate https://bugs.webkit.org/show_bug.cgi?id=211759 <rdar://problem/62909440> Reviewed by Jer Noble. This required packaging the fetchStart time with the rest of the time deltas, passing a const NetworkLoadMetrics& down to the media loader, and packaging the data up in an ObjC object that pretends to be NSURLSessionTaskMetrics, just like WebCoreNSURLSession pretends to be an NSURLSession. I manually verified the NSDates are correct. This is not straightforward to automate tests for because of the inherant dynamic nature of timing data, and because our other WebCoreNSURLSession tests use WebKitLegacy, and that approach won't work here because we are only hooking up data from NSURLSession, which is only used in modern WebKit. * Modules/beacon/NavigatorBeacon.cpp: (WebCore::NavigatorBeacon::notifyFinished): * Modules/beacon/NavigatorBeacon.h: * bindings/js/CachedModuleScriptLoader.cpp: (WebCore::CachedModuleScriptLoader::notifyFinished): * bindings/js/CachedModuleScriptLoader.h: * dom/LoadableClassicScript.cpp: (WebCore::LoadableClassicScript::notifyFinished): * dom/LoadableClassicScript.h: * html/HTMLImageLoader.cpp: (WebCore::HTMLImageLoader::notifyFinished): * html/HTMLImageLoader.h: * html/ImageDocument.cpp: (WebCore::ImageDocument::finishedParsing): * loader/ApplicationManifestLoader.cpp: (WebCore::ApplicationManifestLoader::notifyFinished): * loader/ApplicationManifestLoader.h: * loader/CrossOriginPreflightChecker.cpp: (WebCore::CrossOriginPreflightChecker::notifyFinished): * loader/CrossOriginPreflightChecker.h: * loader/DocumentLoader.cpp: (WebCore::DocumentLoader::notifyFinished): * loader/DocumentLoader.h: * loader/DocumentThreadableLoader.cpp: (WebCore::DocumentThreadableLoader::notifyFinished): * loader/DocumentThreadableLoader.h: * loader/ImageLoader.cpp: (WebCore::ImageLoader::notifyFinished): * loader/ImageLoader.h: * loader/LinkLoader.cpp: (WebCore::LinkLoader::notifyFinished): * loader/LinkLoader.h: * loader/LinkPreloadResourceClients.h: * loader/MediaResourceLoader.cpp: (WebCore::MediaResource::notifyFinished): * loader/MediaResourceLoader.h: * loader/SubresourceLoader.cpp: (WebCore::SubresourceLoader::didReceiveResponse): (WebCore::SubresourceLoader::didFinishLoading): * loader/TextTrackLoader.cpp: (WebCore::TextTrackLoader::notifyFinished): * loader/TextTrackLoader.h: * loader/appcache/ApplicationCacheResourceLoader.cpp: (WebCore::ApplicationCacheResourceLoader::responseReceived): (WebCore::ApplicationCacheResourceLoader::notifyFinished): * loader/appcache/ApplicationCacheResourceLoader.h: * loader/cache/CachedApplicationManifest.cpp: (WebCore::CachedApplicationManifest::finishLoading): * loader/cache/CachedApplicationManifest.h: * loader/cache/CachedCSSStyleSheet.cpp: (WebCore::CachedCSSStyleSheet::finishLoading): (WebCore::CachedCSSStyleSheet::checkNotify): * loader/cache/CachedCSSStyleSheet.h: * loader/cache/CachedFont.cpp: (WebCore::CachedFont::finishLoading): (WebCore::CachedFont::checkNotify): * loader/cache/CachedFont.h: * loader/cache/CachedImage.cpp: (WebCore::CachedImage::finishLoading): * loader/cache/CachedImage.h: * loader/cache/CachedRawResource.cpp: (WebCore::CachedRawResource::updateBuffer): (WebCore::CachedRawResource::finishLoading): * loader/cache/CachedRawResource.h: * loader/cache/CachedResource.cpp: (WebCore::CachedResource::load): (WebCore::CachedResource::checkNotify): (WebCore::CachedResource::finishLoading): (WebCore::CachedResource::error): (WebCore::CachedResource::cancelLoad): (WebCore::CachedResource::didAddClient): * loader/cache/CachedResource.h: * loader/cache/CachedResourceClient.h: (WebCore::CachedResourceClient::notifyFinished): * loader/cache/CachedSVGDocument.cpp: (WebCore::CachedSVGDocument::finishLoading): * loader/cache/CachedSVGDocument.h: * loader/cache/CachedScript.cpp: (WebCore::CachedScript::finishLoading): * loader/cache/CachedScript.h: * loader/cache/CachedTextTrack.cpp: (WebCore::CachedTextTrack::finishLoading): * loader/cache/CachedTextTrack.h: * loader/cache/CachedXSLStyleSheet.cpp: (WebCore::CachedXSLStyleSheet::finishLoading): (WebCore::CachedXSLStyleSheet::checkNotify): * loader/cache/CachedXSLStyleSheet.h: * loader/cache/KeepaliveRequestTracker.cpp: (WebCore::KeepaliveRequestTracker::notifyFinished): * loader/cache/KeepaliveRequestTracker.h: * loader/icon/IconLoader.cpp: (WebCore::IconLoader::notifyFinished): * loader/icon/IconLoader.h: * platform/graphics/PlatformMediaResourceLoader.h: (WebCore::PlatformMediaResourceClient::loadFinished): * platform/graphics/avfoundation/objc/WebCoreAVFResourceLoader.mm: (WebCore::CachedResourceMediaLoader::notifyFinished): * platform/network/NetworkLoadMetrics.h: (WebCore::NetworkLoadMetrics::isolatedCopy const): (WebCore::NetworkLoadMetrics::operator== const): (WebCore::NetworkLoadMetrics::encode const): (WebCore::NetworkLoadMetrics::decode): (WTF::Persistence::Coder<Optional<WebCore::NetworkLoadPriority>>::encode): Deleted. (WTF::Persistence::Coder<Optional<WebCore::NetworkLoadPriority>>::decode): Deleted. * platform/network/cocoa/NetworkLoadMetrics.mm: (WebCore::copyTimingData): * platform/network/cocoa/WebCoreNSURLSession.mm: (networkLoadMetricsDate): (-[WebCoreNSURLSessionTaskTransactionMetrics _initWithMetrics:]): (-[WebCoreNSURLSessionTaskTransactionMetrics fetchStartDate]): (-[WebCoreNSURLSessionTaskTransactionMetrics domainLookupStartDate]): (-[WebCoreNSURLSessionTaskTransactionMetrics domainLookupEndDate]): (-[WebCoreNSURLSessionTaskTransactionMetrics connectStartDate]): (-[WebCoreNSURLSessionTaskTransactionMetrics secureConnectionStartDate]): (-[WebCoreNSURLSessionTaskTransactionMetrics connectEndDate]): (-[WebCoreNSURLSessionTaskTransactionMetrics requestStartDate]): (-[WebCoreNSURLSessionTaskTransactionMetrics responseStartDate]): (-[WebCoreNSURLSessionTaskTransactionMetrics responseEndDate]): (-[WebCoreNSURLSessionTaskMetrics _initWithMetrics:]): (-[WebCoreNSURLSessionTaskMetrics transactionMetrics]): (WebCore::WebCoreNSURLSessionDataTaskClient::loadFinished): (-[WebCoreNSURLSessionDataTask _finish]): (-[WebCoreNSURLSessionDataTask _resource:loadFinishedWithError:metrics:]): (-[WebCoreNSURLSessionDataTask resource:accessControlCheckFailedWithError:]): (-[WebCoreNSURLSessionDataTask resource:loadFailedWithError:]): (-[WebCoreNSURLSessionDataTask resourceFinished:metrics:]): (-[WebCoreNSURLSessionDataTask _resource:loadFinishedWithError:]): Deleted. (-[WebCoreNSURLSessionDataTask resourceFinished:]): Deleted. * rendering/RenderElement.cpp: (WebCore::RenderElement::notifyFinished): * rendering/RenderElement.h: * rendering/RenderImage.cpp: (WebCore::RenderImage::notifyFinished): * rendering/RenderImage.h: * rendering/RenderLayerFilters.cpp: (WebCore::RenderLayerFilters::notifyFinished): * rendering/RenderLayerFilters.h: * svg/SVGFEImageElement.cpp: (WebCore::SVGFEImageElement::notifyFinished): * svg/SVGFEImageElement.h: * svg/SVGUseElement.cpp: (WebCore::SVGUseElement::notifyFinished): * svg/SVGUseElement.h: 2020-05-12 Said Abou-Hallawa <sabouhallawa@apple.com> [CG] Change the UTI of the "WebP" image to be "org.webmproject.webp" https://bugs.webkit.org/show_bug.cgi?id=211794 <rdar://problem/63031187> Reviewed by Darin Adler. See https://developers.google.com/speed/webp/docs/riff_container. * platform/graphics/cg/UTIRegistry.cpp: (WebCore::defaultSupportedImageTypes): Fix review comments from bug 208038. 2020-05-12 Simon Fraser <simon.fraser@apple.com> Move perspective-setting code into its own function https://bugs.webkit.org/show_bug.cgi?id=211812 Reviewed by Zalan Bujtas. Move the code that updates anchor point and children transform (for perspective) into its own function. No behavior change. * rendering/RenderLayerBacking.cpp: (WebCore::RenderLayerBacking::updateChildrenTransformAndAnchorPoint): (WebCore::computeOffsetFromAncestorGraphicsLayer): (WebCore::RenderLayerBacking::updateGeometry): * rendering/RenderLayerBacking.h: 2020-05-12 Jiewen Tan <jiewen_tan@apple.com> [WebAuthn] Don't assume extensions always exist https://bugs.webkit.org/show_bug.cgi?id=211760 <rdar://problem/61217642> Reviewed by Brent Fulgham. * Modules/webauthn/fido/U2fCommandConstructor.cpp: (fido::processGoogleLegacyAppIdSupportExtension): 2020-05-12 Jer Noble <jer.noble@apple.com> [iOS] REGRESSION: (r261342) Play/pause button doesn't work upon first entering fullscreen mode https://bugs.webkit.org/show_bug.cgi?id=211797 <rdar://problem/63118008> Reviewed by Eric Carlson. In r261342 we added code to handle "canplay" and "waiting" events without ever actually adding event listeners for them. So when we enter fullscreen before the "canplay" event, we never re-evaluate whether we're playing or not. Drive-by fix: Also noticed that stalls will cause the play/pause toggle to switch from the "pause icon" to the "play icon", which is incorrect; we're still "playing" event when we're stalled. So when we are in the stalled state, set the "playbackRate" property to some very small, but non-zero value. This will cause the playback slider to stop progressing, but won't also cause the play/pause button to swap states. * platform/cocoa/PlaybackSessionModelMediaElement.mm: (WebCore::PlaybackSessionModelMediaElement::updateForEventName): (WebCore::PlaybackSessionModelMediaElement::observedEventNames): 2020-05-12 Chris Dumez <cdumez@apple.com> [WK2] Neuter WKFrameIsFrameSet() / WKPageGetFrameSetLargestFrame() C API https://bugs.webkit.org/show_bug.cgi?id=211808 Reviewed by Darin Adler. Neuter WKFrameIsFrameSet() / WKPageGetFrameSetLargestFrame() C API. This is only SPI and is only used for slightly different printing behavior in Safari. Framesets are no longer supported in HTML5 and are now super rare. Support for this C API adds quite a bit of code complexity and crashes such as <rdar://problem/60322282>, it just does not seem worth it anymore. * dom/Document.cpp: (WebCore::Document::resume): * html/HTMLFrameSetElement.cpp: (WebCore::HTMLFrameSetElement::insertedIntoAncestor): (WebCore::HTMLFrameSetElement::removedFromAncestor): * loader/EmptyFrameLoaderClient.h: * loader/FrameLoaderClient.h: 2020-05-12 Simon Fraser <simon.fraser@apple.com> Clean up some transformOrigin and perspectiveOrigin code https://bugs.webkit.org/show_bug.cgi?id=211807 Reviewed by Zalan Bujtas. Add LengthPoint and LengthSize-based "value for length" functions so we can do point and size math as we do for LayoutPoint/FloatPoint etc. Use them in code that computes transform and perspective origins. * animation/KeyframeEffect.cpp: (WebCore::KeyframeEffect::computeTransformedExtentViaTransformList const): * css/LengthFunctions.cpp: (WebCore::sizeForLengthSize): (WebCore::pointForLengthPoint): (WebCore::floatPointForLengthPoint): * css/LengthFunctions.h: * page/animation/AnimationBase.cpp: (WebCore::AnimationBase::computeTransformedExtentViaTransformList const): * platform/Length.h: * platform/LengthPoint.h: * rendering/RenderLayer.cpp: (WebCore::RenderLayer::perspectiveTransform const): (WebCore::RenderLayer::perspectiveOrigin const): * rendering/RenderLayerBacking.cpp: (WebCore::RenderLayerBacking::computeTransformOriginForPainting const): * rendering/style/BasicShapes.cpp: (WebCore::BasicShapeInset::path): (WebCore::floatSizeForLengthSize): Deleted. * rendering/style/RenderStyle.cpp: (WebCore::RenderStyle::applyTransform const): * rendering/style/RenderStyle.h: (WebCore::RenderStyle::transformOriginXY const): Explicitly "xy" because it excludes the z component. (WebCore::RenderStyle::perspectiveOrigin const): * rendering/style/StyleRareNonInheritedData.h: (WebCore::StyleRareNonInheritedData::perspectiveOrigin const): * rendering/style/StyleTransformData.h: (WebCore::StyleTransformData::originXY const): 2020-05-12 Michael Catanzaro <mcatanzaro@gnome.org> -Wattribute warning in BreakLines.cpp https://bugs.webkit.org/show_bug.cgi?id=211784 Reviewed by Darin Adler. Remove export attribute. These only work in header files. * rendering/BreakLines.cpp: 2020-05-12 Eric Carlson <eric.carlson@apple.com> Poster set after playback begins should be ignored https://bugs.webkit.org/show_bug.cgi?id=211464 <rdar://problem/62605114> Reviewed by Darin Adler. Test: media/video-poster-set-after-playback.html * html/HTMLVideoElement.cpp: (WebCore::HTMLVideoElement::parseAttribute): Ignore `poster` changes after first video frame is available. (WebCore::HTMLVideoElement::updateDisplayState): Set mode to Video if the first video frame is available. * testing/Internals.cpp: (WebCore::Internals::elementShouldDisplayPosterImage const): * testing/Internals.h: * testing/Internals.idl: 2020-05-12 Simon Fraser <simon.fraser@apple.com> Perpective origin should be relative to the reference box https://bugs.webkit.org/show_bug.cgi?id=211769 Reviewed by Zalan Bujtas. Use the reference box <https://drafts.csswg.org/css-transforms-1/#reference-box> when computing perspective-origin <https://drafts.csswg.org/css-transforms-2/#perspective-origin-property>, adding a referenceBox() helper on RenderBox. The code to compute the perspective transform is wrong; for now, fudge it by passing in the border box, but this code needs to account for GraphicsLayer geometry and transform-origin in future (webkit.org/b/211787). Test: compositing/transforms/perspective-transform-box.html * rendering/RenderBlock.cpp: (WebCore::RenderBlock::nodeAtPoint): * rendering/RenderBox.cpp: (WebCore::RenderBox::referenceBox const): * rendering/RenderBox.h: * rendering/RenderLayer.cpp: (WebCore::computeReferenceRectFromBox): (WebCore::computeReferenceBox): (WebCore::RenderLayer::updateTransform): (WebCore::RenderLayer::currentTransform const): (WebCore::RenderLayer::perspectiveTransform const): (WebCore::RenderLayer::computeClipPath const): * rendering/RenderLayer.h: * rendering/RenderLayerBacking.cpp: (WebCore::RenderLayerBacking::updateGeometry): 2020-05-12 Ross Kirsling <ross.kirsling@sony.com> Unreviewed PlayStation / clang-cl build fix following r261533. Apparently r261572 only caught half of the cases. * Modules/indexeddb/server/UniqueIDBDatabase.cpp: (WebCore::IDBServer::estimateSize): * bindings/js/IDBBindingUtilities.cpp: (WebCore::generateIndexKeyMapForValue): 2020-05-12 Myles C. Maxfield <mmaxfield@apple.com> Text is clipped when rendered with fonts which have a negative line gap metric https://bugs.webkit.org/show_bug.cgi?id=211683 <rdar://problem/62192986> Reviewed by Zalan Bujtas. ... As seen on nytimes.com. Some fonts have negative line gap metrics. Chrome and Firefox both clamp it to 0, so the line-height isn't decreased. However, we were honoring the negative line gap, thereby decreasing line-height. There are some typographical reasons to want a negative line gap, which is why this clamping behavior shouldn't be done in the platform text library. In the interest of matching other browsers, we should perform this clamping ourselves in WebKit. Test: fast/text/negative-line-gap.html * platform/graphics/Font.cpp: (WebCore::Font::platformGlyphInit): 2020-05-12 Ross Kirsling <ross.kirsling@sony.com> Unreviewed PlayStation / clang-cl build fix following r261533. clang for Windows (< v10.0.0) cannot destructure a const class. See also r254471, r249524, etc. * Modules/indexeddb/server/MemoryObjectStore.cpp: (WebCore::IDBServer::MemoryObjectStore::updateIndexesForPutRecord): * Modules/indexeddb/server/SQLiteIDBBackingStore.cpp: (WebCore::IDBServer::SQLiteIDBBackingStore::updateAllIndexesForAddRecord): 2020-05-12 Ross Kirsling <ross.kirsling@sony.com> Unreviewed PlayStation build fix following r261494. * PlatformPlayStation.cmake: 2020-05-12 Carlos Garcia Campos <cgarcia@igalia.com> [GTK] Rework drag and drop handling in preparation for GTK4 https://bugs.webkit.org/show_bug.cgi?id=211723 Reviewed by Adrian Perez de Castro. Remove PasteboardHelper that is no longer used and add conversion functions to GtkUtilities. * PlatformGTK.cmake: * SourcesGTK.txt: * platform/gtk/GtkUtilities.cpp: (WebCore::gdkDragActionToDragOperation): (WebCore::dragOperationToGdkDragActions): (WebCore::dragOperationToSingleGdkDragAction): * platform/gtk/GtkUtilities.h: * platform/gtk/PasteboardHelper.cpp: Removed. * platform/gtk/PasteboardHelper.h: Removed. 2020-05-12 Jacob Uphoff <jacob_uphoff@apple.com> Unreviewed, reverting r261557. This commit caused testing to exit early due to too many crashes on macOS Catalina Asan Reverted changeset: "Allow WebAudioBufferList to dynamically change its number of frames" https://bugs.webkit.org/show_bug.cgi?id=211720 https://trac.webkit.org/changeset/261557 2020-05-12 Simon Fraser <simon.fraser@apple.com> Speculative fix for crash in ScrollingTree::handleWheelEvent() https://bugs.webkit.org/show_bug.cgi?id=211763 <rdar://problem/62926117> Reviewed by Andy Estes. Crash data shows a null-deref crash in ScrollingTree::handleWheelEvent() which is most likely because m_rootNode is null. Protect against this. * page/scrolling/ScrollingTree.cpp: (WebCore::ScrollingTree::handleWheelEvent): 2020-05-12 Youenn Fablet <youenn@apple.com> Allow WebAudioBufferList to dynamically change its number of frames https://bugs.webkit.org/show_bug.cgi?id=211720 Reviewed by Eric Carlson. We sometimes create WebAudioBufferList on the stack which triggers allocation of several vectors. Instead of doing that for every audio sample chunk, we should allocate the WebAudioBufferList and resize it as necessary. For that purpose, we introduce WebAudioBufferList::updateWithNumberOfFrames and use it in two places: - When creating an audio track into WebAudio. - When receiving audio chunks from another process. Covered by existing tests. * Modules/webaudio/MediaStreamAudioSource.cpp: (WebCore::MediaStreamAudioSource::~MediaStreamAudioSource): * Modules/webaudio/MediaStreamAudioSource.h: * Modules/webaudio/MediaStreamAudioSourceCocoa.cpp: (WebCore::streamDescription): (WebCore::MediaStreamAudioSource::consumeAudio): * platform/audio/cocoa/WebAudioBufferList.cpp: (WebCore::WebAudioBufferList::WebAudioBufferList): (WebCore::WebAudioBufferList::updateWithNumberOfFrames): (WebCore::WebAudioBufferList::channelCount const): * platform/audio/cocoa/WebAudioBufferList.h: 2020-05-12 Carlos Garcia Campos <cgarcia@igalia.com> [GTK] Rework clipboard handling in preparation for GTK4 https://bugs.webkit.org/show_bug.cgi?id=211511 Reviewed by Adrian Perez de Castro. Remove PlatformPasteboard implementation that has been replaced by Clipboard class in the WebKit layer. When Pasteboard class is created for copy and paste operations, it no longer has a SelectionData member, it just uses the new methods in the pasteboard strategy to communicate with the clipboard. WebContentReader has now an implementation for GTK and it's used when reading from the clipboard, the same way it's done in other ports. * SourcesGTK.txt: * editing/WebContentReader.h: * editing/gtk/EditorGtk.cpp: (WebCore::Editor::pasteWithPasteboard): Use webContentFromPasteboard(). (WebCore::Editor::webContentFromPasteboard): Use WebContentReader. * editing/gtk/WebContentReaderGtk.cpp: Added. (WebCore::WebContentReader::readFilePath): (WebCore::WebContentReader::readFilePaths): (WebCore::WebContentReader::readHTML): (WebCore::WebContentReader::readPlainText): (WebCore::WebContentReader::readImage): (WebCore::WebContentReader::readURL): (WebCore::WebContentMarkupReader::readHTML): * platform/Pasteboard.h: (WebCore::PasteboardWebContentReader::readDataBuffer): * platform/PasteboardStrategy.h: * platform/gtk/PasteboardGtk.cpp: (WebCore::Pasteboard::Pasteboard): (WebCore::Pasteboard::selectionData const): (WebCore::Pasteboard::writeString): (WebCore::Pasteboard::writePlainText): (WebCore::Pasteboard::write): (WebCore::Pasteboard::clear): (WebCore::Pasteboard::canSmartReplace): (WebCore::Pasteboard::read): (WebCore::Pasteboard::hasData): (WebCore::Pasteboard::typesForLegacyUnsafeBindings): (WebCore::Pasteboard::readString): (WebCore::Pasteboard::fileContentState): * platform/gtk/PasteboardHelper.cpp: * platform/gtk/PasteboardHelper.h: * platform/gtk/PlatformPasteboardGtk.cpp: Removed. * platform/gtk/SelectionData.cpp: (WebCore::SelectionData::setURL): Do not override the text and markup if it has already been set. 2020-05-12 Youenn Fablet <youenn@apple.com> Introduce a RealtimeMediaSource video sample observer https://bugs.webkit.org/show_bug.cgi?id=211718 Reviewed by Eric Carlson. We introduce an observer dedicated to video samples similarly to AudioSampleObserver for audio. This will allow to move video frame processing out of the main thread progressively. For now, we remove video sample observing from the track private and observers should now register directly to the realtime media source. We update the various users, including MediaRecorder and the media player. In both cases, they will only observe the video track to be played/recorded, which is both more efficient and simpler. We introduced RealtimeMediaSource::Observer::hasStartedProducingData callback for MediaStreamTrackPrivate so that the processing to do when the first samples are available can be done on the main thread. MediaStreamTrackPrivate no longer filters out samples if it is not enabled. As such, each consumer is now responsible to observe/unobserve the source when its track gets enabled/disabled similarly as for audio, or do nothing if track is not enabled. Similarly, RealtimeOutgoingVideoSourceCocoa will now only observe video samples when the track is enabled and not muted. Covered by existing tests. * Modules/mediarecorder/MediaRecorder.cpp: (WebCore::MediaRecorder::sampleBufferUpdated): Deleted. * Modules/mediarecorder/MediaRecorder.h: * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.h: * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm: (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::~MediaPlayerPrivateMediaStreamAVFObjC): (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::enqueueVideoSample): We can renove the track check since we only observe the active video track. (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::videoSampleAvailable): (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::checkSelectedVideoTrack): (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::sampleBufferUpdated): Deleted. * platform/mediarecorder/MediaRecorderPrivate.h: (WebCore::MediaRecorderPrivate::setVideoSource): (WebCore::MediaRecorderPrivate::~MediaRecorderPrivate): * platform/mediarecorder/MediaRecorderPrivateAVFImpl.cpp: (WebCore::MediaRecorderPrivateAVFImpl::create): (WebCore::MediaRecorderPrivateAVFImpl::~MediaRecorderPrivateAVFImpl): (WebCore::MediaRecorderPrivateAVFImpl::videoSampleAvailable): (WebCore::MediaRecorderPrivateAVFImpl::stopRecording): (WebCore::MediaRecorderPrivateAVFImpl::sampleBufferUpdated): Deleted. * platform/mediarecorder/MediaRecorderPrivateAVFImpl.h: * platform/mediarecorder/MediaRecorderPrivateMock.cpp: (WebCore::MediaRecorderPrivateMock::MediaRecorderPrivateMock): (WebCore::MediaRecorderPrivateMock::~MediaRecorderPrivateMock): (WebCore::MediaRecorderPrivateMock::stopRecording): (WebCore::MediaRecorderPrivateMock::videoSampleAvailable): (WebCore::MediaRecorderPrivateMock::sampleBufferUpdated): Deleted. * platform/mediarecorder/MediaRecorderPrivateMock.h: * platform/mediastream/MediaStreamTrackPrivate.cpp: (WebCore::MediaStreamTrackPrivate::hasStartedProducingData): (WebCore::MediaStreamTrackPrivate::updateReadyState): (WebCore::MediaStreamTrackPrivate::videoSampleAvailable): Deleted. (WebCore::MediaStreamTrackPrivate::hasStartedProducingAudioData): Deleted. * platform/mediastream/MediaStreamTrackPrivate.h: * platform/mediastream/RealtimeMediaSource.cpp: (WebCore::RealtimeMediaSource::addVideoSampleObserver): (WebCore::RealtimeMediaSource::removeVideoSampleObserver): (WebCore::RealtimeMediaSource::updateHasStartedProducingData): (WebCore::RealtimeMediaSource::videoSampleAvailable): (WebCore::RealtimeMediaSource::audioSamplesAvailable): * platform/mediastream/RealtimeMediaSource.h: * platform/mediastream/RealtimeOutgoingVideoSource.cpp: (WebCore::RealtimeOutgoingVideoSource::unobserveSource): (WebCore::RealtimeOutgoingVideoSource::updateBlackFramesSending): * platform/mediastream/RealtimeOutgoingVideoSource.h: * platform/mediastream/RealtimeVideoSource.cpp: (WebCore::RealtimeVideoSource::~RealtimeVideoSource): (WebCore::RealtimeVideoSource::startProducingData): (WebCore::RealtimeVideoSource::stopProducingData): (WebCore::RealtimeVideoSource::videoSampleAvailable): * platform/mediastream/RealtimeVideoSource.h: * platform/mediastream/mac/AVVideoCaptureSource.mm: (WebCore::AVVideoCaptureSource::captureOutputDidOutputSampleBufferFromConnection): * platform/mediastream/mac/RealtimeIncomingVideoSourceCocoa.h: * platform/mediastream/mac/RealtimeIncomingVideoSourceCocoa.mm: (WebCore::RealtimeIncomingVideoSourceCocoa::processNewSample): * platform/mediastream/mac/RealtimeOutgoingVideoSourceCocoa.cpp: (WebCore::RealtimeOutgoingVideoSourceCocoa::videoSampleAvailable): (WebCore::RealtimeOutgoingVideoSourceCocoa::sampleBufferUpdated): Deleted. * platform/mediastream/mac/RealtimeOutgoingVideoSourceCocoa.h: * platform/mock/MockRealtimeVideoSource.cpp: * testing/Internals.cpp: (WebCore::Internals::~Internals): (WebCore::Internals::stopObservingRealtimeMediaSource): (WebCore::Internals::observeMediaStreamTrack): * testing/Internals.h: 2020-05-12 Philippe Normand <pnormand@igalia.com> [GStreamer] Audio messages in web.whatsapp.com only play once. https://bugs.webkit.org/show_bug.cgi?id=211627 Reviewed by Xabier Rodriguez-Calvar. Test: media/video-src-blob-replay.html * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp: (WebCore::MediaPlayerPrivateGStreamer::updateDownloadBufferingFlag): Make sure on-disk buffering is disabled for blob URIs, because it messes up the pipeline for replays, and it's useless for that use-case anyway. 2020-05-12 Said Abou-Hallawa <sabouhallawa@apple.com> Need to advertise support for WebP in the Accept header https://bugs.webkit.org/show_bug.cgi?id=211735 Reviewed by Darin Adler. On Mac and iOS, the system has to support WebP: HAVE(WEBP). On other platforms, WebKit has to be able to decode WebP images: USE(WEBP). * css/CSSCalculationValue.cpp: (WebCore::createCSS): Fix unrealted coding style issue. * loader/cache/CachedResourceRequest.cpp: (WebCore::acceptHeaderValueForImageResource): (WebCore::acceptHeaderValueFromType): 2020-05-11 Darin Adler <darin@apple.com> Fix problems caught by replacing WTF::Optional with std::optional https://bugs.webkit.org/show_bug.cgi?id=211703 Reviewed by Chris Dumez. * editing/EditorCommand.cpp: (WebCore::executeSelectToMark): Remove erroneous code that converts a live range to a SimpleRange and then back again. * inspector/agents/InspectorNetworkAgent.cpp: (WebCore::InspectorNetworkAgent::willSendRequest): Pass a pointer to a ResourceRequest. (WebCore::InspectorNetworkAgent::didLoadResourceFromMemoryCache): Ditto. (WebCore::InspectorNetworkAgent::buildInitiatorObject): Take a const* to a ResourceRequest instead of an Optional<const ResourceRequest&> because std::optional does not work with reference types. * inspector/agents/InspectorNetworkAgent.h: Update for the change above. * layout/floats/FloatingContext.cpp: (WebCore::Layout::Iterator::operator++): Fix code that was accidentally comparing two optionals, after already checking them for null. Instead we should compare their values. * platform/PlatformScreen.cpp: (WebCore::screenData): Return a const* instead of an Optional<const&> because std::optonal does not work with reference types. * platform/PlatformScreen.h: Updated for the above. Also removed both the unneeded include of Optional.h (could have included Forward.h) and of HashMap.h and put the Mac-specific type IORegistryGPUID inside a PLATFORM(MAC) #if statement. * platform/ScreenProperties.h: Moved the HashMap.h include here, since this is the header that uses it. Changed the EncodedColorSpaceDataType enum to an enum class and gave it much shorter names. (WebCore::ScreenData::encode const): Updated for the enum class change. Also fixed a mistake where the code would use operator<< instead of encodeEnum for the color space type of Null. This would lead to some kind of decoding error, rather than a null cgColorSpace. (WebCore::ScreenData::decode): Ditto. * platform/ios/PlatformScreenIOS.mm: (WebCore::screenIsMonochrome): Updated since screenData returns a pointer. (WebCore::screenHasInvertedColors): Ditto. (WebCore::screenSupportsExtendedColor): Ditto. (WebCore::screenSize): Ditto. (WebCore::availableScreenSize): Ditto. * platform/mac/PlatformScreenMac.mm: Moved declaration of CGDisplayUsesForceToGray to CoreGraphicsSPI.h. Removed unused declaration of CGDisplayUsesInvertedPolarity. (WebCore::primaryOpenGLDisplayMask): Updated since screendData returns a pointer. (WebCore::displayMaskForDisplay): Ditto. (WebCore::gpuIDForDisplay): Ditto. (WebCore::screenProperties): Ditto. Also renamed from getScreenProperties to adhere to WebKit coding style. (WebCore::screenIsMonochrome): Ditto. (WebCore::screenHasInvertedColors): Ditto. (WebCore::screenDepth): Ditto. (WebCore::screenDepthPerComponent): Ditto. (WebCore::screenRectForDisplay): Ditto. (WebCore::screenRect): Ditto. (WebCore::screenAvailableRect): Ditto. (WebCore::screenColorSpace): Ditto. (WebCore::screenSupportsExtendedColor): Ditto. (WebCore::screenSupportsHighDynamicRange): Ditto. * workers/service/context/ServiceWorkerThread.cpp: (WebCore::ServiceWorkerThread::queueTaskToFireInstallEvent): Removed capture of unused jobDataIdentifier. 2020-05-11 James Darpinian <jdarpinian@chromium.org> WebGLLayer clobbers TEXTURE_2D binding on iOS https://bugs.webkit.org/show_bug.cgi?id=211758 Reviewed by Dean Jackson. WebGLLayer was accidentally clobbering the TEXTURE_2D binding on iOS because IOSurfaces are bound to TEXTURE_2D instead of TEXTURE_RECTANGLE. This fixes a bunch of iOS-specific WebGL conformance failures including: texture-bindings-unaffected-on-resize.html default-texture.html tex-image-and-sub-image-2d-with-canvas-rgb565.html and friends * platform/graphics/GraphicsContextGL.h: * platform/graphics/cocoa/WebGLLayer.mm: (-[WebGLLayer display]): (-[WebGLLayer bindFramebufferToNextAvailableSurface]): 2020-05-11 Simon Fraser <simon.fraser@apple.com> [ macOS ] scrollingcoordinator/mac/latching/scrolling-select-should-not-latch-mainframe.html is a flaky failure https://bugs.webkit.org/show_bug.cgi?id=211747 Reviewed by Tim Horton. Add an option to monitorWheelEvents to reset latching. * page/Page.cpp: (WebCore::Page::startMonitoringWheelEvents): * page/Page.h: * page/scrolling/ScrollingCoordinator.h: (WebCore::ScrollingCoordinator::startMonitoringWheelEvents): * page/scrolling/mac/ScrollingCoordinatorMac.h: * page/scrolling/mac/ScrollingCoordinatorMac.mm: (WebCore::ScrollingCoordinatorMac::startMonitoringWheelEvents): * testing/js/WebCoreTestSupport.cpp: (WebCoreTestSupport::monitorWheelEvents): * testing/js/WebCoreTestSupport.h: 2020-05-11 Andres Gonzalez <andresg_22@apple.com> Fixes for crashes in isolated tree mode. https://bugs.webkit.org/show_bug.cgi?id=211740 Reviewed by Chris Fleizach. Fixes for several LayoutTests in isolated tree mode. * accessibility/mac/WebAccessibilityObjectWrapperBase.mm: (-[WebAccessibilityObjectWrapperBase attachIsolatedObject:]): * accessibility/mac/WebAccessibilityObjectWrapperMac.mm: (-[WebAccessibilityObjectWrapper characterOffsetForTextMarker:]): (-[WebAccessibilityObjectWrapper textMarkerForVisiblePosition:]): (-[WebAccessibilityObjectWrapper accessibilityAttributeValue:]): (-[WebAccessibilityObjectWrapper accessibilitySetValue:forAttribute:]): (-[WebAccessibilityObjectWrapper _accessibilitySetValue:forAttribute:]): 2020-05-11 Simon Fraser <simon.fraser@apple.com> Scrollbars flicker in RTL scrollable regions https://bugs.webkit.org/show_bug.cgi?id=211757 Reviewed by Tim Horton. Scrollbars deal in scroll offsets (zero-based), not scroll positions (scroll-origin based) so the scrolling thread needs to update scrollbar painters using offsets. Not testable because this is a transient state that gets fixed by the main thread. * page/scrolling/mac/ScrollingTreeScrollingNodeDelegateMac.mm: (WebCore::ScrollingTreeScrollingNodeDelegateMac::updateScrollbarPainters): 2020-05-11 Ben Nham <nham@apple.com> Improve accuracy of IndexedDB estimated write size computation https://bugs.webkit.org/show_bug.cgi?id=211360 Reviewed by Brady Eidson. We currently estimate the size of a put in IndexedDB for quota check purposes with something like: estimatedWriteSize = (1 + numIndices) * (keySize + valueSize) However, this can lead to large overestimates of write sizes. This is because secondary indices only store a mapping of secondary index key => primary key; they do not store the entire value. In the example site attached to 202137 (another DB quota-related bug), the the heuristic estimates that one of the put operations would use more than 800 MB when it actually uses 220 MB. This inaccuracy leads to spurious disk quota permission modals being presented in Safari. This patch improves the write size computation by generating the secondary index keys before estimating the write size. The performance should be about the same since we save the generated index keys for later usage when we actually add the record to the DB. * Headers.cmake: * Modules/indexeddb/server/IDBBackingStore.h: * Modules/indexeddb/server/MemoryIDBBackingStore.cpp: (WebCore::IDBServer::MemoryIDBBackingStore::MemoryIDBBackingStore): (WebCore::IDBServer::MemoryIDBBackingStore::addRecord): (WebCore::IDBServer::MemoryIDBBackingStore::serializationContext): * Modules/indexeddb/server/MemoryIDBBackingStore.h: * Modules/indexeddb/server/MemoryObjectStore.cpp: (WebCore::IDBServer::MemoryObjectStore::addRecord): (WebCore::IDBServer::MemoryObjectStore::updateIndexesForPutRecord): * Modules/indexeddb/server/MemoryObjectStore.h: * Modules/indexeddb/server/SQLiteIDBBackingStore.cpp: (WebCore::IDBServer::SQLiteIDBBackingStore::updateAllIndexesForAddRecord): (WebCore::IDBServer::SQLiteIDBBackingStore::addRecord): (WebCore::IDBServer::SQLiteIDBBackingStore::serializationContext): * Modules/indexeddb/server/SQLiteIDBBackingStore.h: * Modules/indexeddb/server/UniqueIDBDatabase.cpp: (WebCore::IDBServer::estimateSize): (WebCore::IDBServer::UniqueIDBDatabase::putOrAdd): * Modules/indexeddb/shared/IndexKey.h: * WebCore.xcodeproj/project.pbxproj: * bindings/js/IDBBindingUtilities.cpp: (WebCore::generateIndexKeyMapForValue): * bindings/js/IDBBindingUtilities.h: 2020-05-11 Kate Cheney <katherine_cheney@apple.com> Fail navigations to non app-bound domains after use of app-bound APIs https://bugs.webkit.org/show_bug.cgi?id=211647 <rdar://problem/62978159> Reviewed by Brent Fulgham. Simplified in-app browser privacy protections check into one, better named function. * bindings/js/ScriptController.cpp: (WebCore::ScriptController::executeScriptInWorld): * loader/FrameLoaderClient.h: * page/Frame.cpp: (WebCore::Frame::injectUserScriptImmediately): * page/Page.cpp: (WebCore::Page::injectUserStyleSheet): * page/WebKitNamespace.cpp: (WebCore::WebKitNamespace::messageHandlers): * style/StyleScopeRuleSets.cpp: (WebCore::Style::ScopeRuleSets::initializeUserStyle): Rearranged ordering so the message to WebPageProxy only gets sent to indicate app-bound behavior if user style sheets actually exist. 2020-05-11 Peng Liu <peng.liu6@apple.com> Enable the mock video presentation mode in related layout tests and fix test failures https://bugs.webkit.org/show_bug.cgi?id=211645 Reviewed by Eric Carlson. Revert the unnecessary change in r261493 to fix the build failures when the Picture-in-Picture API is disabled. * html/HTMLVideoElement.cpp: * html/HTMLVideoElement.h: 2020-05-11 Wenson Hsieh <wenson_hsieh@apple.com> Remove some unnecessary indirection when getting Document’s Editor https://bugs.webkit.org/show_bug.cgi?id=211744 Reviewed by Geoffrey Garen. After r261018, there's no longer a need to reach into Document's Frame to get the Editor instance, since Document itself owns the Editor (and Frame's implementation of editor() just calls back into the document anyways). No change in behavior. * accessibility/mac/WebAccessibilityObjectWrapperMac.mm: (AXAttributeStringSetSpelling): * dom/Document.cpp: (WebCore::Document::setFocusedElement): (WebCore::Document::registerAttachmentIdentifier): (WebCore::Document::didInsertAttachmentElement): (WebCore::Document::didRemoveAttachmentElement): * testing/Internals.cpp: (WebCore::Internals::markerCountForNode): (WebCore::Internals::setMarkedTextMatchesAreHighlighted): (WebCore::Internals::lastSpellCheckRequestSequence): (WebCore::Internals::lastSpellCheckProcessedSequence): (WebCore::Internals::hasSpellingMarker): (WebCore::Internals::hasAutocorrectedMarker): (WebCore::Internals::setContinuousSpellCheckingEnabled): (WebCore::Internals::setAutomaticQuoteSubstitutionEnabled): (WebCore::Internals::setAutomaticLinkDetectionEnabled): (WebCore::Internals::setAutomaticDashSubstitutionEnabled): (WebCore::Internals::setAutomaticTextReplacementEnabled): (WebCore::Internals::setAutomaticSpellingCorrectionEnabled): (WebCore::Internals::handleAcceptedCandidate): (WebCore::Internals::isOverwriteModeEnabled): (WebCore::Internals::toggleOverwriteModeEnabled): (WebCore::Internals::rangeOfString): (WebCore::Internals::countMatchesForText): (WebCore::Internals::hasGrammarMarker): 2020-05-11 Devin Rousso <drousso@apple.com> Web Inspector: show JavaScript Worker name as an internal property https://bugs.webkit.org/show_bug.cgi?id=211708 Reviewed by Timothy Hatcher. Test: inspector/worker/worker-create-and-terminate.html * inspector/WebInjectedScriptHost.cpp: (WebCore::WebInjectedScriptHost::getInternalProperties): * workers/Worker.h: (WebCore::Worker::name const): Added. 2020-05-11 Simon Fraser <simon.fraser@apple.com> Have ScrollingThread use a RunLoop rather than rolling its own https://bugs.webkit.org/show_bug.cgi?id=211730 Reviewed by Darin Adler. ScrollingThread rolled its own runloop/function dispatch by dropping to CF for macOS. Fix to use RunLoop which provides the same functionality. There was also a race creating the ScrollingThread for the first time, since both the main thread, and EventDispatcher can call ScrollingThread::dispatch() early on, so fix with a std::once block. * SourcesCocoa.txt: * WebCore.xcodeproj/project.pbxproj: * page/scrolling/ScrollingThread.cpp: (WebCore::ScrollingThread::singleton): (WebCore::ScrollingThread::dispatch): (WebCore::ScrollingThread::createThreadIfNeeded): (WebCore::ScrollingThread::initializeRunLoop): (WebCore::ScrollingThread::dispatchFunctionsFromScrollingThread): Deleted. (WebCore::ScrollingThread::wakeUpRunLoop): Deleted. (WebCore::ScrollingThread::threadRunLoopSourceCallback): Deleted. * page/scrolling/ScrollingThread.h: (WebCore::ScrollingThread::runLoop): * page/scrolling/mac/ScrollingThreadMac.mm: Removed. 2020-05-11 Peng Liu <peng.liu6@apple.com> Enable the mock video presentation mode in related layout tests and fix test failures https://bugs.webkit.org/show_bug.cgi?id=211645 Reviewed by Darin Adler. Clean up the internal states of video element regarding video presentation mode to simplify the task to write reliable layout tests for video fullscreen and Picture-in-Picture. * html/HTMLMediaElement.cpp: (WebCore::HTMLMediaElement::enterFullscreen): Update the states after we are sure the video element will enter fullscreen. (WebCore::HTMLMediaElement::exitFullscreen): Remove the unnecessary "fullscreenModeChanged(VideoFullscreenModeNone)". * html/HTMLMediaElement.h: (WebCore::HTMLMediaElement::waitingToEnterFullscreen): * html/HTMLVideoElement.cpp: (WebCore::HTMLVideoElement::webkitDisplayingFullscreen): The function webkitDisplayingFullscreen() will return true after the process to enter fullscreen is completed. * html/HTMLVideoElement.h: Expose didBecomeFullscreenElement() when VIDEO_PRESENTATION_MODE is enabled. 2020-05-11 Antoine Quint <graouts@apple.com> [Web Animations] Document.getAnimations() should only consider document connection and not timeline association https://bugs.webkit.org/show_bug.cgi?id=211697 Reviewed by Dean Jackson. The Document.getAnimations() function should return any animation running for an element that is a child of the target Document. We now consider all current animations, regardless of which timeline they might be associated with. This lets us pass the final two WPT Document.getAnimations() tests. * dom/Document.cpp: (WebCore::Document::matchingAnimations): 2020-05-11 Andres Gonzalez <andresg_22@apple.com> Add implementation for AXIsolatedObject::elementPath, hasHighlighting, isBlockquote, isKeyboardFocusable. https://bugs.webkit.org/show_bug.cgi?id=211732 Reviewed by Chris Fleizach. Covered by several tests. * accessibility/AccessibilityObject.cpp: (WebCore::AccessibilityObject::isBlockquote const): Moved to base class. * accessibility/AccessibilityObject.h: * accessibility/AccessibilityObjectInterface.h: (WebCore::AXCoreObject::isBlockquote const): * accessibility/isolatedtree/AXIsolatedObject.cpp: (WebCore::AXIsolatedObject::initializeAttributeData): Cache the above mentioned properties. (WebCore::AXIsolatedObject::pathAttributeValue const): (WebCore::AXIsolatedObject::isBlockquote const): Moved to base class. (WebCore::AXIsolatedObject::isKeyboardFocusable const): Implemented inline in header. (WebCore::AXIsolatedObject::hasHighlighting const): Implemented inline in header. (WebCore::AXIsolatedObject::elementPath const): Implemented inline in header. * accessibility/isolatedtree/AXIsolatedObject.h: 2020-05-11 Alex Christensen <achristensen@webkit.org> Fix assertion after r261414 https://bugs.webkit.org/show_bug.cgi?id=211731 This fixes a debug assertion that fired 100% of the time when running the test introduced in r261414 I also respond to Darin's and Youenn's post-commit feedback. * page/SecurityPolicy.cpp: (WebCore::SecurityPolicy::generateReferrerHeader): * platform/network/ResourceRequestBase.cpp: (WebCore::ResourceRequestBase::setHTTPReferrer): 2020-05-11 Andres Gonzalez <andresg_22@apple.com> Check the validity of the underlying Document before updating the isolated tree. https://bugs.webkit.org/show_bug.cgi?id=211728 Reviewed by Chris Fleizach. Solves crashes in isolated tree mode for several LayoutTests. * accessibility/AXObjectCache.cpp: (WebCore::AXObjectCache::focusedUIElementForPage): Update the focused document styles before returning the isolated tree focused object. (WebCore::AXObjectCache::notificationPostTimerFired): Ignored notification if underlying Document doesn't have a living render tree. * accessibility/isolatedtree/AXIsolatedTree.cpp: (WebCore::AXIsolatedTree::updateChildren): Don't update isolated object if associated AXObject doesn't have a Document or the Document doesn't have a live render tree. 2020-05-11 Andres Gonzalez <andresg_22@apple.com> Add mechanism to turn on accessibility isolated tree mode from WebKitTestRunner. https://bugs.webkit.org/show_bug.cgi?id=211725 Reviewed by Chris Fleizach. If the client is WebKitTestRunner, enable isolated tree mode. * accessibility/AXObjectCache.cpp: (WebCore::AXObjectCache::isIsolatedTreeEnabled): 2020-05-11 Per Arne Vollan <pvollan@apple.com> Unreviewed, reverting r261296. Rolling r260769 back in, since this was not causing a regression. Reverted changeset: "Unreviewed, reverting r260769." https://bugs.webkit.org/show_bug.cgi?id=211578 https://trac.webkit.org/changeset/261296 2020-05-11 Zalan Bujtas <zalan@apple.com> [LFC][TFC] Introduce GridSpace https://bugs.webkit.org/show_bug.cgi?id=211712 Reviewed by Antti Koivisto. Normally we use the initial width/height (minimum width/height) value to compute the distribution ratio for the extra space (e.g minimum widths are [ 1 ] [ 2 ] extra space: 6; final widths [ 1 + 2 ] [ 2 + 4 ]). However is some rare case, while we use the minimum widths as the initial widths, the distribution ratio is computed using the maximum widths. This patch introduces GridSpace to be able to differentiate initial and distribution widths/heights (no functional change yet). * layout/tableformatting/TableFormattingContext.cpp: (WebCore::Layout::GridSpace::isEmpty const): (WebCore::Layout::max): (WebCore::Layout::operator-): (WebCore::Layout::operator+=): (WebCore::Layout::operator-=): (WebCore::Layout::operator/): (WebCore::Layout::distributeAvailableSpace): (WebCore::Layout::TableFormattingContext::computeAndDistributeExtraHorizontalSpace): (WebCore::Layout::TableFormattingContext::computeAndDistributeExtraVerticalSpace): 2020-05-10 Antoine Quint <graouts@apple.com> [Web Animations] Refactor animation comparison by composite order in a single utility function https://bugs.webkit.org/show_bug.cgi?id=211695 Reviewed by Darin Adler. We used to split sorting of animations by composite order across several functions and files. Specifically, DocumentTimeline::getAnimations() would first collect animations by class (CSS Transitions, then CSS Animations, then JS-originated animations), and then sort each class, calling into the static function compareDeclarativeAnimationOwningElementPositionsInDocumentTreeOrder() in some cases and into the WebAnimationUtilities compareAnimationsByCompositeOrder() function in other. Since we need to be able to sort animations by composite order in other situations, for instance when sorting events when updating animations and sending events (which we will do in a future patch), we refactor all of the comparison logic into compareAnimationsByCompositeOrder(), removing the need to provide an AnimationList, which is specific to the case where we know we are comparing CSSAnimation objects targeting a shared element. This effectively empties DocumentTimeline::getAnimations() so we remove this function and filter relevant animations in Document::matchingAnimations() and call compareAnimationsByCompositeOrder() before returning the compiled animations. No new tests since there is no change of behavior. * animation/DocumentTimeline.cpp: (WebCore::compareDeclarativeAnimationOwningElementPositionsInDocumentTreeOrder): Deleted. (WebCore::DocumentTimeline::getAnimations const): Deleted. * animation/DocumentTimeline.h: * animation/KeyframeEffectStack.cpp: (WebCore::KeyframeEffectStack::ensureEffectsAreSorted): * animation/WebAnimation.cpp: (WebCore::WebAnimation::commitStyles): * animation/WebAnimationUtilities.cpp: (WebCore::compareDeclarativeAnimationOwningElementPositionsInDocumentTreeOrder): (WebCore::compareCSSTransitions): (WebCore::compareCSSAnimations): (WebCore::compareAnimationsByCompositeOrder): * animation/WebAnimationUtilities.h: * dom/Document.cpp: (WebCore::Document::matchingAnimations): 2020-05-11 Charlie Turner <cturner@igalia.com> [WPE] Layout test media/encrypted-media/mock-MediaKeySystemAccess.html is crashing https://bugs.webkit.org/show_bug.cgi?id=181225 Reviewed by Darin Adler. WebCore::CDM::createInstance assumes its private instance always produces a valid pointer. This is not the case in the testing mocks. Guard against it. Test: media/encrypted-media/mock-MediaKeySystemAccess.html * Modules/encryptedmedia/CDM.cpp: (WebCore::CDM::createInstance): Guard against null pointers in mock scenarios. 2020-05-10 Rob Buis <rbuis@igalia.com> Fix base64.any.html test https://bugs.webkit.org/show_bug.cgi?id=211671 Reviewed by Darin Adler. Fix base64.any.html test by extending DataURLDecoder with a forgiving-base64 decode mode [1], as used by the Fetch data: URL processor algorithm [2]. Behavior matches Chrome and Firefox. [1] https://infra.spec.whatwg.org/#forgiving-base64-decode [2] https://fetch.spec.whatwg.org/#data-url-processor Test: imported/w3c/web-platform-tests/fetch/data-urls/base64.any.html * loader/ResourceLoader.cpp: (WebCore::ResourceLoader::loadDataURL): * platform/network/DataURLDecoder.cpp: (WebCore::DataURLDecoder::decodeBase64): (WebCore::DataURLDecoder::decode): * platform/network/DataURLDecoder.h: 2020-05-10 Darin Adler <darin@apple.com> Add copy constructor and assignment operator to Ref<> https://bugs.webkit.org/show_bug.cgi?id=211705 Reviewed by Sam Weinig. * dom/BoundaryPoint.h: As a test of the change to Ref, remove the explicit copy and move constructors and assignment operators, relying on the defaults instead, which are now exactly what we want. 2020-05-10 Michael Catanzaro <mcatanzaro@gnome.org> Update user agent quirk for bankofamerica.com https://bugs.webkit.org/show_bug.cgi?id=211700 Reviewed by Carlos Garcia Campos. The Mac platform quirk isn't working anymore. The Chrome quirk works. * platform/UserAgentQuirks.cpp: (WebCore::urlRequiresChromeBrowser): (WebCore::urlRequiresMacintoshPlatform): 2020-05-10 Darin Adler <darin@apple.com> Remove now-unneeded HAVE(CORE_VIDEO) https://bugs.webkit.org/show_bug.cgi?id=211677 Reviewed by Dan Bernstein. * page/cocoa/MemoryReleaseCocoa.mm: * platform/cocoa/CoreVideoSoftLink.cpp: Remove HAVE(CORE_VIDEO). * platform/cocoa/CoreVideoSoftLink.h: Ditto. * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h: Ditto. * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm: (WebCore::MediaPlayerPrivateAVFoundationObjC::updateLastImage): Ditto. * platform/graphics/avfoundation/objc/MediaSampleAVFObjC.mm: (WebCore::MediaSampleAVFObjC::getRGBAImageData const): Ditto. * platform/graphics/cv/PixelBufferConformerCV.cpp: Ditto. * platform/graphics/cv/PixelBufferConformerCV.h: Ditto. * platform/graphics/cv/TextureCacheCV.h: Ditto. * platform/graphics/cv/TextureCacheCV.mm: Ditto. * platform/graphics/cv/VideoTextureCopierCV.cpp: Ditto. * platform/graphics/cv/VideoTextureCopierCV.h: Ditto. 2020-05-09 Darin Adler <darin@apple.com> Tighten up logic in DocumentTimelinesController::updateAnimationsAndSendEvents https://bugs.webkit.org/show_bug.cgi?id=211668 Reviewed by Antoine Quint. * animation/DocumentTimelinesController.cpp: (WebCore::DocumentTimelinesController::updateAnimationsAndSendEvents): Use Ref instead of RefPtr. Use Ref even in timelinesToUpdate; no harm in doing a little bit of extra ref'ing. Use copyToVector when iterating relevantAnimations since it could be a problem if the current animation was removed from the ListHashSet while we are iterating it and there is no obvious reason that can't happen. Use makeRef instead of makeRefPtr. Take advantage of the behavior of the Optional operator<, which already treats nullopt as less than any non-nullopt value, and remove unnecessary checks that weere doing the same thing explicitly. This fixes a mistake where we were returning true when both are nullopt, which could harm the stability of the sort, in theory. Add a null check of the timeline when iterating completedTransitions, since there is no obvious guarantee they could not have been removed as a side effect earlier. 2020-05-10 Darin Adler <darin@apple.com> Use makeReversedRange and get rid of one-off ReverseView https://bugs.webkit.org/show_bug.cgi?id=211675 Reviewed by Sam Weinig. * editing/markup.cpp: (WebCore::ReverseView): Deleted. (WebCore::StyledMarkupAccumulator::takeResults): Use makeReversedRange. 2020-05-10 Tim Horton <timothy_horton@apple.com> Clicking a tel:// link on iPad with a trackpad presents different UI than tapping on it https://bugs.webkit.org/show_bug.cgi?id=211686 <rdar://problem/57941589> Reviewed by Wenson Hsieh. * dom/MouseRelatedEvent.h: * editing/cocoa/DataDetection.h: * editing/cocoa/DataDetection.mm: (WebCore::DataDetection::canPresentDataDetectorsUIForElement): (WebCore::DataDetection::shouldCancelDefaultAction): Deleted. Rename shouldCancelDefaultAction to canPresentDataDetectorsUIForElement. This bit indicates whether a given element should invoke DD UI instead of doing its default action, so either name is OK, but it feels better to have it in the affirmative direction. * html/HTMLAnchorElement.cpp: (WebCore::HTMLAnchorElement::handleClick): Determine if tapping on an anchor should invoke DataDetectors UI instead of performing the default action, and short-circuit if that is possible. * loader/EmptyClients.h: * page/ChromeClient.h: 2020-05-09 Wenson Hsieh <wenson_hsieh@apple.com> [macOS] Search field on mayoclinic.org/forms/us-resident-appointment clips the submit button https://bugs.webkit.org/show_bug.cgi?id=211673 <rdar://problem/62572501> Reviewed by Tim Horton. Allow search fields to be style-able, but only if the CSS `border` value is non-default. Note that there was a previous attempt to achieve something similar in r157443 by adding search fields to the base class implementation of `RenderTheme::isControlStyled`; however, this patch wasn't actually accompanied by support for rendering native search fields with a non-default background, which meant that customizing just the background of a search field would cause the entire search field to opt out of the native search field appearance (a pill with rounded corners on macOS). However, in the case where the border is customized on macOS, it is incorrect to use the default search field appearance, since the search field cell just consists of a border; as such, there should be little compatibility risk of a web page unexpectedly getting the fallback (non-native) appearance for a search field, due to having custom border styles. This also makes the behavior of search fields match that of text fields, textareas, and list boxes (multi-option selects) on macOS, in terms of what is needed in order to bail out of native appearance rendering. Rebaselined existing tests: fast/css/text-input-with-webkit-border-radius.html fast/forms/search-styled.html * rendering/RenderThemeMac.mm: (WebCore::RenderThemeMac::isControlStyled const): Add SearchFieldPart. 2020-05-09 Jer Noble <jer.noble@apple.com> REGRESSION(r258493): CRASH running fast/mediastream/RTCPeerConnection tests https://bugs.webkit.org/show_bug.cgi?id=211666 <rdar://problem/63055644> Reviewed by Eric Carlson. MockMediaStreamTrack advertises that it's a webrtc::VideoTrackInterface, but doesn't inherit from that interface, leading to a crash when its pointer is cast to webrtc::VideoTrackInterface and a virtual method called on the resulting pointer. Since it's only used in one place, and since there's an existing mock webrtc::VideoTrackInterface object in that same file, remove MockMediaStreamTrack and replace the one place it's used with MockLibWebRTCVideoTrack. * testing/MockLibWebRTCPeerConnection.h: (WebCore::MockMediaStreamTrack::state const): Deleted. 2020-05-09 David Kilzer <ddkilzer@apple.com> XML external entity resources should only be loaded from XML MIME types <https://webkit.org/b/211488> <rdar://problem/62869515> Reviewed by Darin Adler. Tests: dom/xhtml/level3/core/entitygetinputencoding03.xhtml dom/xhtml/level3/core/entitygetinputencoding04.xhtml dom/xhtml/level3/core/entitygetxmlencoding02.xhtml dom/xhtml/level3/core/entitygetxmlencoding03.xhtml dom/xhtml/level3/core/entitygetxmlencoding04.xhtml dom/xhtml/level3/core/entitygetxmlversion03.xhtml dom/xhtml/level3/core/entitygetxmlversion04.xhtml dom/xhtml/level3/core/nodegetbaseuri16.xhtml dom/xhtml/level3/core/nodegetbaseuri19.xhtml dom/xhtml/level3/core/nodegetbaseuri20.xhtml fast/parser/external-entities-in-xslt.xml fast/xsl/dtd-in-source-document.xml fast/xsl/xslt-second-level-import.xml http/tests/security/contentTypeOptions/nosniff-xml-external-entity.xhtml http/tests/security/xss-DENIED-xsl-external-entity-redirect.xml * html/HTMLBaseElement.cpp: (WebCore::HTMLBaseElement::href const): - Add comment about keeping code in sync with openFunc() in XMLDocumentParserLibxml2.cpp. * xml/XMLHttpRequest.cpp: (WebCore::XMLHttpRequest::responseMIMEType const): - Add comment about keeping code in sync with externalEntityMimeTypeAllowed() in XMLDocumentParserLibxml2.cpp. * xml/parser/XMLDocumentParserLibxml2.cpp: (WebCore::externalEntityMimeTypeAllowed): - Rename from externalEntityMimeTypeAllowedByNosniff(). - Change to only allow XML MIME types regardless of nosniff option. - Add fallback path to determine MIME type for file:/// URLs to make layout tests work properly. Logic taken from XMLHttpRequest::responseMIMEType(). Not sure if there was a good place to share it. (WebCore::openFunc): - Fix relative URLs by providing the document's URL as a base. Also provide an encoding if needed. Logic taken from HTMLBaseElement::href(). (Not sure if there was a good place to share it.) This was required to fix loading of external entity resources in the dom/xhtml/level3/core tests, which hadn't been loading these resources for a while. Ultimately this didn't matter--except for new error messages being printed in test results--because the tests fail due to missing DOM features for XHTML documents). - Change the fix for Bug 21963 into an empty URL check since setting FetchOptions.mode to Mode::SameOrigin prevents a redirect from loading a resource outside the document's origin. The previous check worked, but the relaxed check in externalEntityMimeTypeAllowed() caused the XML MIME type warning to be output on redirects to non-same-origin URLs. I didn't see a way to check for a cross-origin loading error. - Add a console message for a cross-origin load failing. - Update for function rename. - Remove double negative from console message for an invalid MIME type. (WebCore::externalEntityMimeTypeAllowedByNosniff): - Rename to externalEntityMimeTypeAllowed(). 2020-05-09 David Kilzer <ddkilzer@apple.com> Adapt LocalCurrentGraphicsContext for iOS <https://webkit.org/b/211660> Reviewed by Darin Adler. * PlatformMac.cmake: * SourcesCocoa.txt: * WebCore.xcodeproj/project.pbxproj: - Update build files for: - Rename of LocalCurrentGraphicsContext.mm to LocalCurrentGraphicsContextMac.mm. - Move of LocalCurrentGraphicsContext.h from platform/mac to platform/cocoa. - Addition of LocalCurrentGraphicsContextIOS.mm. * platform/cocoa/LocalCurrentGraphicsContext.h: Renamed from Source/WebCore/platform/mac/LocalCurrentGraphicsContext.h. - Make this work for iOS by using PLATFORM(COCOA) for the outer guard and USE(APPKIT) for the Mac-specific bits. - Use RetainPtr<> for NSGraphicsContext to clean up code in LocalCurrentGraphicsContextMac.mm. (WebCore::LocalCurrentGraphicsContext::cgContext): - Inline from LocalCurrentGraphicsContextMac.mm. * platform/ios/LocalCurrentGraphicsContextIOS.mm: Copied from Source/WebCore/platform/mac/LocalCurrentGraphicsContext.mm. (WebCore::LocalCurrentGraphicsContext::LocalCurrentGraphicsContext): (WebCore::LocalCurrentGraphicsContext::~LocalCurrentGraphicsContext): - Implement based on LocalCurrentGraphicsContextMac.mm. Use UIGraphics{GetCurrent,Pop,Push}Context() functions added to UIKitSoftLink.h. * platform/mac/LocalCurrentGraphicsContextMac.mm: Renamed from Source/WebCore/platform/mac/LocalCurrentGraphicsContext.mm. (WebCore::LocalCurrentGraphicsContext::LocalCurrentGraphicsContext): - Use m_savedGraphicsContext instead of graphicsContext in the body of the constructor. - Remove set-to-nil/retain of m_savedNSGraphicsContext since that is handled by RetainPtr<> now. (WebCore::LocalCurrentGraphicsContext::~LocalCurrentGraphicsContext): - Remove release of m_savedNSGraphicsContext since that is handled by RetainPtr<> now. (WebCore::LocalCurrentGraphicsContext::cgContext): Delete. - Inline into header to share implementation with iOS. 2020-05-09 Darin Adler <darin@apple.com> Fix null-dereference in DocumentTimelinesController::updateAnimationsAndSendEvents https://bugs.webkit.org/show_bug.cgi?id=211667 Reviewed by Antoine Quint. * animation/DocumentTimelinesController.cpp: (WebCore::DocumentTimelinesController::updateAnimationsAndSendEvents): Add null check before removing animationsToRemove, which may already have been removed since any arbitrary change could occur while animations are firing. 2020-05-09 Darin Adler <darin@apple.com> Add missing null-check of page in ResourceLoader::loadDataURL https://bugs.webkit.org/show_bug.cgi?id=211589 rdar://57213601 Reviewed by Anders Carlsson. * loader/ResourceLoader.cpp: (WebCore::ResourceLoader::loadDataURL): Add null check before using page. 2020-05-08 Darin Adler <darin@apple.com> Streamline MarkupAccumulator to improve efficiency a bit https://bugs.webkit.org/show_bug.cgi?id=211656 Reviewed by Anders Carlsson. * editing/MarkupAccumulator.cpp: (WebCore::MarkupAccumulator::appendCharactersReplacingEntities): Corrected early exit so it returns any time the length is 0. For some reason the code before wouldn't do the early return when offset is non-zero, which is unnecessary. (WebCore::MarkupAccumulator::appendString): Deleted. (WebCore::MarkupAccumulator::appendStringView): Deleted. (WebCore::MarkupAccumulator::appendEndTag): Use variadic append to cut down on memory allocations. (WebCore::MarkupAccumulator::totalLength): Deleted. (WebCore::MarkupAccumulator::concatenateMarkup): Deleted. (WebCore::MarkupAccumulator::takeMarkup): Added. (WebCore::MarkupAccumulator::appendQuotedURLAttributeValue): Use variadic append to cut down on memory allocations. Also use char instead of UChar so the string building code doesn't have to do an 8/16 bit check. (WebCore::shouldAddNamespaceElement): Prepend a literal, don't bother to make a String just to append to another String. Also made this a non-member function. (WebCore::shouldAddNamespaceAttribute): Made this a non-member function. (WebCore::MarkupAccumulator::appendNamespace): Fix hash table usage to use add instead of get followed by set to avoid double hashing. Use variadic append to cut down on memory allocation. (WebCore::MarkupAccumulator::appendText): Tweaked style to make this a one-line function. (WebCore::appendComment): Deleted. (WebCore::appendXMLDeclaration): Made this a non-member function. Use variadic append to cut down on memory allocation. (WebCore::appendDocumentType): Made this a non-member function. Use variadic append to cut down on memory allocation. (WebCore::MarkupAccumulator::appendCDATASection): Deleted. (WebCore::MarkupAccumulator::appendNonElementNode): Moved the bodies of appendComment, appendProcessingInstruction, and appendCDATASection in here since they can all be one-line variadic append calls. * editing/MarkupAccumulator.h: (WebCore::MarkupAccumulator::length const): Changed the return type of length to be unsigned since that's what StringBuilder returns. Made isAllASCII call StringBuilder::isAllASCII. Replaced appendString and appendStringView with variadic append. Removed many functions that no longer need to be member functions. Made appendAttributeValue a static member function. Made appendNamespace private. Made m_serializationSyntax const. * editing/markup.cpp: (WebCore::StyledMarkupAccumulator::wrapWithStyleNode): Use append instead of appenString. (WebCore::StyledMarkupAccumulator::isAllASCII const): Added. Before the code would only check the StringBuilder, but we also need to check m_reversedPrecedingMarkup. (WebCore::StyledMarkupAccumulator::takeResults): Use CheckedUint32 since StringBuilder's reserveCapacity function takes unsigned, not size_t. The old code, using totalLength, would just pass a size_t and let it get chopped off, which didn't do any harm, but it seems strange to compute a 64-bit value just to chop off the lower 32 bits. An alternative is to compute the 32-bit value and just let it overflow. Use a modern for loop by defining a ReverseView template rather than writing a confusing backwards loop. Use the new takeMarkup instead of concatenateMarkup. (WebCore::StyledMarkupAccumulator::appendText): Tweak coding style a little bit. (WebCore::StyledMarkupAccumulator::appendStartTag): Ditto. (WebCore::StyledMarkupAccumulator::appendNodeToPreserveMSOList): Use variadic append to cut down on memory allocations. (WebCore::propertyMissingOrEqualToNone): Tweak coding style a bit. (WebCore::serializePreservingVisualAppearanceInternal): Use append instead of appendString. (WebCore::shouldPreserveMSOLists): Take a StringView instead of a String to eliminate unnecessary memory allocation in call to substring. (WebCore::sanitizedMarkupForFragmentInDocument): Use makeString instead of StringBuilder to cut down on memory allocation. * html/HTMLFormElement.cpp: (WebCore::HTMLFormElement::resetDefaultButton): Fix spelling error in the word "explicitly". * mathml/MathMLOperatorDictionary.cpp: (WebCore::MathMLOperatorDictionary::search): Ditto. * page/PageSerializer.cpp: (WebCore::PageSerializer::SerializerMarkupAccumulator::SerializerMarkupAccumulator): Use variadic append instead of appendString to cut down on memory allocations. * rendering/svg/SVGInlineTextBox.cpp: (WebCore::SVGInlineTextBox::paint): Fix spelling error in the word "explicitly". 2020-05-09 Jack Lee <shihchieh_lee@apple.com> Nullptr crash in LegacyWebArchive::createPropertyListRepresentation when copying selected range that contains surrogate characters https://bugs.webkit.org/show_bug.cgi?id=211658 <rdar://problem/62844424> Reviewed by Ryosuke Niwa. Added check for null LegacyWebArchive in LegacyWebArchive::createFromSelection. Return nullptr when creation fails. Test: webarchive/copy-surrogate-char-crash.html * loader/archive/cf/LegacyWebArchive.cpp: (WebCore::LegacyWebArchive::createFromSelection): 2020-05-09 Tetsuharu Ohzeki <tetsuharu.ohzeki@gmail.com> Fix wpt shadow-dom/slots-fallback-in-document.html https://bugs.webkit.org/show_bug.cgi?id=211640 Reviewed by Ryosuke Niwa. By specs, HTMLSlotElement.assignedNodes() should not count children of a slot in a document tree for flattened assigned nodes. https://html.spec.whatwg.org/multipage/scripting.html#dom-slot-assignednodes https://dom.spec.whatwg.org/#find-flattened-slotables As sideeffect, this patch also fix wpt shadow-dom/slots-outside-shadow-dom-expected.html Test: web-platform-tests/shadow-dom/slots-fallback-in-document.html web-platform-tests/shadow-dom/slots-outside-shadow-dom.html * html/HTMLSlotElement.cpp: (WebCore::flattenAssignedNodes): 2020-05-08 Basuke Suzuki <basuke.suzuki@sony.com> Fix build error on PlatStation port after r261132 https://bugs.webkit.org/show_bug.cgi?id=211659 Unreviewed build fix after r261132. * page/scrolling/ScrollingTreeGestureState.cpp: 2020-05-08 David Kilzer <ddkilzer@apple.com> Remove empty directories from from svn.webkit.org repository <https://webkit.org/b/211644> Reviewed by Darin Adler. * Modules/webgpu/cocoa: Removed. * page/scrolling/ios: Removed. * platform/graphics/metal: Removed. 2020-05-08 Simon Fraser <simon.fraser@apple.com> Async overflow scroll: sometimes a <select> becomes non-scrollable https://bugs.webkit.org/show_bug.cgi?id=211433 <rdar://problem/62338474> Reviewed by Dean Jackson. Scrollable <select>s (RenderListBox) contribute to the non-fast scrollable region, so wheel events inside them are propagated to the main thread. If the select is scrolled to the end, the event will propagate to the enclosing scroller, then then FrameView::wheelEvent() may send it back to the scrolling thread. If the scrolling thread is processing such an event after the main thread, it should not perform any latching on the main thread. Test: scrollingcoordinator/mac/latching/scrolling-select-should-not-latch-mainframe.html * page/scrolling/ScrollingTree.cpp: (WebCore::ScrollingTree::shouldHandleWheelEventSynchronously): (WebCore::ScrollingTree::handleWheelEvent): * page/scrolling/ScrollingTree.h: * page/scrolling/ScrollingTreeLatchingController.cpp: (WebCore::ScrollingTreeLatchingController::receivedWheelEvent): (WebCore::ScrollingTreeLatchingController::latchedNodeForEvent const): (WebCore::ScrollingTreeLatchingController::nodeDidHandleEvent): (WebCore::ScrollingTreeLatchingController::clearLatchedNode): * page/scrolling/ScrollingTreeLatchingController.h: * page/scrolling/ThreadedScrollingTree.cpp: (WebCore::ThreadedScrollingTree::handleWheelEventAfterMainThread): * page/scrolling/ThreadedScrollingTree.h: * page/scrolling/mac/ScrollingCoordinatorMac.mm: (WebCore::ScrollingCoordinatorMac::handleWheelEvent): * platform/PlatformWheelEvent.cpp: (WebCore::operator<<): 2020-05-08 Darin Adler <darin@apple.com> Remove now-unneeded HAVE(AVFOUNDATION_LOADER_DELEGATE) https://bugs.webkit.org/show_bug.cgi?id=211646 Reviewed by Eric Carlson. * loader/MediaResourceLoader.cpp: (WebCore::MediaResourceLoader::requestResource): Remove check of HAVE(AVFOUNDATION_LOADER_DELEGATE) in a place where it also checks PLATFORM(MAC). * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h: Remove HAVE(AVFOUNDATION_LOADER_DELEGATE) in Cocoa-only code. * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm: Ditto. (WebCore::globalLoaderDelegateQueue): Ditto. (WebCore::MediaPlayerPrivateAVFoundationObjC::MediaPlayerPrivateAVFoundationObjC): Ditto. (WebCore::MediaPlayerPrivateAVFoundationObjC::~MediaPlayerPrivateAVFoundationObjC): Ditto. (WebCore::MediaPlayerPrivateAVFoundationObjC::createAVAssetForURL): Ditto. (WebCore::MediaPlayerPrivateAVFoundationObjC::didStopLoadingRequest): Ditto. * platform/graphics/avfoundation/objc/WebCoreAVFResourceLoader.h: Ditto. * platform/graphics/avfoundation/objc/WebCoreAVFResourceLoader.mm: Ditto. 2020-05-08 Tomoki Imai <Tomoki.Imai@sony.com> TextureMapper should skip clipping a content layer if it's not needed https://bugs.webkit.org/show_bug.cgi?id=210787 Reviewed by Don Olmstead. This patch follows up r260174. We don't need to clip a content layer if the clipping rect contains the content rect. This patch doesn't change the behavior but saves stencil indices. * platform/graphics/texmap/TextureMapperLayer.cpp: (WebCore::TextureMapperLayer::paintSelf): 2020-05-08 Myles C. Maxfield <mmaxfield@apple.com> [iOS] Text-style fonts aren't locale-specific https://bugs.webkit.org/show_bug.cgi?id=211438 <rdar://problem/51654163> Reviewed by Sam Weinig. Simply hook up the locale to the Core Text function. It turns out that this patch actually has no behavior change, because this locale is only used for font fallback, but WebKit does its own font fallback and we already pass the locale into CTFontCopyDefaultCascadeListForLanguages(). However, for symmetry with CTFontCreateUIFontWithLanguage() it's a good idea to just supply it anyway. Just in case. Test: platform/ios/fast/text/lang-text-style.html * platform/graphics/cocoa/SystemFontDatabaseCoreText.cpp: (WebCore::SystemFontDatabaseCoreText::createTextStyleFont): 2020-05-08 Kenneth Russell <kbr@chromium.org> [WebGL2] Complete new texture upload entry points in WebGL2RenderingContext https://bugs.webkit.org/show_bug.cgi?id=208875 Reviewed by Dean Jackson. Implement the remaining texture upload entry points - mainly for 3D textures - in WebGL2RenderingContext. Add support for uploading from the pixel unpack buffer. Refactor the WebGL 2.0 binding points into WebGL2RenderingContext, where they had previously been in the base class. Refactor validation code to override the base class where necessary. Refactor getParameter into WebGLRenderingContextBase and override it in WebGL2RenderingContext, eliminating duplicate code and fixing bugs. * html/canvas/WebGL2RenderingContext.cpp: (WebCore::WebGL2RenderingContext::~WebGL2RenderingContext): (WebCore::WebGL2RenderingContext::getInt64Parameter): (WebCore::WebGL2RenderingContext::validateBufferTarget): (WebCore::WebGL2RenderingContext::validateBufferTargetCompatibility): (WebCore::WebGL2RenderingContext::validateBufferDataTarget): (WebCore::WebGL2RenderingContext::validateAndCacheBufferBinding): (WebCore::WebGL2RenderingContext::validateTexImageBinding): (WebCore::WebGL2RenderingContext::validateTexture3DBinding): (WebCore::WebGL2RenderingContext::copyBufferSubData): (WebCore::WebGL2RenderingContext::bindFramebuffer): (WebCore::WebGL2RenderingContext::deleteFramebuffer): (WebCore::WebGL2RenderingContext::getTexParameter): (WebCore::WebGL2RenderingContext::texStorage2D): (WebCore::WebGL2RenderingContext::texStorage3D): (WebCore::WebGL2RenderingContext::texImage2D): (WebCore::WebGL2RenderingContext::texImage3D): (WebCore::WebGL2RenderingContext::texSubImage2D): (WebCore::WebGL2RenderingContext::texSubImage3D): (WebCore::WebGL2RenderingContext::bindBufferBase): (WebCore::WebGL2RenderingContext::getFramebufferAttachmentParameter): (WebCore::WebGL2RenderingContext::validateFramebufferTarget): (WebCore::WebGL2RenderingContext::getFramebufferBinding): (WebCore::WebGL2RenderingContext::getReadFramebufferBinding): (WebCore::WebGL2RenderingContext::restoreCurrentFramebuffer): (WebCore::WebGL2RenderingContext::getParameter): (WebCore::WebGL2RenderingContext::uncacheDeletedBuffer): (WebCore::WebGL2RenderingContext::validateFramebufferFuncParameters): Deleted. * html/canvas/WebGL2RenderingContext.h: * html/canvas/WebGLBuffer.cpp: (WebCore::WebGLBuffer::setTarget): * html/canvas/WebGLBuffer.h: * html/canvas/WebGLFramebuffer.cpp: (WebCore::WebGLFramebuffer::setAttachmentForBoundFramebuffer): (WebCore::WebGLFramebuffer::attach): (WebCore::WebGLFramebuffer::removeAttachmentFromBoundFramebuffer): (WebCore::WebGLFramebuffer::isBound const): * html/canvas/WebGLFramebuffer.h: * html/canvas/WebGLRenderingContext.cpp: (WebCore::WebGLRenderingContext::validateFramebufferFuncParameters): Deleted. (WebCore::WebGLRenderingContext::getParameter): Deleted. * html/canvas/WebGLRenderingContext.h: * html/canvas/WebGLRenderingContextBase.cpp: (WebCore::WebGLRenderingContextBase::initializeNewContext): (WebCore::WebGLRenderingContextBase::~WebGLRenderingContextBase): (WebCore::WebGLRenderingContextBase::validateBufferTarget): (WebCore::WebGLRenderingContextBase::validateBufferDataTarget): (WebCore::WebGLRenderingContextBase::validateAndCacheBufferBinding): (WebCore::WebGLRenderingContextBase::bindBuffer): (WebCore::WebGLRenderingContextBase::bindFramebuffer): (WebCore::WebGLRenderingContextBase::bindTexture): (WebCore::WebGLRenderingContextBase::checkFramebufferStatus): (WebCore::WebGLRenderingContextBase::uncacheDeletedBuffer): (WebCore::WebGLRenderingContextBase::deleteFramebuffer): (WebCore::WebGLRenderingContextBase::deleteRenderbuffer): (WebCore::WebGLRenderingContextBase::deleteTexture): (WebCore::WebGLRenderingContextBase::framebufferRenderbuffer): (WebCore::WebGLRenderingContextBase::framebufferTexture2D): (WebCore::WebGLRenderingContextBase::getParameter): (WebCore::WebGLRenderingContextBase::readPixels): (WebCore::WebGLRenderingContextBase::copyTexImage2D): (WebCore::WebGLRenderingContextBase::texParameter): (WebCore::WebGLRenderingContextBase::getBoundReadFramebufferColorFormat): (WebCore::WebGLRenderingContextBase::getBoundReadFramebufferWidth): (WebCore::WebGLRenderingContextBase::getBoundReadFramebufferHeight): (WebCore::WebGLRenderingContextBase::validateFramebufferTarget): (WebCore::WebGLRenderingContextBase::getFramebufferBinding): (WebCore::WebGLRenderingContextBase::getReadFramebufferBinding): (WebCore::WebGLRenderingContextBase::validateFramebufferFuncParameters): (WebCore::WebGLRenderingContextBase::validateBufferDataParameters): (WebCore::WebGLRenderingContextBase::setFramebuffer): (WebCore::WebGLRenderingContextBase::restoreCurrentFramebuffer): (WebCore::WebGLRenderingContextBase::getInt64Parameter): Deleted. * html/canvas/WebGLRenderingContextBase.h: 2020-05-08 Nikos Mouchtaris <nmouchtaris@apple.com> Implement web-share v2 for files https://bugs.webkit.org/show_bug.cgi?id=209265 Reviewed by Andy Estes. Modified existing tests for new behavior. Added support for handling of files in share/canShare, and implemented asynchronous reading of data from blobs on disk into memory. * WebCore.xcodeproj/project.pbxproj: * page/Navigator.cpp: (WebCore::Navigator::canShare): (WebCore::Navigator::share): (WebCore::Navigator::finishedLoad): * page/Navigator.h: * page/ReadShareDataAsync.cpp: Added. (WebCore::ReadShareDataAsync::readInternal): (WebCore::ReadShareDataAsync::ReadShareDataAsync): (WebCore::ReadShareDataAsync::~ReadShareDataAsync): (WebCore::ReadShareDataAsync::start): (WebCore::ReadShareDataAsync::didFinishLoading): (WebCore::ReadShareDataAsync::didReceiveData): (WebCore::ReadShareDataAsync::didStartLoading): (WebCore::ReadShareDataAsync::didFail): * page/ReadShareDataAsync.hpp: Added. * page/ShareData.h: 2020-05-08 Ryan Haddad <ryanhaddad@apple.com> Unreviewed, reverting r261341 and r261392. Caused multiple regression test failures Reverted changesets: "Poster set after playback begins should be ignored" https://bugs.webkit.org/show_bug.cgi?id=211464 https://trac.webkit.org/changeset/261341 "REGRESSION(r261341): imported/w3c/web-platform- tests/html/semantics/embedded-content/the-video- element/intrinsic_sizes.htm is failing" https://bugs.webkit.org/show_bug.cgi?id=211612 https://trac.webkit.org/changeset/261392 2020-05-08 Alex Christensen <achristensen@webkit.org> Limit HTTP referer to 4kb https://bugs.webkit.org/show_bug.cgi?id=211603 <rdar://problem/56768823> Reviewed by Chris Dumez. Use the origin if it's longer, unless the origin is too long. This matches the behavior of other browsers. See https://bugzilla.mozilla.org/show_bug.cgi?id=1557346 Tested by API tests. * platform/network/ResourceRequestBase.cpp: (WebCore::ResourceRequestBase::setHTTPReferrer): 2020-05-08 Pinki Gyanchandani <pgyanchandani@apple.com> SIGILL @ WebCore::Shape::createRasterShape -- DOS ASAN https://bugs.webkit.org/show_bug.cgi?id=211539 Reviewed by Simon Fraser. Corrected the comment. No new test needed. * rendering/shapes/Shape.cpp: (WebCore::Shape::createRasterShape): 2020-05-08 Rob Buis <rbuis@igalia.com> Fix urlsearchparams-delete.html https://bugs.webkit.org/show_bug.cgi?id=211456 Reviewed by Daniel Bates. Step 2 of URLSearchParams.delete algorithm [1] indicates we should run the update steps, even if no name-value pairs were removed. Behavior matches Chrome and Firefox. [1] https://url.spec.whatwg.org/#dom-urlsearchparams-delete Test: web-platform-tests/url/urlsearchparams-delete.html * html/URLSearchParams.cpp: (WebCore::URLSearchParams::remove): 2020-05-08 Wenson Hsieh <wenson_hsieh@apple.com> [iOS] caret appears in the middle of a search field when field is focused on agoda.com https://bugs.webkit.org/show_bug.cgi?id=211591 <rdar://problem/60605873> Reviewed by Antoine Quint. See WebKit/ChangeLog for more details. Test: editing/selection/ios/caret-rect-after-animating-focused-text-field.html * animation/WebAnimation.cpp: (WebCore::WebAnimation::finishNotificationSteps): Add plumbing to call out to the WebKit client layer after an animation finishes running. * dom/Node.h: * editing/VisibleSelection.h: WEBCORE_EXPORT a couple of methods. * page/ChromeClient.h: (WebCore::ChromeClient::animationDidFinishForElement): 2020-05-08 Wenson Hsieh <wenson_hsieh@apple.com> Preserve character set information when writing to the pasteboard when copying rich text https://bugs.webkit.org/show_bug.cgi?id=211524 Reviewed by Darin Adler. This patch is a followup to r261247, which introduced a workaround for Cocoa platforms to automatically add a `meta charset` when writing HTML data to the platform pasteboard. When copying a rich text selection, we use a different codepath when sanitizing DOM content - that is, `serializePreservingVisualAppearance`. The previous change also introduced an enum, `AddMetaCharsetIfNeeded`, to limit applying this workaround to only when we're writing HTML to the clipboard. However, it should be harmless to include this when reading sanitized HTML as well, so we can also simplify this code by removing the `AddMetaCharsetIfNeeded` enum (and all of its uses). Test: CopyHTML.SanitizationPreservesCharacterSetInSelectedText * Modules/async-clipboard/ClipboardItemBindingsDataSource.cpp: (WebCore::ClipboardItemBindingsDataSource::ClipboardItemTypeLoader::sanitizeDataIfNeeded): * dom/DataTransfer.cpp: (WebCore::DataTransfer::setDataFromItemList): * editing/MarkupAccumulator.h: (WebCore::MarkupAccumulator::isAllASCII const): * editing/cocoa/WebContentReaderCocoa.mm: (WebCore::sanitizeMarkupWithArchive): (WebCore::WebContentReader::readHTML): (WebCore::WebContentMarkupReader::readHTML): * editing/markup.cpp: (WebCore::sanitizeMarkup): (WebCore::serializePreservingVisualAppearanceInternal): Move the `meta charset` workaround from sanitizedMarkupForFragmentInDocument to serializePreservingVisualAppearanceInternal, such that HTML data written to the pasteboard when copying rich text can be used to load a web view, without losing the fact that the copied content was UTF-8 encoded. (WebCore::sanitizedMarkupForFragmentInDocument): * editing/markup.h: 2020-05-08 Andres Gonzalez <andresg_22@apple.com> Fix for crashes in LayoutTests in isolated tree mode. https://bugs.webkit.org/show_bug.cgi?id=211622 Reviewed by Chris Fleizach. Several LayoutTests. Return the root from the isolated tree when it is really ready. * accessibility/AXObjectCache.cpp: (WebCore::AXObjectCache::rootObject): Some code cleanup. * accessibility/AccessibilityRenderObject.cpp: (WebCore::AccessibilityRenderObject::clickPoint): 2020-05-08 Simon Fraser <simon.fraser@apple.com> Overflow scrollers in iframes don't get mouseMovedInContentArea() https://bugs.webkit.org/show_bug.cgi?id=211347 <rdar://problem/62784560> Reviewed by Tim Horton. We never dispatched mouseMovedInContentArea() on ScrollableAreas in subframes, so overlay scrollbar interactions there were broken. This is because the code ran from EventHandler::mouseMoved(), which only runs for the main frame. Instead, move the mouseMovedInContentArea() dispatch down into updateMouseEventTargetNode() which is run for each subframe. notifyScrollableAreasOfMouseEvents() takes an event name so we only dispatch for mouseMove events. There's some complexity here related to whether the old and new ScrollableArea targets are nested; this code doesn't try to do the right thing with nesting, but does handle the mouse moving between the scrollable main frame and an overflow region. enclosingScrollableArea() is fixed to return the FrameView. enclosingScrollableLayer() is flawed, as noted in the RenderLayer.h comment. Tests: fast/scrolling/mac/scrollbars/overflow-in-iframe-overlay-scrollbar-hovered.html fast/scrolling/mac/scrollbars/overflow-in-iframe-overlay-scrollbar-reveal.html * page/EventHandler.cpp: (WebCore::EventHandler::enclosingScrollableArea): (WebCore::EventHandler::mouseMoved): (WebCore::EventHandler::handleMouseMoveEvent): (WebCore::EventHandler::pointerCaptureElementDidChange): (WebCore::EventHandler::updateMouseEventTargetNode): (WebCore::EventHandler::notifyScrollableAreasOfMouseEvents): (WebCore::EventHandler::dispatchMouseEvent): (WebCore::enclosingScrollableArea): Deleted. (WebCore::EventHandler::notifyScrollableAreasOfMouseEnterExit): Deleted. * page/EventHandler.h: * page/ios/EventHandlerIOS.mm: (WebCore::EventHandler::dispatchSyntheticMouseOut): * rendering/RenderLayer.cpp: (WebCore::RenderLayer::debugDescription const): * rendering/RenderLayer.h: 2020-05-08 Zalan Bujtas <zalan@apple.com> [LFC][TFC] The fixed logical width should be used as the max width for a cell https://bugs.webkit.org/show_bug.cgi?id=211610 Reviewed by Antti Koivisto. Test: fast/layoutformattingcontext/table-simple-with-fixed-widht-and-inline-content.html * layout/tableformatting/TableFormattingContextGeometry.cpp: (WebCore::Layout::TableFormattingContext::Geometry::intrinsicWidthConstraintsForCell): 2020-05-08 Youenn Fablet <youenn@apple.com> Handle remote audio capture IPC messages in a background thread https://bugs.webkit.org/show_bug.cgi?id=211583 Reviewed by Eric Carlson. * platform/mediastream/mac/AudioMediaStreamTrackRendererCocoa.cpp: (WebCore::AudioMediaStreamTrackRendererCocoa::pushSamples): Add assertion to check that we are not running on the main thread. 2020-05-08 Youenn Fablet <youenn@apple.com> Video capture does not get unmuted in case of tab switch on iOS https://bugs.webkit.org/show_bug.cgi?id=211509 Reviewed by Eric Carlson. Remove setInterrupted and related code. Instead, directly use setMuted(true/false) of the source of capture tracks. To ensure we validate that the active source is tied to a track of the document, we add RealtimeSource::isSameAs which handles the case of a RealtimeVideoSource wrapping an AVVideoCaptureSource. There might be multiple video tracks with each one its RealtimeVideoSource using the same AVVideoCaptureSource. We mute the AVVideoCaptureSource directly to make sure all linked tracks will get muted/unmuted at the same time. Tests to be fixed. * Modules/mediastream/MediaStreamTrack.cpp: (WebCore::MediaStreamTrack::MediaStreamTrack): (WebCore::isSourceCapturingForDocument): (WebCore::MediaStreamTrack::updateCaptureAccordingToMutedState): * Modules/mediastream/MediaStreamTrack.h: * dom/Document.cpp: (WebCore::Document::visibilityStateChanged): * platform/mediastream/RealtimeMediaSource.cpp: * platform/mediastream/RealtimeMediaSource.h: * platform/mediastream/RealtimeMediaSourceCenter.cpp: * platform/mediastream/RealtimeMediaSourceCenter.h: * platform/mediastream/RealtimeMediaSourceFactory.h: * platform/mediastream/RealtimeVideoSource.h: * platform/mediastream/ios/CoreAudioCaptureSourceIOS.mm: * platform/mediastream/mac/CoreAudioCaptureSource.h: * platform/mediastream/mac/RealtimeMediaSourceCenterMac.cpp: * platform/mock/MockRealtimeMediaSourceCenter.cpp: 2020-05-07 Simon Fraser <simon.fraser@apple.com> MayBegin wheel event in a <select> doesn't flash the scrollers https://bugs.webkit.org/show_bug.cgi?id=211605 Reviewed by Antti Koivisto. We need to special-case scrollable <select> elements, because they are ScrollableAreas which are never asynchronously scrolled, so the ScrollingTree never dispatches the handleWheelEventPhase() which is necessary to flash overlay scrollbars. Scrollable <select> elements are always in the non-fast scrollable region. Fix findEnclosingScrollableContainer() to return a ScrollableArea for the "maybegin" and "canceled" events that have no delta. Remove some "inline" and make some things references. Tests: fast/scrolling/mac/scrollbars/select-overlay-scrollbar-hovered.html fast/scrolling/mac/scrollbars/select-overlay-scrollbar-reveal.html * page/EventHandler.cpp: (WebCore::handleWheelEventPhaseInScrollableArea): (WebCore::didScrollInScrollableArea): (WebCore::handleWheelEventInAppropriateEnclosingBox): (WebCore::shouldGesturesTriggerActive): (WebCore::EventHandler::eventLoopHandleMouseUp): (WebCore::EventHandler::eventLoopHandleMouseDragged): * page/mac/EventHandlerMac.mm: (WebCore::findEnclosingScrollableContainer): (WebCore::EventHandler::determineWheelEventTarget): * testing/Internals.cpp: (WebCore::Internals::scrollableAreaForNode): Fix to find the ScrollableArea for RenderListBoxes. 2020-05-07 Chris Dumez <cdumez@apple.com> Unreviewed, reverting r261252. Reland r260684 now that a proper fix has landed in Reader Reverted changeset: "REGRESSION (r260684): Reader background is lost after multitasking" https://bugs.webkit.org/show_bug.cgi?id=211533 https://trac.webkit.org/changeset/261252 2020-05-07 Pinki Gyanchandani <pgyanchandani@apple.com> SIGILL @ WebCore::Shape::createRasterShape -- DOS ASAN https://bugs.webkit.org/show_bug.cgi?id=211539 Reviewed by Geoffrey Garen. Removed the RELEASE_ASSERT because its possible for imageData to be null when imageRect size is huge value. Test: fast/shapes/shape-outside-floats/shape-outside-imagedata-overflow.html * rendering/shapes/Shape.cpp: (WebCore::Shape::createRasterShape): 2020-05-07 Youenn Fablet <youenn@apple.com> Remove AudioMediaStreamTrackRenderer::muted https://bugs.webkit.org/show_bug.cgi?id=211289 Reviewed by Eric Carlson. * platform/mediastream/AudioMediaStreamTrackRenderer.h: muted is unnecessary since we are using start/stop instead. 2020-05-07 Eric Carlson <eric.carlson@apple.com> [macOS] Playhead in Touch Bar continues when loading stalls https://bugs.webkit.org/show_bug.cgi?id=211585 <rdar://problem/33893306> Reviewed by Darin Adler. * platform/cocoa/PlaybackSessionModelMediaElement.h: * platform/cocoa/PlaybackSessionModelMediaElement.mm: (WebCore::PlaybackSessionModelMediaElement::updateForEventName): Listen for `waitingEvent` and `canplay` events. Don't claim to be playing when stalled. (WebCore::PlaybackSessionModelMediaElement::isStalled const): New. 2020-05-07 Eric Carlson <eric.carlson@apple.com> Poster set after playback begins should be ignored https://bugs.webkit.org/show_bug.cgi?id=211464 Reviewed by Jer Noble. Redo the poster frame logic to use the `show poster flag` logic from the spec. Test: media/video-poster-set-after-playback.html * html/HTMLMediaElement.cpp: (WebCore::HTMLMediaElement::HTMLMediaElement): Initialize m_showPoster. (WebCore::HTMLMediaElement::prepareForLoad): m_displayMode was removed. (WebCore::HTMLMediaElement::selectMediaResource): Call setShowPosterFlag. (WebCore::HTMLMediaElement::loadResource): Remove calls to setDisplayMode and updateDisplayState, they have been deleted. (WebCore::HTMLMediaElement::waitForSourceChange): Call setShowPosterFlag. Update spec text. (WebCore::HTMLMediaElement::noneSupported): Call setShowPosterFlag. (WebCore::HTMLMediaElement::mediaLoadingFailed): Remove call to updateDisplayState. (WebCore::HTMLMediaElement::setReadyState): Ditto. (WebCore::HTMLMediaElement::seekWithTolerance): Call setShowPosterFlag. (WebCore::HTMLMediaElement::seekTask): Check m_showPoster, not displayMode. (WebCore::HTMLMediaElement::playInternal): Call setShowPosterFlag. (WebCore::HTMLMediaElement::mediaPlayerCharacteristicChanged): Don't check displayMode. (WebCore::HTMLMediaElement::updatePlayState): No more setDisplayMode. (WebCore::HTMLMediaElement::userCancelledLoad): Call setShowPosterFlag. (WebCore::HTMLMediaElement::mediaPlayerFirstVideoFrameAvailable): Deleted. * html/HTMLMediaElement.h: (WebCore::HTMLMediaElement::showPosterFlag const): (WebCore::HTMLMediaElement::setShowPosterFlag): (WebCore::HTMLMediaElement::displayMode const): Deleted. (WebCore::HTMLMediaElement::setDisplayMode): Deleted. (WebCore::HTMLMediaElement::updateDisplayState): Deleted. * html/HTMLVideoElement.cpp: (WebCore::HTMLVideoElement::didAttachRenderers): No more updateDisplayState. (WebCore::HTMLVideoElement::parseAttribute): Ditto. Call updateFromElement when poster is removed. (WebCore::HTMLVideoElement::shouldDisplayPosterImage const): New. (WebCore::HTMLVideoElement::mediaPlayerFirstVideoFrameAvailable): New, update player and renderer if the poster isn't supposed to be visible. (WebCore::HTMLVideoElement::setDisplayMode): Deleted. (WebCore::HTMLVideoElement::updateDisplayState): Deleted. * html/HTMLVideoElement.h: * rendering/RenderVideo.cpp: (WebCore::RenderVideo::failedToLoadPosterImage const): New. * rendering/RenderVideo.h: * testing/Internals.cpp: (WebCore::Internals::elementShouldDisplayPosterImage const): * testing/Internals.h: * testing/Internals.idl: 2020-05-07 Jack Lee <shihchieh_lee@apple.com> In Document::willBeRemovedFromFrame, clear FrameSelection before Editor so the selection is removed. https://bugs.webkit.org/show_bug.cgi?id=211551 Reviewed by Geoffrey Garen. Covered by existing tests. * dom/Document.cpp: (WebCore::Document::willBeRemovedFromFrame): 2020-05-07 Antoine Quint <graouts@apple.com> [Web Animations] imported/w3c/web-platform-tests/web-animations/timing-model/timelines/update-and-send-events.html is a flaky failure https://bugs.webkit.org/show_bug.cgi?id=211232 <rdar://problem/62650227> Reviewed by Dean Jackson. The flakiness came from this porting of the test: animA.finished.then(() => { animB.cancel() }); animB.finished.then(() => { animA.cancel() }); Sometimes, animA and animB would finish in different frames even though they were designed to finish at the same time. If this happened, animA.finished would resolve and trigger animB.cancel, which then rejected animB.finished. This happened because animB was attached to a DocumentTimeline created by script which isn't the main DocumenTimeline accessed via document.timeline. Some curious code would handle syncing of the various timelines such that they would use a shared timebase. This was in DocumentTimeline::currentTime(): auto& mainDocumentTimeline = m_document->timeline(); if (&mainDocumentTimeline != this) { if (auto mainDocumentTimelineCurrentTime = mainDocumentTimeline.currentTime()) return *mainDocumentTimelineCurrentTime - m_originTime; return WTF::nullopt; } We now move the currentTime caching at the DocumentTimelinesController level which ensures all DocumentTimeline objects attached to a given Document use the exact same currentTime(). This prompted some overdue refactoring where also all the related animation suspension code is moved from DocumentTimeline up to DocumentTimelinesController. * animation/DocumentTimeline.cpp: (WebCore::DocumentTimeline::detachFromDocument): (WebCore::DocumentTimeline::suspendAnimations): (WebCore::DocumentTimeline::resumeAnimations): (WebCore::DocumentTimeline::animationsAreSuspended const): (WebCore::DocumentTimeline::currentTime): (WebCore::DocumentTimeline::scheduleAnimationResolution): (WebCore::DocumentTimeline::documentWillUpdateAnimationsAndSendEvents): (WebCore::DocumentTimeline::animationsAreSuspended): Deleted. (WebCore::DocumentTimeline::liveCurrentTime const): Deleted. (WebCore::DocumentTimeline::cacheCurrentTime): Deleted. (WebCore::DocumentTimeline::maybeClearCachedCurrentTime): Deleted. * animation/DocumentTimeline.h: * animation/DocumentTimelinesController.cpp: (WebCore::DocumentTimelinesController::detachFromDocument): (WebCore::DocumentTimelinesController::updateAnimationsAndSendEvents): (WebCore::DocumentTimelinesController::suspendAnimations): (WebCore::DocumentTimelinesController::resumeAnimations): (WebCore::DocumentTimelinesController::animationsAreSuspended const): (WebCore::DocumentTimelinesController::liveCurrentTime const): (WebCore::DocumentTimelinesController::currentTime): (WebCore::DocumentTimelinesController::cacheCurrentTime): (WebCore::DocumentTimelinesController::maybeClearCachedCurrentTime): * animation/DocumentTimelinesController.h: * dom/Document.cpp: (WebCore::Document::didBecomeCurrentDocumentInFrame): (WebCore::Document::resume): * dom/Document.h: * page/Frame.cpp: (WebCore::Frame::clearTimers): (WebCore::Frame::resumeActiveDOMObjectsAndAnimations): * page/Page.cpp: (WebCore::Page::setIsVisibleInternal): (WebCore::Page::hiddenPageCSSAnimationSuspensionStateChanged): * testing/Internals.cpp: (WebCore::Internals::animationsAreSuspended const): (WebCore::Internals::suspendAnimations const): (WebCore::Internals::resumeAnimations const): 2020-05-07 Simon Fraser <simon.fraser@apple.com> REGRESSION (r252161): Animation of box-shadow with border-radius set is flashy https://bugs.webkit.org/show_bug.cgi?id=211530 <rdar://problem/62570229> Reviewed by Zalan Bujtas. Drawing inset box shadows with spread was broken, and in some cases generated invalid rounded rects, causing inset shadows with border-radius to lose the radius. First, with split inlines, the spread was not getting removed from the excluded edges. Fix in the includeLogicalLeftEdge/includeLogicalRightEdge clauses, adding shiftXEdgeBy()/shiftYEdgeBy() helpers to LayoutRect to simplify logic. Second, when computing the rounded hole rect, we'd use the result of style.getRoundedInnerBorderFor() but that doesn't take shadow spread into account, so we'd build a rounded rect with a rect that accounted for spread, but radii computed without. That could result in unrenderable rounded rects. Fix by calling style.getRoundedInnerBorderFor() a second time if we have spread; this will fix up the radii for spread. Tests: fast/box-shadow/inset-box-shadow-fractional-radius.html fast/box-shadow/inset-shadow-split-inline.html fast/box-shadow/inset-spread-box-shadow-split-inline.html * platform/graphics/LayoutRect.h: (WebCore::LayoutRect::shiftXEdgeBy): (WebCore::LayoutRect::shiftYEdgeBy): * rendering/RenderBoxModelObject.cpp: (WebCore::RenderBoxModelObject::paintBoxShadow): 2020-05-07 Don Olmstead <don.olmstead@sony.com> Remove unused USE(REQUEST_ANIMATION_FRAME_DISPLAY_MONITOR) https://bugs.webkit.org/show_bug.cgi?id=211582 Reviewed by Fujii Hironori. After r261264 all ports implemented USE_REQUEST_ANIMATION_FRAME_DISPLAY_MONITOR. * page/ChromeClient.h: (WebCore::ChromeClient::createDisplayRefreshMonitor const): * page/Page.cpp: (WebCore::Page::windowScreenDidChange): * page/RenderingUpdateScheduler.cpp: (WebCore::RenderingUpdateScheduler::RenderingUpdateScheduler): (WebCore::RenderingUpdateScheduler::adjustRenderingUpdateFrequency): (WebCore::RenderingUpdateScheduler::scheduleTimedRenderingUpdate): (WebCore::RenderingUpdateScheduler::windowScreenDidChange): * page/RenderingUpdateScheduler.h: * platform/graphics/DisplayRefreshMonitor.cpp: * platform/graphics/DisplayRefreshMonitor.h: * platform/graphics/DisplayRefreshMonitorClient.cpp: * platform/graphics/DisplayRefreshMonitorClient.h: * platform/graphics/DisplayRefreshMonitorManager.cpp: * platform/graphics/DisplayRefreshMonitorManager.h: * platform/graphics/GraphicsLayerUpdater.cpp: (WebCore::GraphicsLayerUpdater::GraphicsLayerUpdater): (WebCore::GraphicsLayerUpdater::scheduleUpdate): (WebCore::GraphicsLayerUpdater::screenDidChange): (WebCore::GraphicsLayerUpdater::displayRefreshFired): (WebCore::GraphicsLayerUpdater::createDisplayRefreshMonitor const): * platform/graphics/GraphicsLayerUpdater.h: * platform/graphics/gtk/DisplayRefreshMonitorGtk.cpp: * platform/graphics/gtk/DisplayRefreshMonitorGtk.h: * platform/graphics/ios/DisplayRefreshMonitorIOS.h: * platform/graphics/ios/DisplayRefreshMonitorIOS.mm: * platform/graphics/mac/DisplayRefreshMonitorMac.cpp: * platform/graphics/mac/DisplayRefreshMonitorMac.h: * rendering/RenderLayerCompositor.cpp: (WebCore::RenderLayerCompositor::createDisplayRefreshMonitor const): * rendering/RenderLayerCompositor.h: 2020-05-07 Antoine Quint <graouts@apple.com> Add watchOS media controls assets https://bugs.webkit.org/show_bug.cgi?id=211508 Unreviewed. Cleaning up some stray logging. * WebCore.xcodeproj/project.pbxproj: 2020-05-07 Darin Adler <darin@apple.com> Add some missing null checks for DocumentLoader https://bugs.webkit.org/show_bug.cgi?id=211544 rdar://62843516 Reviewed by Anders Carlsson. * loader/FrameLoader.cpp: (WebCore::FrameLoader::transitionToCommitted): Use some more RefPtr, and check for null before calling DocumentLoader::responseMIMEType. Also removed a comment that made no sense, and an assertion that was there for no reason, left over from some point in history where it made sense. * loader/HistoryController.cpp: (WebCore::FrameLoader::HistoryController::updateForRedirectWithLockedBackForwardList): Add checks for null before calling urlForHistory and isClientRedirect. 2020-05-07 Darin Adler <darin@apple.com> Remove USE(INSERTION_UNDO_GROUPING) checks in macOS platform code https://bugs.webkit.org/show_bug.cgi?id=211525 Reviewed by Anders Carlsson. * editing/mac/TextUndoInsertionMarkupMac.h: Remove NSTextInputContext_Private.h usage. Moving to NSTextInputContextSPI.h instead. Also remove #pragma once since this is an Objective-C-only header, not for cross-platform use. * editing/mac/TextUndoInsertionMarkupMac.mm: Above, plus move NSUndoManager_Private.h to NSUndoManagerSPI.h. 2020-05-07 Sergio Villar Senin <svillar@igalia.com> [Conditional=] not working for operations in WebGLRenderingContextBase.idl https://bugs.webkit.org/show_bug.cgi?id=211528 Reviewed by Chris Dumez. When an IDL interface under a given Condition defined an operation with another Condition the generated source file should guard the operation with both the Condition from the interface and the one from the operation. This was working fine for sole interfaces but not for those who were inheriting from a base one, i.e., it was not working for supplemental interfaces. Added a new minimalistic binding test showcasing the problem. * bindings/scripts/CodeGenerator.pm: (ProcessSupplementalDependencies): Add Conditionals from both interface and operation. * bindings/scripts/test/JS/JSTestGlobalObject.cpp: (WebCore::jsTestGlobalObjectTestOperationConditionalConstructorGetter): Updated result. (WebCore::jsTestGlobalObjectTestOperationConditionalConstructor): Ditto. (WebCore::setJSTestGlobalObjectTestOperationConditionalConstructorSetter): Ditto. (WebCore::setJSTestGlobalObjectTestOperationConditionalConstructor): Ditto. * bindings/scripts/test/JS/JSTestOperationBase.cpp: Added. * bindings/scripts/test/JS/JSTestOperationBase.h: Added. * bindings/scripts/test/JS/JSTestOperationConditional.cpp: Added. * bindings/scripts/test/JS/JSTestOperationConditional.h: Added. * bindings/scripts/test/TestOperationBase.idl: Added. * bindings/scripts/test/TestOperationConditional.idl: Added. 2020-05-07 Antti Koivisto <antti@apple.com> [Wheel event region] Include listeners on Window https://bugs.webkit.org/show_bug.cgi?id=211577 Reviewed by Simon Fraser. Test: fast/scrolling/mac/wheel-event-listener-region-window.html * dom/EventTarget.h: * dom/Node.h: * style/StyleAdjuster.cpp: (WebCore::Style::Adjuster::computeEventListenerRegionTypes): Take EventTarget so this can be used with DOMWindow. * style/StyleAdjuster.h: * style/StyleResolveForDocument.cpp: (WebCore::Style::resolveForDocument): 2020-05-07 Simon Fraser <simon.fraser@apple.com> REGRESSION (r261056): [ Mac WK1 ] inspector/console/console-api.html is flaky crashing https://bugs.webkit.org/show_bug.cgi?id=211386 Reviewed by Darin Adler. Address additional review feedback. * platform/mac/ScrollbarThemeMac.mm: (WebCore::ScrollbarThemeMac::unregisterScrollbar): 2020-05-07 Zalan Bujtas <zalan@apple.com> [LFC[TFC] Adjust the table wrapper box style https://bugs.webkit.org/show_bug.cgi?id=211574 Reviewed by Antti Koivisto. The computed values of properties 'position', 'float', 'margin-*', 'top', 'right', 'bottom', and 'left' on the table element are used on the table wrapper box and not the table box; all other values of non-inheritable properties are used on the table box and not the table wrapper box. https://www.w3.org/TR/CSS22/tables.html#model Test: fast/layoutformattingcontext/table-simple-with-border.html * layout/layouttree/LayoutBox.cpp: (WebCore::Layout::Box::isBlockContainerBox const): * layout/layouttree/LayoutTreeBuilder.cpp: (WebCore::Layout::TreeBuilder::createLayoutBox): (WebCore::Layout::TreeBuilder::buildTableStructure): 2020-05-07 Andres Gonzalez <andresg_22@apple.com> Make debug build run in accessibility isolated tree mode = 1. https://bugs.webkit.org/show_bug.cgi?id=211567 Reviewed by Chris Fleizach. - Removed several unnecessary ASSERTs that prevent debug builds to run in isolated tree mode = 1, i.e., isolated tree mode on main thread. - AXIsolatedObject::children and updateBackingStore need to be executed on both threads. * accessibility/isolatedtree/AXIsolatedObject.cpp: (WebCore::AXIsolatedObject::detachRemoteParts): (WebCore::AXIsolatedObject::children): Need to update the children regardless of the thread in which it is invoked. Pending, must add a lock to prevent thread collision. (WebCore::AXIsolatedObject::updateBackingStore): Need to update the backing store regardless of the thread in whhich it is invoked. * accessibility/isolatedtree/AXIsolatedTree.cpp: (WebCore::AXIsolatedTree::generateSubtree): (WebCore::AXIsolatedTree::setRootNodeID): * accessibility/mac/WebAccessibilityObjectWrapperBase.mm: Enable isolated tree mode = 1. (-[WebAccessibilityObjectWrapperBase detach]): (-[WebAccessibilityObjectWrapperBase axBackingObject]): * accessibility/mac/WebAccessibilityObjectWrapperMac.mm: Use makeString instead of String concatenation as pointed out by Darin Adler in bug 210914. (-[WebAccessibilityObjectWrapper accessibilityAttributeValue:]): (-[WebAccessibilityObjectWrapper accessibilityAttributeValue:forParameter:]): (-[WebAccessibilityObjectWrapper accessibilityArrayAttributeValues:index:maxCount:]): 2020-05-07 Zalan Bujtas <zalan@apple.com> [LFC][TFC] Set section [top, left] used position. https://bugs.webkit.org/show_bug.cgi?id=211546 Reviewed by Antti Koivisto. Test: fast/layoutformattingcontext/table-simple-with-padding.html * layout/Verification.cpp: (WebCore::Layout::outputMismatchingBlockBoxInformationIfNeeded): * layout/tableformatting/TableFormattingContext.cpp: (WebCore::Layout::TableFormattingContext::layoutInFlowContent): (WebCore::Layout::TableFormattingContext::setUsedGeometryForSections): * layout/tableformatting/TableFormattingContext.h: 2020-05-07 Antti Koivisto <antti@apple.com> [Wheel event region] Include listeners on Document https://bugs.webkit.org/show_bug.cgi?id=211571 Reviewed by Simon Fraser. Test: fast/scrolling/mac/wheel-event-listener-region-document.html * style/StyleAdjuster.cpp: (WebCore::Style::Adjuster::computeEventListenerRegionTypes): (WebCore::Style::computeEventListenerRegionTypes): Deleted. Make public and take Node instead of Element. * style/StyleAdjuster.h: * style/StyleResolveForDocument.cpp: (WebCore::Style::resolveForDocument): Gather event region bits from Document too. 2020-05-07 Commit Queue <commit-queue@webkit.org> Unreviewed, reverting r260769. https://bugs.webkit.org/show_bug.cgi?id=211578 Introduced regressions related to sharing (Requested by perarne on #webkit). Reverted changeset: "[Cocoa] After r258891, r255119 can be reverted" https://bugs.webkit.org/show_bug.cgi?id=211083 https://trac.webkit.org/changeset/260769 2020-05-07 Darin Adler <darin@apple.com> Fix assertions seen when trying to draw an absurdly large shadow https://bugs.webkit.org/show_bug.cgi?id=211541 rdar://62843377 Reviewed by Geoffrey Garen. * platform/graphics/IntSize.h: (WebCore::IntSize::unclampedArea const): Return uint64_t instead of size_t. Two 32-bit positive integers multiplied fit in a 64-bit integer, but there's no guarantee they fit in a "pointer sized" integer. * platform/graphics/ShadowBlur.cpp: (WebCore::ShadowBlur::drawRectShadow): When comparing an IntSize area with a FloatSize area, avoid checked overflow by using IntSize::unclampedArea, which returns something we can compare with a float. Using IntSize::area meant we'd intentionally crash the process if the area number doesn't fit in a 32-bit int, which is not important or helpful. (WebCore::ShadowBlur::drawRectShadowWithTiling): Make sure ScratchBuffer::scheduleScratchBufferPurge is always called after ScratchBuffer::getScratchBuffer, even it returns nullptr. An alternative would have been to change the logic inside getScratchBuffer, but this seems easier to get right, and no need to optimize the failure case. (WebCore::ShadowBlur::drawInsetShadowWithTiling): Ditto. 2020-05-07 Youenn Fablet <youenn@apple.com> Fix potential threading issue in AudioMediaStreamTrackRendererCocoa::render https://bugs.webkit.org/show_bug.cgi?id=211560 Reviewed by Eric Carlson. When the audio description is updated, the audio renderer is creating a new AudioSampleDataSource. The refing of the source in the render method is not sufficient to protect agains the change. For that purpose, we keep a separate reference to the source that is only used in the render method/render thread. We add a boolean that tells the render method whether to update its source reference. As long as the source reference is not updated, no new source will be created n the method processing the pushed samples. * platform/mediastream/mac/AudioMediaStreamTrackRendererCocoa.cpp: (WebCore::AudioMediaStreamTrackRendererCocoa::pushSamples): (WebCore::AudioMediaStreamTrackRendererCocoa::render): * platform/mediastream/mac/AudioMediaStreamTrackRendererCocoa.h: 2020-05-07 Andres Gonzalez <andresg_22@apple.com> Fix for crash in AXIsolatedObject::identifierAttribute. https://bugs.webkit.org/show_bug.cgi?id=211565 Reviewed by Chris Fleizach. Covered by existing tests. When adding the identifierAttribute property to the AXIsolatedObject's properties map, must make an isolatedCopy of it in order to retrieve it on the secondary thread. * accessibility/isolatedtree/AXIsolatedObject.cpp: (WebCore::AXIsolatedObject::initializeAttributeData): 2020-05-07 Antti Koivisto <antti@apple.com> Add basic support for generating accurate wheel event listener region https://bugs.webkit.org/show_bug.cgi?id=211512 Reviewed by Simon Fraser. Add fake properties for wheel event listeners to RenderStyle and use them to generate regions in EventRegion. There is a separate region for non-passive wheel event listeners (that will require synchronous handling). The generated regions are not used for anything in this patch. Style is not yet invalided on event listener additions and removals. Test: fast/scrolling/mac/wheel-event-listener-region-basic.html * dom/Node.h: * rendering/EventRegion.cpp: (WebCore::EventRegion::unite): (WebCore::EventRegion::uniteEventListeners): (WebCore::EventRegion::dump const): * rendering/EventRegion.h: * rendering/RenderLayerBacking.cpp: (WebCore::RenderLayerBacking::updateEventRegion): * rendering/style/RenderStyle.h: (WebCore::RenderStyle::eventListenerRegionTypes const): (WebCore::RenderStyle::setEventListenerRegionTypes): * rendering/style/RenderStyleConstants.h: * rendering/style/StyleRareInheritedData.cpp: (WebCore::StyleRareInheritedData::StyleRareInheritedData): (WebCore::StyleRareInheritedData::operator== const): * rendering/style/StyleRareInheritedData.h: * style/StyleAdjuster.cpp: (WebCore::Style::computeEventListenerRegionTypes): (WebCore::Style::Adjuster::adjust const): 2020-05-07 Youenn Fablet <youenn@apple.com> Sending WebRTC network packets should not go through the main thread https://bugs.webkit.org/show_bug.cgi?id=211291 Reviewed by Eric Carlson. Covered by existing tests. * Modules/mediastream/PeerConnectionBackend.cpp: (WebCore::PeerConnectionBackend::filterSDP const): Fix a case where the SDP would be badly formatted if we do not have yet a MDNS name for the corresponding IP address. Small refactoring to use early returns. * platform/mediastream/libwebrtc/LibWebRTCProvider.cpp: (WebCore::LibWebRTCProvider::getStaticFactoryAndThreads): * platform/mediastream/libwebrtc/LibWebRTCProvider.h: Add the ability for WebKit LibWebRTCProvider to do some processing on creation of the RTC threads. 2020-05-06 Sergio Villar Senin <svillar@igalia.com> [WebXR] Implement simulateUserActivation() https://bugs.webkit.org/show_bug.cgi?id=211516 Reviewed by Youenn Fablet. simulateUserActivation() is the method used by the WebXR Test API to mock a user activation and thus let WebXR API think that the user is behind the request that is going to be made in the function passed as argument. No new tests added as the imported WebXR web-platform-tests already make use of this API. * testing/WebXRTest.cpp: (WebCore::WebXRTest::simulateUserActivation): Implemented. * testing/WebXRTest.h: Added Document parameter. * testing/WebXRTest.idl: Call with Document. * testing/XRSimulateUserActivationFunction.h: Removed function params. * testing/XRSimulateUserActivationFunction.idl: Ditto. 2020-05-06 Yoshiaki Jitsukawa <yoshiaki.jitsukawa@sony.com> and Fujii Hironori <Hironori.Fujii@sony.com> [Win] Implement DisplayRefreshMonitor by using RunLoop::Timer https://bugs.webkit.org/show_bug.cgi?id=211431 Reviewed by Don Olmstead. * PlatformWin.cmake: * platform/graphics/DisplayRefreshMonitor.cpp: (WebCore::DisplayRefreshMonitor::createDefaultDisplayRefreshMonitor): * platform/graphics/win/DisplayRefreshMonitorWin.cpp: Added. (WebCore::DisplayRefreshMonitorWin::create): (WebCore::DisplayRefreshMonitorWin::DisplayRefreshMonitorWin): (WebCore::DisplayRefreshMonitorWin::requestRefreshCallback): (WebCore::DisplayRefreshMonitorWin::displayLinkFired): * platform/graphics/win/DisplayRefreshMonitorWin.h: Added. 2020-05-06 Zalan Bujtas <zalan@apple.com> [ContentObservation] Shutterstock search bar is not activated on the first tap https://bugs.webkit.org/show_bug.cgi?id=211529 <rdar://problem/58843932> Reviewed by Simon Fraser. * page/Quirks.cpp: (WebCore::Quirks::shouldIgnoreContentObservationForSyntheticClick const): * page/Quirks.h: 2020-05-06 Jack Lee <shihchieh_lee@apple.com> Nullptr crash in indentOutdentCommand::formatRange with asynchronous commands: indent and insert list. https://bugs.webkit.org/show_bug.cgi?id=211466 <rdar://problem/62845430> Reviewed by Geoffrey Garen. Check for null outerBlock returned by splitTreeToNode and bail out. Test: fast/editing/indent-then-insertUL-crash.html * editing/IndentOutdentCommand.cpp: (WebCore::IndentOutdentCommand::indentIntoBlockquote): 2020-05-06 Darin Adler <darin@apple.com> Make a helper for the pattern of ICU functions that may need to be called twice to populate a buffer https://bugs.webkit.org/show_bug.cgi?id=211499 Reviewed by Ross Kirsling. * editing/TextIterator.cpp: (WebCore::normalizeCharacters): Use callBufferProducingFunction. 2020-05-06 Simon Fraser <simon.fraser@apple.com> REGRESSION (r261056): [ Mac WK1 ] inspector/console/console-api.html is flaky crashing https://bugs.webkit.org/show_bug.cgi?id=211386 Reviewed by Tim Horton. This bug was caused by the failure to clear the delegate on an NSScrollerImp when, for testing, we flip between the native scrollbar theme, and the mock scrollbar theme. The crux of the fix is to have ScrollAnimatorMac's scrollerImpForScrollbar() call a static function on ScrollbarThemeMac to get the painters, rather than going through the possibly-null ScrollbarThemeMac instance. A belt-and-braces fix in ScrollbarThemeMac::unregisterScrollbar() always clears the delegate on the NSScrollerImp when unregistering a scrollbar. Finally, modernize code in various places. * platform/mac/ScrollAnimatorMac.mm: (WebCore::scrollerImpForScrollbar): (WebCore::ScrollAnimatorMac::updateScrollerStyle): * platform/mac/ScrollbarThemeMac.h: * platform/mac/ScrollbarThemeMac.mm: (WebCore::scrollbarMap): (+[WebScrollbarPrefsObserver appearancePrefsChanged:]): (WebCore::ScrollbarThemeMac::registerScrollbar): (WebCore::ScrollbarThemeMac::unregisterScrollbar): (WebCore::ScrollbarThemeMac::setNewPainterForScrollbar): (WebCore::ScrollbarThemeMac::painterForScrollbar): (WebCore::ScrollbarThemeMac::hasThumb): (WebCore::ScrollbarThemeMac::minimumThumbLength): (WebCore::ScrollbarThemeMac::updateEnabledState): (WebCore::ScrollbarThemeMac::paint): 2020-05-06 Jack Lee <shihchieh_lee@apple.com> Nullptr crash in InsertListCommand::doApply with user-select:none elements https://bugs.webkit.org/show_bug.cgi?id=211534 <rdar://problem/62898521> Reviewed by Geoffrey Garen. Check for empty position in InsertListCommand::doApply when searching for the start of last paragraph in the selected range. Skip listifying individual paragraphs in the range. Test: editing/inserting/insert-list-user-select-none-crash.html * editing/InsertListCommand.cpp: (WebCore::InsertListCommand::doApply): 2020-05-06 Ryan Haddad <ryanhaddad@apple.com> Unreviewed, reverting r261239. Caused fast/events/wheel-event-outside-body.html to assert on macOS WK1 Reverted changeset: "Add basic support for generating accurate wheel event listener region" https://bugs.webkit.org/show_bug.cgi?id=211512 https://trac.webkit.org/changeset/261239 2020-05-06 Chris Dumez <cdumez@apple.com> REGRESSION (r260684): Reader background is lost after multitasking https://bugs.webkit.org/show_bug.cgi?id=211533 <rdar://problem/62941837> Unreviewed, revert r260684 due to regression. * dom/EventTarget.cpp: (WebCore::EventTarget::fireEventListeners): * page/FrameView.cpp: (WebCore::FrameView::sendResizeEventIfNeeded): * page/Page.h: (WebCore::Page::shouldFireResizeEvents const): (WebCore::Page::setShouldFireResizeEvents): 2020-05-06 Chris Fleizach <cfleizach@apple.com> AX: Implement accessibility of HTML 5.1 Drag & Drop https://bugs.webkit.org/show_bug.cgi?id=211415 <rdar://problem/22695531> Reviewed by Joanmarie Diggs. Support HTML5 drag and drop. Support dropzone attribute. Add new notifications for VoiceOver to consume. It appears that most of the dragging tests are skipped because of eventSender issues. I think this test could do a little more if those issues were resolved. Specifically, not all the notifications are seen that are expected. Test: accessibility/mac/draggable.html * accessibility/AXObjectCache.h: * accessibility/AccessibilityObject.cpp: (WebCore::AccessibilityObject::supportsARIAAttributes const): (WebCore::AccessibilityObject::isAXHidden const): * accessibility/AccessibilityObject.h: * accessibility/AccessibilityObjectInterface.h: * accessibility/AccessibilityRenderObject.cpp: (WebCore::AccessibilityRenderObject::supportsDropping const): (WebCore::AccessibilityRenderObject::supportsDragging const): (WebCore::AccessibilityRenderObject::isGrabbed): (WebCore::AccessibilityRenderObject::determineDropEffects): (WebCore::AccessibilityRenderObject::supportsARIADropping const): Deleted. (WebCore::AccessibilityRenderObject::supportsARIADragging const): Deleted. (WebCore::AccessibilityRenderObject::isARIAGrabbed): Deleted. (WebCore::AccessibilityRenderObject::determineARIADropEffects): Deleted. * accessibility/AccessibilityRenderObject.h: * accessibility/isolatedtree/AXIsolatedObject.cpp: (WebCore::AXIsolatedObject::initializeAttributeData): * accessibility/isolatedtree/AXIsolatedObject.h: * accessibility/mac/AXObjectCacheMac.mm: (WebCore::AXObjectCache::postPlatformNotification): * accessibility/mac/WebAccessibilityObjectWrapperMac.mm: (-[WebAccessibilityObjectWrapper additionalAccessibilityAttributeNames]): (-[WebAccessibilityObjectWrapper accessibilityAttributeValue:]): * html/HTMLAttributeNames.in: * page/EventHandler.cpp: (WebCore::EventHandler::dispatchDragEvent): (WebCore::EventHandler::draggingElement const): * page/EventHandler.h: 2020-05-06 Wenson Hsieh <wenson_hsieh@apple.com> Cut and paste from Google Doc to Notes in several (non-Latin) languages doesn't work https://bugs.webkit.org/show_bug.cgi?id=211498 <rdar://problem/56675345> Reviewed by Darin Adler. When copying text in Google Docs, the page uses `DataTransfer.setData` to write text/html data to the system pasteboard. This markup string includes a meta tag with `charset="utf-8"`, indicating that the HTML string that was copied should be interpreted as UTF-8 data. However, before we write this data to the system pasteboard, we first sanitize it by loading it in a separate page, and then build the final sanitized markup string to write by iterating over only visible content in the main document of this page. Importantly, this last step skips over the meta element containing the charset. Later, when pasting in Notes or TextEdit, both apps use `-[NSAttributedString initWithData:...:]` to convert the HTML data on the pasteboard into an NSAttributedString. This takes the NSPasteboard's HTML data (a blob of `NSData`) and synchronously loads it in a new legacy WebKit view by calling `-[WebFrame loadData:MIMEType:textEncodingName:baseURL:]`, passing in `nil` as the text encoding name. Since WebKit is only given a blob of data and no particular encoding, we fall back to default Latin-1 encoding, which produces gibberish for CJK text. To fix this, we automatically insert a `<meta charset="utf-8">` tag when writing HTML to the pasteboard, if the sanitized markup contains non-ASCII characters. Test: CopyHTML.SanitizationPreservesCharacterSet * Modules/async-clipboard/ClipboardItemBindingsDataSource.cpp: (WebCore::ClipboardItemBindingsDataSource::ClipboardItemTypeLoader::sanitizeDataIfNeeded): Pass in AddMetaCharsetIfNeeded::Yes. * dom/DataTransfer.cpp: (WebCore::DataTransfer::setDataFromItemList): Pass in AddMetaCharsetIfNeeded::Yes here too. * editing/cocoa/WebContentReaderCocoa.mm: (WebCore::sanitizeMarkupWithArchive): (WebCore::WebContentReader::readHTML): (WebCore::WebContentMarkupReader::readHTML): * editing/markup.cpp: (WebCore::sanitizeMarkup): Add a new enum so that we only add the extra meta tag when sanitizing content that is being written to the system pasteboard through one of the clipboard DOM APIs. (WebCore::sanitizedMarkupForFragmentInDocument): * editing/markup.h: 2020-05-06 Tim Horton <timothy_horton@apple.com> REGRESSION (r260753): Frequent crashes under TextIndicator's estimatedTextColorsForRange https://bugs.webkit.org/show_bug.cgi?id=211523 <rdar://problem/62860203> Reviewed by Darin Adler. * page/TextIndicator.cpp: (WebCore::estimatedTextColorsForRange): TextIterator's node() getter can return null. r260753 accidentally refactored away the null check. 2020-05-06 John Wilander <wilander@apple.com> Exempt app-bound domains from ITP's website data deletion and third-party cookie blocking between themselves https://bugs.webkit.org/show_bug.cgi?id=210674 <rdar://problem/61950767> Reviewed by Chris Dumez. This change adds functionality to NetworkStorageSession to allow it to exempt app-bound domains from third-party cookie blocking. Tests: http/tests/resourceLoadStatistics/exemptDomains/app-bound-domains-exempt-from-cookie-blocking-between-each-other.html http/tests/resourceLoadStatistics/exemptDomains/app-bound-domains-exempt-from-website-data-deletion-database.html http/tests/resourceLoadStatistics/exemptDomains/app-bound-domains-exempt-from-website-data-deletion.html * platform/network/NetworkStorageSession.cpp: (WebCore::NetworkStorageSession::shouldBlockCookies const): (WebCore::NetworkStorageSession::shouldExemptDomainPairFromThirdPartyCookieBlocking const): (WebCore::NetworkStorageSession::setAppBoundDomains): (WebCore::NetworkStorageSession::resetAppBoundDomains): * platform/network/NetworkStorageSession.h: 2020-05-06 Antti Koivisto <antti@apple.com> Add basic support for generating accurate wheel event listener region https://bugs.webkit.org/show_bug.cgi?id=211512 Reviewed by Simon Fraser. Add fake properties for wheel event listeners to RenderStyle and use them to generate regions in EventRegion. There is a separate region for non-passive wheel event listeners (that will require synchronous handling). The generated regions are not used for anything in this patch. Style is not yet invalided on event listener additions and removals. Test: fast/scrolling/mac/wheel-event-listener-region-basic.html * dom/Node.h: * rendering/EventRegion.cpp: (WebCore::EventRegion::unite): (WebCore::EventRegion::uniteEventListeners): (WebCore::EventRegion::dump const): * rendering/EventRegion.h: * rendering/RenderLayerBacking.cpp: (WebCore::RenderLayerBacking::updateEventRegion): * rendering/style/RenderStyle.h: (WebCore::RenderStyle::eventListenerRegionTypes const): (WebCore::RenderStyle::setEventListenerRegionTypes): * rendering/style/RenderStyleConstants.h: * rendering/style/StyleRareInheritedData.cpp: (WebCore::StyleRareInheritedData::StyleRareInheritedData): (WebCore::StyleRareInheritedData::operator== const): * rendering/style/StyleRareInheritedData.h: * style/StyleAdjuster.cpp: (WebCore::Style::computeEventListenerRegionTypes): (WebCore::Style::Adjuster::adjust const): 2020-05-06 Darin Adler <darin@apple.com> Remove now-unneeded USE(GRAMMAR_CHECKING) https://bugs.webkit.org/show_bug.cgi?id=211452 Reviewed by Anders Carlsson. * editing/Editor.cpp: (WebCore::Editor::advanceToNextMisspelling): Remove USE(GRAMMAR_CHECKING). (WebCore::Editor::isSelectionUngrammatical): Ditto. (WebCore::Editor::markMisspellingsOrBadGrammar): Ditto. (WebCore::Editor::markBadGrammar): Ditto. * editing/TextCheckingHelper.cpp: (WebCore::TextCheckingHelper::markAllBadGrammar): Ditto. (WebCore::checkTextOfParagraph): Ditto. Also correct misspelling of the word "misspelling". * editing/TextCheckingHelper.h: Ditto. 2020-05-06 Devin Rousso <drousso@apple.com> ASSERT_WITH_MESSAGE(m_isOwnedByMainThread == isMainThread()) when web inspecting https://bugs.webkit.org/show_bug.cgi?id=203638 <rdar://problem/56761893> Reviewed by Brian Burg. Mark the `InspectorEnvironment::executionStopwatch` abstract function as `const` and have it return a `Stopwatch&` instead of a `RefPtr<Stopwatch>&` as callers assume that it exists. By not using a `RefPtr`, an additional `copyRef` can be avoided. * inspector/InspectorController.h: * inspector/InspectorController.cpp: (WebCore::InspectorController::executionStopwatch const): Added. (WebCore::InspectorController::executionStopwatch): Deleted. * inspector/WorkerInspectorController.h: (WebCore::WorkerInspectorController::executionStopwatch const): Added. (WebCore::WorkerInspectorController::executionStopwatch): Deleted. * inspector/agents/InspectorAnimationAgent.cpp: (WebCore::InspectorAnimationAgent::startTracking): (WebCore::InspectorAnimationAgent::stopTracking): (WebCore::InspectorAnimationAgent::willApplyKeyframeEffect): (WebCore::InspectorAnimationAgent::stopTrackingDeclarativeAnimation): * inspector/agents/InspectorCPUProfilerAgent.cpp: (WebCore::InspectorCPUProfilerAgent::startTracking): (WebCore::InspectorCPUProfilerAgent::stopTracking): (WebCore::InspectorCPUProfilerAgent::collectSample): * inspector/agents/InspectorDOMAgent.cpp: (WebCore::InspectorDOMAgent::mediaMetricsTimerFired): * inspector/agents/InspectorMemoryAgent.cpp: (WebCore::InspectorMemoryAgent::startTracking): (WebCore::InspectorMemoryAgent::stopTracking): (WebCore::InspectorMemoryAgent::didHandleMemoryPressure): (WebCore::InspectorMemoryAgent::collectSample): * inspector/agents/InspectorNetworkAgent.cpp: (WebCore::InspectorNetworkAgent::buildObjectForTiming): (WebCore::InspectorNetworkAgent::timestamp): (WebCore::InspectorNetworkAgent::didFinishLoading): * inspector/agents/InspectorPageAgent.cpp: (WebCore::InspectorPageAgent::enable): (WebCore::InspectorPageAgent::timestamp): * inspector/agents/InspectorTimelineAgent.cpp: (WebCore::InspectorTimelineAgent::timestamp): 2020-05-06 Darin Adler <darin@apple.com> Eliminate checks of USE(DICTATION_ALTERNATIVES) in Cocoa-specific code https://bugs.webkit.org/show_bug.cgi?id=211460 Reviewed by Anders Carlsson. * editing/cocoa/AlternativeTextContextController.h: Remove USE(DICTATION_ALTERNATIVES). Also remove unnecessary use of RetainPtr and add a FIXME. Also remove #pragma once since this header is only imported from Objective-C++ sources. * editing/cocoa/AlternativeTextContextController.mm: Ditto. * editing/cocoa/AlternativeTextUIController.h: Ditto. * editing/cocoa/AlternativeTextUIController.mm: Ditto. * editing/mac/TextAlternativeWithRange.h: Ditto. * editing/mac/TextAlternativeWithRange.mm: Ditto. 2020-05-06 Simon Fraser <simon.fraser@apple.com> Factor EventHandler code that sends mouseEnteredContentArea/mouseExitedContentArea into its own function https://bugs.webkit.org/show_bug.cgi?id=211494 Reviewed by Antti Koivisto. mouseEnteredContentArea/mouseEnteredContentArea are used only to notify overlay scrollbars of state changes. Factor the code that calls these functions into a separate EventHandler function, and refactor it for clarity, now we know that both lastElementUnderMouse and elementUnderMouse must belong to this EventHandler's Frame's Document. * page/EventHandler.cpp: (WebCore::EventHandler::updateMouseEventTargetNode): (WebCore::EventHandler::notifyScrollableAreasOfMouseEnterExit): * page/EventHandler.h: 2020-05-06 Zalan Bujtas <zalan@apple.com> [LFC] BlockFormattingContext::computeHeightAndMargin should special case the table box https://bugs.webkit.org/show_bug.cgi?id=211493 Reviewed by Antti Koivisto. By the time we get to BlockFormattingContext::computeHeightAndMargin(), the used valued for the table height is already been computed. (Table box height is mostly content driven, and both the computed height and the min/max pair are taken into account while we are laying out the table content). * layout/blockformatting/BlockFormattingContext.cpp: (WebCore::Layout::BlockFormattingContext::computeHeightAndMargin): * layout/blockformatting/BlockFormattingContextGeometry.cpp: (WebCore::Layout::BlockFormattingContext::Geometry::inFlowHeightAndMargin): 2020-05-06 Antoine Quint <graouts@apple.com> Add watchOS media controls assets https://bugs.webkit.org/show_bug.cgi?id=211508 <rdar://problem/62926565> Reviewed by Eric Carlson. * Modules/modern-media-controls/images/watchOS/ActivityIndicatorSpriteCompact@2x.png: Added. * Modules/modern-media-controls/images/watchOS/InvalidCompact.pdf: Added. * Modules/modern-media-controls/images/watchOS/PlayCompact.pdf: Added. * WebCore.xcodeproj/project.pbxproj: 2020-05-06 Zalan Bujtas <zalan@apple.com> [LFC][BFC] FormattingContext::ConstraintsForInFlowContent should include the computed value of height https://bugs.webkit.org/show_bug.cgi?id=211487 Reviewed by Antti Koivisto. When the formatting context root has fixed height, the computed value should be passed in to the formatting context layout as the available vertical space. * layout/FormattingContextGeometry.cpp: (WebCore::Layout::FormattingContext::Geometry::constraintsForInFlowContent): * layout/tableformatting/TableFormattingContext.cpp: (WebCore::Layout::TableFormattingContext::computeAndDistributeExtraVerticalSpace): 2020-04-29 Sergio Villar Senin <svillar@igalia.com> [WebXR] Implement isSessionSupported() https://bugs.webkit.org/show_bug.cgi?id=211187 Reviewed by Dean Jackson. The isSessionSupported() method queries if a given mode may be supported by the UA and device capabilities. Apart from the needed machinery in the webxr Module we're adding an OpenXR implementation of the enumerateImmersiveXRDevices() method required by isSessionSupported(). The method is not completely implemented as it lacks a few action at its very end, like firing events. They'll be implemented in follow up patches as they require additional changes. Some OpenXR runtimes as Monado always enumerate at least one device even if none is connected. This dummy device might interfere with tests execution (as there will be more devices than expected) so we're adding a testMode to WebXRSystem which does not query platform for existing devices. Added expected results and unskipped some WPT that are now passing. * Modules/webxr/WebXRSystem.cpp: (WebCore::WebXRSystem::ensureImmersiveXRDeviceIsSelected): Asks platform code for the list of attached XR devices and properly set the active immersive device if any. (WebCore::WebXRSystem::isSessionSupported): Partially implemented. (WebCore::WebXRSystem::registerSimulatedXRDeviceForTesting): Set the passed in mock device as either the current active immersive or inline device. (WebCore::WebXRSystem::unregisterSimulatedXRDeviceForTesting): Removes the passed in mock device from the list of immersive devices. * Modules/webxr/WebXRSystem.h: * html/FeaturePolicy.cpp: (WebCore::policyTypeName): Handle XRSpatialTracking. (WebCore::FeaturePolicy::parse): Parse "xr-spatial-tracking". (WebCore::FeaturePolicy::allows const): Handle XRSpatialTracking. * html/FeaturePolicy.h: Added XRSpatialTracking. * platform/xr/PlatformXR.h: (PlatformXR::Instance::immersiveXRDevices const): Keep a list of immersive devices. * platform/xr/openxr/PlatformXR.cpp: (PlatformXR::Instance::Impl::collectSupportedSessionModes): Gather supported session modes for a given device from OpenXR. (PlatformXR::Instance::enumerateImmersiveXRDevices): Collect devices from OpenXR. We are currently asking for HMD devices. 2020-05-06 Antoine Quint <graouts@apple.com> [Web Animations] Coordinate "update animations and send events" procedure across multiple timelines https://bugs.webkit.org/show_bug.cgi?id=202109 Unreviewed. Remove an unused function. * animation/AnimationTimeline.h: (WebCore::AnimationTimeline::allAnimations const): Deleted. 2020-05-05 Antoine Quint <graouts@apple.com> Fix animation ordering to make imported/w3c/web-platform-tests/css/css-animations/Element-getAnimations.tentative.html pass https://bugs.webkit.org/show_bug.cgi?id=211468 <rdar://problem/62732578> Reviewed by David Kilzer. The "Animation composite order" section of the CSS Animations Level 2 specification (https://drafts.csswg.org/css-animations-2/#animation-composite-order) defines the relative composite order of animations. We bake this into compareAnimationsByCompositeOrder(), but this function would not yield consistent results if it is called in a non-stable sort, because if both CSSAnimation objects passed to this function have the same backing Animation object, they would not return the same value if passed in a different order. The Web Animations spec always ensures that procedures that sort using the composite order are called as part of a stable sort. So we change all call sites to use std::stable_sort and add an assertion in case we have two CSSAnimation objects with the same backing Animation objects to catch cases like this in the future. Finally, since we already know only relevant animations can find their way into the output of Document::getAnimations(), we also ensure we iterate over m_animations (which holds only relevant animations) rather than m_allAnimations (which may not). * animation/DocumentTimeline.cpp: (WebCore::DocumentTimeline::getAnimations const): * animation/KeyframeEffectStack.cpp: (WebCore::KeyframeEffectStack::ensureEffectsAreSorted): * animation/WebAnimationUtilities.cpp: (WebCore::compareAnimationsByCompositeOrder): 2020-05-05 Simon Fraser <simon.fraser@apple.com> EventHandler::dispatchMouseEvent() cleanup https://bugs.webkit.org/show_bug.cgi?id=211491 Reviewed by Zalan Bujtas. Replace the last bool argument with FireMouseOverOut, and remove the "cancelable" argument that was unused. * page/EventHandler.cpp: (WebCore::EventHandler::handleMousePressEvent): (WebCore::EventHandler::handleMouseDoubleClickEvent): (WebCore::EventHandler::handleMouseMoveEvent): (WebCore::EventHandler::handleMouseReleaseEvent): (WebCore::EventHandler::handleMouseForceEvent): (WebCore::EventHandler::dispatchMouseEvent): (WebCore::EventHandler::sendContextMenuEvent): * page/EventHandler.h: 2020-05-05 Rob Buis <rbuis@igalia.com> Fix setting host on URL when no port is specified https://bugs.webkit.org/show_bug.cgi?id=211453 Reviewed by Darin Adler. Behavior matches Firefox and Chrome. Test: web-platform-tests/url/url-setters.html * html/URLDecomposition.cpp: (WebCore::URLDecomposition::setHost): 2020-05-05 Simon Fraser <simon.fraser@apple.com> Minor EventHandler and test cleanup https://bugs.webkit.org/show_bug.cgi?id=211475 Reviewed by Zalan Bujtas. Now that we assert that m_elementUnderMouse and m_lastElementUnderMouse are either null or in this EventHandler's document, we can remove the document comparisons (but this code is probably wrong as well). Fix enclosingScrollableArea(), which would return any RenderLayer, but should only return scrollable ones, and should only return scrollable RenderListBoxes. * page/EventHandler.cpp: (WebCore::enclosingScrollableArea): (WebCore::EventHandler::updateMouseEventTargetNode): 2020-05-05 David Kilzer <ddkilzer@apple.com> Fix deprecated NSGraphicsContext methods using 'graphicsPort' <https://webkit.org/b/211481> Reviewed by Darin Adler. - Replace uses of -graphicsPort with -CGContext. - Replace uses of -graphicsContextWithGraphicsPort:flipped: with -graphicsContextWithCGContext:flipped:. - Remove ALLOW_DEPRECATED_DECLARATIONS_{BEGIN,END} if possible. * platform/cocoa/DragImageCocoa.mm: (WebCore::createDragImageForLink): * platform/graphics/ca/cocoa/PlatformCALayerCocoa.mm: (WebCore::PlatformCALayer::drawLayerContents): * platform/mac/ThemeMac.mm: (WebCore::drawCellFocusRingWithFrameAtTime): * platform/mac/WidgetMac.mm: (WebCore::Widget::paint): 2020-05-05 Pinki Gyanchandani <pgyanchandani@apple.com> Crash in match_constness<WebCore::CSSValue, WebCore::CSSPrimitiveValue>::type& WTF::downcast<WebCore::CSSPrimitiveValue, WebCore::CSSValue> -- ASAN https://bugs.webkit.org/show_bug.cgi?id=211479 Reviewed by Geoffrey Garen. Added check to downcast CSSValue to CSSPrimitiveValue, only if valid CSSPrimitveValue is associated with the property. New test would be added to Internal repository. * css/StyleProperties.cpp: (WebCore::StyleProperties::pageBreakPropertyValue const): 2020-05-05 Peng Liu <peng.liu6@apple.com> Update WebKitTestRunner to support running multiple video fullscreen and Picture-in-Picture tests simultaneously https://bugs.webkit.org/show_bug.cgi?id=203723 Reviewed by Jer Noble. Test: media/video-presentation-mode.html Add a flag MockVideoPresentationModeEnabled to "internals" for video fullscreen and picture-in-picture tests. * page/ChromeClient.h: (WebCore::ChromeClient::setMockVideoPresentationModeEnabled): * testing/Internals.cpp: (WebCore::Internals::setMockVideoPresentationModeEnabled): * testing/Internals.h: * testing/Internals.idl: 2020-05-05 Darin Adler <darin@apple.com> Remove HAVE(AVFOUNDATION_LEGIBLE_OUTPUT_SUPPORT) https://bugs.webkit.org/show_bug.cgi?id=211461 Reviewed by Eric Carlson. * PlatformMac.cmake: Removed InbandTextTrackPrivateLegacyAVFObjC.mm. * SourcesCocoa.txt: Ditto. * WebCore.xcodeproj/project.pbxproj: Ditto, also the header. * platform/graphics/avfoundation/objc/InbandTextTrackPrivateLegacyAVFObjC.h: Removed. * platform/graphics/avfoundation/objc/InbandTextTrackPrivateLegacyAVFObjC.mm: Removed. * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h: Removed HAVE(AVFOUNDATION_LEGIBLE_OUTPUT_SUPPORT). Also moved data member initialization to the class definition, made more things private and final, made outputObscuredDueToInsufficientExternalProtectionChanged unconditional, changed friend class MediaPlayerFactoryAVFoundationObjC into member class MediaPlayerPrivateAVFoundationObjC::Factory, removed unused removeSession function, and tweaked conditionals. * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm: Removed import of InbandTextTrackPrivateLegacyAVFObjC.h. Moved data member initialization to the class definition. Moved include of BinarySemaphore here. 2020-05-05 Simon Fraser <simon.fraser@apple.com> Assert that EventHandler only tracks event target nodes in its own document https://bugs.webkit.org/show_bug.cgi?id=211462 Reviewed by Zalan Bujtas. EventHandler is per-Frame, so should not track Nodes from different documents. However, it did so by mistake if an event handler moved a node between documents. * page/EventHandler.cpp: (WebCore::EventHandler::updateMouseEventTargetNode): * rendering/HitTestResult.cpp: (WebCore::HitTestResult::targetNode const): 2020-05-05 Antti Koivisto <antti@apple.com> Factor RenderLayerBacking::updateEventRegion skip conditions into a lambda https://bugs.webkit.org/show_bug.cgi?id=211450 Reviewed by Simon Fraser. * rendering/RenderLayerBacking.cpp: (WebCore::RenderLayerBacking::updateEventRegion): 2020-05-05 Chris Dumez <cdumez@apple.com> Drop code path using the legacy CFNetwork cookie change notification SPI https://bugs.webkit.org/show_bug.cgi?id=211411 <rdar://problem/62869148> Reviewed by John Wilander. * platform/network/cocoa/NetworkStorageSessionCocoa.mm: (WebCore::NetworkStorageSession::registerCookieChangeListenersIfNecessary): (WebCore::NetworkStorageSession::unregisterCookieChangeListenersIfNecessary): (WebCore::NetworkStorageSession::supportsCookieChangeListenerAPI const): 2020-05-05 Timothy Horton <timothy_horton@apple.com> "Essential Skeleton" does not respond to mouse events, only touch events https://bugs.webkit.org/show_bug.cgi?id=211439 <rdar://problem/62694519> Reviewed by Wenson Hsieh. * platform/RuntimeApplicationChecks.h: * platform/cocoa/RuntimeApplicationChecksCocoa.mm: (WebCore::IOSApplication::isEssentialSkeleton): 2020-05-05 Megan Gardner <megan_gardner@apple.com> Style is not applied when changed on the first line of a new mail message. https://bugs.webkit.org/show_bug.cgi?id=211200 <rdar://problem/62087514> Reviewed by Darin Adler. After r257487 when we resign first responder, we immediatly update activity state. This means that if we resign first responder, and then become first responder, we are clearing the selection if the caret is at the beginning of the document, due to a check in setSelectionFromNone. This check was originally added in 2006 because it happened to fix <rdar://problem/4483145>. Removing this check and merging the iOS and Mac logic. Test: editing/execCommand/ios/first-line-text-attribute-change-presist-through-resigning-first-responder.html * editing/FrameSelection.cpp: (WebCore::FrameSelection::setSelectionFromNone): 2020-05-05 Rob Buis <rbuis@igalia.com> A URL cannot have a username/password/port if its host is null https://bugs.webkit.org/show_bug.cgi?id=211358 Reviewed by Darin Adler. A URL cannot have a username/password/port if its host is null [1], so adjust URL.cpp accordingly. Behavior matches Chrome and Firefox. [1] https://url.spec.whatwg.org/#cannot-have-a-username-password-port * html/URLDecomposition.cpp: (WebCore::URLDecomposition::setUsername): (WebCore::URLDecomposition::setPassword): (WebCore::URLDecomposition::setPort): 2020-05-05 Youenn Fablet <youenn@apple.com> MediaPlayerPrivateMediaStreamAVFObjC should unobserve the tracks from its audio and video track sets https://bugs.webkit.org/show_bug.cgi?id=211444 <rdar://problem/62886221> Reviewed by Eric Carlson. Test: fast/mediastream/MediaStream-removeTrack-while-playing.html * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm: (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::~MediaPlayerPrivateMediaStreamAVFObjC): We keep maps of audio and video tracks we are observing. Use these two maps to properly unobserve all tracks at destruction time. While this is not strictly needed since we are using weak pointers, this helps keeping the code healthy. * platform/mediastream/MediaStreamTrackPrivate.cpp: (WebCore::MediaStreamTrackPrivate::forEachObserver): Add a debug ASSERT so that we ensure add/remove observers is done properly. 2020-05-05 Chris Dumez <cdumez@apple.com> Unreviewed, reverting r261130. Caused crashes on some of our bots Reverted changeset: "Drop code path using the legacy CFNetwork cookie change notification SPI" https://bugs.webkit.org/show_bug.cgi?id=211411 https://trac.webkit.org/changeset/261130 2020-05-05 Darin Adler <darin@apple.com> Remove now-unneeded USE(COREMEDIA) and USE(VIDEOTOOLBOX) https://bugs.webkit.org/show_bug.cgi?id=211437 Reviewed by Eric Carlson. * platform/cocoa/VideoToolboxSoftLink.cpp: Remove USE(VIDEOTOOLBOX). * platform/cocoa/VideoToolboxSoftLink.h: Ditto. * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm: (WebCore::MediaPlayerPrivateAVFoundationObjC::createVideoLayer): Ditto. (WebCore::MediaPlayerPrivateAVFoundationObjC::createVideoOutput): Ditto. (WebCore::MediaPlayerPrivateAVFoundationObjC::updateLastImage): Ditto. * platform/graphics/cocoa/WebCoreDecompressionSession.h: Ditto. Also remove #pragma once since this header is only used with #import, not #include. * platform/graphics/cocoa/WebCoreDecompressionSession.mm: Ditto. * platform/graphics/cv/ImageRotationSessionVT.h: Ditto. * platform/graphics/cv/ImageRotationSessionVT.mm: Ditto. * platform/graphics/cv/ImageTransferSessionVT.h: Ditto. * platform/graphics/cv/ImageTransferSessionVT.mm: Ditto. * platform/graphics/cv/PixelBufferConformerCV.cpp: (WebCore::PixelBufferConformerCV::PixelBufferConformerCV): Ditto. (WebCore::PixelBufferConformerCV::convert): Ditto. (WebCore::PixelBufferConformerCV::createImageFromPixelBuffer): Ditto. * platform/graphics/cv/PixelBufferConformerCV.h: Ditto. 2020-05-05 Youenn Fablet <youenn@apple.com> Remove LegacySchemeRegistry::canServiceWorkersHandleURLScheme https://bugs.webkit.org/show_bug.cgi?id=211170 Reviewed by Alex Christensen. Since we no longer use custom service worker schemes in API tests, we no longer need custom schemes in web process, given they are not supported in network process anyway. Remove related code. * Modules/cache/DOMWindowCaches.idl: * bindings/scripts/CodeGeneratorJS.pm: (NeedsRuntimeCheck): (GenerateRuntimeEnableConditionalString): * bindings/scripts/IDLAttributes.json: * dom/ScriptExecutionContext.cpp: (WebCore::ScriptExecutionContext::hasServiceWorkerScheme const): Deleted. * dom/ScriptExecutionContext.h: * loader/DocumentLoader.cpp: (WebCore::DocumentLoader::matchRegistration): (WebCore::DocumentLoader::commitData): * page/NavigatorServiceWorker.idl: * platform/LegacySchemeRegistry.cpp: (WebCore::serviceWorkerSchemes): Deleted. (WebCore::LegacySchemeRegistry::registerURLSchemeServiceWorkersCanHandle): Deleted. (WebCore::LegacySchemeRegistry::canServiceWorkersHandleURLScheme): Deleted. (WebCore::LegacySchemeRegistry::isServiceWorkerContainerCustomScheme): Deleted. * platform/LegacySchemeRegistry.h: * workers/service/ServiceWorkerContainer.cpp: (WebCore::ServiceWorkerContainer::addRegistration): 2020-05-05 Darin Adler <darin@apple.com> Remove now-unneeded HAVE(DISALLOWABLE_USER_INSTALLED_FONTS) https://bugs.webkit.org/show_bug.cgi?id=211428 Reviewed by Anders Carlsson. * platform/graphics/Font.h: Removed isUserInstalledFont, only used for an assertion that I took the liberty of removing. * platform/graphics/FontCascadeFonts.cpp: (WebCore::FontCascadeFonts::glyphDataForSystemFallback): Removed an assertion since it was the only reason to introduce the concept of a user-installed font to the cross-platform code. The assertion is a bit of a self-check that doesn't seem critical. * platform/graphics/cocoa/FontCacheCoreText.cpp: (WebCore::FontDatabase::singleton): Deleted. (WebCore::FontDatabase::singletonAllowingUserInstalledFonts): Remove HAVE(DISALLOWABLE_USER_INSTALLED_FONTS). (WebCore::FontDatabase::singletonDisallowingUserInstalledFonts): Ditto. (WebCore::isUserInstalledFont): Ditto. (WebCore::addAttributesForInstalledFonts): Ditto. (WebCore::isFontMatchingUserInstalledFontFallback): Ditto. (WebCore::addAttributesForWebFonts): Ditto. (WebCore::installedFontMandatoryAttributes): Ditto. * platform/graphics/mac/SimpleFontDataCoreText.cpp: (WebCore::Font::isUserInstalledFont const): Deleted. 2020-05-05 Alicia Boya García <aboya@igalia.com> [GStreamer] Video loops when ran in rr record --chaos https://bugs.webkit.org/show_bug.cgi?id=211182 Reviewed by Philippe Normand. While trying to investigate a different bug, I ran the browser with `rr record --chaos`, which makes it run very slowly and shuffles thread scheduling to try to make existing race conditions more likely to show up, also inevitably making the software run very slow. Doing so I found something strange: the video kept looping even though it didn't have the `loop` attribute set. After some debugging I found that MediaPlayer decides if the video has ended in part by checking `currentMediaTime()` is greater or equal to the video duration, which was not guaranteed to be the case in MediaPlayerPrivateGStreamer. As a consequence of this patch, one new LayoutTest has passed. * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp: (WebCore::MediaPlayerPrivateGStreamer::playbackPosition const): 2020-05-05 Zalan Bujtas <zalan@apple.com> [LFC] Rename computedContentHeight/Width to computedHeight/Width https://bugs.webkit.org/show_bug.cgi?id=211432 Reviewed by Darin Adler. These functions used to return the computed content box height/width but with box-sizing support the name is not correct anymore. * layout/FormattingContext.h: * layout/FormattingContextGeometry.cpp: (WebCore::Layout::FormattingContext::Geometry::computedHeight const): (WebCore::Layout::FormattingContext::Geometry::computedWidth const): (WebCore::Layout::FormattingContext::Geometry::computedMinHeight const): (WebCore::Layout::FormattingContext::Geometry::outOfFlowNonReplacedVerticalGeometry const): (WebCore::Layout::FormattingContext::Geometry::outOfFlowNonReplacedHorizontalGeometry): (WebCore::Layout::FormattingContext::Geometry::complicatedCases const): (WebCore::Layout::FormattingContext::Geometry::floatingNonReplacedWidthAndMargin): (WebCore::Layout::FormattingContext::Geometry::inlineReplacedHeightAndMargin const): (WebCore::Layout::FormattingContext::Geometry::inlineReplacedWidthAndMargin const): (WebCore::Layout::FormattingContext::Geometry::computedContentHeight const): Deleted. (WebCore::Layout::FormattingContext::Geometry::computedContentWidth const): Deleted. * layout/blockformatting/BlockFormattingContextGeometry.cpp: (WebCore::Layout::BlockFormattingContext::Geometry::inFlowNonReplacedHeightAndMargin): (WebCore::Layout::BlockFormattingContext::Geometry::inFlowNonReplacedWidthAndMargin const): (WebCore::Layout::BlockFormattingContext::Geometry::inFlowHeightAndMargin): (WebCore::Layout::BlockFormattingContext::Geometry::inFlowWidthAndMargin): * layout/tableformatting/TableFormattingContext.cpp: (WebCore::Layout::TableFormattingContext::computeAndDistributeExtraVerticalSpace): * layout/tableformatting/TableFormattingContextGeometry.cpp: (WebCore::Layout::TableFormattingContext::Geometry::cellHeigh const): (WebCore::Layout::TableFormattingContext::Geometry::computedColumnWidth const): 2020-05-05 Antoine Quint <graouts@apple.com> Unreviewed, reverting r260989. Mistakenly identified cause of MotionMark 1.1 performance regression Reverted changeset: "REGRESSION: MotionMark 1.1 regressed due to r260016" https://bugs.webkit.org/show_bug.cgi?id=211280 https://trac.webkit.org/changeset/260989 2020-05-05 Alexey Shvayka <shvaikalesh@gmail.com> Object.prototype.toString is not spec-perfect https://bugs.webkit.org/show_bug.cgi?id=199138 Reviewed by Darin Adler and Keith Miller. This patch defines @@toStringTag symbols for all WebIDL prototypes, including interfaces that are not exposed, as required by the spec [1]. With updated JSObject::toStringName() and @@toStringTag symbols added in r260992, className() and toStringName() methods of JSDOMConstructorBase can be safely removed. [1]: https://heycam.github.io/webidl/#dfn-class-string Tests: imported/w3c/web-platform-tests/WebIDL/ecmascript-binding/class-string-interface.any.js imported/w3c/web-platform-tests/WebIDL/ecmascript-binding/class-string-iterator-prototype-object.any.js * bindings/js/JSDOMConstructorBase.cpp: (WebCore::JSDOMConstructorBase::className): Deleted. (WebCore::JSDOMConstructorBase::toStringName): Deleted. * bindings/js/JSDOMConstructorBase.h: * bindings/scripts/CodeGeneratorJS.pm: (GenerateImplementation): (GeneratePrototypeDeclaration): * bindings/scripts/test/JS/JSTestGlobalObject.cpp: (WebCore::JSTestGlobalObjectPrototype::finishCreation): 2020-05-04 Darin Adler <darin@apple.com> [Mac] Remove __MAC_OS_X_VERSION_MIN_REQUIRED checks for versions older than 10.14 https://bugs.webkit.org/show_bug.cgi?id=211420 Reviewed by Alex Christensen. * editing/cocoa/DataDetection.mm: (WebCore::detectItem): Remove __MAC_OS_X_VERSION_MIN_REQUIRED >= 101400. * editing/cocoa/HTMLConverter.mm: (_WebMessageDocumentClass): Ditto. * platform/graphics/cg/GraphicsContextCG.cpp: Ditto. * platform/mac/WebCoreFullScreenPlaceholderView.mm: (-[WebCoreFullScreenPlaceholderView initWithFrame:]): Ditto. * platform/network/cocoa/CookieCocoa.mm: (WebCore::nsSameSitePolicy): Ditto. (WebCore::Cookie::operator NSHTTPCookie * _Nullable const): Ditto. * platform/network/cocoa/NetworkStorageSessionCocoa.mm: (WebCore::cookiesForURL): Ditto. (WebCore::NetworkStorageSession::setHTTPCookiesForURL const): Ditto. * platform/network/cocoa/ResourceRequestCocoa.mm: (WebCore::ResourceRequest::doUpdateResourceRequest): Ditto. (WebCore::siteForCookies): Ditto. (WebCore::ResourceRequest::doUpdatePlatformRequest): Ditto. * rendering/RenderThemeMac.mm: (WebCore::RenderThemeMac::paintTextField): Ditto. * testing/Internals.h: Ditto. 2020-05-04 Darin Adler <darin@apple.com> Remove now-unneeded HAVE(NETWORK_EXTENSION) https://bugs.webkit.org/show_bug.cgi?id=211424 Reviewed by Alex Christensen. * loader/ContentFilter.cpp: (WebCore::ContentFilter::types): Remove check of HAVE(NETWORK_EXTENSION), not needed because ENABLE(CONTENT_FILTER) is only done on Cocoa platforms, and HAVE(NETWORK_EXTENSION) is true for all of those. * platform/cocoa/NetworkExtensionContentFilter.mm: Ditto. 2020-05-04 Darin Adler <darin@apple.com> Remove now-unneeded HAVE(SEC_TRUST_EVALUATE_WITH_ERROR) https://bugs.webkit.org/show_bug.cgi?id=211429 Reviewed by Alex Christensen. * platform/network/cocoa/ResourceResponseCocoa.mm: (WebCore::ResourceResponse::platformCertificateInfo const): Remove HAVE(SEC_TRUST_EVALUATE_WITH_ERROR). 2020-05-04 Simon Fraser <simon.fraser@apple.com> Code cleanup in EventHandler https://bugs.webkit.org/show_bug.cgi?id=211413 Reviewed by Tim Horton. Use a better name for "hoveredNode" which is a HitTestResult. Convert Frame* to Frame&. Have a couple of helper functions return RefPtr<Frame>. * page/AutoscrollController.cpp: (WebCore::AutoscrollController::stopAutoscrollTimer): * page/EventHandler.cpp: (WebCore::EventHandler::subframeForHitTestResult): (WebCore::EventHandler::subframeForTargetNode): (WebCore::EventHandler::handleMousePressEvent): (WebCore::EventHandler::handleMouseDoubleClickEvent): (WebCore::EventHandler::mouseMoved): (WebCore::EventHandler::passMouseMovedEventToScrollbars): (WebCore::EventHandler::handleMouseMoveEvent): (WebCore::EventHandler::handleMouseReleaseEvent): (WebCore::EventHandler::passMousePressEventToScrollbar): (WebCore::EventHandler::passMousePressEventToSubframe): (WebCore::EventHandler::passMouseReleaseEventToSubframe): (WebCore::EventHandler::passWidgetMouseDownEventToWidget): (WebCore::EventHandler::passMouseMoveEventToSubframe): * page/EventHandler.h: * page/ios/EventHandlerIOS.mm: (WebCore::EventHandler::passSubframeEventToSubframe): (WebCore::EventHandler::passMousePressEventToSubframe): (WebCore::EventHandler::passMouseMoveEventToSubframe): (WebCore::EventHandler::passMouseReleaseEventToSubframe): (WebCore::EventHandler::tryToBeginDragAtPoint): * page/mac/EventHandlerMac.mm: (WebCore::EventHandler::passSubframeEventToSubframe): (WebCore::EventHandler::passMousePressEventToSubframe): (WebCore::EventHandler::passMouseMoveEventToSubframe): (WebCore::EventHandler::passMouseReleaseEventToSubframe): * page/win/EventHandlerWin.cpp: (WebCore::EventHandler::passMouseMoveEventToSubframe): 2020-05-04 Ben Nham <nham@apple.com> IndexedDB WAL file keeps growing while app is in use https://bugs.webkit.org/show_bug.cgi?id=202137 Reviewed by Brady Eidson. It's easy to get into a situation where the WAL file associated with a SQLite-backed IndexedDB grows indefinitely while a site is in use for two reasons: 1. We don't promptly reset cached prepared statements in SQLiteIDBBackingStore. Many statements are left hanging in the SQLITE_ROW state without being reset or fully stepped to the SQLITE_DONE state. These hanging statements keep their associated transactions open and prevent the WAL checkpointer from progressing past those active transactions. To fix this, I added SQLiteStatementAutoResetScope. This is a scope guard that SQLiteIDBBackingStore uses to ensure that cached statements are reset in a timely manner. While going through the reset code I also noticed we aren't clearing bindings after resetting statements. We should be doing this because sqlite3_reset does not clear bindings (and their associated copies of blobs/strings); sqlite3_clear_bindings does that. 2. The default WAL hook for auto-checkpointing in upstream SQLite uses the SQLITE_CHECKPOINT_PASSIVE mode, which doesn't truncate the WAL until the next write transaction occurs. (It actually doesn't truncate at all when compiled with default settings, but macOS's SQLite sets SQLITE_DEFAULT_JOURNAL_SIZE_LIMIT, which causes the truncation to occur on the next write.) We want the WAL to be truncated more promptly, because otherwise the quota check that happens on each mutation won't be as accurate. To do this, I installed a WAL hook that truncates the WAL with SQLITE_CHECKPOINT_TRUNCATE after the default threshold of 1000 WAL pages. I didn't enable this for all SQLiteDatabases because this checkpoint call can block on the busy handler. This isn't a problem for IDB since we don't use busy handlers in IDB. * Headers.cmake: * Modules/indexeddb/server/SQLiteIDBBackingStore.cpp: (WebCore::IDBServer::SQLiteIDBBackingStore::getOrEstablishDatabaseInfo): (WebCore::IDBServer::SQLiteIDBBackingStore::createObjectStore): (WebCore::IDBServer::SQLiteIDBBackingStore::deleteObjectStore): (WebCore::IDBServer::SQLiteIDBBackingStore::renameObjectStore): (WebCore::IDBServer::SQLiteIDBBackingStore::clearObjectStore): (WebCore::IDBServer::SQLiteIDBBackingStore::createIndex): (WebCore::IDBServer::SQLiteIDBBackingStore::uncheckedHasIndexRecord): (WebCore::IDBServer::SQLiteIDBBackingStore::uncheckedPutIndexRecord): (WebCore::IDBServer::SQLiteIDBBackingStore::deleteIndex): (WebCore::IDBServer::SQLiteIDBBackingStore::renameIndex): (WebCore::IDBServer::SQLiteIDBBackingStore::keyExistsInObjectStore): (WebCore::IDBServer::SQLiteIDBBackingStore::deleteUnusedBlobFileRecords): (WebCore::IDBServer::SQLiteIDBBackingStore::deleteRecord): (WebCore::IDBServer::SQLiteIDBBackingStore::updateAllIndexesForAddRecord): (WebCore::IDBServer::SQLiteIDBBackingStore::addRecord): (WebCore::IDBServer::SQLiteIDBBackingStore::getBlobRecordsForObjectStoreRecord): (WebCore::IDBServer::SQLiteIDBBackingStore::getRecord): (WebCore::IDBServer::SQLiteIDBBackingStore::cachedStatementForGetAllObjectStoreRecords): (WebCore::IDBServer::SQLiteIDBBackingStore::getAllObjectStoreRecords): (WebCore::IDBServer::SQLiteIDBBackingStore::uncheckedGetIndexRecordForOneKey): (WebCore::IDBServer::SQLiteIDBBackingStore::getCount): (WebCore::IDBServer::SQLiteIDBBackingStore::uncheckedGetKeyGeneratorValue): (WebCore::IDBServer::SQLiteIDBBackingStore::uncheckedSetKeyGeneratorValue): (WebCore::IDBServer::SQLiteIDBBackingStore::cachedStatement): * Modules/indexeddb/server/SQLiteIDBBackingStore.h: * Sources.txt: * WebCore.xcodeproj/project.pbxproj: * platform/sql/SQLiteDatabase.cpp: (WebCore::walAutomaticTruncationHook): (WebCore::SQLiteDatabase::enableAutomaticWALTruncation): * platform/sql/SQLiteDatabase.h: * platform/sql/SQLiteStatement.cpp: (WebCore::SQLiteStatement::reset): * platform/sql/SQLiteStatementAutoResetScope.cpp: Added. (WebCore::SQLiteStatementAutoResetScope::SQLiteStatementAutoResetScope): (WebCore::SQLiteStatementAutoResetScope::operator=): (WebCore::SQLiteStatementAutoResetScope::~SQLiteStatementAutoResetScope): * platform/sql/SQLiteStatementAutoResetScope.h: Added. (WebCore::SQLiteStatementAutoResetScope::operator bool const): (WebCore::SQLiteStatementAutoResetScope::operator! const): (WebCore::SQLiteStatementAutoResetScope::get): (WebCore::SQLiteStatementAutoResetScope::operator->): 2020-05-04 Wenson Hsieh <wenson_hsieh@apple.com> Tapping to focus editable elements should start caret selection at word boundary https://bugs.webkit.org/show_bug.cgi?id=211409 <rdar://problem/62869098> Reviewed by Megan Gardner. Match platform behavior when focusing editable text content by beginning the caret selection at word granularity (i.e. the start or end of a word), rather than character granularity. This will match behavior of other editable widgets on iOS (such as UITextField and UITextView), as well as our current behavior when tapping to change the selection when the text interaction is editable (i.e. when the caret is already visible when tapping). Rebaselined existing layout tests. * editing/VisibleUnits.cpp: (WebCore::wordBoundaryForPositionWithoutCrossingLine): Move logic previously in `WebPage::selectWithGesture` down into `VisibleUnits.h`, as a new standalone helper function. Given a `VisiblePosition`, this new helper will return the given position if it is either already at word boundary or line boundary; if it is within the boundary of a word, it will instead return the start or end of the word. * editing/VisibleUnits.h: * page/EventHandler.cpp: (WebCore::EventHandler::handleMousePressEventSingleClick): When setting the selection due to a synthetic single click, automatically adjust the caret position to be at word boundary instead of using the hit-tested position directly. 2020-05-04 Darin Adler <darin@apple.com> Make __IPHONE_OS_VERSION_MIN_REQUIRED checks against old versions explicit about watchOS and tvOS https://bugs.webkit.org/show_bug.cgi?id=211402 Reviewed by Alexey Proskuryakov. * editing/cocoa/WebContentReaderCocoa.mm: (WebCore::attributesForAttributedStringConversion): Move from __IPHONE_OS_VERSION_MIN_REQUIRED to !PLATFORM(WATCHOS) && !PLATFORM(APPLETV). Move NSExcludedElementsDocumentAttribute to AttributedStringSPI.h. * page/SettingsDefaultValues.h: Rewrite conic gradient conditional to call out tvOS as an exception rather than doing that indirectly through __IPHONE_OS_VERSION_MIN_REQUIRED. * platform/graphics/cg/GradientCG.cpp: (WebCore::Gradient::paint): Ditto. * platform/graphics/cocoa/FontCacheCoreText.cpp: Rewrite HAS_CORE_TEXT_WIDTH_ATTRIBUTE to use !PLATFORM(WATCHOS) && !PLATFORM(APPLETV). (WebCore::variationCapabilitiesForFontDescriptor): Ditto. (WebCore::FontCache::lastResortFallbackFont): Ditto. * platform/graphics/cocoa/FontDescriptionCocoa.cpp: (WebCore::matchSystemFontUse): Use HAVE(SYSTEM_FONT_STYLE_TITLE_0) and HAVE(SYSTEM_FONT_STYLE_TITLE_4) instead of __IPHONE_OS_VERSION_MIN_REQUIRED. This consolidates the watchOS/tvOS issue into the PlatformHave.h file, and does not change behavior at this time. * platform/graphics/cocoa/FontPlatformDataCocoa.mm: (WebCore::cascadeToLastResortAttributesDictionary): Changed this to not use a global since it's only called as part of initializing another global, and to return a RetainPtr. (WebCore::cascadeToLastResortAndVariationsFontDescriptor): Removed WORKAROUND_CORETEXT_VARIATIONS_WITH_FALLBACK_LIST_BUG after researching to be sure it's fixed on recent watchOS and tvOS. Also changed this to return a raw pointer instead of RetainPtr since it returns a single global object. Also removed the CTFontRef argument. (WebCore::FontPlatformData::ctFont const): Updated for the changes above. * platform/graphics/cocoa/IOSurface.mm: (WebCore::IOSurface::surfaceID const): Move from __IPHONE_OS_VERSION_MIN_REQUIRED to !PLATFORM(WATCHOS) && !PLATFORM(APPLETV). * platform/graphics/ios/FontCacheIOS.mm: (WebCore::platformFontWithFamilySpecialCase): Ditto. * platform/graphics/mac/FontCustomPlatformData.cpp: (WebCore::createFontCustomPlatformData): Ditto. 2020-05-04 Darin Adler <darin@apple.com> Remove HAVE(IOSURFACE) checks in Cocoa-platform-specific code https://bugs.webkit.org/show_bug.cgi?id=211389 Reviewed by Alexey Proskuryakov. * page/cocoa/MemoryReleaseCocoa.mm: (WebCore::platformReleaseMemory): Remove HAVE(IOSURFACE) since it's always true on Cocoa platforms. * platform/graphics/RemoteVideoSample.cpp: (WebCore::RemoteVideoSample::surface const): Ditto. * platform/graphics/RemoteVideoSample.h: Ditto. * platform/graphics/cocoa/GraphicsContextGLOpenGLCocoa.mm: (WebCore::GraphicsContextGLOpenGL::allocateIOSurfaceBackingStore): Ditto. (WebCore::GraphicsContextGLOpenGL::updateFramebufferTextureBackingStoreFromLayer): Ditto. * platform/graphics/cocoa/IOSurface.mm: Ditto. * platform/graphics/cocoa/IOSurfacePoolCocoa.mm: Ditto. * platform/graphics/cocoa/WebGLLayer.h: Ditto. * platform/graphics/cocoa/WebGLLayer.mm: (-[WebGLLayer display]): Ditto. * platform/graphics/cv/ImageTransferSessionVT.h: Ditto. * platform/graphics/cv/ImageTransferSessionVT.mm: Ditto. * platform/graphics/cv/VideoTextureCopierCV.cpp: (WebCore::YCbCrToRGBMatrixForRangeAndTransferFunction): Ditto. (WebCore::VideoTextureCopierCV::copyImageToPlatformTexture): Ditto. * platform/graphics/cv/VideoTextureCopierCV.h: Ditto. * rendering/RenderThemeIOS.h: Ditto. 2020-05-04 Simon Fraser <simon.fraser@apple.com> Overflow scrollbars don't grow when hovered https://bugs.webkit.org/show_bug.cgi?id=210692 <rdar://problem/61977273> Reviewed by Tim Horton. Overlay scrollar interaction has a few behaviors that are mediated by ScrollAnimatorMac. These are a trackpad two-finger tap, which sends a "MayBegin" wheel event (which can be followed by a "Cancelled" on fingers up, if they didn't move), and hovering the scrollbar when visible, which causes it to expand (unhovering causes it to fade out). To track these gestures on the scrolling thread, give ScrollingTree a ScrollingTreeGestureState. Flashing the scrollbars on "MayBegin" is driven by didBeginScrollGesture()/didEndScrollGesture(). This relies on sending these for the correct scrollable area, and matching the begin/cancel, so use the normal scrolling tree event handling code path for "MayBegin", and always send "Cancelled" on the node that received "MayBegin. Do the same for "Began" and "Ended". Scrollbars expanding on hover is controlled by these functions on ScrollAnimatorMac: void mouseEnteredContentArea(); void mouseExitedContentArea(); void mouseMovedInContentArea(); void mouseEnteredScrollbar(Scrollbar*) const; void mouseExitedScrollbar(Scrollbar*) const; This mostly (webkit.org/b/211347) works now that the mayBegin/Canceled state is updated correctly, and is tested by a new test. Tests: fast/scrolling/mac/scrollbars/overflow-overlay-scrollbar-hovered.html fast/scrolling/mac/scrollbars/overflow-overlay-scrollbar-reveal.html * Sources.txt: * WebCore.xcodeproj/project.pbxproj: * page/scrolling/ScrollingTree.cpp: (WebCore::ScrollingTree::ScrollingTree): (WebCore::ScrollingTree::handleWheelEvent): * page/scrolling/ScrollingTree.h: * page/scrolling/ScrollingTreeGestureState.cpp: Added. (WebCore::ScrollingTreeGestureState::ScrollingTreeGestureState): (WebCore::ScrollingTreeGestureState::receivedWheelEvent): (WebCore::ScrollingTreeGestureState::handleGestureCancel): (WebCore::ScrollingTreeGestureState::nodeDidHandleEvent): (WebCore::ScrollingTreeGestureState::clearAllNodes): * page/scrolling/ScrollingTreeGestureState.h: Copied from Source/WebCore/page/scrolling/ScrollingTreeLatchingController.h. * page/scrolling/ScrollingTreeLatchingController.cpp: (WebCore::ScrollingTreeLatchingController::nodeDidHandleEvent): * page/scrolling/ScrollingTreeLatchingController.h: * page/scrolling/ScrollingTreeScrollingNode.cpp: (WebCore::ScrollingTreeScrollingNode::canHandleWheelEvent const): (WebCore::ScrollingTreeScrollingNode::canScrollWithWheelEvent const): Deleted. * page/scrolling/ScrollingTreeScrollingNode.h: * page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.mm: (WebCore::ScrollingTreeFrameScrollingNodeMac::handleWheelEvent): * page/scrolling/mac/ScrollingTreeOverflowScrollingNodeMac.mm: (WebCore::ScrollingTreeOverflowScrollingNodeMac::handleWheelEvent): * page/scrolling/mac/ScrollingTreeScrollingNodeDelegateMac.mm: (WebCore::ScrollingTreeScrollingNodeDelegateMac::handleWheelEvent): * platform/Logging.cpp: (WebCore::initializeLogChannelsIfNecessary): * platform/PlatformWheelEvent.h: (WebCore::PlatformWheelEvent::isGestureStart const): (WebCore::PlatformWheelEvent::isGestureCancel const): * platform/cocoa/ScrollController.mm: (WebCore::ScrollController::handleWheelEvent): * platform/mac/ScrollAnimatorMac.mm: (WebCore::scrollbarState): 2020-05-04 Commit Queue <commit-queue@webkit.org> Unreviewed, reverting r261102. https://bugs.webkit.org/show_bug.cgi?id=211418 Revert some debug logging (Requested by smfr on #webkit). Reverted changeset: "REGRESSION: [ Mac WK1 ] inspector/console/console-api.html is flaky crashing" https://bugs.webkit.org/show_bug.cgi?id=211386 https://trac.webkit.org/changeset/261102 2020-05-04 Chris Dumez <cdumez@apple.com> Drop code path using the legacy CFNetwork cookie change notification SPI https://bugs.webkit.org/show_bug.cgi?id=211411 Reviewed by John Wilander. * platform/network/cocoa/NetworkStorageSessionCocoa.mm: (WebCore::NetworkStorageSession::registerCookieChangeListenersIfNecessary): (WebCore::NetworkStorageSession::unregisterCookieChangeListenersIfNecessary): 2020-05-04 Jack Lee <shihchieh_lee@apple.com> Nullptr crash in CompositeEditCommand::moveParagraphs when changing style on elements that are user-select:none and dir:rtl. https://bugs.webkit.org/show_bug.cgi?id=211206 <rdar://problem/61830589> Reviewed by Geoffrey Garen. In function moveParagraphs check if the destination is an empty position and bail out before moving the paragraphs. Test: fast/editing/justify-user-select-none-dir-rtl-crash.html * editing/CompositeEditCommand.cpp: (WebCore::CompositeEditCommand::moveParagraphs): 2020-05-04 Jiewen Tan <jiewen_tan@apple.com> [WebAuthn] Implement +[_WKWebAuthenticationPanel clearAllLocalAuthenticatorCredentials] https://bugs.webkit.org/show_bug.cgi?id=211369 <rdar://problem/60246635> Reviewed by Brent Fulgham. Covered by manual tests given auto tests could clear developers' actual credentials. * Modules/webauthn/WebAuthenticationConstants.h: 2020-05-04 Said Abou-Hallawa <sabouhallawa@apple.com> Throttling requestAnimationFrame should be controlled by RenderingUpdateScheduler https://bugs.webkit.org/show_bug.cgi?id=204713 Reviewed by Simon Fraser. rAF and Page rendering were managed by two different timers. Throttling rAF was implemented by changing its timer. After r242624, RenderingUpdate steps have been managed by RenderingUpdateScheduler. This means rAF is now serviced by the preferredFramesPerSecond which is 60 fps regardless it's throttled or not. Moreover the rAF throttling timer was mistakenly kept and it has been running under the old assumption which is: rAF is serviced by a timer only. This means rAF will be serviced by its timer and by the RenderingUpdate steps at the same time when it is supposed to throttle. This will make it fire more than 60 fps in cases which it is supposed to run less than 60 fps. The solution is to have two throttling types: 1) Page throttling (or full throttling): This slows down all the steps of RenderingUpdate for the main document and all the sub-documents. Page throttling reasons are: -- VisuallyIdle: Aggressive throttling. -- LowPowerMode: Half speed throttling. 2) Document throttling (or partial throttling): This only slows down the rAF of a certain document. Document throttling reasons are: -- OutsideViewport: Aggressive throttling. -- NonInteractedCrossOriginFrame: Half speed throttling. RenderingUpdate steps will still be managed by RenderingUpdateScheduler which can be throttled. The assumption is none of these steps will need to run faster than the Page preferredFramesPerSecond. If rAF wants to run slower than the Page because of a Document throttling reason, no rAF callbacks will be serviced before its preferredFrameInterval has elapsed. In this patch, "Half speed throttling" is only implemented for the Page and the Document throttling. The "Aggressive throttling" will be done in following patches. Page rendering was never throttled before. We need to make sure this is not going to affect PLT. Some tests need to be changed and new tests need to be written. All of the throttling tests checks the state of the code but none of them checks the real user's experience. * Headers.cmake: * WebCore.xcodeproj/project.pbxproj: * animation/DocumentTimeline.cpp: (WebCore::DocumentTimeline::animationInterval const): (WebCore::DocumentTimeline::updateThrottlingState): Deleted. * animation/DocumentTimeline.h: There is no need to have DocumentTimeline throttling. It is already throttled when the page RenderingUpdate is throttled. * dom/Document.cpp: (WebCore::Document::requestAnimationFrame): (WebCore::Document::updateLastHandledUserGestureTimestamp): LowPowerMode throttling is now handled by the Page. So remove its handling from the Document. * dom/ScriptedAnimationController.cpp: (WebCore::ScriptedAnimationController::ScriptedAnimationController): (WebCore::ScriptedAnimationController::page const): (WebCore::ScriptedAnimationController::interval const): (WebCore::ScriptedAnimationController::preferredScriptedAnimationInterval const): (WebCore::ScriptedAnimationController::throttlingReasons const): (WebCore::ScriptedAnimationController::isThrottledRelativeToPage const): (WebCore::ScriptedAnimationController::shouldRescheduleRequestAnimationFrame const): (WebCore::ScriptedAnimationController::registerCallback): (WebCore::ScriptedAnimationController::cancelCallback): (WebCore::ScriptedAnimationController::serviceRequestAnimationFrameCallbacks): (WebCore::ScriptedAnimationController::scheduleAnimation): (WebCore::throttlingReasonToString): Deleted. (WebCore::throttlingReasonsToString): Deleted. (WebCore::ScriptedAnimationController::addThrottlingReason): Deleted. (WebCore::ScriptedAnimationController::removeThrottlingReason): Deleted. (WebCore::ScriptedAnimationController::isThrottled const): Deleted. (WebCore::ScriptedAnimationController::animationTimerFired): Deleted. * dom/ScriptedAnimationController.h: (WebCore::ScriptedAnimationController::addThrottlingReason): (WebCore::ScriptedAnimationController::removeThrottlingReason): Get rid of the rAF throttling timer. Service the rAF callback only when the period from the current time stamp till the last service time stamp is greater than the preferred rAF interval. * page/FrameView.cpp: (WebCore::FrameView::updateScriptedAnimationsAndTimersThrottlingState): ThrottlingReason is now defined outside ScriptedAnimationController. * page/Page.cpp: (WebCore::m_loadsFromNetwork): (WebCore::Page::setLowPowerModeEnabledOverrideForTesting): (WebCore::Page::preferredRenderingUpdateInterval const): Calculate the preferred RenderingUpdate interval from the throttling reasons. (WebCore::Page::setIsVisuallyIdleInternal): (WebCore::Page::handleLowModePowerChange): Call adjustRenderingUpdateFrequency() when isLowPowerModeEnabled or IsVisuallyIdle is toggled. (WebCore::Page::isLowPowerModeEnabled const): Deleted. (WebCore::updateScriptedAnimationsThrottlingReason): Deleted. * page/Page.h: (WebCore::Page::isLowPowerModeEnabled const): (WebCore::Page::throttlingReasons const): (WebCore::Page::canUpdateThrottlingReason const): * page/RenderingUpdateScheduler.cpp: (WebCore::RenderingUpdateScheduler::setPreferredFramesPerSecond): (WebCore::RenderingUpdateScheduler::scheduleAnimation): (WebCore::RenderingUpdateScheduler::adjustRenderingUpdateFrequency): Change the preferredFramesPerSecond of the DisplayRefreshMonitor if the throttling is not aggressive e.g. 10_s. Otherwise use the timer. (WebCore::RenderingUpdateScheduler::scheduleTimedRenderingUpdate): Call adjustFramesPerSecond() when DisplayRefreshMonitor is created. (WebCore::RenderingUpdateScheduler::startTimer): * page/RenderingUpdateScheduler.h: * platform/graphics/AnimationFrameRate.h: Added. (WebCore::preferredFrameInterval): (WebCore::preferredFramesPerSecond): (WebCore::operator<<): Push names of ThrottlingReasons to a TextStream. * platform/graphics/DisplayRefreshMonitor.h: (WebCore::DisplayRefreshMonitor::setPreferredFramesPerSecond): * platform/graphics/DisplayRefreshMonitorManager.cpp: (WebCore::DisplayRefreshMonitorManager::monitorForClient): Rename createMonitorForClient() to monitorForClient() since it may return a cached DisplayRefreshMonitor. (WebCore::DisplayRefreshMonitorManager::setPreferredFramesPerSecond): (WebCore::DisplayRefreshMonitorManager::scheduleAnimation): (WebCore::DisplayRefreshMonitorManager::windowScreenDidChange): No need to call registerClient(). This function was just ensuring the DisplayRefreshMonitor is created. scheduleAnimation() does the same thing. (WebCore::DisplayRefreshMonitorManager::createMonitorForClient): Deleted. (WebCore::DisplayRefreshMonitorManager::registerClient): Deleted. * platform/graphics/DisplayRefreshMonitorManager.h: (WebCore::DisplayRefreshMonitorManager::DisplayRefreshMonitorManager): Deleted. * platform/graphics/GraphicsLayerUpdater.cpp: (WebCore::GraphicsLayerUpdater::GraphicsLayerUpdater): * platform/graphics/ios/DisplayRefreshMonitorIOS.mm: (-[WebDisplayLinkHandler setPreferredFramesPerSecond:]): Set the preferredFramesPerSecond of the CADisplayLink. * testing/Internals.cpp: (WebCore::Internals::requestAnimationFrameThrottlingReasons const): (WebCore::Internals::isRequestAnimationFrameThrottled const): Deleted. * testing/Internals.h: * testing/Internals.idl: Replace isRequestAnimationFrameThrottled() which returns a boolean by requestAnimationFrameThrottlingReasons() which returns a string. The string represents the throttling reasons. 2020-05-04 Darin Adler <darin@apple.com> Remove unneeded USE(MEDIAREMOTE) https://bugs.webkit.org/show_bug.cgi?id=211385 Reviewed by Eric Carlson. * platform/audio/cocoa/MediaSessionManagerCocoa.mm: (WebCore::MediaSessionManagerCocoa::updateNowPlayingInfo): Remove USE(MEDIAREMOTE). * platform/mac/MediaRemoteSoftLink.cpp: Ditto. * platform/mac/MediaRemoteSoftLink.h: Ditto. * platform/mac/RemoteCommandListenerMac.mm: (WebCore::RemoteCommandListenerMac::updateSupportedCommands): Ditto. (WebCore::RemoteCommandListenerMac::RemoteCommandListenerMac): Ditto. (WebCore::RemoteCommandListenerMac::~RemoteCommandListenerMac): Ditto. 2020-05-04 Devin Rousso <drousso@apple.com> Web Inspector: Worker: should use the name of the worker if it exists https://bugs.webkit.org/show_bug.cgi?id=211244 Reviewed by Brian Burg. Test: inspector/worker/runtime-basic.html Pass the `name` from the `WorkerOptions` given to the `Worker` when it's constructed to Web Inspector so it can be used in the frontend UI. Drive-by: replace lots of pointers with references. * workers/WorkerMessagingProxy.cpp: (WebCore::WorkerMessagingProxy::startWorkerGlobalScope): * workers/WorkerInspectorProxy.h: (WebCore::WorkerInspectorProxy::name const): Added. * workers/WorkerInspectorProxy.cpp: (WebCore::WorkerInspectorProxy::workerStarted): (WebCore::WorkerInspectorProxy::workerTerminated): (WebCore::WorkerInspectorProxy::connectToWorkerInspectorController): (WebCore::WorkerInspectorProxy::sendMessageFromWorkerToFrontend): * inspector/InspectorInstrumentation.h: (WebCore::InspectorInstrumentation::workerStarted): (WebCore::InspectorInstrumentation::workerTerminated): * inspector/InspectorInstrumentation.cpp: (WebCore::InspectorInstrumentation::workerStartedImpl): (WebCore::InspectorInstrumentation::workerTerminatedImpl): * inspector/agents/InspectorWorkerAgent.h: * inspector/agents/InspectorWorkerAgent.cpp: (WebCore::InspectorWorkerAgent::sendMessageFromWorkerToFrontend): (WebCore::InspectorWorkerAgent::workerStarted): (WebCore::InspectorWorkerAgent::workerTerminated): (WebCore::InspectorWorkerAgent::connectToAllWorkerInspectorProxiesForPage): (WebCore::InspectorWorkerAgent::connectToWorkerInspectorProxy): (WebCore::InspectorWorkerAgent::disconnectFromWorkerInspectorProxy): 2020-05-04 Devin Rousso <drousso@apple.com> Web Inspector: provide a way for inspector to turn on/off ITP debug mode and AdClickAttribution debug mode https://bugs.webkit.org/show_bug.cgi?id=209763 Reviewed by Brian Burg. Tests: inspector/page/overrideSetting-AdClickAttributionDebugModeEnabled.html inspector/page/overrideSetting-ITPDebugModeEnabled.html * inspector/agents/InspectorPageAgent.cpp: (WebCore::InspectorPageAgent::disable): (WebCore::InspectorPageAgent::overrideSetting): * inspector/InspectorClient.h: (WebCore::InspectorClient::setDeveloperPreferenceOverride): Added. (WebCore::InspectorClient::setMockCaptureDevicesEnabledOverride): Deleted. 2020-05-04 Simon Fraser <simon.fraser@apple.com> REGRESSION: [ Mac WK1 ] inspector/console/console-api.html is flaky crashing https://bugs.webkit.org/show_bug.cgi?id=211386 Reviewed by David Kilzer. Add some temporary logging code to get data from Mojave bots related to this NSScrollerImp crash. * platform/mac/ScrollAnimatorMac.mm: (WebCore::dumpPaintersWithDelegates): (WebCore::ScrollAnimatorMac::ScrollAnimatorMac): (WebCore::ScrollAnimatorMac::~ScrollAnimatorMac): (WebCore::ScrollAnimatorMac::didAddVerticalScrollbar): (WebCore::ScrollAnimatorMac::willRemoveVerticalScrollbar): (WebCore::ScrollAnimatorMac::didAddHorizontalScrollbar): (WebCore::ScrollAnimatorMac::willRemoveHorizontalScrollbar): 2020-05-04 Doug Kelly <dougk@apple.com> Add additional null checks to MediaPlayerPrivateMediaSourceAVFObjC https://bugs.webkit.org/show_bug.cgi?id=211134 <rdar://problem/62056577> Reviewed by Daniel Bates. Add additional null checks for a set m_mediaSourcePrivate to MediaPlayerPrivateMediaSourceAVFObjC. Most uses in this class are already guarded, but a few were not, which could lead to a null pointer crash if encountered. No new tests; no functional changes. * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm: (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::playInternal): (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::setCDMSession): 2020-05-04 Darin Adler <darin@apple.com> Remove now-unneeded HAVE(MEDIA_PLAYER) https://bugs.webkit.org/show_bug.cgi?id=211378 Reviewed by Alex Christensen. * platform/RemoteCommandListener.cpp: Remove uneeded check for HAVE(MEDIA_PLAYER) in code that already checks for Cocoa platforms explicitly. * platform/audio/ios/MediaSessionManagerIOS.mm: (WebCore::MediaSessionManageriOS::configureWireLessTargetMonitoring): Removed check of HAVE(MEDIA_PLAYER) in a Cocoa-only source file. * platform/ios/RemoteCommandListenerIOS.h: Ditto. Also removed #pragma once and some other unnecessary things because this is only included in the .mm file below. * platform/ios/RemoteCommandListenerIOS.mm: Ditto. 2020-05-04 Guillem Vinals <gvinals@apple.com> WebGPU: Textures should be able to have OUTPUT_ATTACHMENT | SAMPLED usage flags https://bugs.webkit.org/show_bug.cgi?id=211345 <rdar://problem/62264423> Reviewed by Myles C. Maxfield. Added support for off-screen render targets. Test: webgpu/textures-textureviews.html * platform/graphics/gpu/cocoa/GPUTextureMetal.mm: (WebCore::mtlTextureUsageForGPUTextureUsageFlags): 2020-05-04 Guillem Vinals <gvinals@apple.com> WebGPU: copyTextureToTexture() has an implementation bug (src copy view info is used also as dst) https://bugs.webkit.org/show_bug.cgi?id=211303 Reviewed by Daniel Bates. The source copy information is also used as the destination copy information. Test: webgpu/blit-commands-texture-to-texture.html * platform/graphics/gpu/cocoa/GPUCommandBufferMetal.mm: (WebCore::GPUCommandBuffer::copyTextureToTexture): 2020-05-04 Antoine Quint <graouts@apple.com> Media controls tracks menu shows "Auto" selected instead of track selected via the JS API https://bugs.webkit.org/show_bug.cgi?id=211230 <rdar://problem/62648409> Reviewed by Eric Carlson. Test: media/modern-media-controls/tracks-support/tracks-support-text-track-selected-via-media-api.html We're fixing two issues with the captions menu on macOS here. First, if a text track was marked as "showing" with the JS API, we would not show it as selected in the UI because MediaControlsHost would report that the captionDisplayMode was "automatic" and we'd take this as sufficient data to say that the "Automatic (Recommended)" item should be shown as selected. We now only do this if we also don't have any text tracks set as "showing". The second issue was when trying to select "Automatic (Recommended)" when a text track had been marked as "showing" with the JS API. Calling `setSelectedTextTrack()` on MediaControlsHost in this case was not sufficient because HTMLMediaElement::setSelectedTextTrack is a no-op if the automatic text track is provided but captionDisplayMode is still set to "automatic". To address this, we first disable all text tracks before calling `setSelectedTextTrack()`. * Modules/modern-media-controls/media/tracks-support.js: (TracksSupport.prototype.tracksPanelIsTrackInSectionSelected): (TracksSupport.prototype.tracksPanelSelectionDidChange): 2020-05-04 Zalan Bujtas <zalan@apple.com> [LFC][TFC] Override the table computed height when content needs more space https://bugs.webkit.org/show_bug.cgi?id=211367 Reviewed by Antti Koivisto. * layout/FormattingContextGeometry.cpp: (WebCore::Layout::FormattingContext::Geometry::contentHeightForFormattingContextRoot const): * layout/blockformatting/BlockFormattingContextGeometry.cpp: (WebCore::Layout::BlockFormattingContext::Geometry::inFlowHeightAndMargin): 2020-05-04 Zalan Bujtas <zalan@apple.com> [LFC][TFC] Use distributeAvailableSpace for row sizing https://bugs.webkit.org/show_bug.cgi?id=211366 Reviewed by Antti Koivisto. Switch over to the generic space distribution for table row sizing. * layout/tableformatting/TableFormattingContext.cpp: (WebCore::Layout::RowSpan::hasSpan): (WebCore::Layout::RowSpan::isSpanned): (WebCore::Layout::RowSpan::spanCount): (WebCore::Layout::RowSpan::startSpan): (WebCore::Layout::RowSpan::endSpan): (WebCore::Layout::RowSpan::index): (WebCore::Layout::RowSpan::size): (WebCore::Layout::RowSpan::spacing): (WebCore::Layout::distributeAvailableSpace): (WebCore::Layout::TableFormattingContext::computeAndDistributeExtraVerticalSpace): 2020-05-04 Youenn Fablet <youenn@apple.com> Camera video samples have a bad orientation if upside down https://bugs.webkit.org/show_bug.cgi?id=211373 Reviewed by Eric Carlson. Manually tested on iPad and iPhones. * platform/mediastream/mac/AVVideoCaptureSource.mm: (WebCore::AVVideoCaptureSource::computeSampleRotation): -90 should be the same as 270 not -270. 2020-05-04 Yusuke Suzuki <ysuzuki@apple.com> [gtk] isMainThread() assert when running minibrowser in debug builds. https://bugs.webkit.org/show_bug.cgi?id=211355 Reviewed by Mark Lam. Using NeverDestroyed<const AtomString> is discouraged if it is in the non main thread. This can be quite easily wrong: if the running thread is one of WorkerPool, then this is wrong since AtomStringTable will be destroyed every time underlying Thread is shutdown. If this is invoked by AutomaticThread, this is also wrong due to the same reason etc. This is why we introduced MainThreadNeverDestroyed and use it for const AtomString. This restriction found the bug that we are using `NeverDestroyed<const AtomString>` in non main thread. We should not do that. This patch fixes the issue by introducing TextureMapperShaderProgram::Variable instead of using AtomString. Then this code no longer has thread affinity. * platform/graphics/texmap/TextureMapperShaderProgram.cpp: (WebCore::TextureMapperShaderProgram::getLocation): Deleted. * platform/graphics/texmap/TextureMapperShaderProgram.h: 2020-05-04 Emilio Cobos Álvarez <emilio@crisal.io> Put lh / rlh units behind a flag until bug 211351 is sorted out. https://bugs.webkit.org/show_bug.cgi?id=211356 Reviewed by Antti Koivisto. * css/parser/CSSParserToken.cpp: Use the new runtime flag to disable parsing the units. (WebCore::cssPrimitiveValueUnitFromTrie): * page/RuntimeEnabledFeatures.h: Define the new runtime flag. (WebCore::RuntimeEnabledFeatures::setLineHeightUnitsEnabled): (WebCore::RuntimeEnabledFeatures::lineHeightUnitsEnabled const): 2020-05-03 David Kilzer <ddkilzer@apple.com> Use LocalCurrentGraphicsContext in WebKit::convertPlatformImageToBitmap() <https://webkit.org/b/211274> Reviewed by Darin Adler. * platform/mac/LocalCurrentGraphicsContext.h: (WebCore::LocalCurrentGraphicsContext::LocalCurrentGraphicsContext): (WebCore::LocalCurrentGraphicsContext::~LocalCurrentGraphicsContext): - Export methods for use in WebKit. 2020-05-03 David Kilzer <ddkilzer@apple.com> Fix static analyzer false positive in -[WebUndefined undefined] <https://webkit.org/b/211353> Reviewed by Darin Adler. * bridge/objc/WebScriptObject.mm: (+[WebUndefined allocWithZone:]): (-[WebUndefined initWithCoder:]): (-[WebUndefined retain]): (-[WebUndefined autorelease]): - Update method signatures. (+[WebUndefined undefined]): - Fix clang static analyzer false positive by using idiomatic -alloc, -init calls to create object. These methods call -allocWithZone:, so this still uses the singleton pattern. 2020-05-03 Daniel Bates <dabates@apple.com> Sometimes cannot find <textarea> in list of editable elements https://bugs.webkit.org/show_bug.cgi?id=211348 <rdar://problem/62231067> Reviewed by Simon Fraser. When building the editable region add the bounds of the text control to the region instead of the bounds of its inner text element even though it is the latter that is actually editable. Using the bounds of the text control is more in line with a user's expectation for the editable portion of a text control: the entire control. So, do that. Tests: editing/editable-region/hit-test-textarea-empty-space.html editing/editable-region/search-field-basic.html editing/editable-region/text-field-basic.html editing/editable-region/textarea-basic.html * rendering/EventRegion.cpp: (WebCore::EventRegionContext::unite): (WebCore::EventRegion::unite): Add a new bool as to whether to override the user-modify check and just assume that the region is for something editable. This is needed because the form control (e.g. the <input> or <textarea> aka the shadow host element) isn't actually editable itself. Its inner text element is editable. RenderBlock::paintObject() will pass true for this override when event region painting such a control and the control's inner text element is editable so that the controls bounds are added to the editable region. * rendering/EventRegion.h: Add a bool, defaulting to false to keep the current behavior. While I am here remove some unneeded WEBCORE_EXPORT attributions. * rendering/RenderBlock.cpp: (WebCore::RenderBlock::paintObject): Pass a value for the override argument. It will be true if this block is actually a text control and its inner text element is editable. Otherwise, it will be false. There is also no longer a need to descend into the children of a text control because I only care to record the bounds of the control itself as editable, not its inner text element. 2020-05-03 Zalan Bujtas <zalan@apple.com> [LFC][TFC] Turns horizontal space distribution into a generic space distribution https://bugs.webkit.org/show_bug.cgi?id=211352 Reviewed by Antti Koivisto. Horizontal(column) and vertical(row) space distributions use essentially the same logic to distribute the extra space among the columns/rows. This patch turns the horizontal space distribution function into a generic space distribution code so that we can use it for row sizing as well. * layout/tableformatting/TableFormattingContext.cpp: (WebCore::Layout::ColumnSpan::hasSpan): (WebCore::Layout::ColumnSpan::isSpanned): (WebCore::Layout::ColumnSpan::spanCount): (WebCore::Layout::ColumnSpan::startSpan): (WebCore::Layout::ColumnSpan::endSpan): (WebCore::Layout::ColumnSpan::index): (WebCore::Layout::ColumnSpan::size): (WebCore::Layout::ColumnSpan::spacing): (WebCore::Layout::distributeAvailableSpace): (WebCore::Layout::TableFormattingContext::computeAndDistributeExtraHorizontalSpace): * layout/tableformatting/TableGrid.h: (WebCore::Layout::TableGrid::slot const): 2020-05-03 Youenn Fablet <youenn@apple.com> AudioMediaStreamTrackRendererCocoa should create/start/stop its remote unit on the main thread https://bugs.webkit.org/show_bug.cgi?id=211287 Reviewed by Eric Carlson. Creating/starting/stopping audio units in different threads is error prone. Now that we have an observer model where we have observers for when to play in the main thread and based on that, we decide to receive audio samples in a background thread, we can simplify the logic of AudioMediaStreamTrackRendererCocoa. We do this by creating/starting the unit in AudioMediaStreamTrackRendererCocoa::start. At that point, AudioMediaStreamTrackRendererCocoa is not expected to receive any sample. Just after starting, AudioTrackPrivateMediaStream will receive audio samples and forward them to AudioMediaStreamTrackRendererCocoa. AudioMediaStreamTrackRendererCocoa will then create in a background thread the AudioSampleDataSource that is responsible to adapt the received audio samples to the unit. Manually tested. * platform/audio/mac/AudioSampleDataSource.h: (WebCore::AudioSampleDataSource::inputDescription const): * platform/audio/mac/CAAudioStreamDescription.h: * platform/mediastream/AudioTrackPrivateMediaStream.cpp: (WebCore::AudioTrackPrivateMediaStream::startRenderer): Ensure to start the unit and then start gettting audio samples. * platform/mediastream/mac/AudioMediaStreamTrackRendererCocoa.cpp: (WebCore::AudioMediaStreamTrackRendererCocoa::start): (WebCore::AudioMediaStreamTrackRendererCocoa::stop): (WebCore::AudioMediaStreamTrackRendererCocoa::clear): (WebCore::AudioMediaStreamTrackRendererCocoa::pushSamples): (WebCore::AudioMediaStreamTrackRendererCocoa::render): * platform/mediastream/mac/AudioMediaStreamTrackRendererCocoa.h: 2020-05-03 Rob Buis <rbuis@igalia.com> atob() should not accept a vertical tab https://bugs.webkit.org/show_bug.cgi?id=184529 Reviewed by Darin Adler. The forgiving-base64 decode algorithm [1] uses [2] to strip out ASCII whitespace which does not include vertical tabs, so change the atob() implementation to not strip out vertical tabs and thus to fail decode on vertical tabs. [1] https://infra.spec.whatwg.org/#forgiving-base64-decode [2] https://infra.spec.whatwg.org/#ascii-whitespace Behavior matches Firefox and Chrome. * page/Base64Utilities.cpp: (WebCore::Base64Utilities::atob): * platform/network/DataURLDecoder.cpp: (WebCore::DataURLDecoder::decodeBase64): 2020-05-02 Simon Fraser <simon.fraser@apple.com> Add a log channel for OverlayScrollbars https://bugs.webkit.org/show_bug.cgi?id=211329 Reviewed by Zalan Bujtas. Overlay scrollbar behavior is opaque. This log channel will add clarity. * platform/Logging.h: * platform/mac/ScrollAnimatorMac.mm: (operator<<): (-[WebScrollbarPartAnimation initWithScrollbar:featureToAnimate:animateFrom:animateTo:duration:]): (-[WebScrollbarPartAnimation startAnimation]): (-[WebScrollbarPartAnimation setCurrentProgress:setCurrentProgress:]): (WebCore::ScrollAnimatorMac::mouseEnteredContentArea): (WebCore::ScrollAnimatorMac::mouseExitedContentArea): (WebCore::ScrollAnimatorMac::mouseMovedInContentArea): (WebCore::ScrollAnimatorMac::didBeginScrollGesture const): (WebCore::ScrollAnimatorMac::didEndScrollGesture const): (WebCore::ScrollAnimatorMac::mayBeginScrollGesture const): (WebCore::ScrollAnimatorMac::handleWheelEventPhase): 2020-05-02 Simon Fraser <simon.fraser@apple.com> Make it possible to test overlay scrollbar interactions https://bugs.webkit.org/show_bug.cgi?id=211342 Reviewed by Daniel Bates. Add internals.horizontalScrollbarState() and internals.verticalScrollbarState() and hook them up via ScrollableArea to ScrollAnimatorMac. They dump state based on the NSScrollerImp state. Make internals.setUsesOverlayScrollbars(true) actually trigger real overlay scrollbars by notifying the ScrollbarTheme about the scrollbar style change. Tests: fast/scrolling/mac/scrollbars/overlay-scrollbar-hovered.html fast/scrolling/mac/scrollbars/overlay-scrollbar-reveal.html fast/scrolling/mac/scrollbars/overlay-scrollbar-state.html fast/scrolling/mac/scrollbars/scrollbar-state.html * platform/ScrollAnimator.h: (WebCore::ScrollAnimator::ScrollAnimator::horizontalScrollbarStateForTesting const): (WebCore::ScrollAnimator::ScrollAnimator::verticalScrollbarStateForTesting const): * platform/ScrollableArea.cpp: (WebCore::ScrollableArea::horizontalScrollbarStateForTesting const): (WebCore::ScrollableArea::verticalScrollbarStateForTesting const): * platform/ScrollableArea.h: * platform/mac/NSScrollerImpDetails.h: * platform/mac/ScrollAnimatorMac.h: * platform/mac/ScrollAnimatorMac.mm: (WebCore::scrollbarState): (WebCore::ScrollAnimatorMac::horizontalScrollbarStateForTesting const): (WebCore::ScrollAnimatorMac::verticalScrollbarStateForTesting const): * testing/Internals.cpp: (WebCore:: const): (WebCore::Internals::scrollbarOverlayStyle const): (WebCore::Internals::scrollbarUsingDarkAppearance const): (WebCore::Internals::horizontalScrollbarState const): (WebCore::Internals::verticalScrollbarState const): (WebCore::Internals::setUsesOverlayScrollbars): * testing/Internals.h: * testing/Internals.idl: 2020-05-02 Daniel Bates <dabates@apple.com> Page::editableElementsInRect() should return root editable elements https://bugs.webkit.org/show_bug.cgi?id=211343 <rdar://problem/60015801> Reviewed by Simon Fraser. Return the root editable element for each non-text form control editable element inside the search rect as it may not have been hit itself. This can happen if the search rect is small enough to intersect only child elements of the root editable elements. * page/Page.cpp: (WebCore::Page::editableElementsInRect const): (WebCore::isEditableTextInputElement): Deleted. 2020-05-02 Simon Fraser <simon.fraser@apple.com> scrollableAreaForScrollingNodeID() gives the wrong answer for the FrameView https://bugs.webkit.org/show_bug.cgi?id=211310 Reviewed by Zalan Bujtas. Given the FrameView's scrollingNodeID, RenderLayerCompositor::scrollableAreaForScrollingNodeID() would return the RenderView's layer when it should return the FrameView itself. Fixing this allows removal of a special-case in setActiveScrollSnapIndices(). No behavior change. * page/scrolling/AsyncScrollingCoordinator.cpp: (WebCore::AsyncScrollingCoordinator::setActiveScrollSnapIndices): * rendering/RenderLayerCompositor.cpp: (WebCore::RenderLayerCompositor::scrollableAreaForScrollingNodeID const): 2020-05-02 Simon Fraser <simon.fraser@apple.com> handleWheelEventPhase() should include the relevant ScrollingNodeID https://bugs.webkit.org/show_bug.cgi?id=211315 Reviewed by Tim Horton. handleWheelEventPhase() is used to send information about wheel event phases to the main thread, which make their way to ScrollAnimatorMac::handleWheelEventPhase() and are used to update the state of overlay scrollbars. In order to talk to the correct set of scrollbars with overflow:scroll, we need to send along the ScrollingNodeID and map that to the appropriate ScrollableArea. Will be tested by future overlay scrollbar tests. * page/scrolling/AsyncScrollingCoordinator.cpp: (WebCore::AsyncScrollingCoordinator::handleWheelEventPhase): * page/scrolling/AsyncScrollingCoordinator.h: * page/scrolling/ScrollingCoordinator.cpp: (WebCore::ScrollingCoordinator::handleWheelEventPhase): Deleted. * page/scrolling/ScrollingCoordinator.h: (WebCore::ScrollingCoordinator::handleWheelEventPhase): * page/scrolling/ScrollingTree.h: * page/scrolling/ThreadedScrollingTree.cpp: (WebCore::ThreadedScrollingTree::handleWheelEventPhase): * page/scrolling/ThreadedScrollingTree.h: * page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.mm: (WebCore::ScrollingTreeFrameScrollingNodeMac::handleWheelEvent): * page/scrolling/mac/ScrollingTreeOverflowScrollingNodeMac.mm: (WebCore::ScrollingTreeOverflowScrollingNodeMac::handleWheelEvent): * platform/mac/ScrollAnimatorMac.mm: 2020-05-02 Devin Rousso <drousso@apple.com> [CSS Easing 1] implement `jump-*` step positions https://bugs.webkit.org/show_bug.cgi?id=211271 Reviewed by Dean Jackson. Add support for `jump-start`, `jump-end`, `jump-none`, and `jump-both` step positions inside the `steps()` CSS timing function <https://drafts.csswg.org/css-easing-1/#step-position>. Adjust existing serialization logic to match the spec <https://drafts.csswg.org/css-easing-1/#serialization>: - omit `end` (and `jump-end`) - the value `step-start` should result in `steps(1, start)` instead of `step-start` - the value `step-end` should result in `steps(1)` instead of `step-end` Tests: animations/computed-style.html fast/css/animation-steps-calculated-value.html transitions/transitions-parsing.html web-platform-tests/css/css-animations/parsing/animation-timing-function-computed.html web-platform-tests/css/css-animations/parsing/animation-timing-function-valid.html web-platform-tests/css/css-easing/step-timing-functions-output.html web-platform-tests/css/css-easing/step-timing-functions-syntax.html web-platform-tests/css/css-transitions/parsing/transition-timing-function-computed.html web-platform-tests/css/css-transitions/parsing/transition-timing-function-valid.html web-platform-tests/web-animations/timing-model/time-transformations/transformed-progress.html * css/CSSValueKeywords.in: * css/parser/CSSPropertyParser.cpp: (WebCore::consumeSteps): (WebCore::consumeAnimationTimingFunction): * css/CSSComputedStyleDeclaration.cpp: (WebCore::createTimingFunctionValue): * css/CSSToStyleMap.cpp: (WebCore::CSSToStyleMap::mapAnimationTimingFunction): * css/CSSTimingFunctionValue.h: (WebCore::CSSStepsTimingFunctionValue::create): (WebCore::CSSStepsTimingFunctionValue::stepPosition const): Added. (WebCore::CSSStepsTimingFunctionValue::CSSStepsTimingFunctionValue): (WebCore::CSSStepsTimingFunctionValue::stepAtStart const): Deleted. * css/CSSTimingFunctionValue.cpp: (WebCore::CSSStepsTimingFunctionValue::customCSSText const): (WebCore::CSSStepsTimingFunctionValue::equals const): * platform/animation/TimingFunction.h: (WebCore::StepsTimingFunction::create): (WebCore::StepsTimingFunction::StepsTimingFunction): (WebCore::StepsTimingFunction::stepPosition): Added. (WebCore::StepsTimingFunction::setStepPosition): Added. (WebCore::StepsTimingFunction::clone): (WebCore::StepsTimingFunction::stepAtStart): Deleted. (WebCore::StepsTimingFunction::setStepAtStart): Deleted. * platform/animation/TimingFunction.cpp: (WebCore::operator<<): (WebCore::TimingFunction::transformTime): (WebCore::TimingFunction::createFromCSSValue): (WebCore::TimingFunction::cssText const): 2020-05-01 Tim Horton <timothy_horton@apple.com> Books sometimes ends up with blank pages, especially after adjusting font size https://bugs.webkit.org/show_bug.cgi?id=211265 <rdar://problem/59898144> Reviewed by Darin Adler. * page/FrameView.cpp: (WebCore::FrameView::setViewExposedRect): Rename "hasRectChanged" because it only tests if the optional-state of the rect has changed, not the actual value. 2020-05-01 Wenson Hsieh <wenson_hsieh@apple.com> Text manipulation should observe the value attribute of some input elements https://bugs.webkit.org/show_bug.cgi?id=211307 <rdar://problem/61568528> Reviewed by Darin Adler. Teach TextManipulationController to detect the `value` attribute in input elements of type "button" and "submit". To do this, we plumb the element through to `isAttributeForTextManipulation` and check `isTextButton()` if "value" attribute is being considered. Test: TextManipulation.StartTextManipulationExtractsValuesFromButtonInputs * editing/TextManipulationController.cpp: (WebCore::isAttributeForTextManipulation): (WebCore::TextManipulationController::observeParagraphs): 2020-05-01 Chris Dumez <cdumez@apple.com> Regression(r259036) Unable to post comments on Jira https://bugs.webkit.org/show_bug.cgi?id=211122 <rdar://problem/62561879> Unreviewed, revert r259036 as the new behavior does not match other browsers and broke some Jira instances. * loader/FormSubmission.cpp: (WebCore::FormSubmission::populateFrameLoadRequest): * loader/FrameLoader.cpp: (WebCore::FrameLoader::addExtraFieldsToRequest): (WebCore::FrameLoader::addHTTPOriginIfNeeded): (WebCore::FrameLoader::loadResourceSynchronously): (WebCore::FrameLoader::loadDifferentDocumentItem): * loader/FrameLoader.h: * loader/NavigationScheduler.cpp: * loader/PingLoader.cpp: (WebCore::PingLoader::sendPing): * loader/SubresourceLoader.cpp: (WebCore::SubresourceLoader::checkRedirectionCrossOriginAccessControl): * loader/cache/CachedResourceRequest.cpp: (WebCore::CachedResourceRequest::updateReferrerAndOriginHeaders): * platform/network/ResourceRequestBase.cpp: (WebCore::doesRequestNeedHTTPOriginHeader): Deleted. * platform/network/ResourceRequestBase.h: 2020-05-01 Jack Lee <shihchieh_lee@apple.com> Unreviewed, amend change log entry for r260831. * ChangeLog: 2020-05-01 Chris Dumez <cdumez@apple.com> Unreviewed, another build fix after r260962. * page/Page.h: 2020-05-01 Daniel Bates <dabates@apple.com> Avoid unnecessary copying in AnimationTimeline and other clean ups https://bugs.webkit.org/show_bug.cgi?id=211309 Reviewed by Simon Fraser. Return animations by const lvalue ref to avoid copying the Vectors. Default the constructor and destructor implementations. Remove an unnessary argument name from animationsForElement() and re-arrange decls to make class definition more idiomatic. * animation/AnimationTimeline.cpp: (WebCore::AnimationTimeline::AnimationTimeline): Deleted. (WebCore::AnimationTimeline::~AnimationTimeline): Deleted. * animation/AnimationTimeline.h: (WebCore::AnimationTimeline::relevantAnimations const): (WebCore::AnimationTimeline::allAnimations const): 2020-05-01 Daniel Bates <dabates@apple.com> Change HitTestResult::NodeSet from set of RefPtrs to set of Refs https://bugs.webkit.org/show_bug.cgi?id=211306 Reviewed by Simon Fraser. HitTestResult::listBasedTestResult() never returns a set with nullptrs in it. So, change the set declaration from ListHashSet<RefPtr<Node>> to ListHashSet<Ref<Node>>. This way people are not tempted to unnecessarily null check the nodes in the set. As I made this change to TreeScope::elementsFromPoint() I noticed that retargetToScope(), which is called by it, returned a Node&. So, I changed it to return a Ref<Node>. That required me to fix up caretRangeFromPoint(), which lead me to fix up nodeFromPoint() as well. * dom/Document.cpp: (WebCore::Document::caretRangeFromPoint): * dom/EventPath.cpp: (WebCore::RelatedNodeRetargeter::checkConsistency): * dom/TreeScope.cpp: (WebCore::TreeScope::retargetToScope const): (WebCore::TreeScope::nodeFromPoint): (WebCore::TreeScope::elementFromPoint): (WebCore::TreeScope::elementsFromPoint): * dom/TreeScope.h: * page/Page.cpp: (WebCore::Page::editableElementsInRect const): * rendering/HitTestResult.cpp: (WebCore::appendToNodeSet): (WebCore::HitTestResult::HitTestResult): (WebCore::HitTestResult::operator=): (WebCore::HitTestResult::addNodeToListBasedTestResultCommon): (WebCore::HitTestResult::append): * rendering/HitTestResult.h: * testing/Internals.cpp: (WebCore::Internals::nodesFromRect const): 2020-05-01 Chris Dumez <cdumez@apple.com> Unreviewed build fix after r260962. * page/Page.cpp: (WebCore::Page::setCORSDisablingPatterns): * page/Page.h: (WebCore::Page::setCORSDisablingPatterns): Deleted. 2020-05-01 Kenneth Russell <kbr@chromium.org> [WebGL2] Refactor texImage2D and texSubImage2D taking ImageBitmap, ImageData, Image, ArrayBufferView https://bugs.webkit.org/show_bug.cgi?id=210766 Reviewed by Dean Jackson. Refactor the texture upload paths taking DOM sources and ArrayBuffers so that texImage/texSubImage and 2D/3D textures are handled with the same entry point. Hook up WebGL 2.0 pixel unpack parameters for selecting sub-rectangles during texture uploads. Refactor context initialization to support WebGL 2.0-specific code paths. Remove duplicate code validating the type of the ArrayBufferView passed to readPixels that was added in the patch for Bug 209515, and validation code subsumed by ANGLE. With this patch, dozens more texture-related WebGL 2.0 conformance tests are passing completely, including all of those under the directories: webgl/2.0.0/conformance2/textures/ canvas_sub_rectangle/ image_data/ The svg_image/ tests in this directory demonstrate browser inconsistencies in SVG handling, and are temporarily skipped. These will be investigated in Bug 211220. Other conformance tests progress or change results, which is expected until WebGL2RenderingContext is fully implemented. * html/canvas/WebGL2RenderingContext.cpp: (WebCore::WebGL2RenderingContext::create): (WebCore::WebGL2RenderingContext::WebGL2RenderingContext): (WebCore::WebGL2RenderingContext::initializeNewContext): (WebCore::WebGL2RenderingContext::resetUnpackParameters): (WebCore::WebGL2RenderingContext::restoreUnpackParameters): (WebCore::WebGL2RenderingContext::initializeShaderExtensions): (WebCore::WebGL2RenderingContext::getTextureSourceSubRectangle): (WebCore::WebGL2RenderingContext::pixelStorei): (WebCore::WebGL2RenderingContext::texStorage2D): (WebCore::WebGL2RenderingContext::texImage2D): (WebCore::WebGL2RenderingContext::texImage3D): (WebCore::WebGL2RenderingContext::texSubImage2D): (WebCore::WebGL2RenderingContext::texSubImage3D): (WebCore::WebGL2RenderingContext::initializeTransformFeedbackBufferCache): Deleted. (WebCore::WebGL2RenderingContext::initializeSamplerCache): Deleted. (WebCore::WebGL2RenderingContext::sliceTypedArrayBufferView): Deleted. * html/canvas/WebGL2RenderingContext.h: * html/canvas/WebGLRenderingContext.cpp: (WebCore::WebGLRenderingContext::create): (WebCore::WebGLRenderingContext::WebGLRenderingContext): * html/canvas/WebGLRenderingContextBase.cpp: (WebCore::ScopedUnpackParametersResetRestore::ScopedUnpackParametersResetRestore): (WebCore::ScopedUnpackParametersResetRestore::~ScopedUnpackParametersResetRestore): (WebCore::WebGLRenderingContextBase::WebGLRenderingContextBase): (WebCore::WebGLRenderingContextBase::initializeNewContext): (WebCore::WebGLRenderingContextBase::resetUnpackParameters): (WebCore::WebGLRenderingContextBase::restoreUnpackParameters): (WebCore::WebGLRenderingContextBase::compressedTexImage2D): (WebCore::WebGLRenderingContextBase::compressedTexSubImage2D): (WebCore::WebGLRenderingContextBase::validateSettableTexInternalFormat): (WebCore::WebGLRenderingContextBase::copyTexSubImage2D): (WebCore::WebGLRenderingContextBase::generateMipmap): (WebCore::WebGLRenderingContextBase::getTexParameter): (WebCore::WebGLRenderingContextBase::readPixels): (WebCore::WebGLRenderingContextBase::sentinelEmptyRect): (WebCore::WebGLRenderingContextBase::safeGetImageSize): (WebCore::WebGLRenderingContextBase::getImageDataSize): (WebCore::WebGLRenderingContextBase::getTexImageSourceSize): (WebCore::WebGLRenderingContextBase::texImageSourceHelper): (WebCore::WebGLRenderingContextBase::texImageArrayBufferViewHelper): (WebCore::WebGLRenderingContextBase::texImageImpl): (WebCore::WebGLRenderingContextBase::texImage2DBase): (WebCore::WebGLRenderingContextBase::texSubImage2DBase): (WebCore::WebGLRenderingContextBase::getTexImageFunctionName): (WebCore::WebGLRenderingContextBase::validateTexFunc): (WebCore::WebGLRenderingContextBase::texImage2D): (WebCore::WebGLRenderingContextBase::texSubImage2D): (WebCore::WebGLRenderingContextBase::validateArrayBufferType): (WebCore::WebGLRenderingContextBase::validateTexFuncData): (WebCore::WebGLRenderingContextBase::validateTexFuncParameters): (WebCore::WebGLRenderingContextBase::addExtensionSupportedFormatsAndTypes): (WebCore::WebGLRenderingContextBase::addExtensionSupportedFormatsAndTypesWebGL2): (WebCore::WebGLRenderingContextBase::validateTexImageSourceFormatAndType): (WebCore::WebGLRenderingContextBase::copyTexImage2D): (WebCore::WebGLRenderingContextBase::drawImageIntoBuffer): (WebCore::WebGLRenderingContextBase::texParameter): (WebCore::WebGLRenderingContextBase::getUnpackPixelStoreParams const): (WebCore::WebGLRenderingContextBase::validateTextureBinding): (WebCore::WebGLRenderingContextBase::validateTexImageBinding): (WebCore::WebGLRenderingContextBase::validateTexture2DBinding): (WebCore::WebGLRenderingContextBase::validateSize): (WebCore::WebGLRenderingContextBase::validateImageBitmap): (WebCore::WebGLRenderingContextBase::maybeRestoreContext): (WebCore::WebGLRenderingContextBase::texImageSource2D): Deleted. (WebCore::WebGLRenderingContextBase::texImage2DImpl): Deleted. (WebCore::WebGLRenderingContextBase::texSubImage2DImpl): Deleted. * html/canvas/WebGLRenderingContextBase.h: (WebCore::WebGLRenderingContextBase::getTextureSourceSize): (WebCore::WebGLRenderingContextBase::validateTexImageSubRectangle): * platform/graphics/IntRect.cpp: (WebCore::IntRect::isValid const): * platform/graphics/IntRect.h: 2020-05-01 Jack Lee <shihchieh_lee@apple.com> Nullptr crash in CompositeEditCommand::cloneParagraphUnderNewElement when indent and align a paragraph. https://bugs.webkit.org/show_bug.cgi?id=211273 <rdar://problem/61885958> Reviewed by Geoffrey Garen. A load event can fire when we clone and append a paragraph. Check if the elements are removed in the event and bail out. Test: fast/editing/indent-then-justifyFull-crash.html * editing/CompositeEditCommand.cpp: (WebCore::CompositeEditCommand::cloneParagraphUnderNewElement): 2020-05-01 Jack Lee <shihchieh_lee@apple.com> Nullptr crash in EditCommand::EditCommand via CompositeEditCommand::removeNode https://bugs.webkit.org/show_bug.cgi?id=207600 <rdar://problem/56969450> Reviewed by Geoffrey Garen. Second part of the fix. Remove m_frame in FrameSelection so it will not be inadvertently used and cause this crash. No new tests, covered by existing test. * editing/AlternativeTextController.cpp: (WebCore::AlternativeTextController::rootViewRectForRange const): * editing/FrameSelection.cpp: (WebCore::FrameSelection::FrameSelection): (WebCore::FrameSelection::setSelectionWithoutUpdatingAppearance): (WebCore::FrameSelection::modify): (WebCore::FrameSelection::selectFrameElementInParentIfFullySelected): (WebCore::FrameSelection::setFocusedElementIfNeeded): (WebCore::FrameSelection::shouldDeleteSelection const): (WebCore::FrameSelection::shouldDeleteSelection): (WebCore::FrameSelection::revealSelection): (WebCore::FrameSelection:: shouldChangeSelection): (WebCore::FrameSelection::shouldChangeSelection const): * editing/FrameSelection.h: * editing/atk/FrameSelectionAtk.cpp: (WebCore::FrameSelection::notifyAccessibilityForSelectionChange): * editing/mac/FrameSelectionMac.mm: (WebCore::FrameSelection::notifyAccessibilityForSelectionChange): 2020-05-01 Darin Adler <darin@apple.com> REGRESSION (r260739): Crash when pasting into Mail https://bugs.webkit.org/show_bug.cgi?id=211311 Reviewed by Wenson Hsieh. Speculative fix. Would be much better to create a test case demonstrating it's correct. * editing/cocoa/HTMLConverter.mm: (WebCore::editingAttributedString): Use container node when TextIterator::node returns null. 2020-05-01 Don Olmstead <don.olmstead@sony.com> [GTK] Add additional exports to support hidden visibility https://bugs.webkit.org/show_bug.cgi?id=211246 Reviewed by Michael Catanzaro. * platform/ContentType.h: * platform/graphics/cairo/RefPtrCairo.h: * platform/gtk/GtkUtilities.h: * platform/network/soup/CertificateInfo.h: * platform/network/soup/SoupNetworkSession.h: 2020-05-01 Yusuke Suzuki <ysuzuki@apple.com> Introduce MainThreadNeverDestroyed / MainThreadLazyNeverDestroyed https://bugs.webkit.org/show_bug.cgi?id=211264 Reviewed by Mark Lam. No behavior change. Adding assertions additionally. * Modules/airplay/WebKitPlaybackTargetAvailabilityEvent.cpp: (WebCore::stringForPlaybackTargetAvailability): * Modules/encryptedmedia/InitDataRegistry.cpp: (WebCore::InitDataRegistry::cencName): (WebCore::InitDataRegistry::keyidsName): (WebCore::InitDataRegistry::webmName): * Modules/mediacontrols/MediaControlsHost.cpp: (WebCore::MediaControlsHost::automaticKeyword): (WebCore::MediaControlsHost::forcedOnlyKeyword): (WebCore::alwaysOnKeyword): (WebCore::manualKeyword): * Modules/mediastream/MediaStreamTrack.cpp: (WebCore::MediaStreamTrack::kind const): (WebCore::MediaStreamTrack::contentHint const): * Modules/mediastream/RTCDataChannel.cpp: (WebCore::blobKeyword): (WebCore::arraybufferKeyword): * accessibility/AccessibilityRenderObject.cpp: (WebCore::AccessibilityRenderObject::liveRegionRelevant const): * dom/ConstantPropertyMap.cpp: (WebCore::ConstantPropertyMap::nameForProperty const): * dom/Document.cpp: (WebCore::Document::validateCustomElementName): * dom/InlineStyleSheetOwner.cpp: (WebCore::isValidCSSContentType): * dom/MutationRecord.cpp: * dom/make_names.pl: (printNamesHeaderFile): (printNamesCppFile): * html/Autocapitalize.cpp: (WebCore::stringForAutocapitalizeType): * html/Autofill.cpp: (WebCore::isContactToken): (WebCore::AutofillData::createFromHTMLFormControlElement): * html/BaseCheckableInputType.cpp: (WebCore::BaseCheckableInputType::fallbackValue const): * html/BaseChooserOnlyDateAndTimeInputType.cpp: (WebCore::BaseChooserOnlyDateAndTimeInputType::createShadowSubtree): * html/ColorInputType.cpp: (WebCore::ColorInputType::createShadowSubtree): * html/FileInputType.cpp: (WebCore::UploadButtonElement::UploadButtonElement): * html/FormController.cpp: (WebCore::FormKeyGenerator::formKey): * html/HTMLAnchorElement.cpp: (WebCore::HTMLAnchorElement::parseAttribute): (WebCore::HTMLAnchorElement::isSystemPreviewLink const): * html/HTMLButtonElement.cpp: (WebCore::HTMLButtonElement::formControlType const): * html/HTMLDetailsElement.cpp: (WebCore::summarySlotName): * html/HTMLElement.cpp: (WebCore::toValidDirValue): (WebCore::trueName): (WebCore::falseName): (WebCore::plaintextOnlyName): (WebCore::HTMLElement::setAutocorrect): * html/HTMLFieldSetElement.cpp: (WebCore::HTMLFieldSetElement::formControlType const): * html/HTMLFormElement.cpp: (WebCore::HTMLFormElement::autocomplete const): * html/HTMLImageElement.cpp: (WebCore::HTMLImageElement::loadingForBindings const): * html/HTMLKeygenElement.cpp: (WebCore::HTMLKeygenElement::formControlType const): * html/HTMLOptGroupElement.cpp: (WebCore::HTMLOptGroupElement::formControlType const): * html/HTMLOutputElement.cpp: (WebCore::HTMLOutputElement::formControlType const): * html/HTMLPlugInImageElement.cpp: (WebCore::HTMLPlugInImageElement::partOfSnapshotOverlay const): * html/HTMLSelectElement.cpp: (WebCore::HTMLSelectElement::formControlType const): * html/HTMLTableCellElement.cpp: (WebCore::HTMLTableCellElement::scope const): * html/HTMLTextAreaElement.cpp: (WebCore::HTMLTextAreaElement::formControlType const): * html/HTMLTextFormControlElement.cpp: (WebCore::directionString): (WebCore::HTMLTextFormControlElement::updateInnerTextElementEditability): * html/InputMode.cpp: (WebCore::InputModeNames::none): (WebCore::InputModeNames::text): (WebCore::InputModeNames::tel): (WebCore::InputModeNames::url): (WebCore::InputModeNames::email): (WebCore::InputModeNames::numeric): (WebCore::InputModeNames::decimal): (WebCore::InputModeNames::search): * html/InputTypeNames.cpp: (WebCore::InputTypeNames::button): (WebCore::InputTypeNames::checkbox): (WebCore::InputTypeNames::color): (WebCore::InputTypeNames::date): (WebCore::InputTypeNames::datetime): (WebCore::InputTypeNames::datetimelocal): (WebCore::InputTypeNames::email): (WebCore::InputTypeNames::file): (WebCore::InputTypeNames::hidden): (WebCore::InputTypeNames::image): (WebCore::InputTypeNames::month): (WebCore::InputTypeNames::number): (WebCore::InputTypeNames::password): (WebCore::InputTypeNames::radio): (WebCore::InputTypeNames::range): (WebCore::InputTypeNames::reset): (WebCore::InputTypeNames::search): (WebCore::InputTypeNames::submit): (WebCore::InputTypeNames::telephone): (WebCore::InputTypeNames::text): (WebCore::InputTypeNames::time): (WebCore::InputTypeNames::url): (WebCore::InputTypeNames::week): * html/MediaController.cpp: (WebCore::playbackStateWaiting): (WebCore::playbackStatePlaying): (WebCore::playbackStateEnded): * html/RangeInputType.cpp: (WebCore::RangeInputType::createShadowSubtree): * html/SearchInputType.cpp: (WebCore::updateResultButtonPseudoType): * html/TextFieldInputType.cpp: (WebCore::TextFieldInputType::createShadowSubtree): (WebCore::TextFieldInputType::createDataListDropdownIndicator): (WebCore::TextFieldInputType::createContainer): (WebCore::TextFieldInputType::createAutoFillButton): * html/ValidationMessage.cpp: (WebCore::ValidationMessage::buildBubbleTree): * html/shadow/DetailsMarkerControl.cpp: (WebCore::DetailsMarkerControl::DetailsMarkerControl): * html/shadow/MediaControlTextTrackContainerElement.cpp: (WebCore::MediaControlTextTrackContainerElement::MediaControlTextTrackContainerElement): * html/shadow/ProgressShadowElement.cpp: (WebCore::ProgressInnerElement::create): (WebCore::ProgressBarElement::create): (WebCore::ProgressValueElement::create): * html/shadow/SliderThumbElement.cpp: (WebCore::SliderThumbElement::resolveCustomStyle): (WebCore::SliderContainerElement::resolveCustomStyle): * html/shadow/SpinButtonElement.cpp: (WebCore::SpinButtonElement::SpinButtonElement): * html/shadow/TextControlInnerElements.cpp: (WebCore::TextControlPlaceholderElement::TextControlPlaceholderElement): (WebCore::SearchFieldCancelButtonElement::SearchFieldCancelButtonElement): * html/shadow/YouTubeEmbedShadowElement.cpp: (WebCore::YouTubeEmbedShadowElement::YouTubeEmbedShadowElement): * html/shadow/mac/ImageControlsButtonElementMac.cpp: (WebCore::ImageControlsButtonElementMac::tryCreate): * html/shadow/mac/ImageControlsRootElementMac.cpp: (WebCore::ImageControlsRootElement::tryCreate): * html/track/AudioTrack.cpp: (WebCore::AudioTrack::alternativeKeyword): (WebCore::AudioTrack::descriptionKeyword): (WebCore::AudioTrack::mainKeyword): (WebCore::AudioTrack::mainDescKeyword): (WebCore::AudioTrack::translationKeyword): (WebCore::AudioTrack::commentaryKeyword): * html/track/TextTrack.cpp: (WebCore::TextTrack::subtitlesKeyword): (WebCore::captionsKeyword): (WebCore::descriptionsKeyword): (WebCore::chaptersKeyword): (WebCore::metadataKeyword): (WebCore::forcedKeyword): * html/track/TextTrackCue.cpp: (WebCore::TextTrackCue::cueShadowPseudoId): (WebCore::TextTrackCue::cueBoxShadowPseudoId): (WebCore::TextTrackCue::cueBackdropShadowPseudoId): (WebCore::TextTrackCue::rebuildDisplayTree): * html/track/VTTRegion.cpp: (WebCore::upKeyword): (WebCore::VTTRegion::textTrackCueContainerScrollingClass): (WebCore::VTTRegion::textTrackCueContainerShadowPseudoId): (WebCore::VTTRegion::textTrackRegionShadowPseudoId): * html/track/VideoTrack.cpp: (WebCore::VideoTrack::alternativeKeyword): (WebCore::VideoTrack::captionsKeyword): (WebCore::VideoTrack::mainKeyword): (WebCore::VideoTrack::signKeyword): (WebCore::VideoTrack::subtitlesKeyword): (WebCore::VideoTrack::commentaryKeyword): * loader/cache/CachedResourceRequest.cpp: (WebCore::CachedResourceRequest::initiatorName const): * page/EventHandler.cpp: (WebCore::focusDirectionForKey): * page/Quirks.cpp: (WebCore::Quirks::shouldBypassBackForwardCache const): * page/animation/CompositeAnimation.cpp: (WebCore::CompositeAnimation::updateKeyframeAnimations): * platform/cocoa/PlaybackSessionModelMediaElement.mm: (WebCore::PlaybackSessionModelMediaElement::eventNameAll): * platform/cocoa/VideoFullscreenModelVideoElement.mm: (WebCore::VideoFullscreenModelVideoElement::eventNameAll): * platform/graphics/FontCache.cpp: (WebCore::FontCache::alternateFamilyName): * platform/graphics/MediaPlayer.cpp: (WebCore::applicationOctetStream): (WebCore::textPlain): * platform/graphics/avfoundation/CDMFairPlayStreaming.cpp: (WebCore::CDMPrivateFairPlayStreaming::sinfName): (WebCore::CDMPrivateFairPlayStreaming::skdName): * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm: (WebCore::metadataType): * platform/graphics/cocoa/FontCacheCoreText.cpp: (WebCore::FontCache::similarFont): (WebCore::FontCache::platformAlternateFamilyName): * platform/graphics/cocoa/SystemFontDatabaseCoreText.cpp: (WebCore::SystemFontDatabaseCoreText::systemFontParameters): * platform/graphics/filters/SourceAlpha.cpp: (WebCore::SourceAlpha::effectName): * platform/graphics/filters/SourceGraphic.cpp: (WebCore::SourceGraphic::effectName): * platform/graphics/ios/FontCacheIOS.mm: (WebCore::FontCache::getCustomFallbackFont): * platform/graphics/texmap/TextureMapperShaderProgram.h: * platform/graphics/win/FontCacheWin.cpp: (WebCore::FontCache::lastResortFallbackFont): (WebCore::FontCache::platformAlternateFamilyName): * platform/network/cocoa/ResourceResponseCocoa.mm: (WebCore::extractHTTPStatusText): * rendering/ComplexLineLayout.cpp: (WebCore::ComplexLineLayout::checkLinesForTextOverflow): * rendering/RenderDeprecatedFlexibleBox.cpp: (WebCore::RenderDeprecatedFlexibleBox::applyLineClamp): * rendering/style/RenderStyle.cpp: (WebCore::RenderStyle::hyphenString const): (WebCore::RenderStyle::textEmphasisMarkString const): * style/StyleAdjuster.cpp: (WebCore::Style::Adjuster::adjustForSiteSpecificQuirks const): * svg/SVGAnimateMotionElement.cpp: (WebCore::SVGAnimateMotionElement::rotateMode const): * svg/SVGAnimationElement.cpp: (WebCore::SVGAnimationElement::setCalcMode): (WebCore::SVGAnimationElement::setAttributeType): (WebCore::SVGAnimationElement::isAdditive const): (WebCore::SVGAnimationElement::isAccumulated const): (WebCore::inheritsFromProperty): * svg/SVGStyleElement.cpp: (WebCore::SVGStyleElement::type const): (WebCore::SVGStyleElement::media const): * svg/animation/SVGSMILElement.cpp: (WebCore::SVGSMILElement::parseClockValue): (WebCore::SVGSMILElement::restart const): (WebCore::SVGSMILElement::fill const): (WebCore::SVGSMILElement::repeatCount const): * svg/properties/SVGAnimationAdditiveValueFunctionImpl.cpp: (WebCore::SVGAnimationColorFunction::colorFromString): * svg/properties/SVGPropertyAnimator.h: (WebCore::SVGPropertyAnimator::adjustForInheritance const): 2020-05-01 Chris Dumez <cdumez@apple.com> REGRESSION (r260243): [ Mac WK1 ] fast/media/mq-inverted-colors-live-update-for-listener.html is a flaky failure https://bugs.webkit.org/show_bug.cgi?id=211154 <rdar://problem/62555128> Reviewed by Darin Adler. Make MediaQueryList an ActiveDOMObject and make sure its JS wrapper stays alive as long as it may fire change events and there is at least 1 change event listener. No new tests, already covered by existing tests. * css/MediaQueryList.cpp: (WebCore::MediaQueryList::MediaQueryList): (WebCore::MediaQueryList::create): (WebCore::MediaQueryList::~MediaQueryList): (WebCore::MediaQueryList::detachFromMatcher): (WebCore::MediaQueryList::evaluate): (WebCore::MediaQueryList::setMatches): (WebCore::MediaQueryList::matches): (WebCore::MediaQueryList::eventListenersDidChange): (WebCore::MediaQueryList::activeDOMObjectName const): (WebCore::MediaQueryList::virtualHasPendingActivity const): * css/MediaQueryList.h: * css/MediaQueryList.idl: * css/MediaQueryMatcher.cpp: (WebCore::MediaQueryMatcher::documentDestroyed): 2020-05-01 Don Olmstead <don.olmstead@sony.com> Use export macros on all platforms https://bugs.webkit.org/show_bug.cgi?id=211293 Reviewed by Michael Catanzaro. * platform/PlatformExportMacros.h: 2020-05-01 Eric Carlson <eric.carlson@apple.com> [MSE] Audio session category is sometimes not set correctly after changing video source https://bugs.webkit.org/show_bug.cgi?id=211252 <rdar://problem/61894737> Reviewed by Jer Noble. Test: media/media-source/media-source-change-source.html * html/HTMLMediaElement.cpp: (WebCore::HTMLMediaElement::mediaPlayerActiveSourceBuffersChanged): Call checkForAudioAndVideo. (WebCore::HTMLMediaElement::audioTrackEnabledChanged): Ditto. (WebCore::HTMLMediaElement::videoTrackSelectedChanged): Ditto. (WebCore::HTMLMediaElement::mediaPlayerCharacteristicChanged): Ditto. (WebCore::HTMLMediaElement::updatePlayState): Ditto. (WebCore::HTMLMediaElement::checkForAudioAndVideo): New, update m_hasEverHadAudio and m_hasEverHadVideo and call m_mediaSession->canProduceAudioChanged. (WebCore::HTMLMediaElement::mediaType const): Put `hasVideo()` in a local variable since it is used more than once. * html/HTMLMediaElement.h: * platform/audio/cocoa/MediaSessionManagerCocoa.mm: (WebCore::MediaSessionManagerCocoa::updateSessionState): Iterate over the list of media sessions once, not five times. * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm: (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::addAudioRenderer): Call m_player->characteristicChanged() rather than m_player->renderingModeChanged(). 2020-05-01 Peng Liu <peng.liu6@apple.com> A PiP window doesn’t actually dismiss after the browser navigates to a different page within the same domain https://bugs.webkit.org/show_bug.cgi?id=211257 Reviewed by Jer Noble. When we suspend a video element (this will happen when the browser is navigating to another page within the same domain), we need to request the corresponding video to exit fullscreen/PiP. The operation should be done immediately because the video element won't response to events after it is suspended. In r259095, we hold the start of exiting video fullscreen/PiP in HTMLMediaElement::exitFullscreen() until the "webkitendfullscreen" event is dispatched/handled. This behavior does not work if the video element is going to be suspended because the exiting fullscreen operation will be held until the video element is resumed. Therefore, we need to handle that case separately by exiting video fullscreen/PiP immediately. API test: PictureInPicture.ExitPiPOnSuspendVideoElement * html/HTMLMediaElement.cpp: (WebCore::HTMLMediaElement::exitFullscreen): * platform/ios/VideoFullscreenInterfaceAVKit.mm: (VideoFullscreenInterfaceAVKit::exitFullscreen): 2020-05-01 Zalan Bujtas <zalan@apple.com> [LFC][TFC] Introduce struct RowHeight in TableFormattingContext::computeAndDistributeExtraVerticalSpace https://bugs.webkit.org/show_bug.cgi?id=211275 Reviewed by Antti Koivisto. This is in preparation for available space distribution across row spans. * layout/tableformatting/TableFormattingContext.cpp: (WebCore::Layout::TableFormattingContext::computeAndDistributeExtraVerticalSpace): 2020-05-01 Antti Koivisto <antti@apple.com> Specific dom node order of Shadow DOM (re)projection causes crash https://bugs.webkit.org/show_bug.cgi?id=211159 <rdar://problem/62626920> Reviewed by Zalan Bujtas. ComposedTreeIterator may traverse to nodes outside its root element if it is constructed with a starting node that has no next sibling inside a slot. This leads to miscomputing RenderTreePosition::nextSibling() and eventual nullptr crash in RenderTreeBuilder when adding a renderer (due to beforeChild renderer being outside the parent renderer). Test case by Elliott Marquez. Test: fast/shadow-dom/composed-tree-iterator-escape.html * dom/ComposedTreeIterator.cpp: (WebCore::ComposedTreeIterator::Context::Context): When findind the end iterator for a tree context we need to look for a sibling in ancestors if the current node has no siblings. 2020-05-01 Alexey Shvayka <shvaikalesh@gmail.com> [WebIDL] Interface prototype objects should define @@toStringTag https://bugs.webkit.org/show_bug.cgi?id=211020 Reviewed by Darin Adler. WebIDL spec was recently updated [1] to define @@toStringTag on interface prototype objects. This change aligns WebIDL with ECMA-262 built-ins and Blink's behavior. Gecko have also expressed implementation commitment. This patch implements the spec change, making `X.prototype.toString()` return "[object X]" instead of "[object XPrototype]", where X is WebIDL interface. This behavior is proven to be web compatible (shipping in Chrome since Q2 2016) and matches class strings of iterator prototype objects [2] introduced in r253855. [1]: https://github.com/heycam/webidl/pull/357 [2]: https://heycam.github.io/webidl/#es-iterator-prototype-object Tests: fast/dom/prototype-chain.html fast/dom/wrapper-classes.html fast/workers/DedicatedWorkerGlobalScope-prototype-chain.html imported/w3c/web-platform-tests/WebIDL/ecmascript-binding/class-string-interface.any.js imported/w3c/web-platform-tests/WebIDL/ecmascript-binding/class-string-named-properties-object.window.js * bindings/js/JSDOMIterator.h: (WebCore::IteratorTraits>::finishCreation): * bindings/js/JSDOMWindowProperties.cpp: (WebCore::JSDOMWindowProperties::finishCreation): * bindings/js/JSDOMWindowProperties.h: * bindings/scripts/CodeGeneratorJS.pm: (GenerateImplementation): (GeneratePrototypeDeclaration): (GenerateConstructorHelperMethods): * bindings/scripts/test/*: Updated. 2020-05-01 Saam Barati <sbarati@apple.com> We can't cast toLength result to unsigned https://bugs.webkit.org/show_bug.cgi?id=211205 <rdar://problem/62625562> Reviewed by Yusuke Suzuki. * bridge/NP_jsobject.cpp: 2020-05-01 Antoine Quint <graouts@apple.com> REGRESSION: MotionMark 1.1 regressed due to r260016 https://bugs.webkit.org/show_bug.cgi?id=211280 <rdar://problem/61898830> Unreviewed. * html/canvas/CanvasRenderingContext2DBase.cpp: (WebCore::CanvasRenderingContext2DBase::drawImage): * platform/graphics/BitmapImage.cpp: (WebCore::BitmapImage::draw): * platform/graphics/GraphicsContext.cpp: (WebCore::GraphicsContext::drawImage): 2020-05-01 Philippe Normand <pnormand@igalia.com> [GStreamer] Move video frame holder to its own file https://bugs.webkit.org/show_bug.cgi?id=211239 Reviewed by Alex Christensen. This class implementation is big enough for a new compilation unit, IMHO. * platform/GStreamer.cmake: * platform/graphics/gstreamer/GStreamerVideoFrameHolder.cpp: Added. (WebCore::GstVideoFrameHolder::GstVideoFrameHolder): (WebCore::GstVideoFrameHolder::~GstVideoFrameHolder): (WebCore::GstVideoFrameHolder::handoffVideoDmaBuf): (WebCore::GstVideoFrameHolder::waitForCPUSync): (WebCore::GstVideoFrameHolder::updateTexture): (WebCore::GstVideoFrameHolder::platformLayerBuffer): * platform/graphics/gstreamer/GStreamerVideoFrameHolder.h: Added. (WebCore::GstVideoFrameHolder::size const): (WebCore::GstVideoFrameHolder::hasAlphaChannel const): (WebCore::GstVideoFrameHolder::flags const): (WebCore::GstVideoFrameHolder::textureID const): (WebCore::GstVideoFrameHolder::hasMappedTextures const): (WebCore::GstVideoFrameHolder::videoFrame const): (WebCore::GstVideoFrameHolder::hasDMABuf const): * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp: (WebCore::GstVideoFrameHolder::GstVideoFrameHolder): Deleted. (WebCore::GstVideoFrameHolder::~GstVideoFrameHolder): Deleted. (WebCore::GstVideoFrameHolder::handoffVideoDmaBuf): Deleted. (WebCore::GstVideoFrameHolder::waitForCPUSync): Deleted. (WebCore::GstVideoFrameHolder::size const): Deleted. (WebCore::GstVideoFrameHolder::hasAlphaChannel const): Deleted. (WebCore::GstVideoFrameHolder::flags const): Deleted. (WebCore::GstVideoFrameHolder::textureID const): Deleted. (WebCore::GstVideoFrameHolder::hasMappedTextures const): Deleted. (WebCore::GstVideoFrameHolder::videoFrame const): Deleted. (WebCore::GstVideoFrameHolder::updateTexture): Deleted. (WebCore::GstVideoFrameHolder::platformLayerBuffer): Deleted. (WebCore::GstVideoFrameHolder::hasDMABuf const): Deleted. 2020-05-01 Adrian Perez de Castro <aperez@igalia.com> [GTK4] Disable arrow on context menu popover https://bugs.webkit.org/show_bug.cgi?id=211241 Reviewed by Carlos Garcia Campos. No new tests needed. * platform/gtk/GtkVersioning.h: (gdk_display_get_monitor_at_window): Add no-op stub for GTK3. 2020-04-30 Rob Buis <rbuis@igalia.com> Inline reportBlockedPortFailed and reportAuthenticationChallengeBlocked https://bugs.webkit.org/show_bug.cgi?id=211250 Reviewed by Alex Christensen. These two static methods have only one caller each, so we can just inline them at the call site since there is nothing tying them to FrameLoader. * loader/DocumentLoader.cpp: (WebCore::DocumentLoader::willSendRequest): * loader/FrameLoader.cpp: (WebCore::FrameLoader::reportBlockedPortFailed): Deleted. (WebCore::FrameLoader::reportAuthenticationChallengeBlocked): Deleted. * loader/FrameLoader.h: * loader/ResourceLoader.cpp: (WebCore::ResourceLoader::didBlockAuthenticationChallenge): 2020-04-30 Ross Kirsling <ross.kirsling@sony.com> TriState should be an enum class and use "Indeterminate" instead of "Mixed" https://bugs.webkit.org/show_bug.cgi?id=211268 Reviewed by Mark Lam. * dom/Document.cpp: (WebCore::Document::queryCommandIndeterm): (WebCore::Document::queryCommandState): * editing/EditingStyle.cpp: (WebCore::EditingStyle::triStateOfStyle const): (WebCore::EditingStyle::hasStyle): * editing/Editor.cpp: (WebCore::Editor::selectionUnorderedListState const): (WebCore::Editor::selectionOrderedListState const): * editing/EditorCommand.cpp: (WebCore::isStylePresent): (WebCore::stateStyle): (WebCore::stateTextWritingDirection): (WebCore::stateNone): (WebCore::stateStyleWithCSS): (WebCore::Editor::Command::state const): (WebCore::Editor::Command::value const): * page/ContextMenuController.cpp: (WebCore::ContextMenuController::checkOrEnableIfNeeded const): 2020-04-30 Simon Fraser <simon.fraser@apple.com> Clean up some EventHandler coordinate-related naming and fix ScrollableArea::lastKnownMousePosition() conversions https://bugs.webkit.org/show_bug.cgi?id=211259 Reviewed by Zalan Bujtas. On EventHandler, rename m_lastKnownMousePosition, m_mouseDownPos and m_mouseDown for clarity. Rename ScrollableArea::lastKnownMousePosition() to be lastKnownMousePositionInView(). Previously, lastKnownMousePosition() would fetch it from EventHandler, which simply stashed event.position() (which is in a coordinate system that differs between WK1 and Wk2) which was not relative to the EventHandler's frame. This cause mouseLocationInScrollerForScrollerImp: to give wrong answers. Instead, lastKnownMousePositionInView() now specifically returns coordinates relative to the Frame. This behavior change will be tested in future overlay scrollbar tests. Document::showPlaybackTargetPicker() was using FrameView::lastKnownMousePosition(), so to avoid changing its (probably broken) behavior, have it call frame()->eventHandler().lastKnownMousePosition(). * dom/Document.cpp: (WebCore::Document::showPlaybackTargetPicker): * page/EventHandler.cpp: (WebCore::EventHandler::clear): (WebCore::EventHandler::handleMousePressEvent): (WebCore::EventHandler::handleMouseDraggedEvent): (WebCore::EventHandler::updateDragSourceActionsAllowed const): (WebCore::EventHandler::dispatchDragStartEventOnSourceElement): (WebCore::EventHandler::handleDrag): (WebCore::EventHandler::mouseMovementExceedsThreshold const): * page/EventHandler.h: * page/FrameView.cpp: (WebCore::FrameView::lastKnownMousePositionInView const): (WebCore::FrameView::lastKnownMousePosition const): Deleted. * page/FrameView.h: * platform/PlatformMouseEvent.h: * platform/ScrollableArea.h: (WebCore::ScrollableArea::lastKnownMousePositionInView const): (WebCore::ScrollableArea::lastKnownMousePosition const): Deleted. * platform/mac/ScrollAnimatorMac.mm: (-[WebScrollerImpPairDelegate mouseLocationInContentAreaForScrollerImpPair:]): (-[WebScrollerImpPairDelegate scrollerImpPair:convertContentPoint:toScrollerImp:]): (-[WebScrollerImpDelegate mouseLocationInScrollerForScrollerImp:]): * rendering/RenderLayer.cpp: (WebCore::RenderLayer::lastKnownMousePositionInView const): (WebCore::RenderLayer::lastKnownMousePosition const): Deleted. * rendering/RenderLayer.h: * rendering/RenderListBox.cpp: (WebCore::RenderListBox::lastKnownMousePositionInView const): (WebCore::RenderListBox::lastKnownMousePosition const): Deleted. * rendering/RenderListBox.h: 2020-04-30 Yusuke Suzuki <ysuzuki@apple.com> Some HTML element critical paths include AtomString materialization https://bugs.webkit.org/show_bug.cgi?id=211223 Reviewed by Saam Barati. While measuring Speedometer2, I've noticed that every time we create some type of input element, we call AtomString multiple times while it is not necessary. It turned out that this is because some places are using `AtomString("...", AtomString::ConstructFromLiteral)` instead of `static NeverDestroyed<const AtomString> ...("...", AtomString::ConstructFromLiteral)`. Since HTML is in the main thread, we can just use `static NeverDestroyed<>`. This patch fixes `AtomString()` calls by changing them to `NeverDestroyed<const AtomString>` if it is under WebCore/html directory. And in this patch, we omit FTPDirectoryDocument, MediaDocument, and PluginDocument's fixes for now since their AtomString content has a bit different nature (some pseudo CSS value ("-webkit-xxx") v.s. some particular CSS property value ("100%"). * html/ColorInputType.cpp: (WebCore::ColorInputType::createShadowSubtree): * html/FileInputType.cpp: (WebCore::UploadButtonElement::UploadButtonElement): * html/HTMLElement.cpp: (WebCore::trueName): (WebCore::falseName): (WebCore::plaintextOnlyName): (WebCore::HTMLElement::setContentEditable): (WebCore::HTMLElement::setDraggable): (WebCore::HTMLElement::setSpellcheck): (WebCore::HTMLElement::setAutocorrect): * html/HTMLTextFormControlElement.cpp: (WebCore::HTMLTextFormControlElement::updateInnerTextElementEditability): * html/RangeInputType.cpp: (WebCore::RangeInputType::createShadowSubtree): * html/SearchInputType.cpp: (WebCore::updateResultButtonPseudoType): * html/TextFieldInputType.cpp: (WebCore::TextFieldInputType::createShadowSubtree): (WebCore::TextFieldInputType::createDataListDropdownIndicator): (WebCore::TextFieldInputType::createContainer): (WebCore::TextFieldInputType::createAutoFillButton): * html/ValidationMessage.cpp: (WebCore::ValidationMessage::buildBubbleTree): * html/shadow/DetailsMarkerControl.cpp: (WebCore::DetailsMarkerControl::DetailsMarkerControl): * html/shadow/MediaControlTextTrackContainerElement.cpp: (WebCore::MediaControlTextTrackContainerElement::MediaControlTextTrackContainerElement): * html/shadow/ProgressShadowElement.cpp: (WebCore::ProgressInnerElement::create): (WebCore::ProgressBarElement::create): (WebCore::ProgressValueElement::create): * html/shadow/ProgressShadowElement.h: (WebCore::ProgressInnerElement::create): Deleted. (WebCore::ProgressBarElement::create): Deleted. (WebCore::ProgressValueElement::create): Deleted. * html/shadow/SpinButtonElement.cpp: (WebCore::SpinButtonElement::SpinButtonElement): * html/shadow/TextControlInnerElements.cpp: (WebCore::TextControlPlaceholderElement::TextControlPlaceholderElement): (WebCore::SearchFieldCancelButtonElement::SearchFieldCancelButtonElement): * html/shadow/YouTubeEmbedShadowElement.cpp: (WebCore::YouTubeEmbedShadowElement::YouTubeEmbedShadowElement): * html/shadow/mac/ImageControlsButtonElementMac.cpp: (WebCore::ImageControlsButtonElementMac::tryCreate): * html/shadow/mac/ImageControlsRootElementMac.cpp: (WebCore::ImageControlsRootElement::tryCreate): * html/track/TextTrackCue.cpp: (WebCore::TextTrackCue::rebuildDisplayTree): 2020-04-30 Jiewen Tan <jiewen_tan@apple.com> [WebAuthn] Optimize LocalAuthenticator https://bugs.webkit.org/show_bug.cgi?id=183534 <rdar://problem/43357408> Reviewed by Brent Fulgham. Covered by new API tests. * en.lproj/Localizable.strings: * platform/LocalizedStrings.cpp: (WebCore::getAssertionTouchIDPromptTitle): (WebCore::genericTouchIDPromptTitle): * platform/LocalizedStrings.h: Improving the LocalAuthentication dialog titles for iOS. 2020-04-30 Kate Cheney <katherine_cheney@apple.com> clearApplicationBundleIdentifierTestingOverride() should set the bundle identifier to a null string, not an empty string https://bugs.webkit.org/show_bug.cgi?id=211255 <rdar://problem/62651110> Reviewed by John Wilander. No new tests, behavior confirmed by existing tests. Clearing the bundle identifier during tests should reset the override value to be a null string so that the following calls to applicationBundleIdentifier() use the [NSBundle mainBundle] bundleIdentifier] call. * platform/cocoa/RuntimeApplicationChecksCocoa.mm: (WebCore::clearApplicationBundleIdentifierTestingOverride): 2020-04-30 Devin Rousso <drousso@apple.com> WebKit.WebContent process crashes when web developer tools are opened in Safari https://bugs.webkit.org/show_bug.cgi?id=210794 <rdar://problem/62214651> Reviewed by Brian Burg. Test: inspector/worker/dom-debugger-event-after-terminate-crash.html * inspector/agents/InspectorDOMDebuggerAgent.cpp: (WebCore::InspectorDOMDebuggerAgent::willHandleEvent): Don't `ASSERT(injectedScript.hasNoValue())` as it's possible for the event to be fired after `Worker.prototype.terminate`, in which case `InjectedScriptManager::injectedScriptFor` will now return an `InjectedScript` that would fail that `ASSERT`. 2020-04-30 Alex Christensen <achristensen@webkit.org> Add SPI to change a WKWebView's CORS disabling pattern after initialization https://bugs.webkit.org/show_bug.cgi?id=211211 <rdar://problem/61837474> Reviewed by Chris Dumez. * page/Page.h: (WebCore::Page::setCORSDisablingPatterns): 2020-04-30 Chris Dumez <cdumez@apple.com> WebCore::systemHasBattery() is unnecessarily expensive on iOS https://bugs.webkit.org/show_bug.cgi?id=211240 <rdar://problem/62619971> Reviewed by Geoffrey Garen. Update WebCore::systemHasBattery() to return true unconditionally on PLATFORM(IOS) and PLATFORM(WATCHOS) since iOS devices always have a battery. Also return false unconditionally for PLATFORM(APPLETV). * platform/cocoa/SystemBattery.mm: (WebCore::systemHasBattery): 2020-04-30 Andres Gonzalez <andresg_22@apple.com> Fix for crash in AXLogger. https://bugs.webkit.org/show_bug.cgi?id=211236 Reviewed by Chris Fleizach. Covered by existing tests. Notifications may have a null AXCoreObject target, so must check for nullity before streaming the object. * accessibility/AXLogger.cpp: (WebCore::AXLogger::log): 2020-04-30 Charlie Turner <cturner@igalia.com> [clang 11] fix build errors due to -WWc++11-narrowing https://bugs.webkit.org/show_bug.cgi?id=211193 Reviewed by Adrian Perez de Castro. Fixes the following errors, Source/WebCore/html/MediaElementSession.cpp:1059:9: error: type 'WebCore::RenderMedia *' cannot be narrowed to 'bool' in initializer list [-Wc++11-narrowing] m_element.renderer(), ^~~~~~~~~~~~~~~~~~~~ Source/WebCore/style/StyleResolver.cpp:106:55: error: type 'const char [4]' cannot be narrowed to 'bool' in initializer list [-Wc++11-narrowing] m_mediaQueryEvaluator = MediaQueryEvaluator { "all" }; ^~~~~ Source/WebCore/style/StyleResolver.cpp:106:55: note: insert an explicit cast to silence this issue m_mediaQueryEvaluator = MediaQueryEvaluator { "all" }; ^~~~~ static_cast<bool>( ) * html/HTMLMediaElement.h: (WebCore::HTMLMediaElement::hasRenderer const): MediaElementSession was implicitly casting a pointer to a bool, which is not allowed with modern Clang checks. Add a helper method to encapsulate the now required static_cast<bool>. * html/MediaElementSession.cpp: Use the new helper method to see if the HTMLMediaElement has an associated renderer. (WebCore::MediaElementSession::updateMediaUsageIfChanged): * style/StyleResolver.cpp: This was calling MediaQueryEvaluator { "all" }; and seemingly expecting to cast a const char[] to a bool, or maybe String? It's confusing because of the MediaQueryEvaluator API. If it was implicitly converting to bool then that could be unintentional. Such casts are not allowed either now. The MediaQueryEvaluator's default constructor says it returns true for "all", which appears to be the original intent of this call, so I replaced it with that. (WebCore::Style::Resolver::Resolver): 2020-04-30 Simon Fraser <simon.fraser@apple.com> border-radius fails to clip iframe contents https://bugs.webkit.org/show_bug.cgi?id=211199 <rdar://problem/61945671> Reviewed by Zalan Bujtas. iframes need to use the same composited clipping strategy that we use for other replaced elements with composited contents, like video and WebGL. To achieve this, change GraphicsLayer to allow child GraphicsLayers to be parented in the contents clipping layer, just like content layers are. (We don't want to do this unconditionally, because it will change behavior for video with controls.) Add GraphicsLayer::contentsRectClipsDescendants(), and used it to run code that creates the contents clipping (and optional shape) layers even when no contents layer is present. Fix up the sublayer list building to parent layers from children in the contents clipping layer. Tests: compositing/iframes/border-radius-composited-frame.html compositing/iframes/border-uneven-radius-composited-frame.html * platform/graphics/GraphicsLayer.cpp: (WebCore::GraphicsLayer::GraphicsLayer): * platform/graphics/GraphicsLayer.h: (WebCore::GraphicsLayer::contentsRectClipsDescendants const): (WebCore::GraphicsLayer::setContentsRectClipsDescendants): * platform/graphics/ca/GraphicsLayerCA.cpp: (WebCore::GraphicsLayerCA::setContentsRectClipsDescendants): (WebCore::GraphicsLayerCA::updateSublayerList): (WebCore::GraphicsLayerCA::updateContentsRects): (WebCore::GraphicsLayerCA::createTransformAnimationsFromKeyframes): * platform/graphics/ca/GraphicsLayerCA.h: * rendering/RenderLayerBacking.cpp: (WebCore::RenderLayerBacking::updateConfiguration): * rendering/RenderLayerCompositor.cpp: (WebCore::RenderLayerCompositor::isCompositedSubframeRenderer): * rendering/RenderLayerCompositor.h: 2020-04-30 Zalan Bujtas <zalan@apple.com> [LFC][TFC] Adjust the available vertical space with the row span for cell layout https://bugs.webkit.org/show_bug.cgi?id=211218 Reviewed by Antti Koivisto. The vertical available space for a cell should include all row heights it spans. (can't include test, current table layout logic is incompatible with LFC -and FF/Chrome.) * layout/tableformatting/TableFormattingContext.cpp: (WebCore::Layout::TableFormattingContext::setUsedGeometryForCells): 2020-04-30 Philippe Normand <pnormand@igalia.com> [SOUP] http/tests/media/video-accept-encoding.html fails https://bugs.webkit.org/show_bug.cgi?id=211228 Reviewed by Carlos Garcia Campos. The resource requests received by the network process always had the accept-encoding setting enabled due to lack of IPC (de)serialization for this boolean. The patch also enables soup release logging, set WEBKIT_DEBUG=Network=debug. * platform/network/soup/ResourceRequest.h: (WebCore::ResourceRequest::encodeWithPlatformData const): (WebCore::ResourceRequest::decodeWithPlatformData): * platform/network/soup/SoupNetworkSession.cpp: (WebCore::soupLogPrinter): (WebCore::SoupNetworkSession::setupLogger): 2020-04-30 Carlos Garcia Campos <cgarcia@igalia.com> [GTK4][X11] Add support for rendering web view contents https://bugs.webkit.org/show_bug.cgi?id=211189 Reviewed by Adrian Perez de Castro. Add PlatformDisplayX11::visual() to get the X visual used for rendering. * platform/graphics/x11/PlatformDisplayX11.cpp: (WebCore::PlatformDisplayX11::visual const): * platform/graphics/x11/PlatformDisplayX11.h: 2020-04-30 Andres Gonzalez <andresg_22@apple.com> Add logging of AXIsolatedTree and AXNotifications. https://bugs.webkit.org/show_bug.cgi?id=211214 Reviewed by Chris Fleizach. - Added operator<< implementations for AXIsolatedTree and AX notifications. - Added corresponding AXLogger::log overloads for the above types. - To set the root node and the focused node we are now always using setRootNodeID and setFocusedNodeID respectively. Therefore, before returning the root or the focused nodes, it is necessary to applyPendingChanges. * accessibility/AXLogger.cpp: (WebCore::AXLogger::add): Used for recursive logging of the hierarchy. (WebCore::AXLogger::log): (WebCore::operator<<): * accessibility/AXLogger.h: * accessibility/AXObjectCache.cpp: Added logging of the isolated tree when it's generated and before and after updates. (WebCore::AXObjectCache::isolatedTreeFocusedObject): (WebCore::AXObjectCache::generateIsolatedTree): (WebCore::AXObjectCache::updateIsolatedTree): * accessibility/AXObjectCache.h: * accessibility/isolatedtree/AXIsolatedObject.cpp: (WebCore::AXIsolatedObject::focusedUIElement const): * accessibility/isolatedtree/AXIsolatedTree.cpp: (WebCore::AXIsolatedTree::createTreeForPageID): (WebCore::AXIsolatedTree::removeTreeForPageID): (WebCore::AXIsolatedTree::nodeForID const): (WebCore::AXIsolatedTree::generateSubtree): (WebCore::AXIsolatedTree::focusedNode): (WebCore::AXIsolatedTree::rootNode): (WebCore::AXIsolatedTree::setRootNodeID): (WebCore::AXIsolatedTree::setFocusedNodeID): (WebCore::AXIsolatedTree::applyPendingChanges): (WebCore::AXIsolatedTree::focusedUIElement): Renamed focusedNode for naming consistency. (WebCore::AXIsolatedTree::setRootNode): Deleted. Using setRootNodeID instead, (WebCore::AXIsolatedTree::setFocusedNode): Deleted. Use setFocusedNodeID instead. * accessibility/isolatedtree/AXIsolatedTree.h: (WebCore::AXIsolatedTree::treeID const): (WebCore::AXIsolatedTree::treeIdentifier const): renamed treeID for naming consistency. 2020-04-30 Philippe Normand <pnormand@igalia.com> Unreviewed, GStreamer build warning fix after r260755. * platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp: (webKitWebSrcMakeRequest): There is no need to capture src in the closure, its protector is used instead. 2020-04-30 Philippe Normand <pnormand@igalia.com> [GStreamer] fast/mediastream/get-user-media-device-id.html failing https://bugs.webkit.org/show_bug.cgi?id=190576 Reviewed by Xabier Rodriguez-Calvar. The test was failing due to deviceId invalid constraint, which led me to rewrite the GStreamer Mock sources, removing various hacks and appsrc usage, which is not needed because we rely on audioSamplesAvailable and videoSamplesAvailable notifications. This patch also fixes the audio mock, which was generating silence until now. * platform/GStreamer.cmake: * platform/mediastream/gstreamer/GStreamerMediaStreamSource.cpp: (WebCore::WebKitMediaStreamTrackObserver::WebKitMediaStreamTrackObserver): * platform/mediastream/gstreamer/MockGStreamerAudioCaptureSource.cpp: Removed. * platform/mediastream/gstreamer/MockGStreamerVideoCaptureSource.cpp: Removed. * platform/mediastream/gstreamer/MockGStreamerVideoCaptureSource.h: Removed. * platform/mediastream/gstreamer/MockRealtimeAudioSourceGStreamer.cpp: Added. (WebCore::MockRealtimeAudioSource::create): (WebCore::MockRealtimeAudioSourceGStreamer::createForMockAudioCapturer): (WebCore::MockRealtimeAudioSourceGStreamer::MockRealtimeAudioSourceGStreamer): (WebCore::MockRealtimeAudioSourceGStreamer::render): (WebCore::MockRealtimeAudioSourceGStreamer::addHum): (WebCore::MockRealtimeAudioSourceGStreamer::reconfigure): * platform/mediastream/gstreamer/MockRealtimeAudioSourceGStreamer.h: Copied from Source/WebCore/platform/mediastream/gstreamer/MockGStreamerAudioCaptureSource.h. * platform/mediastream/gstreamer/MockRealtimeVideoSourceGStreamer.cpp: Added. (WebCore::MockRealtimeVideoSource::create): (WebCore::MockRealtimeVideoSourceGStreamer::createForMockDisplayCapturer): (WebCore::MockRealtimeVideoSourceGStreamer::MockRealtimeVideoSourceGStreamer): (WebCore::MockRealtimeVideoSourceGStreamer::updateSampleBuffer): * platform/mediastream/gstreamer/MockRealtimeVideoSourceGStreamer.h: Renamed from Source/WebCore/platform/mediastream/gstreamer/MockGStreamerAudioCaptureSource.h. * platform/mock/MockRealtimeVideoSource.h: 2020-04-29 Simon Fraser <simon.fraser@apple.com> Use initializers in PlatformMouseEvent and WebEvent https://bugs.webkit.org/show_bug.cgi?id=211217 Reviewed by Tim Horton. Use initializers im PlatformMouseEvent. * platform/PlatformMouseEvent.h: (WebCore::PlatformMouseEvent::PlatformMouseEvent): 2020-04-29 Jer Noble <jer.noble@apple.com> Remove the debug ASSERT in ImageDecoderAVFObjC::storeSampleBuffer() https://bugs.webkit.org/show_bug.cgi?id=211191 <rdar://problem/62542285> Reviewed by Said Abou-Hallawa. r259594 added an iterator check and a RELEASE_LOG_ERROR for that check, making this ASSERT superfluous. * platform/graphics/avfoundation/objc/ImageDecoderAVFObjC.mm: (WebCore::ImageDecoderAVFObjC::storeSampleBuffer): 2020-04-29 Simon Fraser <simon.fraser@apple.com> Simplify contents clipping layer geometry https://bugs.webkit.org/show_bug.cgi?id=211162 Reviewed by Zalan Bujtas. GraphicsLayerCA uses a contents clipping layer, with an optional shape layer, to support clipping replaced elements with composited contents, like video and WebGL canvas. A future patch will use this code path for composited subframes. To achieve this, we need to host the layers of child GraphicsLayers under m_contentsClippingLayer, but without the GraphicsLayer client having to do geometry math. We can do this by setting the bounds origin of m_contentsClippingLayer to adjust for its position relative to the GraphicsLayer origin. This patch does that, adjusting the position of the contents layer accordingly. The shape mask layer also needs adjusting; its position has to be at the layer's bounds origin, and the shape itself needs to have a zero origin. Tested by existing tests. * platform/graphics/ca/GraphicsLayerCA.cpp: (WebCore::GraphicsLayerCA::updateSublayerList): (WebCore::GraphicsLayerCA::updateClippingStrategy): (WebCore::GraphicsLayerCA::updateContentsRects): 2020-04-29 Kenneth Russell <kbr@chromium.org> REGRESSION (r256784?): Shadertoy demo no longer works in Safari https://bugs.webkit.org/show_bug.cgi?id=210994 Reviewed by Dean Jackson. Certain Shadertoy examples stopped working with the ANGLE backend for WebGL because rendering to floating-point render targets was no longer being enabled implicitly along with the OES_texture_float extension. Add support for the WebGL 1.0 extensions EXT_color_buffer_half_float and WEBGL_color_buffer_float, and the WebGL 2.0 extension EXT_color_buffer_float. Enable these implicitly for WebGL 1.0 in the OES_texture_float and OES_texture_half_float extensions, restoring the previous functionality. Translate 32-bit floating point texture formats appropriately for the ANGLE backend. Fix some failures in previously-skipped conformance tests. The new code passes the more stringent top-of-tree WebGL 1.0.4 and 2.0.1 conformance tests related to floating-point texture renderability, which are not yet in the WebKit repository. * CMakeLists.txt: * DerivedSources-input.xcfilelist: * DerivedSources-output.xcfilelist: * DerivedSources.make: * Sources.txt: * WebCore.xcodeproj/project.pbxproj: * bindings/js/JSDOMConvertWebGL.cpp: (WebCore::convertToJSValue): * html/canvas/EXTColorBufferFloat.cpp: Copied from Source/WebCore/html/canvas/OESTextureHalfFloat.cpp. (WebCore::EXTColorBufferFloat::EXTColorBufferFloat): (WebCore::EXTColorBufferFloat::getName const): (WebCore::EXTColorBufferFloat::supported): * html/canvas/EXTColorBufferFloat.h: Copied from Source/WebCore/html/canvas/OESTextureFloat.h. * html/canvas/EXTColorBufferFloat.idl: Added. * html/canvas/EXTColorBufferHalfFloat.cpp: Copied from Source/WebCore/html/canvas/OESTextureFloat.cpp. (WebCore::EXTColorBufferHalfFloat::EXTColorBufferHalfFloat): (WebCore::EXTColorBufferHalfFloat::getName const): (WebCore::EXTColorBufferHalfFloat::supported): * html/canvas/EXTColorBufferHalfFloat.h: Copied from Source/WebCore/html/canvas/OESTextureFloat.h. * html/canvas/EXTColorBufferHalfFloat.idl: Added. * html/canvas/OESTextureFloat.cpp: (WebCore::OESTextureFloat::OESTextureFloat): (WebCore::OESTextureFloat::supported): * html/canvas/OESTextureFloat.h: * html/canvas/OESTextureHalfFloat.cpp: (WebCore::OESTextureHalfFloat::OESTextureHalfFloat): (WebCore::OESTextureHalfFloat::supported): * html/canvas/OESTextureHalfFloat.h: * html/canvas/WebGL2RenderingContext.cpp: (WebCore::WebGL2RenderingContext::getExtension): (WebCore::WebGL2RenderingContext::getSupportedExtensions): (WebCore::WebGL2RenderingContext::getParameter): * html/canvas/WebGLColorBufferFloat.cpp: Copied from Source/WebCore/html/canvas/OESTextureFloat.cpp. (WebCore::WebGLColorBufferFloat::WebGLColorBufferFloat): (WebCore::WebGLColorBufferFloat::getName const): (WebCore::WebGLColorBufferFloat::supported): * html/canvas/WebGLColorBufferFloat.h: Copied from Source/WebCore/html/canvas/OESTextureFloat.h. * html/canvas/WebGLColorBufferFloat.idl: Added. * html/canvas/WebGLExtension.h: * html/canvas/WebGLRenderingContext.cpp: (WebCore::WebGLRenderingContext::getExtension): (WebCore::WebGLRenderingContext::getSupportedExtensions): (WebCore::WebGLRenderingContext::getParameter): * html/canvas/WebGLRenderingContextBase.cpp: (WebCore::WebGLRenderingContextBase::extensionIsEnabled): (WebCore::WebGLRenderingContextBase::copyTexImage2D): * html/canvas/WebGLRenderingContextBase.h: * platform/graphics/angle/ExtensionsGLANGLE.cpp: (WebCore::ExtensionsGLANGLE::adjustWebGL1TextureInternalFormat): (WebCore::ExtensionsGLANGLE::texImage2DRobustANGLE): * platform/graphics/angle/ExtensionsGLANGLE.h: * platform/graphics/angle/GraphicsContextGLANGLE.cpp: (WebCore::GraphicsContextGLOpenGL::texImage2DDirect): 2020-04-29 Zalan Bujtas <zalan@apple.com> Header is blank on https://nader.org https://bugs.webkit.org/show_bug.cgi?id=205747 <rdar://problem/58305910> Reviewed by Simon Fraser. Do not use stale containing block width value while computing preferred width. Test: fast/text/text-indent-inside-float.html * rendering/RenderBlockFlow.cpp: (WebCore::RenderBlockFlow::computeInlinePreferredLogicalWidths const): 2020-04-29 Zalan Bujtas <zalan@apple.com> [LFC][TFC] Take row span into account when checking for missing cells https://bugs.webkit.org/show_bug.cgi?id=211184 Reviewed by Antti Koivisto. The tree builder looks for missing cells in the table grid and fills in the gaps with empty cells. This patch takes row spanning into account and make sure we don't end up adding an extra, redundant cell. * layout/layouttree/LayoutTreeBuilder.cpp: (WebCore::Layout::TreeBuilder::buildTableStructure): 2020-04-29 Youenn Fablet <youenn@apple.com> Update SWServer.cpp originURL after https://trac.webkit.org/changeset/260707 https://bugs.webkit.org/show_bug.cgi?id=211169 Reviewed by Alex Christensen. * workers/service/server/SWServer.cpp: (WebCore::originURL): No need to dereference port since URL::setPort takes an Optional. 2020-04-29 Zalan Bujtas <zalan@apple.com> [LFC] FormattingContext::constraintsForInFlow/OutOfFlowContent should take const ContainerBox& https://bugs.webkit.org/show_bug.cgi?id=211161 Reviewed by Antti Koivisto. Leaf boxes should not need to compute constraints (as by definition they don't have in/out-of-flow descendants). * layout/FormattingContext.cpp: (WebCore::Layout::FormattingContext::layoutOutOfFlowContent): * layout/FormattingContext.h: * layout/FormattingContextGeometry.cpp: (WebCore::Layout::FormattingContext::Geometry::constraintsForOutOfFlowContent): (WebCore::Layout::FormattingContext::Geometry::constraintsForInFlowContent): * layout/FormattingContextQuirks.cpp: (WebCore::Layout::FormattingContext::Quirks::heightValueOfNearestContainingBlockWithFixedHeight): * layout/blockformatting/BlockFormattingContext.cpp: (WebCore::Layout::BlockFormattingContext::layoutInFlowContent): (WebCore::Layout::BlockFormattingContext::precomputeVerticalPositionForBoxAndAncestors): * layout/blockformatting/BlockFormattingContextQuirks.cpp: (WebCore::Layout::BlockFormattingContext::Quirks::stretchedInFlowHeight): * layout/blockformatting/PrecomputedBlockMarginCollapse.cpp: (WebCore::Layout::BlockFormattingContext::MarginCollapse::precomputedPositiveNegativeValues const): * layout/inlineformatting/InlineFormattingContext.cpp: (WebCore::Layout::InlineFormattingContext::layoutInFlowContent): * layout/tableformatting/TableFormattingContext.cpp: (WebCore::Layout::TableFormattingContext::layoutCell): 2020-04-29 Joonghun Park <jh718.park@samsung.com> Unreviewed. Remove no longer used variable and the build warning below. warning: unused variable ‘view’ [-Wunused-variable] No new tests, no new behaviour changes. * page/EventHandler.cpp: (WebCore::EventHandler::handleMousePressEvent): 2020-04-29 Alicia Boya García <aboya@igalia.com> PlatformMediaResourceLoader should be destroyed on the main thread https://bugs.webkit.org/show_bug.cgi?id=211155 Reviewed by Xabier Rodriguez-Calvar. PlatformMediaResourceLoader is only safe to use from the main thread. A tricky detail is this includes its destruction. The same is true for PlatformMediaResource. Both classes are ThreadSafeRefCounted<> classes and therefore WTF::DestructionThread::Main can be used to ensure destruction is run in the correct thread with no need for additional client code. * platform/graphics/PlatformMediaResourceLoader.h: * platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp: (WebKitWebSrcPrivate::StreamingMembers::~StreamingMembers): 2020-04-29 Rob Buis <rbuis@igalia.com> Make PolicyChecker an inner class of FrameLoader https://bugs.webkit.org/show_bug.cgi?id=211138 Reviewed by Alex Christensen. PolicyChecker HistoryController an inner class of FrameLoader, this allows us to move some methods only used by PolicyChecker out of the FrameLoader public API. Because it is not possible to forward declare an enum class in an inner class, move ShouldContinue out of the PolicyChecker class and rename it to ShouldContinuePolicyCheck. * loader/FrameLoader.cpp: (WebCore::FrameLoader::loadURL): (WebCore::FrameLoader::load): (WebCore::FrameLoader::loadPostRequest): (WebCore::FrameLoader::continueLoadAfterNewWindowPolicy): * loader/FrameLoader.h: * loader/FrameLoaderTypes.h: * loader/MediaResourceLoader.cpp: (WebCore::MediaResource::responseReceived): * loader/PolicyChecker.cpp: * loader/PolicyChecker.h: * platform/graphics/PlatformMediaResourceLoader.h: (WebCore::PlatformMediaResourceClient::responseReceived): * platform/graphics/avfoundation/objc/WebCoreAVFResourceLoader.mm: (WebCore::PlatformResourceMediaLoader::responseReceived): * platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp: (CachedResourceStreamingClient::responseReceived): * platform/network/cocoa/WebCoreNSURLSession.mm: (WebCore::WebCoreNSURLSessionDataTaskClient::responseReceived): (-[WebCoreNSURLSessionDataTask resource:receivedResponse:completionHandler:]): 2020-04-29 Adrian Perez de Castro <aperez@igalia.com> [GTK] Misplaced right click menu on web page due to deprecated gtk_menu_popup() https://bugs.webkit.org/show_bug.cgi?id=170553 Reviewed by Carlos Garcia Campos. * platform/gtk/GtkVersioning.h: Add replacements for GtkPopover functions which are no longet available in GTK4. (gtk_popover_menu_new): Added. (gtk_popover_bind_model): Added. (gtk_popover_set_relative_to): Added. 2020-04-29 Philippe Normand <pnormand@igalia.com> [GStreamer] Switch to audiointerleave https://bugs.webkit.org/show_bug.cgi?id=211124 Reviewed by Xabier Rodriguez-Calvar. The audiointerleave element is a drop-in replacement of interleave. It should behave a bit better in live. No new tests, existing webaudio tests cover this change. * platform/audio/gstreamer/WebKitWebAudioSourceGStreamer.cpp: (webKitWebAudioSrcConstructed): (webKitWebAudioSrcChangeState): 2020-04-23 Sergio Villar Senin <svillar@igalia.com> [WebXR][WPE] Implement XRTest::simulateDeviceConnection() https://bugs.webkit.org/show_bug.cgi?id=210912 Reviewed by Dean Jackson. This API gives tests the ability to spin up a simulated XR device which is an XR device which from the point of view of the WebXR API behaves like a normal XR device. These simulated XR devices can be controlled by the associated FakeXRDevice object. No new tests as this is machinery required to execute tests when implementing the WebXR API. * Modules/webxr/WebXRSystem.cpp: (WebCore::WebXRSystem::WebXRSystem): Initialize the default inline device. (WebCore::WebXRSystem::registerSimulatedXRDeviceForTesting): Add a newly created simulated XR device to the list of available devices. Update also the active immersive device and current inline device. (WebCore::WebXRSystem::unregisterSimulatedXRDeviceForTesting): Remove all simulated devices from the list of immersive XR devices. * Modules/webxr/WebXRSystem.h: New DummyInlineDevice which represents the default inline device which must not provide pose information. * Modules/webxr/WebXRView.cpp: (WebCore::WebXRView::WebXRView): Removed some methods that should be really part of a fake XRView instance. (WebCore::WebXRView::setProjectionMatrix): Add implementation. (WebCore::WebXRView::eye const): Deleted. (WebCore::WebXRView::projectionMatrix const): Deleted. (WebCore::WebXRView::transform const): Deleted. * Modules/webxr/WebXRView.h: (WebCore::WebXRView::eye const): Implemented. (WebCore::WebXRView::projectionMatrix const): Ditto. (WebCore::WebXRView::transform const): Ditto. (WebCore::WebXRView::setEye): Ditto. (WebCore::WebXRView::setTransform): Ditto. * Modules/webxr/XRReferenceSpaceType.h: Moved the definitions to PlatformXR. * platform/xr/PlatformXR.cpp: (PlatformXR::Instance::nextDeviceId): New method which returns uniquely defined ids for XR devices. (PlatformXR::Device::Device): * platform/xr/PlatformXR.h: (PlatformXR::Device::id const): New method. (PlatformXR::Device::supports const): Ditto. (PlatformXR::Device::setSupportedModes): Ditto. (PlatformXR::Device::setEnabledFeatures): Ditto. (PlatformXR::Device::operator== const): Ditto. * testing/FakeXRViewInit.h: fieldOfView is optional. * testing/WebFakeXRDevice.cpp: (WebCore::FakeXRView::setFieldOfView): Implemented. (WebCore::WebFakeXRDevice::setViews): Ditto. (WebCore::WebFakeXRDevice::setViewerOrigin): Ditto. (WebCore::WebFakeXRDevice::clearViewerOrigin): Ditto. (WebCore::WebFakeXRDevice::setFloorOrigin): Ditoo. (WebCore::WebFakeXRDevice::clearFloorOrigin): Ditto. (WebCore::WebFakeXRDevice::parseRigidTransform): Added. (WebCore::WebFakeXRDevice::parseView): Ditto. * testing/WebFakeXRDevice.h: Defined FakeXRView class which wraps a XRView adding some associated data as the field of view and viewport. Also defined the SimulatedXRDevice which is an PlatformXR::Device with some additional data useful for testing purpouses. * testing/WebXRTest.cpp: (WebCore::WebXRTest::simulateDeviceConnection): Create a new FakeXRDevice with an associated simulated XR device with the data provided by a FakeXRDeviceInit. (WebCore::WebXRTest::disconnectAllDevices): Remove all simulated devices from the list of immersive devices. * testing/WebXRTest.h: Call simulateDeviceConnection with ScriptExecutionContext. * testing/WebXRTest.idl: Ditto. 2020-04-29 Saam Barati <sbarati@apple.com> U_STRING_NOT_TERMINATED_WARNING ICU must be handled when using the output buffer as a C string https://bugs.webkit.org/show_bug.cgi?id=211142 <rdar://problem/62530860> Reviewed by Darin Adler. * editing/TextIterator.cpp: (WebCore::normalizeCharacters): * platform/text/LocaleICU.cpp: (WebCore::LocaleICU::decimalSymbol): (WebCore::LocaleICU::decimalTextAttribute): (WebCore::getDateFormatPattern): (WebCore::LocaleICU::createLabelVector): (WebCore::getFormatForSkeleton): * platform/text/LocaleToScriptMappingICU.cpp: (WebCore::localeToScriptCodeForFontSelection): * platform/text/TextCodecICU.cpp: (WebCore::TextCodecICU::decode): (WebCore::TextCodecICU::encode): 2020-04-29 Noam Rosenthal <noam@webkit.org> Add StringView::isAllSpecialCharacters() https://bugs.webkit.org/show_bug.cgi?id=211150 Reviewed by Darin Adler. Uses new StringView::isAllSpecialCharacters() instead of creating a StringImpl. No new tests. * rendering/TextPainter.cpp: (WebCore::TextPainter::paintTextOrEmphasisMarks): 2020-04-28 Said Abou-Hallawa <sabouhallawa@apple.com> Rendering update steps should use Seconds for the timestamps https://bugs.webkit.org/show_bug.cgi?id=210990 Unreviewed. serviceRequestAnimationFrameCallbacks() should return rounded milliseconds. This rounding was removed in r260736. So put it back. * dom/ScriptedAnimationController.cpp: (WebCore::ScriptedAnimationController::serviceRequestAnimationFrameCallbacks): 2020-04-28 Carlos Garcia Campos <cgarcia@igalia.com> [GTK4] Add support for key events https://bugs.webkit.org/show_bug.cgi?id=211128 Reviewed by Adrian Perez de Castro. * platform/gtk/GtkVersioning.h: (gdk_event_get_keyval): (gdk_event_get_keycode): 2020-04-28 Wenson Hsieh <wenson_hsieh@apple.com> [Text manipulation] Add a userInfo dictionary to _WKTextManipulationToken https://bugs.webkit.org/show_bug.cgi?id=211151 <rdar://problem/62329534> Reviewed by Darin Adler. Add an extensible mechanism for the text manipulation controller to send additional metadata for each text manipulation token through to the WebKit client, for debugging purposes. Test: TextManipulation.StartTextManipulationExtractsUserInfo * editing/TextManipulationController.cpp: (WebCore::tokenInfo): (WebCore::TextManipulationController::observeParagraphs): * editing/TextManipulationController.h: Add TextManipulationTokenInfo, and add an optional TextManipulationTokenInfo member to TextManipulationToken. For now, just send over the document URL, element tag name, and the value of the role attribute. (WebCore::TextManipulationController::ManipulationTokenInfo::encode const): (WebCore::TextManipulationController::ManipulationTokenInfo::decode): (WebCore::TextManipulationController::ManipulationToken::encode const): (WebCore::TextManipulationController::ManipulationToken::decode): 2020-04-28 Simon Fraser <simon.fraser@apple.com> Update the xcfilelists. * DerivedSources-input.xcfilelist: * DerivedSources-output.xcfilelist: 2020-04-28 Simon Fraser <simon.fraser@apple.com> REGRESSION (r260808): Backdrops on music.apple.com are offset https://bugs.webkit.org/show_bug.cgi?id=211153 <rdar://problem/62543158> Reviewed by Zalan Bujtas. The border-radius code path failed to offset the rounded rect by contentOffsetInCompositingLayer(). Test: compositing/filters/backdrop-filter-rect-border-radius.html * rendering/RenderLayerBacking.cpp: (WebCore::RenderLayerBacking::updateBackdropFiltersGeometry): 2020-04-28 Daniel Bates <dabates@apple.com> Modernize EndPointsAdjustmentMode enumeration and fix misspelled enumerator https://bugs.webkit.org/show_bug.cgi?id=211141 Reviewed by Eric Carlson. Fix the misspelled enumerator DoNotAdjsutEndpoints. While I am here, make EndPointsAdjustmentMode an enum class sized as a bool and simplify the naming of its enumerators now that they have to be qualified. I also re-ordered them so that DoNotAdjust is the first enumerator (it will have value 0). This doesn't really matter, but I like it because it makes it so that this enumeration behaves more like an equivalent boolean should casts be involved. * editing/FrameSelection.cpp: (WebCore::FrameSelection::setSelectionByMouseIfDifferent): * editing/FrameSelection.h: * page/EventHandler.cpp: (WebCore::EventHandler::updateSelectionForMouseDrag): 2020-04-28 Daniel Bates <dabates@apple.com> [WebKitLegacy] Implement -hidePlaceholder and -showPlaceholderIfNecessary in terms of setCanShowPlaceholder() https://bugs.webkit.org/show_bug.cgi?id=211139 Reviewed by Simon Fraser. Remove hidePlaceholder() and showPlaceholderIfNecessary() as they are no longer needed. Callers should use setCanShowPlaceholder() instead. * html/HTMLTextFormControlElement.cpp: (WebCore::HTMLTextFormControlElement::hidePlaceholder): Deleted. (WebCore::HTMLTextFormControlElement::showPlaceholderIfNecessary): Deleted. * html/HTMLTextFormControlElement.h: 2020-04-28 ChangSeok Oh <changseok@webkit.org> [GTK] Fix build failures for ANGLE_WEBGL after r259589 https://bugs.webkit.org/show_bug.cgi?id=211116 Reviewed by Alex Christensen. The compiler is unhappy with coverting GCGLint64 (long long int) to GLInt64 (long int). Passing GCGLuint62 as GLuint64 is a similar issue. No new tests since no new functionalities. * platform/graphics/angle/ExtensionsGLANGLE.cpp: (WebCore::ExtensionsGLANGLE::getInteger64vRobustANGLE): (WebCore::ExtensionsGLANGLE::getInteger64i_vRobustANGLE): (WebCore::ExtensionsGLANGLE::getBufferParameteri64vRobustANGLE): (WebCore::ExtensionsGLANGLE::getQueryObjecti64vRobustANGLE): (WebCore::ExtensionsGLANGLE::getQueryObjectui64vRobustANGLE): * platform/graphics/nicosia/texmap/NicosiaGC3DLayer.cpp: (Nicosia::GC3DLayer::swapBuffersIfNeeded): Unaccelerated -> RenderingMode::Unaccelerated 2020-04-28 Noam Rosenthal <noam@webkit.org> Implement FCP (first contentful paint) https://bugs.webkit.org/show_bug.cgi?id=208499 Reviewed by Simon Fraser. Added the necessary interface, extensions to the performance interface and observer, new runtime flag. Detecting contentfulness after layout and before actual paint, by running a "dummy" paint, similar to invalidateControlTints() / invalidateImagesWithAsyncDecodes(). Save the result to the GraphicsContext and then to the document. This would run for every paint until we detect a contentful one. Note that it paints the entire frame contents, as FCP is not viewport-dependent. Also, paint timing is currently disabled for LFC (layout formatting context), and will be dealt with later. Tests: http/tests/performance/paint-timing/performance-paint-timing-fcp-after-visually-non-empty-for-num-chars.html http/tests/performance/paint-timing/performance-paint-timing-fcp-after-visually-non-empty-for-style.html imported/w3c/web-platform-tests/paint-timing/fcp-only/fcp-background-size.html imported/w3c/web-platform-tests/paint-timing/fcp-only/fcp-bg-image-set.html imported/w3c/web-platform-tests/paint-timing/fcp-only/fcp-bg-image-two-steps.html imported/w3c/web-platform-tests/paint-timing/fcp-only/fcp-canvas-context.html imported/w3c/web-platform-tests/paint-timing/fcp-only/fcp-gradient.html imported/w3c/web-platform-tests/paint-timing/fcp-only/fcp-invisible-3d-rotate-descendant.html imported/w3c/web-platform-tests/paint-timing/fcp-only/fcp-invisible-3d-rotate.html imported/w3c/web-platform-tests/paint-timing/fcp-only/fcp-invisible-scale-transition.html imported/w3c/web-platform-tests/paint-timing/fcp-only/fcp-invisible-scale.html imported/w3c/web-platform-tests/paint-timing/fcp-only/fcp-invisible-text.html imported/w3c/web-platform-tests/paint-timing/fcp-only/fcp-opacity-descendant.html imported/w3c/web-platform-tests/paint-timing/fcp-only/fcp-opacity.html imported/w3c/web-platform-tests/paint-timing/fcp-only/fcp-out-of-bounds-translate.html imported/w3c/web-platform-tests/paint-timing/fcp-only/fcp-out-of-bounds.html imported/w3c/web-platform-tests/paint-timing/fcp-only/fcp-pseudo-element-display.html imported/w3c/web-platform-tests/paint-timing/fcp-only/fcp-pseudo-element-image.html imported/w3c/web-platform-tests/paint-timing/fcp-only/fcp-pseudo-element-opacity.html imported/w3c/web-platform-tests/paint-timing/fcp-only/fcp-pseudo-element-text.html imported/w3c/web-platform-tests/paint-timing/fcp-only/fcp-pseudo-element-visibility.html imported/w3c/web-platform-tests/paint-timing/fcp-only/fcp-svg.html imported/w3c/web-platform-tests/paint-timing/fcp-only/fcp-text-input.html imported/w3c/web-platform-tests/paint-timing/fcp-only/fcp-typographic-pseudo.html imported/w3c/web-platform-tests/paint-timing/fcp-only/fcp-video-frame.html imported/w3c/web-platform-tests/paint-timing/fcp-only/fcp-video-poster.html imported/w3c/web-platform-tests/paint-timing/fcp-only/fcp-whitespace.html imported/w3c/web-platform-tests/paint-timing/fcp-only/fcp-with-rtl.html performance-api/paint-timing/paint-timing-apis.html performance-api/paint-timing/paint-timing-frames.html performance-api/paint-timing/paint-timing-with-worker.html performance-api/paint-timing/performance-observer-first-contentful-paint.html * CMakeLists.txt: * DerivedSources.make: * Sources.txt: * WebCore.xcodeproj/project.pbxproj: * bindings/js/JSPerformanceEntryCustom.cpp: (WebCore::toJSNewlyCreated): * bindings/js/WebCoreBuiltinNames.h: Add PerformancePaintTiming interface. https://w3c.github.io/paint-timing/#sec-PerformancePaintTiming * dom/Document.cpp: * dom/Document.h: (WebCore::Document::supportsPaintTiming const): We only report paint timing for document that can access the top level security origin, to avoid leakage of information to sandboxed iframes. (WebCore::Document::enqueuePaintTimingEntryIfNeeded): Enqueue a paint timing entry, according to https://w3c.github.io/paint-timing/#sec-reporting-paint-timing * page/FrameView.cpp: (WebCore::FrameView::paintContents): Disable FCP fake-paint in LFC mode. * page/Page.cpp: (WebCore::Page::doAfterUpdateRendering): * page/Performance.cpp: (WebCore::Performance::getEntries const): (WebCore::Performance::getEntriesByType const): (WebCore::Performance::getEntriesByName const): (WebCore::Performance::reportFirstContentfulPaint): * page/Performance.h: Support first-contentful-paint reporting. * page/PerformanceEntry.cpp: (WebCore::PerformanceEntry::parseEntryTypeString): * page/PerformanceEntry.h: (WebCore::PerformanceEntry::isPaint const): * page/PerformanceObserver.cpp: (WebCore::PerformanceObserver::supportedEntryTypes): * page/PerformanceObserver.h: * page/PerformanceObserver.idl: * page/PerformancePaintTiming.h: Added. (isType): * page/PerformancePaintTiming.idl: Added. Add paint performance entry type. * page/RuntimeEnabledFeatures.h: (WebCore::RuntimeEnabledFeatures::setPaintTimingEnabled): (WebCore::RuntimeEnabledFeatures::paintTimingEnabled const): New runtime flag for paint timing. * platform/graphics/GraphicsContext.h: (WebCore::GraphicsContext::detectingContentfulPaint const): (WebCore::GraphicsContext::setContentfulPaintDetected): (WebCore::GraphicsContext::contenfulPaintDetected const): Add a flag in GraphicsContext where different render operations can report if they're contentful. * rendering/ContentfulPaintChecker.cpp: Added. (WebCore::ContentfulPaintChecker::qualifiesForContentfulPaint): * rendering/ContentfulPaintChecker.h: Added. Run a "dummy" paint of the FrameView, to detect contentful elements. * rendering/RenderBoxModelObject.cpp: (WebCore::RenderBoxModelObject::paintFillLayerExtended): * rendering/RenderHTMLCanvas.cpp: (WebCore::RenderHTMLCanvas::paintReplaced): * rendering/RenderImage.cpp: (WebCore::RenderImage::paintReplaced): * rendering/RenderLayer.cpp: (WebCore::RenderLayer::paintLayerContents): * rendering/RenderVideo.cpp: (WebCore::RenderVideo::paintReplaced): * rendering/TextPainter.cpp: (WebCore::TextPainter::paintTextOrEmphasisMarks): * rendering/svg/RenderSVGRoot.cpp: (WebCore::RenderSVGRoot::paintReplaced): Report contentfulness when we reach anything that qualifies as contentful, based on https://w3c.github.io/paint-timing/#contentful. 2020-04-28 Simon Fraser <simon.fraser@apple.com> MRMediaRemoteSetNowPlayingApplicationPlaybackStateForOrigin log with no error https://bugs.webkit.org/show_bug.cgi?id=211145 Reviewed by Jer Noble. Don't log when MRMediaRemoteSetNowPlayingApplicationPlaybackStateForOrigin() returns 0. * platform/audio/cocoa/MediaSessionManagerCocoa.mm: (WebCore::MediaSessionManagerCocoa::setNowPlayingInfo): 2020-04-28 Ross Kirsling <ross.kirsling@sony.com> [JSC] Align upon the name isCallable instead of isFunction https://bugs.webkit.org/show_bug.cgi?id=211140 Reviewed by Darin Adler. * Modules/plugins/QuickTimePluginReplacement.mm: (WebCore::QuickTimePluginReplacement::ensureReplacementScriptInjected): * bindings/js/JSCustomElementRegistryCustom.cpp: (WebCore::getCustomElementCallback): * bindings/js/JSDOMConvertCallbacks.h: (WebCore::Converter<IDLCallbackFunction<T>>::convert): * bindings/js/JSDOMConvertScheduledAction.h: (WebCore::Converter<IDLScheduledAction>::convert): * bindings/js/JSDOMPromise.cpp: (WebCore::DOMPromise::whenPromiseIsSettled): * bindings/js/JSDOMWindowCustom.cpp: (WebCore::JSDOMWindow::queueMicrotask): * bindings/js/JSWorkerGlobalScopeCustom.cpp: (WebCore::JSWorkerGlobalScope::queueMicrotask): * bindings/js/ReadableStream.cpp: (WebCore::ReadableStream::pipeTo): (WebCore::ReadableStream::tee): * bindings/js/ReadableStreamDefaultController.cpp: (WebCore::ReadableStreamDefaultController::invoke): * bindings/js/ScriptController.cpp: (WebCore::ScriptController::callInWorld): * bindings/scripts/CodeGeneratorJS.pm: (GenerateOverloadDispatcher): * html/HTMLMediaElement.cpp: (WebCore::HTMLMediaElement::ensureMediaControlsInjectedScript): * testing/Internals.cpp: (WebCore::Internals::parserMetaData): (WebCore::Internals::cloneArrayBuffer): * worklets/PaintWorkletGlobalScope.cpp: (WebCore::PaintWorkletGlobalScope::registerPaint): 2020-04-28 Simon Fraser <simon.fraser@apple.com> Rewrite GraphicsLayerCA::updateSublayerList() https://bugs.webkit.org/show_bug.cgi?id=211137 Reviewed by Zalan Bujtas. This function was hard to understand, with aliasing of a layer list to handle the various configurations. Future patches will add a bit more complexity here. Rewrite using lambdas, which makes it easier to follow. * platform/graphics/ca/GraphicsLayerCA.cpp: (WebCore::GraphicsLayerCA::updateSublayerList): 2020-04-28 Christopher Reid <chris.reid@sony.com> [Win] Bundle Inspector Resources in Release builds https://bugs.webkit.org/show_bug.cgi?id=210942 Reviewed by Fujii Hironori. * CMakeLists.txt: 2020-04-28 Rob Buis <rbuis@igalia.com> Remove downloadAttribute from DocumentLoader https://bugs.webkit.org/show_bug.cgi?id=210493 Reviewed by Darin Adler. Remove downloadAttribute from DocumentLoader since this can be obtained from the NavigationAction. * loader/DocumentLoader.h: (WebCore::DocumentLoader::downloadAttribute const): (WebCore::DocumentLoader::setDownloadAttribute): Deleted. * loader/FrameLoader.cpp: (WebCore::FrameLoader::loadURL): (WebCore::FrameLoader::loadWithNavigationAction): (WebCore::FrameLoader::loadPostRequest): * loader/FrameLoader.h: 2020-04-28 Jack Lee <shihchieh_lee@apple.com> Nullptr crash in EditCommand::EditCommand via CompositeEditCommand::removeNode https://bugs.webkit.org/show_bug.cgi?id=207600 <rdar://problem/56969450> Reviewed by Geoffrey Garen. Move FrameSelection and Editor objects from Frame to Document so when a document is detached in nested command executions, the next EditCommand would not fail in constructor. Test: editing/inserting/insert-list-then-edit-command-crash.html * dom/Document.cpp: (WebCore::m_selection): (WebCore::Document::willBeRemovedFromFrame): (WebCore::m_undoManager): Deleted. (WebCore::Document::prepareForDestruction): Deleted. * dom/Document.h: (WebCore::Document::editor): (WebCore::Document::editor const): (WebCore::Document::selection): (WebCore::Document::selection const): * editing/AlternativeTextController.cpp: (WebCore::AlternativeTextController::AlternativeTextController): (WebCore::AlternativeTextController::stopPendingCorrection): (WebCore::AlternativeTextController::isSpellingMarkerAllowed const): (WebCore::AlternativeTextController::applyAutocorrectionBeforeTypingIfAppropriate): (WebCore::AlternativeTextController::respondToUnappliedSpellCorrection): (WebCore::AlternativeTextController::timerFired): (WebCore::AlternativeTextController::handleAlternativeTextUIResult): (WebCore::AlternativeTextController::rootViewRectForRange const): (WebCore::AlternativeTextController::respondToChangedSelection): (WebCore::AlternativeTextController::respondToAppliedEditing): (WebCore::AlternativeTextController::respondToUnappliedEditing): (WebCore::AlternativeTextController::editorClient): (WebCore::AlternativeTextController::markPrecedingWhitespaceForDeletedAutocorrectionAfterCommand): (WebCore::AlternativeTextController::processMarkersOnTextToBeReplacedByResult): (WebCore::AlternativeTextController::respondToMarkerAtEndOfWord): (WebCore::AlternativeTextController::alternativeTextClient): (WebCore::AlternativeTextController::applyAlternativeTextToRange): (WebCore::AlternativeTextController::insertDictatedText): (WebCore::AlternativeTextController::applyDictationAlternative): * editing/AlternativeTextController.h: (WebCore::AlternativeTextController::UNLESS_ENABLED): * editing/CompositeEditCommand.cpp: (WebCore::EditCommandComposition::unapply): (WebCore::EditCommandComposition::reapply): (WebCore::CompositeEditCommand::willApplyCommand): (WebCore::CompositeEditCommand::didApplyCommand): (WebCore::CompositeEditCommand::targetRanges const): (WebCore::CompositeEditCommand::moveParagraphs): * editing/DeleteSelectionCommand.cpp: (WebCore::DeleteSelectionCommand::saveTypingStyleState): (WebCore::DeleteSelectionCommand::mergeParagraphs): (WebCore::DeleteSelectionCommand::calculateTypingStyleAfterDelete): (WebCore::DeleteSelectionCommand::doApply): * editing/EditCommand.cpp: (WebCore::EditCommand::EditCommand): (WebCore::EditCommand::isEditingTextAreaOrTextInput const): (WebCore::EditCommand::postTextStateChangeNotification): (WebCore::EditCommand::frame): Deleted. (WebCore::EditCommand::frame const): Deleted. * editing/EditCommand.h: * editing/Editing.cpp: (WebCore::createDefaultParagraphElement): * editing/EditingStyle.cpp: (WebCore::StyleChange::StyleChange): * editing/Editor.cpp: (WebCore::ClearTextCommand::CreateAndApply): (WebCore::TemporarySelectionChange::TemporarySelectionChange): (WebCore::TemporarySelectionChange::~TemporarySelectionChange): (WebCore::TemporarySelectionChange::setSelection): (WebCore::Editor::selectionForCommand): (WebCore::Editor::behavior const): (WebCore::Editor::client const): (WebCore::Editor::canEdit const): (WebCore::Editor::canEditRichly const): (WebCore::Editor::canDHTMLCut): (WebCore::Editor::canDHTMLCopy): (WebCore::Editor::canCopy const): (WebCore::Editor::canPaste const): (WebCore::Editor::canDelete const): (WebCore::Editor::shouldSmartDelete): (WebCore::Editor::deleteWithDirection): (WebCore::Editor::deleteSelectionWithSmartDelete): (WebCore::Editor::clearText): (WebCore::Editor::replaceSelectionWithFragment): (WebCore::Editor::selectedRange): (WebCore::Editor::tryDHTMLCopy): (WebCore::Editor::tryDHTMLCut): (WebCore::Editor::shouldInsertText const): (WebCore::Editor::hasBidiSelection const): (WebCore::Editor::selectionUnorderedListState const): (WebCore::Editor::selectionOrderedListState const): (WebCore::Editor::increaseSelectionListLevel): (WebCore::Editor::increaseSelectionListLevelOrdered): (WebCore::Editor::increaseSelectionListLevelUnordered): (WebCore::Editor::decreaseSelectionListLevel): (WebCore::Editor::findEventTargetFromSelection const): (WebCore::Editor::applyStyle): (WebCore::Editor::applyParagraphStyle): (WebCore::Editor::applyStyleToSelection): (WebCore::Editor::applyParagraphStyleToSelection): (WebCore::Editor::selectionStartHasStyle const): (WebCore::Editor::selectionHasStyle const): (WebCore::Editor::selectionStartCSSPropertyValue): (WebCore::Editor::appliedEditing): (WebCore::Editor::Editor): (WebCore::Editor::clear): (WebCore::Editor::insertText): (WebCore::Editor::insertTextForConfirmedComposition): (WebCore::Editor::insertTextWithoutSendingTextEvent): (WebCore::Editor::insertLineBreak): (WebCore::Editor::insertParagraphSeparator): (WebCore::Editor::performCutOrCopy): (WebCore::Editor::paste): (WebCore::Editor::pasteAsQuotation): (WebCore::Editor::renderLayerDidScroll): (WebCore::Editor::setBaseWritingDirection): (WebCore::Editor::baseWritingDirectionForSelectionStart const): (WebCore::Editor::selectComposition): (WebCore::SetCompositionScope::SetCompositionScope): (WebCore::SetCompositionScope::~SetCompositionScope): (WebCore::Editor::setComposition): (WebCore::Editor::ignoreSpelling): (WebCore::Editor::learnSpelling): (WebCore::Editor::advanceToNextMisspelling): (WebCore::Editor::misspelledWordAtCaretOrRange const): (WebCore::Editor::isSelectionUngrammatical): (WebCore::Editor::guessesForMisspelledWord const): (WebCore::Editor::guessesForMisspelledOrUngrammatical): (WebCore::Editor::markMisspellingsAfterTypingToWord): (WebCore::Editor::isSpellCheckingEnabledInFocusedNode const): (WebCore::Editor::markAllMisspellingsAndBadGrammarInRanges): (WebCore::Editor::markAndReplaceFor): (WebCore::Editor::updateMarkersForWordsAffectedByEditing): (WebCore::Editor::rangeForPoint): (WebCore::Editor::revealSelectionAfterEditingOperation): (WebCore::Editor::setIgnoreSelectionChanges): (WebCore::Editor::getCompositionSelection const): (WebCore::Editor::transpose): (WebCore::Editor::changeSelectionAfterCommand): (WebCore::Editor::selectedText const): (WebCore::Editor::selectedTextForDataTransfer const): (WebCore::Editor::insertTextPlaceholder): (WebCore::Editor::removeTextPlaceholder): (WebCore::Editor::shouldChangeSelection const): (WebCore::Editor::computeAndSetTypingStyle): (WebCore::Editor::findString): (WebCore::Editor::countMatchesForText): (WebCore::Editor::respondToChangedSelection): (WebCore::Editor::shouldDetectTelephoneNumbers const): (WebCore::Editor::scanSelectionForTelephoneNumbers): (WebCore::Editor::editorUIUpdateTimerFired): (WebCore::Editor::selectionStartHasMarkerFor const): (WebCore::Editor::stringForCandidateRequest const): (WebCore::Editor::contextRangeForCandidateRequest const): (WebCore::Editor::fontAttributesAtSelectionStart const): (WebCore::Editor::notifyClientOfAttachmentUpdates): (WebCore::Editor::handleAcceptedCandidate): (WebCore::Editor::unifiedTextCheckerEnabled const): (WebCore::Editor::toggleOverwriteModeEnabled): (WebCore::Editor::fontForSelection const): (WebCore::Editor::canCopyExcludingStandaloneImages const): (WebCore::Editor::document const): Deleted. * editing/Editor.h: (WebCore::TemporarySelectionChange::TemporarySelectionChange): (WebCore::IgnoreSelectionChangeForScope::IgnoreSelectionChangeForScope): (WebCore::Editor::document const): * editing/EditorCommand.cpp: (WebCore::executeSwapWithMark): (WebCore::Editor::command): (WebCore::Editor::Command::Command): (WebCore::Editor::Command::execute const): * editing/FrameSelection.cpp: (WebCore::shouldAlwaysUseDirectionalSelection): (WebCore::FrameSelection::FrameSelection): (WebCore::FrameSelection::rootEditableElementOrDocumentElement const): (WebCore::FrameSelection::setSelectionByMouseIfDifferent): (WebCore::FrameSelection::setSelectionWithoutUpdatingAppearance): (WebCore::FrameSelection::setSelection): (WebCore::updateSelectionByUpdatingLayoutOrStyle): (WebCore::FrameSelection::setNeedsSelectionUpdate): (WebCore::FrameSelection::updateAndRevealSelection): (WebCore::FrameSelection::updateDataDetectorsForSelection): (WebCore::FrameSelection::positionForPlatform const): (WebCore::FrameSelection::nextWordPositionForPlatform): (WebCore::FrameSelection::modifyMovingRight): (WebCore::FrameSelection::modifyMovingLeft): (WebCore::FrameSelection::modify): (WebCore::FrameSelection::willBeRemovedFromFrame): (WebCore::FrameSelection::absoluteCaretBounds): (WebCore::FrameSelection::recomputeCaretRect): (WebCore::FrameSelection::contains const): (WebCore::FrameSelection::selectAll): (WebCore::FrameSelection::focusedOrActiveStateChanged): (WebCore::FrameSelection::isFocusedAndActive const): (WebCore::shouldStopBlinkingDueToTypingCommand): (WebCore::FrameSelection::updateAppearance): (WebCore::FrameSelection::setCaretVisibility): (WebCore::FrameSelection::setFocusedElementIfNeeded): (WebCore::FrameSelection::shouldDeleteSelection const): (WebCore::FrameSelection::selectionBounds const): (WebCore::FrameSelection::getClippedVisibleTextRectangles const): (WebCore::FrameSelection::currentForm const): (WebCore::FrameSelection::revealSelection): (WebCore::FrameSelection::setSelectionFromNone): (WebCore::FrameSelection::shouldChangeSelection const): (WebCore::FrameSelection::setShouldShowBlockCursor): (WebCore::FrameSelection::appearanceUpdateTimerFired): (WebCore::FrameSelection::updateAppearanceAfterLayoutOrStyleChange): (WebCore::FrameSelection::selectRangeOnElement): (WebCore::FrameSelection::setCaretBlinks): (WebCore::FrameSelection::prepareForDestruction): Deleted. * editing/FrameSelection.h: * editing/InsertIntoTextNodeCommand.cpp: (WebCore::InsertIntoTextNodeCommand::doApply): * editing/InsertLineBreakCommand.cpp: (WebCore::InsertLineBreakCommand::doApply): * editing/InsertTextCommand.cpp: (WebCore::InsertTextCommand::doApply): * editing/ReplaceRangeWithTextCommand.cpp: (WebCore::ReplaceRangeWithTextCommand::doApply): * editing/ReplaceSelectionCommand.cpp: (WebCore::ReplaceSelectionCommand::doApply): * editing/SetSelectionCommand.cpp: (WebCore::SetSelectionCommand::doApply): (WebCore::SetSelectionCommand::doUnapply): * editing/SpellChecker.cpp: (WebCore::SpellChecker::SpellChecker): (WebCore::SpellChecker::client const): (WebCore::SpellChecker::isAsynchronousEnabled const): (WebCore::SpellChecker::invokeRequest): (WebCore::SpellChecker::didCheck): (WebCore::SpellChecker::didCheckSucceed): * editing/SpellChecker.h: * editing/SpellingCorrectionCommand.cpp: (WebCore::SpellingCorrectionCommand::doApply): * editing/TypingCommand.cpp: (WebCore::TypingCommand::deleteSelection): (WebCore::TypingCommand::deleteKeyPressed): (WebCore::TypingCommand::forwardDeleteKeyPressed): (WebCore::TypingCommand::updateSelectionIfDifferentFromCurrentSelection): (WebCore::TypingCommand::insertText): (WebCore::TypingCommand::insertLineBreak): (WebCore::TypingCommand::insertParagraphSeparatorInQuotedContent): (WebCore::TypingCommand::insertParagraphSeparator): (WebCore::TypingCommand::lastTypingCommandIfStillOpenForTyping): (WebCore::TypingCommand::closeTyping): (WebCore::TypingCommand::ensureLastEditCommandHasCurrentSelectionIfOpenForMoreTyping): (WebCore::TypingCommand::markMisspellingsAfterTyping): (WebCore::TypingCommand::willAddTypingToOpenCommand): (WebCore::TypingCommand::typingAddedToOpenCommand): (WebCore::TypingCommand::insertTextAndNotifyAccessibility): (WebCore::TypingCommand::insertTextRunWithoutNewlines): (WebCore::TypingCommand::insertLineBreakAndNotifyAccessibility): (WebCore::TypingCommand::insertParagraphSeparatorAndNotifyAccessibility): (WebCore::TypingCommand::insertParagraphSeparatorInQuotedContentAndNotifyAccessibility): * editing/TypingCommand.h: * editing/cocoa/EditorCocoa.mm: (WebCore::Editor::selectionInHTMLFormat): (WebCore::selectionAsAttributedString): (WebCore::Editor::writeSelectionToPasteboard): (WebCore::Editor::writeSelection): (WebCore::Editor::selectionInWebArchiveFormat): (WebCore::Editor::replaceSelectionWithAttributedString): (WebCore::Editor::webContentFromPasteboard): (WebCore::Editor::takeFindStringFromSelection): * editing/gtk/EditorGtk.cpp: (WebCore::Editor::pasteWithPasteboard): (WebCore::Editor::writeSelectionToPasteboard): (WebCore::Editor::webContentFromPasteboard): * editing/ios/EditorIOS.mm: (WebCore::Editor::setTextAlignmentForChangedBaseWritingDirection): (WebCore::Editor::removeUnchangeableStyles): (WebCore::Editor::pasteWithPasteboard): (WebCore::Editor::insertDictationPhrases): (WebCore::Editor::setDictationPhrasesAsChildOfElement): (WebCore::Editor::setTextAsChildOfElement): (WebCore::Editor::ensureLastEditCommandHasCurrentSelectionIfOpenForMoreTyping): * editing/libwpe/EditorLibWPE.cpp: (WebCore::Editor::writeSelectionToPasteboard): (WebCore::Editor::pasteWithPasteboard): * editing/mac/EditorMac.mm: (WebCore::Editor::readSelectionFromPasteboard): (WebCore::Editor::replaceNodeFromPasteboard): (WebCore::Editor::selectionWillChange): * editing/win/EditorWin.cpp: (WebCore::Editor::pasteWithPasteboard): (WebCore::Editor::webContentFromPasteboard): * history/CachedFrame.cpp: (WebCore::CachedFrame::destroy): * loader/FrameLoader.cpp: (WebCore::FrameLoader::willTransitionToCommitted): (WebCore::FrameLoader::closeURL): (WebCore::FrameLoader::didOpenURL): (WebCore::FrameLoader::clear): * page/Frame.cpp: (WebCore::Frame::Frame): (WebCore::Frame::setView): (WebCore::Frame::setDocument): (WebCore::Frame::requestDOMPasteAccess): (WebCore::Frame::setPageAndTextZoomFactors): * page/Frame.h: * page/TextIndicator.cpp: (WebCore::TextIndicator::createWithRange): 2020-04-28 Antti Koivisto <antti@apple.com> msn.com: Header flickers when scrolling articles https://bugs.webkit.org/show_bug.cgi?id=211126 <rdar://problem/56439177> Reviewed by Simon Fraser. Test: compositing/fixed-with-clip-stability.html In case of fixed positioned elements the decision to create backing depends on clip rect. However RenderLayer::localClipRect() tests for backing in call to clippingRootForPainting(). This creates instability since clipping depends on backing decision, and backing decision depends on clipping. * rendering/RenderLayer.cpp: (WebCore::RenderLayer::localClipRect const): Specifically the result of clipExceedsBounds test here is affected by computed offsetFromRoot: "clipRect.contains(cssClipRect)" test fails for zero sized clips with different offsets. Compute clipExceedsBounds by looking at the clip sizes only and ignoring the position (which should match). 2020-04-28 Zalan Bujtas <zalan@apple.com> [LFC] Introduce FormattingContext::ConstraintsForOutOfFlowContent https://bugs.webkit.org/show_bug.cgi?id=211125 Reviewed by Antti Koivisto. Horizontal and vertical out-of-flow constraints are always computed and used in pairs. * layout/FormattingContext.cpp: (WebCore::Layout::FormattingContext::computeOutOfFlowHorizontalGeometry): (WebCore::Layout::FormattingContext::computeOutOfFlowVerticalGeometry): (WebCore::Layout::FormattingContext::layoutOutOfFlowContent): * layout/FormattingContext.h: * layout/FormattingContextGeometry.cpp: (WebCore::Layout::FormattingContext::Geometry::constraintsForOutOfFlowContent): (WebCore::Layout::FormattingContext::Geometry::horizontalConstraintsForOutOfFlow): Deleted. (WebCore::Layout::FormattingContext::Geometry::verticalConstraintsForOutOfFlow): Deleted. * layout/LayoutContext.cpp: (WebCore::Layout::LayoutContext::layoutFormattingContextSubtree): * layout/LayoutUnits.h: * layout/blockformatting/BlockFormattingContext.cpp: (WebCore::Layout::BlockFormattingContext::layoutInFlowContent): * layout/inlineformatting/InlineFormattingContext.cpp: (WebCore::Layout::InlineFormattingContext::layoutInFlowContent): 2020-04-28 Zalan Bujtas <zalan@apple.com> [LFC] Introduce FormattingContext::ConstraintsForInFlowContent https://bugs.webkit.org/show_bug.cgi?id=211113 Reviewed by Antti Koivisto. This makes the layoutInFlowContent() related code look simpler. * layout/FormattingContext.cpp: (WebCore::Layout::FormattingContext::layoutOutOfFlowContent): * layout/FormattingContext.h: * layout/LayoutContext.cpp: (WebCore::Layout::LayoutContext::layoutFormattingContextSubtree): * layout/blockformatting/BlockFormattingContext.cpp: (WebCore::Layout::BlockFormattingContext::layoutInFlowContent): * layout/blockformatting/BlockFormattingContext.h: * layout/inlineformatting/InlineFormattingContext.cpp: (WebCore::Layout::InlineFormattingContext::layoutInFlowContent): (WebCore::Layout::InlineFormattingContext::lineLayout): * layout/inlineformatting/InlineFormattingContext.h: * layout/integration/LayoutIntegrationLineLayout.cpp: (WebCore::LayoutIntegration::LineLayout::layout): * layout/tableformatting/TableFormattingContext.cpp: (WebCore::Layout::TableFormattingContext::layoutInFlowContent): (WebCore::Layout::TableFormattingContext::layoutCell): * layout/tableformatting/TableFormattingContext.h: 2020-04-28 Philippe Normand <pnormand@igalia.com> media/track/track-load-error-readyState.html passes only when accompanied by some other tests https://bugs.webkit.org/show_bug.cgi?id=210976 Reviewed by Xabier Rodriguez-Calvar. * testing/Internals.cpp: (WebCore::Internals::resetToConsistentState): Reset caption display mode, which might have been overriden by a previous test. 2020-04-28 Adrian Perez de Castro <aperez@igalia.com> Non-unified build fixes late April 2020 edition https://bugs.webkit.org/show_bug.cgi?id=211099 Unreviewed build fix. No new tests needed. * Modules/cache/DOMCacheStorage.cpp: Sprinkle DOMCacheEngine:: namespace prefixes as needed. (WebCore::DOMCacheStorage::findCacheOrCreate): (WebCore::DOMCacheStorage::retrieveCaches): (WebCore::DOMCacheStorage::doOpen): (WebCore::DOMCacheStorage::doRemove): * bindings/js/JSExecStateInstrumentation.h: Ditto for JSC:: namespace prefixes. (WebCore::JSExecState::instrumentFunction): * dom/ScriptedAnimationController.h: Add missing ReducedResolutionSeconds.h header. * editing/TextCheckingHelper.h: Add missing forward declaration for Position. * html/URLSearchParams.h: Add missing ExceptionOr.h header. 2020-04-28 Charlie Turner <cturner@igalia.com> [EME][CDMProxy] Default initialize m_numDecryptorsWaitingForKey member https://bugs.webkit.org/show_bug.cgi?id=210970 Reviewed by Xabier Rodriguez-Calvar. This was causing non-deterministic reads of the m_numDecryptorsWaitingForKey member. Sometimes a waiting for key event would fail to fire and cause test failures. I thought std::atomic<int> would default initialize to zero, but after spec-diving I realise now I was wrong about that. Test: encrypted-media/clearkey-mp4-waiting-for-a-key.https.html * platform/encryptedmedia/CDMProxy.h: 2020-04-28 Youenn Fablet <youenn@apple.com> RTCPeerConnection should not remove its created remote MediaStream objects until getting close https://bugs.webkit.org/show_bug.cgi?id=211070 Reviewed by Alex Christensen. Remove no longer needed code. This aligns with the spec and Firefox implementation. Test: webrtc/direction-change.html * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp: (WebCore::LibWebRTCMediaEndpoint::transceiverBackendFromSender): * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.h: 2020-04-28 Youenn Fablet <youenn@apple.com> Ensure remote track event gets unmuted after the track event is fired https://bugs.webkit.org/show_bug.cgi?id=211071 Reviewed by Alex Christensen. This code was made obsolete by the setMuted(false) call done just after firing the track event. Given the setMuted(false) in addPendingTrackEvent was done asynchronously and was triggering firing the muted event asynchronously, this change should not be observable from JS. * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp: (WebCore::LibWebRTCMediaEndpoint::addPendingTrackEvent): 2020-04-28 Rob Buis <rbuis@igalia.com> Make HistoryController an inner class of FrameLoader https://bugs.webkit.org/show_bug.cgi?id=211090 Reviewed by Darin Adler. Make HistoryController an inner class of FrameLoader, this allows us to move some methods only used by HistoryController out of the FrameLoader public API. * loader/FrameLoader.h: * loader/HistoryController.cpp: * loader/HistoryController.h: 2020-04-27 Simon Fraser <simon.fraser@apple.com> Do correct clipping of composited replaced elements with border-radius https://bugs.webkit.org/show_bug.cgi?id=211114 Reviewed by Zalan Bujtas. For replaced elements with composited content (video, WebGL), RenderLayerBacking incorrectly used the rounded inner border rect to clip the contents. This doesn't match painted replaced elements, which clip to the inside of the padding box. Fix by implementing RenderReplaced::roundedContentBoxRect() and calling it from compositing code. Also add a helper to get the rounded border box rect, and call it in various places. Test: compositing/clipping/border-radius-on-webgl.html * rendering/RenderBox.cpp: (WebCore::RenderBox::roundedBorderBoxRect const): * rendering/RenderBox.h: * rendering/RenderLayerBacking.cpp: (WebCore::RenderLayerBacking::updateBackdropFiltersGeometry): (WebCore::RenderLayerBacking::updateConfiguration): (WebCore::RenderLayerBacking::updateGeometry): (WebCore::RenderLayerBacking::updateContentsRects): (WebCore::RenderLayerBacking::resetContentsRect): (WebCore::RenderLayerBacking::updateChildClippingStrategy): (WebCore::RenderLayerBacking::updateDirectlyCompositedBackgroundImage): (WebCore::RenderLayerBacking::updateImageContents): (WebCore::backgroundRectForBox): * rendering/RenderLayerBacking.h: * rendering/RenderReplaced.cpp: (WebCore::RenderReplaced::roundedContentBoxRect const): * rendering/RenderReplaced.h: 2020-04-27 Said Abou-Hallawa <sabouhallawa@apple.com> Timestamps should be the same for all rendering update steps https://bugs.webkit.org/show_bug.cgi?id=207153 Reviewed by Simon Fraser. The HTML 5 event loop sepcs states that timestamps should be the same for all rendering update steps. Specs link (step 9): https://html.spec.whatwg.org/multipage/webappapis.html#event-loop-processing-model This patch also fixes some issues in IntersectionObserver. Test: intersection-observer/intersection-observer-callback-timestamp.html * dom/Document.cpp: (WebCore::Document::updateIntersectionObservations): (WebCore::Document::notifyIntersectionObserversTimerFired): Deleted. * dom/Document.h: -- Handle the case when two floats are areEssentiallyEqual(). -- Execute the IntersectionObserver immediately and do not wait until the next CFRunLoop event since this does not implement the specs. * page/DOMWindow.cpp: (WebCore::DOMWindow::freezeNowTimestamp): (WebCore::DOMWindow::unfreezeNowTimestamp): (WebCore::DOMWindow::frozenNowTimestamp const): * page/DOMWindow.h: Provide a frozen now() timestamp in seconds to be used internally only. * page/IntersectionObserver.cpp: (WebCore::IntersectionObserver::nowTimestamp const): Use the frozenNowTimestamp(). * page/Page.cpp: (WebCore::Page::updateRendering): Freeze the timestamps while serving the rendering update steps. 2020-04-27 Dean Jackson <dino@apple.com> getShaderPrecisionFormat returns the wrong values https://bugs.webkit.org/show_bug.cgi?id=211013 <rdar://problem/62378056> Reviewed by Darin Adler. Gregg pointed out that our code hardcodes values for getShaderPrecisionFormat. The fix is simply to call into the underlying GL function. Covered by the existing test: webgl/1.0.3/conformance/misc/shader-precision-format.html However, that just tests minimum values. Devices have different actual results. * platform/graphics/angle/GraphicsContextGLANGLE.cpp: (WebCore::GraphicsContextGLOpenGL::getShaderPrecisionFormat): 2020-04-27 Simon Fraser <simon.fraser@apple.com> Rename scrollableAreaForScrollLayerID to scrollableAreaForScrollingNodeID https://bugs.webkit.org/show_bug.cgi?id=211091 Reviewed by Myles C. Maxfield. The argument to scrollableAreaForScrollLayerID() is a ScrollingNodeID, not a layerID. * page/FrameView.cpp: (WebCore::FrameView::scrollableAreaForScrollingNodeID const): (WebCore::FrameView::scrollableAreaForScrollLayerID const): Deleted. * page/FrameView.h: * page/scrolling/AsyncScrollingCoordinator.cpp: (WebCore::AsyncScrollingCoordinator::updateScrollPositionAfterAsyncScroll): (WebCore::AsyncScrollingCoordinator::setActiveScrollSnapIndices): * rendering/RenderLayerCompositor.cpp: (WebCore::RenderLayerCompositor::scrollableAreaForScrollingNodeID const): (WebCore::RenderLayerCompositor::scrollableAreaForScrollLayerID const): Deleted. * rendering/RenderLayerCompositor.h: 2020-04-27 Ryan Haddad <ryanhaddad@apple.com> [Cocoa] stop using out arguments for document attributes when converting to attributed strings https://bugs.webkit.org/show_bug.cgi?id=211048 Unreviewed partial revert of r260739 to remove unexpected logging that broke Catalina-Release-WK2-Perf tests. * platform/network/cocoa/NetworkStorageSessionCocoa.mm: (WebCore::policyProperties): * platform/network/cocoa/ResourceRequestCocoa.mm: (WebCore::siteForCookies): 2020-04-27 Wenson Hsieh <wenson_hsieh@apple.com> Text manipulation should not aggregate text from different navigation anchor elements https://bugs.webkit.org/show_bug.cgi?id=211081 <rdar://problem/59553658> Reviewed by Megan Gardner. Tweak the item boundary heuristic in `TextManipulationController::observeParagraphs` to separate text in links and list items under navigation elements (either nav elements, or elements with the "navigation" accessibility role) into separate paragraphs. Also, extend the item boundary rule for button elements to apply to elements with the "button" accessibility role as well. Test: TextManipulation.StartTextManipulationTreatsInlineBlockLinksAndButtonsAsParagraphs TextManipulation.StartTextManipulationTreatsLinksInNavigationElementsAsParagraphs * editing/TextManipulationController.cpp: (WebCore::TextManipulationController::observeParagraphs): 2020-04-27 Antoine Quint <graouts@apple.com> Clean up some useless includes of CSSAnimationController.h https://bugs.webkit.org/show_bug.cgi?id=211066 Reviewed by Antti Koivisto. These files don't actually use any of the CSSAnimationController APIs. * page/ios/FrameIOS.mm: * rendering/RenderObject.cpp: 2020-04-27 Antoine Quint <graouts@apple.com> Rename CSSAnimationController accessors from animation() to legacyAnimation() https://bugs.webkit.org/show_bug.cgi?id=211082 Reviewed by Simon Fraser. * css/CSSComputedStyleDeclaration.cpp: (WebCore::computeRenderStyleForProperty): * dom/Document.cpp: (WebCore::Document::resolveStyle): (WebCore::Document::didBecomeCurrentDocumentInFrame): (WebCore::Document::prepareForDestruction): (WebCore::Document::implicitClose): (WebCore::Document::resume): * dom/Element.cpp: (WebCore::Element::removedFromAncestor): * dom/PseudoElement.cpp: (WebCore::PseudoElement::clearHostElement): * history/CachedFrame.cpp: (WebCore::CachedFrame::destroy): * page/Frame.cpp: (WebCore::Frame::clearTimers): (WebCore::Frame::resumeActiveDOMObjectsAndAnimations): * page/Frame.h: * page/FrameView.cpp: (WebCore::FrameView::didDestroyRenderTree): (WebCore::FrameView::updateLayoutAndStyleIfNeededRecursive): * page/FrameViewLayoutContext.cpp: (WebCore::FrameViewLayoutContext::layout): * page/Page.cpp: (WebCore::Page::handleLowModePowerChange): (WebCore::Page::setIsVisibleInternal): (WebCore::Page::hiddenPageCSSAnimationSuspensionStateChanged): * page/animation/CSSAnimationController.cpp: (WebCore::CSSAnimationControllerPrivate::updateThrottlingState): (WebCore::CSSAnimationControllerPrivate::suspendAnimations): (WebCore::CSSAnimationControllerPrivate::resumeAnimations): * rendering/RenderLayer.cpp: (WebCore::RenderLayer::currentTransform const): (WebCore::RenderLayer::calculateClipRects const): * rendering/RenderLayerBacking.cpp: (WebCore::RenderLayerBacking::updateGeometry): (WebCore::RenderLayerBacking::notifyAnimationStarted): * rendering/RenderLayerCompositor.cpp: (WebCore::RenderLayerCompositor::flushPendingLayerChanges): (WebCore::RenderLayerCompositor::updateCompositingLayers): (WebCore::RenderLayerCompositor::requiresCompositingForAnimation const): (WebCore::RenderLayerCompositor::isRunningTransformAnimation const): * rendering/RenderObject.h: (WebCore::RenderObject::legacyAnimation const): (WebCore::RenderObject::animation const): Deleted. * rendering/updating/RenderTreeUpdater.cpp: (WebCore::RenderTreeUpdater::tearDownRenderers): * style/StyleTreeResolver.cpp: (WebCore::Style::TreeResolver::createAnimatedElementUpdate): * testing/Internals.cpp: (WebCore::Internals::numberOfActiveAnimations const): (WebCore::Internals::animationsAreSuspended const): (WebCore::Internals::animationsInterval const): (WebCore::Internals::suspendAnimations const): (WebCore::Internals::resumeAnimations const): (WebCore::Internals::pauseAnimationAtTimeOnElement): (WebCore::Internals::pauseAnimationAtTimeOnPseudoElement): (WebCore::Internals::pauseTransitionAtTimeOnElement): (WebCore::Internals::pauseTransitionAtTimeOnPseudoElement): 2020-04-27 Per Arne Vollan <pvollan@apple.com> [Cocoa] After r258891, r255119 can be reverted https://bugs.webkit.org/show_bug.cgi?id=211083 <rdar://problem/60714318> Unreviewed revert of r255119. Copying a MIME type map from the UI process to the WebContent process on startup is not needed anymore, since r258891 will map the Launch Services database in the WebContent process. * platform/MIMETypeRegistry.cpp: (WebCore::commonMimeTypesMap): (WebCore::typesForCommonExtension): (WebCore::overriddenMimeTypesMap): Deleted. * platform/MIMETypeRegistry.h: * testing/Internals.cpp: (WebCore::Internals::mediaMIMETypeForExtension): Deleted. * testing/Internals.h: * testing/Internals.idl: 2020-04-27 Darin Adler <darin@apple.com> Improve performance of commonInclusiveAncestor for deeply nested nodes https://bugs.webkit.org/show_bug.cgi?id=211078 Reviewed by Antti Koivisto. * dom/Node.cpp: (WebCore::depth): Added. (WebCore::commonInclusiveAncestor): Replaced implementation that walks the parent chain of the second node repeatedly with one that walks the parent chain of each node twice. 2020-04-27 Daniel Bates <dabates@apple.com> Caret may be placed in the wrong spot for text input context that is a form control https://bugs.webkit.org/show_bug.cgi?id=210939 <rdar://problem/61943089> Reviewed by Darin Adler. Add a helper function that returns the closest editable position inside an element for a given point (if any). * editing/Editing.cpp: (WebCore::closestEditablePositionInElementForAbsolutePoint): Added. * editing/Editing.h: 2020-04-27 Alicia Boya García <aboya@igalia.com> [GStreamer] Rework WebKitWebSrc threading https://bugs.webkit.org/show_bug.cgi?id=210284 Reviewed by Xabier Rodriguez-Calvar. WebKitWebSrc as it is in master has a number of race conditions leading to occasional starvation (due to cancelling the wrong request) or data corruption (due to pushing data from a cancelled request). The threading situation wasn't easy to follow, as it wasn't clear access to what members should be protected by what mutex, in what circumstances. Also, some parts of the design were also introducing addicional complexity, such as the first request being sent from the main thread whereas the rest were being sent from the streaming thread or basesrc async start. In response, this patch reworks all the locking in WebKitWebSrc to use WTF::DataMutex. This ensures all accesses to its (now explicit) protected members are locked. The two mutexes and condition variables have been simplified into one, as there was no obvious need or benefit for two of each in this case. Requests have been numbered, which allows to safely and atomically ignore results from cancelled requests, avoiding data corruption races, and makes following them in debug logs much easier. The conditions for making and cancelling requests have been simplified to a simpler and safer model: There is at most only one active request at anytime, flushes cancel the request, and the first create() call always makes the new request (both at startup and after a flush). Debug asserts and notes about the flow of operations during basesrc seeks have been provided. As this effort needed a review of the entire WebKitWebSrc, cleanups, corrections and documentation comments have been provided where appropriate. This patch introduces no visible behavior changes, just stability improvements. * platform/graphics/gstreamer/GRefPtrGStreamer.h: * platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp: (WebKitWebSrcPrivate::~WebKitWebSrcPrivate): (webkit_web_src_class_init): (webkitWebSrcReset): (webKitWebSrcConstructed): (webKitWebSrcSetProperty): (webKitWebSrcGetProperty): (webKitWebSrcSetContext): (webKitWebSrcSendEvent): (restartLoaderIfNeeded): (stopLoaderIfNeeded): (webKitWebSrcCreate): (webKitWebSrcStart): (webKitWebSrcMakeRequest): (webKitWebSrcStop): (webKitWebSrcGetSize): (webKitWebSrcIsSeekable): (webKitWebSrcDoSeek): (webKitWebSrcQuery): (webKitWebSrcUnLock): (webKitWebSrcUnLockStop): (webKitWebSrcSetUri): (webKitWebSrcSetMediaPlayer): (webKitSrcPassedCORSAccessCheck): (CachedResourceStreamingClient::CachedResourceStreamingClient): (CachedResourceStreamingClient::checkUpdateBlocksize): (CachedResourceStreamingClient::responseReceived): (CachedResourceStreamingClient::dataReceived): (CachedResourceStreamingClient::accessControlCheckFailed): (CachedResourceStreamingClient::loadFailed): (CachedResourceStreamingClient::loadFinished): (webKitSrcWouldTaintOrigin): * platform/graphics/gstreamer/WebKitWebSourceGStreamer.h: 2020-04-26 Darin Adler <darin@apple.com> Replace more uses of live ranges with SimpleRange https://bugs.webkit.org/show_bug.cgi?id=211058 Reviewed by Antti Koivisto. * accessibility/AccessibilityRenderObject.cpp: (WebCore::AccessibilityRenderObject::textUnderElement const): Use SimpleRange. * dom/BoundaryPoint.h: Moved makeBoundaryPointAfterNodeContents here so it can be used more places. * dom/Node.cpp: (WebCore::commonInclusiveAncestor): Moved the commonAncestorContainer function here from Range, decided to use the "inclusive ancestor" naming from the DOM specification, and used RefPtr for the result since it's part of our modern safer design to always use smart pointers for return values. * dom/Node.h: Added commonInclusiveAncestor. * dom/Position.cpp: (WebCore::commonShadowIncludingAncestor): Call commonInclusiveAncestor. * dom/Range.cpp: (WebCore::Range::commonAncestorContainer): Deleted. (WebCore::Range::isPointInRange): Call commonInclusiveAncestor. (WebCore::Range::comparePoint const): Ditto. (WebCore::Range::compareBoundaryPoints): Ditto. (WebCore::Range::collectSelectionRectsWithoutUnionInteriorLines const): Ditto. * dom/Range.h: (WebCore::Range::commonAncestorContainer const): Call commonInclusiveAncestor. * dom/SimpleRange.cpp: (WebCore::makeBoundaryPointAfterNodeContents): Moved to BoundaryPoint.h. * editing/AlternativeTextController.cpp: (WebCore::AlternativeTextController::respondToUnappliedSpellCorrection): Use SimpleRange instead of live range. (WebCore::AlternativeTextController::respondToUnappliedEditing): Ditto. (WebCore::AlternativeTextController::markPrecedingWhitespaceForDeletedAutocorrectionAfterCommand): Ditto. (WebCore::AlternativeTextController::processMarkersOnTextToBeReplacedByResult): Ditto. * editing/ChangeListTypeCommand.cpp: (WebCore::listConversionTypeForSelection): use commonInclusiveAncestor. * editing/Editing.cpp: (WebCore::isNodeVisiblyContainedWithin): Take a SimpleRange argument. * editing/Editing.h: Updated for the above. * editing/Editor.cpp: (WebCore::Editor::addRangeToKillRing): Take a SimpleRange argument. (WebCore::Editor::shouldDetectTelephoneNumbers const): Made this const and tweaked coding style a bit. (WebCore::scanForTelephoneNumbers): Moved this, made it a non-member function, renamed from scanRangeForTelephoneNumbers, use SimpleRange. (WebCore::extendSelection): Added. Factored out some logic from the function below. (WebCore::Editor::scanSelectionForTelephoneNumbers): Use SimpleRange. Removed some unnecessary code that subtracts 1 and then adds 1 again. * editing/Editor.h: Updated for the above. * editing/TextManipulationController.cpp: (WebCore::TextManipulationController::replace): Use commonInclusiveAncestor. * editing/VisibleSelection.cpp: (WebCore::makeSearchRange): Return a SimpleRange. (WebCore::VisibleSelection::appendTrailingWhitespace): Use SimpleRange. * editing/WebContentReader.h: Use SimpleRange instead of a live range. * editing/cocoa/DataDetection.h: Use a struct, DetectedItem, for the return value from the detection functions. Also changed DataDetectorTypes to an enum class so it can be forward-declared instead of having to include this header. * editing/cocoa/DataDetection.mm: (WebCore::detectItem): Renamed from detectItemAtPositionWithRange. Return the DetectedItem struct, with a SimpleRange rather than an out argument live range. (WebCore::DataDetection::detectItemAroundHitTestResult): Ditto. (WebCore::contains): Added a helper function for testing bits in the DataDetectorType enum. Later we can make this better using OptionSet. (WebCore::constructURLStringForResult): Refactored a bit, updated for the new DataDetectorTypes enum class, and to use CFEqual instead of CFStringCompare. (WebCore::DataDetection::detectContentInRange): Ditto. * editing/cocoa/EditorCocoa.mm: (WebCore::Editor::webContentFromPasteboard): Use SimpleRange. * editing/cocoa/WebContentReaderCocoa.mm: (WebCore::WebContentReader::readPlainText): Updated since context is SimpleRange. * editing/gtk/EditorGtk.cpp: (WebCore::createFragmentFromPasteboardData): Use SimpleRange. (WebCore::Editor::webContentFromPasteboard): Use SimpleRange. * editing/win/EditorWin.cpp: (WebCore::Editor::webContentFromPasteboard): Use SimpleRange. * editing/mac/EditorMac.mm: (WebCore::Editor::replaceNodeFromPasteboard): Use SimpleRange. * loader/FrameLoader.cpp: (WebCore::FrameLoader::checkLoadCompleteForThisFrame): Use SimpleRange. * page/EventHandler.cpp: (WebCore::targetNodeForClickEvent): Use commonInclusiveAncestor. Also updated to return a RefPtr. (WebCore::EventHandler::handleMouseReleaseEvent): Updated for the above. * page/Settings.yaml: Changed the default for DataDetectorTypes to be the empty string rather than a named constant. * page/SettingsBase.h: Forward-declare DataDetectorTypes instead of including the DataDetection.h header. * page/TextIndicator.cpp: (WebCore::TextIndicator::createWithRange): Take a SimpleRange. (WebCore::TextIndicator::createWithSelectionInFrame): Ditto. (WebCore::hasNonInlineOrReplacedElements): Ditto. (WebCore::selectionRects): Ditto. Also renamed from getSelectionRectsForRange. (WebCore::styleContainsComplexBackground): Tweaked implementation. (WebCore::estimatedTextColorsForRange): Take a SimpleRange. (WebCore::absoluteBoundingRectForRange): Ditto. (WebCore::estimatedBackgroundColorForRange): Ditto. (WebCore::containsOnlyWhiteSpaceText): Ditto. (WebCore::initializeIndicator): Ditto. * page/TextIndicator.h: Updated for the above. * page/mac/ServicesOverlayController.h: Use SimpleRange instead of a live range for highlights. * page/mac/ServicesOverlayController.mm: (WebCore::ServicesOverlayController::Highlight::createForSelection): Take SimpleRange. (WebCore::ServicesOverlayController::Highlight::createForTelephoneNumber): Ditto. (WebCore::ServicesOverlayController::Highlight::Highlight): Ditto. (WebCore::ServicesOverlayController::buildPhoneNumberHighlights): Ditto. (WebCore::ServicesOverlayController::buildSelectionHighlight): Ditto. (WebCore::ServicesOverlayController::telephoneNumberRangesForFocusedFrame): Ditto. (WebCore::ServicesOverlayController::highlightsAreEquivalent): Ditto. (WebCore::ServicesOverlayController::findTelephoneNumberHighlightContainingSelectionHighlight): Ditto. (WebCore::ServicesOverlayController::handleClick): Ditto. * platform/ios/DragImageIOS.mm: (WebCore::createDragImageForLink): Use SimpleRange. (WebCore::createDragImageForSelection): Tweaked a bit. 2020-04-27 Carlos Garcia Campos <cgarcia@igalia.com> [GTK4] Make it possible to build with GTK4 without errors https://bugs.webkit.org/show_bug.cgi?id=210967 Reviewed by Adrian Perez de Castro. * platform/PlatformPasteboard.h: * platform/graphics/DisplayRefreshMonitor.cpp: (WebCore::DisplayRefreshMonitor::createDefaultDisplayRefreshMonitor): * platform/graphics/gtk/DisplayRefreshMonitorGtk.cpp: * platform/graphics/gtk/DisplayRefreshMonitorGtk.h: * platform/graphics/gtk/GdkCairoUtilities.cpp: (WebCore::getDefaultCairoFontOptions): * platform/gtk/CursorGtk.cpp: (WebCore::createCustomCursor): * platform/gtk/DragImageGtk.cpp: (WebCore::dissolveDragImageToFraction): * platform/gtk/GRefPtrGtk.cpp: * platform/gtk/GRefPtrGtk.h: * platform/gtk/GUniquePtrGtk.h: * platform/gtk/GtkVersioning.h: (gdk_event_copy): (gtk_widget_size_allocate): (gtk_widget_queue_resize_no_redraw): (gdk_event_get_state): (gdk_event_get_coords): (gdk_event_get_root_coords): (gdk_event_is_scroll_stop_event): (gdk_event_get_scroll_direction): (gdk_event_get_scroll_deltas): (gdk_event_get_button): * platform/gtk/PasteboardHelper.cpp: * platform/gtk/PasteboardHelper.h: * platform/gtk/PlatformKeyboardEventGtk.cpp: (WebCore::PlatformKeyboardEvent::modifiersContainCapsLock): * platform/gtk/PlatformPasteboardGtk.cpp: (WebCore::PlatformPasteboard::PlatformPasteboard): (WebCore::PlatformPasteboard::writeToClipboard): (WebCore::PlatformPasteboard::readFromClipboard): * platform/gtk/PlatformScreenGtk.cpp: (WebCore::getCurrentScreenMonitor): 2020-04-27 Rob Buis <rbuis@igalia.com> Make loadURLIntoChildFrame private and non-exported https://bugs.webkit.org/show_bug.cgi?id=211051 Reviewed by Darin Adler. Make loadURLIntoChildFrame private and non-exported to reduce the amount of public API functions that start loads. In order to do this loadURLIntoChildFrame is being called from SubframeLoader and SubframeLoader is made an inner class of FrameLoader. Because this simplifies createFrame (and makes createFrame behave strictly like its name) url and referrer do not have to be passed. * html/HTMLObjectElement.cpp: (WebCore::HTMLObjectElement::parametersForPlugin): * loader/EmptyClients.cpp: (WebCore::EmptyFrameLoaderClient::createFrame): * loader/EmptyFrameLoaderClient.h: * loader/FrameLoader.h: * loader/FrameLoaderClient.h: * loader/SubframeLoader.cpp: (WebCore::FrameLoader::SubframeLoader::SubframeLoader): (WebCore::FrameLoader::SubframeLoader::clear): (WebCore::FrameLoader::SubframeLoader::requestFrame): (WebCore::FrameLoader::SubframeLoader::resourceWillUsePlugin): (WebCore::FrameLoader::SubframeLoader::pluginIsLoadable): (WebCore::FrameLoader::SubframeLoader::requestPlugin): (WebCore::FrameLoader::SubframeLoader::requestObject): (WebCore::FrameLoader::SubframeLoader::createJavaAppletWidget): (WebCore::FrameLoader::SubframeLoader::loadOrRedirectSubframe): (WebCore::FrameLoader::SubframeLoader::loadSubframe): (WebCore::FrameLoader::SubframeLoader::shouldUsePlugin): (WebCore::FrameLoader::SubframeLoader::loadPlugin): (WebCore::FrameLoader::SubframeLoader::completeURL const): (WebCore::FrameLoader::SubframeLoader::shouldConvertInvalidURLsToBlank const): (WebCore::SubframeLoader::SubframeLoader): Deleted. (WebCore::SubframeLoader::clear): Deleted. (WebCore::SubframeLoader::requestFrame): Deleted. (WebCore::SubframeLoader::resourceWillUsePlugin): Deleted. (WebCore::SubframeLoader::pluginIsLoadable): Deleted. (WebCore::SubframeLoader::requestPlugin): Deleted. (WebCore::SubframeLoader::requestObject): Deleted. (WebCore::SubframeLoader::createJavaAppletWidget): Deleted. (WebCore::SubframeLoader::loadOrRedirectSubframe): Deleted. (WebCore::SubframeLoader::loadSubframe): Deleted. (WebCore::SubframeLoader::shouldUsePlugin): Deleted. (WebCore::SubframeLoader::loadPlugin): Deleted. (WebCore::SubframeLoader::completeURL const): Deleted. (WebCore::SubframeLoader::shouldConvertInvalidURLsToBlank const): Deleted. * loader/SubframeLoader.h: (WebCore::SubframeLoader::containsPlugins const): Deleted. 2020-04-27 Alberto Garcia <berto@igalia.com> [GTK] [2.28.0] The Yelp build crashes if DISPLAY is not set https://bugs.webkit.org/show_bug.cgi?id=209431 Reviewed by Carlos Garcia Campos. Don't create a PlatformDisplayLibWPE as a fallback when using Wayland or X11. * platform/graphics/PlatformDisplay.cpp: (WebCore::PlatformDisplay::createPlatformDisplay): 2020-04-27 Claudio Saavedra <csaavedra@igalia.com> Unreviewed compile-warning fix. * html/canvas/WebGLRenderingContextBase.cpp: (WebCore::WebGLRenderingContextBase::create): 2020-04-27 Diego Pino Garcia <dpino@igalia.com> Unreviewed, GTK LTS build fix after r260744 https://bugs.webkit.org/show_bug.cgi?id=211069 * bindings/js/JSDOMBuiltinConstructor.h: (WebCore::JSDOMBuiltinConstructor<JSClass>::getConstructData): 2020-04-27 Claudio Saavedra <csaavedra@igalia.com> [GTK4] GdkRGBA has float members instead of double Unreviewed warning fix. * platform/graphics/gtk/ColorGtk.cpp: (WebCore::Color::operator GdkRGBA const): 2020-04-27 Ross Kirsling <ross.kirsling@sony.com> [JSC] CallData/ConstructData should include CallType/ConstructType https://bugs.webkit.org/show_bug.cgi?id=211059 Reviewed by Darin Adler. * Modules/plugins/QuickTimePluginReplacement.mm: (WebCore::QuickTimePluginReplacement::installReplacement): * bindings/js/JSCallbackData.cpp: (WebCore::JSCallbackData::invokeCallback): * bindings/js/JSCustomElementInterface.cpp: (WebCore::constructCustomElementSynchronously): (WebCore::JSCustomElementInterface::upgradeElement): (WebCore::JSCustomElementInterface::invokeCallback): * bindings/js/JSCustomXPathNSResolver.cpp: (WebCore::JSCustomXPathNSResolver::lookupNamespaceURI): * bindings/js/JSDOMBuiltinConstructor.h: (WebCore::JSDOMBuiltinConstructor<JSClass>::getConstructData): * bindings/js/JSDOMBuiltinConstructorBase.cpp: (WebCore::JSDOMBuiltinConstructorBase::callFunctionWithCurrentArguments): * bindings/js/JSDOMConstructor.h: (WebCore::JSDOMConstructor<JSClass>::getConstructData): * bindings/js/JSDOMConstructorBase.cpp: (WebCore::JSDOMConstructorBase::getCallData): * bindings/js/JSDOMConstructorBase.h: * bindings/js/JSDOMConstructorNotConstructable.h: * bindings/js/JSDOMIterator.h: (WebCore::iteratorForEach): * bindings/js/JSDOMMapLike.cpp: (WebCore::clearBackingMap): (WebCore::setToBackingMap): (WebCore::forwardFunctionCallToBackingMap): (WebCore::forwardForEachCallToBackingMap): * bindings/js/JSDOMNamedConstructor.h: (WebCore::JSDOMNamedConstructor<JSClass>::getConstructData): * bindings/js/JSDOMPromise.cpp: (WebCore::DOMPromise::whenPromiseIsSettled): * bindings/js/JSDOMPromiseDeferred.cpp: (WebCore::createRejectedPromiseWithTypeError): * bindings/js/JSDOMSetLike.cpp: (WebCore::clearBackingSet): (WebCore::addToBackingSet): (WebCore::forwardFunctionCallToBackingSet): (WebCore::forwardForEachCallToBackingSet): * bindings/js/JSErrorHandler.cpp: (WebCore::JSErrorHandler::handleEvent): * bindings/js/JSEventListener.cpp: (WebCore::JSEventListener::handleEvent): * bindings/js/JSExecState.cpp: (WebCore::functionCallHandlerFromAnyThread): * bindings/js/JSExecState.h: (WebCore::JSExecState::call): (WebCore::JSExecState::profiledCall): * bindings/js/JSExecStateInstrumentation.h: (WebCore::JSExecState::instrumentFunction): (WebCore::JSExecState::instrumentFunctionInternal): Deleted. (WebCore::JSExecState::instrumentFunctionCall): Deleted. (WebCore::JSExecState::instrumentFunctionConstruct): Deleted. * bindings/js/JSNavigatorCustom.cpp: (WebCore::JSNavigator::getUserMedia): * bindings/js/JSPluginElementFunctions.cpp: (WebCore::callPlugin): (WebCore::pluginElementCustomGetCallData): * bindings/js/JSPluginElementFunctions.h: * bindings/js/ReadableStream.cpp: (WebCore::ReadableStream::create): (WebCore::ReadableStreamInternal::callFunction): (WebCore::ReadableStream::lock): * bindings/js/ReadableStreamDefaultController.cpp: (WebCore::readableStreamCallFunction): * bindings/js/ScheduledAction.cpp: (WebCore::ScheduledAction::executeFunctionInContext): * bindings/js/ScriptController.cpp: (WebCore::ScriptController::callInWorld): (WebCore::ScriptController::executeAsynchronousUserAgentScriptInWorld): * bindings/scripts/CodeGeneratorJS.pm: (GenerateHeader): (GeneratePluginCall): (GenerateLegacyCallerDefinitions): * bindings/scripts/test/JS/JSTestObj.cpp: (WebCore::JSTestObj::getCallData): * bindings/scripts/test/JS/JSTestObj.h: * bindings/scripts/test/JS/JSTestPluginInterface.cpp: (WebCore::JSTestPluginInterface::getCallData): * bindings/scripts/test/JS/JSTestPluginInterface.h: * bridge/NP_jsobject.cpp: * bridge/objc/WebScriptObject.mm: (-[WebScriptObject callWebScriptMethod:withArguments:]): * bridge/objc/objc_runtime.h: * bridge/objc/objc_runtime.mm: (JSC::Bindings::ObjcFallbackObjectImp::getCallData): * bridge/runtime_object.cpp: (JSC::Bindings::RuntimeObject::getCallData): (JSC::Bindings::RuntimeObject::getConstructData): * bridge/runtime_object.h: * html/HTMLMediaElement.cpp: (WebCore::HTMLMediaElement::updateCaptionContainer): (WebCore::HTMLMediaElement::didAddUserAgentShadowRoot): (WebCore::HTMLMediaElement::updateMediaControlsAfterPresentationModeChange): (WebCore::HTMLMediaElement::getCurrentMediaControlsStatus): * html/HTMLPlugInImageElement.cpp: (WebCore::HTMLPlugInImageElement::didAddUserAgentShadowRoot): * testing/Internals.cpp: (WebCore::Internals::cloneArrayBuffer): 2020-04-27 Diego Pino Garcia <dpino@igalia.com> Unreviewed, reverting r260672. [GTK] WebInspector tests are timing out after r260672 Reverted changeset: "[Win] Bundle Inspector Resources in Release builds" https://bugs.webkit.org/show_bug.cgi?id=210942 https://trac.webkit.org/changeset/260672 2020-04-27 Kenneth Russell <kbr@chromium.org> Build failure in WebGL2RenderingContext after r260588 https://bugs.webkit.org/show_bug.cgi?id=211057 Reviewed by Darin Adler. Fix non-ANGLE build failure in WebGL2RenderingContext after r260588. * html/canvas/WebGL2RenderingContext.cpp: (WebCore::WebGL2RenderingContext::texStorage2D): 2020-04-26 Darin Adler <darin@apple.com> [Cocoa] stop using out arguments for document attributes when converting to attributed strings https://bugs.webkit.org/show_bug.cgi?id=211048 Reviewed by Sam Weinig. * DerivedSources-input.xcfilelist: Building modified this file automatically. Uploading the new version. * WebCore.xcodeproj/project.pbxproj: Added AttributedString.h. * editing/cocoa/AttributedString.h: Added. Moved this from WebKit, but removed a lot of inessentials. * editing/cocoa/DictionaryLookup.mm: Removed unneeded include. * editing/cocoa/EditorCocoa.mm: (WebCore::selectionAsAttributedString): Updated for change to the return value of the attributedString function, and use init instead of initWithString:@"". * editing/cocoa/HTMLConverter.h: Changed to an Objective-C-only header, omitting things like #pramga once. Return the AttributedString struct from the functions instead of using an out argument for document attributes. * editing/cocoa/HTMLConverter.mm: (HTMLConverter::convert): Return an AttributedString and drop the out argument. (WebCore::attributedString): Ditto. (WebCore::editingAttributedString): Ditto. Also refactor a little bit. * editing/ios/EditorIOS.mm: Removed unneeded include. * editing/mac/DictionaryLookupLegacy.mm: Removed unneeded include. * editing/mac/EditorMac.mm: (WebCore::Editor::dataSelectionForPasteboard): Updated since attributedString now returns a structure. * platform/network/cocoa/NetworkStorageSessionCocoa.mm: (WebCore::policyProperties): Use init instead of initWithString:@"". * platform/network/cocoa/ResourceRequestCocoa.mm: (WebCore::siteForCookies): Use init instead of initWithString:@"". 2020-04-26 Yoshiaki Jitsukawa <yoshiaki.jitsukawa@sony.com> [PlayStation] Enable TestWTF and TestWebCore https://bugs.webkit.org/show_bug.cgi?id=208849 Reviewed by Don Olmstead. * PlatformPlayStation.cmake: Add WebCore_CopySharedLibs to install dependencies. 2020-04-26 Said Abou-Hallawa <sabouhallawa@apple.com> Rendering update steps should use Seconds for the timestamps https://bugs.webkit.org/show_bug.cgi?id=210990 Reviewed by Daniel Bates. Make DOMWindow::nowTimestamp() return ReducedResolutionSeconds and change the callers accordingly. ReducedResolutionSeconds is a new type but it's just an alias of the type Seconds. It indicates that the returned value is a web-safe seconds. * Headers.cmake: * WebCore.xcodeproj/project.pbxproj: * animation/DocumentTimeline.cpp: (WebCore::DocumentTimeline::suspendAnimations): (WebCore::DocumentTimeline::liveCurrentTime const): (WebCore::DocumentTimeline::cacheCurrentTime): (WebCore::DocumentTimeline::documentWillUpdateAnimationsAndSendEvents): * animation/DocumentTimeline.h: * animation/DocumentTimelinesController.cpp: (WebCore::DocumentTimelinesController::updateAnimationsAndSendEvents): * animation/DocumentTimelinesController.h: * dom/Document.cpp: (WebCore::Document::serviceRequestAnimationFrameCallbacks): (WebCore::Document::updateIntersectionObservations): * dom/Document.h: * dom/ScriptedAnimationController.cpp: (WebCore::ScriptedAnimationController::serviceRequestAnimationFrameCallbacks): (WebCore::ScriptedAnimationController::scheduleAnimation): * dom/ScriptedAnimationController.h: * html/HTMLMediaElement.cpp: (WebCore::HTMLMediaElement::getVideoPlaybackQuality): * page/DOMWindow.cpp: (WebCore::DOMWindow::nowTimestamp const): * page/DOMWindow.h: * page/IntersectionObserver.cpp: (WebCore::IntersectionObserver::nowTimestamp const): (WebCore::IntersectionObserver::createTimestamp const): Deleted. * page/IntersectionObserver.h: * page/Page.cpp: (WebCore::Page::updateRendering): * page/Performance.cpp: (WebCore::Performance::now const): (WebCore::Performance::nowInReducedResolutionSeconds const): * page/Performance.h: * page/ReducedResolutionSeconds.h: Added. 2020-04-26 Alexey Shvayka <shvaikalesh@gmail.com> InternalFunction::createSubclassStructure should use newTarget's globalObject https://bugs.webkit.org/show_bug.cgi?id=202599 Reviewed by Yusuke Suzuki. Accounts for InternalFunction::createSubclassStructure() signature change and utilizes getFunctionRealm() helper to handle cross-realm JSBoundFunction and ProxyObject instances as NewTarget value. Tests: web-platform-tests/WebIDL/ecmascript-binding/constructors.html web-platform-tests/custom-elements/htmlconstructor/newtarget.html * bindings/js/JSDOMWrapperCache.h: (WebCore::setSubclassStructureIfNeeded): * bindings/js/JSHTMLElementCustom.cpp: (WebCore::constructJSHTMLElement): 2020-04-26 Yusuke Suzuki <ysuzuki@apple.com> Use `static Lock` instead of `static NeverDestroyed<Lock>` https://bugs.webkit.org/show_bug.cgi?id=211036 Reviewed by Darin Adler. * platform/GenericTaskQueue.cpp: (WebCore::TaskDispatcher<Timer>::sharedLock): 2020-04-26 Peng Liu <peng.liu6@apple.com> Remove unused class PlaybackSessionInterface https://bugs.webkit.org/show_bug.cgi?id=211031 Reviewed by Daniel Bates. No new tests, no functional changes. * WebCore.xcodeproj/project.pbxproj: * platform/cocoa/PlaybackSessionInterface.h: Removed. * platform/cocoa/PlaybackSessionModelMediaElement.h: * platform/ios/PlaybackSessionInterfaceAVKit.h: * platform/mac/PlaybackSessionInterfaceMac.h: 2020-04-26 Zalan Bujtas <zalan@apple.com> [LFC][TFC] Compute and distribute extra vertical space for rows https://bugs.webkit.org/show_bug.cgi?id=211046 Reviewed by Antti Koivisto. When the table computed height is bigger than the sum of the row heigts, we need to distribute the extra vertical space among the non-fixed height rows. The distribution is based on the preferred height of those non-fixed rows. * layout/tableformatting/TableFormattingContext.cpp: (WebCore::Layout::TableFormattingContext::computeAndDistributeExtraVerticalSpace): 2020-04-11 Darin Adler <darin@apple.com> Stop using live ranges in functions that return range of the selection https://bugs.webkit.org/show_bug.cgi?id=210396 Reviewed by Sam Weinig. - Added makeRangeSelectingNode, to create a range that selects a node and all its descendants. - Improved intersectingNodes so it can now easily be used in a while loop style as well as the range-for loop style. Also made it more robust against tree changes while iterating; it will now always stop at the end of the document. - Changed functions that work with selection to get a SimpleRange, and then either do all the work without a live range, or call createLiveRange right where it's needed, making it clearer when we can delete that call later as we cut down live ranges even more. * accessibility/AccessibilityObject.cpp: (WebCore::AccessibilityObject::selectionRange const): Return a SimpleRange instead of a live range. (WebCore::AccessibilityObject::findTextRanges const): Use createLiveRange on the result of selectionRange since this still mostly uses live ranges. * accessibility/AccessibilityObject.h: Updated for the above. * accessibility/AccessibilityRenderObject.cpp: (WebCore::AccessibilityRenderObject::documentBasedSelectedTextRange const): Updated to create a live range only in the one place we need to call a Range class member function. * accessibility/ios/WebAccessibilityObjectWrapperIOS.mm: (-[WebAccessibilityObjectWrapper textMarkerRangeForSelection]): Use createLiveRange here. * dom/SimpleRange.cpp: (WebCore::makeRangeSelectingNode): Added. For use when we need to make a range that selects a node, not just the node's contents. (WebCore::firstIntersectingNode): Renamed from IntersectingNodeRange::first since this is now used in the iterator class, not the range class. Also letting it be a non-member function so we can tweak it without touching the haeder file. (WebCore::nodePastLastIntersectingNode): Ditto. (WebCore::IntersectingNodeIterator::IntersectingNodeIterator): Changed this constructor to take a SimpleRange. To add the advanceSkippingChildren feature, had to build the termination condition into the iterator rather than basing it on the value of the sentinel. (WebCore::IntersectingNodeIterator::advance): Added. Contains the logic from the ++ operator, so it can be called in a more straightforward way when this is being used with a while loop rather than a range-for loop. (WebCore::IntersectingNodeIterator::advanceSkippingChildren): Added. * dom/SimpleRange.h: Updated for the changes to IntersectingNodeIterator and IntersectingNodeRange. * editing/AlternativeTextController.cpp: (WebCore::AlternativeTextController::timerFired): Use createLiveRange. * editing/CompositeEditCommand.cpp: (WebCore::CompositeEditCommand::targetRanges const): Use WTFMove in a place where the old code was copying instead. * editing/DeleteSelectionCommand.cpp: (WebCore::DeleteSelectionCommand::makeStylingElementsDirectChildrenOfEditableRootToPreventStyleLoss): Use intersectingNodes to make the function's logic easier to understand. * editing/Editing.cpp: (WebCore::visibleImageElementsInRangeWithNonLoadedImages): Changed the argument type to SimpleRange. * editing/Editing.h: Updated for the change above. * editing/EditingStyle.cpp: (WebCore::EditingStyle::styleAtSelectionStart): Use createLiveRange. * editing/Editor.cpp: (WebCore::Editor::selectedRange): Use createLiveRange. (WebCore::Editor::applyStyleToSelection): Ditto. (WebCore::Editor::applyParagraphStyleToSelection): Ditto. (WebCore::Editor::insertTextWithoutSendingTextEvent): Ditto. (WebCore::Editor::insertLineBreak): Ditto. (WebCore::Editor::insertParagraphSeparator): Ditto. (WebCore::Editor::ignoreSpelling): Remove use of live range. (WebCore::Editor::learnSpelling): Ditto. (WebCore::Editor::misspelledWordAtCaretOrRange const): Ditto. (WebCore::Editor::isSelectionUngrammatical): Ditto. (WebCore::Editor::guessesForMisspelledOrUngrammatical): Ditto. (WebCore::Editor::markMisspellingsAfterTypingToWord): Use createLiveRange. (WebCore::Editor::markMisspellingsOrBadGrammar): Ditto. (WebCore::Editor::markMisspellingsAndBadGrammar): Ditto. (WebCore::Editor::rangeForPoint): Ditto. (WebCore::Editor::insertTextPlaceholder): Ditto. (WebCore::Editor::shouldChangeSelection const): Ditto. (WebCore::Editor::findString): Ditto. (WebCore::Editor::rangeOfString): Ditto. (WebCore::Editor::scanSelectionForTelephoneNumbers): Ditto. (WebCore::Editor::editorUIUpdateTimerFired): Remove use of live range. (WebCore::candidateRangeForSelection): Deleted. (WebCore::Editor::stringForCandidateRequest const): Use createLiveRange and merged in the logic from candidateRangeForSelection. (WebCore::Editor::fontForSelection const): Remove use of live range. * editing/EditorCommand.cpp: (WebCore::expandSelectionToGranularity): Use createLiveRange. (WebCore::executeDeleteToMark): Ditto. (WebCore::executeSelectToMark): Ditto. (WebCore::valueFormatBlock): Ditto. * editing/FrameSelection.cpp: (WebCore::FrameSelection::respondToNodeModification): Use createLiveRange. (WebCore::FrameSelection::shouldDeleteSelection const): Ditto. (WebCore::FrameSelection::getClippedVisibleTextRectangles const): Do the work without a live range. (WebCore::FrameSelection::expandSelectionToElementContainingCaretSelection): Ditto. (WebCore::FrameSelection::elementRangeContainingCaretSelection const): Changed to return a SimpleRange rather than a live range. Also removed redundant checks and renamed locals to streamline the function. (WebCore::FrameSelection::wordRangeContainingCaretSelection): Return a SimpleRange instead of a live range. (WebCore::FrameSelection::rangeByMovingCurrentSelection const): Ditto. (WebCore::FrameSelection::rangeByExtendingCurrentSelection const): Ditto. (WebCore::FrameSelection::rangeByAlteringCurrentSelection const): Ditto. * editing/FrameSelection.h: Removed the toNormalizedRange function, since the VisibleSelection class has a comment claiming most callers should not call it. Updated forthe other changes above. * editing/InsertListCommand.cpp: (WebCore::InsertListCommand::doApply): Use createLiveRange. * editing/ReplaceSelectionCommand.cpp: (WebCore::ReplacementFragment::ReplacementFragment): Ditto. * editing/TextCheckingHelper.cpp: (WebCore::TextCheckingHelper::TextCheckingHelper): Remove use of live range, changing the type of m_range to SimpleRange. (WebCore::TextCheckingHelper::findFirstMisspellingOrBadGrammar): Reduce use of live range. (WebCore::TextCheckingHelper::findFirstGrammarDetail const): Use createLiveRange. (WebCore::TextCheckingHelper::findFirstBadGrammar const): Ditto. (WebCore::TextCheckingHelper::isUngrammatical const): Remove use of live range. (WebCore::TextCheckingHelper::guessesForMisspelledOrUngrammaticalRange const): Use createLiveRange. (WebCore::TextCheckingHelper::unifiedTextCheckerEnabled const): Updated for different interface to get the document for a SimpleRange. * editing/TextCheckingHelper.h: Change constructor to take a SimpleRange. * editing/TypingCommand.cpp: (WebCore::TypingCommand::deleteKeyPressed): Use createLiveRange. (WebCore::TypingCommand::forwardDeleteKeyPressed): Ditto. * editing/VisibleSelection.cpp: (WebCore::VisibleSelection::firstRange const): Return a SimpleRange. (WebCore::VisibleSelection::toNormalizedRange const): Ditto. * editing/VisibleSelection.h: Updated for the above. * editing/cocoa/DictionaryLookup.mm: Removed an uneeded check of the selection range against null. Code already guards against null endpoints. * editing/cocoa/EditorCocoa.mm: (WebCore::selectionAsAttributedString): Added. Uses the attributedString function with it's new argument and return value types. There's no longer a special function for the selection in the HTMLConverter header, so we put it here instead. (WebCore::Editor::writeSelectionToPasteboard): Updated to use the function above and to deal with RetainPtr. (WebCore::Editor::writeSelection): Ditto. * editing/cocoa/HTMLConverter.h: Removed attributedStringFromSelection and attributedStringBetweenStartAndEnd. Renamed attributedStringFromRange to just attributedString and renamed editingAttributedStringFromRange to just editingAttributedString. Also renamed IncludeImagesInAttributedString to just IncludeImages. * editing/cocoa/HTMLConverter.mm: (HTMLConverter::HTMLConverter): Use a SimpleRange rther than two Position arguments to the constructor. (HTMLConverter::convert): Use RetainPtr for the return value and the optional out argument. (WebCore::attributedStringFromSelection): Deleted. (WebCore::attributedStringBetweenStartAndEnd): Deleted. (WebCore::attributedString): Renamed the version that takes a range and made it take a SimpleRange, not a live range. (WebCore::editingAttributedString): Ditto. * editing/mac/EditorMac.mm: (WebCore::Editor::dataSelectionForPasteboard): Updated for changes to attributedString. * html/HTMLTextAreaElement.cpp: (WebCore::HTMLTextAreaElement::handleBeforeTextInsertedEvent const): Changed to not use live ranges any more. * page/ContextMenuController.cpp: (WebCore::ContextMenuController::contextMenuItemSelected): Use createLiveRange. * page/DOMSelection.cpp: (WebCore::DOMSelection::getRangeAt): Use createLiveRange. (WebCore::DOMSelection::addRange): Use Ditto. (WebCore::DOMSelection::deleteFromDocument): Ditto. * page/DragController.cpp: (WebCore::setSelectionToDragCaret): Removed in/out argument that was used to update a range that was never looked at afterward. (WebCore::DragController::concludeEditDrag): Use createLiveRange. (WebCore::DragController::draggableElement const): Ditto. (WebCore::DragController::startDrag): Ditto. * page/EventHandler.cpp: (WebCore::EventHandler::dispatchMouseEvent): Use createLiveRange. (WebCore::EventHandler::sendContextMenuEventForKey): Ditto. (WebCore::EventHandler::didStartDrag): Remove use of live range. * page/Page.cpp: (WebCore::Page::findStringMatchingRanges): Use createLiveRange. * page/TextIndicator.cpp: (WebCore::TextIndicator::createWithRange): Ditto. (WebCore::TextIndicator::createWithSelectionInFrame): Ditto. * page/mac/ServicesOverlayController.mm: (WebCore::ServicesOverlayController::buildSelectionHighlight): Use createLiveRange. (WebCore::ServicesOverlayController::findTelephoneNumberHighlightContainingSelectionHighlight): Use createLiveRange. * rendering/HitTestResult.cpp: (WebCore::HitTestResult::selectedText const): Remove use of live range. 2020-04-26 Darin Adler <darin@apple.com> Remove unnecessary inlining and templates for URL decomposition DOM functions https://bugs.webkit.org/show_bug.cgi?id=211025 Reviewed by Alex Christensen. * Headers.cmake: Renamed URLUtils.h to URLDecomposition.h. * Modules/cache/DOMCacheStorage.cpp: Updated include and using namespace. * Sources.txt: Added URLDecomposition.cpp. * WebCore.xcodeproj/project.pbxproj: Added URLDecomposition.cpp and renamed URLUtils.h to URLDecomposition.h. * html/DOMURL.h: Removed the WEBCORE_EXPORT on this class. Added final. Derive from URLDecomposition instead of URLUtils. Changed return type of href to const&. Moved toJSON here from URLUtils. Added overrides of the fullURL and setFullURL functions for URLDecomposition. * html/DOMURL.idl: Removed ImplementationLacksVTable. * html/HTMLAnchorElement.cpp: (WebCore::HTMLAnchorElement::HTMLAnchorElement): Moved initialization of boolean data members to the class definition. * html/HTMLAnchorElement.h: Derive from URLDecomposition instead of URLUtils. Added overrides of the fullURL and setFullURL functions for URLDecomposition. Initialize data members here in the class definition. * html/HTMLMediaElement.cpp: Removed unnecessary include of DOMURL.h. * html/URLDecomposition.cpp: Added. Contains most of the code from the URLUtils class template, which no longer needs to be in a header. * html/URLDecomposition.h: Renamed URLUtils.h to this. It's now an abstract base class rather than a class template using the curiously recurring template pattern. * html/URLSearchParams.h: Forward-declare DOMURL rather than including the DOMURL.h header. * html/URLUtils.h: Removed. Renamed to URLDecompostion.h. * page/DOMWindow.cpp: Removed unneeded include of DOMURL.h. * testing/Internals.cpp: Added include of DOMURL.h. 2020-04-26 Cathie Chen <cathiechen@igalia.com> fast/scrolling/scroll-behavior-invalidate-if-disabled.html is a flaky failure https://bugs.webkit.org/show_bug.cgi?id=210917 Reviewed by Darin Adler. The flaky failure is caused by reusing the CSSPropertyInfo value cached propertyInfoCache after experimental flags changed. Add propertyInfoFromJavaScriptCSSPropertyName to perform disabled checking after parsing. If the property is disabled, it will return an invalid CSSPropertyInfo instead. * css/CSSStyleDeclaration.cpp: (WebCore::CSSStyleDeclaration::getCSSPropertyIDFromJavaScriptPropertyName): (WebCore::CSSStyleDeclaration::namedItem): (WebCore::CSSStyleDeclaration::setNamedItem): 2020-04-25 Ross Kirsling <ross.kirsling@sony.com> [JSC] isCallable is redundant with isFunction https://bugs.webkit.org/show_bug.cgi?id=211037 Reviewed by Yusuke Suzuki. * bindings/js/JSDOMConvertScheduledAction.h: (WebCore::Converter<IDLScheduledAction>::convert): * worklets/PaintWorkletGlobalScope.cpp: (WebCore::PaintWorkletGlobalScope::registerPaint): Don't use getCallData if you don't need CallData. 2020-04-25 Alex Christensen <achristensen@webkit.org> Build fix. https://bugs.webkit.org/show_bug.cgi?id=210521 * Modules/applepay/ApplePaySetupFeature.mm: 2020-04-25 Alex Christensen <achristensen@webkit.org> Move ApplePay code from WebKitAdditions to WebCore and WebKit https://bugs.webkit.org/show_bug.cgi?id=210521 I accidentally committed an older version of the patch. This is the diff between the two to fix the internal build. 2020-04-25 Alex Christensen <achristensen@webkit.org> Move ApplePay code from WebKitAdditions to WebCore and WebKit https://bugs.webkit.org/show_bug.cgi?id=210521 Reviewed by Andy Estes. Only 4 minor modifications were necessary, as follows: 1. PaymentSetupFeatures's RetainPtr<NSArray<PKPaymentSetupFeature *>> was changed to RetainPtr<NSArray> to work with C++. 2. WebPaymentCoordinatorProxyAdditions messages were moved to WebPaymentCoordinatorProxy, removing the need for the extra message receiver, the Optional<WebPaymentCoordinatorProxyAdditions>, and the finishConstruction. 3. WebMediaSessionManager.cpp's macros that collided with other macros were renamed. This was necessary because of different source unification. 4. PaymentSetupFeatures.h was renamed to ApplePayPaymentSetupFeatures.h to be able to build with PaymentSetupFeatures.h in the SDK. The rest is just copy and paste. There isn't a good way to land this without breaking the build without removing the files from WebKitAdditions at the same time, so I'll do the two at the same time late at night to not cause disruption. * DerivedSources.make: * Modules/applepay/ApplePayInstallmentConfiguration.h: Added. * Modules/applepay/ApplePayInstallmentConfiguration.idl: Added. * Modules/applepay/ApplePayPayment.h: * Modules/applepay/ApplePayPayment.idl: * Modules/applepay/ApplePayPaymentMethod.h: * Modules/applepay/ApplePayPaymentMethod.idl: * Modules/applepay/ApplePayPaymentMethodUpdate.h: * Modules/applepay/ApplePayPaymentMethodUpdate.idl: * Modules/applepay/ApplePayRequestBase.cpp: (WebCore::finishConverting): (WebCore::requiresSupportedNetworks): * Modules/applepay/ApplePayRequestBase.h: * Modules/applepay/ApplePaySession.cpp: (WebCore::finishConverting): * Modules/applepay/ApplePaySessionPaymentRequest.h: (WebCore::ApplePaySessionPaymentRequest::installmentConfiguration const): (WebCore::ApplePaySessionPaymentRequest::setInstallmentConfiguration): * Modules/applepay/ApplePaySetup.cpp: Added. (WebCore::shouldDiscloseFeatures): (WebCore::ApplePaySetup::getSetupFeatures): (WebCore::ApplePaySetup::begin): (WebCore::ApplePaySetup::ApplePaySetup): (WebCore::ApplePaySetup::stop): (WebCore::ApplePaySetup::suspend): * Modules/applepay/ApplePaySetup.h: Added. (WebCore::ApplePaySetup::create): * Modules/applepay/ApplePaySetup.idl: Added. * Modules/applepay/ApplePaySetupFeature.h: Added. (WebCore::ApplePaySetupFeature::create): (WebCore::ApplePaySetupFeature::platformFeature const): * Modules/applepay/ApplePaySetupFeature.idl: Added. * Modules/applepay/ApplePaySetupFeature.mm: Added. (WebCore::ApplePaySetupFeature::type const): (WebCore::ApplePaySetupFeature::state const): (WebCore::ApplePaySetupFeature::supportsInstallments const): (WebCore::ApplePaySetupFeature::ApplePaySetupFeature): * Modules/applepay/ApplePaySetupFeatureType.h: Added. * Modules/applepay/ApplePaySetupFeatureType.idl: Added. * Modules/applepay/PaymentCoordinatorClient.h: (WebCore::PaymentCoordinatorClient::getSetupFeatures): (WebCore::PaymentCoordinatorClient::beginApplePaySetup): (WebCore::PaymentCoordinatorClient::endApplePaySetup): * Modules/applepay/PaymentInstallmentConfiguration.h: Added. * Modules/applepay/PaymentInstallmentConfiguration.mm: Added. (WebCore::toDecimalNumber): (WebCore::platformFeatureType): (WebCore::createPlatformConfiguration): (WebCore::PaymentInstallmentConfiguration::PaymentInstallmentConfiguration): (WebCore::PaymentInstallmentConfiguration::platformConfiguration const): * Modules/applepay/PaymentMethodUpdate.h: * Modules/applepay/cocoa/PaymentCocoa.mm: (WebCore::finishConverting): * Modules/applepay/cocoa/PaymentMethodCocoa.mm: (WebCore::finishConverting): * Modules/applepay/cocoa/PaymentMethodUpdateCocoa.mm: (WebCore::PaymentMethodUpdate::setInstallmentGroupIdentifier): * Modules/applepay/cocoa/PaymentSessionErrorCocoa.mm: (WebCore::additionalError): * Modules/applepay/paymentrequest/ApplePayRequest.idl: * Modules/mediasession/WebMediaSessionManager.cpp: (WebCore::WebMediaSessionManager::setMockMediaPlaybackTargetPickerEnabled): (WebCore::WebMediaSessionManager::setMockMediaPlaybackTargetPickerState): (WebCore::WebMediaSessionManager::mockMediaPlaybackTargetPickerDismissPopup): (WebCore::WebMediaSessionManager::addPlaybackTargetPickerClient): (WebCore::WebMediaSessionManager::removePlaybackTargetPickerClient): (WebCore::WebMediaSessionManager::removeAllPlaybackTargetPickerClients): (WebCore::WebMediaSessionManager::showPlaybackTargetPicker): (WebCore::WebMediaSessionManager::clientStateDidChange): (WebCore::WebMediaSessionManager::setPlaybackTarget): (WebCore::WebMediaSessionManager::externalOutputDeviceAvailableDidChange): (WebCore::WebMediaSessionManager::playbackTargetPickerWasDismissed): (WebCore::WebMediaSessionManager::configurePlaybackTargetClients): (WebCore::WebMediaSessionManager::configurePlaybackTargetMonitoring): (WebCore::WebMediaSessionManager::configureWatchdogTimer): (WebCore::WebMediaSessionManager::watchdogTimerFired): * SourcesCocoa.txt: * WebCore.xcodeproj/project.pbxproj: * platform/cocoa/WebCoreAdditions.mm: 2020-04-25 Simon Fraser <simon.fraser@apple.com> Commit the scrolling tree from the main thread https://bugs.webkit.org/show_bug.cgi?id=211026 <rdar://problem/62374855> Reviewed by Darin Adler. ScrollingCoordinatorMac::commitTreeStateIfNeeded() passed the new state tree to the scrolling thread which then did the commit (which updates the scrolling tree from the state tree). However, applyLayerPositions() immediately waited for that commit to complete, blocking the main thread anyway. We might as well just commit the scrolling tree on the main thread. ScrollingTree::commitTreeState() locks m_treeMutex, so this is still safe. Lock contention with the scrolling or event dispatcher threads should be rare; those threads are both mostly responsive. * page/scrolling/AsyncScrollingCoordinator.cpp: (WebCore::AsyncScrollingCoordinator::scrollingTreeAsText const): * page/scrolling/ScrollingTree.cpp: (WebCore::ScrollingTree::commitTreeState): * page/scrolling/ScrollingTree.h: (WebCore::ScrollingTree::waitForScrollingTreeCommit): Deleted. * page/scrolling/ThreadedScrollingTree.cpp: (WebCore::ThreadedScrollingTree::commitTreeState): Deleted. (WebCore::ThreadedScrollingTree::incrementPendingCommitCount): Deleted. (WebCore::ThreadedScrollingTree::decrementPendingCommitCount): Deleted. (WebCore::ThreadedScrollingTree::waitForPendingCommits): Deleted. (WebCore::ThreadedScrollingTree::waitForScrollingTreeCommit): Deleted. (WebCore::ThreadedScrollingTree::applyLayerPositions): Deleted. * page/scrolling/ThreadedScrollingTree.h: * page/scrolling/mac/ScrollingCoordinatorMac.mm: (WebCore::ScrollingCoordinatorMac::commitTreeStateIfNeeded): * page/scrolling/nicosia/ScrollingCoordinatorNicosia.cpp: (WebCore::ScrollingCoordinatorNicosia::commitTreeState): 2020-04-25 Yusuke Suzuki <ysuzuki@apple.com> Use static initialized Lock instead of LazyNeverDestroyed<Lock> https://bugs.webkit.org/show_bug.cgi?id=211010 Reviewed by Mark Lam. WTF::Lock can be static-initialized, so no need to use LazyNeverDestroyed<Lock>. * Modules/webgpu/WebGPUDevice.cpp: (WebCore::WebGPUDevice::instancesMutex): * Modules/webgpu/WebGPUPipeline.cpp: (WebCore::WebGPUPipeline::instancesMutex): * html/canvas/CanvasRenderingContext.cpp: (WebCore::CanvasRenderingContext::instancesMutex): * html/canvas/WebGLProgram.cpp: (WebCore::WebGLProgram::instancesMutex): 2020-04-25 Darin Adler <darin@apple.com> [Cocoa] Deal with another round of Xcode upgrade checks https://bugs.webkit.org/show_bug.cgi?id=211027 Reviewed by Alexey Proskuryakov. * WebCore.xcodeproj/project.pbxproj: Bump the upgrade check version. 2020-04-25 Alex Christensen <achristensen@webkit.org> Prepare to remove automatic URL->String conversion operators https://bugs.webkit.org/show_bug.cgi?id=211007 Reviewed by Darin Adler. * Modules/cache/DOMCache.cpp: (WebCore::DOMCache::requestFromInfo): * Modules/fetch/FetchRequest.cpp: (WebCore::FetchRequest::urlString const): * Modules/fetch/FetchResponse.cpp: (WebCore::FetchResponse::fetch): * Modules/websockets/WebSocket.cpp: (WebCore::WebSocket::create): * accessibility/AccessibilityImageMapLink.cpp: (WebCore::AccessibilityImageMapLink::stringValueForMSAA const): * bindings/IDLTypes.h: (WebCore::IDLString::isNullValue): * bindings/js/CachedScriptSourceProvider.h: (WebCore::CachedScriptSourceProvider::CachedScriptSourceProvider): * bindings/js/JSDOMConvertStrings.h: (WebCore::JSConverter<IDLDOMString>::convert): (WebCore::Converter<IDLUSVString>::convert): (WebCore::JSConverter<IDLUSVString>::convert): * bindings/js/ScriptController.cpp: (WebCore::ScriptController::evaluateInWorld): (WebCore::ScriptController::evaluateModule): (WebCore::ScriptController::callInWorld): (WebCore::ScriptController::executeIfJavaScriptURL): * bindings/js/SerializedScriptValue.cpp: (WebCore::CloneSerializer::dumpIfTerminal): (WebCore::CloneSerializer::write): * css/CSSCursorImageValue.cpp: (WebCore::CSSCursorImageValue::updateCursorElement): * css/CSSImageValue.cpp: (WebCore::CSSImageValue::customCSSText const): (WebCore::CSSImageValue::createDeprecatedCSSOMWrapper const): * css/parser/CSSPropertyParser.cpp: (WebCore::consumeFontFaceSrcURI): * dom/Document.cpp: (WebCore::Document::processHttpEquiv): * dom/ExtensionStyleSheets.cpp: (WebCore::createExtensionsStyleSheet): * dom/InlineStyleSheetOwner.cpp: (WebCore::InlineStyleSheetOwner::createSheet): * dom/ScriptElement.cpp: (WebCore::ScriptElement::requestModuleScript): (WebCore::ScriptElement::executeClassicScript): * dom/StyledElement.cpp: (WebCore::StyledElement::styleAttributeChanged): * editing/cocoa/WebContentReaderCocoa.mm: (WebCore::sanitizeMarkupWithArchive): (WebCore::WebContentReader::readWebArchive): * html/HTMLFormControlElement.cpp: (WebCore::HTMLFormControlElement::formAction const): * html/HTMLFrameElementBase.cpp: (WebCore::HTMLFrameElementBase::canLoadURL const): * html/HTMLLinkElement.cpp: (WebCore::HTMLLinkElement::shouldLoadLink): * html/HTMLMediaElement.cpp: (WebCore::HTMLMediaElement::selectNextSourceChild): * html/HTMLPlugInImageElement.cpp: (WebCore::HTMLPlugInImageElement::canLoadURL const): * html/parser/XSSAuditor.cpp: (WebCore::XSSAuditor::filterToken): * inspector/InspectorAuditResourcesObject.cpp: (WebCore::InspectorAuditResourcesObject::getResources): * inspector/InspectorStyleSheet.cpp: (WebCore::buildArrayForGroupings): * inspector/NetworkResourcesData.cpp: (WebCore::NetworkResourcesData::responseReceived): * inspector/agents/InspectorNetworkAgent.cpp: (WebCore::InspectorNetworkAgent::buildObjectForCachedResource): (WebCore::InspectorNetworkAgent::willSendRequest): * inspector/agents/InspectorPageAgent.cpp: (WebCore::InspectorPageAgent::getCookies): (WebCore::InspectorPageAgent::searchInResources): (WebCore::InspectorPageAgent::buildObjectForFrameTree): * inspector/agents/InspectorWorkerAgent.cpp: (WebCore::InspectorWorkerAgent::connectToWorkerInspectorProxy): * inspector/agents/WebConsoleAgent.cpp: (WebCore::WebConsoleAgent::didFailLoading): * inspector/agents/worker/ServiceWorkerAgent.cpp: (WebCore::ServiceWorkerAgent::getInitializationInfo): * loader/DocumentLoader.cpp: (WebCore::DocumentLoader::subresources const): * loader/DocumentLoader.h: (WebCore::DocumentLoader::clientRedirectDestinationForHistory const): (WebCore::DocumentLoader::serverRedirectDestinationForHistory const): * loader/FrameLoader.cpp: (WebCore::FrameLoader::submitForm): (WebCore::FrameLoader::receivedFirstData): (WebCore::FrameLoader::loadInSameDocument): (WebCore::FrameLoader::loadedResourceFromMemoryCache): (WebCore::createWindow): * loader/HistoryController.cpp: (WebCore::HistoryController::currentItemShouldBeReplaced const): * loader/ImageLoader.cpp: (WebCore::ImageLoader::updateFromElement): (WebCore::ImageLoader::dispatchPendingBeforeLoadEvent): * loader/LinkLoader.cpp: (WebCore::LinkLoader::preloadIfNeeded): (WebCore::LinkLoader::prefetchIfNeeded): * loader/MixedContentChecker.cpp: (WebCore::MixedContentChecker::checkFormForMixedContent const): * loader/NavigationScheduler.cpp: (WebCore::NavigationScheduler::shouldScheduleNavigation const): (WebCore::NavigationScheduler::scheduleLocationChange): * loader/PingLoader.cpp: (WebCore::PingLoader::loadImage): (WebCore::PingLoader::sendPing): * loader/ResourceLoadNotifier.cpp: (WebCore::ResourceLoadNotifier::dispatchWillSendRequest): * loader/SubframeLoader.cpp: (WebCore::SubframeLoader::requestObject): * loader/TextTrackLoader.cpp: (WebCore::TextTrackLoader::load): * loader/appcache/ApplicationCache.cpp: (WebCore::ApplicationCache::addResource): (WebCore::ApplicationCache::resourceForRequest): * loader/appcache/ApplicationCacheGroup.cpp: (WebCore::ApplicationCacheGroup::selectCache): (WebCore::ApplicationCacheGroup::finishedLoadingMainResource): (WebCore::ApplicationCacheGroup::didFinishLoadingEntry): (WebCore::ApplicationCacheGroup::didFailLoadingEntry): (WebCore::ApplicationCacheGroup::didFinishLoadingManifest): * loader/appcache/ApplicationCacheHost.cpp: (WebCore::ApplicationCacheHost::shouldLoadResourceFromApplicationCache): (WebCore::ApplicationCacheHost::getApplicationCacheFallbackResource): * loader/appcache/ApplicationCacheStorage.cpp: (WebCore::ApplicationCacheStorage::loadCacheGroup): (WebCore::ApplicationCacheStorage::findOrCreateCacheGroup): (WebCore::ApplicationCacheStorage::findInMemoryCacheGroup const): (WebCore::ApplicationCacheStorage::cacheGroupForURL): (WebCore::ApplicationCacheStorage::fallbackCacheGroupForURL): (WebCore::ApplicationCacheStorage::cacheGroupDestroyed): (WebCore::ApplicationCacheStorage::cacheGroupMadeObsolete): (WebCore::ApplicationCacheStorage::store): (WebCore::ApplicationCacheStorage::deleteCacheForOrigin): * loader/archive/ArchiveResourceCollection.cpp: (WebCore::ArchiveResourceCollection::addAllResources): (WebCore::ArchiveResourceCollection::addResource): (WebCore::ArchiveResourceCollection::archiveResourceForURL): * loader/cache/CachedCSSStyleSheet.cpp: (WebCore::CachedCSSStyleSheet::didAddClient): (WebCore::CachedCSSStyleSheet::checkNotify): * loader/cache/CachedResourceLoader.cpp: (WebCore::CachedResourceLoader::cachedResource const): (WebCore::CachedResourceLoader::requestResource): (WebCore::CachedResourceLoader::determineRevalidationPolicy const): (WebCore::CachedResourceLoader::notifyFinished): * loader/cache/CachedXSLStyleSheet.cpp: (WebCore::CachedXSLStyleSheet::didAddClient): (WebCore::CachedXSLStyleSheet::checkNotify): * page/ContextMenuController.cpp: (WebCore::ContextMenuController::checkOrEnableIfNeeded const): * page/DOMWindow.cpp: (WebCore::DOMWindow::setLocation): (WebCore::DOMWindow::createWindow): (WebCore::DOMWindow::open): * page/Location.cpp: (WebCore::Location::reload): * page/PageSerializer.cpp: (WebCore::PageSerializer::retrieveResourcesForProperties): * page/SecurityOrigin.cpp: (WebCore::SecurityOrigin::shouldIgnoreHost): * page/SecurityPolicy.cpp: (WebCore::SecurityPolicy::shouldInheritSecurityOriginFromOwner): (WebCore::SecurityPolicy::isBaseURLSchemeAllowed): * page/csp/ContentSecurityPolicy.cpp: (WebCore::ContentSecurityPolicy::reportViolation const): * platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.h: (WebCore::MediaPlayerPrivateAVFoundation::assetURL const): * platform/network/BlobRegistryImpl.cpp: (WebCore::BlobRegistryImpl::writeBlobToFilePath): * platform/network/mac/ResourceErrorMac.mm: (WebCore::ResourceError::platformLazyInit): * storage/StorageEventDispatcher.cpp: (WebCore::StorageEventDispatcher::dispatchSessionStorageEvents): (WebCore::StorageEventDispatcher::dispatchLocalStorageEvents): * svg/SVGImageLoader.cpp: (WebCore::SVGImageLoader::sourceURI const): * workers/WorkerScriptLoader.cpp: (WebCore::WorkerScriptLoader::loadSynchronously): * workers/service/ServiceWorkerRegistration.cpp: (WebCore::ServiceWorkerRegistration::scope const): * workers/service/ServiceWorkerRegistrationKey.cpp: (WebCore::ServiceWorkerRegistrationKey::hash const): (WebCore::ServiceWorkerRegistrationKey::isMatching const): * workers/service/context/ServiceWorkerDebuggable.cpp: (WebCore::ServiceWorkerDebuggable::ServiceWorkerDebuggable): * workers/service/server/SWServer.cpp: (WebCore::SWServer::startScriptFetch): * xml/XMLHttpRequest.cpp: (WebCore::XMLHttpRequest::send): 2020-04-25 Zalan Bujtas <zalan@apple.com> [LFC][TFC] Add vertical-align: baseline support https://bugs.webkit.org/show_bug.cgi?id=211024 Reviewed by Antti Koivisto. Adjust the padding with the baseline offset when the cell is baseline aligned (as opposed to the initial value of 'middle'). Test: fast/layoutformattingcontext/table-basic-row-vertical-align-baseline.html * layout/tableformatting/TableFormattingContext.cpp: (WebCore::Layout::TableFormattingContext::setUsedGeometryForCells): (WebCore::Layout::TableFormattingContext::computeAndDistributeExtraVerticalSpace): * layout/tableformatting/TableGrid.h: (WebCore::Layout::TableGrid::Cell::setBaselineOffset): (WebCore::Layout::TableGrid::Cell::baselineOffset const): 2020-04-25 Darin Adler <darin@apple.com> Move URL to use StringView when returning substrings of the URL https://bugs.webkit.org/show_bug.cgi?id=210431 Reviewed by Anders Carlsson. * Modules/cache/DOMCacheEngine.cpp: (WebCore::DOMCacheEngine::matchURLs): Removed unneeded calls to hasQuery. * Modules/fetch/FetchRequest.cpp: (WebCore::FetchRequest::initializeWith): Use hasCredentials. * Modules/fetch/FetchResponse.cpp: (WebCore::FetchResponse::redirect): Use hasCredentials. * Modules/paymentrequest/PaymentRequest.cpp: (WebCore::isValidURLBasedPaymentMethodIdentifier): Use hasCredentials. * Modules/plugins/YouTubePluginReplacement.cpp: (WebCore::createYouTubeURL): Take StringView. (WebCore::queryKeysAndValues): Take StringView. (WebCore::processAndCreateYouTubeURL): Use auto since URL pieces are now returned as StringView. (WebCore::YouTubePluginReplacement::youTubeURLFromAbsoluteURL): Use StringView and makeString rather than StringBuilder. * Modules/websockets/WebSocketHandshake.cpp: (WebCore::resourceName): Use queryWithLeadingQuestionMark. * accessibility/AccessibilityRenderObject.cpp: (WebCore::AccessibilityRenderObject::internalLinkElement const): Use StringView. * dom/Document.cpp: (WebCore::Document::setURL): Use setHostAndPort. * dom/Element.cpp: (WebCore::Element::findAnchorElementForLink): Update since fragmentIdentifier returns StringView. * dom/TreeScope.cpp: Added a comment. * editing/cocoa/WebContentReaderCocoa.mm: (WebCore::replaceRichContentWithAttachments): Update since lastPathComponent returns a StringView. Also got rid of some strange use of AtomString that was not necessary and used WTFMove more. * editing/ios/EditorIOS.mm: (WebCore::Editor::writeImageToPasteboard): Update since lastPathComponent returns a StringView. * html/HTMLAttachmentElement.cpp: (WebCore::HTMLAttachmentElement::attachmentTitleForDisplay const): Use makeString instead of StringBuilder, and StringView instead of String for name and extension values. * html/HTMLPlugInElement.cpp: (WebCore::pluginReplacementForType): Update since lastPathComponent returns a StringView. * html/MediaFragmentURIParser.cpp: (WebCore::MediaFragmentURIParser::parseFragments): Update since fragmentIdentifier returns a StringView. * html/URLUtils.h: Changed many functions to take a StringView, changed various other functions to call toString, since the underlying URL function now returns a StringView. Updated names since "pass" is now "password". (WebCore::countASCIIDigits): Added. Replaces unusual function named parsePortFromStringPosition because we can use StringView now and so don't need such an unusual function. * loader/AdClickAttribution.cpp: (WebCore::AdClickAttribution::parseConversionRequest): Use hasCredentials. Also removed unnecessary use of ASCIILiteral that hurts performance a tiny bit. (WebCore::AdClickAttribution::urlForTesting const): Use makeString instead of StringBuilder. * loader/CrossOriginAccessControl.cpp: (WebCore::validateCrossOriginRedirectionURL): Use hasCredentials. * loader/DocumentThreadableLoader.cpp: (WebCore::DocumentThreadableLoader::loadRequest): Use hasCredentials. * loader/FormSubmission.cpp: (WebCore::appendMailtoPostFormDataToURL): Update since query returns StringView. * loader/FrameLoader.cpp: (WebCore::FrameLoader::loadInSameDocument): Use equalRespectingNullity on fragment identifiers to preserve behavior, since at this time StringView == StringView does not respect nullity, but String == String does. * loader/appcache/ApplicationCacheHost.cpp: (WebCore::ApplicationCacheHost::createFileURL): Use fileURLWithFileSystemPath. * loader/appcache/ManifestParser.cpp: (WebCore::manifestPath): Return a StringView. (WebCore::parseManifest): Use StringView. * loader/cache/CachedFont.cpp: (WebCore::CachedFont::calculateItemInCollection const): Update since fragmentIdentifer returns a StringView. * loader/cache/CachedResourceRequest.cpp: (WebCore::CachedResourceRequest::splitFragmentIdentifierFromRequestURL): Ditto. * page/FrameView.cpp: (WebCore::FrameView::scrollToFragment): Ditto. (WebCore::FrameView::scrollToFragmentInternal): Updated log message. * page/History.cpp: (WebCore::History::stateObjectAdded): Updated for URL::password name change and to use the new stringWithoutQueryOrFragmentIdentifier rather than the old equalIgnoringQueryAndFragment. * page/Location.cpp: (WebCore::Location::href const): Use removeCredentials. (WebCore::Location::port const): Streamlined. (WebCore::Location::pathname const): Use an ASCIILiteral. (WebCore::Location::search const): Use queryWithLeadingQuestionMark. (WebCore::Location::hash const): Use fragmentIdentifierWithLeadingNumberSign. (WebCore::Location::setPort): Use parseUInt16. * page/UserContentURLPattern.cpp: Coding style tweaks. * platform/MIMETypeRegistry.cpp: (WebCore::MIMETypeRegistry::appendFileExtensionIfNecessary): Use contains instead of reverseFind to check for a period in the filename. * platform/graphics/MediaPlayer.cpp: (WebCore::MediaPlayer::load): Updated since lastPathComponent is a StringView. * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp: (WebCore::convertToInternalProtocol): Updated to use makeString since setProtocol takes a StringView. * platform/network/ResourceHandleInternal.h: Renamed m_pass to m_password and call password instead of pass. * platform/network/ResourceRequestBase.cpp: (WebCore::ResourceRequestBase::removeCredentials): Use removeCredentials. * platform/network/cf/ResourceHandleCFNet.cpp: (WebCore::ResourceHandle::createCFURLConnection): Updated for m_password name change. (WebCore::ResourceHandle::willSendRequest): Updated for m_password and password name changes. (WebCore::ResourceHandle::tryHandlePasswordBasedAuthentication): Ditto. * platform/network/curl/CurlProxySettings.cpp: (WebCore::CurlProxySettings::setUserPass): Updated for setPassword name change. (WebCore::createProxyUrl): Use hasCredentials, updated for password name change. * platform/network/curl/CurlProxySettings.h: (WebCore::CurlProxySettings::password const): Updated for password name change. * platform/network/curl/ResourceHandleCurl.cpp: (WebCore::ResourceHandle::didReceiveAuthenticationChallenge): Updated for m_password name change. (WebCore::ResourceHandle::getCredential): Ditto. (WebCore::ResourceHandle::willSendRequest): Updated for m_password and password name changes. * platform/network/mac/ResourceHandleMac.mm: (WebCore::ResourceHandle::createNSURLConnection): Updated for m_password and setPassword name changes. (WebCore::ResourceHandle::willSendRequest): Ditto. (WebCore::ResourceHandle::tryHandlePasswordBasedAuthentication): Ditto. * platform/network/soup/ResourceRequestSoup.cpp: (WebCore::ResourceRequest::createSoupURI const): Updated for password name change. * platform/network/soup/URLSoup.cpp: (WebCore::soupURIToURL): Updated for setPassword name change. * platform/win/PasteboardWin.cpp: (WebCore::writeURL): Updated since lastPathComponent returns a StringView. (WebCore::filesystemPathFromUrlOrTitle): Ditto. (WebCore::Pasteboard::write): Ditto. * style/StyleBuilderState.cpp: (WebCore::Style::BuilderState::createFilterOperations): Updated since fragmentIdentifier returns a StringView. * workers/WorkerLocation.cpp: (WebCore::WorkerLocation::port const): Streamlined. (WebCore::WorkerLocation::pathname const): Use an ASCIILiteral. (WebCore::WorkerLocation::search const): Use queryWithLeadingQuestionMark. (WebCore::WorkerLocation::hash const): Use fragmentIdentifierWithLeadingNumberSign. * workers/service/ServiceWorkerRegistrationKey.cpp: (WebCore::ServiceWorkerRegistrationKey::ServiceWorkerRegistrationKey): Updated for hasFragmentIdentifier name change. * workers/service/context/ServiceWorkerThreadProxy.cpp: (WebCore::topOriginURL): Simplified code to set port. * workers/service/server/SWServer.cpp: (WebCore::originURL): Ditto. * xml/XMLHttpRequest.cpp: (WebCore::XMLHttpRequest::open): Updated for setPassword name change. 2020-04-25 Chris Fleizach <cfleizach@apple.com> AX: Improve tracking of Element* pointers in AXObjectCache with WeakHashSet https://bugs.webkit.org/show_bug.cgi?id=210879 Reviewed by Daniel Bates. * accessibility/AXObjectCache.cpp: (WebCore::AXObjectCache::remove): (WebCore::AXObjectCache::handleFocusedUIElementChanged): (WebCore::filterListForRemoval): (WebCore::AXObjectCache::performDeferredCacheUpdate): * accessibility/AXObjectCache.h: 2020-04-25 Antoine Quint <graouts@apple.com> [Web Animations] KeyframeEffect should ensure its target remains alive https://bugs.webkit.org/show_bug.cgi?id=211019 Reviewed by Daniel Bates. Test: webanimations/keyframe-effect-target-kept-alive.html Make KeyframeEffect::m_target a RefPtr so that assigning an element to effect.target guarantees that element is kept alive even if there are no other references to that element. * animation/KeyframeEffect.cpp: (WebCore::KeyframeEffect::KeyframeEffect): (WebCore::KeyframeEffect::setTarget): * animation/KeyframeEffect.h: 2020-04-25 Zalan Bujtas <zalan@apple.com> [LFC][TFC] Cleanup TableFormattingContext::layoutInFlowContent https://bugs.webkit.org/show_bug.cgi?id=211023 Reviewed by Sam Weinig. Move some code to dedicated functions. * layout/tableformatting/TableFormattingContext.cpp: (WebCore::Layout::TableFormattingContext::layoutInFlowContent): (WebCore::Layout::TableFormattingContext::setUsedGeometryForCells): (WebCore::Layout::TableFormattingContext::setUsedGeometryForRows): (WebCore::Layout::TableFormattingContext::setUsedGeometryForSections): (WebCore::Layout::TableFormattingContext::layoutCell): (WebCore::Layout::TableFormattingContext::computeAndDistributeExtraHorizontalSpace): (WebCore::Layout::TableFormattingContext::computeAndDistributeExtraVerticalSpace): (WebCore::Layout::TableFormattingContext::initializeDisplayBoxToBlank const): Deleted. (WebCore::Layout::TableFormattingContext::setComputedGeometryForRows): Deleted. (WebCore::Layout::TableFormattingContext::setComputedGeometryForSections): Deleted. * layout/tableformatting/TableFormattingContext.h: * layout/tableformatting/TableFormattingContextGeometry.cpp: (WebCore::Layout::TableFormattingContext::Geometry::cellHeigh const): (WebCore::Layout::TableFormattingContext::Geometry::computedColumnWidth const): (WebCore::Layout::TableFormattingContext::Geometry::tableCellHeightAndMargin const): Deleted. 2020-04-25 Joonghun Park <jh718.park@samsung.com> Unreviewed. Remove the build warning below since r260247. warning: unused parameter ‘foo’ [-Wunused-parameter] No new tests, no new behaviors. * testing/Internals.cpp: (WebCore::Internals::hasSandboxIOKitOpenAccessToClass): 2020-04-24 Chris Dumez <cdumez@apple.com> [iOS] Unable to sign up on twitter.com https://bugs.webkit.org/show_bug.cgi?id=211003 <rdar://problem/58804852> Reviewed by Darin Adler. This is similar to the bug we had on nytimes.com and that was fixed in r258767. However, instead of a 'resize' event, it is a 'change' event on a MediaQueryList that is getting twitter.com in a bad state. The issue is that when we home out of Safari, SpringBoard takes does a snapshot sequence at various sizes / orientations and this causes many JS events to get fired (e.g. 'resize', 'orientationchange', 'change', ...), which can get some sites in a bad state. To address the issue, we now prevent firing of ALL JS events during the SpringBoard snapshot, instead of merely preventing the 'resize' ones. * dom/EventTarget.cpp: (WebCore::EventTarget::fireEventListeners): * page/FrameView.cpp: (WebCore::FrameView::sendResizeEventIfNeeded): * page/Page.h: (WebCore::Page::shouldFireEvents const): (WebCore::Page::setShouldFireEvents): (WebCore::Page::shouldFireResizeEvents const): Deleted. (WebCore::Page::setShouldFireResizeEvents): Deleted. 2020-04-24 Saam Barati <sbarati@apple.com> Return BigInt32 whenever we can https://bugs.webkit.org/show_bug.cgi?id=210922 Reviewed by Yusuke Suzuki. * bindings/js/SerializedScriptValue.cpp: (WebCore::CloneDeserializer::readBigInt): 2020-04-24 Yusuke Suzuki <ysuzuki@apple.com> [WTF] allThreads registration is racy with allThreads unregistration https://bugs.webkit.org/show_bug.cgi?id=210995 <rdar://problem/61609690> Reviewed by Keith Miller. * page/cocoa/ResourceUsageThreadCocoa.mm: (WebCore::ResourceUsageThread::platformCollectCPUData): 2020-04-24 Wenson Hsieh <wenson_hsieh@apple.com> Make some more adjustments to TextManipulationController's paragraph boundary heuristic https://bugs.webkit.org/show_bug.cgi?id=210993 <rdar://problem/61571299> Reviewed by Tim Horton. Adjust the heuristic added in r260583 to account for a few more common scenarios where we currently consider text as a part of the same paragraph. This can lead to many issues during text manipulation where text is moved between these elements, when it should not be. The new scenarios include block and inline-block links, as well as button elements. Test: TextManipulation.StartTextManipulationTreatsInlineBlockLinksAndButtonsAsParagraphs * editing/TextManipulationController.cpp: (WebCore::TextManipulationController::observeParagraphs): Additionally rename "paragraph boundary element" to "item boundary element", to avoid colliding with the existing notion of paragraph boundaries in editing code. 2020-04-24 Christopher Reid <chris.reid@sony.com> [Win] Bundle Inspector Resources in Release builds https://bugs.webkit.org/show_bug.cgi?id=210942 Reviewed by Fujii Hironori. * CMakeLists.txt: 2020-04-24 Antoine Quint <graouts@apple.com> [Web Animations] Ensure calling Web Animations APIs override future CSS Animations style properties https://bugs.webkit.org/show_bug.cgi?id=210988 Reviewed by Dean Jackson. The CSS Animations Level 2 spec specifies how the Web Animations APIs and the CSS Animations style properties should interact in https://drafts.csswg.org/css-animations-2/#animations. This patch implements the specified behavior and this is reflected by progress on the relevant WPT tests. The gist of this change is that once a Web Animations API is called on an animation created using CSS Animations, any changes made to related CSS Animations style properties on the target element will be ignored so that the overrides applied via the Web Animations API remain in effect. For instance, calling pause() or play() in a way that changes the playback state of the CSS Animation will mean that future changes to the CSS animation-play-state property are ignored. To do this we make more IDL properties and methods use dedicated methods to distinguish between the bindings entry-point and internal usage of the same methods to integrate the behavior only when the API itself is being used. * animation/AnimationEffect.cpp: (WebCore::AnimationEffect::getBindingsTiming const): Ensure we flush styles when animation.effect.getTiming() is called. (WebCore::AnimationEffect::getBindingsComputedTiming const): Ensure we flush styles when animation.effect.getComputedTiming() is called. (WebCore::AnimationEffect::bindingsUpdateTiming): Notify the associated CSSAnimation object, if any, when animation.effect.updateTiming() is called such that the CSSAnimation may apply the relevant overrides. * animation/AnimationEffect.h: * animation/AnimationEffect.idl: * animation/CSSAnimation.cpp: (WebCore::CSSAnimation::syncPropertiesWithBackingAnimation): Only apply new values of CSS Animations style properties if there are no overrides for them resulting from calling related Web Animations APIs. (WebCore::CSSAnimation::bindingsPlay): Mark animation-play-state as overridden if play() is called. (WebCore::CSSAnimation::bindingsPause): Mark animation-play-state as overridden if pause() is called. (WebCore::CSSAnimation::setBindingsEffect): Mark all animation style properties, except for animation-name and animation-play-state as overridden if animation.effect is set. (WebCore::CSSAnimation::setBindingsStartTime): Mark animation-play-state as overridden if animation.startTime is set. (WebCore::CSSAnimation::bindingsReverse): Mark animation-play-state as overridden if reverse() is called. (WebCore::CSSAnimation::effectTimingWasUpdatedUsingBindings): Mark each CSS property associated with a key found on the timing object passed to animation.effect.updateTiming() as overridden. (WebCore::CSSAnimation::effectKeyframesWereSetUsingBindings): Mark animation-timing-function as overridden if animation.effect.setKeyframes() is called. * animation/CSSAnimation.h: * animation/DeclarativeAnimation.cpp: (WebCore::DeclarativeAnimation::bindingsStartTime const): (WebCore::DeclarativeAnimation::setBindingsStartTime): (WebCore::DeclarativeAnimation::startTime const): Deleted. (WebCore::DeclarativeAnimation::setStartTime): Deleted. * animation/DeclarativeAnimation.h: * animation/KeyframeEffect.cpp: (WebCore::KeyframeEffect::getBindingsKeyframes): Ensure we flush styles when animation.effect.getKeyframes() is called. (WebCore::KeyframeEffect::getKeyframes): Only use the CSS-originated animation path if we don't have JS-originated keyframes. (WebCore::KeyframeEffect::setBindingsKeyframes): Notify the associated CSSAnimation object, if any, when animation.effect.setKeyframes() is called such that the CSSAnimation may apply the relevant overrides. (WebCore::KeyframeEffect::processKeyframes): Correctly return early if part of the processing yields an exception. * animation/KeyframeEffect.h: * animation/KeyframeEffect.idl: * animation/WebAnimation.cpp: (WebCore::WebAnimation::setBindingsEffect): (WebCore::WebAnimation::setBindingsStartTime): (WebCore::WebAnimation::bindingsReverse): * animation/WebAnimation.h: (WebCore::WebAnimation::bindingsEffect const): (WebCore::WebAnimation::bindingsStartTime const): * animation/WebAnimation.idl: 2020-04-24 Chris Dumez <cdumez@apple.com> ASSERTION FAILED: m_wrapper under HTMLMediaElement::setIsPlayingToWirelessTarget https://bugs.webkit.org/show_bug.cgi?id=210983 <rdar://problem/61611994> Reviewed by Eric Carlson. The issue was that we were trying to fire a JS event as a result of ActiveDOMObject::stop() getting called, which is not allowed. To address the issue, we avoid firing the event if the context is already stopped. No new tests, already covered by: media/modern-media-controls/placard-support/placard-support-airplay-fullscreen.html * html/HTMLMediaElement.cpp: (WebCore::HTMLMediaElement::setIsPlayingToWirelessTarget): 2020-04-24 Tim Horton <timothy_horton@apple.com> iPad: "Pocket City" interaction does not work with trackpad https://bugs.webkit.org/show_bug.cgi?id=210985 <rdar://problem/62273077> Reviewed by Wenson Hsieh. * platform/RuntimeApplicationChecks.h: * platform/cocoa/RuntimeApplicationChecksCocoa.mm: (WebCore::IOSApplication::isPocketCity): 2020-04-24 Tomoki Imai <Tomoki.Imai@sony.com> [OpenSSL] Implement WebCrypto APIs for HMAC https://bugs.webkit.org/show_bug.cgi?id=210902 Reviewed by Don Olmstead. Support WebCrypto HMAC sign/verify with OpenSSL. The design and some functions are inherited from the other ports. * crypto/openssl/CryptoAlgorithmHMACOpenSSL.cpp: (WebCore::HMACAlgorithm): Added. Helper function to map CryptoAlgorithmIdentifier to OpenSSL EVP_MD type. (WebCore::calculateSignature): Added. Helper function to calculate the signature for sign/verify. (WebCore::CryptoAlgorithmHMAC::platformSign): Implemented, mostly same as the other ports. (WebCore::CryptoAlgorithmHMAC::platformVerify): Implemented, mostly same as the other ports. * crypto/openssl/CryptoAlgorithmRegistryOpenSSL.cpp: (WebCore::CryptoAlgorithmRegistry::platformRegisterAlgorithms): Added CryptoAlgorithmHMAC support. * crypto/openssl/OpenSSLCryptoUniquePtr.h: Added specialized unique_ptrs for EVP_MD_CTX and EVP_PKEY. (WebCore::OpenSSLCryptoPtrDeleter<EVP_MD_CTX>::operator() const): (WebCore::OpenSSLCryptoPtrDeleter<EVP_PKEY>::operator() const): 2020-04-24 Brian Burg <bburg@apple.com> Web Automation: timeout underneath Automation.evaluateJavaScriptFunction in Selenium test frame_switching_tests.py::testShouldNotBeAbleToDoAnythingTheFrameIsDeletedFromUnderUs[Safari] https://bugs.webkit.org/show_bug.cgi?id=210162 <rdar://problem/60561009> Reviewed by Devin Rousso. * page/DOMWindow.h: Expose DOMWindow::{register, unregister}Observer. 2020-04-24 Zalan Bujtas <zalan@apple.com> [LFC][TFC] Take first in-flow table-row baseline into account when computing cell baseline https://bugs.webkit.org/show_bug.cgi?id=210972 Reviewed by Antti Koivisto. Check if the cell has a nested table and use its first row as the baseline for the cell (unless there's an IFC before). Test: fast/layoutformattingcontext/table-basic-row-baseline-with-nested-table.html * layout/tableformatting/TableFormattingContext.cpp: (WebCore::Layout::TableFormattingContext::layoutCell): (WebCore::Layout::TableFormattingContext::computeAndDistributeExtraVerticalSpace): * layout/tableformatting/TableFormattingContext.h: * layout/tableformatting/TableFormattingContextGeometry.cpp: (WebCore::Layout::TableFormattingContext::Geometry::usedBaselineForCell): * layout/tableformatting/TableGrid.h: (WebCore::Layout::TableGrid::Row::setBaselineOffset): (WebCore::Layout::TableGrid::Row::baselineOffset const): 2020-04-24 Antti Koivisto <antti@apple.com> Nullptr crash in objc_msgSend under WebCore::genericFamily https://bugs.webkit.org/show_bug.cgi?id=210911 <rdar://problem/61510208> Reviewed by Geoffrey Garen. Speculative fix. * platform/graphics/cocoa/SystemFontDatabaseCoreText.cpp: (WebCore::genericFamily): Test that CTFontDescriptorCopyAttribute is really returning CFStringRef. Also explicitly return String from lambda to clarify lifetimes. 2020-04-24 Simon Fraser <simon.fraser@apple.com> Move some post-renderingUpdate code into WebCore https://bugs.webkit.org/show_bug.cgi?id=210952 Reviewed by Antti Koivisto. Factor some code called by the various DrawingArea subclasses into Page::finalizeRenderingUpdate(), with some flags to control behavior that differs between drawing areas. ScrollingCoordinator::commitTreeStateIfNeeded() is a no-op for RemoteScrollingCoordinator so it's fine to always call it. * page/Page.cpp: (WebCore::Page::passiveTouchEventListenerRectsForTesting): (WebCore::Page::finalizeRenderingUpdate): * page/Page.h: 2020-04-24 Adrian Perez de Castro <aperez@igalia.com> Add missing HTMLNames:: namespace prefix to usage of liTag object Unreviewed build fix. No new tests needed. * editing/TextManipulationController.cpp: (WebCore::TextManipulationController::observeParagraphs): 2020-04-23 Rob Buis <rbuis@igalia.com> Make CachedResourceLoader more conforming to Fetch specification https://bugs.webkit.org/show_bug.cgi?id=210925 Reviewed by Alex Christensen. Make CachedResourceLoader more conforming to Fetch specification by fixing links, re-ordering steps to match main fetch [1] and do early exit code paths earlier. * loader/cache/CachedResourceLoader.cpp: (WebCore::CachedResourceLoader::requestImage): adjust to parameter change. (WebCore::CachedResourceLoader::canRequest): replace CachedResourceRequest param with ResourceLoaderOptions. (WebCore::CachedResourceLoader::prepareFetch): fix comment. (WebCore::CachedResourceLoader::requestResource): re-order. * loader/cache/CachedResourceLoader.h: 2020-04-23 Simon Fraser <simon.fraser@apple.com> Move the storage of DisplayID from Chrome to Page https://bugs.webkit.org/show_bug.cgi?id=210943 Reviewed by Tim Horton. The less Chrome knows about Frames and Documents the better. At some point Page is going to talk to ScrollingCoordinator in this callback too. * page/Chrome.cpp: (WebCore::Chrome::displayID const): (WebCore::Chrome::windowScreenDidChange): * page/Chrome.h: * page/Page.cpp: (WebCore::Page::windowScreenDidChange): * page/Page.h: (WebCore::Page::displayID const): 2020-04-23 Simon Fraser <simon.fraser@apple.com> EventHandler::selectCursor() has broken resize over coordinate conversion code https://bugs.webkit.org/show_bug.cgi?id=210778 Reviewed by Zalan Bujtas. EventHandler::selectCursor() appeared to make a local hit-test point from window to content coordinates, which made no sense, but this happened to work because RenderLayer::hitTestLayer() set the HitTestResult localPoint to a global point if you hit the resizer. Clean up this mess by having all resizer-related geometry queries be in local coordinates. As a bonus, actually set the cursor to a resize cursor when over the resizer. Test: fast/events/cursors/mouse-cursor-over-resizer.html * page/EventHandler.cpp: (WebCore::EventHandler::selectCursor): (WebCore::EventHandler::handleMousePressEvent): * rendering/RenderLayer.cpp: (WebCore::RenderLayer::resize): (WebCore::RenderLayer::offsetFromResizeCorner const): (WebCore::RenderLayer::isPointInResizeControl const): (WebCore::RenderLayer::hitTestLayer): (WebCore::RenderLayer::hitTestResizerInFragments const): * rendering/RenderLayer.h: 2020-04-23 Wenson Hsieh <wenson_hsieh@apple.com> Text manipulation does not account for text in fully clipped containers https://bugs.webkit.org/show_bug.cgi?id=210940 <rdar://problem/61137648> Reviewed by Tim Horton. Allow text manipulation to find both text in `visibility: hidden;` containers, as well as text in fully clipped overflow containers. In both cases, renderers exist for these nodes, but TextIterator ignores them by default. If these containers become visible in the future, we don't want to skip out on performing text manipulation on them. An alternative would be to detect when any element that has not undergone text manipulation has become visible (i.e. no longer clipped by an ancestor), but this is likely more complicated (and possibly less performant) than just eagerly extracting text from hidden containers, once they gain renderers. TextManipulation.StartTextManipulationIncludesFullyClippedText * editing/TextManipulationController.cpp: (WebCore::ParagraphContentIterator::ParagraphContentIterator): (WebCore::TextManipulationController::didCreateRendererForElement): (WebCore::TextManipulationController::scheduleObservationUpdate): (WebCore::TextManipulationController::scheduleObservartionUpdate): Deleted. While I'm here, also rename scheduleObservartionUpdate to scheduleObservationUpdate. * editing/TextManipulationController.h: 2020-04-23 Alex Christensen <achristensen@webkit.org> Allow credentials for same-origin css mask images https://bugs.webkit.org/show_bug.cgi?id=210895 <rdar://problem/60093888> Reviewed by Brent Fulgham. Test: http/tests/security/css-mask-image-credentials.html r230006 went a step too far in restricting what is allowed with css mask images. Basic authentication credentials should be allowed with such requests as they are in Chrome and Firefox. This can be seen by doing run-webkit-httpd then opening http://127.0.0.1:8000/security/css-mask-image-credentials.html In Chrome and Firefox you'll see it forward to a page that has a blue square. In Safari before this change you'll see a yellow square and a basic authentication prompt. In Safari after this change you'll see the same blue square you see in Chrome and Firefox. * style/StylePendingResources.cpp: (WebCore::Style::loadPendingImage): 2020-04-23 Alex Christensen <achristensen@webkit.org> Jesus Calling app needs more WebSQL https://bugs.webkit.org/show_bug.cgi?id=210889 <rdar://problem/61795507> Reviewed by Chris Dumez. Manually verified this fixes the issue in the radar. * bindings/js/JSDOMWindowCustom.cpp: (WebCore::jsDOMWindowInstanceFunctionOpenDatabaseBody): 2020-04-23 Rob Buis <rbuis@igalia.com> Move applyUserAgentIfNeeded calls to a more central place https://bugs.webkit.org/show_bug.cgi?id=209587 Reviewed by Darin Adler. Make main resource loads stop calling applyUserAgentIfNeeded and instead do it in the CachedResourceLoader. * loader/FrameLoader.cpp: (WebCore::FrameLoader::addExtraFieldsToRequest): (WebCore::FrameLoader::loadResourceSynchronously): * loader/appcache/ApplicationCacheGroup.cpp: (WebCore::ApplicationCacheGroup::createRequest): * loader/cache/CachedResourceLoader.cpp: (WebCore::CachedResourceLoader::updateHTTPRequestHeaders): (WebCore::CachedResourceLoader::requestResource): * loader/cache/CachedResourceLoader.h: * loader/cache/CachedResourceRequest.cpp: (WebCore::CachedResourceRequest::updateReferrerAndOriginHeaders): (WebCore::CachedResourceRequest::updateUserAgentHeader): (WebCore::CachedResourceRequest::updateReferrerOriginAndUserAgentHeaders): Deleted. * loader/cache/CachedResourceRequest.h: 2020-04-23 Kenneth Russell <kbr@chromium.org> [WebGL2] Update texture packing code for software uploads from DOM https://bugs.webkit.org/show_bug.cgi?id=209515 Reviewed by Dean Jackson. Update the bottommost DOM-to-texture packing code in GraphicsContextGLOpenGL and FormatConverter to full WebGL 2.0 capability. Reorganize some code to make side-by-side comparisons easier with other WebGL 2.0 implementations. Added NEEDS_PORT comments to areas in the calling code which need particular attention in subsequent patches. Roughly two more patches will be needed on top of this one in order to fully pass the associated conformance tests. Fix a bug in the non-ANGLE ENABLE(WEBGL2) code path which accidentally disabled WebGL entirely in this configuration. Covered by the WebGL 2.0 conformance tests. * html/canvas/WebGLRenderingContextBase.cpp: (WebCore::WebGLRenderingContextBase::create): (WebCore::WebGLRenderingContextBase::copyTexSubImage2D): (WebCore::WebGLRenderingContextBase::readPixels): (WebCore::WebGLRenderingContextBase::texImageSource2D): (WebCore::WebGLRenderingContextBase::texImage2DImpl): (WebCore::WebGLRenderingContextBase::texImage2D): (WebCore::WebGLRenderingContextBase::texSubImage2DImpl): (WebCore::WebGLRenderingContextBase::texSubImage2D): (WebCore::WebGLRenderingContextBase::validateTexFuncData): (WebCore::WebGLRenderingContextBase::getPackPixelStoreParams const): (WebCore::WebGLRenderingContextBase::getUnpackPixelStoreParams const): * html/canvas/WebGLRenderingContextBase.h: * platform/graphics/FormatConverter.cpp: (WebCore::convertFloatToHalfFloat): (WebCore::float>): (WebCore::uint8_t>): (WebCore::uint16_t>): (WebCore::int8_t>): (WebCore::int16_t>): (WebCore::uint32_t>): (WebCore::int32_t>): (WebCore::FormatConverter::convert): * platform/graphics/FormatConverter.h: (WebCore::FormatConverter::FormatConverter): * platform/graphics/GraphicsContextGL.h: (WebCore::GraphicsContextGL::hasAlpha): (WebCore::GraphicsContextGL::hasColor): * platform/graphics/opengl/GraphicsContextGLOpenGL.cpp: (WebCore::GraphicsContextGLOpenGL::texImage2DResourceSafe): (WebCore::GraphicsContextGLOpenGL::computeFormatAndTypeParameters): (WebCore::GraphicsContextGLOpenGL::computeImageSizeInBytes): (WebCore::GraphicsContextGLOpenGL::PixelStoreParams::PixelStoreParams): (WebCore::GraphicsContextGLOpenGL::packImageData): (WebCore::GraphicsContextGLOpenGL::extractImageData): (WebCore::GraphicsContextGLOpenGL::extractTextureData): (WebCore::TexelBytesForFormat): (WebCore::GraphicsContextGLOpenGL::packPixels): * platform/graphics/opengl/GraphicsContextGLOpenGL.h: 2020-04-23 Wenson Hsieh <wenson_hsieh@apple.com> Add a heuristic for text manipulation to treat some list items as paragraph boundaries https://bugs.webkit.org/show_bug.cgi?id=210915 <rdar://problem/61907080> Reviewed by Megan Gardner. Adds a mechanism to allow text manipulation to emit an item containing the current list of text manipulation tokens early, in the case where the paragraph content iterator crosses the boundary of an element that encloses a paragraph. Currently, the only enclosing paragraph element will be list items that have `display: block;`, which we can take as a hint that the text in these list items should be vended as separate items, rather than as tokens in a single item. This may be extended in the future to other situations by adjusting logic in `isEnclosingParagraphElement`. Test: TextManipulation.StartTextManipulationBreaksParagraphInBetweenListItems * editing/TextManipulationController.cpp: (WebCore::TextManipulationController::observeParagraphs): 2020-04-23 Zalan Bujtas <zalan@apple.com> [LFC][TFC] Add support for basic baseline align inside a table row https://bugs.webkit.org/show_bug.cgi?id=210918 Reviewed by Antti Koivisto. Test: fast/layoutformattingcontext/table-basic-row-baseline-align.html The minimum height of a row is defined as the height of an hypothetical linebox containing the cells originating in the row. In this hypothetical linebox, we use baseline alignment to align the cells vertically. Use these vertically aligned cells to compute the final row height. * layout/displaytree/DisplayBox.h: (WebCore::Display::Box::verticalMarginBorderAndPadding const): (WebCore::Display::Box::setVerticalPadding): * layout/tableformatting/TableFormattingContext.cpp: (WebCore::Layout::TableFormattingContext::layoutInFlowContent): (WebCore::Layout::TableFormattingContext::layoutCell): (WebCore::Layout::TableFormattingContext::computeAndDistributeExtraVerticalSpace): * layout/tableformatting/TableFormattingContext.h: 2020-04-23 Sihui Liu <sihui_liu@apple.com> TextManipulationController should set range of paragraph using token's positions https://bugs.webkit.org/show_bug.cgi?id=210866 <rdar://problem/60646283> Reviewed by Wenson Hsieh. Set the range of paragraph using positions of first token and last token in the paragraph because: 1. Accurate range makes token matching in TextManipulationController::replace() easier, as TextIterator could visit different positions with different ranges or different conditions. For example, in our previous implementation, start of a paragraph can be set as the first visible position of document, while position of first token is after that. Then in replace(), TextManipulationController may extract a word before the position of first token and return error. See added test TextManipulation.CompleteTextManipulationCorrectParagraphRange. 2. TextManipulationController can handle fewer content and this is less error-prone. For example, svg elements before/after the paragraph text will not be identified as tokens [] in a paragraph now. See updated API tests for example. New test: TextManipulation.CompleteTextManipulationCorrectParagraphRange * editing/TextManipulationController.cpp: (WebCore::ParagraphContentIterator::moveCurrentNodeForward): m_currentNodeForFindingInvisibleContent should not be advanced if it is already at the end. (WebCore::containsOnlyHTMLSpaces): (WebCore::TextManipulationController::observeParagraphs):Set the paragraph start as the position of the first token and end as the position of last token. If the paragraph is split with <br>, the end will be extended to position of <br> so that we can add this node back later; otherwise, <br> can be removed after original text of paragraph is removed in TextManipulationController::replace(). Also, stop identifying spaces as tokens because non-text Node can emit spaces. (WebCore::TextManipulationController::replace): Only identify tokens from content with meaningful text. 2020-04-23 Chris Dumez <cdumez@apple.com> [ Mac wk2 ] imported/w3c/web-platform-tests/notifications/event-onclose.html is flaky failing. https://bugs.webkit.org/show_bug.cgi?id=209483 <rdar://problem/60830377> Reviewed by Geoff Garen. Align garbage collection of Notification JS wrapper with the specification: - https://notifications.spec.whatwg.org/#garbage-collection [1] In particular, the following changes were made: 1. Instead of using the legacy setPendingActivity() / unsetPendingActivity(), override ActiveDOMObject::virtualHasPendingActivity() to implement the behavior documented in the specification. 2. Keep the wrapper alive as long as the notification is showing and as long as there are relevant event listeners, as per [1]. Previously, we failed to check for event listeners, which was suboptimal. 3. Update the constructor to queue a task on the event loop in order to show the notification asynchronously, instead of relying on a SuspendableTimer for this purpose. Previously, the JS wrapper could get collected between construction and the notification getting shown, which was leading to the test flakiness. No new tests, unskipped existing test. * Modules/notifications/Notification.cpp: (WebCore::Notification::Notification): (WebCore::Notification::show): (WebCore::Notification::finalize): (WebCore::Notification::dispatchShowEvent): (WebCore::Notification::dispatchClickEvent): (WebCore::Notification::dispatchCloseEvent): (WebCore::Notification::dispatchErrorEvent): (WebCore::Notification::eventListenersDidChange): (WebCore::Notification::virtualHasPendingActivity const): * Modules/notifications/Notification.h: 2020-04-23 Andres Gonzalez <andresg_22@apple.com> Correction for patch 397001. https://bugs.webkit.org/show_bug.cgi?id=210914 Reviewed by Chris Fleizach. - No need to check for isEmpty when retrieving the primary screen size, as pointed out by Darin Adler in bug 210760, patch 397001. - Added some helpful AXLOGing. * accessibility/mac/WebAccessibilityObjectWrapperMac.mm: (-[WebAccessibilityObjectWrapper primaryScreenHeight]): (-[WebAccessibilityObjectWrapper accessibilityAttributeValue:]): (-[WebAccessibilityObjectWrapper accessibilityAttributeValue:forParameter:]): (-[WebAccessibilityObjectWrapper accessibilityArrayAttributeValues:index:maxCount:]): 2020-04-23 Don Olmstead <don.olmstead@sony.com> [CMake] Add WebKit::WebCoreTestSupport target https://bugs.webkit.org/show_bug.cgi?id=210867 Unreviewed build fix. Make the dependencies explicit. * CMakeLists.txt: 2020-04-22 Simon Fraser <simon.fraser@apple.com> In the scrolling tree, separate wheel event handling from layer updating https://bugs.webkit.org/show_bug.cgi?id=210899 Reviewed by Antti Koivisto. Working towards webkit.org/b/210884, it needs to be possible to have the scrolling tree handle a wheelEvent and update its internal state about scroll positions, but not immediately map those scroll positions onto CALayers. To achieve this, have ScrollingTreeScrollingNode::currentScrollPositionChanged() not call applyLayerPositions(), or notifyRelatedNodesAfterScrollPositionChange() which just applies layer positions on related nodes. Instead, at the end of wheel event handling, do a full scrolling tree traversal and update all the layer positions there. Delegated scrolling (iOS) still needs notifyRelatedNodesAfterScrollPositionChange() so it can't be removed. * page/scrolling/ScrollingTree.cpp: (WebCore::ScrollingTree::handleWheelEvent): (WebCore::ScrollingTree::applyLayerPositions): (WebCore::ScrollingTree::applyLayerPositionsInternal): * page/scrolling/ScrollingTree.h: * page/scrolling/ScrollingTreeScrollingNode.cpp: (WebCore::ScrollingTreeScrollingNode::currentScrollPositionChanged): 2020-04-23 Charlie Turner <cturner@igalia.com> [EME][CDMProxy] Sort key status array lexicographically by key IDs https://bugs.webkit.org/show_bug.cgi?id=210659 Reviewed by Xabier Rodriguez-Calvar. This is required by section 6.1 of https://www.w3.org/TR/encrypted-media/. Test: encrypted-media/clearkey-keystatuses.https.html * platform/encryptedmedia/CDMProxy.cpp: (WebCore::KeyStore::add): We could use a set here and keep it sorted by design, but this is more complexity than needed. The store has for practical purposes an upper limit of 2 items. Sorting such a vector lowers to either a noop or a swap. So the simple approach here wins over using some kind of self-sorting set structure. I also considered only sorting on-demand, since it only has to appear sorted from the perspective of JS, we could sort the array in convertToJSKeyStatusVector. However, that is semantically a const method, so sorting here felt too surprising. * platform/encryptedmedia/CDMProxy.h: (WebCore::Key::operator<): Add a lexicographic comparator to Key. 2020-04-23 Carlos Garcia Campos <cgarcia@igalia.com> [GTK] excessive wakeups/polling due to gdk_frame_clock_begin_updating https://bugs.webkit.org/show_bug.cgi?id=210561 Reviewed by Žan Doberšek. The problem is that we are destroying the display refresh monitor from the frame clock update callback, and GTK schedules another update from the callback itself in some cases, which ends up happening forever. We were assuming that destroying the window of immediately destroy the frame clock as well, but the paint source idle keeps a reference of the frame clock. At the end of the source idle callback the source is scheduled again, taking a new reference. We need to call gdk_frame_clock_end_updating() to ensure the idle is not scheduled again. * platform/graphics/gtk/DisplayRefreshMonitorGtk.cpp: (WebCore::DisplayRefreshMonitorGtk::~DisplayRefreshMonitorGtk): Disconnect the update signal and call gdk_frame_clock_end_updating(). (WebCore::DisplayRefreshMonitorGtk::requestRefreshCallback): Toplevel window should always have a frame clock, so remove the early return and add an assert instead. 2020-04-23 Youenn Fablet <youenn@apple.com> getDisplayMedia is not respecting aspect ratio with max constraints https://bugs.webkit.org/show_bug.cgi?id=210858 Reviewed by Eric Carlson. Add computation of exact frame size to respect aspect ratio in DisplayCaptureSourceCocoa::updateFrameSize. Refactor code to have one source class DisplayCaptureSourceCocoa and specific capturer for screen and window. This simplifies code and allows reusing DisplayCaptureSourceCocoa with a mock capturer. Update mock code to use DisplayCaptureSourceCocoa. Tests: fast/mediastream/getDisplayMedia-max-constraints.html fast/mediastream/getDisplayMedia-max-constraints1.html fast/mediastream/getDisplayMedia-max-constraints2.html fast/mediastream/getDisplayMedia-max-constraints3.html * SourcesCocoa.txt: * WebCore.xcodeproj/project.pbxproj: * platform/mediastream/mac/DisplayCaptureManagerCocoa.cpp: (WebCore::DisplayCaptureManagerCocoa::updateDisplayCaptureDevices): (WebCore::DisplayCaptureManagerCocoa::updateWindowCaptureDevices): (WebCore::DisplayCaptureManagerCocoa::screenCaptureDeviceWithPersistentID): (WebCore::DisplayCaptureManagerCocoa::windowCaptureDeviceWithPersistentID): * platform/mediastream/mac/DisplayCaptureSourceCocoa.cpp: (WebCore::DisplayCaptureSourceCocoa::create): (WebCore::DisplayCaptureSourceCocoa::DisplayCaptureSourceCocoa): (WebCore::DisplayCaptureSourceCocoa::~DisplayCaptureSourceCocoa): (WebCore::DisplayCaptureSourceCocoa::capabilities): (WebCore::DisplayCaptureSourceCocoa::settings): (WebCore::DisplayCaptureSourceCocoa::startProducingData): (WebCore::DisplayCaptureSourceCocoa::stopProducingData): (WebCore::DisplayCaptureSourceCocoa::updateFrameSize): (WebCore::DisplayCaptureSourceCocoa::emitFrame): (WebCore::DisplayCaptureSourceCocoa::Capturer::setLogger): (WebCore::DisplayCaptureSourceCocoa::Capturer::logChannel const): * platform/mediastream/mac/DisplayCaptureSourceCocoa.h: * platform/mediastream/mac/MockRealtimeVideoSourceMac.h: * platform/mediastream/mac/MockRealtimeVideoSourceMac.mm: (WebCore::MockRealtimeVideoSourceMac::createForMockDisplayCapturer): * platform/mediastream/mac/RealtimeMediaSourceCenterMac.cpp: * platform/mediastream/mac/ScreenDisplayCapturerMac.h: Added. * platform/mediastream/mac/ScreenDisplayCapturerMac.mm: Added. (WebCore::ScreenDisplayCapturerMac::create): (WebCore::ScreenDisplayCapturerMac::ScreenDisplayCapturerMac): (WebCore::ScreenDisplayCapturerMac::~ScreenDisplayCapturerMac): (WebCore::ScreenDisplayCapturerMac::createDisplayStream): (WebCore::ScreenDisplayCapturerMac::start): (WebCore::ScreenDisplayCapturerMac::stop): (WebCore::ScreenDisplayCapturerMac::generateFrame): (WebCore::ScreenDisplayCapturerMac::startDisplayStream): (WebCore::ScreenDisplayCapturerMac::commitConfiguration): (WebCore::ScreenDisplayCapturerMac::displayWasReconfigured): (WebCore::ScreenDisplayCapturerMac::displayReconfigurationCallBack): (WebCore::ScreenDisplayCapturerMac::newFrame): (WebCore::ScreenDisplayCapturerMac::screenCaptureDeviceWithPersistentID): (WebCore::ScreenDisplayCapturerMac::screenCaptureDevices): * platform/mediastream/mac/WindowDisplayCapturerMac.h: Added. * platform/mediastream/mac/WindowDisplayCapturerMac.mm: ddedAdded. (WebCore::WindowDisplayCapturerMac::create): (WebCore::WindowDisplayCapturerMac::WindowDisplayCapturerMac): (WebCore::WindowDisplayCapturerMac::windowImage): (WebCore::WindowDisplayCapturerMac::generateFrame): (WebCore::WindowDisplayCapturerMac::windowCaptureDeviceWithPersistentID): (WebCore::WindowDisplayCapturerMac::windowCaptureDevices): * platform/mock/MockRealtimeMediaSourceCenter.cpp: (WebCore::MockDisplayCapturer::MockDisplayCapturer): (WebCore::MockDisplayCapturer::start): (WebCore::MockDisplayCapturer::generateFrame): * platform/mock/MockRealtimeVideoSource.h: (isType): 2020-04-22 Simon Fraser <simon.fraser@apple.com> Make it possible to eagerly apply scrolling tree state from the main thread https://bugs.webkit.org/show_bug.cgi?id=210883 Reviewed by Tim Horton. Work towards fixing webkit.org/b/210884: at the beginning of Page::updateRendering(), we are going to need to pull the current state of the scrolling tree back to the main thread, so that JS-exposed scroll offsets match scrolling tree state. To this end, expose a scrolling tree traversal function from ScrollingTree, which takes the lock and then calls a visitor function for each node. For scrolling nodes, the visitor gets the scroll position and optional layout viewport origin. These match the data passed back currently via AsyncScrollingCoordinator::scheduleUpdateScrollPositionAfterAsyncScroll(). The new code is not called yet. * page/scrolling/AsyncScrollingCoordinator.cpp: (WebCore::AsyncScrollingCoordinator::synchronizeStateFromScrollingTree): * page/scrolling/AsyncScrollingCoordinator.h: * page/scrolling/ScrollingCoordinator.h: (WebCore::ScrollingCoordinator::synchronizeStateFromScrollingTree): * page/scrolling/ScrollingTree.cpp: (WebCore::ScrollingTree::traverseScrollingTree): (WebCore::ScrollingTree::traverseScrollingTreeRecursive): * page/scrolling/ScrollingTree.h: * page/scrolling/ScrollingTreeScrollingNode.cpp: (WebCore::ScrollingTreeScrollingNode::currentScrollPositionChanged): applyLayerPositions() calls these two functions, so just call it instead. 2020-04-22 Commit Queue <commit-queue@webkit.org> Unreviewed, reverting r260535. https://bugs.webkit.org/show_bug.cgi?id=210897 Causes crashes in WK1 (Requested by smfr on #webkit). Reverted changeset: "[ Mac wk2 ] imported/w3c/web-platform-tests/notifications /event-onclose.html is flaky failing." https://bugs.webkit.org/show_bug.cgi?id=209483 https://trac.webkit.org/changeset/260535 2020-04-22 Darin Adler <darin@apple.com> [Cocoa] Build with UChar as char16_t even in builds that use Apple's internal SDK https://bugs.webkit.org/show_bug.cgi?id=210845 Reviewed by Anders Carlsson. * Configurations/WebCore.xcconfig: Move ICU-configuring macros to Platform.h. * Modules/websockets/WebSocket.cpp: (WebCore::WebSocket::connect): Get rid of an obsolete cast to unsigned to work around uint16_t not being treated as a number by makeString. * rendering/svg/SVGTextLayoutEngineBaseline.cpp: (WebCore::SVGTextLayoutEngineBaseline::calculateGlyphOrientationAngle const): Remove deprecated U_EA_COUNT. 2020-04-22 Andres Gonzalez <andresg_22@apple.com> Add logging to core accessibility. https://bugs.webkit.org/show_bug.cgi?id=210564 <rdar://problem/61863477> Reviewed by Simon Fraser and Chris Fleizach. - Use LOG and LOG_WITH_STREAM macros instead of WTF::Logger directly. - Added logging of AXCoreObjects. * accessibility/AXLogger.cpp: (WebCore::AXLogger::AXLogger): (WebCore::AXLogger::~AXLogger): (WebCore::AXLogger::log): (WebCore::operator<<): * accessibility/AXLogger.h: * accessibility/AccessibilityObjectInterface.h: 2020-04-22 Daniel Bates <dabates@apple.com> Support toggling debug overlay for touch action region and editable element region independent from non-fast scrollable region https://bugs.webkit.org/show_bug.cgi?id=210774 Reviewed by Dean Jackson. Break out the touch action region and editable element region debug overlays into their own flags that can be passed to Settings::setVisibleDebugOverlayRegions() to toggle these overlays, respectively. Currently both of these overlays piggyback on whether the engine will paint the non-fast scrollable region. * page/SettingsBase.h: Add two more enumerators. * rendering/RenderLayer.cpp: (WebCore::RenderLayer::invalidateEventRegion const): Update the code to be more precise now that we can target the update paint overlay hack to when we are painting touch-action or editable element regions. * rendering/RenderLayerBacking.cpp: (WebCore::RenderLayerBacking::paintDebugOverlays): Condition the painting of touch action region on one enumerator and the painting of editable element region on another. (WebCore::RenderLayerBacking::paintContents): Update the code to be more precise. 2020-04-22 Chris Dumez <cdumez@apple.com> [ Mac wk2 ] imported/w3c/web-platform-tests/notifications/event-onclose.html is flaky failing. https://bugs.webkit.org/show_bug.cgi?id=209483 <rdar://problem/60830377> Reviewed by Geoffrey Garen. Align garbage collection of Notification JS wrapper with the specification: - https://notifications.spec.whatwg.org/#garbage-collection [1] In particular, the following changes were made: 1. Instead of using the legacy setPendingActivity() / unsetPendingActivity(), override ActiveDOMObject::virtualHasPendingActivity() to implement the behavior documented in the specification. 2. Keep the wrapper alive as long as the notification is showing and as long as there are relevant event listeners, as per [1]. Previously, we failed to check for event listeners, which was suboptimal. 3. Update the constructor to queue a task on the event loop in order to show the notification asynchronously, instead of relying on a SuspendableTimer for this purpose. Previously, the JS wrapper could get collected between construction and the notification getting shown, which was leading to the test flakiness. No new tests, unskipped existing test. * Modules/notifications/Notification.cpp: (WebCore::Notification::Notification): (WebCore::Notification::show): (WebCore::Notification::finalize): (WebCore::Notification::dispatchShowEvent): (WebCore::Notification::dispatchClickEvent): (WebCore::Notification::dispatchCloseEvent): (WebCore::Notification::dispatchErrorEvent): (WebCore::Notification::eventListenersDidChange): (WebCore::Notification::virtualHasPendingActivity const): * Modules/notifications/Notification.h: 2020-04-22 Don Olmstead <don.olmstead@sony.com> [CMake] Add WebKit::WebCoreTestSupport target https://bugs.webkit.org/show_bug.cgi?id=210867 Reviewed by Michael Catanzaro. Add the WebKit::WebCoreTestSupport target. Modify WebCoreTestSupport to only have a dependency on WebCore if WebCore is built as a shared library. * CMakeLists.txt: 2020-04-22 Eric Carlson <eric.carlson@apple.com> fast/events/event-handler-detached-document-dispatchEvent.html is crashing https://bugs.webkit.org/show_bug.cgi?id=210859 <rdar://problem/62072269> Reviewed by Jer Noble. A media session may not have a Page when it is created, so register with the MediaUsageManager in inActiveDocumentChanged if necessary. No new tests, fixes an existing test. * html/MediaElementSession.cpp: (WebCore::MediaElementSession::MediaElementSession): (WebCore::MediaElementSession::~MediaElementSession): (WebCore::MediaElementSession::addedMediaUsageManagerSessionIfNecessary): (WebCore::MediaElementSession::inActiveDocumentChanged): (WebCore::MediaElementSession::updateMediaUsageIfChanged): * html/MediaElementSession.h: 2020-04-22 Antti Koivisto <antti@apple.com> REGRESSION (r249160): Deleting newline after pasting text ending in a newline results in a discontinuity https://bugs.webkit.org/show_bug.cgi?id=210677 <rdar://problem/61954169> Reviewed by Zalan Bujtas. Test: fast/text/delete-line-break-in-pre.html * rendering/RenderTextLineBoxes.cpp: (WebCore::RenderTextLineBoxes::dirtyRange): r249160 changed InlineTextBox end offset to be consistently first-past-end. The code here that updates lineBreakPos needs to take this into account too. 2020-04-22 Antoine Quint <graouts@apple.com> [Web Animations] Coordinate "update animations and send events" procedure across multiple timelines https://bugs.webkit.org/show_bug.cgi?id=202109 <rdar://problem/59470821> Reviewed by Dean Jackson. So far, although we did manage multiple animation timelines per document, we mostly operated under the assumption that there really was a single timeline. In this patch we make the "update animations and send events" procedure, which is central to the lifecycle of animations, work with multiple timelines such that a single microtask checkpoint is performed even with multiple timelines, whereas we would perform one per timeline before. To do this, we move much of the logic DocumentTimeline::updateAnimationsAndSendEvents() to DocumentTimelinesController where each step is run across each timeline, rather than running all steps for each timeline one after the other, respecting the single microtask checkpoint in the middle of the process. To minimize code churn at this stage, we still keep a fair bit of logic in DocumentTimeline and, while we remove updateAnimationsAndSendEvents(), internalUpdateAnimationsAndSendEvents() and updateCurrentTime(), we expose three methods that allow to run the pre-flight sequence in documentWillUpdateAnimationsAndSendEvents(), collect pending events in prepareForPendingAnimationEventsDispatch() and run the post-flight sequence in documentDidUpdateAnimationsAndSendEvents(). None of the logic changes, this is just moving code around. In the future, more patches will move code from DocumentTimeline up to DocumentTimelinesController such that events are enqueued there, and animation scheduling as well. But this already lets us pass a new test that used to flakily reject promises in the WPT test web-animations/timing-model/timelines/update-and-send-events.html. * animation/AnimationTimeline.h: (WebCore::AnimationTimeline::relevantAnimations const): (WebCore::AnimationTimeline::allAnimations const): * animation/DocumentTimeline.cpp: (WebCore::DocumentTimeline::documentWillUpdateAnimationsAndSendEvents): (WebCore::DocumentTimeline::documentDidUpdateAnimationsAndSendEvents): (WebCore::DocumentTimeline::prepareForPendingAnimationEventsDispatch): (WebCore::DocumentTimeline::updateCurrentTime): Deleted. (WebCore::DocumentTimeline::updateAnimationsAndSendEvents): Deleted. (WebCore::DocumentTimeline::internalUpdateAnimationsAndSendEvents): Deleted. * animation/DocumentTimeline.h: * animation/DocumentTimelinesController.cpp: (WebCore::DocumentTimelinesController::DocumentTimelinesController): (WebCore::DocumentTimelinesController::updateAnimationsAndSendEvents): * animation/DocumentTimelinesController.h: * animation/WebAnimationTypes.h: * dom/Document.cpp: (WebCore::Document::ensureTimelinesController): 2020-04-22 Eric Carlson <eric.carlson@apple.com> [iOS] Add a quirk to keep gizmodo videos visible when playing in fullscreen. https://bugs.webkit.org/show_bug.cgi?id=210857 <rdar://problem/58875327> Reviewed by Jer Noble. * page/Quirks.cpp: (WebCore::Quirks::needsFullscreenDisplayNoneQuirk const): * page/Quirks.h: * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm: (WebCore::MediaPlayerPrivateAVFoundationObjC::createAVPlayerLayer): Drive-by fix: always set the layer name to make debugging in release builds easier. * platform/graphics/avfoundation/objc/VideoLayerManagerObjC.mm: (WebCore::VideoLayerManagerObjC::setVideoLayer): Ditto. * style/StyleAdjuster.cpp: (WebCore::Style::Adjuster::adjustForSiteSpecificQuirks const): Change `display:none` into `display:block` on div with class "instream-native-video--mobile" when child video element with id "vjs_video_3_html5_api" is in fullscreen. 2020-04-22 Chris Dumez <cdumez@apple.com> Unreviewed, commit updated xcfilelist files. * DerivedSources-input.xcfilelist: * DerivedSources-output.xcfilelist: 2020-04-22 Chris Dumez <cdumez@apple.com> Unreviewed, reverting r259116. Broke login flow on some apple-internal sites (rdar://problem/61905262) Reverted changeset: "Move applyUserAgentIfNeeded calls to a more central place" https://bugs.webkit.org/show_bug.cgi?id=209587 https://trac.webkit.org/changeset/259116 2020-04-22 Zalan Bujtas <zalan@apple.com> [LFC][TFC] Introduce TableFormattingContext::computeAndDistributeExtraVerticalSpace https://bugs.webkit.org/show_bug.cgi?id=210830 Reviewed by Antti Koivisto. Add a dedicated function to compute preferred heights for the table rows. This is in preparation for the 2 pass layout required to finalize row height. * layout/FormattingContext.cpp: (WebCore::Layout::FormattingContext::computeBorderAndPadding): * layout/FormattingContext.h: * layout/FormattingContextGeometry.cpp: (WebCore::Layout::FormattingContext::Geometry::computedPadding const): * layout/tableformatting/TableFormattingContext.cpp: (WebCore::Layout::TableFormattingContext::layoutInFlowContent): (WebCore::Layout::TableFormattingContext::layoutCell): (WebCore::Layout::TableFormattingContext::computeAndDistributeExtraVerticalSpace): (WebCore::Layout::TableFormattingContext::setComputedGeometryForRows): (WebCore::Layout::TableFormattingContext::setComputedGeometryForSections): (WebCore::Layout::TableFormattingContext::positionTableCells): Deleted. * layout/tableformatting/TableFormattingContext.h: 2020-04-22 Claudio Saavedra <csaavedra@igalia.com> [GTK4] Several fixes to GdkEvent APIs for GTK4 https://bugs.webkit.org/show_bug.cgi?id=210856 Reviewed by Carlos Garcia Campos. No tests needed. Several fixes to GdkEvent API changes for GTK4. This is far from complete but it allows the GTK4 build to move forward. When possible, add GTK3-API replacements to GtkVersioning.h to avoid #ifdef blocks, where the API changes are too complex, just #ifdef. * platform/gtk/GtkUtilities.cpp: (WebCore::wallTimeForEvent): * platform/gtk/GtkVersioning.h: (gdk_event_get_state): (gdk_event_get_coords): (gdk_event_get_root_coords): (gdk_event_is_scroll_stop_event): (gdk_event_get_scroll_direction): (gdk_event_get_scroll_deltas): (gdk_event_get_button): (gdk_keymap_get_for_display): Deleted as it was wrong and it's not needed. * platform/gtk/PlatformKeyboardEventGtk.cpp: (WebCore::PlatformKeyboardEvent::currentCapsLockState): (WebCore::PlatformKeyboardEvent::getCurrentModifierState): (WebCore::PlatformKeyboardEvent::modifiersContainCapsLock): * platform/gtk/PlatformWheelEventGtk.cpp: (WebCore::PlatformWheelEvent::PlatformWheelEvent): 2020-04-22 Youenn Fablet <youenn@apple.com> Simplify SWServerWorker::whenActivated logic https://bugs.webkit.org/show_bug.cgi?id=210795 Reviewed by Alex Christensen. Improve logging and ensure whenActivated can be called whatever the worker state is. No change of behavior. * workers/service/server/SWServer.cpp: (WebCore::SWServer::didFinishInstall): (WebCore::SWServer::fireInstallEvent): (WebCore::SWServer::fireActivateEvent): * workers/service/server/SWServerWorker.cpp: (WebCore::SWServerWorker::whenActivated): 2020-04-22 Enrique Ocaña González <eocanha@igalia.com> [GStreamer][MSE] Youtube 'live stream'/H264 URLs fail to play, VP8/9 URLs play OK https://bugs.webkit.org/show_bug.cgi?id=209119 Reviewed by Xabier Rodriguez-Calvar. The fix consists of removing the initial avoiding of seeking and just issuing the proper segment instead of seeking (seeks in GStreamer can't be done before prerolling anyway). Appsrc doesn't make easy to emit our own custom segment, so what I did was to use a segment fixer probe to modify the original [0, infinity] segment issued by appsrc and use a [startTime, stopTime] with proper values depending on the seek target and rate. Covered by existing tests. * platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.cpp: (WebCore::checkShouldDelaySeek): Don't hold seeks on startup, when changing from READY to PAUSED. (WebCore::MediaPlayerPrivateGStreamerMSE::doSeek): Refactored seek delay condition. Also, don't do a regular gst_element_seek() for initial seeks, just proceed with a special case in that situation. * platform/graphics/gstreamer/mse/WebKitMediaSourceGStreamer.cpp: (initialSeekSegmentFixerProbe): Probe that fixes the segment. (webKitMediaSrcPrepareInitialSeek): Behave much like a regular seek, but also compute the right GstSegment, install the segment fixer probe and setReadyForMoreSamples() on the SourceBufferPrivates. * platform/graphics/gstreamer/mse/WebKitMediaSourceGStreamer.h: 2020-04-21 Sergio Villar Senin <svillar@igalia.com> [WebXR] Test IDLs and stubs https://bugs.webkit.org/show_bug.cgi?id=209859 Reviewed by Dean Jackson and Youenn Fablet. WebXR testing is hard as it might involve interaction with actual devices. That's why the WebXR testing API (https://immersive-web.github.io/webxr-test-api/) was proposed. In fact, all the current WebXR tests from web-platform-tests are using that testing API. This new testing API supplements navigator.xr and is accessed through navigator.xr.test. In order not to expose the API to the web we're adding the XRTest interface to Internals instead. The mapping from internals.xrTest to navigator.xr.test happens in the WPT code. We're adding the required IDLs and very basic (mostly empty) implementations for testing methods. We're adding testing infrastructure, adding tests make no sense for this change. * CMakeLists.txt: Added new files. * DerivedSources.make: Ditto. * Modules/webxr/NavigatorWebXR.h: Export API to be used in testing code. * Modules/webxr/WebXRSystem.h: Export ::from and ::xr methods. * WebCore.xcodeproj/project.pbxproj: Ditto. * bindings/js/WebCoreBuiltinNames.h: Added some new macros. * testing/FakeXRBoundsPoint.h: Added. * testing/FakeXRBoundsPoint.idl: Added. * testing/FakeXRButtonStateInit.h: Added. * testing/FakeXRButtonStateInit.idl: Added. * testing/FakeXRInputSourceInit.h: Added. * testing/FakeXRInputSourceInit.idl: Added. * testing/FakeXRRigidTransformInit.h: Added. * testing/FakeXRRigidTransformInit.idl: Added. * testing/FakeXRViewInit.h: Added. * testing/FakeXRViewInit.idl: Added. * testing/Internals.cpp: (WebCore::Internals::xrTest): Added WebXRTest to Internals. * testing/Internals.h: Added xrTest() accessor. * testing/Internals.idl: Added xrTest attribute. * testing/WebFakeXRDevice.cpp: Added. (WebCore::WebFakeXRDevice::setViews): (WebCore::WebFakeXRDevice::disconnect): (WebCore::WebFakeXRDevice::setViewerOrigin): (WebCore::WebFakeXRDevice::clearViewerOrigin): (WebCore::WebFakeXRDevice::simulateVisibilityChange): (WebCore::WebFakeXRDevice::setBoundsGeometry): (WebCore::WebFakeXRDevice::setFloorOrigin): (WebCore::WebFakeXRDevice::clearFloorOrigin): (WebCore::WebFakeXRDevice::simulateResetPose): (WebCore::WebFakeXRDevice::simulateInputSourceConnection): * testing/WebFakeXRDevice.h: Added. * testing/WebFakeXRDevice.idl: Added. * testing/WebFakeXRInputController.cpp: Added. (WebCore::WebFakeXRInputController::setHandedness): (WebCore::WebFakeXRInputController::setTargetRayMode): (WebCore::WebFakeXRInputController::setProfiles): (WebCore::WebFakeXRInputController::setGripOrigin): (WebCore::WebFakeXRInputController::clearGripOrigin): (WebCore::WebFakeXRInputController::setPointerOrigin): (WebCore::WebFakeXRInputController::disconnect): (WebCore::WebFakeXRInputController::reconnect): (WebCore::WebFakeXRInputController::startSelection): (WebCore::WebFakeXRInputController::endSelection): (WebCore::WebFakeXRInputController::simulateSelect): (WebCore::WebFakeXRInputController::setSupportedButtons): (WebCore::WebFakeXRInputController::updateButtonState): * testing/WebFakeXRInputController.h: Added. * testing/WebFakeXRInputController.idl: Added. * testing/WebXRTest.cpp: Added. (WebCore::WebXRTest::simulateDeviceConnection const): (WebCore::WebXRTest::simulateUserActivation): (WebCore::WebXRTest::disconnectAllDevices): * testing/WebXRTest.h: Added. (WebCore::WebXRTest::create): * testing/WebXRTest.idl: Added. * testing/XRSimulateUserActivationFunction.h: Added. * testing/XRSimulateUserActivationFunction.idl: Ditto. 2020-04-21 Antoine Quint <graouts@apple.com> [Web Animations] Add a supporting object for Document to manage timelines https://bugs.webkit.org/show_bug.cgi?id=210817 Reviewed by Dean Jackson. Add a new DocumentTimelinesController object owned by Document to manage DocumentTimelines created for it. This simple piece of refactoring is the first step towards a coordinated "update animations and send events" procedure where all timelines are updated at once with a single microtask checkpoint instead of each timeline running one. No change in behavior, so no new tests. * Headers.cmake: * Sources.txt: * WebCore.xcodeproj/project.pbxproj: * animation/DocumentTimeline.cpp: (WebCore::DocumentTimeline::DocumentTimeline): (WebCore::DocumentTimeline::~DocumentTimeline): (WebCore::DocumentTimeline::controller const): (WebCore::DocumentTimeline::detachFromDocument): * animation/DocumentTimeline.h: * animation/DocumentTimelinesController.cpp: Added. (WebCore::DocumentTimelinesController::DocumentTimelinesController): (WebCore::DocumentTimelinesController::~DocumentTimelinesController): (WebCore::DocumentTimelinesController::addTimeline): (WebCore::DocumentTimelinesController::removeTimeline): (WebCore::DocumentTimelinesController::detachFromDocument): (WebCore::DocumentTimelinesController::updateAnimationsAndSendEvents): * animation/DocumentTimelinesController.h: Added. * dom/Document.cpp: (WebCore::Document::commonTeardown): (WebCore::Document::ensureTimelinesController): (WebCore::Document::updateAnimationsAndSendEvents): Deleted. (WebCore::Document::addTimeline): Deleted. (WebCore::Document::removeTimeline): Deleted. * dom/Document.h: (WebCore::Document::timelinesController const): * page/Page.cpp: (WebCore::Page::updateRendering): 2020-04-21 Cathie Chen <cathiechen@igalia.com> REGRESSION (r254790): No longer get smooth scrolling on music.apple.com https://bugs.webkit.org/show_bug.cgi?id=210634 Reviewed by Darin Adler. The page uses the access of "scrollBehavior" in CSSStyleDeclaration as the support of scroll-behavior. If supported, it will use scroll-behavior. Otherwise, it will perform a JS smooth scroll. Currently, "scrollBehavior" is still available when CSSOMViewSmoothScrolling is off, only the value "smooth" is invalidated. In order to fix this, CSSStyleDeclaration will take account of CSSOMViewSmoothScrolling in Settings. This patch also tries to provide an interface which let flags in Settings can enable/disable a property. However, it is not complete, for there are some scenarios that Settings isn't accessible. By adding "settings-flag" to CSSProperties.json, it would be effective to control the property access in CSSStyleDeclaration. Tests: fast/scrolling/scroll-behavior-invalidate-if-disabled.html fast/scrolling/scroll-behavior-validate-if-enabled.html * css/CSSProperties.json: * css/CSSStyleDeclaration.cpp: (WebCore::CSSStyleDeclaration::getCSSPropertyIDFromJavaScriptPropertyName): (WebCore::CSSStyleDeclaration::namedItem): (WebCore::CSSStyleDeclaration::setNamedItem): (WebCore::CSSStyleDeclaration::supportedPropertyNames const): * css/makeprop.pl: (addProperty): * css/parser/CSSPropertyParser.cpp: (WebCore::cssPropertyID): * inspector/InspectorStyleSheet.cpp: (WebCore::InspectorStyle::collectProperties const): * inspector/agents/InspectorCSSAgent.cpp: (WebCore::InspectorCSSAgent::getSupportedCSSProperties): 2020-04-21 Yusuke Suzuki <ysuzuki@apple.com> Canonicalize JSBigInt generated by structured-cloning by calling rightTrim https://bugs.webkit.org/show_bug.cgi?id=210816 Reviewed by Keith Miller and Darin Adler. Let's assume that the serialized data is slightly different. JSBigInt's internal representation has various invariants. For example, if JSBigInt is zero, it should have zero length, and its sign should be false. But there are various ways of representing zero JSBigInt in serialization format. For example, we can set sign = true, length = 0. Current code strongly assumes that dumped data meets this JSBigInt's internal invariant. This is not good: for example, if we add a new invariant into JSBigInt, already serialized data would not meet this invariant. In this patch, we call `JSBigInt::rightTrim(VM&)` when finishing JSBigInt deserialization. This means that we canonicalize JSBigInt when finishing creation, and this makes this serialization format free from JSBigInt's internal invariants. This makes JSBigInt serialization/deserialization robust. And we also add lengthInUint64 == 0 path not to call rightTrim when it is zero. This makes deserialization robust for zero-length & signed corrupted JSBigInt zero. * bindings/js/SerializedScriptValue.cpp: (WebCore::CloneSerializer::dumpBigInt32Data): (WebCore::CloneDeserializer::readBigInt): 2020-04-21 Peng Liu <peng.liu6@apple.com> platform/mac/media/audio-session-category-audio-autoplay.html is timing out https://bugs.webkit.org/show_bug.cgi?id=210826 Reviewed by Jer Noble. For WebKitLegacy, AudioSession::setCategory() needs to set the category when m_routingArbitrationClient is nullptr. This patch also fixes an error regarding setupArbitrationOngoing. * platform/audio/mac/AudioSessionMac.mm: (WebCore::AudioSession::setCategory): 2020-04-21 Peng Liu <peng.liu6@apple.com> Fix MACCATALYST build failures https://bugs.webkit.org/show_bug.cgi?id=210815 Reviewed by Tim Horton. No new tests, no functional change. * Configurations/FeatureDefines.xcconfig: * platform/ios/WebVideoFullscreenControllerAVKit.mm: 2020-04-19 Darin Adler <darin@apple.com> [Cocoa] Use createNSArray in many more places that build NSArray objects from C++ collections https://bugs.webkit.org/show_bug.cgi?id=210702 Reviewed by Alex Christensen. * accessibility/ios/WebAccessibilityObjectWrapperIOS.mm: (-[WebAccessibilityObjectWrapper accessibilityFlowToElements]): Use createNSArray. (-[WebAccessibilityObjectWrapper textRectsFromMarkers:withText:]): Ditto. (-[WebAccessibilityObjectWrapper rectsForSelectionRects:]): Deleted. Merged into the method above. * accessibility/mac/WebAccessibilityObjectWrapperBase.h: Take const references instead of references when passing Path and FloatRect. * accessibility/mac/WebAccessibilityObjectWrapperBase.mm: (convertMathPairsToNSArray): Use createNSArray. Also use arrays on the stack to create NSDictionary rather than using NSMutableDictionary. (addChildToArray): Deleted. (convertToNSArray): Uses createNSArray. Rolled addChildToArray in. (-[WebAccessibilityObjectWrapperBase convertPathToScreenSpace:]): Take const reference instead of reference. (-[WebAccessibilityObjectWrapperBase convertRectToSpace:space:]): Ditto. * accessibility/mac/WebAccessibilityObjectWrapperMac.mm: (-[WebAccessibilityObjectWrapper accessibilityAttributeValue:forParameter:]): Use createNSArray. * editing/cocoa/FontAttributesCocoa.mm: (WebCore::FontAttributes::createDictionary const): Ditto. * page/ios/FrameIOS.mm: (WebCore::Frame::interpretationsForCurrentRoot const): Ditto. * platform/cocoa/SearchPopupMenuCocoa.mm: (WebCore::saveRecentSearches): Ditto. * platform/cocoa/SharedBufferCocoa.mm: (WebCore::SharedBuffer::createNSDataArray const): Ditto. * platform/graphics/avfoundation/objc/CDMInstanceFairPlayStreamingAVFObjC.mm: (WebCore::CDMInstanceSessionFairPlayStreamingAVFObjC::updateLicense): Ditto. * platform/graphics/avfoundation/objc/CDMSessionAVContentKeySession.mm: (WebCore::CDMSessionAVContentKeySession::update): Ditto. * platform/graphics/avfoundation/objc/CDMSessionAVStreamSession.mm: (WebCore::CDMSessionAVStreamSession::update): Ditto. * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm: (WebCore::MediaPlayerPrivateAVFoundationObjC::createAVAssetForURL): Ditto. * platform/graphics/ca/cocoa/PlatformCAAnimationCocoa.mm: (WebCore::PlatformCAAnimationCocoa::setValues): Ditto. (WebCore::PlatformCAAnimationCocoa::setKeyTimes): Ditto. (WebCore::PlatformCAAnimationCocoa::setTimingFunctions): Ditto. * platform/graphics/ca/cocoa/PlatformCAFiltersCocoa.mm: (WebCore::PlatformCAFilters::setFiltersOnLayer): Moved almost the whole function into a call to createNSArray. Removed the default case from the switch so we get a warning if we miss any filter operation types. * platform/graphics/ca/cocoa/PlatformCALayerCocoa.mm: (WebCore::PlatformCALayerCocoa::setSublayers): Use createNSArray. * platform/ios/PlatformPasteboardIOS.mm: (WebCore::PlatformPasteboard::write): Ditto. * platform/ios/PlaybackSessionInterfaceAVKit.mm: (WebCore::mediaSelectionOptions): Ditto. * platform/mac/PlatformPasteboardMac.mm: (WebCore::PlatformPasteboard::write): Ditto. * platform/mac/WebPlaybackControlsManager.mm: (mediaSelectionOptions): Ditto. * platform/network/cocoa/NetworkStorageSessionCocoa.mm: (WebCore::NetworkStorageSession::setCookies): Ditto. * platform/network/cocoa/ResourceRequestCocoa.mm: (WebCore::ResourceRequest::doUpdatePlatformRequest): Ditto. * platform/network/cocoa/WebCoreNSURLSession.h: Use the Objective-C type WebCoreNSURLSessionDataTask in the _dataTasks set rather than using CFTypeRef. * platform/network/cocoa/WebCoreNSURLSession.mm: (-[WebCoreNSURLSession dealloc]): Remove now-unneeded typecast. (-[WebCoreNSURLSession taskCompleted:]): Ditto. (-[WebCoreNSURLSession finishTasksAndInvalidate]): Use a more idiomatic form of capturing strongSelf in a lambda. (-[WebCoreNSURLSession invalidateAndCancel]): Updated the type on a local variable and removed now-unneeded typecast. (-[WebCoreNSURLSession getTasksWithCompletionHandler:]): Use RetainPtr to cut down on autorelease. Use createNSArray, taking advantage of the fact that it works on HashSet. Removed now-unneeded typecast. (-[WebCoreNSURLSession getAllTasksWithCompletionHandler:]): Ditto. (-[WebCoreNSURLSession dataTaskWithRequest:]): Remove now-unneeded typecast. (-[WebCoreNSURLSession dataTaskWithURL:]): Ditto. 2020-04-21 Alexey Shvayka <shvaikalesh@gmail.com> The visibilitychange event should bubble https://bugs.webkit.org/show_bug.cgi?id=210829 Reviewed by Darin Adler. This change makes `visibilitychange` event bubble as per spec [1], aligning WebKit with Blink and Gecko. Also fixes broken spec link to `visibilityState` attribute. [1] https://w3c.github.io/page-visibility/#dfn-now-visible-algorithm (step 2) Test: fast/events/page-visibility-transition-test.html * dom/Document.cpp: (WebCore::Document::visibilityStateChanged): (WebCore::Document::visibilityState const): 2020-04-21 Simon Fraser <simon.fraser@apple.com> Composited layers are misplaced inside RTL overflow scroller with visible scrollbar https://bugs.webkit.org/show_bug.cgi?id=210820 Reviewed by Zalan Bujtas. RenderLayerBacking::computeParentGraphicsLayerRect() used renderBox.paddingBoxRectIncludingScrollbar() to position layers inside composited overflow scroll, but this is wrong if the RTL left-side scrollbar takes space. Fix by making some static functions that we can call from the various places that ask about box geometry, and using them. Test: compositing/scrolling/async-overflow-scrolling/position-inside-rtl-overflow.html * rendering/RenderBox.cpp: (WebCore::RenderBox::overflowClipRect const): (WebCore::RenderBox::clipRect const): (WebCore::RenderBox::overflowClipRect): Deleted. (WebCore::RenderBox::clipRect): Deleted. * rendering/RenderBox.h: (WebCore::RenderBox::overflowClipRectForChildLayers const): (WebCore::RenderBox::overflowClipRectForChildLayers): Deleted. * rendering/RenderLayerBacking.cpp: (WebCore::scrollContainerLayerBox): (WebCore::clippingLayerBox): (WebCore::overflowControlsHostLayerBox): (WebCore::RenderLayerBacking::computeParentGraphicsLayerRect const): (WebCore::RenderLayerBacking::updateGeometry): (WebCore::clipBox): Deleted. * rendering/RenderTable.cpp: (WebCore::RenderTable::overflowClipRect const): (WebCore::RenderTable::overflowClipRect): Deleted. * rendering/RenderTable.h: 2020-04-21 Simon Fraser <simon.fraser@apple.com> [Async overflow scroll] Overflow that's hidden on one axis is scrollable on that axis https://bugs.webkit.org/show_bug.cgi?id=210771 <rdar://problem/62080331> Reviewed by Tim Horton. eventCanScrollContents() should check the presence of enabled scrollbars, like ScrollAnimator::handleWheelEvent() does. Test: fast/scrolling/mac/async-scroll-overflow-hidden-on-one-axis.html * page/scrolling/ScrollingTreeScrollingNode.cpp: (WebCore::ScrollingTreeScrollingNode::eventCanScrollContents const): 2020-04-21 Daniel Bates <dabates@apple.com> [iOS] -_didFinishTextInteractionInTextInputContext should only zoom to reveal focused element if it changed https://bugs.webkit.org/show_bug.cgi?id=210697 <rdar://problem/60997530> Reviewed by Wenson Hsieh. For now, add a comment about the return value of setFocusedElement: it returns whether focus was blocked. If focused wasn't blocked then it will return true even if the element wasn't actually focused. For example, it will return true for non-focusable elements: <input disabled>. I was tempted to fix setFocusedElement() to return true when it actually focused the element or if the element was already focused, but I decided to defer this until I audit the callers and run some tests. * dom/Document.h: 2020-04-21 Andres Gonzalez <andresg_22@apple.com> Fix for remoteParentObject and platformWidget not being stored properly in the AXIsolatedObject attributes variant. https://bugs.webkit.org/show_bug.cgi?id=210809 Reviewed by Chris Fleizach. Adding these properties to the AXIsolatedObject attributes variant as WeakPtr<void*> fails. So they are now cached as member variables. * accessibility/isolatedtree/AXIsolatedObject.cpp: (WebCore::AXIsolatedObject::initializeAttributeData): (WebCore::AXIsolatedObject::platformWidget const): * accessibility/isolatedtree/AXIsolatedObject.h: (WebCore::AXIsolatedObject::propertyValue const): Deleted. * accessibility/isolatedtree/mac/AXIsolatedObjectMac.mm: (WebCore::AXIsolatedObject::initializePlatformProperties): (WebCore::AXIsolatedObject::remoteParentObject const): 2020-04-20 Simon Fraser <simon.fraser@apple.com> Horizontal overflow overlay scrollbar is misplaced in RTL https://bugs.webkit.org/show_bug.cgi?id=210673 <rdar://problem/61950751> Reviewed by Antti Koivisto. Code for positioning RenderLayer overflow controls (scrollbars and scroll corner) was scattered across lots of different functions, making it hard to follow, and prone to bugs. Fix by making one source of truth, overflowControlsRects(), which computes rects for the two scrollbars, the "scroll corner" (the square in the corner which shows, only for non-overlay scrollbars, when both scrollbars or the resize control is visible), and the resize control which shows when style specifies the "resize" property. Call this function in all the places that need to know about overflow control geometry. RenderLayer::hitTestResizerInFragments() is a little tricky because it wants the resize control relative to the fragment rect; achieve this by computing the position of the resizer rect relative to the border box, then shifting it into position relative to the fragment bounds (which include border). Test: compositing/overflow/rtl-scrollbar-layer-positioning.html * page/EventHandler.cpp: (WebCore::EventHandler::selectCursor): * rendering/RenderLayer.cpp: (WebCore::RenderLayer::scrollCornerRect const): (WebCore::RenderLayer::overflowControlsRects const): (WebCore::RenderLayer::scrollbarOffset const): (WebCore::RenderLayer::invalidateScrollbarRect): (WebCore::RenderLayer::positionOverflowControls): (WebCore::RenderLayer::overflowControlsIntersectRect const): (WebCore::RenderLayer::paintResizer): (WebCore::RenderLayer::isPointInResizeControl const): (WebCore::RenderLayer::hitTestOverflowControls): (WebCore::RenderLayer::hitTestResizerInFragments const): (WebCore::cornerStart): Deleted. (WebCore::cornerRect): Deleted. (WebCore::resizerCornerRect): Deleted. (WebCore::RenderLayer::scrollCornerAndResizerRect const): Deleted. (WebCore::RenderLayer::rectForHorizontalScrollbar const): Deleted. (WebCore::RenderLayer::rectForVerticalScrollbar const): Deleted. (WebCore::RenderLayer::verticalScrollbarStart const): Deleted. (WebCore::RenderLayer::horizontalScrollbarStart const): Deleted. * rendering/RenderLayer.h: * rendering/RenderLayerBacking.cpp: (WebCore::RenderLayerBacking::requiresScrollCornerLayer const): (WebCore::RenderLayerBacking::positionOverflowControlsLayers): (WebCore::RenderLayerBacking::paintContents): 2020-04-21 Sergio Villar Senin <svillar@igalia.com> Unreviewed, reverting r260432. Broke WPE build Reverted changeset: "[WebXR] Test IDLs and stubs" https://bugs.webkit.org/show_bug.cgi?id=209859 https://trac.webkit.org/changeset/260432 2020-04-21 Chris Dumez <cdumez@apple.com> REGRESSION (r256808): “A problem repeatedly occurred” when attempting to load https://bungalow.com/listings/bay-area https://bugs.webkit.org/show_bug.cgi?id=210801 <rdar://problem/61658940> Reviewed by Antti Koivisto. Even though the page uses the 'async' attribute on the mapbox-gl.js script, deferring the execution of this script gets the page into a bad state, causing it to use a lot of CPU & memory until the process crashes. Since we don't have any other evidence of breakage from r256808 yet and since r256808 was a massive PLT progression, I am opting to add a quirk to disable the async script optimization on bungalow.com for now. * dom/Document.cpp: (WebCore::Document::shouldDeferAsynchronousScriptsUntilParsingFinishes const): * page/Quirks.cpp: (WebCore::Quirks::shouldBypassAsyncScriptDeferring const): * page/Quirks.h: * platform/RegistrableDomain.h: (WebCore::RegistrableDomain::operator== const): 2020-04-16 Sergio Villar Senin <svillar@igalia.com> [WebXR] Test IDLs and stubs https://bugs.webkit.org/show_bug.cgi?id=209859 Reviewed by Dean Jackson and Youenn Fablet. WebXR testing is hard as it might involve interaction with actual devices. That's why the WebXR testing API (https://immersive-web.github.io/webxr-test-api/) was proposed. In fact, all the current WebXR tests from web-platform-tests are using that testing API. This new testing API supplements navigator.xr and is accessed through navigator.xr.test. In order not to expose the API to the web we're adding the XRTest interface to Internals instead. The mapping from internals.xrTest to navigator.xr.test happens in the WPT code. We're adding the required IDLs and very basic (mostly empty) implementations for testing methods. We're adding testing infrastructure, adding tests make no sense for this change. * CMakeLists.txt: Added new files. * DerivedSources.make: Ditto. * Modules/webxr/NavigatorWebXR.h: Export API to be used in testing code. * Modules/webxr/WebXRSystem.h: Export ::from and ::xr methods. * Sources.txt: Added new files. * WebCore.xcodeproj/project.pbxproj: Ditto. * bindings/js/WebCoreBuiltinNames.h: Added some new macros. * testing/FakeXRBoundsPoint.h: Added. * testing/FakeXRBoundsPoint.idl: Added. * testing/FakeXRButtonStateInit.h: Added. * testing/FakeXRButtonStateInit.idl: Added. * testing/FakeXRInputSourceInit.h: Added. * testing/FakeXRInputSourceInit.idl: Added. * testing/FakeXRRigidTransformInit.h: Added. * testing/FakeXRRigidTransformInit.idl: Added. * testing/FakeXRViewInit.h: Added. * testing/FakeXRViewInit.idl: Added. * testing/Internals.cpp: (WebCore::Internals::xrTest): Added WebXRTest to Internals. * testing/Internals.h: Added xrTest() accessor. * testing/Internals.idl: Added xrTest attribute. * testing/WebFakeXRDevice.cpp: Added. (WebCore::WebFakeXRDevice::setViews): (WebCore::WebFakeXRDevice::disconnect): (WebCore::WebFakeXRDevice::setViewerOrigin): (WebCore::WebFakeXRDevice::clearViewerOrigin): (WebCore::WebFakeXRDevice::simulateVisibilityChange): (WebCore::WebFakeXRDevice::setBoundsGeometry): (WebCore::WebFakeXRDevice::setFloorOrigin): (WebCore::WebFakeXRDevice::clearFloorOrigin): (WebCore::WebFakeXRDevice::simulateResetPose): (WebCore::WebFakeXRDevice::simulateInputSourceConnection): * testing/WebFakeXRDevice.h: Added. * testing/WebFakeXRDevice.idl: Added. * testing/WebFakeXRInputController.cpp: Added. (WebCore::WebFakeXRInputController::setHandedness): (WebCore::WebFakeXRInputController::setTargetRayMode): (WebCore::WebFakeXRInputController::setProfiles): (WebCore::WebFakeXRInputController::setGripOrigin): (WebCore::WebFakeXRInputController::clearGripOrigin): (WebCore::WebFakeXRInputController::setPointerOrigin): (WebCore::WebFakeXRInputController::disconnect): (WebCore::WebFakeXRInputController::reconnect): (WebCore::WebFakeXRInputController::startSelection): (WebCore::WebFakeXRInputController::endSelection): (WebCore::WebFakeXRInputController::simulateSelect): (WebCore::WebFakeXRInputController::setSupportedButtons): (WebCore::WebFakeXRInputController::updateButtonState): * testing/WebFakeXRInputController.h: Added. * testing/WebFakeXRInputController.idl: Added. * testing/WebXRTest.cpp: Added. (WebCore::WebXRTest::simulateDeviceConnection const): (WebCore::WebXRTest::simulateUserActivation): (WebCore::WebXRTest::disconnectAllDevices): * testing/WebXRTest.h: Added. (WebCore::WebXRTest::create): * testing/WebXRTest.idl: Added. * testing/XRSimulateUserActivationFunction.h: Added. * testing/XRSimulateUserActivationFunction.idl: Ditto. 2020-04-21 Claudio Saavedra <csaavedra@igalia.com> [GTK4] Adapt to GtkIconTheme API changes https://bugs.webkit.org/show_bug.cgi?id=210745 Reviewed by Adrian Perez de Castro. No new tests needed. GtkIconTheme changes in GTK and since we're no longer following the theme we can drop the missing image from the icon theme, so remove now unnecessary code. * platform/graphics/gtk/ImageGtk.cpp: (WebCore::Image::loadPlatformResource): Directly load image from compiled GResource. (WebCore::loadResourceSharedBuffer): Deleted. (WebCore::loadMissingImageIconFromTheme): Deleted. 2020-04-21 Rob Buis <rbuis@igalia.com> Exit early in FrameLoader::loadURL when redirecting to another frame https://bugs.webkit.org/show_bug.cgi?id=210751 Reviewed by Geoffrey Garen. Exit early in FrameLoader::loadURL when redirecting to another frame, previously we were preparing request needlessly, doing it twice in case of frame redirecting. Also move some variables to where they are actually used. * loader/FrameLoader.cpp: (WebCore::FrameLoader::loadURL): * loader/FrameLoader.h: 2020-04-21 Carlos Garcia Campos <cgarcia@igalia.com> [GTK] Remove PlatformMouseEventGtk https://bugs.webkit.org/show_bug.cgi?id=210743 Reviewed by Adrian Perez de Castro. It's unused, we no longer create PlatformMouseEvent from a GdkEvent since WebKit2. * SourcesGTK.txt: * platform/PlatformMouseEvent.h: * platform/gtk/PlatformMouseEventGtk.cpp: Removed. 2020-04-21 Claudio Saavedra <csaavedra@igalia.com> [GTK4] Fix platform GDK includes https://bugs.webkit.org/show_bug.cgi?id=210746 Reviewed by Carlos Garcia Campos. * platform/graphics/PlatformDisplay.cpp: Wayland, X11, etc. platform includes changed path, so update accordingly. 2020-04-21 Adrian Perez de Castro <aperez@igalia.com> Non-unified build fixes late February 2020 edition https://bugs.webkit.org/show_bug.cgi?id=210767 Unreviewed build fix. No new tests needed. * css/MediaQueryListEvent.cpp: Add missing wtf/IsoMallocInlines.h header. * css/MediaQueryMatcher.cpp: Add missing MediaQueryListEvent.h header. * platform/graphics/FloatQuad.cpp: Add missing wtf/text/TextStream.h header. 2020-04-20 Ross Kirsling <ross.kirsling@sony.com> Classes marked final should not use protected access specifier https://bugs.webkit.org/show_bug.cgi?id=210775 Reviewed by Daniel Bates. * Modules/applepay/ApplePayPaymentMethodSelectedEvent.h: * Modules/applepay/ApplePayValidateMerchantEvent.h: * Modules/encryptedmedia/legacy/LegacyCDMSessionClearKey.h: * Modules/webaudio/BiquadDSPKernel.h: * Modules/webaudio/WaveShaperDSPKernel.h: * Modules/websockets/WebSocketChannel.h: * Modules/websockets/WorkerThreadableWebSocketChannel.h: * Modules/webxr/WebXRSession.h: * Modules/webxr/WebXRSystem.h: * accessibility/AccessibilityARIAGridCell.h: * accessibility/AccessibleSetValueEvent.h: * animation/CSSAnimation.h: * bindings/js/ReadableStream.h: * bridge/objc/objc_runtime.h: * bridge/runtime_array.h: * css/CSSImageSetValue.h: * html/HTMLKeygenElement.cpp: * html/canvas/WebGLBuffer.h: * html/canvas/WebGLFramebuffer.h: * html/canvas/WebGLProgram.h: * html/canvas/WebGLQuery.h: * html/canvas/WebGLRenderbuffer.h: * html/canvas/WebGLSampler.h: * html/canvas/WebGLSync.h: * html/canvas/WebGLTransformFeedback.h: * html/canvas/WebGLUniformLocation.h: * html/shadow/TextControlInnerElements.h: * inspector/InspectorStyleSheet.h: * inspector/WebInjectedScriptManager.h: * loader/cache/CachedCSSStyleSheet.h: * page/Frame.h: * page/FrameView.h: * page/PageConsoleClient.h: * page/animation/KeyframeAnimation.h: * page/scrolling/nicosia/ScrollingTreeOverflowScrollProxyNode.h: * platform/audio/AudioBus.h: * platform/cocoa/PlaybackSessionModelMediaElement.h: * platform/graphics/BitmapImage.h: * platform/graphics/CrossfadeGeneratedImage.h: * platform/graphics/NamedImageGeneratedImage.h: * platform/graphics/avfoundation/objc/CDMSessionAVFoundationObjC.h: * platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm: * platform/graphics/ca/cocoa/PlatformCAAnimationCocoa.h: * platform/graphics/ca/win/PlatformCAAnimationWin.h: * platform/graphics/cg/ImageDecoderCG.h: * platform/graphics/iso/ISOOriginalFormatBox.h: * platform/graphics/iso/ISOProtectionSchemeInfoBox.h: * platform/graphics/iso/ISOSchemeInformationBox.h: * platform/graphics/iso/ISOSchemeTypeBox.h: * platform/graphics/iso/ISOTrackEncryptionBox.h: * platform/graphics/iso/ISOVTTCue.cpp: * platform/graphics/iso/ISOVTTCue.h: * platform/graphics/win/ImageDecoderDirect2D.h: * platform/mediastream/mac/AVCaptureDeviceManager.h: * platform/mock/mediasource/MockBox.h: * platform/mock/mediasource/MockSourceBufferPrivate.cpp: * rendering/RenderFullScreen.h: * rendering/RenderGrid.h: * rendering/RenderMultiColumnSet.h: * rendering/RenderRuby.h: * rendering/RenderScrollbarPart.h: * rendering/RenderScrollbarTheme.h: * rendering/RenderTableCell.h: * rendering/RenderTableSection.h: * rendering/RenderThemeIOS.h: * rendering/RenderView.h: * rendering/svg/RenderSVGResourceClipper.h: * svg/SVGTextPathElement.h: * workers/WorkerConsoleClient.h: * worklets/Worklet.h: 2020-04-20 Peng Liu <peng.liu6@apple.com> Fix build failures when video fullscreen and picture-in-picture is disabled https://bugs.webkit.org/show_bug.cgi?id=210777 Reviewed by Eric Carlson. Wrap video fullscreen and picture-in-picture related code with "#if ENABLE(VIDEO_PRESENTATION_MODE)". * Configurations/FeatureDefines.xcconfig: * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm: (WebCore::MediaPlayerPrivateAVFoundationObjC::updateVideoLayerGravity): * platform/graphics/avfoundation/objc/VideoLayerManagerObjC.h: * platform/graphics/avfoundation/objc/VideoLayerManagerObjC.mm: (WebCore::VideoLayerManagerObjC::setVideoLayer): (WebCore::VideoLayerManagerObjC::requiresTextTrackRepresentation const): (WebCore::VideoLayerManagerObjC::syncTextTrackBounds): (WebCore::VideoLayerManagerObjC::setTextTrackRepresentation): 2020-04-20 Nikos Mouchtaris <nmouchtaris@apple.com> WK2 Quicklook for attachments https://bugs.webkit.org/show_bug.cgi?id=208891 Reviewed by Darin Adler. Added to HTMLAttachmentElement to have member image representing QuickLook thumbnail. Added code to render this image on both iOS and Mac. No new tests. Test will be added after additions to test infrastructure. * html/HTMLAttachmentElement.cpp: (WebCore::HTMLAttachmentElement::updateThumbnailRepresentation): Allow setting of thumbnail member. * html/HTMLAttachmentElement.h: * rendering/RenderThemeIOS.mm: Added rendering of image member of attachment element. (WebCore::RenderAttachmentInfo::RenderAttachmentInfo): (WebCore::paintAttachmentIcon): (WebCore::RenderThemeIOS::paintAttachment): * rendering/RenderThemeMac.mm: (WebCore::paintAttachmentIcon): 2020-04-20 Yusuke Suzuki <ysuzuki@apple.com> Add more structure-cloning tests for BigInt https://bugs.webkit.org/show_bug.cgi?id=210765 Reviewed by Mark Lam. This patch adds safe-guard for future JSC primitive extension for structure-cloning. We throw DataCloneError if we see unknown primitive value, which can happen if JSC extends primitive value. * bindings/js/SerializedScriptValue.cpp: (WebCore::CloneSerializer::dumpImmediate): (WebCore::CloneSerializer::dumpIfTerminal): 2020-04-20 Simon Fraser <simon.fraser@apple.com> Scrolling with background-attachment: fixed needs to trigger repaints https://bugs.webkit.org/show_bug.cgi?id=193893 <rdar://problem/47587017> Reviewed by Dean Jackson. When scrolling an overflow scroll which has "background-atttachment:fixed" in the content, the node will have non-empty synchronous scrolling reasons. In this case we need to send the scroll to the main thread, and trigger a repaint on scroll. If handling the wheel event on the scrolling thread determines that the scroll must be sent to the main thread, EventDispatcher::wheelEvent() does so in the callback function. To trigger the repaint, RenderLayer::scrollTo() asks the composited layers backing whether the node has synchronous scrolling reasons; this is implemented by asking the scrolling coordinator. Test: scrollingcoordinator/mac/fixed-backgrounds/fixed-background-in-overflow-repaint.html * page/scrolling/AsyncScrollingCoordinator.cpp: (WebCore::AsyncScrollingCoordinator::hasSynchronousScrollingReasons const): * page/scrolling/AsyncScrollingCoordinator.h: * page/scrolling/ScrollingCoordinator.h: (WebCore::ScrollingCoordinator::hasSynchronousScrollingReasons const): * page/scrolling/ScrollingStateScrollingNode.h: (WebCore::ScrollingStateScrollingNode::hasSynchronousScrollingReasons const): * page/scrolling/ScrollingTree.cpp: (WebCore::ScrollingTree::handleWheelEvent): * page/scrolling/ScrollingTreeScrollingNode.h: * page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.mm: (WebCore::ScrollingTreeFrameScrollingNodeMac::currentScrollPositionChanged): * page/scrolling/mac/ScrollingTreeOverflowScrollingNodeMac.mm: (WebCore::ScrollingTreeOverflowScrollingNodeMac::handleWheelEvent): Return SendToMainThread if this node needs to do synchronous scrolling. * rendering/RenderLayer.cpp: (WebCore::RenderLayer::scrollTo): * rendering/RenderLayerBacking.cpp: (WebCore::RenderLayerBacking::needsRepaintOnCompositedScroll const): (WebCore::RenderLayerBacking::setRequiresOwnBackingStore): (WebCore::RenderLayerBacking::setContentsNeedDisplay): * rendering/RenderLayerBacking.h: 2020-04-20 Fujii Hironori <Hironori.Fujii@sony.com> MSVC: LayoutUnits.h(248): warning C4245: 'argument': conversion from 'const int' to 'size_t', signed/unsigned mismatch https://bugs.webkit.org/show_bug.cgi?id=210592 Reviewed by Zalan Bujtas. * layout/LayoutUnits.h: (WTF::HashTraits<WebCore::Layout::SlotPosition>::emptyValue): (WTF::HashTraits<WebCore::Layout::SlotPosition>::constructDeletedValue): (WTF::HashTraits<WebCore::Layout::SlotPosition>::isDeletedValue): Use std::numeric_limits<size_t>::max() for empty and deleted values instead of WebCore::intMinForLayoutUnit. 2020-04-20 Wenson Hsieh <wenson_hsieh@apple.com> Text manipulation sometimes fails to replace text in title elements https://bugs.webkit.org/show_bug.cgi?id=210750 <rdar://problem/61066103> Reviewed by Tim Horton and Darin Adler. Internal clients using WebKit text manipulation APIs currently fail to replace text in title and option elements in the case where text manipulation has been completed with more than one token. These are elements for which we want to replace the entire text as a single token, even if the text manipulation client ends up breaking the token into multiple chunks. To handle this case, pull the `title || option` check out into a helper function, and consult it when completing text manipulation in the case where the manipulation data lacks either start or end positions. If `canPerformTextManipulationByReplacingEntireTextContent` is true and there are multiple replacement tokens, allow ourselves to process the replacement by combining the replacement tokens into a space-separated string. Test: TextManipulation.CompleteTextManipulationShouldReplaceTextContentWithMultipleTokens * editing/TextManipulationController.cpp: (WebCore::canPerformTextManipulationByReplacingEntireTextContent): (WebCore::TextManipulationController::observeParagraphs): (WebCore::TextManipulationController::replace): 2020-04-20 Andres Gonzalez <andresg_22@apple.com> The rect for the primary screen should be retrieved on the main thread. https://bugs.webkit.org/show_bug.cgi?id=210760 Reviewed by Chris Fleizach. - Call to screenRectForPrimaryScreen is dispatched to main thread. - This value is cached since it is very unlikely to change in normal usage and this would avoid hitting the main thread repeatedly. * accessibility/mac/WebAccessibilityObjectWrapperMac.mm: (-[WebAccessibilityObjectWrapper primaryScreenHeight]): 2020-04-15 Sergio Villar Senin <svillar@igalia.com> [WebXR] Update WebXRSession and WebXRSystem interfaces https://bugs.webkit.org/show_bug.cgi?id=210553 Reviewed by Žan Doberšek. Update WebXRSession and WebXRSystem to the latest changes in the specs. * Modules/webxr/WebXRSession.idl: Added 3 new events. * Modules/webxr/WebXRSystem.idl: Interface name is XR not XRSystem. * bindings/js/WebCoreBuiltinNames.h: Renamed macro. * dom/EventNames.h: Added 3 new events. 2020-04-20 Chris Dumez <cdumez@apple.com> Sending beacons when Fetch KeepAlive feature is disabled crashes the WebProcess https://bugs.webkit.org/show_bug.cgi?id=210753 <rdar://problem/61896221> Reviewed by Geoffrey Garen. Test: http/wpt/beacon/beacon-legacy-code-path.html * testing/InternalSettings.cpp: (WebCore::InternalSettings::Backup::Backup): (WebCore::InternalSettings::Backup::restoreTo): (WebCore::InternalSettings::setFetchAPIKeepAliveEnabled): * testing/InternalSettings.h: * testing/InternalSettings.idl: Add internal settings to disable Fetch Keep Alive for layout testing. 2020-04-20 Youenn Fablet <youenn@apple.com> MediaPlayerPrivateMediaStreamAVFObjC should start play a newly added audio track if it is playing https://bugs.webkit.org/show_bug.cgi?id=210740 Reviewed by Eric Carlson. Before the patch, MediaPlayerPrivateMediaStreamAVFObjC was not calling play on the audio renderer when the audio renderer was added after the MediaPlayerPrivateMediaStreamAVFObjC was asked to play. This patch makes it so that, on configuration of an audio track, it will be asked to play if its MediaPlayerPrivateMediaStreamAVFObjC is playing. Add internals API to be able to write a test. Test: fast/mediastream/play-newly-added-audio-track.html * html/track/AudioTrack.h: * html/track/AudioTrack.idl: * platform/graphics/AudioTrackPrivate.h: (WebCore::AudioTrackPrivate::isBackedByMediaStreamTrack const): * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm: (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::updateTracks): * platform/mediastream/AudioTrackPrivateMediaStream.cpp: (WebCore::AudioTrackPrivateMediaStream::play): * platform/mediastream/AudioTrackPrivateMediaStream.h: (isType): * testing/Internals.cpp: (WebCore::Internals::isMockRealtimeMediaSourceCenterEnabled): (WebCore::Internals::shouldAudioTrackPlay): * testing/Internals.h: * testing/Internals.idl: 2020-04-20 Youenn Fablet <youenn@apple.com> Use a WeakHashSet to store MediaStreamPrivate observers https://bugs.webkit.org/show_bug.cgi?id=210494 Reviewed by Eric Carlson. Remove observers from the MediaStream and migrate existing client (MediaRecorder) to MediaStreamPrivate::Observer. Make use of WeakHashSet in MediaStreamPrivate to improve robustness of the code. Any time the MediaStreamPrivate tracks are modified, observers will be notified. MediaStream needs now to decide when to send an event when its MediaStreamPrivate notifies of new/deleted tracks, Modernize a bit the code to use more references. Covered by existing tests. * Modules/mediarecorder/MediaRecorder.cpp: (WebCore::MediaRecorder::MediaRecorder): (WebCore::MediaRecorder::~MediaRecorder): (WebCore::MediaRecorder::handleTrackChange): * Modules/mediarecorder/MediaRecorder.h: * Modules/mediastream/MediaStream.cpp: (WebCore::createTrackPrivateVector): (WebCore::MediaStream::MediaStream): (WebCore::MediaStream::~MediaStream): (WebCore::MediaStream::addTrack): (WebCore::MediaStream::removeTrack): (WebCore::MediaStream::getTrackById): (WebCore::MediaStream::didAddTrack): (WebCore::MediaStream::didRemoveTrack): (WebCore::MediaStream::addTrackFromPlatform): (WebCore::MediaStream::internalAddTrack): (WebCore::MediaStream::internalTakeTrack): * Modules/mediastream/MediaStream.h: * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp: (WebCore::LibWebRTCMediaEndpoint::removeRemoteTrack): * platform/mediastream/MediaStreamPrivate.cpp: (WebCore::MediaStreamPrivate::MediaStreamPrivate): (WebCore::MediaStreamPrivate::addObserver): (WebCore::MediaStreamPrivate::removeObserver): (WebCore::MediaStreamPrivate::forEachObserver): (WebCore::MediaStreamPrivate::computeActiveState): (WebCore::MediaStreamPrivate::updateActiveState): (WebCore::MediaStreamPrivate::addTrack): (WebCore::MediaStreamPrivate::removeTrack): (WebCore::MediaStreamPrivate::trackEnded): * platform/mediastream/MediaStreamPrivate.h: * testing/Internals.cpp: (WebCore::Internals::removeMediaStreamTrack): 2020-04-19 Simon Fraser <simon.fraser@apple.com> Content disappears on CSS parallax example https://bugs.webkit.org/show_bug.cgi?id=210732 <rdar://problem/61997636> Reviewed by Darin Adler. If scrolling affects the computation of coverage rect of a TiledBacking, we plumb that expanded coverage back into TransformState which is maintained during GraphicsLayer flushing, and it's used to compute coverage rect for descendants. It's passed into TransformState::setLastPlanarSecondaryQuad(), which has to map it back into the coordinate system of the last flattening ancestor. However, TransformState::mapQuad() had a missing return and the quad mapping was wrong. The new code is now the same as TransformState::mappedPoint() (you can see where the copy/paste error came from). Test: compositing/tiling/coverage-adjustment-secondary-quad-mapping.html * platform/graphics/transforms/TransformState.cpp: (WebCore::TransformState::mapQuad const): (WebCore::TransformState::flattenWithTransform): 2020-04-20 Zalan Bujtas <zalan@apple.com> [LFC][TFC] Add support for border-collapse: collapse. https://bugs.webkit.org/show_bug.cgi?id=210747 Reviewed by Antti Koivisto. Test: fast/layoutformattingcontext/table-flex-width-border-collapse.html * layout/tableformatting/TableFormattingContext.cpp: (WebCore::Layout::TableFormattingContext::ensureTableGrid): 2020-04-20 Wenson Hsieh <wenson_hsieh@apple.com> Oversized caret and selection rects in text fields on ganji.com and netflix.com/login https://bugs.webkit.org/show_bug.cgi?id=210622 <rdar://problem/45945636> Reviewed by Darin Adler. Currently, selection and caret rects in text fields on some web pages can be excessively tall. This patch makes a small adjustment to allow the top of the caret or selection rect to snap to the top of the inline box instead of being at the end of the previous line, in the case where there is no previous inline box. In the case where we compute the caret rect for an empty renderer (i.e. no children), we make an additional tweak so that the caret rect's height is based on the computed font height instead of line height, and then we ensure that the caret is (logically) vertically centered. See below for more details. Test: editing/selection/selection-and-caret-do-not-extend-to-line-height.html * rendering/RenderBlockFlow.cpp: (WebCore::RenderBlockFlow::positionForPointWithInlineChildren): Specify ForHitTesting::Yes when asking for selectionTop(). * rendering/RenderBoxModelObject.cpp: (WebCore::RenderBoxModelObject::localCaretRectForEmptyElement): Use FontMetric's height when computing the height of the caret rect, and then center it vertically in the renderer. * rendering/RenderReplaced.cpp: (WebCore::RenderReplaced::positionForPoint): Specify ForHitTesting::Yes when asking for selectionTop(). See below for more information. * rendering/RenderTextLineBoxes.cpp: (WebCore::RenderTextLineBoxes::positionForPoint const): * rendering/RootInlineBox.cpp: (WebCore::RootInlineBox::selectionTop const): When computing selectionTop(), we currently fall back to using the top of the containing RenderBlockFlow (`blockFlow().borderAndPaddingBefore()`) in the case where there is no previous root box. However, this can lead to selection and caret rects being taller than expected; instead, we can use the max of the `selectionTop` (that is, the top of the line box, adjusted for annotations) and the top of the RenderBlockFlow. This has the effect of allowing the caret and selection to visually snap to the top of a run of text, provided there is not already a line of text that precedes it. Taking the maximum of the two values ensures that we don't unintentionally make the selection or caret rects even larger, if the line top is above the top of the block. Note that we also avoid shrinking the selection and caret rects when hit-testing renderers for positions and ranges. This allows users to still click and drag to select text in the extra line-height area above a piece of text, even if the selection is only painted over the text (and not in the region containing the line-height). This behavior was established in the fix for webkit.org/b/14911, and is covered by the layout test `editing/selection/inline-closest-leaf-child.html`. * rendering/RootInlineBox.h: 2020-04-20 Darin Adler <darin@apple.com> Use #import instead of #include in Objective-C and don't use #pragma once https://bugs.webkit.org/show_bug.cgi?id=210724 Reviewed by David Kilzer. * page/cocoa/SettingsBaseCocoa.mm: (WebCore::sansSerifTraditionalHanFontFamily): Deleted. (WebCore::sansSerifSimplifiedHanFontFamily): Deleted. (WebCore::SettingsBase::initializeDefaultFontFamilies): Just use font name strings directly since there are no conditionals any more. * Modules/applepay/PaymentRequestValidator.mm: * Modules/applepay/cocoa/PaymentContactCocoa.mm: * accessibility/ios/WebAccessibilityObjectWrapperIOS.h: * accessibility/mac/AXObjectCacheMac.mm: * accessibility/mac/WebAccessibilityObjectWrapperBase.h: * accessibility/mac/WebAccessibilityObjectWrapperMac.h: * bridge/objc/WebScriptObjectPrivate.h: * bridge/objc/objc_class.mm: * bridge/testbindings.mm: * crypto/mac/SerializedCryptoKeyWrapMac.mm: * editing/cocoa/WebArchiveResourceFromNSAttributedString.h: * editing/cocoa/WebArchiveResourceWebResourceHandler.h: * editing/cocoa/WebContentReaderCocoa.mm: * history/mac/HistoryItemMac.mm: * loader/cocoa/DiskCacheMonitorCocoa.mm: * loader/cocoa/SubresourceLoaderCocoa.mm: * loader/mac/ResourceLoaderMac.mm: * page/cocoa/MemoryReleaseCocoa.mm: * page/cocoa/ResourceUsageOverlayCocoa.mm: * page/cocoa/ResourceUsageThreadCocoa.mm: * page/ios/WebEventRegion.h: * page/mac/ChromeMac.mm: * page/mac/EventHandlerMac.mm: * page/mac/WheelEventDeltaFilterMac.mm: * page/scrolling/cocoa/ScrollingStateNode.mm: * page/scrolling/mac/ScrollingCoordinatorMac.mm: * page/scrolling/mac/ScrollingMomentumCalculatorMac.mm: * page/scrolling/mac/ScrollingStateScrollingNodeMac.mm: * page/scrolling/mac/ScrollingThreadMac.mm: * page/scrolling/mac/ScrollingTreeMac.mm: * platform/audio/cocoa/MediaSessionManagerCocoa.mm: * platform/audio/mac/AudioSampleDataSource.mm: * platform/cocoa/DataDetectorsCoreSoftLink.mm: * platform/cocoa/PasteboardCocoa.mm: * platform/cocoa/ScrollSnapAnimatorState.mm: * platform/cocoa/SystemVersion.mm: * platform/gamepad/cocoa/GameControllerGamepad.mm: * platform/graphics/avfoundation/AVTrackPrivateAVFObjCImpl.mm: * platform/graphics/avfoundation/MediaSelectionGroupAVFObjC.mm: * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm: * platform/graphics/avfoundation/objc/MediaSourcePrivateAVFObjC.mm: * platform/graphics/avfoundation/objc/VideoLayerManagerObjC.mm: * platform/graphics/ca/cocoa/PlatformCALayerCocoa.mm: * platform/graphics/ca/cocoa/WebSystemBackdropLayer.h: * platform/graphics/ca/cocoa/WebTiledBackingLayer.h: * platform/graphics/ca/cocoa/WebVideoContainerLayer.h: * platform/graphics/cocoa/GraphicsContextGLOpenGLCocoa.mm: * platform/graphics/cocoa/IOSurfacePoolCocoa.mm: * platform/graphics/cocoa/TextTrackRepresentationCocoa.mm: * platform/graphics/cocoa/WebGLLayer.h: * platform/graphics/cocoa/WebGLLayer.mm: * platform/graphics/cocoa/WebGPULayer.h: * platform/graphics/cocoa/WebGPULayer.mm: * platform/graphics/cv/ImageRotationSessionVT.mm: * platform/graphics/cv/ImageTransferSessionVT.mm: * platform/graphics/cv/TextureCacheCV.mm: * platform/graphics/gpu/cocoa/GPUBufferMetal.mm: * platform/graphics/gpu/cocoa/GPUComputePassEncoderMetal.mm: * platform/graphics/mac/ComplexTextControllerCoreText.mm: * platform/graphics/mac/FloatPointMac.mm: * platform/graphics/mac/FloatSizeMac.mm: * platform/graphics/mac/IntPointMac.mm: * platform/graphics/mac/IntSizeMac.mm: * platform/graphics/mac/WebLayer.h: * platform/graphics/mac/WebLayer.mm: * platform/ios/LegacyTileCache.mm: * platform/ios/LegacyTileGrid.mm: * platform/ios/LegacyTileGridTile.mm: * platform/ios/LegacyTileLayer.h: * platform/ios/LegacyTileLayer.mm: * platform/ios/LegacyTileLayerPool.mm: * platform/ios/LocalCurrentTraitCollection.mm: * platform/ios/LocalizedDeviceModel.mm: * platform/ios/ScrollbarThemeIOS.mm: * platform/ios/WebCoreMotionManager.h: * platform/ios/WebItemProviderPasteboard.mm: * platform/ios/WebVideoFullscreenControllerAVKit.h: * platform/mac/LocalCurrentGraphicsContext.mm: * platform/mac/LocalDefaultSystemAppearance.mm: * platform/mac/LoggingMac.mm: * platform/mac/PlatformEventFactoryMac.mm: * platform/mac/RemoteCommandListenerMac.mm: * platform/mac/ScrollAnimatorMac.mm: * platform/mac/SerializedPlatformDataCueMac.mm: * platform/mac/WebCoreFullScreenPlaceholderView.mm: * platform/mac/WebCoreFullScreenWarningView.h: * platform/mac/WebCoreFullScreenWarningView.mm: * platform/mac/WebCoreFullScreenWindow.h: * platform/mac/WebCoreObjCExtras.mm: * platform/mediarecorder/cocoa/MediaRecorderPrivateWriterCocoa.mm: * platform/mediasession/mac/MediaSessionInterruptionProviderMac.mm: * platform/mediastream/ios/AVAudioSessionCaptureDevice.mm: * platform/mediastream/ios/CoreAudioCaptureSourceIOS.mm: * platform/mediastream/mac/RealtimeIncomingVideoSourceCocoa.mm: * platform/mediastream/mac/RealtimeMediaSourceCenterMac.mm: * platform/mediastream/mac/RealtimeVideoUtilities.mm: * platform/mediastream/mac/ScreenDisplayCaptureSourceMac.mm: * platform/network/cocoa/CertificateInfoCocoa.mm: * platform/network/cocoa/WebCoreNSURLSession.h: * platform/network/mac/BlobDataFileReferenceMac.mm: * platform/network/mac/CredentialStorageMac.mm: * platform/network/mac/SynchronousLoaderClient.mm: * platform/network/mac/WebCoreResourceHandleAsOperationQueueDelegate.h: * platform/text/cocoa/LocaleCocoa.mm: * testing/ServiceWorkerInternals.mm: * testing/cocoa/WebViewVisualIdentificationOverlay.h: More #import, less #pragma once. 2020-04-20 Youenn Fablet <youenn@apple.com> Safari doesn't apply frameRate limit when request stream from Camera https://bugs.webkit.org/show_bug.cgi?id=210186 <rdar://problem/61452794> Reviewed by Eric Carlson. Add support to RealtimeVideoSource to decimate the video samples based on the observed frame rate of its capture source. This allows supporting two tracks using the same capture device, one track being low frame rate and the other one high frame rate. Clean-up refactoring to make RealtimeVideoSource directly inherit from RealtimeVideoCaptureSource. Migrate size and format of frame adaptation from RealtimeVideoCaptureSource to RealtimeVideoSource. Fix mock capture source to update its frame rate when asked by applyConstraints. Tests: fast/mediastream/mediastreamtrack-video-frameRate-clone-decreasing.html fast/mediastream/mediastreamtrack-video-frameRate-clone-increasing.html fast/mediastream/mediastreamtrack-video-frameRate-decreasing.html fast/mediastream/mediastreamtrack-video-frameRate-increasing.html * platform/mediastream/RealtimeVideoCaptureSource.cpp: (WebCore::RealtimeVideoCaptureSource::dispatchMediaSampleToObservers): (WebCore::RealtimeVideoCaptureSource::clientUpdatedSizeAndFrameRate): * platform/mediastream/RealtimeVideoCaptureSource.h: (WebCore::RealtimeVideoCaptureSource::observedFrameRate const): * platform/mediastream/RealtimeVideoSource.cpp: (WebCore::RealtimeVideoSource::RealtimeVideoSource): (WebCore::m_source): (WebCore::RealtimeVideoSource::adaptVideoSample): (WebCore::RealtimeVideoSource::videoSampleAvailable): * platform/mediastream/RealtimeVideoSource.h: * platform/mock/MockRealtimeVideoSource.cpp: (WebCore::MockRealtimeVideoSource::setFrameRateWithPreset): * testing/Internals.cpp: (WebCore::Internals::observeMediaStreamTrack): 2020-04-20 Antoine Quint <graouts@apple.com> WebAnimations API doesn't properly apply keyframe easings to transforms https://bugs.webkit.org/show_bug.cgi?id=210526 <rdar://problem/61800424> Reviewed by Antti Koivisto. GraphicsLayerCA has code that determines whether an animation can be accelerated looking at the timing function of its keyframes and excluding animations that use a steps timing function as one of its values. However, we we would fail to set the timing function on the KeyframeValue for each keyframe in the KeyframeList we create for a JS-originated animation. We now do this correctly. Test: webanimations/transform-animation-with-steps-timing-function-not-accelerated.html * animation/KeyframeEffect.cpp: (WebCore::KeyframeEffect::updateBlendingKeyframes): 2020-04-20 Yusuke Suzuki <ysuzuki@apple.com> StructuredClone algorithm should be aware of BigInt https://bugs.webkit.org/show_bug.cgi?id=210728 Reviewed by Mark Lam. This patch adds structured-cloning for BigInt and BigIntObject. The logic is adding BigIntTag & BigIntObjectTag. And then we put content of BigInt with length. And deserialization reads them to reconstruct BigInt or BigIntObject. * bindings/js/SerializedScriptValue.cpp: (WebCore::CloneSerializer::dumpImmediate): (WebCore::CloneSerializer::dumpBigIntData): (WebCore::CloneSerializer::dumpBigInt32Data): (WebCore::CloneSerializer::dumpHeapBigIntData): (WebCore::CloneSerializer::dumpIfTerminal): (WebCore::CloneDeserializer::readBigInt): (WebCore::CloneDeserializer::readTerminal): 2020-04-20 Carlos Garcia Campos <cgarcia@igalia.com> [GTK][WPE] Enable resource load statistics https://bugs.webkit.org/show_bug.cgi?id=210184 Reviewed by Žan Doberšek. * platform/network/soup/NetworkStorageSessionSoup.cpp: (WebCore::NetworkStorageSession::setCookiesFromDOM const): Return early if cookies are blocked and update the persistent cookies expiration if needed. (WebCore::NetworkStorageSession::deleteCookiesForHostnames): Implement this when receiving IncludeHttpOnlyCookies parameter. (WebCore::NetworkStorageSession::hasCookies const): Implement this. (WebCore::NetworkStorageSession::getRawCookies const): Honor shouldAskITP parameter. (WebCore::cookiesForSession): Ditto. (WebCore::NetworkStorageSession::cookiesForDOM const): Ditto. (WebCore::NetworkStorageSession::cookieRequestHeaderFieldValue const): Ditto. 2020-04-19 Simon Fraser <simon.fraser@apple.com> Use Optional<FloatQuad> in TransformState https://bugs.webkit.org/show_bug.cgi?id=144226 Reviewed by Sam Weinig. Use Optional<> instead of pointers in TransformState, make it loggable, make FloatQuad loggable. * platform/graphics/FloatQuad.cpp: (WebCore::operator<<): * platform/graphics/FloatQuad.h: * platform/graphics/ca/GraphicsLayerCA.cpp: (WebCore::GraphicsLayerCA::flushCompositingState): (WebCore::GraphicsLayerCA::computeVisibleAndCoverageRect const): (WebCore::GraphicsLayerCA::recursiveCommitChanges): * platform/graphics/transforms/TransformState.cpp: (WebCore::TransformState::operator=): (WebCore::TransformState::mappedSecondaryQuad const): (WebCore::TransformState::setLastPlanarSecondaryQuad): (WebCore::TransformState::flattenWithTransform): (WebCore::operator<<): * platform/graphics/transforms/TransformState.h: (WebCore::TransformState::setSecondaryQuad): (WebCore::TransformState::lastPlanarSecondaryQuad const): (WebCore::TransformState::isMappingSecondaryQuad const): (WebCore::TransformState::accumulatedTransform const): 2020-04-19 Rob Buis <rbuis@igalia.com> Remove unneeded code from FrameLoader::loadURL https://bugs.webkit.org/show_bug.cgi?id=210696 Reviewed by Darin Adler. Remove unneeded code from FrameLoader::loadURL, since the only way the load type can be Reload is if loadFrameRequest set it, and the only way loadFrameRequest can set it is if cachePolicy is ReloadIgnoringCacheData, so no need to set it again in FrameLoader::loadURL. * loader/FrameLoader.cpp: (WebCore::FrameLoader::loadURL): 2020-04-19 Brady Eidson <beidson@apple.com> Add WKScriptMessageHandler API that asynchronously responds with a promise. rdar://problem/57243492 and https://bugs.webkit.org/show_bug.cgi?id=206398 Reviewed by Andy Estes. Covered by new API tests. Updated for moving an #include into implementation files: * bindings/js/JSDOMPromiseDeferred.cpp: * bindings/js/JSDOMPromiseDeferred.h: * html/HTMLMediaElement.cpp: * page/DOMWindow.cpp: * workers/service/ServiceWorkerGlobalScope.cpp: * page/UserMessageHandler.cpp: (WebCore::UserMessageHandler::postMessage): Return a promise to be fulfilled by the API client. * page/UserMessageHandler.h: * page/UserMessageHandler.idl: * page/UserMessageHandlerDescriptor.h: 2020-04-19 Zalan Bujtas <zalan@apple.com> [LFC][TFC] Add column spanning support for flexible table width https://bugs.webkit.org/show_bug.cgi?id=210713 Reviewed by Antti Koivisto. Test: fast/layoutformattingcontext/table-flex-width-colspans.html This patch slightly changes the extra space distribution logic by using either the minimum or the maximum width as the base initial width for the columns. * layout/tableformatting/TableFormattingContext.cpp: (WebCore::Layout::TableFormattingContext::layoutInFlowContent): (WebCore::Layout::TableFormattingContext::computeColumnWidths): (WebCore::Layout::TableFormattingContext::computeAndDistributeExtraHorizontalSpace): Deleted. * layout/tableformatting/TableFormattingContext.h: 2020-04-19 Emilio Cobos Álvarez <emilio@crisal.io> Don't use the inherited custom properties to store environment variables. https://bugs.webkit.org/show_bug.cgi?id=210707 Reviewed by Antti Koivisto. It leaks this implementation detail when enumerating the computed style. Tests: imported/w3c/web-platform-tests/css/css-cascade/all-prop-initial-xml.xhtml imported/w3c/web-platform-tests/css/cssom/getComputedStyle-logical-enumeration.html * css/CSSVariableReferenceValue.cpp: (WebCore::resolveVariableReference): (WebCore::resolveTokenRange): * style/StyleResolveForDocument.cpp: (WebCore::Style::resolveForDocument): 2020-04-19 Antti Koivisto <antti@apple.com> [CSS selectors] :is() / :where() should not allow pseudo-elements at parse-time https://bugs.webkit.org/show_bug.cgi?id=210701 Reviewed by Anders Carlsson. https://drafts.csswg.org/selectors/#matches: "Pseudo-elements cannot be represented by the matches-any pseudo-class; they are not valid within :is()." Test: fast/selectors/pseudo-element-in-is-where.html * css/parser/CSSSelectorParser.cpp: (WebCore::CSSSelectorParser::consumePseudo): 2020-04-19 Zalan Bujtas <zalan@apple.com> [LFC][TFC] Take border spacing into account when distributing column spanners width. https://bugs.webkit.org/show_bug.cgi?id=210712 Reviewed by Antti Koivisto. While distributing the column spanner extra space among individual columns, the spacing between these columns (set by border-spacing) should be taken into account and subtract it from the width to distribute. <table style="border-spacing: 50px"><tr><td colspan=2>long long text</td></tr><tr><td>lo</td><td>xt</td><tr></table> [long long text] [lo] [xt] The individual columns don't require any extra space from the spanner. * layout/FormattingContext.h: (WebCore::Layout::FormattingContext::IntrinsicWidthConstraints::operator+=): (WebCore::Layout::FormattingContext::IntrinsicWidthConstraints::operator-=): * layout/tableformatting/TableFormattingContext.cpp: (WebCore::Layout::TableFormattingContext::computedIntrinsicWidthConstraints): (WebCore::Layout::TableFormattingContext::computedPreferredWidthForColumns): (WebCore::Layout::TableFormattingContext::computeAndDistributeExtraHorizontalSpace): * layout/tableformatting/TableGrid.h: (WebCore::Layout::TableGrid::horizontalSpacing const): (WebCore::Layout::TableGrid::totalHorizontalSpacing const): Deleted. 2020-04-19 Emilio Cobos Álvarez <emilio@crisal.io> Fix the logic to decide whether a property is enumerated in a computed style declaration. https://bugs.webkit.org/show_bug.cgi?id=210695 Reviewed by Antti Koivisto. Fix the logic to decide whether a property is enumerated in a computed style declaration. Logical properties don't need stylebuilder code, but still should be generated. Using the specification->category for this seems a bit hacky, but unclear if it's worse than adding a new flag. Tests: fast/css/getComputedStyle/computed-style-enumeration.html imported/w3c/web-platform-tests/css/cssom/getComputedStyle-logical-enumeration.html * css/makeprop.pl: (skippedFromComputedStyle): (isLogical): (sortWithPrefixedPropertiesLast): 2020-04-18 Antti Koivisto <antti@apple.com> [CSS selectors] Support :where() pseudo class https://bugs.webkit.org/show_bug.cgi?id=210690 Reviewed by Sam Weinig. "The Specificity-adjustment pseudo-class, :where(), is a functional pseudo-class with the same syntax and functionality as :is(). Unlike :is(), neither the :where pseudo-class, nor any of its arguments contribute to the specificity of the selector—its specificity is always zero. This is useful for introducing filters in a selector while keeping the associated style declarations easy to override." https://drafts.csswg.org/selectors-4/#zero-matches In terms of implementation this is just another alias for :is() with different (always 0) specificity. Test: fast/selectors/where-specificity.html * css/CSSSelector.cpp: (WebCore::simpleSelectorSpecificityInternal): Here is where it differs from PseudoClassIs. (WebCore::CSSSelector::selectorText const): * css/CSSSelector.h: * css/SelectorChecker.cpp: (WebCore::SelectorChecker::checkOne const): * css/SelectorPseudoClassAndCompatibilityElementMap.in: * css/parser/CSSSelectorParser.cpp: (WebCore::isOnlyPseudoClassFunction): (WebCore::CSSSelectorParser::consumePseudo): * cssjit/SelectorCompiler.cpp: (WebCore::SelectorCompiler::addPseudoClassType): 2020-04-18 Rob Buis <rbuis@igalia.com> Reduce parameter list of the FrameLoadRequest constructor https://bugs.webkit.org/show_bug.cgi?id=210668 Reviewed by Darin Adler. Reduce parameter list of the FrameLoadRequest constructor by instead using various setters. By choosing the most common defaults the actual number of setters to call are minimized. * inspector/InspectorFrontendClientLocal.cpp: (WebCore::InspectorFrontendClientLocal::openInNewTab): * inspector/agents/InspectorPageAgent.cpp: (WebCore::InspectorPageAgent::navigate): * loader/DocumentLoader.cpp: (WebCore::DocumentLoader::handleProvisionalLoadFailureFromContentFilter): * loader/FrameLoadRequest.cpp: (WebCore::FrameLoadRequest::FrameLoadRequest): * loader/FrameLoadRequest.h: (WebCore::FrameLoadRequest::FrameLoadRequest): (WebCore::FrameLoadRequest::disableShouldReplaceDocumentIfJavaScriptURL): * loader/FrameLoader.cpp: (WebCore::FrameLoader::changeLocation): (WebCore::FrameLoader::loadURLIntoChildFrame): * loader/NavigationScheduler.cpp: (WebCore::NavigationScheduler::scheduleLocationChange): * page/ContextMenuController.cpp: (WebCore::openNewWindow): (WebCore::ContextMenuController::contextMenuItemSelected): * page/DOMWindow.cpp: (WebCore::DOMWindow::createWindow): * page/DragController.cpp: (WebCore::DragController::performDragOperation): 2020-04-18 David Kilzer <ddkilzer@apple.com> Attempt #3 to fix tvOS build Unreviewed. * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm: (WebCore::MediaPlayerPrivateAVFoundationObjC::createAVPlayerLayer): (WebCore::MediaPlayerPrivateAVFoundationObjC::updateDisableExternalPlayback): - Use !PLATFORM(APPLETV) to comment out functions declared within ENABLE(VIDEO_PRESENTATION_MODE) from r260307 and r260308. 2020-04-18 Yusuke Suzuki <ysuzuki@apple.com> [WTF] Move DataRef.h from WebCore to WTF to utilize it in JSC https://bugs.webkit.org/show_bug.cgi?id=210689 Reviewed by Anders Carlsson. No behavior change, just moving header from WebCore to WTF. * Headers.cmake: * WebCore.xcodeproj/project.pbxproj: * rendering/style/NinePieceImage.h: * rendering/style/RenderStyle.h: * rendering/style/SVGRenderStyle.h: * rendering/style/StyleRareInheritedData.cpp: * rendering/style/StyleRareInheritedData.h: * rendering/style/StyleRareNonInheritedData.h: 2020-04-18 David Kilzer <ddkilzer@apple.com> Attempt #2 to fix tvOS build Unreviewed. * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm: - Add #if ENABLE(VIDEO_PRESENTATION_MODE)/#endif to protect methods defined in MediaPlayerPrivate.h. - The previous commit was (r260307) also to fix tvOS, not watchOS. 2020-04-18 David Kilzer <ddkilzer@apple.com> Attempt to fix watchOS build Unreviewed. * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h: - Add #if ENABLE(VIDEO_PRESENTATION_MODE)/#endif to protect methods defined in MediaPlayerPrivate.h. 2020-04-17 Simon Fraser <simon.fraser@apple.com> Group overflow controls layers into a single container layer https://bugs.webkit.org/show_bug.cgi?id=210675 Reviewed by Zalan Bujtas. Overflow control layers are going to change z-order in a future change. To make this easier, group the overflow controls layer into their own container layer. * rendering/RenderLayerBacking.cpp: (WebCore::RenderLayerBacking::updateDebugIndicators): (WebCore::RenderLayerBacking::updateGeometry): Size the overflow controls layer using paddingBoxRectIncludingScrollbar(). (WebCore::RenderLayerBacking::updateInternalHierarchy): New parenting. (WebCore::RenderLayerBacking::updateOverflowControlsLayers): Some refactoring with a nice lambda. (WebCore::RenderLayerBacking::positionOverflowControlsLayers): Lovely lambda here. Nice. * rendering/RenderLayerBacking.h: 2020-04-17 Kate Cheney <katherine_cheney@apple.com> Enable service workers for app-bound domains https://bugs.webkit.org/show_bug.cgi?id=210451 <rdar://problem/61479474> Reviewed by Brent Fulgham. SWServer now retrieves the app-bound domains from the UI Process and only continues with the load if the proper entitlement is present or the load is coming from an app-bound domain. * workers/service/server/SWServer.cpp: (WebCore::SWServer::addRegistrationFromStore): (WebCore::SWServer::SWServer): (WebCore::SWServer::validateRegistrationDomain): (WebCore::SWServer::scheduleJob): * workers/service/server/SWServer.h: 2020-04-17 Dean Jackson <dino@apple.com> [WebGL] Confirm there are no errors when setting up framebuffers https://bugs.webkit.org/show_bug.cgi?id=210632 <rdar://problem/61916680> Reviewed by Simon Fraser. We're seeing crashes on macOS inside GraphicsContextGL::reshape(). Specifically when we submit work at the end of the function via glFlush. At the moment the cause is a mystery, because we should bail out before then if the multisample renderbuffer was not complete. In the hope that it helps somewhat, add a call to glGetError to double check that there isn't anything horribly wrong before we talk to the GPU. * html/canvas/WebGL2RenderingContext.cpp: (WebCore::WebGL2RenderingContext::WebGL2RenderingContext): If the underlying GCGL context was marked as "LOST" during initialization, skip the rest of our initialization. * html/canvas/WebGLRenderingContext.cpp: Ditto. (WebCore::WebGLRenderingContext::WebGLRenderingContext): * html/canvas/WebGLRenderingContextBase.cpp: Ditto. (WebCore::WebGLRenderingContextBase::WebGLRenderingContextBase): * platform/graphics/angle/GraphicsContextGLANGLE.cpp: Check for a GL error during setup and, if there is one, skip directly into a LOST state. (WebCore::GraphicsContextGLOpenGL::reshape): * platform/graphics/opengl/GraphicsContextGLOpenGLCommon.cpp: (WebCore::GraphicsContextGLOpenGL::reshape): 2020-04-17 Peng Liu <peng.liu6@apple.com> Cleanup the macros for video fullscreen and picture-in-picture https://bugs.webkit.org/show_bug.cgi?id=210638 Reviewed by Eric Carlson. A follow-up patch to fix build failures of r260259. * platform/ios/VideoFullscreenInterfaceAVKit.h: * platform/ios/VideoFullscreenInterfaceAVKit.mm: * platform/ios/WebVideoFullscreenControllerAVKit.mm: 2020-04-17 David Kilzer <ddkilzer@apple.com> REGRESSION (r234105): [iOS] WKColorButton leaks a UIColor <https://webkit.org/b/210658> <rdar://problem/61938137> Reviewed by Darin Adler. * html/ColorInputType.cpp: (WebCore::ColorInputType::isKeyboardFocusable const): * page/Chrome.cpp: (WebCore::Chrome::createColorChooser): - Drive-by fix of unreachable code on PLATFORM(IOS_FAMILY). 2020-04-17 Don Olmstead <don.olmstead@sony.com> [CMake] Add WebKit::WebCore target https://bugs.webkit.org/show_bug.cgi?id=210445 Reviewed by Michael Catanzaro. Add a WebKit::WebCore target. Remove the WebCoreHeaderInterface target since the WebKit::WebCore target is functionaly the same. * CMakeLists.txt: 2020-04-17 Ryan Haddad <ryanhaddad@apple.com> Unreviewed, reverting r260245. The tests added with this change are frequently failing on macOS bots. Reverted changeset: "Safari doesn't apply frameRate limit when request stream from Camera" https://bugs.webkit.org/show_bug.cgi?id=210186 https://trac.webkit.org/changeset/260245 2020-04-17 Per Arne Vollan <pvollan@apple.com> Unreviewed build fix. * platform/cocoa/AGXCompilerService.cpp: 2020-04-17 Antoine Quint <graouts@apple.com> Stop including style rules related to media controls in the UA style sheet when Modern Media Controls are enabled https://bugs.webkit.org/show_bug.cgi?id=210606 Reviewed by Antti Koivisto and Daniel Bates. There is no need to insert style rules related to media controls in the UA stylesheet when Modern Media Controls are enabled. There is one rule from mediaControlsApple.css for the default sizing of <audio> that makes sense broadly for content on the Web so we move that to html.css. We also set the background-color property for media documents in html.css. * Modules/mediacontrols/mediaControlsApple.css: (audio): Deleted. (body:-webkit-full-page-media): Deleted. * Modules/mediacontrols/mediaControlsiOS.css: (body:-webkit-full-page-media): Deleted. * Modules/modern-media-controls/controls/media-document.css: (:host(.media-document)): * css/html.css: (body:-webkit-full-page-media): (audio): * css/mediaControls.css: (body:-webkit-full-page-media): Deleted. * style/UserAgentStyle.cpp: (WebCore::Style::UserAgentStyle::ensureDefaultStyleSheetsForElement): 2020-04-17 Peng Liu <peng.liu6@apple.com> Cleanup the macros for video fullscreen and picture-in-picture https://bugs.webkit.org/show_bug.cgi?id=210638 Reviewed by Eric Carlson. Replace some "#if PLATFORM(IOS_FAMILY) || (PLATFORM(MAC) && ENABLE(VIDEO_PRESENTATION_MODE))" and all "#if (PLATFORM(IOS_FAMILY) && HAVE(AVKIT)) || (PLATFORM(MAC) && ENABLE(VIDEO_PRESENTATION_MODE))" with "#if ENABLE(VIDEO_PRESENTATION_MODE)". No new tests, no functional change. * html/HTMLMediaElement.cpp: (WebCore::HTMLMediaElement::mediaEngineWasUpdated): (WebCore::HTMLMediaElement::setVideoFullscreenStandby): * html/HTMLMediaElement.h: * html/HTMLVideoElement.cpp: * html/HTMLVideoElement.h: * platform/PictureInPictureSupport.h: * platform/cocoa/VideoFullscreenChangeObserver.h: * platform/cocoa/VideoFullscreenModel.h: * platform/cocoa/VideoFullscreenModelVideoElement.h: * platform/cocoa/VideoFullscreenModelVideoElement.mm: * platform/graphics/MediaPlayer.cpp: * platform/graphics/MediaPlayer.h: * platform/graphics/MediaPlayerPrivate.h: * platform/ios/VideoFullscreenInterfaceAVKit.mm: (WebCore::supportsPictureInPicture): 2020-04-17 Zalan Bujtas <zalan@apple.com> [LFC][TFC] Resolve the minimum width for overlapping spanner columns https://bugs.webkit.org/show_bug.cgi?id=210654 Reviewed by Antti Koivisto. The extra horizontal space distribution is based on the columns' minimum widths. In case of column spanners, first we need to distribute the spanner's minimum width across the columns using the non-spanning minimum widths as the distribution ratio. When there's no non-spanning minimum width for a column (all rows have column spanners for tbis particular column) the minimum width gets distributed equally across the spanned columns. This distribution starts with the shortest columns spans so that we can use these resolved column widths to compute the wider ones. * layout/tableformatting/TableFormattingContext.cpp: (WebCore::Layout::TableFormattingContext::computeAndDistributeExtraHorizontalSpace): 2020-04-17 Claudio Saavedra <csaavedra@igalia.com> [GTK] Update for GdkKeymap API changes https://bugs.webkit.org/show_bug.cgi?id=210642 Reviewed by Adrian Perez de Castro. No new tests needed. gdk_keymap_get_default() is deprecated in GTK+ 3.22, so use gdk_keymap_get_for_display() instead. Since in GTK4 this method is removed to gdk_display_get_keymap(), add a helper to GtkVersioning.h to avoid cluttering with ifdefs all over the place. * platform/gtk/GtkVersioning.h: (gdk_keymap_get_for_display): * platform/gtk/PlatformKeyboardEventGtk.cpp: (WebCore::PlatformKeyboardEvent::currentCapsLockState): (WebCore::PlatformKeyboardEvent::modifiersContainCapsLock): 2020-04-17 Oriol Brufau <obrufau@igalia.com> Revert "[css-grid] Exclude implicit grid tracks from the resolved value" https://bugs.webkit.org/show_bug.cgi?id=210617 Reviewed by Manuel Rego Casasnovas. Revert r254561 since it appears to be breaking site authoring tools which were relying on the previous behaviour. Tests: fast/css-grid-layout/grid-auto-columns-rows-get-set.html fast/css-grid-layout/grid-columns-rows-get-set.html fast/css-grid-layout/grid-template-shorthand-get-set.html fast/css-grid-layout/mark-as-infinitely-growable.html fast/css-grid-layout/named-grid-lines-computed-style-implicit-tracks.html fast/css-grid-layout/negative-growth-share-as-infinity-crash.html imported/w3c/web-platform-tests/css/css-grid/grid-definition/grid-inline-support-flexible-lengths-001.html imported/w3c/web-platform-tests/css/css-grid/grid-definition/grid-inline-support-grid-template-columns-rows-001.html imported/w3c/web-platform-tests/css/css-grid/grid-definition/grid-inline-support-named-grid-lines-001.html imported/w3c/web-platform-tests/css/css-grid/grid-definition/grid-inline-support-repeat-001.html imported/w3c/web-platform-tests/css/css-grid/grid-definition/grid-inline-template-columns-rows-resolved-values-001.html imported/w3c/web-platform-tests/css/css-grid/grid-definition/grid-support-flexible-lengths-001.html imported/w3c/web-platform-tests/css/css-grid/grid-definition/grid-support-grid-template-columns-rows-001.html imported/w3c/web-platform-tests/css/css-grid/grid-definition/grid-support-named-grid-lines-001.html imported/w3c/web-platform-tests/css/css-grid/grid-definition/grid-support-repeat-001.html imported/w3c/web-platform-tests/css/css-grid/grid-definition/grid-template-columns-rows-resolved-values-001.html imported/w3c/web-platform-tests/css/css-grid/grid-layout-properties.html imported/w3c/web-platform-tests/css/css-grid/parsing/grid-template-columns-computed-withcontent.html imported/w3c/web-platform-tests/css/css-grid/parsing/grid-template-rows-computed-withcontent.html * css/CSSComputedStyleDeclaration.cpp: (WebCore::valueForGridTrackList): * rendering/RenderGrid.cpp: (WebCore::RenderGrid::trackSizesForComputedStyle const): 2020-04-17 Per Arne Vollan <pvollan@apple.com> [iOS] Deny iokit open access to graphics related classes https://bugs.webkit.org/show_bug.cgi?id=210616 Reviewed by Darin Adler. Deny iokit open access to graphics related classes in the WebContent process on iOS, but issue extensions for these for some devices which still need access to them. API test: WebKit.IOKitOpenSandboxAccessForDeviceWithAGXCompilerService * WebCore.xcodeproj/project.pbxproj: * platform/cocoa/AGXCompilerService.cpp: Added. (WebCore::setDeviceHasAGXCompilerServiceForTesting): (WebCore::deviceHasAGXCompilerService): * platform/cocoa/AGXCompilerService.h: Added. * testing/Internals.cpp: (WebCore::Internals::hasSandboxIOKitOpenAccessToClass): * testing/Internals.h: * testing/Internals.idl: * testing/Internals.mm: (WebCore::Internals::hasSandboxIOKitOpenAccessToClass): 2020-04-17 Youenn Fablet <youenn@apple.com> Safari doesn't apply frameRate limit when request stream from Camera https://bugs.webkit.org/show_bug.cgi?id=210186 <rdar://problem/61452794> Reviewed by Eric Carlson. Add support to RealtimeVideoSource to decimate the video samples based on the observed frame rate of its capture source. This allows supporting two tracks using the same capture device, one track being low frame rate and the other one high frame rate. Clean-up refactoring to make RealtimeVideoSource directly inherit from RealtimeVideoCaptureSource. Migrate size and format of frame adaptation from RealtimeVideoCaptureSource to RealtimeVideoSource. Fix mock capture source to update its frame rate when asked by applyConstraints. Tests: fast/mediastream/mediastreamtrack-video-frameRate-clone-decreasing.html fast/mediastream/mediastreamtrack-video-frameRate-clone-increasing.html fast/mediastream/mediastreamtrack-video-frameRate-decreasing.html fast/mediastream/mediastreamtrack-video-frameRate-increasing.html * platform/mediastream/RealtimeVideoCaptureSource.cpp: (WebCore::RealtimeVideoCaptureSource::dispatchMediaSampleToObservers): (WebCore::RealtimeVideoCaptureSource::clientUpdatedSizeAndFrameRate): * platform/mediastream/RealtimeVideoCaptureSource.h: (WebCore::RealtimeVideoCaptureSource::observedFrameRate const): * platform/mediastream/RealtimeVideoSource.cpp: (WebCore::RealtimeVideoSource::RealtimeVideoSource): (WebCore::m_source): (WebCore::RealtimeVideoSource::adaptVideoSample): (WebCore::RealtimeVideoSource::videoSampleAvailable): * platform/mediastream/RealtimeVideoSource.h: * platform/mock/MockRealtimeVideoSource.cpp: (WebCore::MockRealtimeVideoSource::setFrameRateWithPreset): * testing/Internals.cpp: (WebCore::Internals::observeMediaStreamTrack): 2020-04-17 Alexey Shvayka <shvaikalesh@gmail.com> MediaQueryList should extend EventTarget https://bugs.webkit.org/show_bug.cgi?id=203288 Reviewed by Darin Adler. Initially, CSSOM View Module specification [1] had a custom callback mechanism with addListener() and removeListener(), and the callback was invoked with the associated MediaQueryList as argument. Now the normal event mechanism [2] is used instead. For backwards compatibility, addListener() and removeListener() methods are basically aliases for addEventListener() and removeEventListener(), respectively, and the "change" event masquerades as a MediaQueryList. This patch implements new event mechanism, aligning WebKit with Blink and SpiderMonkey, and also fixes a few minor spec incompatibilities: mandatory listener argument, "handleEvent" support, and listeners call order. [1]: https://www.w3.org/TR/2011/WD-cssom-view-20110804/#mediaquerylist [2]: https://www.w3.org/TR/cssom-view-1/#mediaquerylist Tests: fast/media/media-query-list-07.html web-platform-tests/css/cssom-view/MediaQueryList-addListener-handleEvent.html web-platform-tests/css/cssom-view/MediaQueryList-addListener-removeListener.html web-platform-tests/css/cssom-view/MediaQueryList-extends-EventTarget.html web-platform-tests/css/cssom-view/MediaQueryList-extends-EventTarget-interop.html web-platform-tests/css/cssom-view/MediaQueryListEvent.html web-platform-tests/css/cssom-view/idlharness.html web-platform-tests/css/cssom-view/matchMedia.html * CMakeLists.txt: * DerivedSources-input.xcfilelist: * DerivedSources-output.xcfilelist: * DerivedSources.make: * Sources.txt: * WebCore.xcodeproj/project.pbxproj: * bindings/js/WebCoreBuiltinNames.h: * bindings/scripts/test/JS/*: Updated. * css/MediaQueryList.cpp: (WebCore::MediaQueryList::MediaQueryList): (WebCore::MediaQueryList::create): (WebCore::MediaQueryList::~MediaQueryList): (WebCore::MediaQueryList::addListener): (WebCore::MediaQueryList::removeListener): * css/MediaQueryList.h: * css/MediaQueryList.idl: * css/MediaQueryListEvent.cpp: Added. (WebCore::MediaQueryListEvent::MediaQueryListEvent): * css/MediaQueryListEvent.h: Added. * css/MediaQueryListEvent.idl: Added. * css/MediaQueryListListener.h: Removed. * css/MediaQueryListListener.idl: Removed. * css/MediaQueryMatcher.cpp: (WebCore::MediaQueryMatcher::documentDestroyed): (WebCore::MediaQueryMatcher::addMediaQueryList): (WebCore::MediaQueryMatcher::removeMediaQueryList): (WebCore::MediaQueryMatcher::matchMedia): (WebCore::MediaQueryMatcher::evaluateAll): (WebCore::MediaQueryMatcher::addListener): Deleted. (WebCore::MediaQueryMatcher::removeListener): Deleted. * css/MediaQueryMatcher.h: * dom/EventNames.in: * dom/EventTarget.h: (WebCore::EventTarget::removeEventListener): * dom/EventTargetFactory.in: 2020-04-17 Adrian Perez de Castro <aperez@igalia.com> Unreviewed build fix after r260123 No new tests needed. * platform/gtk/CursorGtk.cpp: (WebCore::createCustomCursor): Pass missing pixel buffer data pointer to gdk_memory_texture_new(). 2020-04-17 Youenn Fablet <youenn@apple.com> Make use of WeakHashSet for MediaStreamTrackPrivate and RealtimeMediaSource observers https://bugs.webkit.org/show_bug.cgi?id=210492 Reviewed by Geoffrey Garen. We are making use of WeakHashSet to improve the robustness of the code. For that purpose we use the new WeakHashSet::forEach method. No change of behavior. * Modules/mediarecorder/MediaRecorder.h: * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.h: * platform/mediastream/MediaStreamPrivate.cpp: (WebCore::MediaStreamPrivate::forEachObserver const): * platform/mediastream/MediaStreamTrackPrivate.cpp: (WebCore::MediaStreamTrackPrivate::forEachObserver): (WebCore::MediaStreamTrackPrivate::addObserver): (WebCore::MediaStreamTrackPrivate::removeObserver): (WebCore::MediaStreamTrackPrivate::forEachObserver const): Deleted. * platform/mediastream/MediaStreamTrackPrivate.h: (WebCore::MediaStreamTrackPrivate::hasObserver const): Deleted. * platform/mediastream/RealtimeMediaSource.cpp: (WebCore::RealtimeMediaSource::addAudioSampleObserver): (WebCore::RealtimeMediaSource::removeAudioSampleObserver): (WebCore::RealtimeMediaSource::addObserver): (WebCore::RealtimeMediaSource::removeObserver): (WebCore::RealtimeMediaSource::forEachObserver): (WebCore::RealtimeMediaSource::notifyMutedObservers): (WebCore::RealtimeMediaSource::requestToEnd): (WebCore::RealtimeMediaSource::forEachObserver const): Deleted. (WebCore::RealtimeMediaSource::notifyMutedObservers const): Deleted. * platform/mediastream/RealtimeMediaSource.h: * platform/mediastream/RealtimeOutgoingVideoSource.h: 2020-04-17 Rob Buis <rbuis@igalia.com> Move allowPlugins to FrameLoader https://bugs.webkit.org/show_bug.cgi?id=205876 Reviewed by Darin Adler. Move allowPlugins to FrameLoader to reduce pointer dereferences and lessen dependency on SubframeLoader. Also rename to arePluginsEnabled since the method is asking the Setting with the same name. * dom/DOMImplementation.cpp: (WebCore::DOMImplementation::createDocument): * html/HTMLElement.cpp: (WebCore::HTMLElement::rendererIsEverNeeded): * loader/FrameLoader.cpp: (WebCore::FrameLoader::arePluginsEnabled): * loader/FrameLoader.h: * loader/SubframeLoader.cpp: (WebCore::SubframeLoader::createJavaAppletWidget): (WebCore::SubframeLoader::allowPlugins): Deleted. * loader/SubframeLoader.h: * plugins/DOMMimeType.cpp: (WebCore::DOMMimeType::enabledPlugin const): 2020-04-17 Tomoki Imai <Tomoki.Imai@sony.com> Fix an integer overflow in WebCrypto AES-CTR Mac implementation, which may detect a false loop https://bugs.webkit.org/show_bug.cgi?id=210540 (1 << counterLength) causes an integer overflow, and the undefined behavior. The longest valid counterLength on 64 bit machine is 63, and the literal 1 is considered as 32-bit signed integer. Left shifting 1 beyond or to sign-bit is undefined behavior in C++ spec. - https://en.cppreference.com/w/cpp/language/integer_literal - https://en.cppreference.com/w/cpp/language/operator_arithmetic#Bitwise_shift_operators This issue is originally found in https://bugs.webkit.org/show_bug.cgi?id=208186#c2 Reviewed by Jiewen Tan. Test: crypto/subtle/aes-ctr-import-key-encrypt.html * crypto/mac/CryptoAlgorithmAES_CTRMac.cpp: (WebCore::transformAES_CTR): 2020-04-16 Simon Fraser <simon.fraser@apple.com> Scrolling-tree hit-testing is off by top content inset https://bugs.webkit.org/show_bug.cgi?id=210629 <rdar://problem/61848883> Reviewed by Tim Horton. r259936 added a point conversion from the superlayer of the root content layer, to fix RTL, but this also pulled in top content inset, which we don't want. Instead, do the RTL fix by factoring in scroll origin. Test: fast/scrolling/mac/async-scroll-overflow-top-inset.html * page/scrolling/ScrollingTreeScrollingNode.h: * page/scrolling/mac/ScrollingTreeMac.mm: (ScrollingTreeMac::scrollingNodeForPoint): 2020-04-16 Sergio Villar Senin <svillar@igalia.com> Unreviewed build fix for non unified builds. * html/OffscreenCanvas.cpp: Added missing include. * html/canvas/CanvasRenderingContext2DBase.cpp: Ditto. * layout/tableformatting/TableFormattingContextGeometry.cpp: Ditto. * workers/WorkerAnimationController.cpp: (WebCore::WorkerAnimationController::requestAnimationFrame): Added namespace. * workers/WorkerAnimationController.h: Added missing include. 2020-04-16 Simon Fraser <simon.fraser@apple.com> A slow-starting swipe always latches on the root node https://bugs.webkit.org/show_bug.cgi?id=210618 Reviewed by Tim Horton. If the first event in a wheel event gesture had zero delta, scrolling thread logic would always latch on the root node and the rest of the gesture would scroll the document. Fix by not latching for events with zero delta. Test: scrollingcoordinator/mac/latching/zero-delta-began-should-not-latch.html * page/scrolling/ScrollingTreeLatchingController.cpp: (WebCore::ScrollingTreeLatchingController::nodeDidHandleEvent): * page/scrolling/ScrollingTreeScrollingNode.cpp: (WebCore::ScrollingTreeScrollingNode::canScrollWithWheelEvent const): (WebCore::ScrollingTreeScrollingNode::eventCanScrollContents const): (WebCore::ScrollingTreeScrollingNode::scrollLimitReached const): Deleted. * page/scrolling/ScrollingTreeScrollingNode.h: * platform/PlatformWheelEvent.h: (WebCore::PlatformWheelEvent::shouldConsiderLatching const): FIXME comment. Ideally this would check delta() that that's too scarey at the moment. 2020-04-16 Jer Noble <jer.noble@apple.com> Unreviewed build-fix after r260182; guard call to fullscreenManager() for ports which do not ENABLE(FULLSCREEN_API). * html/MediaElementSession.cpp: (WebCore::MediaElementSession::updateMediaUsageIfChanged): 2020-04-16 Claudio Saavedra <csaavedra@igalia.com> [GTK] Deprecation-guards fixes https://bugs.webkit.org/show_bug.cgi?id=210600 Reviewed by Adrian Perez de Castro. No new tests needed. * platform/gtk/RenderThemeGadget.cpp: (WebCore::RenderThemeGadget::backgroundColor const): Add missing deprecation guards for deprecated GtkStyleContext API. * platform/gtk/ThemeGtk.cpp: (WebCore::ThemeGtk::ensurePlatformColors const): Switch to WK deprecation guards from glib ones. 2020-04-16 Jack Lee <shihchieh_lee@apple.com> ASSERTION FAILED: candidate.isCandidate() in WebCore::canonicalizeCandidate https://bugs.webkit.org/show_bug.cgi?id=130844 <rdar://59535009> Reviewed by Geoffrey Garen. Call Position::isCandidate() in PositionIterator::isCandidate so behavior of candidate search become identical in both classes. Test: editing/inserting/insert-in-br.html * dom/PositionIterator.cpp: (WebCore::PositionIterator::isCandidate const): 2020-04-16 Rob Buis <rbuis@igalia.com> Remove outdated comment from FrameLoader https://bugs.webkit.org/show_bug.cgi?id=210607 Reviewed by Darin Adler. Remove comment from FrameLoader that is not valid/important anymore because addExtraFieldsToRequest does not set the Origin header since r259036. * loader/FrameLoader.cpp: (WebCore::FrameLoader::loadDifferentDocumentItem): 2020-04-16 Chris Fleizach <cfleizach@apple.com> AX: Need method for setting selected range from NSRange https://bugs.webkit.org/show_bug.cgi?id=210593 Reviewed by Darin Adler. Allow setSelection to work outside of text controls. Test: accessibility/ios-simulator/non-textcontrol-set-selection.html * accessibility/ios/WebAccessibilityObjectWrapperIOS.mm: (-[WebAccessibilityObjectWrapper _accessibilitySetSelectedTextRange:]): 2020-04-16 Jer Noble <jer.noble@apple.com> [macOS] Update ScreenTime as playback state changes https://bugs.webkit.org/show_bug.cgi?id=210518 <rdar://problem/61181092> Reviewed by Eric Carlson. Follow up to r260182; Pass a WeakPtr into our task queue in sessionWillEndPlayback rather than a bare pointer. * platform/audio/cocoa/MediaSessionManagerCocoa.mm: (WebCore::MediaSessionManagerCocoa::sessionWillEndPlayback): 2020-04-16 Said Abou-Hallawa <sabouhallawa@apple.com> Captured ThreadedScrollingTree should check its m_scrollingCoordinator before calling its methods https://bugs.webkit.org/show_bug.cgi?id=210570 Reviewed by Simon Fraser. m_scrollingCoordinator may be nullified before asynchronously calling its method scheduleUpdateScrollPositionAfterAsyncScroll(). Check if it is not null before calling this method. * page/scrolling/ThreadedScrollingTree.cpp: (WebCore::ThreadedScrollingTree::scrollingTreeNodeDidScroll): 2020-04-16 Zalan Bujtas <zalan@apple.com> Crash in IndefiniteSizeStrategy::recomputeUsedFlexFractionIfNeeded when min-size can not be resolved https://bugs.webkit.org/show_bug.cgi?id=210584 <rdar://problem/56685237> Reviewed by Manuel Rego Casasnovas. Use the initial value of 0 when the min-height can't be resolved. Test: fast/css-grid-layout/crash-when-min-height-cant-be-resolved.html * rendering/GridTrackSizingAlgorithm.cpp: (WebCore::IndefiniteSizeStrategy::recomputeUsedFlexFractionIfNeeded const): 2020-04-16 Adrian Perez de Castro <aperez@igalia.com> Non-unified build fixes mid April 2020 edition https://bugs.webkit.org/show_bug.cgi?id=210599 Unreviewed build fix. No new tests needed. * bindings/js/JSNavigatorCustom.cpp: Add missing JavaScriptCore/JSCJSValue.h header. (WebCore::JSNavigator::getUserMedia): Prefix with the JSC:: namespace where needed. * dom/ShadowRoot.cpp: Add missing WebAnimation.h header. * dom/SimpleRange.cpp: Add missing NodeTraversal.h header. * editing/RemoveNodePreservingChildrenCommand.cpp: Add missing Editing.h header. * page/MemoryRelease.cpp: Add missing JavaScriptCore/VM.h header. * page/PageConfiguration.cpp: Add missing UserContentURLPattern.h header. * page/scrolling/ScrollingTree.h: Add missing EventTrackingRegions.h header. * page/scrolling/ScrollingTreeLatchingController.cpp: Add missing Logging.h header. * page/scrolling/ScrollingTreeLatchingController.h: Add missing ScrollTypes.h header, and forward declaration for WebCore::PlatformWheelEvent. * workers/service/server/SWServerJobQueue.cpp: Add missing Logging.h header. 2020-04-16 Simon Fraser <simon.fraser@apple.com> [Async overflow scrolling] Slow-repaint overflow scroll have force their enclosing scrollers to be slow too https://bugs.webkit.org/show_bug.cgi?id=210591 Reviewed by Antti Koivisto. If an overflow:scroll has background-attachment:fixed in the contents, then both it and all its containing-block scrolling ancestors have to be slow-scrolling too, because scrolling any of them affects the local geometry of the fixed backgrounds which paint on scroll. Implement this by having the scrolling tree do a post-commit pass over the nodes with sync scrolling reasons (which we collect during the commit phase). For each slow-scrolling node, walk its ancestor chain (via proxy nodes when necessary) and mark the scrolling node ancestors with the "DescendantScrollersHaveSynchronousScrolling" reason. For testing, expose internals.scrollingTreeAsText(), which needs a bit of synchronization via waitForScrollingTreeCommit() since the commit happens on the scrolling thread. Tests: scrollingcoordinator/mac/fixed-backgrounds/fixed-background-in-nested-non-cb-overflow.html scrollingcoordinator/mac/fixed-backgrounds/fixed-background-in-nested-overflow.html scrollingcoordinator/mac/fixed-backgrounds/fixed-background-in-nested-overflow2.html * page/scrolling/AsyncScrollingCoordinator.cpp: (WebCore::AsyncScrollingCoordinator::scrollingStateTreeAsText const): (WebCore::AsyncScrollingCoordinator::scrollingTreeAsText const): * page/scrolling/AsyncScrollingCoordinator.h: * page/scrolling/ScrollingCoordinator.cpp: (WebCore::ScrollingCoordinator::scrollingStateTreeAsText const): (WebCore::ScrollingCoordinator::scrollingTreeAsText const): (WebCore::ScrollingCoordinator::synchronousScrollingReasonsAsText): * page/scrolling/ScrollingCoordinator.h: * page/scrolling/ScrollingCoordinatorTypes.h: * page/scrolling/ScrollingTree.cpp: (WebCore::ScrollingTree::commitTreeState): (WebCore::ScrollingTree::updateTreeFromStateNodeRecursive): (WebCore::ScrollingTree::propagateSynchronousScrollingReasons): (WebCore::ScrollingTree::updateTreeFromStateNode): Deleted. * page/scrolling/ScrollingTree.h: (WebCore::ScrollingTree::waitForScrollingTreeCommit): * page/scrolling/ScrollingTreeScrollingNode.cpp: (WebCore::ScrollingTreeScrollingNode::commitStateAfterChildren): * page/scrolling/ScrollingTreeScrollingNode.h: * page/scrolling/ThreadedScrollingTree.cpp: (WebCore::ThreadedScrollingTree::waitForScrollingTreeCommit): * page/scrolling/ThreadedScrollingTree.h: * testing/Internals.cpp: (WebCore::Internals::scrollingTreeAsText const): * testing/Internals.h: * testing/Internals.idl: 2020-04-16 Claudio Saavedra <csaavedra@igalia.com> Clean a couple of unused-parameters warnings https://bugs.webkit.org/show_bug.cgi?id=210596 Unreviewed. No new tests needed. * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp: (WebCore::MediaPlayerPrivateGStreamer::wouldTaintOrigin const): Remove a spurious UNUSED_PARAM() for an actually used parameter. * rendering/RenderBlock.cpp: (WebCore::RenderBlock::updateSecurityDiscCharacters): 2020-04-16 Eric Carlson <eric.carlson@apple.com> [macOS] Update ScreenTime as playback state changes https://bugs.webkit.org/show_bug.cgi?id=210518 <rdar://problem/61181092> Reviewed by Jer Noble. Test: media/media-usage-state.html Pass media element state to the UI process whenever it changes. * Headers.cmake: * WebCore.xcodeproj/project.pbxproj: * html/HTMLMediaElement.cpp: (WebCore::HTMLMediaElement::HTMLMediaElement): (WebCore::HTMLMediaElement::mediaSessionUniqueIdentifier const): * html/HTMLMediaElement.h: * html/MediaElementSession.cpp: (WebCore::MediaElementSession::MediaElementSession): (WebCore::MediaElementSession::~MediaElementSession): (WebCore::MediaElementSession::updateMediaUsageIfChanged): * html/MediaElementSession.h: * page/ChromeClient.h: (WebCore::ChromeClient::addMediaUsageManagerSession): (WebCore::ChromeClient::updateMediaUsageManagerSessionState): (WebCore::ChromeClient::removeMediaUsageManagerSession): * platform/audio/PlatformMediaSession.cpp: (WebCore::PlatformMediaSession::PlatformMediaSession): * platform/audio/PlatformMediaSession.h: (WebCore::PlatformMediaSession::updateMediaUsageIfChanged): (WebCore::PlatformMediaSession::mediaSessionIdentifier const): * platform/audio/PlatformMediaSessionManager.cpp: (WebCore::PlatformMediaSessionManager::updateNowPlayingInfoIfNecessary): * platform/audio/PlatformMediaSessionManager.h: (WebCore::PlatformMediaSessionManager::scheduleUpdateSessionStatus): (WebCore::PlatformMediaSessionManager::sessionDidEndRemoteScrubbing): (WebCore::PlatformMediaSessionManager::scheduleUpdateNowPlayingInfo): Deleted. * platform/audio/cocoa/MediaSessionManagerCocoa.h: * platform/audio/cocoa/MediaSessionManagerCocoa.mm: (WebCore::MediaSessionManagerCocoa::scheduleUpdateSessionStatus): (WebCore::MediaSessionManagerCocoa::sessionWillBeginPlayback): (WebCore::MediaSessionManagerCocoa::sessionDidEndRemoteScrubbing): (WebCore::MediaSessionManagerCocoa::removeSession): (WebCore::MediaSessionManagerCocoa::sessionWillEndPlayback): (WebCore::MediaSessionManagerCocoa::clientCharacteristicsChanged): (WebCore::MediaSessionManagerCocoa::sessionCanProduceAudioChanged): (WebCore::MediaSessionManagerCocoa::scheduleUpdateNowPlayingInfo): Deleted. * platform/audio/ios/MediaSessionManagerIOS.mm: (WebCore::MediaSessionManageriOS::resetRestrictions): (WebCore::MediaSessionManageriOS::sessionWillBeginPlayback): * platform/graphics/MediaUsageInfo.h: Added. (WebCore::MediaUsageInfo::operator== const): (WebCore::MediaUsageInfo::operator!= const): (WebCore::MediaUsageInfo::encode const): (WebCore::MediaUsageInfo::decode): * testing/Internals.cpp: (WebCore::Internals::setMediaElementRestrictions): (WebCore::Internals::mediaUsageState const): * testing/Internals.h: * testing/Internals.idl: 2020-04-16 Yusuke Suzuki <ysuzuki@apple.com> [JSC] Implement JSMapIterator/JSSetIterator with JSInternalFieldObjectImpl https://bugs.webkit.org/show_bug.cgi?id=210023 Reviewed by Keith Miller. * bindings/js/SerializedScriptValue.cpp: (WebCore::CloneSerializer::serialize): 2020-04-16 Philippe Normand <pnormand@igalia.com> Unreviewed, fix GStreamer build warnings. * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp: (WebCore::MediaPlayerPrivateGStreamer::cdmInstanceDetached): * platform/graphics/gstreamer/mse/AppendPipeline.cpp: (WebCore::AppendPipeline::handleErrorConditionFromStreamingThread): 2020-04-16 Carlos Alberto Lopez Perez <clopez@igalia.com> [GTK] MiniBrowser opens new windows too small causing failures on some WPT tests https://bugs.webkit.org/show_bug.cgi?id=210206 Reviewed by Carlos Garcia Campos. Some WPT tests (when executed with the WPT runner via WebDriver) open new browser windows via JavaScript invoking Window.open() and then run the test on this new window. The size of the new window is not specified, and we were failing to provide a default window size, so it was using the minimum of 100x100 which its just too small for some test that later call document.elementFromPoint() on some coordinates that are outside of that size. To fix that provide the size of the default GTK window to WebCore if the application sets one via gtk_window_set_default_size(). And if not, then use the size of the previous window. Also change the way we position the new window to work better when the system uses more than one monitor. Previously to get the default coordinates of the new window we were using gdk_display_get_monitor() with just the first monitor available. This causes issues in the calculation of the available space when using several monitors. Instead get the monitor in use by looking at the current GDK root window. Tests: TestWebKitAPI/WebKit2Gtk/TestUIClient:/webkit/WebKitWebView/open-window-default-size and TestWebKitAPI/WebKit2Gtk/TestUIClient:/webkit/WebKitWebView/open-window-no-default-size * loader/FrameLoader.cpp: (WebCore::createWindow): * platform/gtk/PlatformScreenGtk.cpp: (WebCore::getCurrentScreenMonitor): (WebCore::screenRect): (WebCore::screenAvailableRect): 2020-04-16 Tomoki Imai <Tomoki.Imai@sony.com> TextureMapper renders video element with "object-fit: cover" incorrectly https://bugs.webkit.org/show_bug.cgi?id=210544 Reviewed by Žan Doberšek. Propagate GraphicsLayer::contentsClippingRect information to TextureMapperLayer to properly clip the outside of DOM element when the element has "object-fit: cover". Unfortunately, the test is disabled on WebKitGTK due to bug 177536, bug 163528. Test: compositing/video/video-object-fit.html * platform/graphics/nicosia/NicosiaPlatformLayer.h: (Nicosia::CompositionLayer::flushState): * platform/graphics/texmap/TextureMapperLayer.cpp: (WebCore::TextureMapperLayer::paintSelf): Clip using propagated contentsClippingRect when rendering m_contentsLayer. (WebCore::TextureMapperLayer::setContentsClippingRect): * platform/graphics/texmap/TextureMapperLayer.h: * platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp: (WebCore::CoordinatedGraphicsLayer::setContentsClippingRect): (WebCore::CoordinatedGraphicsLayer::flushCompositingStateForThisLayerOnly): * platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.h: 2020-04-15 Myles C. Maxfield <mmaxfield@apple.com> [Cocoa] Password obscuring dots drawn with the system font are too small https://bugs.webkit.org/show_bug.cgi?id=209692 <rdar://problem/60788385> Reviewed by Darin Adler. The system font's U+2022 BULLET glyph got smaller. Instead, we should match the native platform's behavior of using U+F79A. However, U+F79A is a PUA character, meaning different fonts will draw it in arbitrary different ways. Therefore, we should only use this character if we're drawing it with the system font. Otherwise, we can take the old codepath and use U+2022 BULLET. Tests: fast/text/text-security-disc-bullet-pua.html platform/mac/fast/text/text-security-disc-bullet-pua-mac.html platform/ios/fast/text/text-security-disc-bullet-pua-ios-new.html platform/ios/fast/text/text-security-disc-bullet-pua-ios-old.html * rendering/InlineTextBox.cpp: (WebCore::InlineTextBox::text const): * rendering/RenderBlock.cpp: (WebCore::RenderBlock::constructTextRun): * rendering/SimpleLineLayout.cpp: (WebCore::SimpleLineLayout::canUseForStyle): * rendering/SimpleLineLayoutCoverage.cpp: (WebCore::SimpleLineLayout::printReason): * rendering/SimpleLineLayoutCoverage.h: * rendering/style/RenderStyle.cpp: (WebCore::RenderStyle::computeTextSecurityDiscShouldUsePUACodePoint const): * rendering/style/RenderStyle.h: 2020-04-15 Jer Noble <jer.noble@apple.com> REGRESSION (r260102): ASSERTION FAILED: m_arbitrators.contains(proxy) in WebKit::SharedArbitrator::endRoutingArbitrationForArbitrator https://bugs.webkit.org/show_bug.cgi?id=210589 <rdar://problem/61844208> Reviewed by Eric Carlson. Track whether the session successfully entered routing arbitration and only call leaveRoutingAbritration() if entering was sucessful. * platform/audio/mac/AudioSessionMac.mm: (WebCore::AudioSession::setCategory): 2020-04-15 Simon Fraser <simon.fraser@apple.com> [Async overflow scroll] background-attachment:fixed needs to disable async overflow scrolling https://bugs.webkit.org/show_bug.cgi?id=210581 Reviewed by Zalan Bujtas. Start setting synchronousScrollingReasons on overflow scrolling nodes if the scrolling would move content that has background-attachment:fixed (we can't use async scrolling there, because such content needs painting on each scroll). When style changes, we call FrameView::{add|remove}SlowRepaintObject(). That sets the "needsScrollingTreeUpdate" compositing bit on the enclosing RenderLayer (note, any RenderLayer, not necessarily a scrolling one). Setting that bit will ensure that RenderLayerCompositor does an "update backing and hierarchy" traversal, and during this traversal, if we see a layer with the bit set, scrollingTreeState.needSynchronousScrollingReasonsUpdate becomes true. At the end of the traversal this is used as a signal to call updateSynchronousScrollingNodes(). updateSynchronousScrollingNodes() needs to clear synchronousScrollingReasons on nodes that no longer need to slow-scroll, and set it on those that do. To achieve this we use the set of slow-repaint renders from FrameView, and the set of layers with scrolling nodes from RenderLayerCompositor, starting with the set of all nodes, and pruning those known to be slow. synchronousScrollingReasons are cleared on the remainder. Tests: scrollingcoordinator/mac/fixed-backgrounds/fixed-background-in-overflow-dynamic.html scrollingcoordinator/mac/fixed-backgrounds/fixed-background-in-overflow.html scrollingcoordinator/mac/fixed-backgrounds/fixed-background-on-overflow.html * page/FrameView.cpp: (WebCore::FrameView::addSlowRepaintObject): (WebCore::FrameView::removeSlowRepaintObject): * page/FrameView.h: * page/scrolling/AsyncScrollingCoordinator.cpp: (WebCore::AsyncScrollingCoordinator::setSynchronousScrollingReasons): * rendering/RenderLayerCompositor.cpp: (WebCore::RenderLayerCompositor::updateCompositingLayers): (WebCore::RenderLayerCompositor::updateBackingAndHierarchy): (WebCore::RenderLayerCompositor::updateSynchronousScrollingNodes): * rendering/RenderLayerCompositor.h: 2020-04-15 Andres Gonzalez <andresg_22@apple.com> Add logging to core accessibility. https://bugs.webkit.org/show_bug.cgi?id=210564 Reviewed by Chris Fleizach. Added AXLogger class and AXTRACE macro. Used them in AXIsolatedTree. * Headers.cmake: * Sources.txt: * WebCore.xcodeproj/project.pbxproj: * accessibility/AXLogger.cpp: Added. (WebCore::AXLogger::AXLogger): (WebCore::AXLogger::~AXLogger): * accessibility/AXLogger.h: Added. * accessibility/isolatedtree/AXIsolatedTree.cpp: (WebCore::AXIsolatedTree::AXIsolatedTree): (WebCore::AXIsolatedTree::~AXIsolatedTree): (WebCore::AXIsolatedTree::create): (WebCore::AXIsolatedTree::nodeInTreeForID): (WebCore::AXIsolatedTree::treeForID): (WebCore::AXIsolatedTree::createTreeForPageID): (WebCore::AXIsolatedTree::removeTreeForPageID): (WebCore::AXIsolatedTree::treeForPageID): (WebCore::AXIsolatedTree::nodeForID const): (WebCore::AXIsolatedTree::objectsForIDs const): (WebCore::AXIsolatedTree::generateSubtree): (WebCore::AXIsolatedTree::createSubtree): (WebCore::AXIsolatedTree::updateNode): (WebCore::AXIsolatedTree::updateSubtree): (WebCore::AXIsolatedTree::updateChildren): (WebCore::AXIsolatedTree::focusedUIElement): (WebCore::AXIsolatedTree::rootNode): (WebCore::AXIsolatedTree::setRootNode): (WebCore::AXIsolatedTree::setFocusedNode): (WebCore::AXIsolatedTree::setFocusedNodeID): (WebCore::AXIsolatedTree::removeNode): (WebCore::AXIsolatedTree::removeSubtree): (WebCore::AXIsolatedTree::appendNodeChanges): (WebCore::AXIsolatedTree::applyPendingChanges): * platform/Logging.h: 2020-04-15 Simon Fraser <simon.fraser@apple.com> Lay the groundwork for SynchronousScrollingReason on overflow nodes https://bugs.webkit.org/show_bug.cgi?id=210565 Reviewed by Tim Horton. Make setSynchronousScrollingReasons() public on ScrollingCoordinator because we're going to be calling it for overflow scrolling nodes. Call ScrollingCoordinator::slowRepaintObjectsDidChange() not just when we go between none some some slow-repaint objects, but whenever the set changes. slowRepaintObjectsDidChange() is lightweight. Minor cleanup in FrameView to avoid testing Page* nullness every time. * page/FrameView.cpp: (WebCore::FrameView::prepareForDetach): (WebCore::FrameView::isScrollSnapInProgress const): (WebCore::FrameView::usesAsyncScrolling const): (WebCore::FrameView::addSlowRepaintObject): (WebCore::FrameView::removeSlowRepaintObject): (WebCore::FrameView::addViewportConstrainedObject): (WebCore::FrameView::removeViewportConstrainedObject): (WebCore::FrameView::scrollingCoordinator const): (WebCore::FrameView::shouldUpdateCompositingLayersAfterScrolling const): (WebCore::FrameView::isRubberBandInProgress const): (WebCore::FrameView::requestScrollPositionUpdate): (WebCore::FrameView::layoutOrVisualViewportChanged): (WebCore::FrameView::performPostLayoutTasks): (WebCore::FrameView::scrollableAreaSetChanged): (WebCore::FrameView::wheelEvent): (WebCore::FrameView::setScrollPinningBehavior): * page/FrameView.h: * page/scrolling/ScrollingCoordinator.cpp: (WebCore::ScrollingCoordinator::slowRepaintObjectsDidChange): (WebCore::ScrollingCoordinator::synchronousScrollingReasonsForFrameView const): (WebCore::ScrollingCoordinator::updateSynchronousScrollingReasons): (WebCore::ScrollingCoordinator::shouldUpdateScrollLayerPositionSynchronously const): (WebCore::ScrollingCoordinator::synchronousScrollingReasonsAsText const): (WebCore::ScrollingCoordinator::frameViewHasSlowRepaintObjectsDidChange): Deleted. (WebCore::ScrollingCoordinator::synchronousScrollingReasons const): Deleted. * page/scrolling/ScrollingCoordinator.h: (WebCore::ScrollingCoordinator::setSynchronousScrollingReasons): * rendering/RenderLayerCompositor.cpp: (WebCore::RenderLayerCompositor::updateBacking): 2020-04-15 Jack Lee <shihchieh_lee@apple.com> ASSERTION FAILED: !selectionToDelete.isNone() in TypingCommand::forwardDeleteKeyPressed when deleting a UserSelect::None element. https://bugs.webkit.org/show_bug.cgi?id=210530 <rdar://problem/58591480> Reviewed by Geoffrey Garen. Quit forwardDeleteKeyPressed() if FrameSelection::modify() returns empty selection. Test: editing/deleting/forward-delete-UserSelect-None-element.html * editing/TypingCommand.cpp: (WebCore::TypingCommand::forwardDeleteKeyPressed): 2020-04-15 Peng Liu <peng.liu6@apple.com> Video elements don't return to the correct position when exiting fullscreen https://bugs.webkit.org/show_bug.cgi?id=210529 Reviewed by Jer Noble. Add WEBCORE_EXPORT to the function setNeedsDOMWindowResizeEvent(). * dom/Document.h: 2020-04-15 Wenson Hsieh <wenson_hsieh@apple.com> [iPadOS] Some pages indefinitely zoom in and out due to idempotent text autosizing https://bugs.webkit.org/show_bug.cgi?id=210551 <rdar://problem/56820674> Reviewed by Tim Horton. Rename m_initialScale and initialScale() on Page to m_initialScaleIgnoringContentSize and initialScaleIgnoringContentSize(), respectively. See WebKit/ChangeLog for more details. Test: fast/text-autosizing/ios/idempotentmode/idempotent-autosizing-reaches-stable-state.html * page/Page.cpp: (WebCore::Page::setInitialScaleIgnoringContentSize): (WebCore::Page::setInitialScale): Deleted. * page/Page.h: (WebCore::Page::initialScaleIgnoringContentSize const): (WebCore::Page::initialScale const): Deleted. * style/StyleAdjuster.cpp: (WebCore::Style::Adjuster::adjustmentForTextAutosizing): 2020-04-15 Chris Dumez <cdumez@apple.com> REGRESSION (r258977): Crash under Document::visibilityStateChanged https://bugs.webkit.org/show_bug.cgi?id=210555 Reviewed by Youenn Fablet. Re-introduce null check of page in Document::visibilityStateChanged() which got inadvertently dropped in r258977. * dom/Document.cpp: (WebCore::Document::visibilityStateChanged): 2020-04-15 Zalan Bujtas <zalan@apple.com> REGRESSION( r260114): [ Mac and iOS ] imported/w3c/web-platform-tests/web-animations/timing-model/timelines/document-timelines.html is failing. https://bugs.webkit.org/show_bug.cgi?id=210549 <rdar://problem/61828495> Unreviewed. Partial revert of r260114. See webkit.org/b/210559 for details. * dom/ScriptedAnimationController.cpp: (WebCore::ScriptedAnimationController::serviceRequestAnimationFrameCallbacks): 2020-04-15 Antoine Quint <graouts@apple.com> [Web Animations] Add support for `pseudoElement` on `KeyframeEffect` and `KeyframeEffectOptions` https://bugs.webkit.org/show_bug.cgi?id=207290 <rdar://problem/59199003> Reviewed by Antti Koivisto. We add the required IDL bindings such that JS-originated Web Animations can target pseudo-elements, either via the KeyframeEffect.pseudoElement property, or via the KeyframeEffectOptions.pseudoElement property, which is set on the object passed to the KeyframeEffect constrcutor and Element.animate(). This means that a PseudoElement can be targeted by an animation even if it's not been created through style resolution by virtue of a ::before or ::after selector and a "content" style rule. This means that when either the "target" or "pseudoElement" property of KeyframeEffect is set, we ensure a PseudoElement is created and set on the host element if required. And additionally, we ensure that during style resolution, animations are applied to such pseudo-elements with a new PseudoElement::isTargetedByKeyframeEffectRequiringPseudoElement() method that indicates that a JS-originated KeyframeEffect targets this pseudo-element. * animation/KeyframeEffect.cpp: (WebCore::KeyframeEffect::create): Handle the new KeyframeEffectOptions.pseudoElement property in the KeyframeEffect constructor. (WebCore::KeyframeEffect::targetsPseudoElement const): Indicates whether this effect targets a pseudo-element and not a regular element or a null target. (WebCore::KeyframeEffect::targetElementOrPseudoElement const): Use the new targetsPseudoElement() method to determine whether a pseudo-element is targeted. We also remove an assertion that only made sense when m_pseudoId could only be set via a CSS-originated animation and another one when the only possible m_pseudoId values were PseudoId::Before and PseudoId::After. (WebCore::KeyframeEffect::setTarget): Call the new didChangeTargetElementOrPseudoElement() method if the provided value differs from the stored value for m_target. (WebCore::KeyframeEffect::pseudoElement const): Return the matching normalized string with a `::` prefix for m_pseudoId if the target is a pseudo-element. Note that PseudoElement::pseudoElementNameForEvents() will only return a string for "::before" and "::after" since we only know how to animate these pseudo-elements. (WebCore::KeyframeEffect::setPseudoElement): Determine a matching PseudoId, if any, for the provided string, and call the new didChangeTargetElementOrPseudoElement() method if the provided value differs from the stored value for m_pseudoId. (WebCore::KeyframeEffect::didChangeTargetElementOrPseudoElement): New method called when either m_target or m_pseudoId is changed such that we can ensure the required PseudoElement is created if the animation targets a pseudo-element. Then we run the same logic that we used to in KeyframeEffect::setTarget(). (WebCore::KeyframeEffect::requiresPseudoElement const): Indicates whether a PseudoElement must remain created for this KeyframeEffect, which is only necessary for JS-originated effects targeting a pseudo-element. * animation/KeyframeEffect.h: * animation/KeyframeEffect.idl: * animation/KeyframeEffectOptions.h: * animation/KeyframeEffectOptions.idl: * animation/KeyframeEffectStack.cpp: (WebCore::KeyframeEffectStack::requiresPseudoElement const): Indicates whether one or more JS-originated keyframe effects in the stack target the PseudoElement owning this stack. * animation/KeyframeEffectStack.h: * animation/WebAnimation.cpp: (WebCore::WebAnimation::commitStyles): Use KeyframeEffect::targetsPseudoElement() to determine whether the animation's effect's target is a pseudo-element, in which case we need to throw a NoModificationAllowedError exception. * dom/PseudoElement.cpp: (WebCore::PseudoElement::rendererIsNeeded): Return true also when one or more JS-originated keyframe effects in the stack target this pseudo-element. (WebCore::PseudoElement::isTargetedByKeyframeEffectRequiringPseudoElement): Return true when one or more JS-originated keyframe effects in the stack target this pseudo-element. * dom/PseudoElement.h: * rendering/updating/RenderTreeUpdaterGeneratedContent.cpp: (WebCore::createContentRenderers): Remove the assertion that the "content" property was set since it's valid for this function to now be called due to JS-originated keyframe effects targeting the given pseudo-element. Instead we add an assertion that there are such keyframe effects in case no "content" property was set. (WebCore::RenderTreeUpdater::GeneratedContent::updatePseudoElement): Only remove pseudo-elements if there are no JS-originated keyframe effects targeting the specified pseudo-element. * style/StyleTreeResolver.cpp: (WebCore::Style::TreeResolver::resolvePseudoStyle): Allow animated style resolution for pseudo-elements targeted by JS-originated keyframe effects. 2020-04-15 Carlos Garcia Campos <cgarcia@igalia.com> [GTK4] Fix use of gtk init functions https://bugs.webkit.org/show_bug.cgi?id=210550 Reviewed by Adrian Perez de Castro. Add gtk_init and gtk_init_check receiving parameters to GtkVersioning. * PlatformGTK.cmake: * platform/graphics/PlatformDisplay.cpp: * platform/gtk/GtkVersioning.h: (gtk_init): (gtk_init_check): 2020-04-15 Yusuke Suzuki <ysuzuki@apple.com> import.meta.url: baseURL for a module script should be response URL, not request URL https://bugs.webkit.org/show_bug.cgi?id=205294 Reviewed by Youenn Fablet. The module should expose response URL as `import.meta.url` instead of request URL. If redirection happens, this URL should be redirected one. * bindings/js/ScriptModuleLoader.cpp: (WebCore::ScriptModuleLoader::resolve): (WebCore::ScriptModuleLoader::responseURLFromRequestURL): (WebCore::ScriptModuleLoader::createImportMetaProperties): (WebCore::ScriptModuleLoader::notifyFinished): * bindings/js/ScriptModuleLoader.h: 2020-04-15 Jer Noble <jer.noble@apple.com> isNullFunctionPointer() can fail for symbols not explicitly marked as weakly linked. https://bugs.webkit.org/show_bug.cgi?id=210532 Reviewed by Tim Horton. Symbols whose declarations are explicitly marked as weakly imported are guaranteed to be NULL when the library containing those symbols is not available at runtime, or when the symbol itself isn't present in the version of the library which is available at runtime. For symbols which are not explicitly marked as weakly imported (because, e.g., the framework itself is weakly imported), this technique can fail. Rather than test the nullity of a random static C++ class method with isNullFunctionPointer(), explicitly mark as weak_import a utility method added by the WebKit project, which conveniently is already used from within LibWebRTCProviderCocoa, and test the nullity of that method instead. * platform/mediastream/libwebrtc/LibWebRTCProviderCocoa.cpp: (WebCore::LibWebRTCProvider::webRTCAvailable): 2020-04-15 Claudio Saavedra <csaavedra@igalia.com> [GTK] Make PlatformScreen::screenDPI() GTK4-ready https://bugs.webkit.org/show_bug.cgi?id=210543 Reviewed by Adrian Perez de Castro. No new tests needed. This method is using deprecated and removed APIs from GDK. Guard the removed API usage so that it's only used in GTK3 and update to use the replacement APIs otherwise. Also, make it to also use the gtk-xft-dpi GtkSettings property. This method is mostly used in response to a change in this property, so ignoring its value doesn't seem a good idea. The following priority is used: 1. (GTK3 only) query gdk_screen_get_resolution(). 2. Use the GtkSettings::gtk-xft-dpi property. 3. Calculate the actual DPI from the monitor 0's properties. 4. If none of these succeed, use the default DPI, 96. * platform/gtk/PlatformScreenGtk.cpp: (WebCore::screenDPI): 2020-04-15 Carlos Garcia Campos <cgarcia@igalia.com> [GTK] Remove IconGtk https://bugs.webkit.org/show_bug.cgi?id=210546 Reviewed by Adrian Perez de Castro. It's currently unused in GTK port since we never show an icon for file uploads. * SourcesGTK.txt: * platform/graphics/Icon.cpp: * platform/graphics/Icon.h: * platform/graphics/gtk/IconGtk.cpp: Removed. 2020-04-15 Adrian Perez de Castro <aperez@igalia.com> [GTK4] Provide an alternative to gtk_widget_{get,is}_toplevel() https://bugs.webkit.org/show_bug.cgi?id=210463 Reviewed by Carlos Garcia Campos. Adapt utility functions to GTK4, and provide replacement implementations for the gtk_widget_get_tolevel() and gtk_widget_is_toplevel() functions for GTK4 builds. No new tests needed. * platform/gtk/GtkUtilities.cpp: (WebCore::gtkWindowGetOrigin): Added. (WebCore::convertWidgetPointToScreenPoint): Move code used to find the window position into a separate function, and use it to avoid the USE(GTK4) conditional here. (WebCore::widgetIsOnscreenToplevelWindow): Adapt to make it work with GTK4. * platform/gtk/GtkVersioning.h: Added. (gtk_widget_is_toplevel): Alternative implementation for GTK4. (gtk_widget_get_toplevel): Ditto. (gtk_window_get_position): Ditto. 2020-04-15 Adrian Perez de Castro <aperez@igalia.com> [GTK4] Adapt to cursor API changes https://bugs.webkit.org/show_bug.cgi?id=210453 Reviewed by Carlos Garcia Campos. No new tests needed. * platform/gtk/CursorGtk.cpp: (WebCore::fallbackCursor): Utility function which returns the "default" cursor for GTK4. (WebCore::createNamedCursor): Adapt to the changes in the gdk_cursor_new_from_name(). (WebCore::createCustomCursor): Create a GdkTexture directly when the given Cairo surface is in one of the pixel formats supported by gdk_memory_texture_new(), otherwise convert first; then create a GdkCursor from the GdkTexture. 2020-04-14 Simon Fraser <simon.fraser@apple.com> [Async overflow scroll] Backgrounds missing on gmail sometimes https://bugs.webkit.org/show_bug.cgi?id=210506 <rdar://problem/60523869> Reviewed by Zalan Bujtas. When painting the scrolled contents layers of accelerated overflow:scroll, RenderBlock::paint() needs to not short-circuit when the dirty rect is outside a clipping rect, because accelerated overflow involves overdraw for tiles outside the visible area. There were two code paths that made this mostly work: overflowRectForPaintRejection() tested for usesCompositedScrolling(), and the #if PLATFORM(IOS_FAMILY) made it work on iOS. For content involving flexbox, overflowRectForPaintRejection() gave the wrong answer because flex layout would sometimes clear m_overflow, even on an overflow:scroll element. So remove overflowRectForPaintRejection(), and instead revert to the simple visualOverflowRect(), but first check a bit that's passed down from compositing code that indicates that we're painting the contents of composited scroll Test: compositing/scrolling/async-overflow-scrolling/mac/overflow-in-flex-empty-tiles.html * rendering/PaintPhase.h: * rendering/RenderBlock.cpp: (WebCore::RenderBlock::paint): * rendering/RenderBox.cpp: (WebCore::RenderBox::overflowRectForPaintRejection const): Deleted. * rendering/RenderBox.h: * rendering/RenderLayer.cpp: (WebCore::RenderLayer::paintLayerContents): (WebCore::RenderLayer::paintForegroundForFragments): 2020-04-14 Zalan Bujtas <zalan@apple.com> Content expanding is broken on icourse163.org https://bugs.webkit.org/show_bug.cgi?id=210510 <rdar://problem/45951820> Reviewed by Simon Fraser. www.icourse163.org's animation code expects a decimal point in the rAF timestamp (millisecond resolution). * dom/ScriptedAnimationController.cpp: (WebCore::ScriptedAnimationController::serviceRequestAnimationFrameCallbacks): * page/Quirks.cpp: (WebCore::Quirks::needsMillisecondResolutionForHighResTimeStamp const): * page/Quirks.h: 2020-04-14 Peng Liu <peng.liu6@apple.com> Adopt interface AVAudioRoutingArbiter for Mac https://bugs.webkit.org/show_bug.cgi?id=210167 Reviewed by Eric Carlson. * SourcesCocoa.txt: * WebCore.xcodeproj/project.pbxproj: * platform/audio/ios/AudioSessionIOS.mm: (WebCore::AudioSession::setCategory): (WebCore::categoryName): Deleted. * platform/audio/mac/AudioSessionMac.mm: Renamed from Source/WebCore/platform/audio/mac/AudioSessionMac.cpp. (WebCore::AudioSession::setCategory): (WebCore::AudioSession::categoryOverride const): (WebCore::AudioSession::setCategoryOverride): Fix unified build failures. * platform/mediastream/mac/RealtimeIncomingAudioSourceCocoa.h: 2020-04-14 Youenn Fablet <youenn@apple.com> ReadableStreamDefaultController::enqueue should check for worker terminated exception https://bugs.webkit.org/show_bug.cgi?id=210485 Reviewed by Mark Lam. Make sure to not assert in case of enqueue exception if we are in a terminating worker. This is covered by WPT fetch/api/basic/stream-response.any.worker.html and fetch/api/basic/stream-safe-creation.any.worker.html. * bindings/js/ReadableStreamDefaultController.h: (WebCore::ReadableStreamDefaultController::enqueue): 2020-04-14 Youenn Fablet <youenn@apple.com> Protect MediaStreamTrackPrivate and RealtimeMediaSource when iterating its observers https://bugs.webkit.org/show_bug.cgi?id=210488 Reviewed by Eric Carlson. Making sure explicitly that the track private and source remain alive while looping from its observers. * platform/mediastream/MediaStreamTrackPrivate.cpp: (WebCore::MediaStreamTrackPrivate::forEachObserver const): * platform/mediastream/RealtimeMediaSource.cpp: (WebCore::RealtimeMediaSource::forEachObserver const): 2020-04-14 James Craig <jcraig@apple.com> AX: Smart Invert doesn't handle the picture elements on foxnews.com <https://webkit.org/b/210472> Reviewed by Chris Fleizach. Tests: accessibilty/smart-invert.html accessibilty/smart-invert-reference.html Filled out more variants in the test cases, and removed the unnecessary :not() selector. * css/html.css: (@media (inverted-colors) img, picture, video): (@media (inverted-colors) img:not(picture>img), picture, video): Deleted. 2020-04-14 Wenson Hsieh <wenson_hsieh@apple.com> [iPadOS] Wikipedia articles lay out incorrectly in 1/3 multitasking window https://bugs.webkit.org/show_bug.cgi?id=210501 <rdar://problem/54856323> Reviewed by Tim Horton. In a 1/3 multitasking window, Safari currently uses the `-[WKWebView _allowsViewportShrinkToFit]` SPI to force pages to shrink down by fitting the content width to the view width. This legacy method of shrinking to fit involves laying the page out at the normal view width (320px in 1/3 multitasking), and then scaling the page down such that any amount of horizontal overflow fits within the view. In iOS 13, a new style of shrinking to fit was introduced in support of two new features: page zoom controls (accessible via the page formatting menu), and on-by-default page scaling when loading desktop sites on certain models of iPad where the page width is less than cutoffs of 1112px (in landscape) and 1024px (in portrait). This new method of shrinking to fit involves laying out at a larger width (computed from a combination of the minimum effective device width and layout size scale factor), and scaling to fit the effective layout size scale factor instead of the entire contents of the page. This means that while we may still get horizontal scrolling after shrinking to fit, the overall layout of the page is preserved. Currently, in 1/3 multitasking, Safari still relies on the former to scale pages down to fit, which means that Wikipedia articles (among other websites) do not lay out sensibly. Moreover, even if Safari adopted the second mechanism for shrinking to fit, layout issues would still exist (albeit to a lesser degree), since we'd still attempt to shrink the content width down to fit due to the fact that the desktop version of Wikipedia doesn't have a meta viewport. While we wouldn't get a broken layout, we'd still have a blank column running down the right side of the page, which is less than ideal. It's clear that in this case, attempting to shrink page content down to fit the view is suboptimal (at best, it leads to a large portion of the page being blank; at worst, it completely breaks page layout). To address this bug for now, add a parallel minimumEffectiveDeviceWidth value that takes effect when ignoring scaling constraints (i.e. when we're in a multitasking window), and scale the page down to fit this value instead of fitting the full content width when computing initial scale in `ViewportConfiguration::initialScaleFromSize`. Maintaining this value separately from m_minimumEffectiveDeviceWidth makes it much easier to ensure that the effects of this change are only ever active when the quirk is applied, and also when the view is embedded in a multitasking window. * page/Quirks.cpp: (WebCore::Quirks::shouldLayOutAtMinimumWindowWidthWhenIgnoringScalingConstraints const): Introduce a quirk to fix layout issues in multitasking mode on the desktop version of Wikipedia. * page/Quirks.h: * page/ViewportConfiguration.cpp: (WebCore::ViewportConfiguration::initialScaleFromSize const): (WebCore::ViewportConfiguration::setMinimumEffectiveDeviceWidth): (WebCore::ViewportConfiguration::setMinimumEffectiveDeviceWidthWhenIgnoringScalingConstraints): * page/ViewportConfiguration.h: Add a minimum effective device width value that only takes effect when ignoring scaling constraints, and update `shouldIgnoreMinimumEffectiveDeviceWidth()` and `minimumEffectiveDeviceWidth()` to not always return `true` and `0` (respectively) when ignoring scaling constraints, if m_minimumEffectiveDeviceWidthWhenIgnoringScalingConstraints is set. (WebCore::ViewportConfiguration::minimumEffectiveDeviceWidth const): (WebCore::ViewportConfiguration::shouldIgnoreMinimumEffectiveDeviceWidth const): (WebCore::ViewportConfiguration::shouldShrinkToFitMinimumEffectiveDeviceWidthWhenIgnoringScalingConstraints const): 2020-04-14 Antoine Quint <graouts@apple.com> Factor PseudoElement creation calls into a single Element::ensurePseudoElement(pseudoId) method https://bugs.webkit.org/show_bug.cgi?id=210495 Reviewed by Antti Koivisto. To support webkit.org/b/207290 we need a way to ensure a PseudoElement is available for ::before and ::after pseudo-elements on a given Element. We now use a Element::ensurePseudoElement(pseudoId) method to do this and replace existing places where we would do something similar. * dom/Element.cpp: (WebCore::Element::ensurePseudoElement): * dom/Element.h: * rendering/updating/RenderTreeUpdaterGeneratedContent.cpp: (WebCore::RenderTreeUpdater::GeneratedContent::updatePseudoElement): * style/StyleTreeResolver.cpp: (WebCore::Style::TreeResolver::resolvePseudoStyle): 2020-04-14 Simon Fraser <simon.fraser@apple.com> Scroll snap in subframes is often broken https://bugs.webkit.org/show_bug.cgi?id=210503 Reviewed by Darin Adler. RenderBox::findEnclosingScrollableContainer() incorrectly consulted the scrollability of the main frame, causing snapping in subframes to be broken any time the main frame was not scrollable. Test: tiled-drawing/scrolling/scroll-snap/scroll-snap-async-iframe.html * rendering/RenderBox.cpp: (WebCore::RenderBox::findEnclosingScrollableContainer const): 2020-04-14 Andres Gonzalez <andresg_22@apple.com> Make WTR::AccessibilityUIElements calls to accessibilitySetValue run on AX secondary thread. web content https://bugs.webkit.org/show_bug.cgi?id=210500 Reviewed by Chris Fleizach. Removed _accessibilitySetTestValue since it is no longer used, use _accessibilitySetValue instead. * accessibility/mac/WebAccessibilityObjectWrapperMac.mm: (-[WebAccessibilityObjectWrapper _accessibilitySetTestValue:forAttribute:]): Deleted. 2020-04-14 David Kilzer <ddkilzer@apple.com> Add WARN_UNUSED_RETURN to decode methods in Source/WebCore <https://webkit.org/b/210416> <rdar://problem/61693462> Reviewed by Alex Christensen. * Modules/geolocation/GeolocationPositionData.h: * Modules/indexeddb/IDBGetAllResult.h: * Modules/indexeddb/IDBGetResult.h: * Modules/indexeddb/IDBKeyData.h: * Modules/indexeddb/IDBKeyRangeData.h: * Modules/indexeddb/server/IDBSerialization.cpp: (WebCore::decodeKey): * Modules/indexeddb/shared/IDBCursorInfo.h: * Modules/indexeddb/shared/IDBCursorRecord.h: * Modules/indexeddb/shared/IDBDatabaseInfo.h: * Modules/indexeddb/shared/IDBError.h: * Modules/indexeddb/shared/IDBGetAllRecordsData.h: * Modules/indexeddb/shared/IDBGetRecordData.h: * Modules/indexeddb/shared/IDBIndexInfo.h: * Modules/indexeddb/shared/IDBIterateCursorData.h: * Modules/indexeddb/shared/IDBObjectStoreInfo.h: * Modules/indexeddb/shared/IDBRequestData.h: * Modules/indexeddb/shared/IDBResourceIdentifier.h: * Modules/indexeddb/shared/IDBTransactionInfo.h: * Modules/mediasource/SourceBuffer.cpp: (WebCore::decodeTimeComparator): * dom/EventInit.h: * dom/ExceptionData.h: * dom/SecurityPolicyViolationEvent.h: * editing/FontAttributeChanges.h: * editing/FontShadow.h: * loader/CanvasActivityRecord.h: * loader/FetchOptions.h: (WebCore::FetchOptions::decodePersistent): * platform/ContentFilterUnblockHandler.h: * platform/DragItem.h: * platform/KeyedCoding.h: * platform/LinkIcon.h: * platform/ThreadSafeDataBuffer.h: * platform/audio/mac/CAAudioStreamDescription.h: * platform/cf/KeyedDecoderCF.h: * platform/generic/KeyedDecoderGeneric.h: * platform/glib/KeyedDecoderGlib.h: * platform/graphics/Region.h: * platform/graphics/RemoteVideoSample.h: (WebCore::RemoteVideoSample::decode): * platform/mediastream/MediaConstraints.h: (WebCore::MediaConstraint::decode): (WebCore::NumericConstraint::decode): (WebCore::StringConstraint::decode): * platform/mediastream/RealtimeMediaSourceCapabilities.h: * platform/mediastream/RealtimeMediaSourceSettings.h: * platform/mediastream/RealtimeMediaSourceSupportedConstraints.h: * platform/network/HTTPHeaderMap.h: * platform/network/NetworkLoadMetrics.h: * platform/network/ResourceRequestBase.h: * platform/network/ResourceResponseBase.h: (WebCore::ResourceResponseBase::decode): * platform/network/SameSiteInfo.h: * platform/network/SocketStreamError.h: * platform/network/curl/ResourceRequest.h: * platform/network/soup/ResourceRequest.h: * platform/network/soup/ResourceResponse.h: * rendering/EventRegion.h: * workers/service/ServiceWorkerFetchResult.h: - Add WARN_UNUSED_RETURN to all decode functions. 2020-04-14 Antoine Quint <graouts@apple.com> [Web Animations] Store an Element / PseudoId pair to define the KeyframeEffect target https://bugs.webkit.org/show_bug.cgi?id=210491 Reviewed by Antti Koivisto. In preparation for webkit.org/b/207290 where we will expose the `pseudoElement` JS API on KeyframeEffect we now use an Element / PseudoId (m_target / m_pseudoId) pair to specify an effect's target. In the cases where it matters, such as accessing the various animation collections exposed through Element and the KeyframeEffectStack, we now use the new KeyframeEffect::targetElementOrPseudoElement() method to access the Element or PseudoElement targeted with the Element / PseudoId pair. * animation/AnimationTimeline.cpp: (WebCore::AnimationTimeline::removeAnimation): * animation/DeclarativeAnimation.cpp: (WebCore::DeclarativeAnimation::initialize): * animation/DocumentTimeline.cpp: (WebCore::DocumentTimeline::transitionDidComplete): (WebCore::DocumentTimeline::animationAcceleratedRunningStateDidChange): * animation/KeyframeEffect.cpp: (WebCore::KeyframeEffect::create): (WebCore::KeyframeEffect::KeyframeEffect): (WebCore::KeyframeEffect::copyPropertiesFromSource): (WebCore::KeyframeEffect::getKeyframes): (WebCore::KeyframeEffect::forceLayoutIfNeeded): (WebCore::KeyframeEffect::computeCSSAnimationBlendingKeyframes): (WebCore::KeyframeEffect::computeCSSTransitionBlendingKeyframes): (WebCore::KeyframeEffect::animationTimelineDidChange): (WebCore::KeyframeEffect::updateEffectStackMembership): (WebCore::KeyframeEffect::targetElementOrPseudoElement const): (WebCore::KeyframeEffect::setTarget): (WebCore::KeyframeEffect::apply): (WebCore::KeyframeEffect::invalidate): (WebCore::KeyframeEffect::getAnimatedStyle): (WebCore::KeyframeEffect::applyPendingAcceleratedActions): (WebCore::KeyframeEffect::document const): (WebCore::KeyframeEffect::renderer const): * animation/KeyframeEffect.h: * animation/KeyframeEffectStack.cpp: (WebCore::KeyframeEffectStack::addEffect): * animation/WebAnimation.cpp: (WebCore::WebAnimation::setEffectInternal): (WebCore::WebAnimation::setTimeline): (WebCore::WebAnimation::persist): * dom/Document.cpp: (WebCore::Document::matchingAnimations): * inspector/agents/InspectorAnimationAgent.cpp: (WebCore::buildObjectForKeyframes): (WebCore::InspectorAnimationAgent::requestEffectTarget): 2020-04-14 Simon Fraser <simon.fraser@apple.com> [Async overflow scroll] Custom scrollbars on gmail don't show https://bugs.webkit.org/show_bug.cgi?id=210438 <rdar://problem/61722541> Reviewed by Tim Horton. Custom scrollbars painted into the backing store of the scrolling element, but that might have become an empty "simple container layer" causing the scroll bars to not be painted anywhere. Fix by making compositing layers for custom scrollbars. This is better than giving backing store to the scroller's element, because that might be huge. Test: scrollbars/async-overflow-custom-scrollbar.html * rendering/RenderLayerBacking.cpp: (WebCore::RenderLayerBacking::requiresLayerForScrollbar const): (WebCore::RenderLayerBacking::requiresHorizontalScrollbarLayer const): (WebCore::RenderLayerBacking::requiresVerticalScrollbarLayer const): (WebCore::RenderLayerBacking::requiresScrollCornerLayer const): * rendering/RenderLayerBacking.h: 2020-04-14 Claudio Saavedra <csaavedra@igalia.com> [GTK] Adapt to GdkVisual deprecation and removal https://bugs.webkit.org/show_bug.cgi?id=210489 Reviewed by Adrian Perez de Castro. No new tests needed. Update the GdkVisual used to get the screen depth per component in GTK3 and use default values for GTK4, as visuals as an abstraction are gone from GTK4. The use in WK is very limited so there's no much gain from peeking into backend-specific values. * platform/gtk/PlatformScreenGtk.cpp: (WebCore::screenDepth): Guard GdkVisual call and leave default value for GTK4. (WebCore::screenDepthPerComponent): Update API and ditto. 2020-04-14 Carlos Garcia Campos <cgarcia@igalia.com> [GTK][WPE] Scrollbar handle has no minimum size https://bugs.webkit.org/show_bug.cgi?id=209962 Reviewed by Adrian Perez de Castro. Set a minimum thumb length. * platform/adwaita/ScrollbarThemeAdwaita.cpp: (WebCore::ScrollbarThemeAdwaita::minimumThumbLength): 2020-04-14 Carlos Garcia Campos <cgarcia@igalia.com> [GTK] New scrollbar click behavior https://bugs.webkit.org/show_bug.cgi?id=210002 Reviewed by Adrian Perez de Castro. Use the same bahavior for mouse events when not rendering native scrollbars. * platform/gtk/ScrollbarThemeGtk.cpp: (WebCore::ScrollbarThemeGtk::handleMousePressEvent): 2020-04-14 Antti Koivisto <antti@apple.com> [CSS Selectors] Selectors Level 4 specificity calculation for pseudo classes https://bugs.webkit.org/show_bug.cgi?id=210419 Reviewed by Simon Fraser. CSS selector specification drafts at some point had a concept of "dynamic specificity" where the specificity of a selector depended on the element it matched. It was only ever used with :matches and :nth-child pseudo classes and has subsequently been removed. Selector specificity can now always be computed statically. There is a ton of code to support this obsolete feature. Remove it. https://drafts.csswg.org/selectors-4/#specificity-rules "The specificity of an :is(), :not(), or :has() pseudo-class is replaced by the specificity of the most specific complex selector in its selector list argument. Analogously, the specificity of an :nth-child() or :nth-last-child() selector is the specificity of the pseudo class itself (counting as one pseudo-class selector) plus the specificity of the most specific complex selector in its selector list argument (if any)." * css/html.css: Reorganize a :matches rule into a selector list to keep the exact specificites. It matters here to select between listbox and menulist correctly based on the 'size' and 'multiple' attributes. * css/CSSSelector.cpp: (WebCore::selectorSpecificity): (WebCore::maxSpecificity): (WebCore::simpleSelectorSpecificityInternal): (WebCore::CSSSelector::simpleSelectorSpecificity const): Also handle nth here. (WebCore::CSSSelector::specificity const): (WebCore::simpleSelectorFunctionalPseudoClassStaticSpecificity): Deleted. (WebCore::functionalPseudoClassStaticSpecificity): Deleted. (WebCore::staticSpecificityInternal): Deleted. (WebCore::CSSSelector::staticSpecificity const): Deleted. Rename to just computeSpecificity(), there is no other kind than static. * css/CSSSelector.h: * css/SelectorChecker.cpp: (WebCore::SelectorChecker::match const): (WebCore::SelectorChecker::matchHostPseudoClass const): (WebCore::SelectorChecker::matchRecursively const): (WebCore::SelectorChecker::checkOne const): (WebCore::SelectorChecker::matchSelectorList const): SelectorChecker doesn't need to deal with specificity anymore. * css/SelectorChecker.h: * cssjit/SelectorCompiler.cpp: (WebCore::SelectorCompiler::addNthChildType): (WebCore::SelectorCompiler::addPseudoClassType): (WebCore::SelectorCompiler::constructFragmentsInternal): (WebCore::SelectorCompiler::SelectorCodeGenerator::generateSelectorChecker): (WebCore::SelectorCompiler::SelectorCodeGenerator::generateElementAttributeFunctionCallValueMatching): Neither does SelectorCompiler. * cssjit/SelectorCompiler.h: * dom/SelectorQuery.cpp: (WebCore::SelectorDataList::selectorMatches const): (WebCore::SelectorDataList::selectorClosest const): * inspector/InspectorStyleSheet.cpp: (WebCore::buildObjectForSelectorHelper): (WebCore::selectorsFromSource): (WebCore::InspectorStyleSheet::buildObjectForSelector): (WebCore::InspectorStyleSheet::buildObjectForSelectorList): (WebCore::InspectorStyleSheet::buildObjectForRule): (WebCore::InspectorStyleSheet::buildArrayForRuleList): (WebCore::hasDynamicSpecificity): Deleted. * inspector/InspectorStyleSheet.h: * inspector/agents/InspectorCSSAgent.cpp: (WebCore::InspectorCSSAgent::setRuleSelector): (WebCore::InspectorCSSAgent::addRule): (WebCore::InspectorCSSAgent::buildObjectForRule): (WebCore::InspectorCSSAgent::buildArrayForMatchedRuleList): * inspector/agents/InspectorDOMAgent.cpp: (WebCore::InspectorDOMAgent::highlightSelector): * style/ElementRuleCollector.cpp: (WebCore::Style::ElementRuleCollector::ruleMatches): Switch to get the specificity from the selector instead of computing it during selector checking. * style/ElementRuleCollector.h: 2020-04-14 Carlos Garcia Campos <cgarcia@igalia.com> [GLIB] Fix race condition in FileMonitor implementation https://bugs.webkit.org/show_bug.cgi?id=210483 Reviewed by Adrian Perez de Castro. This is causing flaky timeouts when running resource load statistics layout tests. The problem is that we assume FileMonitor has the last reference of the platform monitor and it's deleted on g_object_unref(), but GLib keeps another reference that is released later on a different thread if the monitor is still active. We just need to ensure we cancel the monitor before calling g_object_unref(). * platform/FileMonitor.h: * platform/glib/FileMonitorGLib.cpp: (WebCore::FileMonitor::~FileMonitor): (WebCore::FileMonitor::didChange): (WebCore::FileMonitor::cancel): 2020-04-14 Charlie Turner <cturner@igalia.com> [EME][CDMProxy] Fix waitingForKey logic https://bugs.webkit.org/show_bug.cgi?id=210437 Reviewed by Xabier Rodriguez-Calvar. startedWaitingForKey() was incorrectly flagged. It needs to signal on the 0->1 transition, here it was only signalling on N->N+1 where N>0. Also break ASSERTs into separate statements, it makes it easier in a crash dump to see which conjuct fired. Test: imported/w3c/web-platform-tests/encrypted-media/clearkey-mp4-waiting-for-a-key.https.html * platform/encryptedmedia/CDMProxy.cpp: (WebCore::CDMInstanceProxy::startedWaitingForKey): (WebCore::CDMInstanceProxy::stoppedWaitingForKey): 2020-04-14 Carlos Garcia Campos <cgarcia@igalia.com> [GTK] Bring back support for rendering scrollbars using the system appearance https://bugs.webkit.org/show_bug.cgi?id=209805 Reviewed by Michael Catanzaro. Bring back ScrollbarThemeGtk, RenderThemeGadget and RenderThemeWidget (renamed as RenderThemeScrollbar), including only the code needed to render the scrollbars. ScrollbarThemeGtk inherits from ScrollbarThemeAdwaita that is used when system appearance is disabled. * PlatformGTK.cmake: * SourcesGTK.txt: * platform/adwaita/ScrollbarThemeAdwaita.cpp: * platform/adwaita/ScrollbarThemeAdwaita.h: * platform/gtk/RenderThemeGadget.cpp: Added. (WebCore::RenderThemeGadget::create): (WebCore::createStyleContext): (WebCore::appendElementToPath): (WebCore::RenderThemeGadget::RenderThemeGadget): (WebCore::RenderThemeGadget::marginBox const): (WebCore::RenderThemeGadget::borderBox const): (WebCore::RenderThemeGadget::paddingBox const): (WebCore::RenderThemeGadget::contentsBox const): (WebCore::RenderThemeGadget::color const): (WebCore::RenderThemeGadget::backgroundColor const): (WebCore::RenderThemeGadget::opacity const): (WebCore::RenderThemeGadget::state const): (WebCore::RenderThemeGadget::setState): (WebCore::RenderThemeGadget::minimumSize const): (WebCore::RenderThemeGadget::preferredSize const): (WebCore::RenderThemeGadget::render): (WebCore::RenderThemeBoxGadget::RenderThemeBoxGadget): (WebCore::RenderThemeBoxGadget::preferredSize const): (WebCore::RenderThemeScrollbarGadget::RenderThemeScrollbarGadget): (WebCore::RenderThemeScrollbarGadget::renderStepper): * platform/gtk/RenderThemeGadget.h: Added. (WebCore::RenderThemeGadget::context const): * platform/gtk/RenderThemeScrollbar.cpp: Added. (WebCore::widgetMap): (WebCore::RenderThemeScrollbar::getOrCreate): (WebCore::RenderThemeScrollbar::clearCache): (WebCore::RenderThemeScrollbar::RenderThemeScrollbar): (WebCore::RenderThemeScrollbar::stepper): * platform/gtk/RenderThemeScrollbar.h: Added. (WebCore::RenderThemeScrollbar::scrollbar const): (WebCore::RenderThemeScrollbar::contents const): (WebCore::RenderThemeScrollbar::slider const): (WebCore::RenderThemeScrollbar::trough const): * platform/gtk/ScrollbarThemeGtk.cpp: Added. (WebCore::ScrollbarTheme::nativeTheme): (WebCore::themeChangedCallback): (WebCore::ScrollbarThemeGtk::ScrollbarThemeGtk): (WebCore::ScrollbarThemeGtk::setUseSystemAppearance): (WebCore::ScrollbarThemeGtk::themeChanged): (WebCore::ScrollbarThemeGtk::updateThemeProperties): (WebCore::ScrollbarThemeGtk::hasButtons): (WebCore::scrollbarPartStateFlags): (WebCore::widgetTypeForScrollbar): (WebCore::contentsRectangle): (WebCore::ScrollbarThemeGtk::trackRect): (WebCore::ScrollbarThemeGtk::backButtonRect): (WebCore::ScrollbarThemeGtk::forwardButtonRect): (WebCore::ScrollbarThemeGtk::paint): (WebCore::ScrollbarThemeGtk::handleMousePressEvent): (WebCore::ScrollbarThemeGtk::scrollbarThickness): (WebCore::ScrollbarThemeGtk::minimumThumbLength): * platform/gtk/ScrollbarThemeGtk.h: Added. 2020-04-14 Youenn Fablet <youenn@apple.com> Add a timer to AVVideoCaptureSource to verify reception of frames https://bugs.webkit.org/show_bug.cgi?id=210335 Reviewed by Eric Carlson. Count the number of frames being captured. Add a timer repeating every 3 seconds. Timer starts/stops based on whether the session is running/is interrupted. If the number of frames did not increase, fail the source. Manually tested. * platform/mediastream/RealtimeMediaSource.cpp: (WebCore::RealtimeMediaSource::captureFailed): Explicitly call stop() instead of just setting m_isProducingData. This ensures we release all resources and that we may not restart capturing after captureFailed(). * platform/mediastream/mac/AVVideoCaptureSource.h: * platform/mediastream/mac/AVVideoCaptureSource.mm: (WebCore::AVVideoCaptureSource::AVVideoCaptureSource): (WebCore::AVVideoCaptureSource::verifyIsCapturing): (WebCore::AVVideoCaptureSource::updateVerifyCapturingTimer): (WebCore::AVVideoCaptureSource::captureOutputDidOutputSampleBufferFromConnection): (WebCore::AVVideoCaptureSource::captureSessionIsRunningDidChange): 2020-04-14 Commit Queue <commit-queue@webkit.org> Unreviewed, reverting r260024. https://bugs.webkit.org/show_bug.cgi?id=210480 Regressed performance due to loss of specificity caching (Requested by anttik on #webkit). Reverted changeset: "[CSS Selectors] Selectors Level 4 specificity calculation for pseudo classes" https://bugs.webkit.org/show_bug.cgi?id=210419 https://trac.webkit.org/changeset/260024 2020-04-13 Commit Queue <commit-queue@webkit.org> Unreviewed, reverting r260052. https://bugs.webkit.org/show_bug.cgi?id=210479 Breaks iOS tests, needs more work (Requested by smfr on #webkit). Reverted changeset: "Add ENABLE_CUSTOM_SCROLLBARS and define it for macOS and for non-Cocoa platforms" https://bugs.webkit.org/show_bug.cgi?id=210460 https://trac.webkit.org/changeset/260052 2020-04-13 Adrian Perez de Castro <aperez@igalia.com> [GTK4] Use ThemeAdwaita instead of ThemeGtk https://bugs.webkit.org/show_bug.cgi?id=210334 Reviewed by Carlos Garcia Campos. No new tests needed. * platform/adwaita/ThemeAdwaita.cpp: Build the Theme::singleton() factory also with USE(GTK4). * platform/gtk/ThemeGtk.cpp: Conditionally build if !USE(GTK4). (WebCore::ThemeGtk::ensurePlatformColors const): Add deprecation ignore guards. * platform/gtk/ThemeGtk.h: Conditionally build if !USE(GTK4). 2020-04-13 Simon Fraser <simon.fraser@apple.com> [Async overflow] Get scroll-snap working with async overflow scrolling on macOS https://bugs.webkit.org/show_bug.cgi?id=210471 <rdar://problem/61643199> Reviewed by Wenson Hsieh. Obey the FIXME and move scroll-snap related code to the delegate so that it works for both frame and overflow nodes. Tests: tiled-drawing/scrolling/scroll-snap/scroll-snap-mandatory-async-overflow-stateless.html tiled-drawing/scrolling/scroll-snap/scroll-snap-mandatory-async-overflow.html * page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.mm: (WebCore::ScrollingTreeFrameScrollingNodeMac::commitStateBeforeChildren): (WebCore::convertToLayoutUnits): Deleted. * page/scrolling/mac/ScrollingTreeScrollingNodeDelegateMac.mm: (WebCore::convertToLayoutUnits): (WebCore::ScrollingTreeScrollingNodeDelegateMac::updateFromStateNode): 2020-04-13 Zalan Bujtas <zalan@apple.com> Do not cache definite height against perpendicular flex items. https://bugs.webkit.org/show_bug.cgi?id=207603 <rdar://problem/59135373> Reviewed by Simon Fraser. RenderFlexibleBox::m_hasDefiniteHeight should not be set when the child we check against is a perpendicular item because a perpendicular box's height is resolved against the containing block's width. Test: fast/flexbox/unresolved-height-percentage-crash.html * rendering/RenderFlexibleBox.cpp: (WebCore::RenderFlexibleBox::computeInnerFlexBaseSizeForChild): 2020-04-13 David Kilzer <ddkilzer@apple.com> Replace use of Checked<size_t, RecordOverflow> with CheckedSize <https://webkit.org/b/210461> Reviewed by Mark Lam. * platform/audio/ios/AudioFileReaderIOS.cpp: (WebCore::createAudioBufferList): * platform/graphics/ImageBufferBackend.cpp: (WebCore::ImageBufferBackend::calculateBackendSize): * platform/graphics/win/Direct2DUtilities.cpp: (WebCore::Direct2D::createDirect2DImageSurfaceWithData): * platform/graphics/win/ImageBufferDirect2DBackend.cpp: (WebCore::ImageBufferDirect2DBackend::copyNativeImage const): 2020-04-13 Simon Fraser <simon.fraser@apple.com> Add ENABLE_CUSTOM_SCROLLBARS and define it for macOS and for non-Cocoa platforms https://bugs.webkit.org/show_bug.cgi?id=210460 Reviewed by Tim Horton. Wrap all custom scrollbar and custom scroll corner code in ENABLE(CUSTOM_SCROLLBARS). * page/FrameView.cpp: (WebCore::FrameView::createScrollbar): (WebCore::FrameView::updateScrollCorner): * page/FrameView.h: * rendering/RenderLayer.cpp: (WebCore::RenderLayer::createScrollbar): (WebCore::RenderLayer::calculateClipRects const): * rendering/RenderLayer.h: * rendering/RenderLayerCompositor.cpp: * rendering/RenderListBox.cpp: (WebCore::RenderListBox::createScrollbar): * rendering/RenderMenuList.cpp: (RenderMenuList::createScrollbar): * rendering/RenderObject.cpp: (WebCore::RenderObject::containingBlock const): * rendering/RenderObject.h: * rendering/RenderScrollbar.cpp: * rendering/RenderScrollbar.h: * rendering/RenderScrollbarPart.cpp: * rendering/RenderScrollbarPart.h: * rendering/RenderScrollbarTheme.cpp: * rendering/RenderScrollbarTheme.h: * rendering/RenderSearchField.cpp: (WebCore::RenderSearchField::createScrollbar): * rendering/RenderTextControlSingleLine.cpp: * style/StyleResolver.cpp: 2020-04-13 Kenneth Russell <kbr@chromium.org> Clean up more resources during WebGLLayer teardown https://bugs.webkit.org/show_bug.cgi?id=210222 Reviewed by Dean Jackson. Release OpenGL resources just before destruction of the underlying OpenGL context. * platform/graphics/cocoa/GraphicsContextGLOpenGLCocoa.mm: (WebCore::GraphicsContextGLOpenGL::~GraphicsContextGLOpenGL): * platform/graphics/cocoa/WebGLLayer.h: * platform/graphics/cocoa/WebGLLayer.mm: (-[WebGLLayer releaseGLResources]): (-[WebGLLayer dealloc]): Deleted. 2020-04-13 Noam Rosenthal <noam@webkit.org> Background images should figure into visually non empty heuristic https://bugs.webkit.org/show_bug.cgi?id=208501 Reviewed by Simon Fraser. This makes the visually non-empty heuristic treat background images the same as it treats regular images. This is in line with first contentful paint spec in paint timing: https://w3c.github.io/paint-timing/. Note that the pixel count is computed based on the image size rather than the box size, as the box size might not be known at this time. This is equivalent to the pixel reporting done for RenderImage. Border-images and masks are excluded, as per the spec. * rendering/RenderBox.cpp: (WebCore::RenderBox::imageChanged): Call incrementVisuallyNonEmptyPixelCountIfNeeded for background images * rendering/RenderElement.cpp: (WebCore::RenderElement::RenderElement): * rendering/RenderBox.cpp: (WebCore::RenderElement::incrementVisuallyNonEmptyPixelCountIfNeeded): * rendering/RenderBox.h: * rendering/RenderImage.cpp: (WebCore::RenderImage::incrementVisuallyNonEmptyPixelCountIfNeeded): Deleted. * rendering/RenderImage.h: Moved incrementVisuallyNonEmptyPixelCountIfNeeded from RenderImage to RenderElement 2020-04-13 Yusuke Suzuki <ysuzuki@apple.com> module's default cross-origin value should be "anonymous" https://bugs.webkit.org/show_bug.cgi?id=210326 Reviewed by Sam Weinig. Tests: http/tests/security/cookie-module-import-propagate.html http/tests/security/cookie-module-import.html http/tests/security/cookie-module-propagate.html http/tests/security/cookie-module.html The original spec was using "omit" crossorigin for modules when crossorigin is not set / empty. However, the spec is changed to sending requests with "same-origin" credentials ("anonymous" crossorigin mode) by default. We should follow it. * dom/ScriptElement.cpp: (WebCore::ScriptElement::requestModuleScript): * dom/ScriptElementCachedScriptFetcher.cpp: (WebCore::ScriptElementCachedScriptFetcher::requestModuleScript const): * dom/ScriptElementCachedScriptFetcher.h: * html/parser/HTMLResourcePreloader.cpp: (WebCore::PreloadRequest::resourceRequest): * loader/cache/CachedScript.cpp: (WebCore::CachedScript::script): While this is not directly related to this patch, added new tests found that we are returning null StringView if the resource is zero byte. This totally works, but JSC::Parser has assertion that this is non-null StringView. For zero byte CachedScript resource, we should return non-null empty StringView instead. 2020-04-13 Dean Jackson <dino@apple.com> Add Apple's Reality files to AR System Preview https://bugs.webkit.org/show_bug.cgi?id=210449 <rdar://problem/61732793> Reviewed by Sam Weinig. Add support for Apples .reality AR files - both the vendor MIME Type and our UTI. These have been supported by WebKitAdditions for a while. Move them into Open Source. * platform/MIMETypeRegistry.cpp: (WebCore::MIMETypeRegistry::systemPreviewMIMETypes): * platform/network/mac/UTIUtilities.mm: (WebCore::UTIFromUnknownMIMEType): 2020-04-13 Per Arne Vollan <pvollan@apple.com> [iOS] Remove unused UTType swizzler code https://bugs.webkit.org/show_bug.cgi?id=210435 Unreviewed rollout of r258120. * WebCore.xcodeproj/project.pbxproj: * platform/cocoa/UTTypeRecordSwizzler.h: Removed. * platform/cocoa/UTTypeRecordSwizzler.mm: Removed. 2020-04-13 Commit Queue <commit-queue@webkit.org> Unreviewed, reverting r260003. https://bugs.webkit.org/show_bug.cgi?id=210441 Avoid using basic-authentication for tests (Requested by yusukesuzuki on #webkit). Reverted changeset: "module's default cross-origin value should be "anonymous"" https://bugs.webkit.org/show_bug.cgi?id=210326 https://trac.webkit.org/changeset/260003 2020-04-13 Antti Koivisto <antti@apple.com> [CSS Selectors] Selectors Level 4 specificity calculation for pseudo classes https://bugs.webkit.org/show_bug.cgi?id=210419 Reviewed by Simon Fraser. CSS selector specification drafts at some point had a concept of "dynamic specificity" where the specificity of a selector depended on the element it matched. It was only ever used with :matches and :nth-child pseudo classes and has subsequently been removed. Selector specificity can now always be computed statically. There is a ton of code to support this obsolete feature. Remove it. https://drafts.csswg.org/selectors-4/#specificity-rules "The specificity of an :is(), :not(), or :has() pseudo-class is replaced by the specificity of the most specific complex selector in its selector list argument. Analogously, the specificity of an :nth-child() or :nth-last-child() selector is the specificity of the pseudo class itself (counting as one pseudo-class selector) plus the specificity of the most specific complex selector in its selector list argument (if any)." * css/html.css: Reorganize a :matches rule into a selector list to keep the exact specificites. It matters here to select between listbox and menulist correctly based on the 'size' and 'multiple' attributes. * css/CSSSelector.cpp: (WebCore::selectorSpecificity): (WebCore::maxSpecificity): (WebCore::simpleSelectorSpecificityInternal): (WebCore::CSSSelector::simpleSelectorSpecificity const): Also handle nth here. (WebCore::CSSSelector::specificity const): (WebCore::simpleSelectorFunctionalPseudoClassStaticSpecificity): Deleted. (WebCore::functionalPseudoClassStaticSpecificity): Deleted. (WebCore::staticSpecificityInternal): Deleted. (WebCore::CSSSelector::staticSpecificity const): Deleted. Rename to just computeSpecificity(), there is no other kind than static. * css/CSSSelector.h: * css/SelectorChecker.cpp: (WebCore::SelectorChecker::match const): (WebCore::SelectorChecker::matchHostPseudoClass const): (WebCore::SelectorChecker::matchRecursively const): (WebCore::SelectorChecker::checkOne const): (WebCore::SelectorChecker::matchSelectorList const): SelectorChecker doesn't need to deal with specificity anymore. * css/SelectorChecker.h: * cssjit/SelectorCompiler.cpp: (WebCore::SelectorCompiler::addNthChildType): (WebCore::SelectorCompiler::addPseudoClassType): (WebCore::SelectorCompiler::constructFragmentsInternal): (WebCore::SelectorCompiler::SelectorCodeGenerator::generateSelectorChecker): (WebCore::SelectorCompiler::SelectorCodeGenerator::generateElementAttributeFunctionCallValueMatching): Neither does SelectorCompiler. * cssjit/SelectorCompiler.h: * dom/SelectorQuery.cpp: (WebCore::SelectorDataList::selectorMatches const): (WebCore::SelectorDataList::selectorClosest const): * inspector/InspectorStyleSheet.cpp: (WebCore::buildObjectForSelectorHelper): (WebCore::selectorsFromSource): (WebCore::InspectorStyleSheet::buildObjectForSelector): (WebCore::InspectorStyleSheet::buildObjectForSelectorList): (WebCore::InspectorStyleSheet::buildObjectForRule): (WebCore::InspectorStyleSheet::buildArrayForRuleList): (WebCore::hasDynamicSpecificity): Deleted. * inspector/InspectorStyleSheet.h: * inspector/agents/InspectorCSSAgent.cpp: (WebCore::InspectorCSSAgent::setRuleSelector): (WebCore::InspectorCSSAgent::addRule): (WebCore::InspectorCSSAgent::buildObjectForRule): (WebCore::InspectorCSSAgent::buildArrayForMatchedRuleList): * inspector/agents/InspectorDOMAgent.cpp: (WebCore::InspectorDOMAgent::highlightSelector): * style/ElementRuleCollector.cpp: (WebCore::Style::ElementRuleCollector::ruleMatches): (WebCore::Style::ElementRuleCollector::collectMatchingRulesForList): Switch to get the specificity from the selector instead of computing it during selector checking. * style/ElementRuleCollector.h: * style/RuleData.cpp: (WebCore::Style::computeMatchesBasedOnRuleHash): (WebCore::Style::RuleData::RuleData): (WebCore::Style::computeMatchBasedOnRuleHash): Deleted. * style/RuleData.h: (WebCore::Style::RuleData::matchesBasedOnRuleHash const): (WebCore::Style::RuleData::matchBasedOnRuleHash const): Deleted. This can be a bit instead of an enum since there is no need to communicate specificity. 2020-04-13 David Kilzer <ddkilzer@apple.com> KeyedDecoder functions in ResourceLoadStatistics.{cpp,h} should return bool and use WARN_UNUSED_RETURN <https://webkit.org/b/210414> <rdar://problem/61693118> Reviewed by Alex Christensen. * loader/ResourceLoadStatistics.cpp: (WebCore::decodeHashCountedSet): (WebCore::decodeHashSet): (WebCore::decodeOptionSet): (WebCore::decodeFontHashSet): (WebCore::decodeCanvasActivityRecord): (WebCore::ResourceLoadStatistics::decode): * loader/ResourceLoadStatistics.h: - Change decode functions to return `bool`. - Add WARN_UNUSED_RETURN to all decode functions. - Check the return value of all decode functions. 2020-04-13 Said Abou-Hallawa <sabouhallawa@apple.com> When drawing an image srcRect and imageRect have to be in the orientation of destRect https://bugs.webkit.org/show_bug.cgi?id=210364 Reviewed by Darin Adler. * html/canvas/CanvasRenderingContext2DBase.cpp: (WebCore::CanvasRenderingContext2DBase::drawImage): Use the renderer to get the orientation of the image if it is available. Otherwise fall back to computedStyle(). * platform/graphics/BitmapImage.cpp: (WebCore::BitmapImage::draw): For async image decoding, we will use the none oriented size as the sizeForDrawing. imageRect must be in the same orientation as destRect. * platform/graphics/GraphicsContext.cpp: (WebCore::GraphicsContext::drawImage): srcRect must be in the same orientation as destRect. 2020-04-13 Joonghun Park <jh718.park@samsung.com> Unreviewed. Remove redundant move in return statement. Return statement already returns rvalue, so we don't need move here. This patch removes the build warning below since r259922. warning: redundant move in return statement [-Wredundant-move] No new tests, no new behaviours. * page/csp/ContentSecurityPolicyResponseHeaders.h: (WebCore::ContentSecurityPolicyResponseHeaders::decode): * platform/network/cf/CertificateInfoCFNet.cpp: (WTF::Persistence::decodeSecTrustRef): 2020-04-13 Youenn Fablet <youenn@apple.com> Fix mute/unmute of CoreAudioCapture sources after revision 257914 https://bugs.webkit.org/show_bug.cgi?id=210381 Reviewed by Eric Carlson. Revert part of revision 257914 since we still need the active source registration/unregistration when capturing in web process. Make sure mock factory delegates all active source handling to CoreAudioCaptureSourceFactory, now that the mock factory is using CoreAudioCaptureSources with a mock share dunit. Tests: platform/ios/mediastream/audio-muted-in-background-tab-gpu-process.html platform/ios/mediastream/getUserMedia-single-capture-gpu-process.html * platform/mediastream/RealtimeMediaSourceFactory.h: * platform/mediastream/mac/CoreAudioCaptureSource.cpp: (WebCore::CoreAudioCaptureSource::~CoreAudioCaptureSource): (WebCore::CoreAudioCaptureSource::startProducingData): * platform/mock/MockRealtimeMediaSourceCenter.cpp: 2020-04-13 Michael Catanzaro <mcatanzaro@gnome.org> Fix various build warnings https://bugs.webkit.org/show_bug.cgi?id=210429 Reviewed by Mark Lam. Fix -Wunused-parameter warning. * html/canvas/WebGLRenderingContextBase.cpp: (WebCore::WebGLRenderingContextBase::texImage2DBase): 2020-04-13 Zalan Bujtas <zalan@apple.com> [LFC][TFC] Pre-fill columnIntrinsicWidths vector https://bugs.webkit.org/show_bug.cgi?id=210415 Reviewed by Antti Koivisto. Vector<ColumnMinimumWidth> has a fixed number of entries (number of columns in the table). (This patch also flips the shouldFlex flag to isFixedWidth. It reads better in the context of minimum _widths_). Test: fast/layoutformattingcontext/table-with-column-spanner-first-row.html * layout/tableformatting/TableFormattingContext.cpp: (WebCore::Layout::TableFormattingContext::computedPreferredWidthForColumns): (WebCore::Layout::TableFormattingContext::computeAndDistributeExtraHorizontalSpace): 2020-04-13 Adrian Perez de Castro <aperez@igalia.com> [GTK4] Fix usage of GDK event functions in PlatformWheelEventGtk https://bugs.webkit.org/show_bug.cgi?id=210160 Reviewed by Michael Catanzaro. No new tests needed. * platform/gtk/PlatformWheelEventGtk.cpp: (WebCore::PlatformWheelEvent::PlatformWheelEvent): Conditionally use the new GDK event functions when building with GTK4. 2020-04-13 Yusuke Suzuki <ysuzuki@apple.com> module's default cross-origin value should be "anonymous" https://bugs.webkit.org/show_bug.cgi?id=210326 Reviewed by Sam Weinig. The original spec was using "omit" crossorigin for modules when crossorigin is not set / empty. However, the spec is changed to sending requests with "same-origin" credentials ("anonymous" crossorigin mode) by default. We should follow it. * dom/ScriptElement.cpp: (WebCore::ScriptElement::requestModuleScript): * dom/ScriptElementCachedScriptFetcher.cpp: (WebCore::ScriptElementCachedScriptFetcher::requestModuleScript const): * dom/ScriptElementCachedScriptFetcher.h: * html/parser/HTMLResourcePreloader.cpp: (WebCore::PreloadRequest::resourceRequest): * loader/cache/CachedScript.cpp: (WebCore::CachedScript::script): While this is not directly related to this patch, added new tests found that we are returning null StringView if the resource is zero byte. This totally works, but JSC::Parser has assertion that this is non-null StringView. For zero byte CachedScript resource, we should return non-null empty StringView instead. 2020-04-13 Charlie Turner <cturner@igalia.com> [EME][GStreamer] remove m_cdmInstance ASSERT in cdmInstanceDetached https://bugs.webkit.org/show_bug.cgi?id=210331 Reviewed by Xabier Rodriguez-Calvar. In tests that reset the src very quickly, the MediaKeys can be installed and then the src is reset before an attachment message is sent. Hence, detachment can result in no CDM currently existing. Covered by imported/w3c/web-platform-tests/encrypted-media. * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp: (WebCore::MediaPlayerPrivateGStreamer::cdmInstanceDetached): Only assert if the CDM instance has been set before detachment. (WebCore::MediaPlayerPrivateGStreamer::attemptToDecryptWithInstance): Do not need the .get(), the operator== overload in RefPtr does this for us, and it makes the code more consistent. 2020-04-13 Rob Buis <rbuis@igalia.com> Remove return parameter from FrameLoader::closeURL https://bugs.webkit.org/show_bug.cgi?id=210404 Reviewed by Manuel Rego Casasnovas. Remove return parameter from FrameLoader::closeURL since it always returns true and is never tested. * loader/FrameLoader.cpp: (WebCore::FrameLoader::closeURL): * loader/FrameLoader.h: 2020-04-13 Rob Buis <rbuis@igalia.com> Remove addExtraFieldsToSubresourceRequest https://bugs.webkit.org/show_bug.cgi?id=210407 Reviewed by Darin Adler. Remove addExtraFieldsToSubresourceRequest since it can be replaced by calling addExtraFieldsToRequest. The loadType parameter is not taken into account by defaultRequestCachingPolicy so FrameLoadType::Standard rather than m_loadType is passed. This patch also replaces the isMainResource boolean parameter with an enum. * loader/FrameLoader.cpp: (WebCore::FrameLoader::loadURL): (WebCore::FrameLoader::load): (WebCore::FrameLoader::addExtraFieldsToRequest): (WebCore::FrameLoader::loadPostRequest): (WebCore::FrameLoader::loadResourceSynchronously): (WebCore::FrameLoader::loadDifferentDocumentItem): (WebCore::FrameLoader::addExtraFieldsToSubresourceRequest): Deleted. * loader/FrameLoader.h: * loader/PingLoader.cpp: (WebCore::PingLoader::loadImage): (WebCore::PingLoader::sendPing): (WebCore::PingLoader::sendViolationReport): * loader/cache/CachedResource.cpp: (WebCore::CachedResource::load): 2020-04-12 Darin Adler <darin@apple.com> Fix a few mispellings of descendant and propagation https://bugs.webkit.org/show_bug.cgi?id=210409 Reviewed by Mark Lam. * dom/Element.cpp: (WebCore::Element::dispatchWheelEvent): "propagation" * dom/TreeScopeOrderedMap.cpp: (WebCore::TreeScopeOrderedMap::getAllElementsById const): "descendants". Also refactored this function a bit. * html/MediaElementSession.cpp: (WebCore::MediaElementSession::canShowControlsManager const): "descendants" * rendering/RenderFrameSet.cpp: (WebCore::resetFrameRendererAndDescendants): "descendants" (WebCore::RenderFrameSet::positionFrames): "descendants" (WebCore::RenderFrameSet::positionFramesWithFlattening): "descendants" 2020-04-12 Darin Adler <darin@apple.com> Refactor and tighten up the CSSVariableReferenceValue class https://bugs.webkit.org/show_bug.cgi?id=210406 Reviewed by Anders Carlsson. * css/CSSCustomPropertyValue.h: Remove uneeded forward declaration of CSSVariableReferenceValue, since it's not used here. Added inclde of CSSVariableData.h since the use of Variant in this class does require that header, which we were getting indirectly before from CSSVariableReferenceValue.h in some translation units. * css/CSSVariableReferenceValue.cpp: (WebCore::CSSVariableReferenceValue::CSSVariableReferenceValue): Moved here from the header. (WebCore::CSSVariableReferenceValue::create): Ditto. (WebCore::CSSVariableReferenceValue::equals const): Ditto. (WebCore::CSSVariableReferenceValue::customCSSText const): Use non-null to indicate this is not serialized. * css/CSSVariableReferenceValue.h: Reduced includes, inlining, marked constructor explicit, removed unneeded m_serialized boolean. * rendering/style/StyleCustomPropertyData.h: Remove unneeded include of CSSVariableReferenceValue.h, not used here. 2020-04-12 Darin Adler <darin@apple.com> Fix some strange uses of start/endOfDocument https://bugs.webkit.org/show_bug.cgi?id=210408 Reviewed by Wenson Hsieh. * editing/VisibleSelection.cpp: (WebCore::VisibleSelection::setStartAndEndFromBaseAndExtentRespectingGranularity): Call startOfDocument and endOfDocument without unnecessarily turning a Position into a VisiblePostion, since those functions just require any node from the document. 2020-04-12 Zalan Bujtas <zalan@apple.com> [LFC][TFC] Add support for column spanners https://bugs.webkit.org/show_bug.cgi?id=210403 Reviewed by Antti Koivisto. Table width constraint computation with spanner support is as follows: 1. Collect each cells' width constraints. 2. Collect fixed column widths set by <colgroup>'s and <col>s. 3. Find the min/max width for each columns using the cell constraints and the <col> fixed widths but ignore column spans. 4. Distribute column spanning cells min/max widths. 5. Add them all up and return the computed min/max widths. * layout/FormattingContext.h: (WebCore::Layout::FormattingContext::IntrinsicWidthConstraints::operator-=): * layout/tableformatting/TableFormattingContext.cpp: (WebCore::Layout::TableFormattingContext::computedPreferredWidthForColumns): (WebCore::Layout::TableFormattingContext::computeAndDistributeExtraHorizontalSpace): * layout/tableformatting/TableFormattingContextGeometry.cpp: (WebCore::Layout::TableFormattingContext::Geometry::intrinsicWidthConstraintsForCell): * layout/tableformatting/TableGrid.cpp: (WebCore::Layout::TableGrid::Columns::hasFixedColumnsOnly const): * layout/tableformatting/TableGrid.h: 2020-04-12 Zalan Bujtas <zalan@apple.com> [LFC][TFC] Column, Row and Cell boxes are always ContainerBoxes https://bugs.webkit.org/show_bug.cgi?id=210402 Reviewed by Antti Koivisto. These boxes are always ContainerBox types. * layout/tableformatting/TableFormattingContext.cpp: (WebCore::Layout::TableFormattingContext::layoutCell): (WebCore::Layout::TableFormattingContext::ensureTableGrid): (WebCore::Layout::TableFormattingContext::computedPreferredWidthForColumns): * layout/tableformatting/TableGrid.cpp: (WebCore::Layout::TableGrid::Column::Column): (WebCore::Layout::TableGrid::Columns::addColumn): (WebCore::Layout::TableGrid::Rows::addRow): (WebCore::Layout::TableGrid::Row::Row): (WebCore::Layout::TableGrid::Cell::Cell): (WebCore::Layout::TableGrid::appendCell): (WebCore::Layout::TableGrid::insertCell): (WebCore::Layout::TableGrid::removeCell): * layout/tableformatting/TableGrid.h: (WebCore::Layout::TableGrid::Column::box const): (WebCore::Layout::TableGrid::Row::box const): (WebCore::Layout::TableGrid::Cell::box const): 2020-04-12 Zalan Bujtas <zalan@apple.com> [LFC][TFC] Add support for fixed width columns https://bugs.webkit.org/show_bug.cgi?id=210401 Reviewed by Antti Koivisto. This is in preparation for adding support for spanner cells. Fixed width columns (<col> and <td>) don't participate in the spanner width distribution. * layout/FormattingContext.h: (WebCore::Layout::FormattingContext::IntrinsicWidthConstraints::operator-=): * layout/Verification.cpp: (WebCore::Layout::areEssentiallyEqual): (WebCore::Layout::LayoutContext::verifyAndOutputMismatchingLayoutTree): * layout/tableformatting/TableFormattingContext.cpp: (WebCore::Layout::TableFormattingContext::computedIntrinsicWidthConstraints): (WebCore::Layout::TableFormattingContext::computedPreferredWidthForColumns): (WebCore::Layout::TableFormattingContext::computeAndDistributeExtraHorizontalSpace): (WebCore::Layout::TableFormattingContext::computePreferredWidthForColumns): Deleted. (WebCore::Layout::TableFormattingContext::useAsContentLogicalWidth): Deleted. * layout/tableformatting/TableFormattingContext.h: * layout/tableformatting/TableFormattingContextGeometry.cpp: (WebCore::Layout::TableFormattingContext::Geometry::intrinsicWidthConstraintsForCell): * layout/tableformatting/TableGrid.cpp: (WebCore::Layout::TableGrid::Column::isFixedWidth const): (WebCore::Layout::TableGrid::Cell::isFixedWidth const): (WebCore::Layout::TableGrid::Slot::Slot): (WebCore::Layout::TableGrid::appendCell): (WebCore::Layout::TableGrid::Column::setWidthConstraints): Deleted. (WebCore::Layout::TableGrid::Column::widthConstraints const): Deleted. (WebCore::Layout::TableGrid::Column::hasFixedWidth const): Deleted. (WebCore::Layout::TableGrid::widthConstraints): Deleted. * layout/tableformatting/TableGrid.h: (WebCore::Layout::TableGrid::setWidthConstraints): (WebCore::Layout::TableGrid::widthConstraints): (WebCore::Layout::TableGrid::Column::setHasFixedWidthCell): (WebCore::Layout::TableGrid::Column::hasFixedWidthCell const): (WebCore::Layout::TableGrid::Slot::cell const): (WebCore::Layout::TableGrid::Slot::cell): (WebCore::Layout::TableGrid::Slot::widthConstraints const): (WebCore::Layout::TableGrid::Slot::setWidthConstraints): (WebCore::Layout::TableGrid::Slot::hasColumnSpan const): (WebCore::Layout::TableGrid::Slot::hasRowSpan const): (WebCore::Layout::TableGrid::Slot::isColumnSpanned const): (WebCore::Layout::TableGrid::Slot::isRowSpanned const): (WebCore::Layout::TableGrid::hasComputedWidthConstraints const): Deleted. 2020-04-12 Zalan Bujtas <zalan@apple.com> [LFC][TFC] Introduce dedicated SlotPosition/CellSpan structs https://bugs.webkit.org/show_bug.cgi?id=210399 Reviewed by Antti Koivisto. SlotPosition.column/row and CellSpan.column/row read better. * layout/LayoutUnits.h: (WebCore::Layout::SlotPosition::SlotPosition): (WebCore::Layout::operator==): (WTF::SlotPositionHash::hash): (WTF::SlotPositionHash::equal): (WTF::HashTraits<WebCore::Layout::SlotPosition>::emptyValue): (WTF::HashTraits<WebCore::Layout::SlotPosition>::constructDeletedValue): (WTF::HashTraits<WebCore::Layout::SlotPosition>::isDeletedValue): * layout/layouttree/LayoutBox.cpp: (WebCore::Layout::Box::setRowSpan): (WebCore::Layout::Box::setColumnSpan): (WebCore::Layout::Box::rowSpan const): (WebCore::Layout::Box::columnSpan const): * layout/layouttree/LayoutBox.h: * layout/tableformatting/TableFormattingContext.cpp: (WebCore::Layout::TableFormattingContext::computePreferredWidthForColumns): * layout/tableformatting/TableGrid.cpp: (WebCore::Layout::TableGrid::Cell::Cell): (WebCore::Layout::TableGrid::appendCell): * layout/tableformatting/TableGrid.h: (WebCore::Layout::TableGrid::Cell::startColumn const): (WebCore::Layout::TableGrid::Cell::endColumn const): (WebCore::Layout::TableGrid::Cell::startRow const): (WebCore::Layout::TableGrid::Cell::endRow const): (WebCore::Layout::TableGrid::Cell::columnSpan const): (WebCore::Layout::TableGrid::Cell::rowSpan const): (WebCore::Layout::TableGrid::Cell::span const): (WebCore::Layout::TableGrid::Cell::size const): Deleted. 2020-04-12 Zalan Bujtas <zalan@apple.com> [LFC][TFC] Add table support to BlockFormattingContext::Geometry::inFlowWidthAndMargin https://bugs.webkit.org/show_bug.cgi?id=210400 Reviewed by Antti Koivisto. Use a slightly modified shrink-to-fit logic to compute the table width. * layout/blockformatting/BlockFormattingContextGeometry.cpp: (WebCore::Layout::BlockFormattingContext::Geometry::inFlowWidthAndMargin): 2020-04-12 Zalan Bujtas <zalan@apple.com> [LFC][TFC] Cleanup class/struct/variable names in TableGrid/TableFormattingContext https://bugs.webkit.org/show_bug.cgi?id=210397 Reviewed by Antti Koivisto. This is in preparation for the column spanner work. * layout/tableformatting/TableFormattingContext.cpp: (WebCore::Layout::TableFormattingContext::layoutInFlowContent): (WebCore::Layout::TableFormattingContext::layoutCell): (WebCore::Layout::TableFormattingContext::positionTableCells): (WebCore::Layout::TableFormattingContext::setComputedGeometryForRows): (WebCore::Layout::TableFormattingContext::setComputedGeometryForSections): (WebCore::Layout::TableFormattingContext::ensureTableGrid): (WebCore::Layout::TableFormattingContext::computePreferredWidthForColumns): (WebCore::Layout::TableFormattingContext::computeAndDistributeExtraHorizontalSpace): (WebCore::Layout::TableFormattingContext::useAsContentLogicalWidth): (WebCore::Layout::TableFormattingContext::layoutTableCellBox): Deleted. * layout/tableformatting/TableFormattingContext.h: * layout/tableformatting/TableGrid.cpp: (WebCore::Layout::TableGrid::Column::Column): (WebCore::Layout::TableGrid::Column::hasFixedWidth const): (WebCore::Layout::TableGrid::Columns::addColumn): (WebCore::Layout::TableGrid::Columns::addAnonymousColumn): (WebCore::Layout::TableGrid::Rows::addRow): (WebCore::Layout::TableGrid::Row::Row): (WebCore::Layout::TableGrid::Cell::Cell): (WebCore::Layout::TableGrid::Slot::Slot): (WebCore::Layout::TableGrid::slot): (WebCore::Layout::TableGrid::appendCell): (WebCore::Layout::TableGrid::insertCell): (WebCore::Layout::TableGrid::removeCell): (WebCore::Layout::TableGrid::widthConstraints): (WebCore::Layout::TableGrid::ColumnsContext::addColumn): Deleted. (WebCore::Layout::TableGrid::CellInfo::CellInfo): Deleted. (WebCore::Layout::TableGrid::SlotInfo::SlotInfo): Deleted. * layout/tableformatting/TableGrid.h: (WebCore::Layout::TableGrid::totalHorizontalSpacing const): (WebCore::Layout::TableGrid::hasComputedWidthConstraints const): (WebCore::Layout::TableGrid::Column::box const): (WebCore::Layout::TableGrid::Columns::list): (WebCore::Layout::TableGrid::Columns::list const): (WebCore::Layout::TableGrid::Columns::size const): (WebCore::Layout::TableGrid::Columns::logicalWidth const): (WebCore::Layout::TableGrid::Row::logicalBottom const): (WebCore::Layout::TableGrid::Row::box const): (WebCore::Layout::TableGrid::Rows::list): (WebCore::Layout::TableGrid::Rows::rowList const): (WebCore::Layout::TableGrid::Rows::size const): (WebCore::Layout::TableGrid::Cell::startColumn const): (WebCore::Layout::TableGrid::Cell::endColumn const): (WebCore::Layout::TableGrid::Cell::startRow const): (WebCore::Layout::TableGrid::Cell::endRow const): (WebCore::Layout::TableGrid::Cell::columnSpan const): (WebCore::Layout::TableGrid::Cell::rowSpan const): (WebCore::Layout::TableGrid::Cell::position const): (WebCore::Layout::TableGrid::Cell::size const): (WebCore::Layout::TableGrid::Cell::box const): (WebCore::Layout::TableGrid::columns const): (WebCore::Layout::TableGrid::columns): (WebCore::Layout::TableGrid::rows const): (WebCore::Layout::TableGrid::rows): (WebCore::Layout::TableGrid::cells): (WebCore::Layout::TableGrid::CellInfo::startColumn const): Deleted. (WebCore::Layout::TableGrid::CellInfo::endColumn const): Deleted. (WebCore::Layout::TableGrid::CellInfo::startRow const): Deleted. (WebCore::Layout::TableGrid::CellInfo::endRow const): Deleted. (WebCore::Layout::TableGrid::CellInfo::columnSpan const): Deleted. (WebCore::Layout::TableGrid::CellInfo::rowSpan const): Deleted. (WebCore::Layout::TableGrid::Column::columnBox const): Deleted. (WebCore::Layout::TableGrid::ColumnsContext::columns): Deleted. (WebCore::Layout::TableGrid::ColumnsContext::columns const): Deleted. (WebCore::Layout::TableGrid::ColumnsContext::logicalWidth const): Deleted. (WebCore::Layout::TableGrid::columnsContext const): Deleted. (WebCore::Layout::TableGrid::columnsContext): Deleted. 2020-04-11 Jack Lee <shihchieh_lee@apple.com> Infinite loop in InsertListCommand::doApply() https://bugs.webkit.org/show_bug.cgi?id=210354 <rdar://problem/61427778> Reviewed by Darin Adler. Function startOfNextParagraph may return an empty position. Added null check to exit the while loop and stop looking for next paragraph. Test: editing/inserting/insert-list-end-of-table.html * editing/InsertListCommand.cpp: (WebCore::InsertListCommand::doApply): 2020-04-11 Wenson Hsieh <wenson_hsieh@apple.com> [macOS] [WK1] Touch Bar flashes when typing in Vietnamese in Mail https://bugs.webkit.org/show_bug.cgi?id=210394 <rdar://problem/60099560> Reviewed by Tim Horton. See WebKitLegacy/mac/ChangeLog for more details. Currently, many users of TemporarySelectionChange use it to temporarily avoid propagating selection changes to the client layer during temporary selection changes. This involves creating a TemporarySelectionChange without a new selection, but with the `IgnoreSelectionChanges` option specified, which makes us call `Editor:: setIgnoreSelectionChanges` to suppress selection change notifications. Do a bit of cleanup in this area by introducing IgnoreSelectionChangeForScope, which wraps a TemporarySelectionChange and makes it easier for a handful of call sites that currently use TemporarySelectionChange to hide selection changes from the client layer to get their desired behavior. Test: CandidateTests.DoNotHideCandidatesDuringTextReplacement * editing/Editor.cpp: (WebCore::Editor::respondToChangedSelection): * editing/Editor.h: (WebCore::TemporarySelectionChange::TemporarySelectionChange): (WebCore::IgnoreSelectionChangeForScope::IgnoreSelectionChangeForScope): * page/DragController.cpp: (WebCore::DragController::performDragOperation): (WebCore::DragController::insertDroppedImagePlaceholdersAtCaret): Replace these: `TemporarySelectionChange ignoreSelectionChanges { frame, WTF::nullopt, TemporarySelectionOption::IgnoreSelectionChanges };` ...with these instead: `IgnoreSelectionChangeForScope ignoreSelectionChanges { *frame };` 2020-04-11 Simon Fraser <simon.fraser@apple.com> [Async overflow] Can't scroll overflow:scroll in sideways-scrollable RTL document https://bugs.webkit.org/show_bug.cgi?id=210389 Reviewed by Tim Horton. ScrollingTree::handleWheelEvent() converts the event coordinates from view to "content" coordinates, but we then jump into hit-testing on CALayers. In a sideways-scrollable RTL document, the root content layer has a negative X offset which corresponds to scrollOrigin; we need to map the point into the coordinate space of this layer before entering layer-based hit-testing. Tests: fast/scrolling/mac/async-scroll-overflow-rtl-zoomed.html fast/scrolling/mac/async-scroll-overflow-rtl.html * page/scrolling/ScrollingTree.cpp: (WebCore::ScrollingTree::handleWheelEvent): * page/scrolling/mac/ScrollingTreeMac.mm: (ScrollingTreeMac::scrollingNodeForPoint): 2020-04-10 Darin Adler <darin@apple.com> Move more from live range to SimpleRange: callers of absoluteTextRects https://bugs.webkit.org/show_bug.cgi?id=210369 Reviewed by Anders Carlsson. * dom/Node.cpp: (WebCore::Node::textRects const): Deleted. * dom/Node.h: Updated for the above. * dom/Range.cpp: (WebCore::Range::absoluteBoundingBox const): Updated since absoluteTextRects no longer has a RangeInFixedPosition* argument. (WebCore::Range::absoluteTextRects const): Removed the unused RangeInFixedPosition* argument. * dom/Range.h: Got rid of unused RangeInFixedPosition type and also removed RangeInFixedPosition* argument from the absoluteTextRects function. Later will remove absoluteTextRects entirely. * editing/Editor.cpp: (WebCore::Editor::firstRectForRange const): Use RenderObject::absoluteTextQuads and unitedBoundingBoxes rather than using RenderObject::absoluteBoundingBoxRectForRange. * editing/cocoa/DataDetection.mm: (WebCore::DataDetection::detectContentInRange): Use SimpleRange rather than live ranges. * html/HTMLTextFormControlElement.cpp: (WebCore::setContainerAndOffsetForRange): Moved from int to unsigned. (WebCore::HTMLTextFormControlElement::selection const): Return Optional<SimpleRange> rather than a live range. * html/HTMLTextFormControlElement.h: Updated for the change above. * page/TextIndicator.cpp: (WebCore::initializeIndicator): Updated since absoluteTextRects no longer takes a RangeInFixedPosition* argument. * rendering/HighlightData.h: Removed stray obsolete declaration. * rendering/RenderObject.cpp: (WebCore::RenderObject::absoluteBoundingBoxRectForRange): Deleted. Callers can use absoluteTextQuads directly. We need to cut down on the number of separate functions that are not really separate concepts, and this was used in only one place. (WebCore::RenderObject::absoluteTextRects): Added. Replaces Range::absoluteTextRects for all callers outside the live range class and will eventually replace it entirely. * rendering/RenderObject.h: Updated for the above. 2020-04-11 Devin Rousso <drousso@apple.com> REGRESSION (Safari 13.1?): Web Inspector: Debugger hang at breakpoint when using Keyboard Maestro https://bugs.webkit.org/show_bug.cgi?id=210177 <rdar://problem/61485723> Reviewed by Joseph Pecoraro. Partial revert of r251036 <https://webkit.org/b/202716> to go back to using AppKit APIs instead of `CFRunLoopRunInMode`. Only seems to affect WebKitLegacy. * inspector/PageScriptDebugServer.h: * inspector/PageScriptDebugServer.cpp: (WebCore::PageScriptDebugServer::runEventLoopWhilePausedInternal): (WebCore::PageScriptDebugServer::platformShouldContinueRunningEventLoopWhilePaused): * inspector/mac/PageScriptDebugServerMac.mm: Added. (WebCore::PageScriptDebugServer::platformShouldContinueRunningEventLoopWhilePaused): * SourcesCocoa.txt: * WebCore.xcodeproj/project.pbxproj: 2020-04-08 Darin Adler <darin@apple.com> Use Node::length to replace Node::maxCharacterOffset and lastOffsetInNode; switch more offsets from int to unsigned https://bugs.webkit.org/show_bug.cgi?id=210246 Reviewed by Antti Koivisto. - The recently-added Node::length, which matches the DOM specification terminology for node offsets as used in ranges, is the same as the existing maxCharacterOffset and lastOffsetInNode functions. Deleted all uses of those and replaced them with calls to Node::length. One of the benefits of this is that Node::length is implemented more efficiently and is not a virtual function. Another is consistently matching the DOM specification terminology. - Many offsets, including the ones in live ranges, are currently implemented as signed in WebKit, but are specified as unsigned in the DOM and HTML specifications. This has very little observable effect from JavaScript that can affect website compatibility, but it's still helpful to be consistent both with the specification and internally. Accordingly, changed some of these to unsigned; more to come later. * accessibility/AXObjectCache.cpp: (WebCore::AXObjectCache::previousBoundary): Use length instead of maxCharacterOffset. * dom/CharacterData.cpp: (WebCore::CharacterData::maxCharacterOffset const): Deleted. * dom/CharacterData.h: Deleted maxCharacterOffset override. * dom/DocumentMarkerController.cpp: (WebCore::DocumentMarkerController::shiftMarkers): Use length instead of maxCharacterOffset. * dom/Node.cpp: (WebCore::Node::maxCharacterOffset const): Deleted. * dom/Node.h: Deleted maxCharacterOffset. * dom/Position.cpp: (WebCore::Position::computeOffsetInContainerNode const): Use length instead of lastOffsetInNode. * dom/Position.h: (WebCore::lastOffsetInNode): Deleted. (WebCore::lastPositionInNode): Use length instead of lastOffsetInNode. (WebCore::minOffsetForNode): Use length instead of maxCharacterOffset. (WebCore::offsetIsBeforeLastNodeOffset): Ditto. * dom/RangeBoundaryPoint.h: (WebCore::RangeBoundaryPoint::setToEndOfNode): Use length instead of maxCharacterOffset. * editing/ApplyBlockElementCommand.cpp: (WebCore::isNewLineAtPosition): Use length instead of maxCharacterOffset. (WebCore::ApplyBlockElementCommand::rangeForParagraphSplittingTextNodesIfNeeded): Ditto. * editing/ApplyStyleCommand.cpp: (WebCore::ApplyStyleCommand::removeInlineStyle): Use length instead of maxCharacterOffset. * editing/Editing.cpp: (WebCore::lastOffsetForEditing): Use length instead of mmaxCharacterOffset and countChildNodes. Also improved the comment here. * editing/EditingStyle.cpp: (WebCore::EditingStyle::styleAtSelectionStart): Use length instead of maxCharacterOffset. * editing/InsertListCommand.cpp: (WebCore::InsertListCommand::doApplyForSingleParagraph): Use length instead of lastOffsetInNode. * editing/TextIterator.cpp: (WebCore::SimplifiedBackwardsTextIterator::SimplifiedBackwardsTextIterator): USe length instead of lastOffsetInNode. * editing/VisibleUnits.cpp: (WebCore::previousBoundary): Use length instead of maxCharacterOffset. 2020-04-10 Alex Christensen <achristensen@webkit.org> PersistentCoders should use modern decoding syntax https://bugs.webkit.org/show_bug.cgi?id=207497 Reviewed by Darin Adler. * inspector/InspectorFrontendHost.cpp: (WebCore::InspectorFrontendHost::showCertificate): * loader/FetchOptions.h: (WebCore::FetchOptions::decodePersistent): * page/csp/ContentSecurityPolicyResponseHeaders.h: (WebCore::ContentSecurityPolicyResponseHeaders::encode const): (WebCore::ContentSecurityPolicyResponseHeaders::decode): * platform/PasteboardCustomData.cpp: (WebCore::PasteboardCustomData::fromSharedBuffer): * platform/network/ResourceLoadPriority.h: * platform/network/ResourceRequestBase.h: (WebCore::ResourceRequestBase::encodeBase const): (WebCore::ResourceRequestBase::decodeBase): * platform/network/cf/CertificateInfo.h: (WTF::Persistence::decodeCFData): (WTF::Persistence::decodeSecTrustRef): (WTF::Persistence::decodeCertificateChain): (WTF::Persistence::Coder<WebCore::CertificateInfo>::encode): (WTF::Persistence::Coder<WebCore::CertificateInfo>::decode): * workers/service/server/RegistrationDatabase.cpp: (WebCore::RegistrationDatabase::doPushChanges): (WebCore::RegistrationDatabase::importRecords): 2020-04-10 Simon Fraser <simon.fraser@apple.com> [macOS] Fix scrollbar display for async-scrolling overflow https://bugs.webkit.org/show_bug.cgi?id=194101 Reviewed by Tim Horton. We need to call positionOverflowControlsLayers() from RenderLayerBacking::updateGeometry(), otherwise, on first load, scrollbar layers have no size because we try to position them before we've created them. Test: fast/scrolling/mac/overflow-scrollbars-should-be-visible.html * rendering/RenderLayer.cpp: (WebCore::RenderLayer::positionOverflowControls): * rendering/RenderLayerBacking.cpp: (WebCore::RenderLayerBacking::updateGeometry): 2020-04-10 Simon Fraser <simon.fraser@apple.com> [Async overflow] Can't scroll vertically while over a horizontal scroller in this content https://bugs.webkit.org/show_bug.cgi?id=210356 <rdar://problem/60523731> Reviewed by Tim Horton. https://dozermapper.github.io/gitbook/documentation/customconverter.html has style that triggers mismatched containing block and z-order layer trees, triggering the creation of an "overflow scroll proxy node" in the scrolling tree. If we encounter such a node in our ancestor tree walk while deciding which node to send a wheel event too, we need to jump to the node that the proxy node is representing. Test: fast/scrolling/mac/nested-overflow-proxy-node.html * page/scrolling/ScrollingTree.cpp: (WebCore::ScrollingTree::handleWheelEvent): 2020-04-10 Ryan Haddad <ryanhaddad@apple.com> Unreviewed, reverting r259764. Causes layout test crashes under GuardMalloc Reverted changeset: "Release WebGLLayer earlier in ~GraphicsContextGLOpenGL" https://bugs.webkit.org/show_bug.cgi?id=210213 https://trac.webkit.org/changeset/259764 2020-04-10 Peng Liu <peng.liu6@apple.com> REGRESSION: (r259850)[ Mac wk1 Debug ] media/track/track-user-stylesheet.html is flaky failing. https://bugs.webkit.org/show_bug.cgi?id=210350 Reviewed by Daniel Bates. Revert the change in r259850. * page/CaptionUserPreferences.cpp: (WebCore::CaptionUserPreferences::setCaptionsStyleSheetOverride): 2020-04-10 Pinki Gyanchandani <pgyanchandani@apple.com> Null ptr Deref in RadioButtonGroups::updateCheckedState https://bugs.webkit.org/show_bug.cgi?id=210353 Reviewed by Chris Dumez. This crash happened when the default checked setter was called for an input element and RadioButtonGroup was NULL. Added condition to dereference the group only if it is non-null. Test: fast/forms/input-element-default-checked-setter-crash.html * dom/RadioButtonGroups.cpp: (WebCore::RadioButtonGroups::updateCheckedState): 2020-04-10 Jack Lee <shihchieh_lee@apple.com> ASSERTION FAILED: selection.isRange() in InsertListCommand::doApply https://bugs.webkit.org/show_bug.cgi?id=210170 <rdar://problem/61410397> Reviewed by Wenson Hsieh. If selectionForParagraphIteration returns a non-range selection, there is no need for finding multiple paragraphs. And since non-range selection is handled, the assertion can be removed. Test: editing/inserting/insert-list-in-table-assert.html * editing/InsertListCommand.cpp: (WebCore::InsertListCommand::doApply): 2020-04-10 Antti Koivisto <antti@apple.com> [CSS Shadow Parts] Bad style sharing between sibling elements with different part attributes https://bugs.webkit.org/show_bug.cgi?id=210249 <rdar://problem/61547528> Reviewed by Daniel Bates. Style sharing optimization was unconditionally allowed for elements that were styled with part pseudo element. This could lead to miscomputed style. Test case by Justin Fagnani. Test: fast/css/shadow-parts/shadow-part-style-sharing.html * style/StyleSharingResolver.cpp: (WebCore::Style::SharingResolver::canShareStyleWithElement): Only allow style sharing if parts match. == Rolled over to ChangeLog-2020-04-10 ==