WebKit-https.git
9 months agoJSON.parse has bad is array assert
sbarati@apple.com [Mon, 21 Oct 2019 23:23:37 +0000 (23:23 +0000)]
JSON.parse has bad is array assert
https://bugs.webkit.org/show_bug.cgi?id=203207
<rdar://problem/56366913>

Reviewed by Yusuke Suzuki.

JSTests:

* stress/json-parse-array-prototype-is-array-assert.js: Added.
(assert):

Source/JavaScriptCore:

In r250860, we updated JSON.parse to be more spec compliant with how it
handles arrays. However, we also updated an assertion in an improper way,
where our assert was not accounting for the check we performed to take
that control flow path.

* runtime/JSONObject.cpp:
(JSC::Walker::walk):

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

9 months agoThrow the right exception upon memory exhaustion in Array::slice
rmorisset@apple.com [Mon, 21 Oct 2019 22:47:16 +0000 (22:47 +0000)]
Throw the right exception upon memory exhaustion in Array::slice
https://bugs.webkit.org/show_bug.cgi?id=202650

Reviewed by Saam Barati.

JSTests:

* stress/array-slice-memory-exhaustion.js: Added.
(foo):

Source/JavaScriptCore:

Trivial change: just use tryCreate instead of create, and throw an exception if it fails.
No security implication: we were just crashing instead of throwing a catchable exception.

* runtime/ArrayBuffer.cpp:
(JSC::ArrayBuffer::slice const):
(JSC::ArrayBuffer::sliceImpl const):
* runtime/ArrayBuffer.h:
* runtime/JSArrayBufferPrototype.cpp:
(JSC::arrayBufferProtoFuncSlice):

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

9 months agoResource Load Statistics: Update cookie blocking in NetworkStorageSession after first...
wilander@apple.com [Mon, 21 Oct 2019 22:33:47 +0000 (22:33 +0000)]
Resource Load Statistics: Update cookie blocking in NetworkStorageSession after first user interaction
https://bugs.webkit.org/show_bug.cgi?id=203195
<rdar://problem/56464567>

Reviewed by Alex Christensen and Chris Dumez.

Source/WebKit:

This change makes sure that the state of cookie blocking in
WebCore:: NetworkStorageSession is immediately updated if the logged
user interaction was new for this domain. It adds a completion
handler to WebResourceLoadStatisticsStore::logUserInteraction() so
that the call properly waits for everything to be updated.

* NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.cpp:
(WebKit::CompletionHandler<void):
* NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.h:
* NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.cpp:
(WebKit::ResourceLoadStatisticsMemoryStore::logUserInteraction):
* NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.h:
* NetworkProcess/Classifier/ResourceLoadStatisticsStore.h:
* NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp:
(WebKit::WebResourceLoadStatisticsStore::logUserInteraction):

LayoutTests:

This patch removes the explicit calls to testRunner.statisticsUpdateCookieBlocking() since
they are no longer needed. This makes sure the changed code is tested.

* http/tests/resourceLoadStatistics/third-party-cookie-blocking-on-sites-without-user-interaction-database.html:
* http/tests/resourceLoadStatistics/third-party-cookie-blocking-on-sites-without-user-interaction.html:

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

9 months agoDispatch AR event on the originating anchor element
dino@apple.com [Mon, 21 Oct 2019 22:31:49 +0000 (22:31 +0000)]
Dispatch AR event on the originating anchor element
https://bugs.webkit.org/show_bug.cgi?id=203198
<rdar://55743929>

Reviewed by Simon Fraser.

Source/WebCore:

Expose an ElementContext on the SystemPreviewInfo, so that
when something happens in the AR QuickLook an event can be
fired on the originating <a> element.

* dom/Document.cpp:
(WebCore::Document::dispatchSystemPreviewActionEvent): Make sure
we dispatch only to the HTMLAnchorElement.
* dom/Document.h:
* html/HTMLAnchorElement.cpp:
(WebCore::HTMLAnchorElement::handleClick):
* loader/FrameLoaderTypes.h:
(WebCore::SystemPreviewInfo::encode const):
(WebCore::SystemPreviewInfo::decode):
* testing/Internals.cpp:
(WebCore::Internals::elementIdentifier const):
* testing/Internals.h:
* testing/Internals.idl:

Source/WebKit:

Use the ElementContext on SystemPreviewInfo.

* UIProcess/API/Cocoa/WKWebView.mm:
(-[WKWebView _triggerSystemPreviewActionOnElement:frame:page:]):
(-[WKWebView _triggerSystemPreviewActionOnFrame:page:]): Deleted.
* UIProcess/API/Cocoa/WKWebViewPrivate.h:
* UIProcess/Cocoa/SystemPreviewControllerCocoa.mm:
* UIProcess/SystemPreviewController.h:
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::systemPreviewActionTriggered):

Tools:

Improve this test, most importantly so that it
actually works :)

Retrieve the ElementIdentifier for the <a> element,
and trigger a system preview action on it.

* TestWebKitAPI/Tests/WebKitCocoa/SystemPreview.mm:
(-[TestSystemPreviewTriggeredHandler userContentController:didReceiveScriptMessage:]):
(TestWebKitAPI::TEST):
* TestWebKitAPI/Tests/WebKitCocoa/system-preview-trigger.html:

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

9 months agoUnreviewed, re-enable a couple of passing layout tests
wenson_hsieh@apple.com [Mon, 21 Oct 2019 22:13:58 +0000 (22:13 +0000)]
Unreviewed, re-enable a couple of passing layout tests

* platform/ios/TestExpectations:
* platform/ipad/TestExpectations:

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

9 months agoMove ElementContext from WebKit to WebCore
dino@apple.com [Mon, 21 Oct 2019 22:12:01 +0000 (22:12 +0000)]
Move ElementContext from WebKit to WebCore
https://bugs.webkit.org/show_bug.cgi?id=203210
<rdar://problem/56475682>

Reviewed by Simon Fraser.

Source/WebCore:

* WebCore.xcodeproj/project.pbxproj:
* dom/RadioButtonGroups.h:

Source/WebKit:

* Scripts/webkit/messages.py:
* Shared/DocumentEditingContext.h:
* Shared/DocumentEditingContext.mm:
(IPC::ArgumentCoder<WebKit::DocumentEditingContextRequest>::decode):
* Shared/ElementContext.cpp: Removed.
* Shared/ElementContext.h: Removed.
* Shared/WebPreferencesDefaultValues.cpp:
(WebKit::defaultCSSOMViewScrollingAPIEnabled):
* Shared/WebsitePoliciesData.cpp:
(WebKit::WebsitePoliciesData::decode):
* Shared/ios/InteractionInformationAtPosition.h:
* Sources.txt:
* UIProcess/API/Cocoa/WKWebView.mm:
(-[WKWebView _requestTextInputContextsInRect:completionHandler:]):
* UIProcess/API/Cocoa/_WKTextInputContext.mm:
(-[_WKTextInputContext _initWithTextInputContext:]):
(-[_WKTextInputContext _textInputContext]):
* UIProcess/API/Cocoa/_WKTextInputContextInternal.h:
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::textInputContextsInRect):
(WebKit::WebPageProxy::focusTextInputContext):
* UIProcess/WebPageProxy.h:
* WebKit.xcodeproj/project.pbxproj:
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::textInputContextsInRect):
(WebKit::WebPage::focusTextInputContext):
(WebKit::WebPage::elementForContext const):
(WebKit::WebPage::contextForElement const):
* WebProcess/WebPage/WebPage.h:
* WebProcess/WebPage/WebPage.messages.in:
* WebProcess/WebPage/ios/WebPageIOS.mm:
(WebKit::WebPage::startInteractionWithElementContextOrPosition):

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

9 months agoediting/selection/ios/selection-handles-in-readonly-input.html times out
wenson_hsieh@apple.com [Mon, 21 Oct 2019 22:07:03 +0000 (22:07 +0000)]
editing/selection/ios/selection-handles-in-readonly-input.html times out
https://bugs.webkit.org/show_bug.cgi?id=203203
<rdar://problem/47710799>

Reviewed by Tim Horton.

This test began to fail in iOS 13, since we (intentionally) no longer show a keyboard when focusing `readonly`
inputs. The test is intended to verify that moving selection handles inside a readonly input field will not
cause the selection to disappear, but it currently waits forever for the keyboard to appear after initially
tapping a readonly input field.

We can fix this test by instead using a tap-and-half gesture to select the text ('aa').

* editing/selection/ios/selection-handles-in-readonly-input.html:

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

9 months agoWeb Inspector: REGRESSION(r251227): Uncaught Exception: undefined is not an object...
drousso@apple.com [Mon, 21 Oct 2019 22:05:06 +0000 (22:05 +0000)]
Web Inspector: REGRESSION(r251227): Uncaught Exception: undefined is not an object (evaluating 'agent.enable')
https://bugs.webkit.org/show_bug.cgi?id=203208

Reviewed by Joseph Pecoraro.

* UserInterface/Controllers/AppController.js:
(WI.AppController.prototype.activateExtraDomains):

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

9 months agoSetting border-radius on <video> element clips top and left sections of video
simon.fraser@apple.com [Mon, 21 Oct 2019 21:36:11 +0000 (21:36 +0000)]
Setting border-radius on <video> element clips top and left sections of video
https://bugs.webkit.org/show_bug.cgi?id=202049
<rdar://problem/55570024>

Reviewed by Dean Jackson.

Source/WebCore:

updateClippingStrategy() is called both when we're setting a mask layer on m_layer,
and on m_contentsClippingLayer, and they disagreed on the coordinate space that
the rounded rect was in. r246845 fixed rounded-rect scrollers, but broke video.

Fix by declaring that the rounded rect is relative to the bounds of the layer
argument. We don't try to size the shape layer to the rounded rect, because in some
configurations (e.g. scroller with left scrollbar) the rounded rect hangs outside
the clipping layer.

Test: compositing/video/video-border-radius-clipping.html

* platform/graphics/FloatRoundedRect.h:
(WebCore::FloatRoundedRect::setLocation):
* platform/graphics/ca/GraphicsLayerCA.cpp:
(WebCore::GraphicsLayerCA::updateClippingStrategy):
(WebCore::GraphicsLayerCA::updateContentsRects): The rounded rect is relative to the contentsClippingLayer,
so set its location to zero.
* rendering/RenderLayerBacking.cpp:
(WebCore::RenderLayerBacking::updateChildClippingStrategy): negate the offset, as we do in updateGeometry which
has similar code.

LayoutTests:

* compositing/video/video-border-radius-clipping-expected.html: Added.
* compositing/video/video-border-radius-clipping.html: Added.

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

9 months agoServiceWorker tests should use TCPServer instead of WKURLSchemeHandler
achristensen@apple.com [Mon, 21 Oct 2019 21:28:58 +0000 (21:28 +0000)]
ServiceWorker tests should use TCPServer instead of WKURLSchemeHandler
https://bugs.webkit.org/show_bug.cgi?id=203141

Reviewed by Youenn Fablet.

Source/WebCore:

This makes the tests more like what users will see,
and it allows us to not consult custom schemes when loading service workers,
which is preventing us from moving logic to the NetworkProcess.  See bug 203055.
Also, I now remove test-only code that's not used anymore.

* workers/service/server/SWServer.cpp:
(WebCore::SWServer::SWServer):
(WebCore::SWServer::canHandleScheme const):
* workers/service/server/SWServer.h:

Source/WebKit:

* NetworkProcess/NetworkProcess.cpp:
(WebKit::NetworkProcess::initializeNetworkProcess):
(WebKit::NetworkProcess::addWebsiteDataStore):
(WebKit::NetworkProcess::swServerForSession):
(WebKit::NetworkProcess::addServiceWorkerSession):
* NetworkProcess/NetworkProcess.h:
* Shared/WebsiteDataStoreParameters.cpp:
(WebKit::WebsiteDataStoreParameters::encode const):
(WebKit::WebsiteDataStoreParameters::decode):
* Shared/WebsiteDataStoreParameters.h:
* UIProcess/API/Cocoa/_WKWebsiteDataStoreConfiguration.h:
* UIProcess/API/Cocoa/_WKWebsiteDataStoreConfiguration.mm:
(-[_WKWebsiteDataStoreConfiguration registerURLSchemeServiceWorkersCanHandleForTesting:]): Deleted.
* UIProcess/WebProcessPool.cpp:
(WebKit::WebProcessPool::initializeNewWebProcess):
* UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm:
(WebKit::WebsiteDataStore::parameters):
* UIProcess/WebsiteData/WebsiteDataStoreConfiguration.cpp:
(WebKit::WebsiteDataStoreConfiguration::copy):
* UIProcess/WebsiteData/WebsiteDataStoreConfiguration.h:
(WebKit::WebsiteDataStoreConfiguration::serviceWorkerRegisteredSchemes const): Deleted.
(WebKit::WebsiteDataStoreConfiguration::registerServiceWorkerScheme): Deleted.

Tools:

* TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
* TestWebKitAPI/Tests/WebKitCocoa/ServiceWorkerBasic.mm:
(-[SWMessageHandlerForRestoreFromDiskTest userContentController:didReceiveScriptMessage:]):
(-[SWSchemes handledRequests]): Deleted.
(-[SWSchemes webView:startURLSchemeTask:]): Deleted.
(-[SWSchemes webView:stopURLSchemeTask:]): Deleted.
* TestWebKitAPI/Tests/WebKitCocoa/ServiceWorkerTCPServer.h: Added.
(ServiceWorkerTCPServer::ServiceWorkerTCPServer):
(ServiceWorkerTCPServer::request):
(ServiceWorkerTCPServer::requestWithLocalhost):
(ServiceWorkerTCPServer::requestWithFragment):
(ServiceWorkerTCPServer::userAgentsChecked):
(ServiceWorkerTCPServer::requestWithFormat):
* TestWebKitAPI/Tests/WebKitCocoa/StorageQuota.mm:
(-[StorageSchemes webView:startURLSchemeTask:]): Deleted.
(-[StorageSchemes webView:stopURLSchemeTask:]): Deleted.

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

9 months agoPython 3: Add support in webkitpy.common.config
jbedard@apple.com [Mon, 21 Oct 2019 21:17:14 +0000 (21:17 +0000)]
Python 3: Add support in webkitpy.common.config
https://bugs.webkit.org/show_bug.cgi?id=202463

Reviewed by Dewei Zhu.

* Scripts/test-webkitpy-python3: Add webkitpy.common.config to the test list.
* Scripts/webkitpy/common/config/committers.py:
(Contributor.__init__): Convert lists to maps.
(Contributor.__str__): __str__ will always return the native string type.
(Contributor.__unicode__): Use .format() string.
(CommitterList._exclusive_contributors): Convert filter to list.
(CommitterList._exclusive_committers): Ditto.
(CommitterList.contributors_by_search_string): Ditto.
* Scripts/webkitpy/common/config/committervalidator_unittest.py: Use full import paths.
* Scripts/webkitpy/common/config/contributionareas_unittest.py: Use full import paths.
* Scripts/webkitpy/common/config/ports.py:
(DeprecatedPort.makeArgs): Use 'in' instead of has_key.
* Scripts/webkitpy/common/config/urls_unittest.py:
* Scripts/webkitpy/common/unicode_compatibility.py:
(encode_for): Encode string for type.
* Scripts/webkitpy/thirdparty/BeautifulSoup.py: Make html5lib import auto-install compatible.
* Scripts/webkitpy/thirdparty/__init__.py:
(AutoinstallImportHook.find_module): Add html5lib.
(AutoinstallImportHook._install_html5lib): Make html5lib a stand-alone installed package.
(AutoinstallImportHook._install_mechanize): Install html5lib.
(AutoinstallImportHook._install_beautifulsoup): Ditto.

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

9 months agomacCatalyst: Swipe navigation gestures do not work
timothy_horton@apple.com [Mon, 21 Oct 2019 21:16:21 +0000 (21:16 +0000)]
macCatalyst: Swipe navigation gestures do not work
https://bugs.webkit.org/show_bug.cgi?id=203205
<rdar://problem/54617473>

Reviewed by Wenson Hsieh.

Source/WebKit:

* UIProcess/ios/ViewGestureControllerIOS.mm:
(-[WKSwipeTransitionController gestureRecognizerForInteractiveTransition:WithTarget:action:]):
Use a different gesture recognizer for swipe in macCatalyst that behaves
more like the macOS implementation, based on scrolling instead of the
gesture coming from a screen edge.

Source/WTF:

* wtf/Platform.h:
Add a new HAVE.

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

9 months agoAdd some PencilKit extension points
dbates@webkit.org [Mon, 21 Oct 2019 21:07:38 +0000 (21:07 +0000)]
Add some PencilKit extension points
https://bugs.webkit.org/show_bug.cgi?id=202962
<rdar://problem/56269759>

Reviewed by Andy Estes.

This is the WebKit part corresponding to <rdar://problem/56261392>.

* UIProcess/ios/WKContentViewInteraction.mm:
(-[WKContentView setupInteraction]): Call extension point.
(-[WKContentView cleanupInteraction]): Ditto.

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

9 months agoUpdate expected result for fast/repaint/placeholder-after-caps-lock-hidden.html
dbates@webkit.org [Mon, 21 Oct 2019 20:47:03 +0000 (20:47 +0000)]
Update expected result for fast/repaint/placeholder-after-caps-lock-hidden.html
https://bugs.webkit.org/show_bug.cgi?id=203005
<rdar://problem/51826131>

Reviewed by Simon Fraser.

Rebase iOS result. The test fast/repaint/placeholder-after-caps-lock-hidden.html is only supported
in Modern WebKit and only on Mac and iOS, which implement uiController.toggleCapsLock(), at the time
of writing.

* platform/ios-wk2/TestExpectations: Mark test as PASS.
* platform/ios-wk2/fast/repaint/placeholder-after-caps-lock-hidden-expected.txt:
* platform/ios/TestExpectations: Remove entry so that we fallback to platform-independent TestExpectations
and skip the test because the test is only supported on Modern WebKit.
* platform/ios/fast/events/ios/placeholder-after-caps-lock-hidden-expected.txt: Removed; erroneously added
file for non-existent test.

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

9 months agoWeb Inspector: Provide a flag for technology preview builds
joepeck@webkit.org [Mon, 21 Oct 2019 20:43:00 +0000 (20:43 +0000)]
Web Inspector: Provide a flag for technology preview builds
https://bugs.webkit.org/show_bug.cgi?id=203164
<rdar://problem/56202164>

Reviewed by Devin Rousso.

Source/WebCore:

* inspector/InspectorFrontendHost.cpp:
(WebCore::InspectorFrontendHost::isExperimentalBuild):
* inspector/InspectorFrontendHost.h:
* inspector/InspectorFrontendHost.idl:

Source/WebInspectorUI:

* Localizations/en.lproj/localizedStrings.js:

* UserInterface/Test/Test.js:
* UserInterface/Base/Main.js:
* UserInterface/Base/Setting.js:
(WI.isTechnologyPreviewBuild):
(WI.arePreviewFeaturesEnabled):
* UserInterface/Views/SettingsTabContentView.js:
(WI.SettingsTabContentView.prototype._createExperimentalSettingsView):
In non-TechnologyPreview builds, if there are Preview Features provide a
setting switch that can be used to match the TechnologyPreview features.

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

9 months ago[SVG2]: Add 'auto' behavior to the 'width' and 'height' properties of the SVG <image...
commit-queue@webkit.org [Mon, 21 Oct 2019 20:25:49 +0000 (20:25 +0000)]
[SVG2]: Add 'auto' behavior to the 'width' and 'height' properties of the SVG <image> element
https://bugs.webkit.org/show_bug.cgi?id=202013

Patch by Said Abou-Hallawa <sabouhallawa@apple.com> on 2019-10-21
Reviewed by Simon Fraser.

LayoutTests/imported/w3c:

* web-platform-tests/svg/geometry/svg-image-intrinsic-size-with-cssstyle-auto-dynamic-image-change-expected.txt:
* web-platform-tests/svg/geometry/svg-image-intrinsic-size-with-cssstyle-auto-expected.txt:

Source/WebCore:

The spec page is: https://www.w3.org/TR/SVG/geometry.html#Sizing

Handle the case if the 'width' or the 'height' of an SVG <image> or both
are missing.

Tests: svg/custom/image-width-height-auto-dynamic.svg
       svg/custom/image-width-height-auto-initial.svg
       svg/custom/image-width-height-length-initial.svg

* rendering/svg/RenderSVGImage.cpp:
(WebCore::RenderSVGImage::calculateObjectBoundingBox const):
(WebCore::RenderSVGImage::updateImageViewport):
* rendering/svg/RenderSVGImage.h:

LayoutTests:

* svg/custom/image-width-height-auto-dynamic-expected.svg: Added.
* svg/custom/image-width-height-auto-dynamic.svg: Added.
* svg/custom/image-width-height-auto-initial-expected.svg: Added.
* svg/custom/image-width-height-auto-initial.svg: Added.
* svg/custom/image-width-height-length-initial-expected.svg: Added.
* svg/custom/image-width-height-length-initial.svg: Added.
* svg/custom/resources/100x200-green.png: Added.

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

9 months ago[Clipboard API] Implement ClipboardItem.getType() for platform clipboard items
wenson_hsieh@apple.com [Mon, 21 Oct 2019 20:19:53 +0000 (20:19 +0000)]
[Clipboard API] Implement ClipboardItem.getType() for platform clipboard items
https://bugs.webkit.org/show_bug.cgi?id=203168

Reviewed by Tim Horton.

Source/WebCore:

This patch completes support for ClipboardItem.getType().

Tests:  editing/async-clipboard/clipboard-change-data-while-getting-type.html
        editing/async-clipboard/clipboard-get-type-with-old-items.html
        editing/async-clipboard/clipboard-item-get-type-basic.html
        ClipboardTests.ReadMultipleItems

* Modules/async-clipboard/Clipboard.cpp:
(WebCore::Clipboard::getType):

Implement getType(). If the given clipboard item is being tracked as one of the active clipboard items, then
allow it to read data from the platform pasteboard. We use existing pasteboard reading methods and classes
(PasteboardPlainText and WebContentMarkupReader) to ask the platform pasteboard for text and markup data,
respectively, and go through readURL() for "text/uri-list".

Before exposing any data to the page, we additionally check that the change count of the pasteboard is still
what we started with when setting up the current session. If this is not the case, we reject the promise and
immediately clear out the session.

(WebCore::Clipboard::activePasteboard):
* Modules/async-clipboard/Clipboard.h:
* dom/DataTransfer.h:

Drive-by tweak: make the WebContentReadingPolicy enum class narrower.

* platform/Pasteboard.h:

Add an enum flag for allowing or ignoring the platform URL type when reading plain text from the platform
pasteboard. We use this in Clipboard::getType() to ignore URLs on the platform pasteboard when plain text, since
the plain text reader would otherwise prefer URLs over plain text by default, and read the URL type instead of
the plain text type.

* platform/StaticPasteboard.h:
* platform/gtk/PasteboardGtk.cpp:
(WebCore::Pasteboard::read):
* platform/ios/PasteboardIOS.mm:
(WebCore::Pasteboard::read):
* platform/libwpe/PasteboardLibWPE.cpp:
(WebCore::Pasteboard::read):
* platform/mac/PasteboardMac.mm:
(WebCore::Pasteboard::read):
* platform/win/PasteboardWin.cpp:
(WebCore::Pasteboard::read):

Tools:

Add support for the new layout tests, as well as a new API test.

* DumpRenderTree/ios/UIScriptControllerIOS.h:
* DumpRenderTree/ios/UIScriptControllerIOS.mm:
(WTR::UIScriptControllerIOS::copyText):

Implement UIScriptController.copyText in WebKit1. This is used in one of the new layout tests, which passes in
WebKit1 on macOS and iOS.

* DumpRenderTree/mac/DumpRenderTreePasteboard.mm:
(-[LocalPasteboard declareTypes:owner:]):
(-[LocalPasteboard addTypes:owner:]):
(-[LocalPasteboard _addTypesWithoutUpdatingChangeCount:owner:]):

Adjust logic when declaring types on the platform pasteboard, such that it behaves more like the platform; when
declaring types, even if the owner doesn't change, the change count should still get bumped up by 1.

* DumpRenderTree/mac/UIScriptControllerMac.h:
* DumpRenderTree/mac/UIScriptControllerMac.mm:
(WTR::UIScriptControllerMac::copyText):
* TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
* TestWebKitAPI/Tests/WebKitCocoa/ClipboardTests.mm: Added.
(-[TestWKWebView readClipboard]):
(createWebViewForClipboardTests):
(writeMultipleObjectsToPlatformPasteboard):

Add a new API test to verify that clipboard items contain the right data when writing multiple items (each with
different sets of types) to the platform pasteboard using native APIs.

* TestWebKitAPI/Tests/WebKitCocoa/clipboard.html: Added.
* WebKitTestRunner/mac/WebKitTestRunnerPasteboard.mm:
(-[LocalPasteboard declareTypes:owner:]):
(-[LocalPasteboard addTypes:owner:]):
(-[LocalPasteboard _addTypesWithoutUpdatingChangeCount:owner:]):

LayoutTests:

Add 3 new layout tests.

* editing/async-clipboard/clipboard-change-data-while-getting-type-expected.txt: Added.
* editing/async-clipboard/clipboard-change-data-while-getting-type.html: Added.

Add a layout test to verify that if the pasteboard changes right after the page has obtained clipboard items,
the page should not be able to fetch the new contents of the pasteboard using these clipboard items.

* editing/async-clipboard/clipboard-get-type-with-old-items.html: Added.
* editing/async-clipboard/clipboard-get-type-with-old-items-expected.txt: Added.

Add a layout test to verify that after attempting to get data from invalid (stale) items, the page is still
capable of reading data from valid clipboard items.

* editing/async-clipboard/clipboard-item-get-type-basic-expected.txt: Added.
* editing/async-clipboard/clipboard-item-get-type-basic.html: Added.

Add a layout test to verify that after writing multiple types to the clipboard using the DataTransfer API, we
should be able to read them back using the async clipboard API, as a single ClipboardItem, and also get data out
of the clipboard item using ClipboardItem.getType.

* editing/async-clipboard/resources/async-clipboard-helpers.js:
* platform/win/TestExpectations:
* resources/ui-helper.js:
(window.UIHelper.async.copyText):
(window.UIHelper):

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

9 months agoWeb Inspector: replace all uses of `window.*Agent` with a target-specific call
drousso@apple.com [Mon, 21 Oct 2019 20:09:25 +0000 (20:09 +0000)]
Web Inspector: replace all uses of `window.*Agent` with a target-specific call
https://bugs.webkit.org/show_bug.cgi?id=201149

Reviewed by Matt Baker.

Most of these were changed in r251227, but a few appear to have slipped through the cracks.

* UserInterface/Controllers/DebuggerManager.js:
(WI.DebuggerManager.prototype.debuggerDidResume):
* UserInterface/Views/SourceCodeTextEditor.js:
(WI.SourceCodeTextEditor.prototype._createTypeTokenAnnotator):
(WI.SourceCodeTextEditor.prototype._createBasicBlockAnnotator):

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

9 months agoscrollingcoordinator/ios/ui-scrolling-tree.html is a Flaky Failure on iPad
simon.fraser@apple.com [Mon, 21 Oct 2019 20:00:24 +0000 (20:00 +0000)]
scrollingcoordinator/ios/ui-scrolling-tree.html is a Flaky Failure on iPad
https://bugs.webkit.org/show_bug.cgi?id=203119
rdar://problem/52970947

Reviewed by Wenson Hsieh.

iPad viewport heuristics (WebPage::immediatelyShrinkToFitContent()) run on a zero-delay
timer after page load, which races with this test getting the UI-side scrolling tree
and makes the test flakey.

Fix by turning off the heuristics with "contentMode=mobile". Also fix the test
to use UIHelper to get the scrolling tree.

* platform/ipad/TestExpectations:
* platform/ipad/scrollingcoordinator/ios/ui-scrolling-tree-expected.txt:
* scrollingcoordinator/ios/ui-scrolling-tree.html:

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

9 months agoPython 3: Add support in webkitpy.common.net
jbedard@apple.com [Mon, 21 Oct 2019 19:34:53 +0000 (19:34 +0000)]
Python 3: Add support in webkitpy.common.net
https://bugs.webkit.org/show_bug.cgi?id=202464

Reviewed by Dewei Zhu.

* Scripts/test-webkitpy-python3: Add webkitpy.common.net.
* Scripts/webkitpy/common/net/credentials_unittest.py: Replace raw_input with input for Python3.
* Scripts/webkitpy/common/net/ewsserver.py:
* Scripts/webkitpy/common/net/resultsjsonparser.py:
(ParsedJSONResults.__init__): Sort results by test name.
* Scripts/webkitpy/common/net/resultsjsonparser_unittest.py:
(test_basic): Sort results by test name.
* Scripts/webkitpy/common/net/statusserver.py:
(StatusServer._fetch_url):
* Scripts/webkitpy/common/net/unittestresults_unittest.py:

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

9 months ago[WinCairo][PlayStation] Add automation support for RemoteInspector SocketServer imple...
Basuke.Suzuki@sony.com [Mon, 21 Oct 2019 19:25:52 +0000 (19:25 +0000)]
[WinCairo][PlayStation] Add automation support for RemoteInspector SocketServer implementation.
https://bugs.webkit.org/show_bug.cgi?id=199070

Reviewed by Ross Kirsling.

Added handler for StartAutomationSession event from WebDriver and preparing for automation session.

* inspector/remote/RemoteInspector.h:
* inspector/remote/socket/RemoteInspectorSocket.cpp:
(Inspector::RemoteInspector::listingForAutomationTarget const):
(Inspector::RemoteInspector::sendAutomaticInspectionCandidateMessage):
(Inspector::RemoteInspector::requestAutomationSession):
(Inspector::RemoteInspector::dispatchMap):
(Inspector::RemoteInspector::startAutomationSession):

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

9 months agoRemove all uses of untagCodePtr in debugging code.
mark.lam@apple.com [Mon, 21 Oct 2019 19:15:26 +0000 (19:15 +0000)]
Remove all uses of untagCodePtr in debugging code.
https://bugs.webkit.org/show_bug.cgi?id=203188
<rdar://problem/56453043>

Reviewed by Yusuke Suzuki.

Source/JavaScriptCore:

* runtime/JSCPtrTag.cpp:
(JSC::tagForPtr):

Source/WTF:

We want the ability to always assert on failure to authenticate in untagCodePtr
(though we don't currently do that yet).

* wtf/PtrTag.cpp:
(WTF::tagForPtr):
* wtf/PtrTag.h:
(WTF::retagCodePtrImpl):
(WTF::tagCFunctionPtrImpl):
(WTF::untagCFunctionPtrImpl):
(WTF::assertIsCFunctionPtr):
(WTF::isTaggedWith):

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

9 months agoPost increment/decrement should only call ToNumber once
rmorisset@apple.com [Mon, 21 Oct 2019 19:06:48 +0000 (19:06 +0000)]
Post increment/decrement should only call ToNumber once
https://bugs.webkit.org/show_bug.cgi?id=202711

Reviewed by Saam Barati.

JSTests:

* stress/postinc-custom-valueOf.js: Added.
(postInc):
(postDec):

Source/JavaScriptCore:

The problem is that we first called ToNumber on the object being incremented (to have the result that we'll eventually return), but we then do emitIncOrDec on the original object, which can call ToNumber again.
Instead we must do the ToNumber once, then copy its result, emitIncOrDec on the copy, put the copy back in the original location, and finally return the old value.
Since the result of ToNumber is guaranteed not to be an object, emitIncOrDec won't call ToNumber a second time.

* bytecompiler/NodesCodegen.cpp:
(JSC::emitPostIncOrDec):

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

9 months agoAdd more release logging for "Unexpectedly resumed" assertion
cdumez@apple.com [Mon, 21 Oct 2019 18:59:22 +0000 (18:59 +0000)]
Add more release logging for "Unexpectedly resumed" assertion
https://bugs.webkit.org/show_bug.cgi?id=203196

Reviewed by Geoffrey Garen.

* WebProcess/WebProcess.cpp:
(WebKit::WebProcess::processDidResume):
* WebProcess/cocoa/WebProcessCocoa.mm:
(WebKit::WebProcess::processTaskStateDidChange):

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

9 months ago[iOS WK2] Support hiding iframe scrollbars via ::-webkit-scrollbar style
simon.fraser@apple.com [Mon, 21 Oct 2019 18:59:09 +0000 (18:59 +0000)]
[iOS WK2] Support hiding iframe scrollbars via ::-webkit-scrollbar style
https://bugs.webkit.org/show_bug.cgi?id=203178

Reviewed by Dean Jackson.
Source/WebCore:

::-webkit-scrollbar {
    display: none;
}
is supported for overflow:scroll, but not for iframes. To make the latter work,
two fixes were necessary.

First, FrameView had to implement horizontalScrollbarHiddenByStyle()/verticalScrollbarHiddenByStyle().
This is a little tricky on iOS because we never create RenderScrollbars, so we have to consult
pseudo-styles directly; a bit of refactoring makes that cleaner.

Second, ScrollableAreaParameters was failing to check horizontalScrollbarHiddenByStyle/verticalScrollbarHiddenByStyle
in operator==, meaning that these data often didn't make it to the UI process.

Test: fast/scrolling/ios/scrollbar-hiding-iframes.html

* page/FrameView.cpp:
(WebCore::FrameView::rootElementForCustomScrollbarPartStyle const):
(WebCore::FrameView::createScrollbar):
(WebCore::FrameView::styleHidesScrollbarWithOrientation const):
(WebCore::FrameView::horizontalScrollbarHiddenByStyle const):
(WebCore::FrameView::verticalScrollbarHiddenByStyle const):
(WebCore::FrameView::updateScrollCorner):
* page/FrameView.h:
* page/scrolling/ScrollingCoordinatorTypes.h:
(WebCore::ScrollableAreaParameters::operator== const):
* platform/Scrollbar.h:
(WebCore::Scrollbar::isHiddenByStyle const):
* rendering/RenderLayer.cpp:
(WebCore::scrollbarHiddenByStyle):
* rendering/RenderScrollbar.cpp:
(WebCore::RenderScrollbar::getScrollbarPseudoStyle const):
(WebCore::RenderScrollbar::isHiddenByStyle const):
(WebCore::RenderScrollbar::getScrollbarPseudoStyle): Deleted.
* rendering/RenderScrollbar.h:

LayoutTests:

Tests that dumps the scrolling tree.

* fast/scrolling/ios/scrollbar-hiding-iframes-expected.txt: Added.
* fast/scrolling/ios/scrollbar-hiding-iframes.html: Added.

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

9 months agoEWS should have a way to retry a patch
aakash_jain@apple.com [Mon, 21 Oct 2019 18:34:45 +0000 (18:34 +0000)]
EWS should have a way to retry a patch
https://bugs.webkit.org/show_bug.cgi?id=196599

Reviewed by Jonathan Bedard.

* BuildSlaveSupport/ews-app/ews/models/build.py:
(Build): Add the retried field to keep track of whether a build is requested to be retried or not.
(Build.set_retried): Method to set the retried field.
* BuildSlaveSupport/ews-app/ews/templates/statusbubble.html: Added the 'Retry failed builds' button.
* BuildSlaveSupport/ews-app/ews/views/retrypatch.py:
(RetryPatch.post): Added a check if the build is already retried. Also, set the retried flag appropriately.
* BuildSlaveSupport/ews-app/ews/views/statusbubble.py:
(StatusBubble._build_bubble): Updated the status-bubble to in-progress while waiting for build to be retried.
(StatusBubble._build_bubbles_for_patch): Display the retry button only if there are failed builds.
* BuildSlaveSupport/ews-app/ews/migrations/0002_build_retried.py: Added database migration.

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

9 months agoShare code between AudioDestinationIOS and AudioDestinationMac
youenn@apple.com [Mon, 21 Oct 2019 16:29:06 +0000 (16:29 +0000)]
Share code between AudioDestinationIOS and AudioDestinationMac
https://bugs.webkit.org/show_bug.cgi?id=203047
<rdar://problem/56340866>

Reviewed by Eric Carlson.

Source/WebCore:

Introduce AudioDestinationCocoa to share code between iOS and Mac.
Most code is now shared, except for the configuration of the audio unit which is slightly different between Mac and iOS.

Introduce MockAudioDestinationCocoa to allow more code coverage of the shared code.
This could also allow us to validate dynamic changes in frame rate, number of frames to process...
Add Internals API to enable the mock destination.

Covered by added test.

* SourcesCocoa.txt:
* WebCore.xcodeproj/project.pbxproj:
* platform/audio/cocoa/AudioDestinationCocoa.cpp: Added.
(WebCore::AudioDestination::create):
(WebCore::AudioDestination::hardwareSampleRate):
(WebCore::AudioDestination::maxChannelCount):
(WebCore::AudioDestinationCocoa::AudioDestinationCocoa):
(WebCore::AudioDestinationCocoa::~AudioDestinationCocoa):
(WebCore::AudioDestinationCocoa::start):
(WebCore::AudioDestinationCocoa::stop):
(WebCore::AudioDestinationCocoa::setIsPlaying):
(WebCore::AudioDestinationCocoa::setAudioStreamBasicDescription):
(WebCore::assignAudioBuffersToBus):
(WebCore::AudioDestinationCocoa::render):
(WebCore::AudioDestinationCocoa::inputProc):
* platform/audio/cocoa/AudioDestinationCocoa.h: Added.
(WebCore::AudioDestinationCocoa::outputUnit):
* platform/audio/ios/AudioDestinationIOS.cpp:
(WebCore::AudioDestinationCocoa::configure):
(WebCore::AudioDestinationCocoa::processBusAfterRender):
* platform/audio/ios/AudioDestinationIOS.h: Removed.
* platform/audio/mac/AudioDestinationMac.cpp:
(WebCore::AudioDestinationCocoa::configure):
(WebCore::AudioDestinationCocoa::processBusAfterRender):
* platform/audio/mac/AudioDestinationMac.h: Removed.
* platform/mock/MockAudioDestinationCocoa.cpp: Added.
(WebCore::MockAudioDestinationCocoa::MockAudioDestinationCocoa):
(WebCore::MockAudioDestinationCocoa::start):
(WebCore::MockAudioDestinationCocoa::stop):
(WebCore::MockAudioDestinationCocoa::tick):
* platform/mock/MockAudioDestinationCocoa.h: Added.
* testing/Internals.cpp:
(WebCore::Internals::Internals):
(WebCore::Internals::useMockAudioDestinationCocoa):
* testing/Internals.h:
* testing/Internals.idl:

LayoutTests:

* fast/mediastream/getUserMedia-webaudio-expected.txt:
* fast/mediastream/getUserMedia-webaudio.html:

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

9 months agoXMLHttpRequest should not prevent entering the back/forward cache
cdumez@apple.com [Mon, 21 Oct 2019 15:17:19 +0000 (15:17 +0000)]
XMLHttpRequest should not prevent entering the back/forward cache
https://bugs.webkit.org/show_bug.cgi?id=203107
<rdar://problem/56438647>

Reviewed by Youenn Fablet.

LayoutTests/imported/w3c:

Rebaseline a new WPT tests that are passing now that we properly check that the
Document is fully active in open().

* web-platform-tests/xhr/open-url-multi-window-2-expected.txt:
* web-platform-tests/xhr/open-url-multi-window-5-expected.txt:
* web-platform-tests/xhr/open-url-multi-window-6-expected.txt:

Source/WebCore:

Improve XMLHttpRequest for back/forward cache suspension:
1. We no longer cancel pending loads in the suspend() method as this may
   fire events.
2. Simplify XMLHttpRequestProgressEventThrottle to use SuspendableTimers
   to dispatch events that are deferred by suspension or throttling.

Test: http/tests/navigation/page-cache-xhr-in-loading-iframe.html

* xml/XMLHttpRequest.cpp:
(WebCore::XMLHttpRequest::XMLHttpRequest):
(WebCore::XMLHttpRequest::open):
Add check to throw a InvalidStateError if the associated document is not fully active,
as per https://xhr.spec.whatwg.org/#dom-xmlhttprequest-open (Step 2). This avoids
dispatching events after ActiveDOMObject::stop() has been called and brings a few more
passes on WPT tests.

(WebCore::XMLHttpRequest::dispatchEvent):
(WebCore::XMLHttpRequest::suspend):
(WebCore::XMLHttpRequest::resume):
(WebCore::XMLHttpRequest::shouldPreventEnteringBackForwardCache_DEPRECATED const): Deleted.
(WebCore::XMLHttpRequest::resumeTimerFired): Deleted.
* xml/XMLHttpRequest.h:
* xml/XMLHttpRequestProgressEventThrottle.cpp:
(WebCore::XMLHttpRequestProgressEventThrottle::XMLHttpRequestProgressEventThrottle):
(WebCore::XMLHttpRequestProgressEventThrottle::dispatchThrottledProgressEvent):
(WebCore::XMLHttpRequestProgressEventThrottle::dispatchReadyStateChangeEvent):
(WebCore::XMLHttpRequestProgressEventThrottle::dispatchEventWhenPossible):
(WebCore::XMLHttpRequestProgressEventThrottle::dispatchProgressEvent):
(WebCore::XMLHttpRequestProgressEventThrottle::flushProgressEvent):
(WebCore::XMLHttpRequestProgressEventThrottle::dispatchDeferredEventsAfterResuming):
(WebCore::XMLHttpRequestProgressEventThrottle::dispatchThrottledProgressEventTimerFired):
(WebCore::XMLHttpRequestProgressEventThrottle::suspend):
(WebCore::XMLHttpRequestProgressEventThrottle::resume):
(WebCore::XMLHttpRequestProgressEventThrottle::dispatchEvent): Deleted.
(WebCore::XMLHttpRequestProgressEventThrottle::dispatchDeferredEvents): Deleted.
(WebCore::XMLHttpRequestProgressEventThrottle::fired): Deleted.
(WebCore::XMLHttpRequestProgressEventThrottle::hasEventToDispatch const): Deleted.
* xml/XMLHttpRequestProgressEventThrottle.h:

LayoutTests:

Add more test coverage.

* TestExpectations:
* fast/dom/xmlhttprequest-constructor-in-detached-document-expected.txt:
* fast/xmlhttprequest/xmlhttprequest-open-after-iframe-onload-remove-self.html:
* http/tests/navigation/page-cache-xhr-in-loading-iframe-expected.txt: Added.
* http/tests/navigation/page-cache-xhr-in-loading-iframe.html: Added.
* http/tests/navigation/resources/page-cache-xhr-in-loading-iframe.html: Added.

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

9 months ago[MSE][GStreamer] Revert WebKitMediaSrc rework temporarily
aboya@igalia.com [Mon, 21 Oct 2019 13:28:49 +0000 (13:28 +0000)]
[MSE][GStreamer] Revert WebKitMediaSrc rework temporarily
https://bugs.webkit.org/show_bug.cgi?id=203078

Reviewed by Carlos Garcia Campos.

.:

* Source/cmake/GStreamerChecks.cmake:

Source/WebCore:

While the WebKitMediaSrc rework fixed a number of tests and introduced
design improvements in MSE, it also exposed a number of bugs related
to the playbin3 switch.

Fixing these has been turned tricky, so in order to not keep known
user-facing bugs, I'm reverting it for now until a workable solution
is available.

* platform/GStreamer.cmake:
* platform/graphics/gstreamer/GRefPtrGStreamer.cpp:
(WTF::refGPtr<GstMiniObject>): Deleted.
(WTF::derefGPtr<GstMiniObject>): Deleted.
* platform/graphics/gstreamer/GRefPtrGStreamer.h:
* platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
(WebCore::MediaPlayerPrivateGStreamer::playbackPosition const):
(WebCore::MediaPlayerPrivateGStreamer::changePipelineState):
(WebCore::MediaPlayerPrivateGStreamer::paused const):
(WebCore::MediaPlayerPrivateGStreamer::updateTracks):
(WebCore::MediaPlayerPrivateGStreamer::enableTrack):
(WebCore::MediaPlayerPrivateGStreamer::notifyPlayerOfVideo):
(WebCore::MediaPlayerPrivateGStreamer::videoSinkCapsChangedCallback):
(WebCore::MediaPlayerPrivateGStreamer::notifyPlayerOfVideoCaps):
(WebCore::MediaPlayerPrivateGStreamer::sourceSetup):
(WebCore::MediaPlayerPrivateGStreamer::handleSyncMessage):
(WebCore::MediaPlayerPrivateGStreamer::createGSTPlayBin):
* platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h:
(WebCore::MediaPlayerPrivateGStreamer::configurePlaySink):
(WebCore::MediaPlayerPrivateGStreamer::invalidateCachedPosition): Deleted.
* platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
(WebCore::MediaPlayerPrivateGStreamerBase::naturalSize const):
(WebCore::MediaPlayerPrivateGStreamerBase::sizeChanged):
(WebCore::MediaPlayerPrivateGStreamerBase::triggerRepaint):
(WebCore::MediaPlayerPrivateGStreamerBase::naturalSizeFromCaps const): Deleted.
(WebCore::MediaPlayerPrivateGStreamerBase::doSamplesHaveDifferentNaturalSizes const): Deleted.
* platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.h:
* platform/graphics/gstreamer/MediaSampleGStreamer.cpp:
(WebCore::MediaSampleGStreamer::MediaSampleGStreamer):
* platform/graphics/gstreamer/mse/AppendPipeline.cpp:
(WebCore::AppendPipeline::appsinkNewSample):
(WebCore::AppendPipeline::connectDemuxerSrcPadToAppsink):
* platform/graphics/gstreamer/mse/AppendPipeline.h:
(WebCore::AppendPipeline::appsinkCaps):
(WebCore::AppendPipeline::track):
(WebCore::AppendPipeline::streamType):
* platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.cpp:
(WebCore::MediaPlayerPrivateGStreamerMSE::~MediaPlayerPrivateGStreamerMSE):
(WebCore::MediaPlayerPrivateGStreamerMSE::load):
(WebCore::MediaPlayerPrivateGStreamerMSE::pause):
(WebCore::MediaPlayerPrivateGStreamerMSE::seek):
(WebCore::MediaPlayerPrivateGStreamerMSE::configurePlaySink):
(WebCore::MediaPlayerPrivateGStreamerMSE::changePipelineState):
(WebCore::MediaPlayerPrivateGStreamerMSE::notifySeekNeedsDataForTime):
(WebCore::MediaPlayerPrivateGStreamerMSE::doSeek):
(WebCore::MediaPlayerPrivateGStreamerMSE::maybeFinishSeek):
(WebCore::MediaPlayerPrivateGStreamerMSE::updatePlaybackRate):
(WebCore::MediaPlayerPrivateGStreamerMSE::seeking const):
(WebCore::MediaPlayerPrivateGStreamerMSE::setReadyState):
(WebCore::MediaPlayerPrivateGStreamerMSE::waitForSeekCompleted):
(WebCore::MediaPlayerPrivateGStreamerMSE::seekCompleted):
(WebCore::MediaPlayerPrivateGStreamerMSE::sourceSetup):
(WebCore::MediaPlayerPrivateGStreamerMSE::updateStates):
(WebCore::MediaPlayerPrivateGStreamerMSE::asyncStateChangeDone):
(WebCore::MediaPlayerPrivateGStreamerMSE::mediaSourceClient):
(WebCore::MediaPlayerPrivateGStreamerMSE::unblockDurationChanges):
(WebCore::MediaPlayerPrivateGStreamerMSE::durationChanged):
(WebCore::MediaPlayerPrivateGStreamerMSE::trackDetected):
(WebCore::MediaPlayerPrivateGStreamerMSE::markEndOfStream):
(WebCore::MediaPlayerPrivateGStreamerMSE::currentMediaTime const):
(WebCore::MediaPlayerPrivateGStreamerMSE::play): Deleted.
(WebCore::MediaPlayerPrivateGStreamerMSE::reportSeekCompleted): Deleted.
(WebCore::MediaPlayerPrivateGStreamerMSE::didEnd): Deleted.
* platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.h:
* platform/graphics/gstreamer/mse/MediaSourceClientGStreamerMSE.cpp:
(WebCore::MediaSourceClientGStreamerMSE::addSourceBuffer):
(WebCore::MediaSourceClientGStreamerMSE::markEndOfStream):
(WebCore::MediaSourceClientGStreamerMSE::removedFromMediaSource):
(WebCore::MediaSourceClientGStreamerMSE::flush):
(WebCore::MediaSourceClientGStreamerMSE::enqueueSample):
(WebCore::MediaSourceClientGStreamerMSE::allSamplesInTrackEnqueued):
(WebCore::MediaSourceClientGStreamerMSE::isReadyForMoreSamples): Deleted.
(WebCore::MediaSourceClientGStreamerMSE::notifyClientWhenReadyForMoreSamples): Deleted.
* platform/graphics/gstreamer/mse/MediaSourceClientGStreamerMSE.h:
* platform/graphics/gstreamer/mse/MediaSourceGStreamer.cpp:
(WebCore::MediaSourceGStreamer::markEndOfStream):
(WebCore::MediaSourceGStreamer::unmarkEndOfStream):
(WebCore::MediaSourceGStreamer::waitForSeekCompleted):
(WebCore::MediaSourceGStreamer::seekCompleted):
* platform/graphics/gstreamer/mse/MediaSourceGStreamer.h:
* platform/graphics/gstreamer/mse/PlaybackPipeline.cpp: Added.
(getStreamByTrackId):
(getStreamBySourceBufferPrivate):
(pushSample):
(WebCore::PlaybackPipeline::setWebKitMediaSrc):
(WebCore::PlaybackPipeline::webKitMediaSrc):
(WebCore::PlaybackPipeline::addSourceBuffer):
(WebCore::PlaybackPipeline::removeSourceBuffer):
(WebCore::PlaybackPipeline::attachTrack):
(WebCore::PlaybackPipeline::reattachTrack):
(WebCore::PlaybackPipeline::notifyDurationChanged):
(WebCore::PlaybackPipeline::markEndOfStream):
(WebCore::PlaybackPipeline::flush):
(WebCore::PlaybackPipeline::enqueueSample):
(WebCore::PlaybackPipeline::allSamplesInTrackEnqueued):
(WebCore::PlaybackPipeline::pipeline):
* platform/graphics/gstreamer/mse/PlaybackPipeline.h: Copied from Source/WebCore/platform/graphics/gstreamer/mse/MediaSourceClientGStreamerMSE.h.
* platform/graphics/gstreamer/mse/SourceBufferPrivateGStreamer.cpp:
(WebCore::SourceBufferPrivateGStreamer::enqueueSample):
(WebCore::SourceBufferPrivateGStreamer::isReadyForMoreSamples):
(WebCore::SourceBufferPrivateGStreamer::setReadyForMoreSamples):
(WebCore::SourceBufferPrivateGStreamer::notifyReadyForMoreSamples):
(WebCore::SourceBufferPrivateGStreamer::notifyClientWhenReadyForMoreSamples):
* platform/graphics/gstreamer/mse/SourceBufferPrivateGStreamer.h:
* platform/graphics/gstreamer/mse/WebKitMediaSourceGStreamer.cpp:
(disabledAppsrcNeedData):
(disabledAppsrcEnoughData):
(disabledAppsrcSeekData):
(enabledAppsrcEnoughData):
(enabledAppsrcSeekData):
(getStreamByAppsrc):
(webkitMediaSrcChain):
(webkit_media_src_init):
(webKitMediaSrcFinalize):
(webKitMediaSrcSetProperty):
(webKitMediaSrcGetProperty):
(webKitMediaSrcDoAsyncStart):
(webKitMediaSrcDoAsyncDone):
(webKitMediaSrcChangeState):
(webKitMediaSrcGetSize):
(webKitMediaSrcQueryWithParent):
(webKitMediaSrcUpdatePresentationSize):
(webKitMediaSrcLinkStreamToSrcPad):
(webKitMediaSrcLinkSourcePad):
(webKitMediaSrcFreeStream):
(webKitMediaSrcCheckAllTracksConfigured):
(webKitMediaSrcUriGetType):
(webKitMediaSrcGetProtocols):
(webKitMediaSrcGetUri):
(webKitMediaSrcSetUri):
(webKitMediaSrcUriHandlerInit):
(seekNeedsDataMainThread):
(notifyReadyForMoreSamplesMainThread):
(webKitMediaSrcSetMediaPlayerPrivate):
(webKitMediaSrcSetReadyForSamples):
(webKitMediaSrcPrepareSeek):
(WebKitMediaSrcPrivate::streamByName): Deleted.
(): Deleted.
(WTF::refGPtr<WebKitMediaSrcPad>): Deleted.
(WTF::derefGPtr<WebKitMediaSrcPad>): Deleted.
(webkit_media_src_pad_class_init): Deleted.
(Stream::Stream): Deleted.
(Stream::StreamingMembers::StreamingMembers): Deleted.
(Stream::StreamingMembers::durationEnqueued const): Deleted.
(findPipeline): Deleted.
(webkit_media_src_class_init): Deleted.
(debugProbe): Deleted.
(copyCollectionAndAddStream): Deleted.
(copyCollectionWithoutStream): Deleted.
(gstStreamType): Deleted.
(webKitMediaSrcAddStream): Deleted.
(webKitMediaSrcRemoveStream): Deleted.
(webKitMediaSrcActivateMode): Deleted.
(webKitMediaSrcPadLinked): Deleted.
(webKitMediaSrcStreamNotifyLowWaterLevel): Deleted.
(webKitMediaSrcLoop): Deleted.
(webKitMediaSrcEnqueueObject): Deleted.
(webKitMediaSrcEnqueueSample): Deleted.
(webKitMediaSrcEnqueueEvent): Deleted.
(webKitMediaSrcEndOfStream): Deleted.
(webKitMediaSrcIsReadyForMoreSamples): Deleted.
(webKitMediaSrcNotifyWhenReadyForMoreSamples): Deleted.
(webKitMediaSrcStreamFlushStart): Deleted.
(webKitMediaSrcStreamFlushStop): Deleted.
(webKitMediaSrcFlush): Deleted.
(webKitMediaSrcSeek): Deleted.
(countStreamsOfType): Deleted.
* platform/graphics/gstreamer/mse/WebKitMediaSourceGStreamer.h:
* platform/graphics/gstreamer/mse/WebKitMediaSourceGStreamerPrivate.h: Added.

Tools:

* Scripts/webkitpy/style/checker.py:

LayoutTests:

* platform/gtk/TestExpectations:

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

9 months agoUnreviewed. Mark some more WTF unit tests as slow for GTK and WPE
carlosgc@webkit.org [Mon, 21 Oct 2019 09:53:59 +0000 (09:53 +0000)]
Unreviewed. Mark some more WTF unit tests as slow for GTK and WPE

* TestWebKitAPI/glib/TestExpectations.json:

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

9 months ago[GTK] Objects category in emoji picker is empty
carlosgc@webkit.org [Mon, 21 Oct 2019 09:30:03 +0000 (09:30 +0000)]
[GTK] Objects category in emoji picker is empty
https://bugs.webkit.org/show_bug.cgi?id=203189

Reviewed by Adrian Perez de Castro.

There's a typo in the first emopi name of objects section.

* UIProcess/API/gtk/WebKitEmojiChooser.cpp:
(webkitEmojiChooserSetupEmojiSections): uted speaker -> muted speaker

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

9 months ago[GTK][WPE] IconDatabase is not thread safe yet
carlosgc@webkit.org [Mon, 21 Oct 2019 09:21:14 +0000 (09:21 +0000)]
[GTK][WPE] IconDatabase is not thread safe yet
https://bugs.webkit.org/show_bug.cgi?id=202980

Reviewed by Adrian Perez de Castro.

Current implementation is safer, but we still need to protect members used by both threads.

* UIProcess/API/glib/IconDatabase.cpp:
(WebKit::IconDatabase::populatePageURLToIconURLMap):
(WebKit::IconDatabase::clearLoadedIconsTimerFired):
(WebKit::IconDatabase::checkIconURLAndSetPageURLIfNeeded):
(WebKit::IconDatabase::loadIconForPageURL):
(WebKit::IconDatabase::iconURLForPageURL):
(WebKit::IconDatabase::setIconForPageURL):
(WebKit::IconDatabase::clear):
* UIProcess/API/glib/IconDatabase.h:

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

9 months agoClean up some includes to improve WebKit2 build speed
timothy_horton@apple.com [Mon, 21 Oct 2019 08:25:55 +0000 (08:25 +0000)]
Clean up some includes to improve WebKit2 build speed
https://bugs.webkit.org/show_bug.cgi?id=203071

Reviewed by Wenson Hsieh.

Source/WebCore:

No new tests, just shuffling code around.

* bindings/js/WindowProxy.cpp:
(WebCore::WindowProxy::WindowProxy):
(WebCore::WindowProxy::~WindowProxy):
(WebCore::WindowProxy::detachFromFrame):
(WebCore::WindowProxy::destroyJSWindowProxy):
(WebCore::WindowProxy::createJSWindowProxy):
(WebCore::WindowProxy::jsWindowProxiesAsVector const):
(WebCore::WindowProxy::clearJSWindowProxiesNotMatchingDOMWindow):
(WebCore::WindowProxy::setDOMWindow):
(WebCore::WindowProxy::attachDebugger):
(WebCore::WindowProxy::jsWindowProxies const):
(WebCore::WindowProxy::releaseJSWindowProxies):
(WebCore::WindowProxy::setJSWindowProxies):
* bindings/js/WindowProxy.h:
(WebCore::WindowProxy::existingJSWindowProxy const):
(WebCore::WindowProxy::jsWindowProxies const): Deleted.
(WebCore::WindowProxy::releaseJSWindowProxies): Deleted.
(WebCore::WindowProxy::setJSWindowProxies): Deleted.
* platform/graphics/cocoa/IOSurface.h:
* platform/graphics/cocoa/IOSurface.mm:
(WebCore::IOSurface::~IOSurface):

Source/WebKit:

This is worth about 6% on WebKit2, and unlocks another 8% improvement
down the line (but which is less mechanical).

* NetworkProcess/Classifier/ResourceLoadStatisticsStore.cpp:
* NetworkProcess/Classifier/WebResourceLoadStatisticsStore.h:
* NetworkProcess/NetworkSocketChannel.h:
* NetworkProcess/WebStorage/StorageArea.h:
* NetworkProcess/WebStorage/StorageManager.cpp:
* NetworkProcess/WebStorage/StorageManagerSet.cpp:
* Platform/IPC/Connection.h:
* Shared/API/APIURL.h:
* Shared/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.h:
* Shared/WebCoreArgumentCoders.cpp:
* Shared/WebCoreArgumentCoders.h:
* UIProcess/API/APIAttachment.h:
* UIProcess/API/Cocoa/_WKInspector.mm:
* UIProcess/RemoteLayerTree/RemoteLayerTreeNode.h:
* UIProcess/TextCheckerCompletion.cpp:
* UIProcess/TextCheckerCompletion.h:
* UIProcess/UserContent/WebUserContentControllerProxy.cpp:
(WebKit::WebUserContentControllerProxy::addNetworkProcess):
(WebKit::WebUserContentControllerProxy::removeNetworkProcess):
* UIProcess/UserContent/WebUserContentControllerProxy.h:
(WebKit::WebUserContentControllerProxy::addNetworkProcess): Deleted.
(WebKit::WebUserContentControllerProxy::removeNetworkProcess): Deleted.
* WebProcess/Automation/WebAutomationSessionProxy.h:
* WebProcess/Network/NetworkProcessConnection.cpp:
* WebProcess/Network/NetworkProcessConnection.h:
* WebProcess/Plugins/Netscape/NetscapePlugin.cpp:
* WebProcess/Plugins/PDF/PDFPlugin.mm:
* WebProcess/Plugins/Plugin.cpp:
* WebProcess/Plugins/Plugin.h:
* WebProcess/WebProcess.cpp:

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

9 months ago[GTK][WPE] Check we don't leak the WebKitWebContext in all tests
carlosgc@webkit.org [Mon, 21 Oct 2019 07:16:32 +0000 (07:16 +0000)]
[GTK][WPE] Check we don't leak the WebKitWebContext in all tests
https://bugs.webkit.org/show_bug.cgi?id=202981

Reviewed by Žan Doberšek.

Also include the number of references left in leaks report.

* TestWebKitAPI/glib/WebKitGLib/TestMain.h:
(Test::Test):
(Test::~Test):

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

9 months ago[GTK] Unreviewed. Fix build warning: unused parameter ‘Foo’ [-Wunused-parameter]...
jh718.park@samsung.com [Mon, 21 Oct 2019 07:16:12 +0000 (07:16 +0000)]
[GTK] Unreviewed. Fix build warning: unused parameter ‘Foo’ [-Wunused-parameter] since r251320.

Patch by Joonghun Park <jh718.park@samsung.com> on 2019-10-21

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

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

9 months agoImprove serialization logic
bfulgham@apple.com [Mon, 21 Oct 2019 01:55:11 +0000 (01:55 +0000)]
Improve serialization logic
https://bugs.webkit.org/show_bug.cgi?id=203039
<rdar://problem/55631691>

Reviewed by Alex Christensen.

Check that the SecItemRequestData only contains relevant types for
CFNetwork uses.

* Platform/spi/Cocoa/SecItemSPI.h: Added.
* Shared/mac/SecItemRequestData.cpp:
(WebKit::arrayContainsInvalidType): Added.
(WebKit::dictionaryContainsInvalidType): Added.
(WebKit::validTypeIDs): Added.
(WebKit::isValidType): Added.
(WebKit::SecItemRequestData::decode): Check types during decode.
* Shared/mac/SecItemRequestData.h:
* WebKit.xcodeproj/project.pbxproj:

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

9 months agoUnreviewed, drop debug logging that was inadvertently committed with r251327.
cdumez@apple.com [Mon, 21 Oct 2019 01:44:45 +0000 (01:44 +0000)]
Unreviewed, drop debug logging that was inadvertently committed with r251327.

* history/BackForwardCache.cpp:

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

9 months ago[LFC][IFC] Make InlineTextItem reusable when 'segment break' behavior changes
zalan@apple.com [Sun, 20 Oct 2019 15:09:21 +0000 (15:09 +0000)]
[LFC][IFC] Make InlineTextItem reusable when 'segment break' behavior changes
https://bugs.webkit.org/show_bug.cgi?id=203184
<rdar://problem/56438945>

Reviewed by Antti Koivisto.

InlineTextItem::isWhitespace should dynamically check for 'preserve new line' behavior. This way we don't have to rebuild the inline item list
when the related style property value changes.

* layout/inlineformatting/InlineTextItem.cpp:
(WebCore::Layout::isWhitespaceCharacter):
(WebCore::Layout::moveToNextNonWhitespacePosition):
(WebCore::Layout::InlineTextItem::createAndAppendTextItems):
(WebCore::Layout::InlineTextItem::createWhitespaceItem):
(WebCore::Layout::InlineTextItem::createNonWhitespaceItem):
(WebCore::Layout::InlineTextItem::createSegmentBreakItem):
(WebCore::Layout::InlineTextItem::createEmptyItem):
(WebCore::Layout::InlineTextItem::InlineTextItem):
(WebCore::Layout::InlineTextItem::split const):
(WebCore::Layout::InlineTextItem::isWhitespace const):
(WebCore::Layout::isSoftLineBreak): Deleted.
* layout/inlineformatting/InlineTextItem.h:
(WebCore::Layout::InlineTextItem::isSegmentBreak const):
(WebCore::Layout::InlineTextItem::isWhitespace const): Deleted.

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

9 months ago[LFC][IFC] Move the collapsed bit from InlineItems to runs
zalan@apple.com [Sun, 20 Oct 2019 14:56:32 +0000 (14:56 +0000)]
[LFC][IFC] Move the collapsed bit from InlineItems to runs
https://bugs.webkit.org/show_bug.cgi?id=203183

Reviewed by Antti Koivisto.
<rdar://problem/56437181>

Let's not store the collapsed bit on the InlineTextItem. All we need to know is whether the InlineTextItem content is collapsible or not.
Also when only the white-space property changes (going from preserve whitespace to not and vice versa) we don't actually need to rebuild the
InlinItem list since they don't carry any layout dependent information.
This patch also fixes leading/trailing content preservation.

* layout/inlineformatting/InlineLine.cpp:
(WebCore::Layout::Line::Run::canBeExtended const):
(WebCore::Layout::shouldPreserveTrailingContent):
(WebCore::Layout::shouldPreserveLeadingContent):
(WebCore::Layout::Line::appendTextContent):
* layout/inlineformatting/InlineLine.h:
(WebCore::Layout::Line::Run::isCollapsed const):
(WebCore::Layout::Line::Run::setIsCollapsed):
* layout/inlineformatting/InlineLineLayout.cpp:
(WebCore::Layout::inlineItemWidth):
* layout/inlineformatting/InlineTextItem.cpp:
(WebCore::Layout::InlineTextItem::createAndAppendTextItems):
(WebCore::Layout::InlineTextItem::InlineTextItem):
(WebCore::Layout::InlineTextItem::split const):
* layout/inlineformatting/InlineTextItem.h:
(WebCore::Layout::InlineTextItem::isCollapsible const):
(WebCore::Layout::InlineTextItem::isCollapsed const): Deleted.
* layout/inlineformatting/text/TextUtil.cpp:
(WebCore::Layout::TextUtil::isTrimmableContent): Deleted.
* layout/inlineformatting/text/TextUtil.h:

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

9 months agoFlaky Test: fast/events/resize-subframe-in-rendering-update.html
rniwa@webkit.org [Sat, 19 Oct 2019 23:50:32 +0000 (23:50 +0000)]
Flaky Test: fast/events/resize-subframe-in-rendering-update.html
https://bugs.webkit.org/show_bug.cgi?id=203140
<rdar://problem/56415948>

Reviewed by Wenson Hsieh.

Removed the assertion in setTimeout to avoid flakiness. There isn't a way to deterministically order
callbacks of setTimeout and requestAnimationFrame for this test for now.

* fast/events/resize-subframe-in-rendering-update-expected.txt:
* fast/events/resize-subframe-in-rendering-update.html:

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

9 months agoFileReader should not prevent entering the back/forward cache
cdumez@apple.com [Sat, 19 Oct 2019 23:41:11 +0000 (23:41 +0000)]
FileReader should not prevent entering the back/forward cache
https://bugs.webkit.org/show_bug.cgi?id=203106

Reviewed by Geoffrey Garen.

Source/WebCore:

FileReader should not prevent entering the back/forward cache. To support this,
its implementation now uses a SuspendableTaskQueue to dispatch events.

Test: fast/files/file-reader-back-forward-cache.html

* dom/ActiveDOMObject.cpp:
(WebCore::ActiveDOMObject::isAllowedToRunScript const):
* dom/ActiveDOMObject.h:
* dom/ScriptExecutionContext.cpp:
(WebCore::ScriptExecutionContext::resumeActiveDOMObjects):
* fileapi/FileReader.cpp:
(WebCore::FileReader::FileReader):
(WebCore::FileReader::stop):
(WebCore::FileReader::hasPendingActivity const):
(WebCore::FileReader::readInternal):
(WebCore::FileReader::abort):
(WebCore::FileReader::didStartLoading):
(WebCore::FileReader::didReceiveData):
(WebCore::FileReader::didFinishLoading):
(WebCore::FileReader::didFail):
(WebCore::FileReader::fireEvent):
* fileapi/FileReader.h:

LayoutTests:

Add layout test coverage.

* TestExpectations:
* fast/files/file-reader-back-forward-cache-expected.txt: Added.
* fast/files/file-reader-back-forward-cache.html: Added.

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

9 months ago[GTK][WPE] Fix non-unified builds after r250857
aperez@igalia.com [Sat, 19 Oct 2019 19:56:35 +0000 (19:56 +0000)]
[GTK][WPE] Fix non-unified builds after r250857
https://bugs.webkit.org/show_bug.cgi?id=203145

Reviewed by Carlos Garcia Campos.

Source/WebCore:

No new tests needed.

* Modules/async-clipboard/ClipboardItem.cpp: Add missing inclusion of the Clipboard.h header.
* Modules/async-clipboard/ClipboardItemBindingsDataSource.cpp: Add missing inclusion of the
ClipboardItem.h header.
* Modules/async-clipboard/ClipboardItemPasteboardDataSource.cpp: Add missing inclusions of
the Clipboard.h, ClipboardItem.h, and JSDOMPromiseDeferred.h headers.
* dom/AbstractEventLoop.h: Add missing inclusion of the wtf/RefCounted.h header.
* dom/WindowEventLoop.h: Add missing inclusion of the DocumentIdentifier.h header.
* dom/IdleCallbackController.h: Add missing forward-declaration for the Document class.
* dom/RadioButtonGroups.h: Add needed inclusion of of the wtf/text/AtomStringHash.h header,
needed because AtomString is used as key for a HashMap; remove the (now unneeded) of the
wtf/Forward.h header.
* page/WheelEventTestMonitor.cpp: Add missing inclusion of the wtf/OptionSet.h header.
* rendering/style/ShadowData.cpp: Add missing inclusion of the wtf/text/TextStream.h header.

Source/WebKit:

* UIProcess/WebProcessProxy.cpp: Add missing inclusion of the WebBackForwardCache.h header.

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

9 months agoAdd support to TextStream for dumping HashMap<> and HashSet<>
simon.fraser@apple.com [Sat, 19 Oct 2019 18:40:36 +0000 (18:40 +0000)]
Add support to TextStream for dumping HashMap<> and HashSet<>
https://bugs.webkit.org/show_bug.cgi?id=202969

Reviewed by Dean Jackson.

Make it possible to output HashMap<> and HashSet<> to TextStream,
so long as key and value types are streamable. Also implement operator<<(char)
so that chars show as ASCII, rather than numbers.

* wtf/text/TextStream.cpp:
(WTF::TextStream::operator<<):
* wtf/text/TextStream.h:
(WTF::operator<<):

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

9 months agoIntegrate media query evaluation into HTML5 event loop
rniwa@webkit.org [Sat, 19 Oct 2019 08:31:00 +0000 (08:31 +0000)]
Integrate media query evaluation into HTML5 event loop
https://bugs.webkit.org/show_bug.cgi?id=203134
<rdar://problem/56396316>

Reviewed by Antti Koivisto.

Source/WebCore:

Moved the code to call media query listeners to HTML5 event loop's step to update the rendering:
https://html.spec.whatwg.org/multipage/webappapis.html#update-the-rendering

Tests: fast/media/mq-inverted-colors-live-update-for-listener.html
       fast/media/mq-prefers-reduced-motion-live-update-for-listener.html

* css/MediaQueryMatcher.cpp:
(WebCore::MediaQueryMatcher::evaluateAll): Renamed from styleResolverChanged.
* css/MediaQueryMatcher.h:
* dom/Document.cpp:
(WebCore::Document::updateElementsAffectedByMediaQueries): Split from evaluateMediaQueryList.
This function is still called right after each layout update so that picture element may start
requesting newly selected image resources without having to wait for a rendering update.
But this function will no longer execute arbitrary scripts.
(WebCore::Document::evaluateMediaQueriesAndReportChanges): Split from evaluateMediaQueryList.
Evaluates media query listeners.
* dom/Document.h:
* inspector/agents/InspectorPageAgent.cpp:
(WebCore::InspectorPageAgent::setEmulatedMedia): Force the evaluation of media queries for now
but this code should really be scheduling a rendering update instead so added a FIXME.
* page/Frame.cpp:
(WebCore::Frame::setPrinting): Evaluate media queries. We should consider invoking the full
algorithm to update the rendering here. e.g. intersection observer may add more contents.
* page/Page.cpp:
(WebCore::Page::updateRendering): Call evaluateMediaQueriesAndReportChanges.

LayoutTests:

Added tests for listening to accessiblity related media queries without having any style rules
get affected by those media queries so that we can catch any future regressions. For now,
changing accessiblity settings seem to always schedule a rendering update so there is nothing to do
when these accessibility settings do change.

* fast/media/media-query-list-07.html: Fixed the test to be compatible with new behavior.
* fast/media/mq-inverted-colors-live-update-for-listener-expected.txt: Added.
* fast/media/mq-inverted-colors-live-update-for-listener.html: Added.
* fast/media/mq-prefers-reduced-motion-live-update-for-listener-expected.txt: Added.
* fast/media/mq-prefers-reduced-motion-live-update-for-listener.html: Added.

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

9 months ago[JSC] DFG::CommonData modification by DFG reallyAdd should be guarded by CodeBlock...
ysuzuki@apple.com [Sat, 19 Oct 2019 06:31:27 +0000 (06:31 +0000)]
[JSC] DFG::CommonData modification by DFG reallyAdd should be guarded by CodeBlock's lock
https://bugs.webkit.org/show_bug.cgi?id=203177

Reviewed by Mark Lam.

JSTests:

* stress/dfg-really-add-locking.js: Added.

Source/JavaScriptCore:

When doing DFG reallyAdd, DFG::JITCode is already set in CodeBlock and DFG::CommonData can be
reachable from CodeBlock. So concurrent collector can trace entries of DFG::CommonData while DFG reallyAdd
is modifying it. It would be possible that we install DFG::JITCode after performing DFG reallyAdd, but for now,
we just protect DFG reallyAdd's DFG::CommonData modification by CodeBlock's lock so that concurrent collector
does not trace them in a racy manner.

* dfg/DFGDesiredGlobalProperties.cpp:
(JSC::DFG::DesiredGlobalProperties::reallyAdd):
* dfg/DFGDesiredIdentifiers.cpp:
(JSC::DFG::DesiredIdentifiers::reallyAdd):
* dfg/DFGDesiredTransitions.cpp:
(JSC::DFG::DesiredTransition::reallyAdd):
* dfg/DFGDesiredWatchpoints.cpp:
(JSC::DFG::ArrayBufferViewWatchpointAdaptor::add):
(JSC::DFG::SymbolTableAdaptor::add):
(JSC::DFG::FunctionExecutableAdaptor::add):
(JSC::DFG::AdaptiveStructureWatchpointAdaptor::add):
* dfg/DFGDesiredWatchpoints.h:
(JSC::DFG::SetPointerAdaptor::add):
* dfg/DFGDesiredWeakReferences.cpp:
(JSC::DFG::DesiredWeakReferences::reallyAdd):

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

9 months agomacCatalyst: Cursor should send mouse events, not touch events
timothy_horton@apple.com [Sat, 19 Oct 2019 05:48:14 +0000 (05:48 +0000)]
macCatalyst: Cursor should send mouse events, not touch events
https://bugs.webkit.org/show_bug.cgi?id=203175
<rdar://problem/56321134>

Reviewed by Simon Fraser.

Source/WebCore:

* dom/Element.cpp:
(WebCore::shouldIgnoreMouseEvent):
(WebCore::Element::dispatchMouseEvent):
* page/PointerCaptureController.cpp:
(WebCore::PointerCaptureController::reset):
Share more code between platforms that support touch events and platforms that don't;
we want to be able to dispatch pointer events that originate from mouse events
in macCatalyst despite touch events being enabled (by virtue of being iOS WebKit),
so un-ifdef that code.

Source/WebKit:

* Platform/spi/ios/UIKitSPI.h:
* Shared/NativeWebMouseEvent.h:
* Shared/ios/NativeWebMouseEventIOS.mm:
(WebKit::NativeWebMouseEvent::NativeWebMouseEvent):
Add a NativeWebMouseEvent constructor that doesn't actually wrap a native event,
for creating totally-synthetic events.

* UIProcess/ios/WKMouseGestureRecognizer.h: Added.
* UIProcess/ios/WKMouseGestureRecognizer.mm: Added.
(webEventModifiersForUIKeyModifierFlags):
(-[WKMouseGestureRecognizer initWithTarget:action:]):
(-[WKMouseGestureRecognizer setView:]):
(-[WKMouseGestureRecognizer lastMouseEvent]):
(-[WKMouseGestureRecognizer lastMouseLocation]):
(-[WKMouseGestureRecognizer mouseTouch]):
(-[WKMouseGestureRecognizer _wantsHoverEvents]):
(-[WKMouseGestureRecognizer reset]):
(-[WKMouseGestureRecognizer _shouldReceiveTouch:forEvent:recognizerView:]):
(-[WKMouseGestureRecognizer _shouldReceivePress:]):
(-[WKMouseGestureRecognizer createMouseEventWithType:]):
(-[WKMouseGestureRecognizer touchesBegan:withEvent:]):
(-[WKMouseGestureRecognizer touchesMoved:withEvent:]):
(-[WKMouseGestureRecognizer touchesEnded:withEvent:]):
(-[WKMouseGestureRecognizer touchesCancelled:withEvent:]):
(-[WKMouseGestureRecognizer _hoverEntered:withEvent:]):
(-[WKMouseGestureRecognizer _hoverMoved:withEvent:]):
(-[WKMouseGestureRecognizer _hoverExited:withEvent:]):
(-[WKMouseGestureRecognizer _hoverCancelled:withEvent:]):
(-[WKMouseGestureRecognizer locationInView:]):
(-[WKMouseGestureRecognizer canPreventGestureRecognizer:]):
(-[WKMouseGestureRecognizer canBePreventedByGestureRecognizer:]):
Instead of just using UIHoverGestureRecognizer, introduce a new gesture
recognizer that does what it did, but also supports cases where the button
is pressed (so, mousedown and mouseup instead of just mousemove),
and synthesizes mouse events for all state transitions. These events
should look roughly identical to what a non-macCatalyst app would get
in AppKit's mouseUp/mouseDown/mouseMoved NSResponder methods.

* SourcesCocoa.txt:
* UIProcess/ios/WKContentViewInteraction.h:
* UIProcess/ios/WKContentViewInteraction.mm:
(-[WKContentView setupInteraction]):
(-[WKContentView cleanupInteraction]):
(-[WKContentView _removeDefaultGestureRecognizers]):
(-[WKContentView _addDefaultGestureRecognizers]):
(-[WKContentView gestureRecognizer:shouldReceiveTouch:]):
(-[WKContentView gestureRecognizer:shouldRecognizeSimultaneouslyWithGestureRecognizer:]):
(-[WKContentView _showShareSheet:inRect:completionHandler:]):
(-[WKContentView _mouseGestureRecognizerChanged:]):
(webEventFlagsForUIKeyModifierFlags): Deleted.
(-[WKContentView _hoverGestureRecognizerChanged:]): Deleted.
* WebKit.xcodeproj/project.pbxproj:
Make use of WKMouseGestureRecognizer to plumb the synthesized events directly
to the macOS-style "handleMouseEvent" codepath, instead of going through
the touch events path (and then subsequently generating synthetic clicks).
Also, ensure that other gesture recognizers ignore the mouse "touch" entirely
by returning NO in shouldReceiveTouch.

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

9 months agoMake it possible to query scrollbar pseudo-style without having a scrollbar
simon.fraser@apple.com [Sat, 19 Oct 2019 02:28:12 +0000 (02:28 +0000)]
Make it possible to query scrollbar pseudo-style without having a scrollbar
https://bugs.webkit.org/show_bug.cgi?id=203174

Reviewed by Tim Horton.

A future patch needs the ability to query scrollbar pseudo-style without having
a scrollbar, and it was ugly to pass a live RenderScrollbar into CSS style resolution
functions. Instead, pass in a pure-data object that has information about the scrollbar.

* css/ElementRuleCollector.cpp:
(WebCore::ElementRuleCollector::ruleMatches):
* css/SelectorChecker.h:
* css/SelectorCheckerTestFunctions.h:
(WebCore::scrollbarMatchesEnabledPseudoClass):
(WebCore::scrollbarMatchesDisabledPseudoClass):
(WebCore::scrollbarMatchesHoverPseudoClass):
(WebCore::scrollbarMatchesActivePseudoClass):
(WebCore::scrollbarMatchesHorizontalPseudoClass):
(WebCore::scrollbarMatchesVerticalPseudoClass):
(WebCore::scrollbarMatchesDecrementPseudoClass):
(WebCore::scrollbarMatchesIncrementPseudoClass):
(WebCore::scrollbarMatchesStartPseudoClass):
(WebCore::scrollbarMatchesEndPseudoClass):
(WebCore::scrollbarMatchesDoubleButtonPseudoClass):
(WebCore::scrollbarMatchesSingleButtonPseudoClass):
(WebCore::scrollbarMatchesNoButtonPseudoClass):
(WebCore::scrollbarMatchesCornerPresentPseudoClass):
* css/StyleResolver.h:
(WebCore::PseudoStyleRequest::PseudoStyleRequest):
* rendering/RenderScrollbar.cpp:
(WebCore::RenderScrollbar::getScrollbarPseudoStyle):

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

9 months ago[SVG2]: Remove the SVGExternalResourcesRequired interface
commit-queue@webkit.org [Sat, 19 Oct 2019 01:18:17 +0000 (01:18 +0000)]
[SVG2]: Remove the SVGExternalResourcesRequired interface
https://bugs.webkit.org/show_bug.cgi?id=191293

Patch by Said Abou-Hallawa <sabouhallawa@apple.com> on 2019-10-18
Reviewed by Simon Fraser.

LayoutTests/imported/w3c:

* web-platform-tests/svg/import/types-dom-04-b-manual.svg:
Use the preserveAlpha property of <feConvolveMatrix> element to test
SVGAnimatedBoolean.

Source/WebCore:

The spec page is: https://www.w3.org/TR/SVG/changes.html.

r251290 made externalResourcesRequired have no effect on firing the load
event. All the control was moved to SVGURIReference. This patch will remove
this interface entirely to conform with SVG2 specs and other browsers.

* CMakeLists.txt:
* DerivedSources-input.xcfilelist:
* DerivedSources-output.xcfilelist:
* DerivedSources.make:
* Sources.txt:
* WebCore.xcodeproj/project.pbxproj:
* svg/SVGAElement.cpp:
(WebCore::SVGAElement::SVGAElement):
(WebCore::SVGAElement::parseAttribute):
(WebCore::SVGAElement::svgAttributeChanged):
* svg/SVGAElement.h:
* svg/SVGAElement.idl:
* svg/SVGAnimationElement.cpp:
(WebCore::SVGAnimationElement::SVGAnimationElement):
(WebCore::SVGAnimationElement::isSupportedAttribute):
(WebCore::SVGAnimationElement::parseAttribute):
* svg/SVGAnimationElement.h:
* svg/SVGAnimationElement.idl:
* svg/SVGCircleElement.cpp:
(WebCore::SVGCircleElement::SVGCircleElement):
(WebCore::SVGCircleElement::parseAttribute):
(WebCore::SVGCircleElement::svgAttributeChanged):
* svg/SVGCircleElement.h:
* svg/SVGCircleElement.idl:
* svg/SVGClipPathElement.cpp:
(WebCore::SVGClipPathElement::SVGClipPathElement):
(WebCore::SVGClipPathElement::parseAttribute):
(WebCore::SVGClipPathElement::svgAttributeChanged):
* svg/SVGClipPathElement.h:
* svg/SVGClipPathElement.idl:
* svg/SVGCursorElement.cpp:
(WebCore::SVGCursorElement::SVGCursorElement):
(WebCore::SVGCursorElement::parseAttribute):
* svg/SVGCursorElement.h:
* svg/SVGCursorElement.idl:
* svg/SVGDefsElement.cpp:
(WebCore::SVGDefsElement::SVGDefsElement):
* svg/SVGDefsElement.h:
* svg/SVGDefsElement.idl:
* svg/SVGEllipseElement.cpp:
(WebCore::SVGEllipseElement::SVGEllipseElement):
(WebCore::SVGEllipseElement::parseAttribute):
(WebCore::SVGEllipseElement::svgAttributeChanged):
* svg/SVGEllipseElement.h:
* svg/SVGEllipseElement.idl:
* svg/SVGExternalResourcesRequired.cpp: Removed.
* svg/SVGExternalResourcesRequired.h: Removed.
* svg/SVGExternalResourcesRequired.idl: Removed.
* svg/SVGFEImageElement.cpp:
(WebCore::SVGFEImageElement::SVGFEImageElement):
(WebCore::SVGFEImageElement::parseAttribute):
* svg/SVGFEImageElement.h:
* svg/SVGFEImageElement.idl:
* svg/SVGFilterElement.cpp:
(WebCore::SVGFilterElement::SVGFilterElement):
(WebCore::SVGFilterElement::parseAttribute):
(WebCore::SVGFilterElement::svgAttributeChanged):
* svg/SVGFilterElement.h:
* svg/SVGFilterElement.idl:
* svg/SVGFontElement.cpp:
(WebCore::SVGFontElement::SVGFontElement):
* svg/SVGFontElement.h:
* svg/SVGForeignObjectElement.cpp:
(WebCore::SVGForeignObjectElement::SVGForeignObjectElement):
(WebCore::SVGForeignObjectElement::parseAttribute):
(WebCore::SVGForeignObjectElement::svgAttributeChanged):
* svg/SVGForeignObjectElement.h:
* svg/SVGForeignObjectElement.idl:
* svg/SVGGElement.cpp:
(WebCore::SVGGElement::SVGGElement):
(WebCore::SVGGElement::parseAttribute): Deleted.
(WebCore::SVGGElement::svgAttributeChanged): Deleted.
* svg/SVGGElement.h:
* svg/SVGGElement.idl:
* svg/SVGGradientElement.cpp:
(WebCore::SVGGradientElement::SVGGradientElement):
(WebCore::SVGGradientElement::parseAttribute):
* svg/SVGGradientElement.h:
* svg/SVGGradientElement.idl:
* svg/SVGImageElement.cpp:
(WebCore::SVGImageElement::SVGImageElement):
(WebCore::SVGImageElement::parseAttribute):
(WebCore::SVGImageElement::svgAttributeChanged):
* svg/SVGImageElement.h:
* svg/SVGImageElement.idl:
* svg/SVGLineElement.cpp:
(WebCore::SVGLineElement::SVGLineElement):
(WebCore::SVGLineElement::parseAttribute):
(WebCore::SVGLineElement::svgAttributeChanged):
* svg/SVGLineElement.h:
* svg/SVGLineElement.idl:
* svg/SVGMPathElement.cpp:
(WebCore::SVGMPathElement::SVGMPathElement):
(WebCore::SVGMPathElement::parseAttribute):
(WebCore::SVGMPathElement::svgAttributeChanged):
* svg/SVGMPathElement.h:
* svg/SVGMPathElement.idl:
* svg/SVGMarkerElement.cpp:
(WebCore::SVGMarkerElement::SVGMarkerElement):
(WebCore::SVGMarkerElement::parseAttribute):
(WebCore::SVGMarkerElement::svgAttributeChanged):
* svg/SVGMarkerElement.h:
* svg/SVGMarkerElement.idl:
* svg/SVGMaskElement.cpp:
(WebCore::SVGMaskElement::SVGMaskElement):
(WebCore::SVGMaskElement::parseAttribute):
(WebCore::SVGMaskElement::svgAttributeChanged):
* svg/SVGMaskElement.h:
* svg/SVGMaskElement.idl:
* svg/SVGPathElement.cpp:
(WebCore::SVGPathElement::SVGPathElement):
(WebCore::SVGPathElement::parseAttribute):
(WebCore::SVGPathElement::svgAttributeChanged):
* svg/SVGPathElement.h:
* svg/SVGPathElement.idl:
* svg/SVGPatternElement.cpp:
(WebCore::SVGPatternElement::SVGPatternElement):
(WebCore::SVGPatternElement::parseAttribute):
(WebCore::SVGPatternElement::svgAttributeChanged):
* svg/SVGPatternElement.h:
* svg/SVGPatternElement.idl:
* svg/SVGPolyElement.cpp:
(WebCore::SVGPolyElement::SVGPolyElement):
(WebCore::SVGPolyElement::parseAttribute):
(WebCore::SVGPolyElement::svgAttributeChanged):
* svg/SVGPolyElement.h:
* svg/SVGPolygonElement.idl:
* svg/SVGPolylineElement.idl:
* svg/SVGRectElement.cpp:
(WebCore::SVGRectElement::SVGRectElement):
(WebCore::SVGRectElement::parseAttribute):
(WebCore::SVGRectElement::svgAttributeChanged):
* svg/SVGRectElement.h:
* svg/SVGRectElement.idl:
* svg/SVGSVGElement.cpp:
(WebCore::SVGSVGElement::SVGSVGElement):
(WebCore::SVGSVGElement::parseAttribute):
(WebCore::SVGSVGElement::svgAttributeChanged):
* svg/SVGSVGElement.h:
* svg/SVGSVGElement.idl:
* svg/SVGScriptElement.cpp:
(WebCore::SVGScriptElement::SVGScriptElement):
(WebCore::SVGScriptElement::parseAttribute):
(WebCore::SVGScriptElement::svgAttributeChanged):
* svg/SVGScriptElement.h:
* svg/SVGScriptElement.idl:
* svg/SVGSwitchElement.cpp:
(WebCore::SVGSwitchElement::SVGSwitchElement):
* svg/SVGSwitchElement.h:
* svg/SVGSwitchElement.idl:
* svg/SVGSymbolElement.cpp:
(WebCore::SVGSymbolElement::SVGSymbolElement):
(WebCore::SVGSymbolElement::parseAttribute):
(WebCore::SVGSymbolElement::svgAttributeChanged): Deleted.
* svg/SVGSymbolElement.h:
* svg/SVGSymbolElement.idl:
* svg/SVGTextContentElement.cpp:
(WebCore::SVGTextContentElement::SVGTextContentElement):
(WebCore::SVGTextContentElement::parseAttribute):
(WebCore::SVGTextContentElement::svgAttributeChanged):
* svg/SVGTextContentElement.h:
* svg/SVGTextContentElement.idl:
* svg/SVGUseElement.cpp:
(WebCore::SVGUseElement::SVGUseElement):
(WebCore::SVGUseElement::parseAttribute):
(WebCore::SVGUseElement::svgAttributeChanged):
* svg/SVGUseElement.h:
* svg/SVGUseElement.idl:
* svg/SVGViewElement.cpp:
(WebCore::SVGViewElement::SVGViewElement):
(WebCore::SVGViewElement::parseAttribute):
(WebCore::SVGViewElement::svgAttributeChanged):
* svg/SVGViewElement.h:
* svg/SVGViewElement.idl:

LayoutTests:

* platform/gtk/TestExpectations:
The script-change-externalResourcesRequired-while-loading.svg has to be
removed and it was flaky on all platforms.

* platform/gtk/imported/w3c/web-platform-tests/svg/import/types-dom-04-b-manual-expected.txt:
* platform/gtk/svg/W3C-SVG-1.1-SE/types-dom-04-b-expected.txt:
* platform/ios-simulator/imported/w3c/web-platform-tests/svg/import/types-dom-04-b-manual-expected.txt:
* platform/ios/TestExpectations:
* platform/ios/svg/W3C-SVG-1.1-SE/types-dom-04-b-expected.txt:
* platform/mac/TestExpectations:
* platform/mac/imported/w3c/web-platform-tests/svg/import/types-dom-04-b-manual-expected.txt:
* platform/mac/svg/W3C-SVG-1.1-SE/types-dom-04-b-expected.txt:
* platform/win/TestExpectations:
* platform/win/svg/W3C-SVG-1.1-SE/types-dom-04-b-expected.txt:
* platform/wpe/imported/w3c/web-platform-tests/svg/import/types-dom-04-b-manual-expected.txt:
* platform/wpe/svg/W3C-SVG-1.1-SE/types-dom-04-b-expected.txt:
* svg/W3C-SVG-1.1-SE/types-dom-04-b.svg:
Use the preserveAlpha property of <feConvolveMatrix> element to test
SVGAnimatedBoolean.

* svg/animations/animate-externalResourcesRequired-no-load-event-expected.txt: Removed.
* svg/animations/animate-externalResourcesRequired-no-load-event.html: Removed.
* svg/custom/path-domsubtreemodified-crash.html:

* svg/dom/SVGAnimatedBoolean-expected.txt:
* svg/dom/SVGAnimatedBoolean.html:
Use the preserveAlpha property of <feConvolveMatrix> element to test
SVGAnimatedBoolean.

* svg/dom/SVGScriptElement/script-change-externalResourcesRequired-while-loading-expected.txt: Removed.
* svg/dom/SVGScriptElement/script-change-externalResourcesRequired-while-loading.svg: Removed.
* svg/dom/SVGScriptElement/script-load-and-error-events.svg:
* svg/dom/SVGScriptElement/script-onerror-bubbling.svg:
* svg/dom/SVGScriptElement/script-reexecution.svg:
* svg/dynamic-updates/SVGUseElement-dom-href1-attr.html:

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

9 months ago[WebAuthn] Warn users when no credentials are found
jiewen_tan@apple.com [Sat, 19 Oct 2019 01:02:19 +0000 (01:02 +0000)]
[WebAuthn] Warn users when no credentials are found
https://bugs.webkit.org/show_bug.cgi?id=203147
<rdar://problem/55931123>

Reviewed by Brent Fulgham.

Source/WebKit:

This patch returns _WKWebAuthenticationPanelUpdateNoCredentialsFound to client via
-[_WKWebAuthenticationPanelDelegate panel:updateWebAuthenticationPanel:] when either
CtapAuthenticator receives kCtap2ErrNoCredentials or U2fAuthenticator exhausts the
allow list.

This patch also enhances CtapAuthenticator::tryDowngrade to check if the CTAP command
can be converted to U2F commands to ensure kCtap2ErrNoCredentials is returned if it
is the case. Otherwise, after downgrading, U2fAuthenticator will return NotSupportedError
given it can't convert the commands.

* UIProcess/API/APIUIClient.h:
* UIProcess/API/APIWebAuthenticationPanelClient.h:
(API::WebAuthenticationPanelClient::updatePanel const):
* UIProcess/WebAuthentication/Authenticator.h:
* UIProcess/WebAuthentication/AuthenticatorManager.cpp:
(WebKit::AuthenticatorManager::authenticatorStatusUpdated):
* UIProcess/WebAuthentication/AuthenticatorManager.h:
* UIProcess/WebAuthentication/Cocoa/WebAuthenticationPanelClient.h:
* UIProcess/WebAuthentication/Cocoa/WebAuthenticationPanelClient.mm:
(WebKit::WebAuthenticationPanelClient::WebAuthenticationPanelClient):
(WebKit::wkWebAuthenticationPanelUpdate):
(WebKit::WebAuthenticationPanelClient::updatePanel const):
* UIProcess/WebAuthentication/WebAuthenticationFlags.h: Renamed from Source/WebKit/UIProcess/WebAuthentication/WebAuthenticationPanelFlags.h.
* UIProcess/WebAuthentication/WebAuthenticationRequestData.h:
* UIProcess/WebAuthentication/WebAuthenticatorCoordinatorProxy.cpp:
* UIProcess/WebAuthentication/fido/CtapAuthenticator.cpp:
(WebKit::CtapAuthenticator::continueGetAssertionAfterResponseReceived):
(WebKit::CtapAuthenticator::tryDowngrade):
* UIProcess/WebAuthentication/fido/U2fAuthenticator.cpp:
(WebKit::U2fAuthenticator::issueSignCommand):
* WebKit.xcodeproj/project.pbxproj:

Tools:

Adds new tests for _WKWebAuthenticationPanelUpdateNoCredentialsFound.

* TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
* TestWebKitAPI/Tests/WebKitCocoa/_WKWebAuthenticationPanel.mm:
(-[TestWebAuthenticationPanelDelegate panel:updateWebAuthenticationPanel:]):
(TestWebKitAPI::TEST):
* TestWebKitAPI/Tests/WebKitCocoa/web-authentication-get-assertion-hid-cancel.html:
* TestWebKitAPI/Tests/WebKitCocoa/web-authentication-get-assertion-hid-no-credentials.html: Added.
* TestWebKitAPI/Tests/WebKitCocoa/web-authentication-get-assertion-hid.html:
* TestWebKitAPI/Tests/WebKitCocoa/web-authentication-get-assertion-nfc.html:
* TestWebKitAPI/Tests/WebKitCocoa/web-authentication-get-assertion-u2f-no-credentials.html: Added.

LayoutTests:

Adds new tests for CtapAuthenticator::tryDowngrade enhancement.

* http/wpt/webauthn/public-key-credential-get-failure-hid.https-expected.txt:
* http/wpt/webauthn/public-key-credential-get-failure-hid.https.html:

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

9 months ago[Clipboard API] Refactor Pasteboard::read() to take an optional item index
wenson_hsieh@apple.com [Sat, 19 Oct 2019 00:47:30 +0000 (00:47 +0000)]
[Clipboard API] Refactor Pasteboard::read() to take an optional item index
https://bugs.webkit.org/show_bug.cgi?id=203161

Reviewed by Tim Horton.

Source/WebCore:

Adds an optional `itemIndex` argument to Pasteboard::read(PasteboardPlainText&) and
Pasteboard::read(PasteboardWebContentReader&, WebContentReadingPolicy). See below for more details.

Tests:  CopyHTML.ItemTypesWhenCopyingWebContent
        PasteWebArchive.WebArchiveTypeIdentifier

* editing/mac/EditorMac.mm:
(WebCore::Editor::dataSelectionForPasteboard):

Recognize "com.apple.webarchive" alongside "Apple Web Archive pasteboard type" when writing and reading from the
platform pasteboard on macOS. We add support for this here because the existing private type cannot be written
to an NSPasteboardItem, since it does not conform to a valid UTI format. Luckily, there already exists a UTI
that represents a web archive, so we can use it instead.

We need to write and read web archive data from NSPasteboardItem in order to support the case where there are
multiple items in the pasteboard that contain different web archive data.

* platform/Pasteboard.h:
* platform/StaticPasteboard.h:
* platform/gtk/PasteboardGtk.cpp:
(WebCore::Pasteboard::read):
* platform/ios/PasteboardIOS.mm:
(WebCore::Pasteboard::read):

Read the string from `itemIndex` if specified; otherwise, fall back to index 0. This could actually be fixed in
the future to scan all pasteboard items for a suitable string instead of falling back on the first item, but for
now, we maintain the existing behavior.

(WebCore::Pasteboard::readRespectingUTIFidelities):

If an `itemIndex` is specified, ignore all other item indices when looking for suitable content.

* platform/libwpe/PasteboardLibWPE.cpp:
(WebCore::Pasteboard::read):
* platform/mac/DragDataMac.mm:
(WebCore::DragData::containsCompatibleContent const):
* platform/mac/PasteboardMac.mm:
(WebCore::Pasteboard::write):
(WebCore::readStringAtPreferredItemIndex):
(WebCore::readBufferAtPreferredItemIndex):

Add helper methods to read strings and buffers from the pasteboard, at an optional `itemIndex` if specified.

(WebCore::Pasteboard::read):

Adopt the helper functions when reading plain text and web content, and respect the given `itemIndex`. To do
this, we need to read both legacy and modern types from the pasteboard, instead of just legacy types. This is
because NSPasteboardItem on macOS only accepts and provides data in the form of modern pasteboard types.

* platform/mac/PlatformPasteboardMac.mm:
(WebCore::safeTypeForDOMToReadAndWriteForPlatformType):
(WebCore::PlatformPasteboard::readBuffer const):
(WebCore::PlatformPasteboard::readString const):

Fix these methods to accept platform pasteboard types instead of MIME types, to match the behavior of existing
readBuffer and readString methods in PlatformPasteboardIOS.

* platform/win/PasteboardWin.cpp:
(WebCore::Pasteboard::read):

Source/WebKit:

* Shared/mac/PasteboardTypes.mm:
(WebKit::PasteboardTypes::forEditing):
(WebKit::PasteboardTypes::forSelection):

Support "com.apple.webarchive" alongside the private "Apple Web Archive pasteboard type".

* UIProcess/Cocoa/WebViewImpl.mm:
(WebKit::WebViewImpl::setPromisedDataForImage):

Tools:

Add a couple of new API tests to verify that the web archive type identifier ("com.apple.webarchive") is (1)
written to the pasteboard when copying a rich text selection, and (2) is read when attempting to paste web
content.

* TestWebKitAPI/Tests/WebKitCocoa/CopyHTML.mm:
* TestWebKitAPI/Tests/WebKitCocoa/PasteWebArchive.mm:

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

9 months ago[ASAN] Fix WebGPU tests after r250258
drousso@apple.com [Sat, 19 Oct 2019 00:44:28 +0000 (00:44 +0000)]
[ASAN] Fix WebGPU tests after r250258
https://bugs.webkit.org/show_bug.cgi?id=203133
<rdar://problem/56379008>

Reviewed by Joseph Pecoraro.

* platform/graphics/gpu/GPUObjectBase.h:
(WebCore::GPUObjectBase::~GPUObjectBase): Added.
Add a default virtual destructor since this class class is the one that is `RefCounted` and
the `WebGPUPipeline` subclass is virtual.

* Modules/webgpu/WebGPUPipeline.h:
(WebCore::WebGPUPipeline::scriptExecutionContext const): Deleted.
* Modules/webgpu/WebGPUPipeline.cpp:
(WebCore::WebGPUPipeline::WebGPUPipeline):
(WebCore::WebGPUPipeline::contextDestroyed): Added.
Make `WebGPUPipeline` a subclass of `ContextDestructionObserver` so that the raw pointer to
the associated `ScriptExecutionContext` is properly cleared and isn't UAFd.

* Modules/webgpu/WebGPUComputePipeline.h:
* Modules/webgpu/WebGPUComputePipeline.cpp:
(WebCore::WebGPUComputePipeline::create):
(WebCore::WebGPUComputePipeline::WebGPUComputePipeline):
(WebCore::WebGPUComputePipeline::cloneShaderModules):
(WebCore::WebGPUComputePipeline::recompile):
* Modules/webgpu/WebGPURenderPipeline.h:
* Modules/webgpu/WebGPURenderPipeline.cpp:
(WebCore::WebGPURenderPipeline::create):
(WebCore::WebGPURenderPipeline::WebGPURenderPipeline):
(WebCore::WebGPURenderPipeline::cloneShaderModules):
(WebCore::WebGPURenderPipeline::recompile):
* Modules/webgpu/WebGPUDevice.cpp:
(WebCore::WebGPUDevice::createRenderPipeline):
(WebCore::WebGPUDevice::createComputePipeline):
Rework how Web Inspector preserves related shader modules so that there isn't as much wasted
space in the class layout, as we can use the `RefPtr` itself instead of an `Optional`.

* Modules/webgpu/WebGPUBuffer.idl:
Now that `GPUObjectBase` has a virtual destructor, it has a vtable, which means that this
object also does and therefore cannot be marked with `ImplementationLacksVTable`.

* inspector/InspectorShaderProgram.cpp:
(WebCore::shaderForType):
(WebCore::InspectorShaderProgram::requestShaderSource):
(WebCore::InspectorShaderProgram::updateShader):
(WebCore::InspectorShaderProgram::buildObjectForShaderProgram):

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

9 months ago[ Mac Debug WK1 ] REGRESSION (r251262?): fast/scrolling/latching/scroll-select-bottom...
russell_e@apple.com [Sat, 19 Oct 2019 00:41:44 +0000 (00:41 +0000)]
[ Mac Debug WK1 ] REGRESSION (r251262?): fast/scrolling/latching/scroll-select-bottom-test.html is a Flaky Failure
https://bugs.webkit.org/show_bug.cgi?id=203176

Unreviewed Test Gardening.

* platform/mac-wk1/TestExpectations:

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

9 months ago[ Mac WK1 ] REGRESSION (r251261): Layout Test inspector/console/webcore-logging.html...
russell_e@apple.com [Fri, 18 Oct 2019 23:58:28 +0000 (23:58 +0000)]
[ Mac WK1 ] REGRESSION (r251261): Layout Test inspector/console/webcore-logging.html is consistently Failing
https://bugs.webkit.org/show_bug.cgi?id=203173

Unreviewed Test Gardening.

* platform/mac-wk1/TestExpectations:

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

9 months agoPython 3: Add support in webkitpy.common.watchlist
jbedard@apple.com [Fri, 18 Oct 2019 23:55:20 +0000 (23:55 +0000)]
Python 3: Add support in webkitpy.common.watchlist
https://bugs.webkit.org/show_bug.cgi?id=202473

Reviewed by Dewei Zhu.

* Scripts/test-webkitpy-python3: Add webkitpy.common.watchlist.
* Scripts/webkitpy/common/watchlist/watchlist.py:
(WatchList.find_matching_definitions): Use items instead of iteritems.
* Scripts/webkitpy/common/watchlist/watchlist_unittest.py:
(WatchListTest.test_filename_definition_no_matches): Back-slash needs to be escaped.
(WatchListTest.test_filename_definition): Ditto.
(WatchListTest.test_cc_rules_simple): Ditto.
(WatchListTest.test_cc_rules_complex): Ditto.
(WatchListTest.test_cc_and_message_rules_complex): Ditto.
(WatchListTest.test_cc_and_message_rules_no_matches): Ditto.
(WatchListTest.test_more_and_less_match): Ditto.
(WatchListTest.test_complex_match): Ditto.
* Scripts/webkitpy/common/watchlist/watchlistparser_unittest.py:
(WatchListParserTest.test_bad_definition): Back-slash needs to be escaped.
(WatchListParserTest.test_bad_filename_regex): Ditto.
(WatchListParserTest.test_bad_more_regex): Ditto.
(WatchListParserTest.test_bad_match_type): Ditto.
(WatchListParserTest.test_match_type_typo): Ditto.
(WatchListParserTest.test_empty_cc_rule): Ditto.
(WatchListParserTest.test_cc_rule_with_invalid_email): Ditto.
(WatchListParserTest.test_cc_rule_with_secondary_email): Ditto.
(WatchListParserTest.test_empty_message_rule): Ditto.
(WatchListParserTest.test_unused_defintion): Ditto.
(WatchListParserTest.test_cc_rule_with_undefined_defintion_with_suggestion): Ditto.

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

9 months agoLayout Test inspector/layers/layers-for-node.html is flaky
tsavell@apple.com [Fri, 18 Oct 2019 23:46:03 +0000 (23:46 +0000)]
Layout Test inspector/layers/layers-for-node.html is flaky
https://bugs.webkit.org/show_bug.cgi?id=203171

unreviewed test gardening

* platform/mac/TestExpectations:

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

9 months agoRemove myself from the CMake watchlist
commit-queue@webkit.org [Fri, 18 Oct 2019 23:42:07 +0000 (23:42 +0000)]
Remove myself from the CMake watchlist
https://bugs.webkit.org/show_bug.cgi?id=203166

Patch by Raphael Kubo da Costa <rakuco@webkit.org> on 2019-10-18
Reviewed by Aakash Jain.

* Scripts/webkitpy/common/config/watchlist:

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

9 months ago[iOS] REGRESSION(r251269): fast/events/ios/rotation/do-not-shrink-to-fit-content...
rniwa@webkit.org [Fri, 18 Oct 2019 23:36:36 +0000 (23:36 +0000)]
[iOS] REGRESSION(r251269): fast/events/ios/rotation/do-not-shrink-to-fit-content-after-rotation.html and fast/events/ios/rotation/layout-viewport-during-safari-type-rotation.html fail
https://bugs.webkit.org/show_bug.cgi?id=203162
<rdar://problem/56418459>

Reviewed by Simon Fraser.

Source/WebKit:

Synchronously update the rendering before the orientation change and other viewport size updates.

Otherwise, resize event will be dispatched in the middle of orientation animation,
and would result in non-determistic results.

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

LayoutTests:

Rebaselined the test now that the order of execution of orientationchange and resize events have changed.

* fast/events/ios/rotation/layout-viewport-during-safari-type-rotation-expected.txt:

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

9 months agoRefactor AbstractEventLoop out of WindowEventLoop
rniwa@webkit.org [Fri, 18 Oct 2019 23:34:36 +0000 (23:34 +0000)]
Refactor AbstractEventLoop out of WindowEventLoop
https://bugs.webkit.org/show_bug.cgi?id=203136
<rdar://problem/56396749>

Reviewed by Antti Koivisto.

Extract AbstractEventLoop out of WindowEventLoop as a preparation for adding WorkerEventLoop.

Also replaced m_activeTaskCount with a boolean m_isScheduledToRun since it doesn't need to count.

* WebCore.xcodeproj/project.pbxproj:
* dom/AbstractEventLoop.cpp: Added.
* dom/AbstractEventLoop.h: Added.
(WebCore::AbstractEventLoop): Added.
* dom/WindowEventLoop.cpp:
(WebCore::WindowEventLoop::WindowEventLoop): Deleted. Use the default constructor in the header instead.
(WebCore::WindowEventLoop::queueTask):
(WebCore::WindowEventLoop::suspend):
(WebCore::WindowEventLoop::resume):
(WebCore::WindowEventLoop::scheduleToRunIfNeeded): Extracted out of queueTask.
(WebCore::WindowEventLoop::run):
* dom/WindowEventLoop.h:

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

9 months ago[JSC] Make ConcurrentJSLock Lock even if ENABLE_CONCURRENT_JS=OFF
ysuzuki@apple.com [Fri, 18 Oct 2019 23:32:04 +0000 (23:32 +0000)]
[JSC] Make ConcurrentJSLock Lock even if ENABLE_CONCURRENT_JS=OFF
https://bugs.webkit.org/show_bug.cgi?id=202892

Reviewed by Mark Lam.

Source/JavaScriptCore:

We are using ConcurrentJSLock to guard data structure against concurrent compilers.
But these data structures should be guarded by GC concurrent collector, so we are using this ConcurrentJSLock
to guard them against concurrent collector too.
The problem is that ENABLE(CONCURRENT_JS) relies on ENABLE(DFG_JIT). If we configure JSC with the options like,

    ENABLE_DFG_JIT 0
    ENABLE_FTL_JIT 0

Then, the built JSC becomes

    ENABLE_CONCURRENT_JS 0
    But, Concurrent GC is enabled.

This is wrong due to several reasons.

    1. Baseline JIT can produce JIT related data structures that are traced by concurrent collector. In the above options,
       these data structures are not guarded by lock.
    2. Baseline JIT also has concurrent JIT compiler. But ENABLE_CONCURRENT_JS does not reflect this.

In this patch, we fix two things.

1. We should make ConcurrentJSLock always Lock. In 64bit environment we are supporting actively (including watchOS ARM64_32),
   we are enabling ENABLE(JIT) regardless of we are actually using JIT. So, anyway, this is already a Lock. Flipping these
   bits does not matter in 32bit architectures since they do not have concurrent compilers anyway. This makes things simpler:
   it is always a Lock. And concurrent collector can use it.
2. We should make `ENABLE(CONCURRENT_JS)` ON when `ENABLE(JIT)` is true, to reflect the fact that Baseline JIT has concurrent compiler.

* runtime/ConcurrentJSLock.h:
(JSC::ConcurrentJSLocker::ConcurrentJSLocker):

Source/WTF:

BaselineJIT also has concurrent compiler. ENABLE(CONCURRENT_JS) should not rely on ENABLE(DFG_JIT).
It should rely on ENABLE(JIT) instead.

* wtf/Platform.h:

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

9 months agoWeb Inspector: Elements: allow WebKit engineers to edit UserAgent shadow trees
drousso@apple.com [Fri, 18 Oct 2019 22:54:09 +0000 (22:54 +0000)]
Web Inspector: Elements: allow WebKit engineers to edit UserAgent shadow trees
https://bugs.webkit.org/show_bug.cgi?id=203159

Reviewed by Brian Burg.

Source/JavaScriptCore:

* inspector/protocol/DOM.json:
Add `setAllowEditingUserAgentShadowTrees` command.

Source/WebCore:

Test: inspector/dom/setAllowEditingUserAgentShadowTrees.html

* inspector/agents/InspectorDOMAgent.h:
* inspector/agents/InspectorDOMAgent.cpp:
(WebCore::InspectorDOMAgent::assertEditableNode):
(WebCore::InspectorDOMAgent::setInspectedNode):
(WebCore::InspectorDOMAgent::setAllowEditingUserAgentShadowTrees): Added.

Source/WebInspectorUI:

* UserInterface/Controllers/DOMManager.js:
(WI.DOMManager.prototype.initializeTarget):
(WI.DOMManager.supportsEditingUserAgentShadowTrees): Added.
* UserInterface/Models/CSSStyleDeclaration.js:
(WI.CSSStyleDeclaration.prototype.get editable):
* UserInterface/Views/ContextMenuUtilities.js:
(WI.appendContextMenuItemsForDOMNode):
* UserInterface/Views/DOMTreeElement.js:
(WI.DOMTreeElement.prototype.get editable):
(WI.DOMTreeElement.prototype._startEditingTarget):
(WI.DOMTreeElement.prototype.populateDOMNodeContextMenu):

* UserInterface/Views/GeneralStyleDetailsSidebarPanel.js:
(WI.GeneralStyleDetailsSidebarPanel):
(WI.GeneralStyleDetailsSidebarPanel.prototype._showPanel):
(WI.GeneralStyleDetailsSidebarPanel.prototype._handleNodeChanged): Added.
* UserInterface/Views/StyleDetailsPanel.js:
(WI.StyleDetailsPanel.prototype.get supportsNewRule): Added.
(WI.StyleDetailsPanel.prototype.markAsNeedsRefresh):
(WI.StyleDetailsPanel.prototype.refresh):
* UserInterface/Views/SpreadsheetRulesStyleDetailsPanel.js:
(WI.SpreadsheetRulesStyleDetailsPanel.prototype.get supportsNewRule): Added.
(WI.SpreadsheetRulesStyleDetailsPanel.prototype.newRuleButtonClicked):
(WI.SpreadsheetRulesStyleDetailsPanel.prototype.newRuleButtonContextMenu):
Don't show the "Add Rule" button if the selected node is inside a UserAgent shadow tree.

* UserInterface/Base/Setting.js:
* UserInterface/Views/SettingsTabContentView.js:
(WI.SettingsTabContentView.prototype._createEngineeringSettingsView):

LayoutTests:

* inspector/dom/setAllowEditingUserAgentShadowTrees.html: Added.
* inspector/dom/setAllowEditingUserAgentShadowTrees-expected.txt: Added.

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

9 months agoDocument::m_closeAfterStyleRecalc is unnecessary
rniwa@webkit.org [Fri, 18 Oct 2019 22:45:59 +0000 (22:45 +0000)]
Document::m_closeAfterStyleRecalc is unnecessary
https://bugs.webkit.org/show_bug.cgi?id=203143

Reviewed by Antti Koivisto.

Removed the code to defer implicit close until the style recalc is done
since we call FrameLoader::checkCompleted asynchronously via a timer these days.

* dom/Document.cpp:
(WebCore::Document::resolveStyle):
(WebCore::Document::implicitClose):
* dom/Document.h:

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

9 months ago[iOS] "Unexpectedly Resumed" process assertion may cause us to get terminated
cdumez@apple.com [Fri, 18 Oct 2019 22:45:42 +0000 (22:45 +0000)]
[iOS] "Unexpectedly Resumed" process assertion may cause us to get terminated
https://bugs.webkit.org/show_bug.cgi?id=203046
<rdar://problem/56179592>

Reviewed by Geoffrey Garen.

This patch implements the following to avoid getting terminated:
1. Schedule the task to release the assertion on a background thread instead of
   the main thread so that we end up releasing the task even if the main thread
   is somehow hung.
2. Add an invalidation handler to the process assertion which releases the assertion
   upon expiration.

* UIProcess/Cocoa/WebProcessProxyCocoa.mm:
(WebKit::WebProcessProxy::processWasUnexpectedlyUnsuspended):
* WebProcess/WebProcess.cpp:
(WebKit::WebProcess::processDidResume):
* WebProcess/WebProcess.h:
* WebProcess/cocoa/WebProcessCocoa.mm:
(WebKit::WebProcess::processTaskStateDidChange):

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

9 months agotexImage2D for a half-float texture only accepts null
dino@apple.com [Fri, 18 Oct 2019 22:29:47 +0000 (22:29 +0000)]
texImage2D for a half-float texture only accepts null
https://bugs.webkit.org/show_bug.cgi?id=169999
<rdar://problem/31713571>

Reviewed by Simon Fraser.

Source/WebCore:

After we initially implemented this, the extension was
modified such that texImage2D could upload to half-float
from a Uint16 array.

Test: fast/canvas/webgl/oes-texture-half-float-uint16.html

* html/canvas/WebGLRenderingContextBase.cpp:
(WebCore::WebGLRenderingContextBase::validateArrayBufferType): Accept
Uint16.

LayoutTests:

Add a new test, and update the expected results of existing tests.

* fast/canvas/webgl/oes-texture-half-float-uint16-expected.txt: Added.
* fast/canvas/webgl/oes-texture-half-float-uint16.html: Added.
* webgl/2.0.0/conformance/extensions/oes-texture-half-float-expected.txt:
* webgl/2.0.0/conformance2/extensions/ext-color-buffer-float-expected.txt:
* webgl/2.0.0/conformance2/textures/misc/tex-new-formats-expected.txt:

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

9 months agoWeb Inspector: Elements: $0 is shown for the wrong node when selecting elements in...
drousso@apple.com [Fri, 18 Oct 2019 22:27:58 +0000 (22:27 +0000)]
Web Inspector: Elements: $0 is shown for the wrong node when selecting elements in a user agent shadow tree
https://bugs.webkit.org/show_bug.cgi?id=203155

Reviewed by Matt Baker.

Rather than naively using the last selected node (from `WI.TreeOutline`), we should wait
to see if the inspected page's DOM agent allows the selected node to be used as the
inspected node, and if so then to show the `$0`.

* UserInterface/Controllers/DOMManager.js:
(WI.DOMManager.prototype.setInspectedNode):

* UserInterface/Views/DOMTreeContentView.js:
(WI.DOMTreeContentView):
* UserInterface/Views/DOMTreeOutline.js:
(WI.DOMTreeOutline.prototype._handleInspectedNodeChanged): Added.
* UserInterface/Views/DOMTreeOutline.css:
(.tree-outline.dom li.inspected-node > span::after): Added.
(.tree-outline.dom:focus li.inspected-node.selected > span::after): Added.
(.tree-outline.dom.show-last-selected li.last-selected > span::after): Deleted.
(.tree-outline.dom.show-last-selected:focus li.last-selected > span::after): Deleted.

* UserInterface/Views/TreeOutline.js:
(WI.TreeOutline.prototype.selectionControllerSelectionDidChange):

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

9 months agofast/events/ios/forward-delete-in-editable.html is a flaky failure
dbates@webkit.org [Fri, 18 Oct 2019 22:23:55 +0000 (22:23 +0000)]
fast/events/ios/forward-delete-in-editable.html is a flaky failure
https://bugs.webkit.org/show_bug.cgi?id=203049
<rdar://problem/52969457>

Reviewed by Wenson Hsieh.

Now that <rdar://problem/45772078> is fixed we can write the test such that we check the test
result after we receive a DOM key up for the forward delete. Currently the test makes use of a
workaround that incorrectly assumes that the keyboard will call back into WebKit to perform the
forward deletion before the web process blur()s the field. This is not guaranteed to happen.
Instead wait until we receive a DOM key up for the delete key.

* fast/events/ios/forward-delete-in-editable.html:

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

9 months agoLayout Test http/tests/security/contentSecurityPolicy/iframe-allowed-when-loaded...
dbates@webkit.org [Fri, 18 Oct 2019 22:21:56 +0000 (22:21 +0000)]
Layout Test http/tests/security/contentSecurityPolicy/iframe-allowed-when-loaded-via-javascript-url.html is flaky
https://bugs.webkit.org/show_bug.cgi?id=202481
<rdar://problem/55916200>

Reviewed by Youenn Fablet.

Have the iframe's document call testRunner.notifyDone() instead of assuming that the document will
be loaded by the next turn of the event loop.

* http/tests/security/contentSecurityPolicy/iframe-allowed-when-loaded-via-javascript-url.html:

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

9 months agoREGRESSION (r241747): [iOS] Adjust default SVG focus ring width to match width for...
dbates@webkit.org [Fri, 18 Oct 2019 22:16:46 +0000 (22:16 +0000)]
REGRESSION (r241747): [iOS] Adjust default SVG focus ring width to match width for HTML documents
https://bugs.webkit.org/show_bug.cgi?id=203011

Reviewed by Wenson Hsieh.

Source/WebCore:

Update default user agent stylesheet for SVG documents (i.e. .svg resources) to use the same 3px
outline width for focused elements as we do for HTML documents.

This makes the test imported/blink/svg/custom/focus-ring-2.svg pass on iOS.

* css/svg.css:

LayoutTests:

Remove the test imported/blink/svg/custom/focus-ring-2.svg now that it passes, again.

* platform/ios/TestExpectations:

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

9 months agoAdd experimental HDR MediaCapabilities support.
jer.noble@apple.com [Fri, 18 Oct 2019 22:00:48 +0000 (22:00 +0000)]
Add experimental HDR MediaCapabilities support.
https://bugs.webkit.org/show_bug.cgi?id=203113

Reviewed by Eric Carlson.

Source/WebCore:

Tests: media/mediacapabilities/mock-decodingInfo-hdr.html
       platform/mac/media/mediacapabilities/hevc-decodingInfo-hdr.html

Add support for MediaCapabilities.decodeInfo() HDR support detection.

Add new enum IDL types to MediaCapabilities and remove old unused ones. Add
mock implementation for HDR detection. Add Cocoa platform implementation.

* CMakeLists.txt:
* DerivedSources-input.xcfilelist:
* DerivedSources-output.xcfilelist:
* DerivedSources.make:
* Modules/mediacapabilities/ColorGamut.idl:
* Modules/mediacapabilities/HdrMetadataType.idl:
* Modules/mediacapabilities/ScreenLuminance.h:
* Modules/mediacapabilities/TransferFunction.idl:
* Modules/mediacapabilities/VideoConfiguration.idl:
* Scripts/GenerateSettings.rb:
* Sources.txt:
* WebCore.xcodeproj/project.pbxproj:
* bindings/scripts/CodeGenerator.pm:
(WK_ucfirst):
* bindings/scripts/CodeGeneratorJS.pm:
(ToMethodName):
* page/Settings.yaml:
* platform/graphics/cocoa/MediaEngineConfigurationFactoryCocoa.cpp:
(WebCore::createMediaPlayerDecodingConfigurationCocoa):
* platform/mediacapabilities/ColorGamut.h:
* platform/mediacapabilities/HdrMetadataType.h:
* platform/mediacapabilities/TransferFunction.h:
* platform/mediacapabilities/VideoConfiguration.h:
* platform/mock/MediaEngineConfigurationFactoryMock.cpp:
(WebCore::canDecodeMedia):
(WebCore::canEncodeMedia):

Source/WebKit:

Add experimental hdrMediaCapabilitiesEnabled preference.

* Shared/WebPreferences.yaml:

LayoutTests:

* media/mediacapabilities/mock-decodingInfo-alphaChannel-expected.txt:
* media/mediacapabilities/mock-decodingInfo-hdr-expected.txt: Added.
* media/mediacapabilities/mock-decodingInfo-hdr.html: Added.
* platform/mac/media/mediacapabilities/hevc-decodingInfo-hdr-expected.txt: Added.
* platform/mac/media/mediacapabilities/hevc-decodingInfo-hdr.html: Added.

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

9 months agoWeb Inspector: REGRESSION(r251254): Elements: forced pseudo-class indicator isn't...
drousso@apple.com [Fri, 18 Oct 2019 21:33:06 +0000 (21:33 +0000)]
Web Inspector: REGRESSION(r251254): Elements: forced pseudo-class indicator isn't visible for selected nodes
https://bugs.webkit.org/show_bug.cgi?id=203158

Reviewed by Matt Baker.

* UserInterface/Views/DOMTreeOutline.css:
(.tree-outline.dom li > :not(.selection-area)): Added.
(.tree-outline.dom li > span): Deleted.

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

9 months agoUnreviewed, remove an extraneous header import after r251279
wenson_hsieh@apple.com [Fri, 18 Oct 2019 21:30:18 +0000 (21:30 +0000)]
Unreviewed, remove an extraneous header import after r251279

Address a post-landing review comment.

* DumpRenderTree/mac/DumpRenderTreePasteboard.mm:

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

9 months ago[WebAuthn] Implement AuthenticatorCancel
jiewen_tan@apple.com [Fri, 18 Oct 2019 20:55:56 +0000 (20:55 +0000)]
[WebAuthn] Implement AuthenticatorCancel
https://bugs.webkit.org/show_bug.cgi?id=191523
<rdar://problem/55920204>

Reviewed by Brent Fulgham.

Source/WebCore:

Covered by new tests in existing test files.

* Modules/credentialmanagement/CredentialsContainer.cpp:
(WebCore::CredentialsContainer::get):
(WebCore::CredentialsContainer::isCreate):
* Modules/webauthn/AuthenticatorCoordinator.cpp:
(WebCore::AuthenticatorCoordinator::create const):
(WebCore::AuthenticatorCoordinator::discoverFromExternalSource const):
* Modules/webauthn/AuthenticatorCoordinator.h:
* Modules/webauthn/AuthenticatorCoordinatorClient.cpp: Removed.
* Modules/webauthn/AuthenticatorCoordinatorClient.h:
* Modules/webauthn/PublicKeyCredential.cpp:
(WebCore::PublicKeyCredential::tryCreate):
* Modules/webauthn/PublicKeyCredential.h:
* Modules/webauthn/PublicKeyCredentialData.h:
* Modules/webauthn/fido/DeviceRequestConverter.h:
* Modules/webauthn/fido/FidoHidMessage.cpp:
(fido::FidoHidMessage::FidoHidMessage):
* Modules/webauthn/fido/FidoHidPacket.cpp:
(fido::FidoHidInitPacket::getSerializedData const):
(fido::FidoHidContinuationPacket::getSerializedData const):
* Sources.txt:
* WebCore.xcodeproj/project.pbxproj:
* testing/MockWebAuthenticationConfiguration.h:
(WebCore::MockWebAuthenticationConfiguration::HidConfiguration::encode const):
(WebCore::MockWebAuthenticationConfiguration::HidConfiguration::decode):
* testing/MockWebAuthenticationConfiguration.idl:
Adds a new option to test AuthenticatorCancel.

Source/WebKit:

This patch implement two ways to cancel a pending WebAuthn ceremony:
1) Via navigation activities. Activities include i) main frame navigation, ii) main frame reload,
iii) main frame destruction, iv) sub frame navigation, and v) sub frame destruction. All the above
activities will cancel any pending WebAuthn ceremony that is associated with the frame. To prove
the association, a GlobalFrameIdentifier is bridged into WebAuthenticationRequestData. Navigation
cancel is done in WebPageProxy::didStartProvisionalLoadForFrameShared, and destruction cancel is done
in WebProcessProxy::didDestroyFrame and WebPageProxy::resetState.
2) Via UI. This path is simply bridged -[_WKWebAuthenticationPanel cancel] into AuthenticatorManager.
Noted, this patch follows the spec to wait until time out to notify RPs.
References: i) Step 20 of https://www.w3.org/TR/webauthn/#createCredential, ii) Step 18 of
https://www.w3.org/TR/webauthn/#getAssertion

As for what the cancel actually does, it:
1) stops any HID/NFC scanning;
2) sends CTAPHID_CANCEL to any HID authenticators that have been added. Reference:
https://fidoalliance.org/specs/fido-v2.0-ps-20190130/fido-client-to-authenticator-protocol-v2.0-ps-20190130.html#usb-hid-cancel
Sending CTAPHID_CANCEL, however, is not trivial. An abstract class FidoAuthenticator is crafted to
do this labor for both CtapAuthenticator and U2fAuthenticator during the time of destructions.
Noted: The CtapHidDriver is the only CtapDriver implements the cancel method. Since the message
is sent during state reset, lifecycle of the HidConenction and HidService which manage the underlying
IOHIDDeviceRef is very hard to hold. This is required for the regular async sender. Therefore,
HidConnection::sendSync is crafted to send the message synchronously to get rid of the tediousness
of managing those lifecycles.

P.S. Vector::grow doesn't initialize POD types. Therefore, this patch also appends it with memset
for FidoHidPacket.

P.S.S. This patch also simplifies AuthenticatorCoordinatorClient by: i) moving code from AuthenticatorCoordinatorClient
to WebAuthenticatorCoordinatorClient, and ii) using sendWithAsyncReply. The latter allows us to
get rid of the complex mechanism of ensuring the right reply is returned.

* DerivedSources.make:
* Sources.txt:
* UIProcess/API/APIWebAuthenticationPanel.cpp:
(API::WebAuthenticationPanel::create):
(API::WebAuthenticationPanel::WebAuthenticationPanel):
(API::WebAuthenticationPanel::cancel const):
* UIProcess/API/APIWebAuthenticationPanel.h:
* UIProcess/API/Cocoa/_WKWebAuthenticationPanel.mm:
(-[_WKWebAuthenticationPanel cancel]):
* UIProcess/WebAuthentication/AuthenticatorManager.cpp:
(WebKit::AuthenticatorManager::cancelRequest):
(WebKit::AuthenticatorManager::clearState):
(WebKit::AuthenticatorManager::runPanel):
(WebKit::AuthenticatorManager::resetState):
* UIProcess/WebAuthentication/AuthenticatorManager.h:
* UIProcess/WebAuthentication/Cocoa/HidConnection.h:
(WebKit::HidConnection::isInitialized const):
(WebKit::HidConnection::setIsInitialized):
* UIProcess/WebAuthentication/Cocoa/HidConnection.mm:
(WebKit::HidConnection::~HidConnection):
(WebKit::HidConnection::initialize):
(WebKit::HidConnection::terminate):
(WebKit::HidConnection::sendSync):
(WebKit::HidConnection::send):
(WebKit::HidConnection::registerDataReceivedCallback):
* UIProcess/WebAuthentication/Mock/MockHidConnection.cpp:
(WebKit::MockHidConnection::initialize):
(WebKit::MockHidConnection::terminate):
(WebKit::MockHidConnection::sendSync):
(WebKit::MockHidConnection::send):
(WebKit::MockHidConnection::feedReports):
* UIProcess/WebAuthentication/Mock/MockHidConnection.h:
* UIProcess/WebAuthentication/WebAuthenticationRequestData.h:
* UIProcess/WebAuthentication/WebAuthenticatorCoordinatorProxy.cpp:
(WebKit::WebAuthenticatorCoordinatorProxy::makeCredential):
(WebKit::WebAuthenticatorCoordinatorProxy::getAssertion):
(WebKit::WebAuthenticatorCoordinatorProxy::handleRequest):
(WebKit::WebAuthenticatorCoordinatorProxy::isUserVerifyingPlatformAuthenticatorAvailable):
(WebKit::WebAuthenticatorCoordinatorProxy::requestReply): Deleted.
* UIProcess/WebAuthentication/WebAuthenticatorCoordinatorProxy.h:
* UIProcess/WebAuthentication/WebAuthenticatorCoordinatorProxy.messages.in:
* UIProcess/WebAuthentication/fido/CtapAuthenticator.cpp:
(WebKit::CtapAuthenticator::CtapAuthenticator):
(WebKit::CtapAuthenticator::makeCredential):
(WebKit::CtapAuthenticator::getAssertion):
(WebKit::CtapAuthenticator::tryDowngrade):
* UIProcess/WebAuthentication/fido/CtapAuthenticator.h:
* UIProcess/WebAuthentication/fido/CtapDriver.h:
(WebKit::CtapDriver::cancel):
* UIProcess/WebAuthentication/fido/CtapHidDriver.cpp:
(WebKit::CtapHidDriver::Worker::write):
(WebKit::CtapHidDriver::Worker::read):
(WebKit::CtapHidDriver::Worker::returnMessage):
(WebKit::CtapHidDriver::Worker::reset):
(WebKit::CtapHidDriver::Worker::cancel):
(WebKit::CtapHidDriver::continueAfterChannelAllocated):
(WebKit::CtapHidDriver::continueAfterResponseReceived):
(WebKit::CtapHidDriver::returnResponse):
(WebKit::CtapHidDriver::reset):
(WebKit::CtapHidDriver::cancel):
* UIProcess/WebAuthentication/fido/CtapHidDriver.h:
* UIProcess/WebAuthentication/fido/FidoAuthenticator.cpp: Copied from Source/WebKit/UIProcess/API/APIWebAuthenticationPanel.cpp.
(WebKit::FidoAuthenticator::FidoAuthenticator):
(WebKit::FidoAuthenticator::~FidoAuthenticator):
(WebKit::FidoAuthenticator::driver const):
(WebKit::FidoAuthenticator::releaseDriver):
* UIProcess/WebAuthentication/fido/FidoAuthenticator.h: Copied from Source/WebKit/UIProcess/API/APIWebAuthenticationPanel.cpp.
* UIProcess/WebAuthentication/fido/FidoService.cpp:
(WebKit::FidoService::continueAfterGetInfo):
* UIProcess/WebAuthentication/fido/U2fAuthenticator.cpp:
(WebKit::U2fAuthenticator::U2fAuthenticator):
(WebKit::U2fAuthenticator::issueCommand):
* UIProcess/WebAuthentication/fido/U2fAuthenticator.h:
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::didStartProvisionalLoadForFrameShared):
(WebKit::WebPageProxy::resetState):
* UIProcess/WebProcessProxy.cpp:
(WebKit::WebProcessProxy::didDestroyFrame):
* WebKit.xcodeproj/project.pbxproj:
* WebProcess/WebAuthentication/WebAuthenticatorCoordinator.cpp:
(WebKit::WebAuthenticatorCoordinator::WebAuthenticatorCoordinator):
(WebKit::WebAuthenticatorCoordinator::makeCredential):
(WebKit::WebAuthenticatorCoordinator::getAssertion):
(WebKit::WebAuthenticatorCoordinator::isUserVerifyingPlatformAuthenticatorAvailable):
(WebKit::WebAuthenticatorCoordinator::~WebAuthenticatorCoordinator): Deleted.
* WebProcess/WebAuthentication/WebAuthenticatorCoordinator.h:
* WebProcess/WebAuthentication/WebAuthenticatorCoordinator.messages.in: Removed.
* WebProcess/WebPage/WebFrame.cpp:
(WebKit::WebFrame::fromCoreFrame):
* WebProcess/WebPage/WebFrame.h:

Tools:

* TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
* TestWebKitAPI/Tests/WebCore/FidoHidMessageTest.cpp:
(TestWebKitAPI::TEST):
* TestWebKitAPI/Tests/WebKitCocoa/_WKWebAuthenticationPanel.mm:
(-[TestWebAuthenticationPanelUIDelegate webView:runWebAuthenticationPanel:initiatedByFrame:completionHandler:]):
(TestWebKitAPI::TEST):
* TestWebKitAPI/Tests/WebKitCocoa/web-authentication-get-assertion-hid-cancel.html: Copied from Tools/TestWebKitAPI/Tests/WebKitCocoa/web-authentication-get-assertion-hid.html.
* TestWebKitAPI/Tests/WebKitCocoa/web-authentication-get-assertion-hid.html:
* TestWebKitAPI/Tests/WebKitCocoa/web-authentication-get-assertion-nfc.html:
* TestWebKitAPI/Tests/WebKitCocoa/web-authentication-get-assertion.html:

LayoutTests:

Modified one of the error message that is no longer emitted.

* http/wpt/webauthn/public-key-credential-create-failure.https.html:
* http/wpt/webauthn/public-key-credential-create-success-hid.https.html:
* http/wpt/webauthn/public-key-credential-get-failure.https.html:
* http/wpt/webauthn/public-key-credential-get-success-hid.https.html:

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

9 months agoFlaky Test: fast/events/resize-subframe-in-rendering-update.html
rniwa@webkit.org [Fri, 18 Oct 2019 19:44:22 +0000 (19:44 +0000)]
Flaky Test: fast/events/resize-subframe-in-rendering-update.html
https://bugs.webkit.org/show_bug.cgi?id=203140

Reviewed by Simon Fraser.

The flakiness was caused by the race condition between rAF and setTimeout. In many cases,
setTimeout was getting scheduled after the next rAF and prevented some assertions to run in time.

Fixed the flakiness by moving setTimeout to outside the setTimeout in which tests run so that
those assertions would always run.

Rebaselined the test since these assertions in setTimeout are now always included in the results.

* fast/events/resize-subframe-in-rendering-update-expected.txt:
* fast/events/resize-subframe-in-rendering-update.html:

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

9 months agoCleanup: Stop setting -ApplePersistenceIgnoreState when running debug Mac WebKit
bburg@apple.com [Fri, 18 Oct 2019 19:18:34 +0000 (19:18 +0000)]
Cleanup: Stop setting -ApplePersistenceIgnoreState when running debug Mac WebKit
https://bugs.webkit.org/show_bug.cgi?id=203156

Reviewed by Jonathan Bedard.

This is no longer needed. The new value has been supported since 2014.

* Scripts/webkitdirs.pm:
(argumentsForRunAndDebugMacWebKitApp):

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

9 months agoAdd TextStream dumping for BasicShape types
simon.fraser@apple.com [Fri, 18 Oct 2019 18:54:05 +0000 (18:54 +0000)]
Add TextStream dumping for BasicShape types
https://bugs.webkit.org/show_bug.cgi?id=203150

Reviewed by Zalan Bujtas.

Add dumping for the classes, and make the BasicShape enum an enum class.

* css/BasicShapeFunctions.cpp:
(WebCore::valueForBasicShape):
* rendering/shapes/Shape.cpp:
(WebCore::Shape::createShape):
* rendering/style/BasicShapes.cpp:
(WebCore::BasicShapeCircle::dump const):
(WebCore::BasicShapeEllipse::dump const):
(WebCore::BasicShapePolygon::dump const):
(WebCore::BasicShapePath::dump const):
(WebCore::BasicShapeInset::dump const):
(WebCore::operator<<):
* rendering/style/BasicShapes.h:
(WebCore::BasicShapeCenterCoordinate::BasicShapeCenterCoordinate):

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

9 months agoElementRuleCollector function signature cleanups
antti@apple.com [Fri, 18 Oct 2019 18:46:54 +0000 (18:46 +0000)]
ElementRuleCollector function signature cleanups
https://bugs.webkit.org/show_bug.cgi?id=203153
<rdar://problem/56412684>

Unreviewed followup.

* css/ElementRuleCollector.cpp:
(WebCore::ElementRuleCollector::transferMatchedRules):

Try to appease MSVC.

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

9 months agoLoad event must be fired only for the SVG structurally external elements and the...
commit-queue@webkit.org [Fri, 18 Oct 2019 18:29:11 +0000 (18:29 +0000)]
Load event must be fired only for the SVG structurally external elements and the outermost SVG element
https://bugs.webkit.org/show_bug.cgi?id=203044

Patch by Said Abou-Hallawa <sabouhallawa@apple.com> on 2019-10-18
Reviewed by Simon Fraser.

LayoutTests/imported/w3c:

* web-platform-tests/svg/geometry/svg-image-intrinsic-size-with-cssstyle-auto-expected.txt:
The timeout issues are now fixed. webkit.org/b/202013 will fix the other
failures.

* web-platform-tests/svg/images/20x20.png: Added.
Add an image which is referenced by these tests:
    web-platform-tests/svg/import/styling-pres-02-f-manual.svg
    web-platform-tests/svg/import/struct-use-01-t-manual.svg
    web-platform-tests/svg/import/interact-events-02-b-manual.svg

* web-platform-tests/svg/linking/scripted/href-script-element-expected.txt:

Source/WebCore:

The SVG1.1 spec for SVGLoad event is:
    https://www.w3.org/TR/SVG11/interact.html

The SVG2 spec for the load event is:
    https://www.w3.org/TR/SVG/changes.html#interact
    https://www.w3.org/TR/SVG/interact.html

SVG2 removes the SVGExternalResourcesRequired interface. It also simplifies
the rules for firing the load event and made them consistent with the HTML
specs. The plan is to remove SVGExternalResourcesRequired in a following
patch. This patch makes SVGExternalResourcesRequired have no effect on the
load event firing rules. It moves all the functionalities to SVGURIReference
as a step towards removing the SVGExternalResourcesRequired interface.

Test: svg/custom/image-load-event.html

* dom/Document.cpp:
(WebCore::Document::implicitClose):
Do not use the SVGLoad term. It has been removed from the specs.

* dom/ScriptElement.cpp:
(WebCore::ScriptElement::ScriptElement):
* dom/ScriptElement.h:
(WebCore::ScriptElement::errorOccurred const):
(WebCore::ScriptElement::setErrorOccurred):
Add a method to track the occurrence  of loading error. errorOccurred()
|| haveFiredLoadEvent() means no pending loading activity.

* svg/SVGDocumentExtensions.cpp:
(WebCore::SVGDocumentExtensions::dispatchLoadEventToOutermostSVGElements):
(WebCore::SVGDocumentExtensions::dispatchSVGLoadEventToOutermostSVGElements): Deleted.
* svg/SVGDocumentExtensions.h:
Do not use the SVGLoad term.

* svg/SVGElement.cpp:
(WebCore::SVGElement::sendLoadEventIfPossible):
(WebCore::SVGElement::loadEventTimerFired):
(WebCore::SVGElement::loadEventTimer):
(WebCore::SVGElement::finishParsingChildren):
(WebCore::SVGElement::sendSVGLoadEventIfPossible): Deleted.
(WebCore::SVGElement::sendSVGLoadEventIfPossibleAsynchronously): Deleted.
(WebCore::SVGElement::svgLoadEventTimerFired): Deleted.
(WebCore::SVGElement::svgLoadEventTimer): Deleted.
* svg/SVGElement.h:
finishParsingChildren() won't fire 'load' event anymore. The 'load' event
will be fired explicitly for the outermost SVG element from Document::implicitClose().

* svg/SVGExternalResourcesRequired.cpp:
(WebCore::SVGExternalResourcesRequired::svgAttributeChanged):
(WebCore::SVGExternalResourcesRequired::dispatchLoadEvent): Deleted.
(WebCore::SVGExternalResourcesRequired::insertedIntoDocument): Deleted.
(WebCore::SVGExternalResourcesRequired::finishParsingChildren): Deleted.
(WebCore::SVGExternalResourcesRequired::haveLoadedRequiredResources const): Deleted.
* svg/SVGExternalResourcesRequired.h:
(WebCore::SVGExternalResourcesRequired::setHaveFiredLoadEvent): Deleted.
(WebCore::SVGExternalResourcesRequired::isParserInserted const): Deleted.
(WebCore::SVGExternalResourcesRequired::haveFiredLoadEvent const): Deleted.
* svg/SVGImageElement.cpp:
(WebCore::SVGImageElement::haveLoadedRequiredResources):
* svg/SVGImageLoader.cpp:
(WebCore::SVGImageLoader::dispatchLoadEvent):
The value of externalResourcesRequired() no longer controls firing the
'load' event.

* svg/SVGScriptElement.cpp:
(WebCore::SVGScriptElement::SVGScriptElement):
(WebCore::SVGScriptElement::insertedIntoAncestor):
(WebCore::SVGScriptElement::dispatchErrorEvent):
(WebCore::SVGScriptElement::finishParsingChildren): Deleted.
* svg/SVGScriptElement.h:
dispatchErrorEvent() is now a virtual function. Let SVGScriptElement
overrides it so it can track when the loader finishes its activity.

* svg/SVGStyleElement.cpp:
(WebCore::SVGStyleElement::SVGStyleElement):
* svg/SVGStyleElement.h:

* svg/SVGURIReference.cpp:
(WebCore::SVGURIReference::contextElement const):
(WebCore::SVGURIReference::parseAttribute):
(WebCore::SVGURIReference::haveLoadedRequiredResources const):
(WebCore::SVGURIReference::dispatchLoadEvent):
* svg/SVGURIReference.h:
(WebCore::SVGURIReference::haveFiredLoadEvent const):
(WebCore::SVGURIReference::setHaveFiredLoadEvent):
(WebCore::SVGURIReference::errorOccurred const):
(WebCore::SVGURIReference::setErrorOccurred):
SVGURIReference will decide whether the 'load' event can be fired or not.

* svg/SVGUseElement.cpp:
(WebCore::SVGUseElement::SVGUseElement):
(WebCore::SVGUseElement::insertedIntoAncestor):
(WebCore::SVGUseElement::notifyFinished):
(WebCore::SVGUseElement::finishParsingChildren): Deleted.
(WebCore::SVGUseElement::isValid const): Deleted.
(WebCore::SVGUseElement::haveLoadedRequiredResources): Deleted.
(WebCore::SVGUseElement::setHaveFiredLoadEvent): Deleted.
(WebCore::SVGUseElement::haveFiredLoadEvent const): Deleted.
(WebCore::SVGUseElement::svgLoadEventTimer): Deleted.
* svg/SVGUseElement.h:
SVGUseElement needs to track firing the load event or error occurrence
the same way SVGImageElement and SVGScriptElement do.

LayoutTests:

* fast/dom/crash-moving-subtree-between-documents.html:
* fast/dom/focus-style-resolution.html:
* fast/html/marquee-reparent-check.html:
The SVGElement element should not fire "load" event. Set the HTML <body>
element's "onload" event handler to be the function which was set to the
SVGElement's "onload" event handler.

* svg/custom/image-load-event-expected.html: Added.
* svg/custom/image-load-event.html: Added.
Images with external resources or data URIs must fire load events once
the data is loaded or decoded.

* svg/custom/loadevents-async-expected.txt: Removed.
* svg/custom/loadevents-async.html: Removed.
* svg/custom/loadevents-capturing-expected.txt: Removed.
* svg/custom/loadevents-capturing.svg: Removed.
* svg/custom/loadevents-externalresourcesrequired-displaynone-expected.txt: Removed.
* svg/custom/loadevents-externalresourcesrequired-displaynone.svg: Removed.
* svg/custom/loadevents-externalresourcesrequired-expected.txt: Removed.
* svg/custom/loadevents-externalresourcesrequired.svg: Removed.
* svg/custom/loadevents-normal-displaynone-expected.txt: Removed.
* svg/custom/loadevents-normal-displaynone.svg: Removed.
* svg/custom/loadevents-normal-expected.txt: Removed.
* svg/custom/loadevents-normal.svg: Removed.
These tests were implementing the SVG1.1 SVGLoad event interactivity:
https://www.w3.org/TR/SVG11/interact.html where every SVG element had to
fire the SVGLoad event once it parsed its closing tag. SVG structurally
external elements were firing load events when the corresponding external
resources had finished loading but only if externalResourcesRequired = true.

* svg/dom/SVGScriptElement/script-load-and-error-events.svg:
This test had two wrong assumptions:
1) The SVG structurally external element fires a load event when parsing
the children finishes. Then they may fire another load or error event if
externalResourcesRequired = true.
2) The outermost SVG element will not fire its load event unless all the
children fires their load events correctly.

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

9 months agoElementRuleCollector function signature cleanups
antti@apple.com [Fri, 18 Oct 2019 18:08:43 +0000 (18:08 +0000)]
ElementRuleCollector function signature cleanups
https://bugs.webkit.org/show_bug.cgi?id=203153

Reviewed by Zalan Bujtas.

Many functions in ElementRuleCollector take repetitive arguments that can be removed:

- Make includeEmptyRules argument a class member
- Remove RuleRange argument, update the ranges in rule transfer step.

* css/ElementRuleCollector.cpp:
(WebCore::MatchRequest::MatchRequest):
(WebCore::ElementRuleCollector::addMatchedRule):
(WebCore::ElementRuleCollector::collectMatchingRules):
(WebCore::ElementRuleCollector::sortAndTransferMatchedRules):
(WebCore::ElementRuleCollector::transferMatchedRules):
(WebCore::ElementRuleCollector::matchAuthorRules):
(WebCore::ElementRuleCollector::matchesAnyAuthorRules):
(WebCore::ElementRuleCollector::collectMatchingAuthorRules):
(WebCore::ElementRuleCollector::matchAuthorShadowPseudoElementRules):
(WebCore::ElementRuleCollector::matchHostPseudoClassRules):
(WebCore::ElementRuleCollector::matchSlottedPseudoElementRules):
(WebCore::ElementRuleCollector::matchPartPseudoElementRules):
(WebCore::ElementRuleCollector::matchPartPseudoElementRulesForScope):
(WebCore::ElementRuleCollector::collectMatchingShadowPseudoElementRules):
(WebCore::ElementRuleCollector::collectSlottedPseudoElementRulesForSlot):
(WebCore::ElementRuleCollector::matchUserRules):
(WebCore::ElementRuleCollector::matchUARules):
(WebCore::ElementRuleCollector::collectMatchingRulesForList):
(WebCore::ElementRuleCollector::matchAllRules):
(WebCore::ElementRuleCollector::hasAnyMatchingRules):
* css/ElementRuleCollector.h:
(WebCore::ElementRuleCollector::setIncludeEmptyRules):
(WebCore::ElementRuleCollector::transferMatchedRules):

Range update happens now here based on the supplied argument.

* css/StyleResolver.cpp:
(WebCore::StyleResolver::pseudoStyleForElement):
(WebCore::StyleResolver::pseudoStyleRulesForElement):

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

9 months agoREGRESSION (r251262): Layout Test scrollingcoordinator/ios/non-stable-viewport-scroll...
russell_e@apple.com [Fri, 18 Oct 2019 17:35:21 +0000 (17:35 +0000)]
REGRESSION (r251262): Layout Test scrollingcoordinator/ios/non-stable-viewport-scroll.html is a Flaky Failure
https://bugs.webkit.org/show_bug.cgi?id=203157

Unreviewed Test Gardening.

* platform/ios-simulator-wk2/TestExpectations: Marked
scrollingcoordinator/ios/non-stable-viewport-scroll.html as flaky

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

9 months ago[iOS] Layout Test http/tests/resourceLoadStatistics/website-data-removal-for-site...
commit-queue@webkit.org [Fri, 18 Oct 2019 16:58:47 +0000 (16:58 +0000)]
[iOS] Layout Test http/tests/resourceLoadStatistics/website-data-removal-for-site-navigated-to-with-link-decoration.html is frequently failing or timing out (198185)
https://bugs.webkit.org/show_bug.cgi?id=198185
<rdar://problem/51074251>

Patch by Kate Cheney <katherine_cheney@apple.com> on 2019-10-18
Reviewed by Youenn Fablet.

Fixes a flaky failure caused by test results being checked before data
records have finished processing. This patch uses a callback to
ensure data processing has finished before continuing.

* http/tests/resourceLoadStatistics/website-data-removal-for-site-navigated-to-with-link-decoration.html:
* platform/ios-wk2/TestExpectations:

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

9 months agoREGRESSION: Layout Test webgl/many-contexts.html is a flaky timeout on Mojave
tsavell@apple.com [Fri, 18 Oct 2019 16:28:13 +0000 (16:28 +0000)]
REGRESSION: Layout Test webgl/many-contexts.html is a flaky timeout on Mojave
https://bugs.webkit.org/show_bug.cgi?id=198867

Unreviewed test gardening

* platform/mac/TestExpectations:

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

9 months ago[CSS Shadow Parts] :part rules should be able to override style attribute
antti@apple.com [Fri, 18 Oct 2019 16:20:17 +0000 (16:20 +0000)]
[CSS Shadow Parts] :part rules should be able to override style attribute
https://bugs.webkit.org/show_bug.cgi?id=202919

Reviewed by Zalan Bujtas.

LayoutTests/imported/w3c:

* web-platform-tests/css/css-shadow-parts/simple-inline-expected.txt:

Source/WebCore:

Element inline style was simply appended to the matching declaration list and not sorted with the rest of the author style.
This used to work because before CSS Shadow Parts feature inline style would always win.

Fixing this involves refactoring the rule collection code to remove this assumption.

* css/ElementRuleCollector.cpp:
(WebCore::ElementRuleCollector::addMatchedRule):

Both initialize and update ranges here.

(WebCore::ElementRuleCollector::clearMatchedRules):
(WebCore::ElementRuleCollector::addElementStyleProperties):

Both initialize and update ranges here.

(WebCore::ElementRuleCollector::sortAndTransferMatchedRules):

Split out transfering to a separate function.

(WebCore::ElementRuleCollector::transferMatchedRules):

Add a parameter to limit transfer to rules from a scope.

(WebCore::ElementRuleCollector::matchAuthorRules):
(WebCore::ElementRuleCollector::matchesAnyAuthorRules):

Replace hasMatchedRules() with a more specific function. This can use collectMatchingAuthorRules and avoids unnecessary sorting step.

(WebCore::ElementRuleCollector::collectMatchingAuthorRules):

Split out collecting the rules from matchAuthorRules. Like other collect functions, this doesn't do any sorting.

(WebCore::ElementRuleCollector::matchAllRules):

Add element inline style before transfering rules from the containing host scope.

(WebCore::ElementRuleCollector::addElementInlineStyleProperties):

Factor adding inline style into a function.

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

9 months ago[LFC][TFC] Include horizontal spacing when checking for the extra horizontal space
zalan@apple.com [Fri, 18 Oct 2019 16:14:28 +0000 (16:14 +0000)]
[LFC][TFC] Include horizontal spacing when checking for the extra horizontal space
https://bugs.webkit.org/show_bug.cgi?id=203154
<rdar://problem/56408032>

Reviewed by Antti Koivisto.

* layout/tableformatting/TableFormattingContext.cpp:
(WebCore::Layout::TableFormattingContext::computeAndDistributeExtraHorizontalSpace):

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

9 months ago[LFC][TFC] Fix table's total horizontal spacing computation
zalan@apple.com [Fri, 18 Oct 2019 16:12:44 +0000 (16:12 +0000)]
[LFC][TFC] Fix table's total horizontal spacing computation
https://bugs.webkit.org/show_bug.cgi?id=203151
<rdar://problem/56406930>

Reviewed by Antti Koivisto.

The horizontal spacing value sets the gaps between
1. first column and the left edge of the table's content box
2. between 2 columns
3. last column and the right edge of the table's content box
In case of 'n' columns, the number of gaps is 'n + 1'.

* layout/tableformatting/TableGrid.h:
(WebCore::Layout::TableGrid::totalHorizontalSpacing const):

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

9 months ago[LFC][TFC] Cache table's width constraint values.
zalan@apple.com [Fri, 18 Oct 2019 16:11:34 +0000 (16:11 +0000)]
[LFC][TFC] Cache table's width constraint values.
https://bugs.webkit.org/show_bug.cgi?id=203135
<rdar://problem/56396352>

Reviewed by Antti Koivisto.

This patch ensures that when computedIntrinsicWidthConstraints is called from both the preferred width and the actual layout codepaths during a layout frame, we don't
end up building up the grid twice.

* layout/tableformatting/TableFormattingContext.cpp:
(WebCore::Layout::TableFormattingContext::computedIntrinsicWidthConstraints):
(WebCore::Layout::TableFormattingContext::computePreferredWidthForColumns):
(WebCore::Layout::TableFormattingContext::computeAndDistributeExtraHorizontalSpace):
* layout/tableformatting/TableGrid.cpp:
(WebCore::Layout::TableGrid::widthConstraints):
(WebCore::Layout::TableGrid::widthConstraints const): Deleted.
* layout/tableformatting/TableGrid.h:
(WebCore::Layout::TableGrid::hasComputedWidthConstraints const):

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

9 months ago[LFC][BFC] TableFormattingContext::computedIntrinsicWidthConstraints should not expec...
zalan@apple.com [Fri, 18 Oct 2019 16:09:41 +0000 (16:09 +0000)]
[LFC][BFC] TableFormattingContext::computedIntrinsicWidthConstraints should not expect a valid containing block's width
https://bugs.webkit.org/show_bug.cgi?id=203131
<rdar://problem/56394676>

Reviewed by Antti Koivisto.

When TableFormattingContext::computedIntrinsicWidthConstraints is called by the preferred width computation (<div style="float: left"><table>)
the containing block's width is not yet set (it gets computed based on the preferred width) so computedIntrinsicWidthConstraints should not be relying
on it. Let's move that logic out to TableFormattingContext::layoutInFlowContent() where it belongs.

* layout/blockformatting/BlockFormattingContextGeometry.cpp:
(WebCore::Layout::BlockFormattingContext::Geometry::inFlowWidthAndMargin):
* layout/tableformatting/TableFormattingContext.cpp:
(WebCore::Layout::TableFormattingContext::layoutInFlowContent):
(WebCore::Layout::TableFormattingContext::computedIntrinsicWidthConstraints):
(WebCore::Layout::TableFormattingContext::ensureTableGrid):
(WebCore::Layout::TableFormattingContext::computeAndDistributeExtraHorizontalSpace):
(WebCore::Layout::TableFormattingContext::computedTableWidth): Deleted.
(WebCore::Layout::TableFormattingContext::distributeExtraHorizontalSpace): Deleted.
* layout/tableformatting/TableFormattingContext.h:

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

9 months ago[LFC][BFC] Fix block level formatting root inflow box height computation
zalan@apple.com [Fri, 18 Oct 2019 14:54:47 +0000 (14:54 +0000)]
[LFC][BFC] Fix block level formatting root inflow box height computation
https://bugs.webkit.org/show_bug.cgi?id=203085
<rdar://problem/56372306>

Reviewed by Antti Koivisto.

Section 10.6.7 (https://www.w3.org/TR/CSS22/visudet.html#root-height) defines the height computation for block level formatting context roots.
We already use it for floats, out-of-flow and block level boxes when overflow computes to not "visible".
This patch makes generic in-flow non-replaced BFC roots (e.g. principal block container box for <table>) compute their heights according to 10.6.7.

* layout/blockformatting/BlockFormattingContextGeometry.cpp:
(WebCore::Layout::BlockFormattingContext::Geometry::inFlowNonReplacedHeightAndMargin):

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

9 months ago[Clipboard API] Support navigator.clipboard.read()
wenson_hsieh@apple.com [Fri, 18 Oct 2019 14:24:07 +0000 (14:24 +0000)]
[Clipboard API] Support navigator.clipboard.read()
https://bugs.webkit.org/show_bug.cgi?id=203021

Reviewed by Ryosuke Niwa.

LayoutTests/imported/w3c:

Rebaseline a web platform test, now that Clipboard.read() no longer immediately rejects.

* web-platform-tests/clipboard-apis/async-navigator-clipboard-basics.https-expected.txt:

Source/WebCore:

Add support for navigator.clipboard.read(), which returns a promise that resolves to a list of ClipboardItems.
See below for more details.

Tests: editing/async-clipboard/clipboard-change-data-while-reading.html
       editing/async-clipboard/clipboard-read-basic.html

* Modules/async-clipboard/Clipboard.cpp:
(WebCore::Clipboard::read):

Implement read(). This makes two calls to the platform pasteboard: the first to get the current change count,
and if the change count is different from the changeCount used for the last read() call (or there are no
existing clipboard items being tracked), then we request pasteboard item information for all items on the
pasteboard, and use this information to create new clipboard items. Otherwise, if the changeCount is still valid
for the current list of clipboard items, simply return these clipboard items.

If the changeCount ends up being different in between the initial changeCount request and when the pasteboard
item information is received, we immediately bail with a NotAllowedError. The new layout test
clipboard-change-data-while-reading.html exercises this scenario.

(WebCore::Clipboard::getType):
(WebCore::Clipboard::frame const):
* Modules/async-clipboard/Clipboard.h:
* Modules/async-clipboard/ClipboardItem.cpp:
(WebCore::ClipboardItem::blobFromString):
(WebCore::ClipboardItem::ClipboardItem):
(WebCore::ClipboardItem::create):
(WebCore::ClipboardItem::navigator):

Refactor this so that each clipboard item itself has a WeakPtr to its Navigator. This avoids having to follow
the weak pointer to the Clipboard to get to the Clipboard's navigator during garbage collection when computing
reachability from opaque roots, since this may happen on a background (GC) thread.

(WebCore::ClipboardItem::clipboard):
* Modules/async-clipboard/ClipboardItem.h:
* Modules/async-clipboard/ClipboardItemBindingsDataSource.cpp:
(WebCore::ClipboardItemBindingsDataSource::getType):
(WebCore::blobFromString): Deleted.

Move this to ClipboardItem, and make it a static method.

* Modules/async-clipboard/ClipboardItemPasteboardDataSource.cpp:
(WebCore::ClipboardItemPasteboardDataSource::ClipboardItemPasteboardDataSource):
(WebCore::ClipboardItemPasteboardDataSource::getType):
* Modules/async-clipboard/ClipboardItemPasteboardDataSource.h:

Move a couple of member variables (index and changeCount) out of ClipboardItem. Instead of having each
ClipboardItem keep track of this information, have the Clipboard that owns the ClipboardItem keep this
information. This means that reading data from ClipboardItem will (in a future patch) work by having the item
ask its Clipboard object to read data on its behalf.

* platform/Pasteboard.cpp:
(WebCore::Pasteboard::allPasteboardItemInfo const):
(WebCore::Pasteboard::pasteboardItemInfo const):
(WebCore::Pasteboard::readString):
(WebCore::Pasteboard::readBuffer):
(WebCore::Pasteboard::readURL):

Add some null checks to handle the case where there is no pasteboard strategy.

Tools:

Make adjustments to WebKitTestRunner and DumpRenderTree to support the new layout tests. See below for more
details.

* DumpRenderTree/DumpRenderTree.xcodeproj/project.pbxproj:
* DumpRenderTree/mac/DumpRenderTreePasteboard.mm:
(-[LocalPasteboard pasteboardItems]):

Fixes an existing issue with the mock NSPasteboard used for layout tests. Currently, our logic for converting
the contents of the platform pasteboard to NSPasteboardItem simply writes the pasteboard data as-is to
NSPasteboardItems. However, these pasteboard types may be legacy pasteboard types, in which case
NSPasteboardItem will simply handle the call to `-setData:forType:` as a no-op. AppKit has logic in this
scenario to canonicalize these legacy pasteboard types to their modern counterparts, but this is absent in
DumpRenderTreePasteboard and WebKitTestRunnerPasteboard.

Address this by teaching the mock pasteboards to convert legacy types to modern types when generating platform
pasteboard items.

* TestRunnerShared/UIScriptContext/Bindings/UIScriptController.idl:
* TestRunnerShared/UIScriptContext/UIScriptController.h:
(WTR::UIScriptController::copyText):

Add a new UIScriptController method to write a string to the platform pasteboard. This patch adds support for
this new testing hook on macOS and iOS, in WebKit2 (WebKitTestRunner).

* TestRunnerShared/mac/NSPasteboardAdditions.h: Copied from Tools/WebKitTestRunner/mac/UIScriptControllerMac.h.
* TestRunnerShared/mac/NSPasteboardAdditions.mm: Added.
(+[NSPasteboard _modernPasteboardType:]):

Add a helper to convert legacy pasteboard types (and dynamic UTIs that map to legacy pasteboard types) to
modern pasteboard types, suitable for writing to NSPasteboardItems on macOS.

* WebKitTestRunner/WebKitTestRunner.xcodeproj/project.pbxproj:
* WebKitTestRunner/ios/UIScriptControllerIOS.h:
* WebKitTestRunner/ios/UIScriptControllerIOS.mm:
(WTR::UIScriptControllerIOS::copyText):
* WebKitTestRunner/mac/UIScriptControllerMac.h:
* WebKitTestRunner/mac/UIScriptControllerMac.mm:
(WTR::UIScriptControllerMac::copyText):
* WebKitTestRunner/mac/WebKitTestRunnerPasteboard.mm:

Apply the same fix for WebKitTestRunner's mock NSPasteboard.

(-[LocalPasteboard _clearContentsWithoutUpdatingChangeCount]):
(-[LocalPasteboard clearContents]):

Make -clearContents clear out all the contents on the mock pasteboard, instead of crashing in AppKit.

(-[LocalPasteboard declareTypes:owner:]):
(-[LocalPasteboard pasteboardItems]):

LayoutTests:

* editing/async-clipboard/clipboard-change-data-while-reading-expected.txt: Added.
* editing/async-clipboard/clipboard-change-data-while-reading.html: Added.

Add a new layout test to verify that if the platform pasteboard changes in the middle of a DOM paste access
request, the promise returned by Clipboard.read() should reject, and the page should not receive any clipboard
items.

* editing/async-clipboard/clipboard-read-basic-expected.txt: Added.
* editing/async-clipboard/clipboard-read-basic.html: Added.

Add a new layout test to exercise Clipboard.read(). Since we don't support reading data from clipboard items
yet, this only checks the types of each pasteboard item. This test additionally ensures that the ClipboardItems
returned from the API are the same between calls to Clipboard.read() if the data hasn't changed.

* editing/async-clipboard/resources/async-clipboard-helpers.js:
(writeToClipboardUsingDataTransfer):

Add a new helper to synchronously write data to the clipboard using execCommand and DataTransfer API.

(async.triggerProgrammaticPaste):

Add a new helper to trigger programmatic paste by activating the given element or location. Also receives an
array of options (which, for now, just supports a single option to change the pasteboard when granting DOM paste
access).

* platform/ios-wk1/TestExpectations: Skip clipboard-change-data-while-reading.html for now in WebKit1.
* platform/mac-wk1/TestExpectations: Skip clipboard-change-data-while-reading.html for now in WebKit1.
* platform/win/TestExpectations: Skip the new layout tests on Windows for now.

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

9 months agoAvoid crashes on GCC-compiled binaries by avoiding a use-after-move
zandobersek@gmail.com [Fri, 18 Oct 2019 10:40:34 +0000 (10:40 +0000)]
Avoid crashes on GCC-compiled binaries by avoiding a use-after-move
that's the result of differring call conventions.

Rubber-stamped by Carlos Garcia Campos.

* NetworkProcess/ServiceWorker/WebSWServerConnection.cpp:
(WebKit::WebSWServerConnection::startFetch): Copy the SW identifier from
the ServiceWorkerFetchTask before it's moved into the lambda.

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

9 months agoUpdate libwebrtc third-party abseilcpp to M78
youenn@apple.com [Fri, 18 Oct 2019 08:35:09 +0000 (08:35 +0000)]
Update libwebrtc third-party abseilcpp to M78
https://bugs.webkit.org/show_bug.cgi?id=202726
<rdar://problem/56147823>

Unreviewed.

* Source/third_party/abseil-cpp/absl/strings/string_view.h:
(absl::string_view::CheckLengthInternal):
Build fix for debug bots.

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

9 months ago[Clang][Windows] Options.cpp(317,25): error: no matching function for call to 'option...
Hironori.Fujii@sony.com [Fri, 18 Oct 2019 08:29:51 +0000 (08:29 +0000)]
[Clang][Windows] Options.cpp(317,25): error: no matching function for call to 'optionTypeSpecificIndex'
https://bugs.webkit.org/show_bug.cgi?id=203142

Unreviewed build fix

clang-cl reported a compilation error for MSVC bug workaround code of optionTypeSpecificIndex.

runtime\Options.cpp(294,12): error: variables defined in a constexpr function must be initialized
    size_t index;
           ^
* runtime/Options.cpp:
(JSC::optionTypeSpecificIndex): Initialize the variable 'index'.

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

9 months agoDon't put pages that have not reached the non-visually empty layout milestone in...
cdumez@apple.com [Fri, 18 Oct 2019 05:01:50 +0000 (05:01 +0000)]
Don't put pages that have not reached the non-visually empty layout milestone in the back/forward cache
https://bugs.webkit.org/show_bug.cgi?id=203108
<rdar://problem/56375671>

Reviewed by Geoff Garen.

Source/WebCore:

We don't want to go back to a visually empty page on back/forward navigation.

* history/BackForwardCache.cpp:
(WebCore::canCacheFrame):
* page/DiagnosticLoggingKeys.cpp:
(WebCore::DiagnosticLoggingKeys::visuallyEmptyKey):
* page/DiagnosticLoggingKeys.h:

LayoutTests:

* http/tests/navigation/page-cache-pending-load.html:
Tweak test to add the stylesheet to the body instead of the head since a document
with a pending stylesheet before the body qualifies as visually empty. The test
would be flaky otherwise.

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

9 months agoAdd missing checks after calls to the sameValue() JSValue comparator.
mark.lam@apple.com [Fri, 18 Oct 2019 04:35:28 +0000 (04:35 +0000)]
Add missing checks after calls to the sameValue() JSValue comparator.
https://bugs.webkit.org/show_bug.cgi?id=203126
<rdar://problem/56366561>

Reviewed by Saam Barati.

JSTests:

* stress/validate-exception-check-in-proxy-object-put.js: Added.

Source/JavaScriptCore:

* runtime/JSFunction.cpp:
(JSC::JSFunction::defineOwnProperty):
* runtime/JSObject.cpp:
(JSC::JSObject::defineOwnIndexedProperty):
(JSC::validateAndApplyPropertyDescriptor):
* runtime/PropertyDescriptor.cpp:
(JSC::PropertyDescriptor::equalTo const):
* runtime/ProxyObject.cpp:
(JSC::performProxyGet):
(JSC::ProxyObject::performPut):
(JSC::ProxyObject::performSetPrototype):
(JSC::ProxyObject::performGetPrototype):
* runtime/RegExpObject.cpp:
(JSC::RegExpObject::defineOwnProperty):

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

9 months agoOnly include "deep color" in layer tree dumps if a tests requests it
simon.fraser@apple.com [Fri, 18 Oct 2019 04:24:09 +0000 (04:24 +0000)]
Only include "deep color" in layer tree dumps if a tests requests it
https://bugs.webkit.org/show_bug.cgi?id=203125

Reviewed by Tim Horton.
Source/WebCore:

Layer tree dumping tests can fail when run on different devices because the "deep color"
property on layers is device-dependent. Stop dumping this by default, and have one test
that sets the bit. iphone-7 is the only device we test that has deep color support.

Tests: compositing/contents-format/deep-color-backing-store.html
       compositing/contents-format/ipad/deep-color-backing-store.html
       compositing/contents-format/iphone-7/deep-color-backing-store.html

* page/Frame.h:
* platform/graphics/GraphicsLayerClient.h:
* platform/graphics/ca/GraphicsLayerCA.cpp:
(WebCore::GraphicsLayerCA::createTransformAnimationsFromKeyframes):
* rendering/RenderLayerCompositor.cpp:
(WebCore::RenderLayerCompositor::layerTreeAsText):
* testing/Internals.cpp:
(WebCore::toLayerTreeFlags):
* testing/Internals.h:
* testing/Internals.idl:

LayoutTests:

* TestExpectations:
* compositing/contents-format/deep-color-backing-store-expected.txt: Copied from LayoutTests/platform/iphone-7/tiled-drawing/compositing-layers-deep-color-expected.txt.
* compositing/contents-format/deep-color-backing-store.html: Copied from LayoutTests/platform/iphone-7/tiled-drawing/compositing-layers-deep-color.html.
* compositing/contents-format/ipad/deep-color-backing-store-expected.txt: Copied from LayoutTests/platform/iphone-7/tiled-drawing/compositing-layers-deep-color-expected.txt.
* compositing/contents-format/ipad/deep-color-backing-store.html: Copied from LayoutTests/platform/iphone-7/tiled-drawing/compositing-layers-deep-color.html.
* compositing/contents-format/iphone-7/deep-color-backing-store-expected.txt: Copied from LayoutTests/platform/iphone-7/tiled-drawing/compositing-layers-deep-color-expected.txt.
* compositing/contents-format/iphone-7/deep-color-backing-store.html: Renamed from LayoutTests/platform/iphone-7/tiled-drawing/compositing-layers-deep-color.html.
* platform/ipad/TestExpectations:
* platform/iphone-7/TestExpectations: Added.
* platform/mac-wk1/compositing/contents-format/deep-color-backing-store-expected.txt: Renamed from LayoutTests/platform/iphone-7/tiled-drawing/compositing-layers-deep-color-expected.txt.

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

9 months agoREGRESSION (r243347) Layout tests fast/events/touch/ios/drag-block-without-overflow...
simon.fraser@apple.com [Fri, 18 Oct 2019 02:27:01 +0000 (02:27 +0000)]
REGRESSION (r243347) Layout tests fast/events/touch/ios/drag-block-without-overflow-scroll-and-passive-observer-on* are flakey
https://bugs.webkit.org/show_bug.cgi?id=203122
rdar://problem/50058173

Reviewed by Wenson Hsieh.

Rewrite these tests to wait for scrolling to finish, since the overflow is now accelerated and we need
to wait for momentum to end.

Also have them use UIHelper, factoring a function to work with overflow as well as document scroll.

* fast/events/touch/ios/drag-block-without-overflow-scroll-and-passive-observer-on-block-expected.txt:
* fast/events/touch/ios/drag-block-without-overflow-scroll-and-passive-observer-on-block.html:
* fast/events/touch/ios/drag-block-without-overflow-scroll-and-passive-observer-on-document-expected.txt:
* fast/events/touch/ios/drag-block-without-overflow-scroll-and-passive-observer-on-document.html:
* resources/ui-helper.js:
(window.UIHelper.callFunctionAndWaitForEvent):
(window.UIHelper.callFunctionAndWaitForScrollToFinish):
(window.UIHelper.callFunctionAndWaitForTargetScrollToFinish.return.new.Promise):
(window.UIHelper.callFunctionAndWaitForTargetScrollToFinish):
(window.UIHelper.callFunctionAndWaitForScrollToFinish.return.new.Promise): Deleted.

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

9 months agoGetByVal and PutByVal on ArrayStorage need to use the same AbstractHeap
sbarati@apple.com [Fri, 18 Oct 2019 00:42:25 +0000 (00:42 +0000)]
GetByVal and PutByVal on ArrayStorage need to use the same AbstractHeap
https://bugs.webkit.org/show_bug.cgi?id=203124
<rdar://problem/55988183>

Reviewed by Yusuke Suzuki.

JSTests:

* stress/licm-array-storage-get-and-put-by-val.js: Added.
(assert):
(foo):

Source/JavaScriptCore:

* dfg/DFGAbstractHeap.h:
* dfg/DFGClobberize.h:
(JSC::DFG::clobberize):

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

9 months agoctx.font = "" asserts in CSS parser
dino@apple.com [Fri, 18 Oct 2019 00:29:33 +0000 (00:29 +0000)]
ctx.font = "" asserts in CSS parser
https://bugs.webkit.org/show_bug.cgi?id=203127
<rdar://problem/56391016>

Reviewed by Devin Rousso.

Source/WebCore:

The HTML specification says:
"values that cannot be parsed as CSS font values are ignored", so
return early if we get an empty string, otherwise the CSS parser
will assert. This was the only case I could find where we sidestepped
most of the parsing infrastructure and injected a raw string.

Test: http/wpt/2dcontext/text-styles/2d.text.font.parse.invalid.html

* html/canvas/CanvasRenderingContext2D.cpp:
(WebCore::CanvasRenderingContext2D::setFont):

LayoutTests:

Copy the updated test from my WPT pull request. Once this
is merged into WPT, we won't need this version.

* http/wpt/2dcontext/text-styles/2d.text.font.parse.invalid-expected.txt: Added.
* http/wpt/2dcontext/text-styles/2d.text.font.parse.invalid.html: Added.
* http/wpt/resources/canvas-tests.css: Added.
* http/wpt/resources/canvas-tests.js: Added.

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

9 months agoIntegrate resize event with HTML5 event loop
rniwa@webkit.org [Fri, 18 Oct 2019 00:15:28 +0000 (00:15 +0000)]
Integrate resize event with HTML5 event loop
https://bugs.webkit.org/show_bug.cgi?id=202964

Reviewed by Geoffrey Garen.

Source/WebCore:

Dispatch resize events in "run the resize steps" during the "update the rendering":
https://html.spec.whatwg.org/multipage/webappapis.html#update-the-rendering

Exisitng code in WebCore which was dispatching or scheduling dispatching of resize events now simply sets
a flag on document and schedules a rendering update. In Page::updateRendering, we fire resize events on
any documents with this flag set.

Test: fast/events/resize-subframe-in-rendering-update.html

* dom/Document.cpp:
(WebCore::Document::setNeedsDOMWindowResizeEvent): Added.
(WebCore::Document::setNeedsVisualViewportResize): Added.
(WebCore::Document::runResizeSteps): Added. https://drafts.csswg.org/cssom-view/#run-the-resize-steps
* dom/Document.h:
* page/DOMWindow.cpp:
(WebCore::DOMWindow::resizeTo const):
* page/FrameView.cpp:
(WebCore::FrameView::sendResizeEventIfNeeded): Now sets m_needsDOMWindowResizeEvent on Document instead of
enqueuing a resize event.
* page/Page.cpp:
(WebCore::Page::updateRendering): Call runResizeSteps on each document.
(WebCore::Page::collectDocuments): Added.
* page/Page.h:
* page/VisualViewport.cpp:
(WebCore::VisualViewport::enqueueResizeEvent):

LayoutTests:

Added a regression test and fixed an existing test to work with the new behavior.

* fast/events/resize-subframe-in-rendering-update-expected.txt: Added.
* fast/events/resize-subframe-in-rendering-update.html: Added.
* fast/shadow-dom/trusted-event-scoped-flags.html:

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

9 months ago[bmalloc] Bug fix for wait time when it's in mini mode.
Basuke.Suzuki@sony.com [Fri, 18 Oct 2019 00:02:10 +0000 (00:02 +0000)]
[bmalloc] Bug fix for wait time when it's in mini mode.
https://bugs.webkit.org/show_bug.cgi?id=203121

Reviewed by Yusuke Suzuki.

Since r243144, m_waitTime is never changed on mini mode.

* bmalloc/Scavenger.cpp:
(bmalloc::Scavenger::threadRunLoop):

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

9 months agoUnreviewed, rolling out r251255.
cdumez@apple.com [Thu, 17 Oct 2019 23:42:09 +0000 (23:42 +0000)]
Unreviewed, rolling out r251255.

This is causing the existing back/forward tests to be flaky

Reverted changeset:

"Don't put pages that have not reached the non-visually empty
layout milestone in the back/forward cache"
https://bugs.webkit.org/show_bug.cgi?id=203108
https://trac.webkit.org/changeset/251255

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

9 months agoLand a missing test baseline
timothy_horton@apple.com [Thu, 17 Oct 2019 23:38:19 +0000 (23:38 +0000)]
Land a missing test baseline

* fast/forms/ios/inputmode-none-with-hardware-keyboard-expected.txt: Added.

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