WebKit-https.git
6 months agoUnreviewed, rolling out r245899.
cdumez@apple.com [Fri, 31 May 2019 23:10:27 +0000 (23:10 +0000)]
Unreviewed, rolling out r245899.

Seems to be causing crashes on iosmac

Reverted changeset:

"[iOS] UIProcess' background task expiration handler may get
called after the app is foreground again"
https://bugs.webkit.org/show_bug.cgi?id=198380
https://trac.webkit.org/changeset/245899

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

6 months agoWeb Inspector: CSS Changes: modifications aren't shared for rules that match multiple...
nvasilyev@apple.com [Fri, 31 May 2019 22:53:40 +0000 (22:53 +0000)]
Web Inspector: CSS Changes: modifications aren't shared for rules that match multiple elements
https://bugs.webkit.org/show_bug.cgi?id=195264
<rdar://problem/48550023>

Reviewed by Devin Rousso.

Source/WebInspectorUI:

This patch fixes several cases when the diff was incorrect.

1. Perform diff based on CSSProperty content (name, value, and enabled property) instead
   of strict equality of CSSProperty instances.

2. Copy all initial CSSProperty instances of CSSStyleDeclaration on 1st edit.
   This removes the need to update `properties` on every single edit.

3. Do full diff to display modified property markers (green background) in Rules panel.
   This fixes a few cases when the markers were inaccurate. E.g. a newly added property
   matches removed property - no need to show the green background.

* UserInterface/Base/Utilities.js:
(Array.diffArrays):
Allow repeating items in the arrays.

* UserInterface/Controllers/CSSManager.js:
(WI.CSSManager.prototype.getModifiedStyle):
(WI.CSSManager.prototype.removeModifiedStyle):
* UserInterface/Models/CSSProperty.js:
(WI.CSSProperty):
(WI.CSSProperty.prototype.get modified):
(WI.CSSProperty.prototype.set modified):
(WI.CSSProperty.prototype.equals):
(WI.CSSProperty.prototype.clone):
(WI.CSSProperty.prototype._updateOwnerStyleText):
(WI.CSSProperty.prototype._markModified):
* UserInterface/Models/CSSStyleDeclaration.js:
(WI.CSSStyleDeclaration.prototype.markModified):
(WI.CSSStyleDeclaration.prototype.updatePropertiesModifiedState):
* UserInterface/Views/ChangesDetailsSidebarPanel.js:
(WI.ChangesDetailsSidebarPanel.prototype._createRuleElement):
* UserInterface/Views/SpreadsheetCSSStyleDeclarationEditor.js:
(WI.SpreadsheetCSSStyleDeclarationEditor.prototype.layout):
* UserInterface/Views/SpreadsheetStyleProperty.js:

LayoutTests:

Test arrays with repeating items for Array.diffArrays.

* inspector/unit-tests/array-utilities-expected.txt:
* inspector/unit-tests/array-utilities.html:

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

6 months agotile-coverage-iframe-to-zero-coverage.html flakey after r245974
simon.fraser@apple.com [Fri, 31 May 2019 22:30:55 +0000 (22:30 +0000)]
tile-coverage-iframe-to-zero-coverage.html flakey after r245974
https://bugs.webkit.org/show_bug.cgi?id=198438

Unreviewed test gardening.

layerTreeAsText() doesn't force layouts on subframes (webkit.org/b/198439) so
have the test force an update on the subframe via a dummy layerTreeAsText() call.

* tiled-drawing/tile-coverage-iframe-to-zero-coverage-expected.txt:
* tiled-drawing/tile-coverage-iframe-to-zero-coverage.html:

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

6 months agoiOS: Main frame should be scrollable when pinch zoomed or software keyboard is up
rniwa@webkit.org [Fri, 31 May 2019 22:12:19 +0000 (22:12 +0000)]
iOS: Main frame should be scrollable when pinch zoomed or software keyboard is up
https://bugs.webkit.org/show_bug.cgi?id=198244

Reviewed by Simon Fraser.

Source/WebKit:

This is a follow up to r245006. Even when overflow: hidden is specified on the document body,
we still need to make it scrollable when the page is pinch zoomed or there is a content inset
e.g. for software keyboard. Otherwise, the user won't be able to get to the content that is
outside the visual viewport when pinch zoomed or the parts of the page that is not outside
the visual viewport due to the scrolling caused by the software keyboard being brought up.

* UIProcess/API/Cocoa/WKWebView.mm:
(-[WKWebView _didCommitLayerTree:]):

LayoutTests:

Added regression tests.

* fast/scrolling/ios/body-overflow-hidden-height-100-percent-keyboard-expected.txt: Added.
* fast/scrolling/ios/body-overflow-hidden-height-100-percent-keyboard.html: Added.
* fast/scrolling/ios/body-overflow-hidden-height-100-percent-zoomed-1-expected.txt: Added.
* fast/scrolling/ios/body-overflow-hidden-height-100-percent-zoomed-1.html: Added.
* fast/scrolling/ios/body-overflow-hidden-height-100-percent-zoomed-2-expected.txt: Added.
* fast/scrolling/ios/body-overflow-hidden-height-100-percent-zoomed-2.html: Added.

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

6 months agoREGRESSION: WebKit.InteractionDeadlockAfterCrash and SynchronousTimeoutTests.Unrespon...
timothy_horton@apple.com [Fri, 31 May 2019 22:02:14 +0000 (22:02 +0000)]
REGRESSION: WebKit.InteractionDeadlockAfterCrash and SynchronousTimeoutTests.UnresponsivePageDoesNotCausePositionInformationToHangUI API tests are failing
https://bugs.webkit.org/show_bug.cgi?id=198432
<rdar://problem/51266033>

Reviewed by Wenson Hsieh.

* TestWebKitAPI/Tests/WebKitCocoa/InteractionDeadlockAfterCrash.mm:
(TEST):
(recursiveFindHighlightLongPressRecognizer): Deleted.
* TestWebKitAPI/Tests/ios/SynchronousTimeoutTests.mm:
(TestWebKitAPI::TEST):
(TestWebKitAPI::recursiveFindHighlightLongPressRecognizer): Deleted.

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

6 months agoSome WeakPtr typedef cleanup
ggaren@apple.com [Fri, 31 May 2019 21:56:37 +0000 (21:56 +0000)]
Some WeakPtr typedef cleanup
https://bugs.webkit.org/show_bug.cgi?id=198431

Reviewed by Chris Dumez.

Use "using" instead of "typedef", since using is preferred in C++ for
better compatibility with templates.

Source/WebCore:

* Modules/indexeddb/shared/InProcessIDBServer.h:
* html/HTMLMediaElement.h:
* platform/ScrollView.h:

Source/WebKit:

* UIProcess/WebAuthentication/AuthenticatorManager.h:

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

6 months agoUnreviewed, rolling out r245953.
commit-queue@webkit.org [Fri, 31 May 2019 21:11:32 +0000 (21:11 +0000)]
Unreviewed, rolling out r245953.
https://bugs.webkit.org/show_bug.cgi?id=198436

Broke quip (Requested by rniwa on #webkit).

Reverted changeset:

"iOS: Main frame should be scrollable when pinch zoomed or
software keyboard is up"
https://bugs.webkit.org/show_bug.cgi?id=198244
https://trac.webkit.org/changeset/245953

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

6 months agoURLParser::parseIPv6Host should properly parse 0's around compression
achristensen@apple.com [Fri, 31 May 2019 20:56:40 +0000 (20:56 +0000)]
URLParser::parseIPv6Host should properly parse 0's around compression
https://bugs.webkit.org/show_bug.cgi?id=198424

Reviewed by Tim Horton.

Source/WTF:

* wtf/URLParser.cpp:
(WTF::URLParser::parseIPv6Host):

Tools:

* TestWebKitAPI/Tests/WTF/URLParser.cpp:
(TestWebKitAPI::TEST_F):

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

6 months agoURLParser::parseHostAndPort should not allow non-port characters after an ipv6 host
achristensen@apple.com [Fri, 31 May 2019 20:55:25 +0000 (20:55 +0000)]
URLParser::parseHostAndPort should not allow non-port characters after an ipv6 host
https://bugs.webkit.org/show_bug.cgi?id=198428
<rdar://problem/51209196>

Reviewed by Tim Horton.

Source/WTF:

This matches Chrome and Firefox.

* wtf/URLParser.cpp:
(WTF::URLParser::parseHostAndPort):

Tools:

* TestWebKitAPI/Tests/WTF/URLParser.cpp:
(TestWebKitAPI::TEST_F):

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

6 months agorun-benchmark should report an error if the argument to --build-directory is bogus
dewei_zhu@apple.com [Fri, 31 May 2019 20:52:31 +0000 (20:52 +0000)]
run-benchmark should report an error if the argument to --build-directory is bogus
https://bugs.webkit.org/show_bug.cgi?id=198316

Reviewed by Ryosuke Niwa.

'run-benchmark' should not fallback to system safari when browser or browser build path is
specified but not valid.
Add a run-time check to ensure at least one of the resource from build directory is opened by
Safari when build directory is specified.

* Scripts/webkitpy/benchmark_runner/browser_driver/osx_safari_driver.py:
(OSXSafariDriver.launch_url): Raise an exception when browser or browser build path is
specified but not valid.

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

6 months agoInserting a newline in contenteditable causes two characters to be added instead...
commit-queue@webkit.org [Fri, 31 May 2019 20:23:31 +0000 (20:23 +0000)]
Inserting a newline in contenteditable causes two characters to be added instead of one
https://bugs.webkit.org/show_bug.cgi?id=197894
<rdar://problems/49700998>

Patch by Andres Gonzalez <andresg_22@apple.com> on 2019-05-31
Reviewed by Chris Fleizach.

No new test is necessary since this is a comment change.

Removed radar reference from code.

* editing/Editing.cpp:
(WebCore::visiblePositionForIndexUsingCharacterIterator):

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

6 months agoOptionally respect device management restrictions when loading from the network
timothy_horton@apple.com [Fri, 31 May 2019 20:00:07 +0000 (20:00 +0000)]
Optionally respect device management restrictions when loading from the network
https://bugs.webkit.org/show_bug.cgi?id=198318
<rdar://problem/44263806>

Reviewed by Alex Christensen.

Source/WebCore:

* en.lproj/Localizable.strings:

Source/WebKit:

* Configurations/Network-iOS.entitlements:
* Resources/SandboxProfiles/ios/com.apple.WebKit.Networking.sb:
Add some entitlements and sandbox holes required to talk to DeviceManagement.

* NetworkProcess/NetworkCORSPreflightChecker.cpp:
(WebKit::NetworkCORSPreflightChecker::wasBlockedByRestrictions):
* NetworkProcess/NetworkCORSPreflightChecker.h:
* NetworkProcess/NetworkLoad.cpp:
(WebKit::NetworkLoad::wasBlockedByRestrictions):
* NetworkProcess/NetworkLoad.h:
* NetworkProcess/PingLoad.cpp:
(WebKit::PingLoad::wasBlockedByRestrictions):
* NetworkProcess/PingLoad.h:
* Shared/WebErrors.cpp:
(WebKit::wasBlockedByRestrictionsError):
* Shared/WebErrors.h:
* NetworkProcess/NetworkDataTask.cpp:
(WebKit::NetworkDataTask::create):
(WebKit::NetworkDataTask::failureTimerFired):
* NetworkProcess/NetworkDataTask.h:
* Shared/API/APIError.h:
* Shared/API/c/WKErrorRef.cpp:
(WKErrorGetErrorCode):
* Shared/API/c/WKErrorRef.h:
Plumb a new error for loads that are blocked by device management restrictions.

* NetworkProcess/NetworkLoadParameters.h:
* NetworkProcess/NetworkResourceLoadParameters.cpp:
(WebKit::NetworkResourceLoadParameters::encode const):
(WebKit::NetworkResourceLoadParameters::decode):
* WebProcess/Network/WebLoaderStrategy.cpp:
(WebKit::WebLoaderStrategy::scheduleLoadFromNetworkProcess):
Plumb a new bit that indicates whether a load is for the main resource of a frame.
We will only apply device management restrictions to main resources.

* NetworkProcess/NetworkSessionCreationParameters.cpp:
(WebKit::NetworkSessionCreationParameters::privateSessionParameters):
(WebKit::NetworkSessionCreationParameters::encode const):
(WebKit::NetworkSessionCreationParameters::decode):
* NetworkProcess/NetworkSessionCreationParameters.h:
* UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm:
(WebKit::WebsiteDataStore::parameters):
Plumb a new bit indicating whether a network session should respect device mangement
restrictions.

* NetworkProcess/cocoa/NetworkDataTaskCocoa.h:
* NetworkProcess/cocoa/NetworkDataTaskCocoa.mm:
(WebKit::NetworkDataTaskCocoa::NetworkDataTaskCocoa):
(WebKit::NetworkDataTaskCocoa::resume):
Defer resuming the load until we have a reply from DeviceManagement framework
about whether the URL should be blocked. If it is blocked, instead fail the load.

* NetworkProcess/cocoa/NetworkSessionCocoa.h:
* NetworkProcess/cocoa/NetworkSessionCocoa.mm:
(-[WKNetworkSessionDelegate URLSession:dataTask:didReceiveResponse:completionHandler:]):
(WebKit::NetworkSessionCocoa::NetworkSessionCocoa):
(WebKit::NetworkSessionCocoa::deviceManagementPolicyMonitor):
Cache a single DMFWebsitePolicyMonitor instance per NetworkSession.

* UIProcess/API/APIWebsiteDataStore.cpp:
(API::WebsiteDataStore::defaultDataStoreConfiguration):
The default data store is persistent; its configuration should reflect that.

* UIProcess/API/Cocoa/WKProcessPool.mm:
(-[WKProcessPool _setAllowsAnySSLCertificateForServiceWorker:]): Style.

* UIProcess/API/Cocoa/WKWebsiteDataStore.mm:
(-[WKWebsiteDataStore _initWithConfiguration:]):
Make it possible to create a non-persistent WKWebsiteDataStore from a
configuration, and ensure that it does not have any persistent storage directories set.

* UIProcess/API/Cocoa/_WKWebsiteDataStoreConfiguration.h:
* UIProcess/API/Cocoa/_WKWebsiteDataStoreConfiguration.mm:
(-[_WKWebsiteDataStoreConfiguration init]):
(-[_WKWebsiteDataStoreConfiguration initWithNonPersistentConfiguration]):
(-[_WKWebsiteDataStoreConfiguration isPersistent]):
(-[_WKWebsiteDataStoreConfiguration _setWebStorageDirectory:]):
(-[_WKWebsiteDataStoreConfiguration _setIndexedDBDatabaseDirectory:]):
(-[_WKWebsiteDataStoreConfiguration _setWebSQLDatabaseDirectory:]):
(-[_WKWebsiteDataStoreConfiguration _setCookieStorageFile:]):
(-[_WKWebsiteDataStoreConfiguration _setResourceLoadStatisticsDirectory:]):
(-[_WKWebsiteDataStoreConfiguration _setCacheStorageDirectory:]):
(-[_WKWebsiteDataStoreConfiguration _setServiceWorkerRegistrationDirectory:]):
(-[_WKWebsiteDataStoreConfiguration deviceManagementRestrictionsEnabled]):
(-[_WKWebsiteDataStoreConfiguration setDeviceManagementRestrictionsEnabled:]):
* UIProcess/WebsiteData/WebsiteDataStoreConfiguration.cpp:
(WebKit::WebsiteDataStoreConfiguration::copy):
* UIProcess/WebsiteData/WebsiteDataStoreConfiguration.h:
(WebKit::WebsiteDataStoreConfiguration::isPersistent const):
(WebKit::WebsiteDataStoreConfiguration::setPersistent):
(WebKit::WebsiteDataStoreConfiguration::perOriginStorageQuota const):
(WebKit::WebsiteDataStoreConfiguration::deviceManagementRestrictionsEnabled const):
(WebKit::WebsiteDataStoreConfiguration::setDeviceManagementRestrictionsEnabled):
(WebKit::WebsiteDataStoreConfiguration::perOriginStorageQuota): Deleted.
Make it possible to create a _WKWebsiteDataStoreConfiguration that will create a non-persistent
data store. Add a bit to _WKWebsiteDataStoreConfiguration that controls whether the network
session will respect device management restrictions.

* WebKit.xcodeproj/project.pbxproj:
* WebKit/NetworkProcess/cocoa/DeviceManagementSoftLink.h:
* WebKit/NetworkProcess/cocoa/DeviceManagementSoftLink.mm:
* WebKit/Platform/spi/Cocoa/DeviceManagementSPI.h:
Add some soft-linking and SPI headers.

Source/WTF:

* wtf/Platform.h:
Add a HAVE flag for DeviceManagement.framework.
It does exist in the simulator, but does not function; pretend it doesn't exist.

Tools:

* TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
* TestWebKitAPI/Tests/WebKitCocoa/DeviceManagementRestrictions.mm: Added.
(TEST):
* TestWebKitAPI/Tests/WebKitCocoa/WKWebsiteDatastore.mm:
(TestWebKitAPI::TEST):
* TestWebKitAPI/Tests/WebKitCocoa/WebsiteDataStoreCustomPaths.mm:
(TEST):
Clone a test that tests non-persistent data stores and ensure
that it works if the data store is created via a configuration as well.

Add a test that ensures that you can't create a data store configuration
with an invalid set of options.

Add a test that device management restrictions (when mocked) correctly
fail the load with a new, appropriate error.

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

6 months agoUnreviewed, rolling out r245943.
ryanhaddad@apple.com [Fri, 31 May 2019 19:49:16 +0000 (19:49 +0000)]
Unreviewed, rolling out r245943.

Caused API test WKWebView.LocalStorageProcessSuspends to fail
on release bots.

Reverted changeset:

"WKWebsiteDataStore API fails to fetch web storage data for
non-persistent data store"
https://bugs.webkit.org/show_bug.cgi?id=198317
https://trac.webkit.org/changeset/245943

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

6 months agoMove code that sets compositing paint phases into a single function
simon.fraser@apple.com [Fri, 31 May 2019 19:07:30 +0000 (19:07 +0000)]
Move code that sets compositing paint phases into a single function
https://bugs.webkit.org/show_bug.cgi?id=198420

Reviewed by Zalan Bujtas.

Source/WebCore:

To compute the correct paint phases for the various GraphicsLayers in a RenderLayerBacking,
we have to know which set of layers we've created (m_scrollContainerLayer, m_foregroundLayer etc).
So move the code that sets phases into a single function which is called when that
set of layers changes.

The test dumps paint phases for a stacking-context-composited scroller with a negative z-index child.

Also have GraphicsLayer::setPaintingPhase() trigger the necessary repaint when the paint phase changes.

Test: compositing/overflow/stacking-context-composited-scroller-with-foreground-paint-phases.html

* platform/graphics/GraphicsLayer.cpp:
(WebCore::GraphicsLayer::setPaintingPhase):
* platform/graphics/GraphicsLayer.h:
(WebCore::GraphicsLayer::setPaintingPhase): Deleted.
* rendering/RenderLayerBacking.cpp:
(WebCore::RenderLayerBacking::updateConfiguration):
(WebCore::RenderLayerBacking::updateForegroundLayer):
(WebCore::RenderLayerBacking::updateBackgroundLayer):
(WebCore::RenderLayerBacking::updateMaskingLayer):
(WebCore::RenderLayerBacking::updateScrollingLayers):
(WebCore::RenderLayerBacking::updatePaintingPhases):
(WebCore::RenderLayerBacking::paintingPhaseForPrimaryLayer const): Deleted.
* rendering/RenderLayerBacking.h:

LayoutTests:

* compositing/overflow/stacking-context-composited-scroller-with-foreground-paint-phases-expected.txt: Added.
* compositing/overflow/stacking-context-composited-scroller-with-foreground-paint-phases.html: Added.
* platform/ios-wk2/compositing/overflow/stacking-context-composited-scroller-with-foreground-paint-phases-expected.txt: Added.
* platform/mac-wk1/compositing/overflow/stacking-context-composited-scroller-with-foreground-paint-phases-expected.txt: Added.

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

6 months agoWeb Inspector: Timelines: CPU: gray (?) and (x) should be white
drousso@apple.com [Fri, 31 May 2019 19:05:51 +0000 (19:05 +0000)]
Web Inspector: Timelines: CPU: gray (?) and (x) should be white
https://bugs.webkit.org/show_bug.cgi?id=198394

Reviewed by Joseph Pecoraro.

* UserInterface/Views/Variables.css:
(@media (prefers-color-scheme: dark)):
Remove the dark mode override for `--gray-foreground-color`, as the default `white` is a
better contrast.

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

6 months agoWebKitTestRunner sometimes freezes under -[NSWindow release]
ap@apple.com [Fri, 31 May 2019 18:56:36 +0000 (18:56 +0000)]
WebKitTestRunner sometimes freezes under -[NSWindow release]
https://bugs.webkit.org/show_bug.cgi?id=198422

Reviewed by Tim Horton.

The window remains key until it's out of the allWindows vector, and AppKit is not
happy about deallocating key windows. Fixed by updating allWindows in -close
instead of -release.

Added isMainFrame assertions in code that manipulates allWindows for a good measure.

* WebKitTestRunner/mac/WebKitTestRunnerWindow.mm:
(+[WebKitTestRunnerWindow _WTR_keyWindow]):
(-[WebKitTestRunnerWindow initWithContentRect:styleMask:backing:defer:]):
(-[WebKitTestRunnerWindow close]):
(-[WebKitTestRunnerWindow dealloc]):

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

6 months ago[Async overflow scrolling] Flashes of missing layer backing store when scrolling...
simon.fraser@apple.com [Fri, 31 May 2019 18:55:14 +0000 (18:55 +0000)]
[Async overflow scrolling] Flashes of missing layer backing store when scrolling an overflow
https://bugs.webkit.org/show_bug.cgi?id=198363

Reviewed by Tim Horton.

Source/WebCore:

When the contents of an overflow:scroll did not use a tiled backing layer, GraphicsLayerCA::adjustCoverageRect()
would do no coverage rect expansion for scrolling, which meant that backing store attachment for
descendant layers would just use the visible rect from their scrolling ancestor which made it easy
to scroll into view a layer whose backing store was not yet attached.

Since this only affects non-tiled layers, re-use the generic TileController::adjustTileCoverageRect()
code by moving it down to GraphicsLayer, and call it for a scrolled contents layer which does not
have tiled backing.

Tested by fast/scrolling/ios/reconcile-layer-position-recursive.html

* platform/graphics/GraphicsLayer.cpp:
(WebCore::GraphicsLayer::adjustCoverageRectForMovement):
* platform/graphics/GraphicsLayer.h:
* platform/graphics/ca/GraphicsLayerCA.cpp:
(WebCore::GraphicsLayerCA::adjustCoverageRect const):
* platform/graphics/ca/TileController.cpp:
(WebCore::TileController::adjustTileCoverageRect):

LayoutTests:

Reset results.

* fast/scrolling/ios/reconcile-layer-position-recursive-expected.txt:
* tiled-drawing/tiled-backing-in-window-expected.txt:

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

6 months ago[WHLSL] Make sure we properly emit code for "&*x"
sbarati@apple.com [Fri, 31 May 2019 18:16:45 +0000 (18:16 +0000)]
[WHLSL] Make sure we properly emit code for "&*x"
https://bugs.webkit.org/show_bug.cgi?id=198198

Reviewed by Myles C. Maxfield.

Source/WebCore:

I ran into this when trying to test zero-filling code, so let's just fix it.
The issue is that the property resolver ends up emitting code that looks like
"&*x". The semantics of this are such that it should result in just x.
However, we emitted Metal code in such a way where we'd end up with a pointer
to a temporary value. To fix this, DereferenceExpression will emit code that results
in a reference type. Then, MakePointerExpression will correctly return the
pointer backing that reference type.

Because of this, we also no longer need to pattern match the lhs of assignment
expressions since we will now be assigning to a reference type.

Test: webgpu/whlsl-store-to-property-updates-properly.html

* Modules/webgpu/WHLSL/Metal/WHLSLFunctionWriter.cpp:
(WebCore::WHLSL::Metal::FunctionDefinitionWriter::visit):

LayoutTests:

* webgpu/whlsl-store-to-property-updates-properly-expected.html: Added.
* webgpu/whlsl-store-to-property-updates-properly.html: Added.

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

6 months agoSome WeakPtr cleanup
ggaren@apple.com [Fri, 31 May 2019 17:11:58 +0000 (17:11 +0000)]
Some WeakPtr cleanup
https://bugs.webkit.org/show_bug.cgi?id=198390

Reviewed by Chris Dumez.

Source/WebCore:

* Modules/indexeddb/shared/InProcessIDBServer.cpp:
(WebCore::storageQuotaManagerGetter): Dereference the weak pointer
directly instead of using a weak pointer to guard a raw pointer. It's
safer and more idiomatic to use weak pointers directly.

* Modules/indexeddb/shared/InProcessIDBServer.h: Use our base clase
weakPtrFactory() definition instead of writing our own. Declare
WeakValueType so we can dereference the weak pointer we create (above).

Source/WTF:

* wtf/WeakHashSet.h:
(WTF::HashTraits<Ref<WeakPtrImpl>>::isReleasedWeakValue):
(WTF::WeakHashSet::WeakHashSetConstIterator::WeakHashSetConstIterator):
Updated for rename to WeakPtrImpl.

(WTF::WeakHashSet::WeakHashSetConstIterator::get const): Updated for new
get() interface. Also, switched to iterator operator* to help clarify
the double dereference here.

(WTF::WeakHashSet::add):
(WTF::WeakHashSet::remove):
(WTF::WeakHashSet::contains const):
(WTF::WeakHashSet::computeSize const):
(WTF::HashTraits<Ref<WeakReference>>::isReleasedWeakValue): Deleted.
Updated for rename to WeakPtrImpl.

* wtf/WeakPtr.h:
(WTF::WeakPtrImpl::create):
(WTF::WeakPtrImpl::~WeakPtrImpl): Renamed WeakReference to WeakPtrImpl.
Now we don't need a comment explaining that this class is the backing
implementation of WeakPtr.

(WTF::WeakPtrImpl::get): Return the pointer type we stored, rather than
the pointer type requested by our client. It's a little too surprising
for a field to store one pointer type and load another.

(WTF::WeakPtrImpl::WeakPtrImpl): Fixed a theoretical type safety bug.
Make sure to store T::WeakValueType* instead of T*, since they might
not be the same pointer value. (In practice, T and T::WeakValueType*
are always the same type in this constructor because WeakPtrFactory
makes them so, but it's best not to depend on implementation details
across classes.)

(WTF::WeakPtr::get const): Updated for new get() interface.

(WTF::WeakPtr::operator bool const):
(WTF::WeakPtr::operator=):
(WTF::WeakPtr::clear):
(WTF::WeakPtr::WeakPtr): Updated for WeakPtrImpl rename.

(WTF::WeakPtrFactory::~WeakPtrFactory): Updated for WeakPtrImpl rename.

(WTF::WeakPtrFactory::createWeakPtr const): ASSERT that the passed-in
pointer is equal to the stored pointer. As a space optimization, we
require our client to remind us what we point to each time a weak
pointer is created -- but nothing guarantees that our client will do
this correctly.

(WTF::WeakPtrFactory::revokeAll): Updated for WeakPtrImpl rename.

(WTF::CanMakeWeakPtr::weakPtrFactory const):
(WTF::CanMakeWeakPtr::weakPtrFactory): Use idiomatic accessor naming.

(WTF::weak_ptr_impl_cast): Fixed a theoretical type safety bug.
Previously, if Base and Derived both inherited CanMakeWeakPtr, and
you casted WeakPtr<Base> to WeakPtr<Derived> (or vice versa), and
casting Base <-> Derived required pointer fixup, the previous
compile-time check would accept the cast, even though the stored pointer
would be wrong.

(WTF::WeakPtr<T>::WeakPtr):
(WTF::=):
(WTF::makeWeakPtr):
(WTF::WeakReference::create): Deleted.
(WTF::WeakReference::~WeakReference): Deleted.
(WTF::WeakReference::get const): Deleted.
(WTF::WeakReference::operator bool const): Deleted.
(WTF::WeakReference::clear): Deleted.
(WTF::WeakReference::WeakReference): Deleted.
(WTF::weak_reference_cast): Deleted. Updated for rename to WeakPtrImpl.

Don't export WeakPtrImpl because it's an implmenetation detail and
it shouldn't be easy to use outside WTF.

Tools:

* TestWebKitAPI/Tests/WTF/WeakPtr.cpp: Updated for rename.

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

6 months ago[LFC][IFC] InlineFormattingContext::LineLayout::processInlineItemsForLine should...
zalan@apple.com [Fri, 31 May 2019 17:05:33 +0000 (17:05 +0000)]
[LFC][IFC] InlineFormattingContext::LineLayout::processInlineItemsForLine should create and destroy Line.
https://bugs.webkit.org/show_bug.cgi?id=198419
<rdar://problem/51300837>

Reviewed by Antti Koivisto.

This is in preparation for using "createInlineRunsForLine" logic when computing preferred width.
1. Line object is now constructed and destroyed in processInlineItemsForLine (caller does not need to know about Line).
2. processInlineItemsForLine returns a Line::Content instance.

* layout/inlineformatting/InlineFormattingContext.h:
* layout/inlineformatting/InlineFormattingContextLineLayout.cpp:
(WebCore::Layout::InlineFormattingContext::LineLayout::LineInput::LineInput):
(WebCore::Layout::constructLine):
(WebCore::Layout::InlineFormattingContext::LineLayout::processInlineItemsForLine const):
(WebCore::Layout::InlineFormattingContext::LineLayout::layout const):
(WebCore::Layout::InlineFormattingContext::LineLayout::createDisplayRuns const):
(WebCore::Layout::InlineFormattingContext::LineLayout::createLine const): Deleted.
(WebCore::Layout::InlineFormattingContext::LineLayout::createInlineRunsForLine const): Deleted.
(WebCore::Layout::InlineFormattingContext::LineLayout::processInlineRuns const): Deleted.

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

6 months ago[CMake] Add WebKit::WTF target
don.olmstead@sony.com [Fri, 31 May 2019 16:56:03 +0000 (16:56 +0000)]
[CMake] Add WebKit::WTF target
https://bugs.webkit.org/show_bug.cgi?id=198400

Reviewed by Konstantin Tokarev.

Source/JavaScriptCore:

Use the WebKit::WTF target.

* CMakeLists.txt:
* shell/CMakeLists.txt:

Source/WebCore:

Use the WebKit::WTF target.

* PlatformWin.cmake:

Source/WebDriver:

Use the WebKit::WTF target.

* CMakeLists.txt:

Source/WebKitLegacy:

Use the WebKit::WTF target.

* PlatformWin.cmake:

Source/WebKitLegacy/win:

Use the WebKit::WTF target.

* WebKitQuartzCoreAdditions/CMakeLists.txt:

Source/WTF:

Create the WebKit::WTF target and use that to propagate headers. Use
WEBKIT_COPY_FILES instead of WEBKIT_MAKE_FORWARDING_HEADERS.

* wtf/CMakeLists.txt:

Tools:

Use the WebKit::WTF target.

* DumpRenderTree/CMakeLists.txt:
* DumpRenderTree/PlatformWin.cmake:
* MiniBrowser/win/CMakeLists.txt:
* TestWebKitAPI/CMakeLists.txt:
* TestWebKitAPI/PlatformGTK.cmake:
* TestWebKitAPI/PlatformWPE.cmake:
* TestWebKitAPI/PlatformWin.cmake:
* WebKitTestRunner/PlatformGTK.cmake:
* WebKitTestRunner/PlatformWin.cmake:

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

6 months agoVersioning.
kocsen_chung@apple.com [Fri, 31 May 2019 16:48:09 +0000 (16:48 +0000)]
Versioning.

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

6 months agoAlways min-width should win over max-width.
jh718.park@samsung.com [Fri, 31 May 2019 16:37:13 +0000 (16:37 +0000)]
Always min-width should win over max-width.
https://bugs.webkit.org/show_bug.cgi?id=198032

Reviewed by Darin Adler.

In the spec, https://www.w3.org/TR/CSS21/visudet.html#min-max-widths,
the following algorithm describes how the two properties influence
the used value of the 'width' property.

1. The tentative used width is calculated (without 'min-width' and 'max-width')
following the rules under "Calculating widths and margins" above.
2. If the tentative used width is greater than 'max-width',
the rules above are applied again, but this time using the computed value of 'max-width'
as the computed value for 'width'.
3. If the resulting width is smaller than 'min-width', the rules above are applied again,
but this time using the value of 'min-width' as the computed value for 'width'.

LayoutTests/imported/w3c:

* web-platform-tests/css/css-sizing/min-width-max-width-precedence-expected.txt: Added.
* web-platform-tests/css/css-sizing/min-width-max-width-precedence.html: Added.

Source/WebCore:

* rendering/RenderBlock.cpp:
(WebCore::RenderBlock::computePreferredLogicalWidths):

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

6 months agoREGRESSION (Safari 12): SafariForWebkitDevelopment won't load any pages on Mojave...
achristensen@apple.com [Fri, 31 May 2019 16:19:57 +0000 (16:19 +0000)]
REGRESSION (Safari 12): SafariForWebkitDevelopment won't load any pages on Mojave, nightly builds broken
https://bugs.webkit.org/show_bug.cgi?id=194808
<rdar://problem/48278497>

Reviewed by Darin Adler.

I verified that a daily build downloaded an run on Mojave does not work without this and works with this.

* WebKitArchiveSupport/run-webkit-archive:
(set_dyld_framework_path):
Also set XPC variants of needed environment variables.

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

6 months agoUnreviewed, rolling out r245946.
ryanhaddad@apple.com [Fri, 31 May 2019 15:20:48 +0000 (15:20 +0000)]
Unreviewed, rolling out r245946.

Breaks the watchOS build.

Reverted changeset:

"Add an option to mute audio capture automatically when page
is not visible"
https://bugs.webkit.org/show_bug.cgi?id=198307
https://trac.webkit.org/changeset/245946

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

6 months ago[Win10] Some tests are failing only on specific machines
pvollan@apple.com [Fri, 31 May 2019 14:42:45 +0000 (14:42 +0000)]
[Win10] Some tests are failing only on specific machines
https://bugs.webkit.org/show_bug.cgi?id=197509

Unreviewed test gardening.

* platform/win/TestExpectations:

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

6 months ago[LFC[IFC] Do not reuse the same Line object.
zalan@apple.com [Fri, 31 May 2019 13:43:37 +0000 (13:43 +0000)]
[LFC[IFC] Do not reuse the same Line object.
https://bugs.webkit.org/show_bug.cgi?id=198366
<rdar://problem/51250279>

Reviewed by Antti Koivisto.

This is in preparation for constructing Line inside createInlineRunsForLine and return Line::Content.

* layout/inlineformatting/InlineFormattingContext.h:
* layout/inlineformatting/InlineFormattingContextLineLayout.cpp:
(WebCore::Layout::InlineFormattingContext::LineLayout::createLine const):
(WebCore::Layout::InlineFormattingContext::LineLayout::layout const):
(WebCore::Layout::InlineFormattingContext::LineLayout::processInlineRuns const):
(WebCore::Layout::InlineFormattingContext::LineLayout::initializeLine const): Deleted.
* layout/inlineformatting/InlineLine.cpp:
(WebCore::Layout::Line::Line):
(WebCore::Layout::m_lineLogicalWidth):
(WebCore::Layout::Line::close):
(WebCore::Layout::Line::moveLogicalLeft):
(WebCore::Layout::Line::appendNonBreakableSpace):
(WebCore::Layout::Line::appendTextContent):
(WebCore::Layout::Line::appendNonReplacedInlineBox):
(WebCore::Layout::Line::appendHardLineBreak):
(WebCore::Layout::Line::reset): Deleted.
* layout/inlineformatting/InlineLine.h:
(WebCore::Layout::Line::hasContent const):

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

6 months ago[LFC][IFC] Move final runs to a dedicated class (Line::Content)
zalan@apple.com [Fri, 31 May 2019 12:58:35 +0000 (12:58 +0000)]
[LFC][IFC] Move final runs to a dedicated class (Line::Content)
https://bugs.webkit.org/show_bug.cgi?id=198360
<rdar://problem/51247717>

Reviewed by Antti Koivisto.

It decouples the line and the final line content. So when we process the runs after closing the line,
LineContent should be able to answer all the content and geometry related questions.
This is also in preparation for
transfering the ownership of the line content when calling Line::close().

* WebCore.xcodeproj/project.pbxproj:
* layout/inlineformatting/InlineFormattingContextLineLayout.cpp:
(WebCore::Layout::InlineFormattingContext::LineLayout::processInlineRuns const):
* layout/inlineformatting/InlineLine.cpp:
(WebCore::Layout::Line::Content::isVisuallyEmpty const):
(WebCore::Layout::Line::Content::Run::Run):
(WebCore::Layout::Line::reset):
(WebCore::Layout::Line::close):
(WebCore::Layout::Line::moveLogicalLeft):
(WebCore::Layout::Line::appendNonBreakableSpace):
(WebCore::Layout::Line::appendTextContent):
(WebCore::Layout::Line::appendNonReplacedInlineBox):
(WebCore::Layout::Line::appendHardLineBreak):
(WebCore::Layout::Line::LineItem::LineItem): Deleted.
(WebCore::Layout::Line::hasContent const): Deleted.
* layout/inlineformatting/InlineLine.h:
(WebCore::Layout::Line::Content::runs const):
(WebCore::Layout::Line::Content::isEmpty const):
(WebCore::Layout::Line::Content::logicalTop const):
(WebCore::Layout::Line::Content::logicalLeft const):
(WebCore::Layout::Line::Content::logicalRight const):
(WebCore::Layout::Line::Content::logicalBottom const):
(WebCore::Layout::Line::Content::logicalWidth const):
(WebCore::Layout::Line::Content::logicalHeight const):
(WebCore::Layout::Line::Content::setLogicalRect):
(WebCore::Layout::Line::Content::runs):
(WebCore::Layout::Line::hasContent const):
(WebCore::Layout::Line::availableWidth const):
(WebCore::Layout::Line::contentLogicalRight const):
(WebCore::Layout::Line::logicalTop const):
(WebCore::Layout::Line::logicalBottom const):
(WebCore::Layout::Line::logicalLeft const):
(WebCore::Layout::Line::logicalRight const):
(WebCore::Layout::Line::logicalWidth const):
(WebCore::Layout::Line::logicalHeight const):
(WebCore::Layout::Line::contentLogicalWidth const):
* page/FrameViewLayoutContext.cpp:
(WebCore::layoutUsingFormattingContext):

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

6 months agoUnreviewed. Fix typo of |ComputedStyleExtractor::valueForPropertyInStyle|
jh718.park@samsung.com [Fri, 31 May 2019 12:29:19 +0000 (12:29 +0000)]
Unreviewed. Fix typo of |ComputedStyleExtractor::valueForPropertyInStyle|
to follow camel case function naming style.

No behavioral changes.

Patch by Joonghun Park <jh718.park@samsung.com> on 2019-05-31

* animation/KeyframeEffect.cpp:
(WebCore::KeyframeEffect::getKeyframes):
* css/CSSComputedStyleDeclaration.cpp:
(WebCore::ComputedStyleExtractor::propertyValue):
(WebCore::ComputedStyleExtractor::valueForPropertyInStyle):
(WebCore::ComputedStyleExtractor::valueForPropertyinStyle): Deleted.
* css/CSSComputedStyleDeclaration.h:
* rendering/style/RenderStyle.cpp:
(WebCore::changedCustomPaintWatchedProperty):

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

6 months ago[WPE] Build at-spi2-core without x11 support in jhbuild
commit-queue@webkit.org [Fri, 31 May 2019 11:39:48 +0000 (11:39 +0000)]
[WPE] Build at-spi2-core without x11 support in jhbuild
https://bugs.webkit.org/show_bug.cgi?id=198411

Patch by Carlos Garcia Campos <cgarcia@igalia.com> on 2019-05-31
Reviewed by Philippe Normand.

* wpe/jhbuild.modules:

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

6 months agoREGRESSION (r245396): Page load time performance regression
ajuma@chromium.org [Fri, 31 May 2019 11:03:14 +0000 (11:03 +0000)]
REGRESSION (r245396): Page load time performance regression
https://bugs.webkit.org/show_bug.cgi?id=198382

Reviewed by Simon Fraser.

Delay the scheduling of a rendering update by 500ms when a new
IntersectionObserver target is added during page load. This addresses
a page load time regression from r245396, which immediately scheduled a
rendering update when a target is added. Note that even with this change,
if anything else triggers a rendering update before the 500ms delay expires,
intersection observations will be updated during that rendering update.

Covered by intersection-observer/initial-observation.html

* dom/Document.cpp:
(WebCore::Document::updateIntersectionObservations):
(WebCore::Document::scheduleInitialIntersectionObservationUpdate):
* dom/Document.h:
* page/IntersectionObserver.cpp:
(WebCore::IntersectionObserver::observe):

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

6 months ago[GTK] WPERenderer: ensure we complete the last frame when leaving AC mode
carlosgc@webkit.org [Fri, 31 May 2019 08:17:39 +0000 (08:17 +0000)]
[GTK] WPERenderer: ensure we complete the last frame when leaving AC mode
https://bugs.webkit.org/show_bug.cgi?id=198372

Reviewed by Michael Catanzaro.

It can happen that we leave AC mode after a new image is received from the web process but before it's
committed. It can also happen that we receive a new image from the web process right after we have left AC
mode. In both cases we need to complete the frame to ensure we don't leave the wayland compositor waiting
forever for a frame to be completed.

* UIProcess/gtk/AcceleratedBackingStoreWayland.cpp:
(WebKit::AcceleratedBackingStoreWayland::update): Complete any pending image when a new surface is used.
(WebKit::AcceleratedBackingStoreWayland::displayBuffer): Complete the given image and return early if we already
left AC mode.
* UIProcess/gtk/AcceleratedBackingStoreWayland.h:

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

6 months ago[CoordinatedGraphics] WPERenderer: do not release the host file descritor when initia...
carlosgc@webkit.org [Fri, 31 May 2019 08:15:09 +0000 (08:15 +0000)]
[CoordinatedGraphics] WPERenderer: do not release the host file descritor when initializing the render target
https://bugs.webkit.org/show_bug.cgi?id=198371

Reviewed by Michael Catanzaro.

We are assuming that there will always be only one target for a web page. In the GTK port we destroy the render
target when leaving AC mode, and a new one is created when re-entering AC mode. Since the file descriptor is
released on the first target and adopted by libwpe, the second target passes -1 as host fd to libwpe, and the
new surface created by the target is not properly registered in the wayland compositor. That means that frame
requests for the new target are simply ignored by the wayland compositor, it returns early on surfacxe frame
when the surface doesn't have a view backend client.

* WebProcess/WebPage/WebPage.h:
(WebKit::WebPage::hostFileDescriptor const): Rename it and make it const.
* WebProcess/WebPage/libwpe/AcceleratedSurfaceLibWPE.cpp:
(WebKit::AcceleratedSurfaceLibWPE::initialize): Pass a duplicated file descriptor to
wpe_renderer_backend_egl_target_create().

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

6 months ago[GTK] Fix memory leak introduced in r245807
carlosgc@webkit.org [Fri, 31 May 2019 08:13:56 +0000 (08:13 +0000)]
[GTK] Fix memory leak introduced in r245807
https://bugs.webkit.org/show_bug.cgi?id=198369

Reviewed by Michael Catanzaro.

We should destroy the wpe_view_backend_exportable_fdo created in AcceleratedBackingStoreWayland.

* UIProcess/gtk/AcceleratedBackingStoreWayland.cpp:
(WebKit::AcceleratedBackingStoreWayland::~AcceleratedBackingStoreWayland):

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

6 months agoREGRESSION(r244182): [GTK] Web view no longer updated after re-entering AC mode
carlosgc@webkit.org [Fri, 31 May 2019 08:12:45 +0000 (08:12 +0000)]
REGRESSION(r244182): [GTK] Web view no longer updated after re-entering AC mode
https://bugs.webkit.org/show_bug.cgi?id=198367

Reviewed by Sergio Villar Senin.

This happens because we leave accelerated compositing mode when a rendering update is scheduled in
RenderingUpdateScheduler. The ThreadedDisplayRefreshMonitor is destroyed without completing the
frame, so that the RenderingUpdateScheduler is left scheduled forever, ignoring any new schedule request. We
need to ensure we complete the frame request before destroying the display refresh monitor to leave the
RenderingUpdateScheduler in a consistent state.

* Shared/CoordinatedGraphics/threadedcompositor/ThreadedDisplayRefreshMonitor.cpp:
(WebKit::ThreadedDisplayRefreshMonitor::invalidate):

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

6 months agoiOS: Main frame should be scrollable when pinch zoomed or software keyboard is up
rniwa@webkit.org [Fri, 31 May 2019 07:25:43 +0000 (07:25 +0000)]
iOS: Main frame should be scrollable when pinch zoomed or software keyboard is up
https://bugs.webkit.org/show_bug.cgi?id=198244

Reviewed by Simon Fraser.

Source/WebKit:

This is a follow up to r245006. Even when overflow: hidden is specified on the document body,
we still need to make it scrollable when the page is pinch zoomed or there is a content inset
e.g. for software keyboard. Otherwise, the user won't be able to get to the content that is
outside the visual viewport when pinch zoomed or the parts of the page that is not outside
the visual viewport due to the scrolling caused by the software keyboard being brought up.

* UIProcess/API/Cocoa/WKWebView.mm:
(-[WKWebView _didCommitLayerTree:]):

LayoutTests:

Added regression tests.

* fast/scrolling/ios/body-overflow-hidden-height-100-percent-keyboard-expected.txt: Added.
* fast/scrolling/ios/body-overflow-hidden-height-100-percent-keyboard.html: Added.
* fast/scrolling/ios/body-overflow-hidden-height-100-percent-zoomed-1-expected.txt: Added.
* fast/scrolling/ios/body-overflow-hidden-height-100-percent-zoomed-1.html: Added.
* fast/scrolling/ios/body-overflow-hidden-height-100-percent-zoomed-2-expected.txt: Added.
* fast/scrolling/ios/body-overflow-hidden-height-100-percent-zoomed-2.html: Added.

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

6 months agoUnreviewed. Suppress -Wunused-variable warnings for the unused static
zandobersek@gmail.com [Fri, 31 May 2019 06:45:57 +0000 (06:45 +0000)]
Unreviewed. Suppress -Wunused-variable warnings for the unused static
mousePointerID variable by making it a constexpr.

* platform/PointerID.h:

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

6 months agoUse an OptionSet<> for GraphicsLayerPaintingPhase
simon.fraser@apple.com [Fri, 31 May 2019 05:50:50 +0000 (05:50 +0000)]
Use an OptionSet<> for GraphicsLayerPaintingPhase
https://bugs.webkit.org/show_bug.cgi?id=198404

Reviewed by Tim Horton.

Replace GraphicsLayerPaintingPhase with OptionSet<GraphicsLayerPaintingPhase>.

No behavior change.

Source/WebCore:

* page/PageOverlayController.cpp:
(WebCore::PageOverlayController::setPageOverlayNeedsDisplay):
(WebCore::PageOverlayController::paintContents):
(WebCore::PageOverlayController::notifyFlushRequired):
* page/PageOverlayController.h:
* page/linux/ResourceUsageOverlayLinux.cpp:
* page/mac/ServicesOverlayController.h:
* page/mac/ServicesOverlayController.mm:
(WebCore::ServicesOverlayController::Highlight::paintContents):
* platform/graphics/GraphicsLayer.cpp:
(WebCore::GraphicsLayer::dumpProperties const):
* platform/graphics/GraphicsLayer.h:
(WebCore::GraphicsLayer::paintingPhase const):
(WebCore::GraphicsLayer::setPaintingPhase):
* platform/graphics/GraphicsLayerClient.h:
(WebCore::GraphicsLayerClient::paintContents):
* rendering/RenderLayerBacking.cpp:
(WebCore::RenderLayerBacking::updateForegroundLayer):
(WebCore::RenderLayerBacking::updateBackgroundLayer):
(WebCore::RenderLayerBacking::updateMaskingLayer):
(WebCore::RenderLayerBacking::updateChildClippingStrategy):
(WebCore::RenderLayerBacking::updateScrollingLayers):
(WebCore::RenderLayerBacking::paintingPhaseForPrimaryLayer const):
(WebCore::RenderLayerBacking::paintIntoLayer):
(WebCore::RenderLayerBacking::paintContents):
* rendering/RenderLayerBacking.h:
* rendering/RenderLayerCompositor.cpp:
(WebCore::RenderLayerCompositor::paintContents):
* rendering/RenderLayerCompositor.h:

Source/WebKitLegacy/win:

* WebCoreSupport/AcceleratedCompositingContext.cpp:
(AcceleratedCompositingContext::paintContents):
* WebCoreSupport/AcceleratedCompositingContext.h:
* WebView.cpp:
(WebView::paintContents):
* WebView.h:

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

6 months agoFix AVVideoCaptureSource::setFrameRateWithPreset logging
youenn@apple.com [Fri, 31 May 2019 04:57:06 +0000 (04:57 +0000)]
Fix AVVideoCaptureSource::setFrameRateWithPreset logging
https://bugs.webkit.org/show_bug.cgi?id=198392

Reviewed by Eric Carlson.

Move logging from setFrameRateWithPreset to setSessionSizeAndFrameRate which does the actual job.
This ensures to not log in case of preset being null.
No change of behavior.

* platform/mediastream/mac/AVVideoCaptureSource.mm:
(WebCore::AVVideoCaptureSource::setFrameRateWithPreset):
(WebCore::AVVideoCaptureSource::setSessionSizeAndFrameRate):

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

6 months agoVideo playback in Safari should continue when CarPlay is plugged in
jer.noble@apple.com [Fri, 31 May 2019 04:46:39 +0000 (04:46 +0000)]
Video playback in Safari should continue when CarPlay is plugged in
https://bugs.webkit.org/show_bug.cgi?id=198345
<rdar://problem/45505750>

Reviewed by Eric Carlson.

Source/WebCore:

Test: media/video-isplayingtoautomotiveheadunit.html

* html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::shouldOverrideBackgroundPlaybackRestriction const):
* platform/audio/PlatformMediaSessionManager.cpp:
(WebCore::PlatformMediaSessionManager::setIsPlayingToAutomotiveHeadUnit):
* platform/audio/PlatformMediaSessionManager.h:
(WebCore::PlatformMediaSessionManager::isPlayingToAutomotiveHeadUnit const):
* platform/audio/ios/MediaSessionManagerIOS.h:
* platform/audio/ios/MediaSessionManagerIOS.mm:
(WebCore::MediaSessionManageriOS::MediaSessionManageriOS):
(WebCore::MediaSessionManageriOS::carPlayServerDied):
(WebCore::MediaSessionManageriOS::updateCarPlayIsConnected):
(-[WebMediaSessionHelper initWithCallback:]):
(-[WebMediaSessionHelper startMonitoringAirPlayRoutes]):
(-[WebMediaSessionHelper interruption:]):
(-[WebMediaSessionHelper applicationWillEnterForeground:]):
(-[WebMediaSessionHelper applicationDidBecomeActive:]):
(-[WebMediaSessionHelper applicationWillResignActive:]):
(-[WebMediaSessionHelper wirelessRoutesAvailableDidChange:]):
(-[WebMediaSessionHelper applicationDidEnterBackground:]):
(-[WebMediaSessionHelper carPlayServerDied:]):
(-[WebMediaSessionHelper carPlayIsConnectedDidChange:]):
* testing/Internals.cpp:
(WebCore::Internals::resetToConsistentState):
(WebCore::Internals::setIsPlayingToAutomotiveHeadUnit):
* testing/Internals.h:
* testing/Internals.idl:

LayoutTests:

* media/video-isplayingtoautomotiveheadunit-expected.txt: Added.
* media/video-isplayingtoautomotiveheadunit.html: Added.

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

6 months agoAdd an option to mute audio capture automatically when page is not visible
youenn@apple.com [Fri, 31 May 2019 04:46:05 +0000 (04:46 +0000)]
Add an option to mute audio capture automatically when page is not visible
https://bugs.webkit.org/show_bug.cgi?id=198307

Reviewed by Eric Carlson.

Source/WebCore:

Reuse video capture mechanism for audio capture.
In case document gets in the background, interrupt the audio track if the audio factory requires it.
CoreAudioCaptureSourceIOS requires the audio source be interrupted if the app has not the right background mode.
It also allows interrupting the audio capture based on a runtime flag.

Add a runtime flag to control this.
Internals API is used to set it for test purposes, off by default.
For regular cases, the runtime flag is set through web preferences.

Test: platform/ios/mediastream/audio-muted-in-background-tab.html

* dom/Document.cpp:
(WebCore::Document::notifyMediaCaptureOfVisibilityChanged):
* page/RuntimeEnabledFeatures.h:
(WebCore::RuntimeEnabledFeatures::interruptAudioOnPageVisibilityChangeEnabled const):
(WebCore::RuntimeEnabledFeatures::setInterruptAudioOnPageVisibilityChangeEnabled):
* platform/mediastream/RealtimeMediaSourceCenter.cpp:
(WebCore::RealtimeMediaSourceCenter::RealtimeMediaSourceCenter):
(WebCore::RealtimeMediaSourceCenter::initializeShouldInterruptAudioOnPageVisibilityChange):
(WebCore::RealtimeMediaSourceCenter::setCapturePageState):
(WebCore::RealtimeMediaSourceCenter::visibilityDidChange):
* platform/mediastream/RealtimeMediaSourceCenter.h:
(WebCore::RealtimeMediaSourceCenter::shouldInterruptAudioOnPageVisibilityChange):
* platform/mediastream/RealtimeMediaSourceFactory.h:
(WebCore::AudioCaptureFactory::setAudioCapturePageState):
(WebCore::VideoCaptureFactory::setVideoCapturePageState):
* platform/mediastream/ios/CoreAudioCaptureSourceIOS.h:
* platform/mediastream/ios/CoreAudioCaptureSourceIOS.mm:
(WebCore::CoreAudioCaptureSourceFactory::setAudioCapturePageState):
(WebCore::CoreAudioCaptureSourceFactoryIOS::shouldInterruptAudioOnPageVisibilityChange):
* platform/mediastream/mac/CoreAudioCaptureSource.h:
* platform/mediastream/mac/RealtimeMediaSourceCenterMac.cpp:
(WebCore::RealtimeMediaSourceCenter::initializeShouldInterruptAudioOnPageVisibilityChange):
* testing/Internals.cpp:
(WebCore::Internals::resetToConsistentState):
(WebCore::Internals::setShouldInterruptAudioOnPageVisibilityChange):
* testing/Internals.h:
* testing/Internals.idl:

Source/WebKit:

Add API to set the new runtime flag.
Make source proxy factories implement this automatic muting.

* Shared/WebPreferences.yaml:
* UIProcess/API/Cocoa/WKPreferences.mm:
(-[WKPreferences _interruptAudioOnPageVisibilityChangeEnabled]):
(-[WKPreferences _setInterruptAudioOnPageVisibilityChangeEnabled:]):
* UIProcess/API/Cocoa/WKPreferencesPrivate.h:
* WebProcess/cocoa/UserMediaCaptureManager.cpp:
(WebKit::UserMediaCaptureManager::setAudioCapturePageState):
(WebKit::UserMediaCaptureManager::setVideoCapturePageState):
* WebProcess/cocoa/UserMediaCaptureManager.h:

LayoutTests:

* platform/ios/mediastream/audio-muted-in-background-tab-expected.txt: Added.
* platform/ios/mediastream/audio-muted-in-background-tab.html: Added.

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

6 months ago[WHLSL] Enforce variable lifetimes
sbarati@apple.com [Fri, 31 May 2019 04:31:54 +0000 (04:31 +0000)]
[WHLSL] Enforce variable lifetimes
https://bugs.webkit.org/show_bug.cgi?id=195794
<rdar://problem/50746293>

Reviewed by Myles C. Maxfield.

Source/WebCore:

In WHLSL, each variable has global lifetime. So returning a pointer to a
local variable is a legitimate and well specified thing to do. Each local
variable has a unique place in memory. So, for example:

```
thread int* ptr() { int local; return &local; }
thread int* ptrPtr() { return ptr(); }
```

In the above program, ptr() must always return the same value
as ptrPtr(). So, the following would print "42":
```
thread int* p = ptrPtr();
*ptr() = 42;
print(*p);
```

To implement these semantics, this patch introduces a new pass which does the
following transformations:
- It notes every variable whose address is taken in the program.
- Each such variable gets defined as a field in a struct.
- Each function which is an entry point defines this struct.
- Each non entry point takes a pointer to this struct as its final parameter.
- Each call to a non-native function is rewritten to pass a pointer to the
  struct as the last call argument.
- Each variable reference to "x", where "x" ends up in the struct, is
  modified to instead be "struct->x". We store to "struct->x" after declaring
  "x". If "x" is a function parameter, we store to "struct->x" as the first
  thing we do in the function body.

Tests: webgpu/whlsl-ensure-proper-variable-lifetime-2.html
       webgpu/whlsl-ensure-proper-variable-lifetime-3.html
       webgpu/whlsl-ensure-proper-variable-lifetime.html
       webgpu/whlsl-return-local-variable.html

* Modules/webgpu/WHLSL/AST/WHLSLAST.h:
* Modules/webgpu/WHLSL/AST/WHLSLExpression.h:
(WebCore::WHLSL::AST::Expression::Expression):
(WebCore::WHLSL::AST::Expression::isGlobalVariableReference const):
(WebCore::WHLSL::AST::Expression::origin const): Deleted.
* Modules/webgpu/WHLSL/AST/WHLSLFunctionDeclaration.h:
(WebCore::WHLSL::AST::FunctionDeclaration::origin):
* Modules/webgpu/WHLSL/AST/WHLSLGlobalVariableReference.h: Added.
(WebCore::WHLSL::AST::GlobalVariableReference::GlobalVariableReference):
(WebCore::WHLSL::AST::GlobalVariableReference::structField):
(WebCore::WHLSL::AST::GlobalVariableReference::base):
* Modules/webgpu/WHLSL/AST/WHLSLStatement.h:
(WebCore::WHLSL::AST::Statement::Statement):
(WebCore::WHLSL::AST::Statement::isStatementList const):
(WebCore::WHLSL::AST::Statement::isWhileLoop const):
* Modules/webgpu/WHLSL/AST/WHLSLStatementList.h: Added.
(WebCore::WHLSL::AST::StatementList::StatementList):
(WebCore::WHLSL::AST::StatementList::statements):
* Modules/webgpu/WHLSL/AST/WHLSLValue.h:
(WebCore::WHLSL::AST::Value::Value):
(WebCore::WHLSL::AST::Value::origin const):
* Modules/webgpu/WHLSL/AST/WHLSLVariableDeclaration.h:
(WebCore::WHLSL::AST::VariableDeclaration::VariableDeclaration):
(WebCore::WHLSL::AST::VariableDeclaration::takeInitializer):
(WebCore::WHLSL::AST::VariableDeclaration::origin const): Deleted.
* Modules/webgpu/WHLSL/AST/WHLSLVariableReference.h:
(WebCore::WHLSL::AST::VariableReference::wrap):
* Modules/webgpu/WHLSL/Metal/WHLSLFunctionWriter.cpp:
(WebCore::WHLSL::Metal::FunctionDefinitionWriter::visit):
* Modules/webgpu/WHLSL/WHLSLASTDumper.cpp:
(WebCore::WHLSL::ASTDumper::visit):
* Modules/webgpu/WHLSL/WHLSLASTDumper.h:
(WebCore::WHLSL::dumpASTNode):
(WebCore::WHLSL::dumpAST):
(WebCore::WHLSL::toString): Deleted.
* Modules/webgpu/WHLSL/WHLSLPrepare.cpp:
(WebCore::WHLSL::prepareShared):
* Modules/webgpu/WHLSL/WHLSLPreserveVariableLifetimes.cpp: Added.
(WebCore::WHLSL::EscapedVariableCollector::takeEscapedVariables):
(WebCore::WHLSL::anonymousToken):
(WebCore::WHLSL::PreserveLifetimes::PreserveLifetimes):
(WebCore::WHLSL::PreserveLifetimes::makeStructVariableReference):
(WebCore::WHLSL::preserveVariableLifetimes):
* Modules/webgpu/WHLSL/WHLSLPreserveVariableLifetimes.h: Added.
* Modules/webgpu/WHLSL/WHLSLVisitor.cpp:
(WebCore::WHLSL::Visitor::visit):
* Modules/webgpu/WHLSL/WHLSLVisitor.h:
* Sources.txt:
* WebCore.xcodeproj/project.pbxproj:

Source/WTF:

* wtf/PrintStream.h:

LayoutTests:

* webgpu/whlsl-ensure-proper-variable-lifetime-2-expected.html: Added.
* webgpu/whlsl-ensure-proper-variable-lifetime-2.html: Added.
* webgpu/whlsl-ensure-proper-variable-lifetime-3-expected.html: Added.
* webgpu/whlsl-ensure-proper-variable-lifetime-3.html: Added.
* webgpu/whlsl-ensure-proper-variable-lifetime-expected.html: Added.
* webgpu/whlsl-ensure-proper-variable-lifetime.html: Added.
* webgpu/whlsl-return-local-variable-expected.html: Added.
* webgpu/whlsl-return-local-variable.html: Added.

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

6 months agoUnreviewed, rolling out r245890, 245887.
ryanhaddad@apple.com [Fri, 31 May 2019 03:14:35 +0000 (03:14 +0000)]
Unreviewed, rolling out r245890, 245887.

Breaks internal builds.

Reverted changeset:
"Video playback in Safari should continue when CarPlay is plugged in"
https://bugs.webkit.org/show_bug.cgi?id=198345
https://trac.webkit.org/changeset/245887/webkit# Please enter the commit message for your changes. Lines starting

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

6 months agoWKWebsiteDataStore API fails to fetch web storage data for non-persistent data store
sihui_liu@apple.com [Fri, 31 May 2019 02:19:12 +0000 (02:19 +0000)]
WKWebsiteDataStore API fails to fetch web storage data for non-persistent data store
https://bugs.webkit.org/show_bug.cgi?id=198317
Source/WebKit:

<rdar://problem/51244662>

Reviewed by Alex Christensen.

Use LocalStorageNameSpace instead of SessionStorageNameSpace for localStorage in ephemeral session or
websiteDataStore.

* NetworkProcess/WebStorage/StorageManager.cpp:
(WebKit::StorageManager::StorageArea::isEphemeral const):
(WebKit::StorageManager::StorageArea::removeListener):
(WebKit::StorageManager::StorageArea::setItems):
(WebKit::StorageManager::StorageArea::openDatabaseAndImportItemsIfNeeded const):
(WebKit::StorageManager::LocalStorageNamespace::~LocalStorageNamespace):
(WebKit::StorageManager::LocalStorageNamespace::getOrCreateStorageArea):
(WebKit::StorageManager::LocalStorageNamespace::clearAllStorageAreas):
(WebKit::StorageManager::LocalStorageNamespace::ephemeralOrigins const):
(WebKit::StorageManager::LocalStorageNamespace::cloneTo):
(WebKit::StorageManager::StorageManager):
(WebKit::StorageManager::cloneSessionStorageNamespace):
(WebKit::StorageManager::getLocalStorageOrigins):
(WebKit::StorageManager::getLocalStorageOriginDetails):
(WebKit::StorageManager::deleteLocalStorageEntriesForOrigin):
(WebKit::StorageManager::deleteLocalStorageOriginsModifiedSince):
(WebKit::StorageManager::deleteLocalStorageEntriesForOrigins):
(WebKit::StorageManager::createLocalStorageMap):
(WebKit::StorageManager::createTransientLocalStorageMap):
(WebKit::StorageManager::createSessionStorageMap):
(WebKit::StorageManager::destroyStorageMap):
(WebKit::StorageManager::getValues):
(WebKit::StorageManager::setItem):
(WebKit::StorageManager::removeItem):
(WebKit::StorageManager::clear):
(WebKit::StorageManager::suspend):
(WebKit::StorageManager::resume):
(WebKit::StorageManager::StorageArea::isSessionStorage const): Deleted.
* NetworkProcess/WebStorage/StorageManager.h:
(): Deleted.
* WebProcess/WebStorage/StorageAreaMap.cpp:
(WebKit::StorageAreaMap::dispatchStorageEvent):
(WebKit::StorageAreaMap::dispatchSessionStorageEvent):
(WebKit::StorageAreaMap::connect):
* WebProcess/WebStorage/StorageNamespaceImpl.cpp:
(WebKit::StorageNamespaceImpl::createEphemeralLocalStorageNamespace):
(WebKit::StorageNamespaceImpl::createLocalStorageNamespace):
* WebProcess/WebStorage/StorageNamespaceImpl.h:
* WebProcess/WebStorage/WebStorageNamespaceProvider.cpp:
(WebKit::WebStorageNamespaceProvider::createLocalStorageNamespace):

Tools:

Reviewed by Alex Christensen.

* TestWebKitAPI/Tests/WebKitCocoa/WKWebsiteDatastore.mm:
(TestWebKitAPI::TEST):

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

6 months agoMedia documents on iPad are too wide in split screen
dino@apple.com [Fri, 31 May 2019 02:03:59 +0000 (02:03 +0000)]
Media documents on iPad are too wide in split screen
https://bugs.webkit.org/show_bug.cgi?id=198405
<rdar://problem/50974548>

Reviewed by Tim Horton.

Source/WebCore:

Media documents on iPad had a minimum width of 700px. This
was fine in full-screen, but didn't work when then window
was smaller, such as split screen or a link preview.

Tests: media/modern-media-controls/media-documents/media-document-video-ipad-sizing.html
       media/modern-media-controls/media-documents/media-document-video-iphone-sizing.html

* Modules/modern-media-controls/controls/media-document.css: Add a media query to
detect small windows.
* Modules/modern-media-controls/media/media-document-controller.js:

LayoutTests:

Make old test iPhone-specific. Add an iPad-specific test.
And mark all the expectations correctly.

* media/modern-media-controls/media-documents/media-document-video-ipad-sizing-expected.txt: Copied from LayoutTests/media/modern-media-controls/media-documents/media-document-video-ios-sizing-expected.txt.
* media/modern-media-controls/media-documents/media-document-video-ipad-sizing.html: Copied from LayoutTests/media/modern-media-controls/media-documents/media-document-video-ios-sizing.html.
* media/modern-media-controls/media-documents/media-document-video-iphone-sizing-expected.txt: Renamed from LayoutTests/media/modern-media-controls/media-documents/media-document-video-ios-sizing-expected.txt.
* media/modern-media-controls/media-documents/media-document-video-iphone-sizing.html: Renamed from LayoutTests/media/modern-media-controls/media-documents/media-document-video-ios-sizing.html.
* platform/ios/TestExpectations:
* platform/ipad/TestExpectations:
* platform/mac/TestExpectations:

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

6 months ago[CMake] Add WEBKIT_FRAMEWORK_TARGET macro
don.olmstead@sony.com [Fri, 31 May 2019 00:46:38 +0000 (00:46 +0000)]
[CMake] Add WEBKIT_FRAMEWORK_TARGET macro
https://bugs.webkit.org/show_bug.cgi?id=198396

Reviewed by Konstantin Tokarev.

.:

Add a macro to help create the WebKit::targets in CMake.

* CMakeLists.txt:
* Source/cmake/WebKitMacros.cmake:

Source/bmalloc:

Use WEBKIT_FRAMEWORK_TARGET.

* CMakeLists.txt:

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

6 months agoWeb Inspector: Audit: there should be a default test for WebInspectorAudit.Resources...
drousso@apple.com [Fri, 31 May 2019 00:12:03 +0000 (00:12 +0000)]
Web Inspector: Audit: there should be a default test for WebInspectorAudit.Resources functionality
https://bugs.webkit.org/show_bug.cgi?id=196710
<rdar://problem/49712348>

Reviewed by Joseph Pecoraro.

Source/JavaScriptCore:

* inspector/protocol/Audit.json:
Increment Audit version.

Source/WebInspectorUI:

Previously, there was no way to return data from Audit that wasn't a DOM node, a DOM
attribute (which wasn't "shown" anywhere, as it would highlight that attribute on any
returned DOM nodes), or an error string.

In order for Audits to be more flexible with the types of things they test, there needs to
be a way for other types of data to be sent back and displayed in the Audit tab.

This patch makes it so that an Audit result can now contain other keys/values that are all
expected to be JSON serializable. It will take all of the non-"special" (e.g. "domNodes" or
"errors") keys/values and display them as object trees. This way, any JSON serializable data
can be sent with the result and be displayed in the Audit tab.

* UserInterface/Models/AuditTestBase.js:
(WI.AuditTestBase.prototype.async setup):
(WI.AuditTestBase.prototype.clearResult):
* UserInterface/Models/AuditTestGroup.js:
(WI.AuditTestCase.prototype.clearResult):
(WI.AuditTestCase.prototype._updateResult):
* UserInterface/Models/AuditTestCase.js:
(WI.AuditTestCase.prototype.async run):
(WI.AuditTestCase.prototype.async run.async parseResponse):
(WI.AuditTestCase.prototype.async run.async parseResponse.checkResultProperty):
(WI.AuditTestCase.prototype.async run.async parseResponse.checkResultProperty.addErrorForValueType):
(WI.AuditTestCase.prototype.async run.async parseResponse.async resultArrayForEach):
(WI.AuditTestCase.prototype.async run.async parseResponse.inspectedPage_stringify): Added.
Rename `ResultCleared` to `ResultChanged` so that it can (semantically) be used whenever a
new result is set in addition to when an existing one is cleared. This is needed so that
`AuditTestCaseContentView` will refresh each time the result changes, instead of only in the
first `layout()` after the last result was cleared.

* UserInterface/Models/AuditTestCaseResult.js:
(WI.AuditTestCaseResult.async fromPayload):
(WI.AuditTestCaseResult.prototype.toJSON):
Drive-by: fix the check for optional `data` values to still warn if the value is `null`.
* UserInterface/Controllers/AuditManager.js:
(WI.AuditManager.prototype._addDefaultTests):
Add a default test "Demo Audit > Result Data > data-custom" as an example how to write an
Audit that returns custom data, as well as how that custom data is shown in the Audit tab.

* UserInterface/Views/AuditTestContentView.js:
(WI.AuditTestContentView.prototype.shown):
(WI.AuditTestContentView.prototype.handleResultChanged): Added.
* UserInterface/Views/AuditTestCaseContentView.js:
(WI.AuditTestCaseContentView):
(WI.AuditTestCaseContentView.prototype.layout):
(WI.AuditTestCaseContentView.prototype.handleResultChanged): Added.
Preserve the UI for each section across `layout()`s, so that expand/collapse states aren't
reset each time the user changes the selected Audit.

* UserInterface/Views/AuditTestCaseContentView.css:
(.content-view.audit-test-case > section table > tr > td + td): Added.
Drive-by: ensure that the "index" table column is never larger than it needs to be.
* UserInterface/Views/AuditTreeElement.js:
(WI.AuditTreeElement.prototype.onattach):
(WI.AuditTreeElement.prototype._handleTestResultChanged): Added.
(WI.AuditTreeElement.prototype._handleTestResultCleared): Deleted.

* Localizations/en.lproj/localizedStrings.js:

LayoutTests:

* inspector/audit/manager-start-setup.html:
* inspector/audit/manager-start-setup-expected.txt:
* inspector/model/auditTestCase-expected.txt:
* inspector/model/auditTestCaseResult-expected.txt:
* inspector/model/auditTestGroup-expected.txt:
* inspector/unit-tests/object-utilities.html:
* inspector/unit-tests/object-utilities-expected.txt:

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

6 months agoREGRESSION (r245873) [Mac WK2] Layout Test http/wpt/service-workers/update-service...
youenn@apple.com [Fri, 31 May 2019 00:08:04 +0000 (00:08 +0000)]
REGRESSION (r245873) [Mac WK2] Layout Test http/wpt/service-workers/update-service-worker.https.html is a flaky crash after running new test
https://bugs.webkit.org/show_bug.cgi?id=198379
<rdar://problem/51264361>

Reviewed by Alex Christensen.

This case can happen when network process is crashing.
Given the WebSWClientConnection may be kept alive, it might reregister itself but in that case will never be unregistered.
Remove the WebSWClientConnection from the NetworkProcessConnection corresponding map on destruction time.
Covered by no longer crashing tests.

* WebProcess/Network/NetworkProcessConnection.cpp:
(WebKit::NetworkProcessConnection::removeSWClientConnection):
* WebProcess/Network/NetworkProcessConnection.h:
* WebProcess/Storage/WebSWClientConnection.cpp:
(WebKit::WebSWClientConnection::~WebSWClientConnection):

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

6 months agoInserting a newline in contenteditable causes two characters to be added instead...
commit-queue@webkit.org [Fri, 31 May 2019 00:02:59 +0000 (00:02 +0000)]
Inserting a newline in contenteditable causes two characters to be added instead of one
https://bugs.webkit.org/show_bug.cgi?id=197894
<rdar://problem/49700998>

Patch by Andres Gonzalez <andresg_22@apple.com> on 2019-05-30
Reviewed by Wenson Hsieh and Chris Fleizach.

Source/WebCore:

There were two issues with inserting a newline character at the end of
a line that caused problems for accessibility:
- the first '\n' inserted after text would result in two line breaks
inserted instead of one. createFragmentFromText in markup.cpp was
splitting the string "\n" into two empty strings and creating a <div>
and a <br> respectively. Then the emission code would emit a '\n' for
the empty div and another for the <br>.
- the second problem is a consequence of <rdar://problem/5192593> and
the workaround is the change in editing.cpp in the function
visiblePositionForIndexUsingCharacterIterator, similar to what is done
in VisibleUnits.cpp for nextBoundary.
The rest of the changes in this patch are accessibility changes to
execute the layout tests.

Tests: accessibility/ios-simulator/set-selected-text-range-after-newline.html
       accessibility/set-selected-text-range-after-newline.html

* accessibility/AccessibilityRenderObject.cpp:
(WebCore::AccessibilityRenderObject::setSelectedTextRange):
* accessibility/ios/WebAccessibilityObjectWrapperIOS.mm:
(-[WebAccessibilityObjectWrapper stringForRange:]):
(-[WebAccessibilityObjectWrapper _accessibilitySelectedTextRange]):
(-[WebAccessibilityObjectWrapper accessibilityReplaceRange:withText:]):
* accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
(-[WebAccessibilityObjectWrapper accessibilityAttributeValue:]):
* editing/Editing.cpp:
(WebCore::visiblePositionForIndexUsingCharacterIterator):
* editing/markup.cpp:
(WebCore::createFragmentFromText):

Tools:

iOS implementation of several AccessibilityUIElement methods to execute
LayoutTests.

* WebKitTestRunner/InjectedBundle/ios/AccessibilityUIElementIOS.mm:
(WTR::AccessibilityUIElement::selectedTextRange):
(WTR::AccessibilityUIElement::setSelectedTextRange):
(WTR::AccessibilityUIElement::replaceTextInRange):

LayoutTests:

* accessibility/ios-simulator/set-selected-text-range-after-newline-expected.txt: Added.
* accessibility/ios-simulator/set-selected-text-range-after-newline.html: Added.
* accessibility/ios-simulator/text-marker-list-item-expected.txt:
* accessibility/set-selected-text-range-after-newline-expected.txt: Added.
* accessibility/set-selected-text-range-after-newline.html: Added.
* platform/win/TestExpectations:

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

6 months agoNetwork process crash when decoding SecItemResponseData
cdumez@apple.com [Fri, 31 May 2019 00:00:09 +0000 (00:00 +0000)]
Network process crash when decoding SecItemResponseData
https://bugs.webkit.org/show_bug.cgi?id=198388
<rdar://problem/50408046>

Reviewed by Alex Christensen.

* Shared/cf/ArgumentCodersCF.cpp:
(IPC::decode):
When decoding the elements inside a CFArrayRef, if decoding was successful but
the CFTypeRef element is still null then skip it instead of trying to append it
to the array. A CFArray container is not allowed to contain null.
Some of our decoders for CFTypeRef types may not initialize the element even if
the decode() function returns true. For example, the decoders for CFArrayRef and
CFDictionaryRef return true if the encoded container was null but do not create
a container.

* Shared/mac/SecItemResponseData.cpp:
(WebKit::SecItemResponseData::SecItemResponseData):
nit: The wrong parameter was being moved. This is more efficient.

(WebKit::SecItemResponseData::encode const):
nit: Drop unnecessary .get().

* UIProcess/mac/SecItemShimProxy.cpp:
(WebKit::SecItemShimProxy::secItemRequest):
nit: Use nullptr instead of 0.

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

6 months agoWeb Inspector: Audit: tests are unable to get the current Audit version
drousso@apple.com [Thu, 30 May 2019 23:15:09 +0000 (23:15 +0000)]
Web Inspector: Audit: tests are unable to get the current Audit version
https://bugs.webkit.org/show_bug.cgi?id=198270

Reviewed by Timothy Hatcher.

Source/JavaScriptCore:

Expose the Audit version number through the `WebInspectorObject` that's injected into tests
so that they can decide at runtime whether they're supported (e.g. the `unsupported` result).

* inspector/agents/InspectorAuditAgent.h:
* inspector/agents/InspectorAuditAgent.cpp:
(Inspector::InspectorAuditAgent::populateAuditObject):

LayoutTests:

* inspector/audit/run.html:
* inspector/audit/run-expected.txt:
* inspector/audit/version.html:

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

6 months agoIsoHeaps don't notice uncommitted VA becoming the first eligible.
keith_miller@apple.com [Thu, 30 May 2019 23:07:27 +0000 (23:07 +0000)]
IsoHeaps don't notice uncommitted VA becoming the first eligible.
https://bugs.webkit.org/show_bug.cgi?id=198301

Reviewed by Yusuke Suzuki.

Source/bmalloc:

IsoDirectory has a firstEligible member that is used as an
optimization to help find the first fit. However if the scavenger
decommitted a page before firstEligible then we wouldn't move
firstEligible. Thus, if no space is ever freed below firstEligible
we will never reused the decommitted memory (e.g. if the VA page
is decommitted). The fix is to make IsoDirectory::didDecommit move
the firstEligible page back if the decommitted page is smaller
than the current firstEligible. As such, this patch renames
firstEligible to firstEligibleOrDecommitted.

Also, this patch changes gigacageEnabledForProcess to check if the
process starts with Test rather than just test as TestWTF does.

Lastly, unbeknownst to me IsoHeaps are dependent on gigacage, so
by removing gigacage from arm64 I accidentally disabled
IsoHeaps...

* bmalloc.xcodeproj/project.pbxproj:
* bmalloc/IsoDirectory.h:
* bmalloc/IsoDirectoryInlines.h:
(bmalloc::passedNumPages>::takeFirstEligible):
(bmalloc::passedNumPages>::didBecome):
(bmalloc::passedNumPages>::didDecommit):
* bmalloc/IsoHeapImpl.h:
* bmalloc/IsoHeapImplInlines.h:
(bmalloc::IsoHeapImpl<Config>::takeFirstEligible):
(bmalloc::IsoHeapImpl<Config>::didBecomeEligibleOrDecommited):
(bmalloc::IsoHeapImpl<Config>::didCommit):
(bmalloc::IsoHeapImpl<Config>::didBecomeEligible): Deleted.
* bmalloc/IsoTLS.cpp:
(bmalloc::IsoTLS::determineMallocFallbackState):
* bmalloc/ProcessCheck.mm:
(bmalloc::gigacageEnabledForProcess):

Tools:

Move testbmalloc.cpp to TestWTF so it runs in automation.

* TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
* TestWebKitAPI/Tests/WTF/bmalloc/IsoHeap.cpp: Renamed from Source/bmalloc/test/testbmalloc.cpp.
(TEST):

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

6 months agoDragAndDropTests.DataTransferExposePlainTextWithFileURLAsFile API test is failing
wenson_hsieh@apple.com [Thu, 30 May 2019 23:06:34 +0000 (23:06 +0000)]
DragAndDropTests.DataTransferExposePlainTextWithFileURLAsFile API test is failing
https://bugs.webkit.org/show_bug.cgi?id=198389
<rdar://problem/51266096>

Reviewed by Tim Horton.

This test started failing, since the fallback name for a dropped text file changed from "text.txt" to
"Document.txt" on newer iOS SDK versions. We simply fix this test by checking that the name of the file ends
with ".txt", and that the MIME type of the file is "text/plain".

* TestWebKitAPI/Tests/ios/DragAndDropTestsIOS.mm:
(TestWebKitAPI::TEST):

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

6 months ago[JSC] Implement op_wide16 / op_wide32 and introduce 16bit version bytecode
ysuzuki@apple.com [Thu, 30 May 2019 21:40:35 +0000 (21:40 +0000)]
[JSC] Implement op_wide16 / op_wide32 and introduce 16bit version bytecode
https://bugs.webkit.org/show_bug.cgi?id=197979

Reviewed by Filip Pizlo.

JSTests:

* stress/16bit-code.js: Added.
(shouldBe):
* stress/32bit-code.js: Added.
(shouldBe):

Source/JavaScriptCore:

This patch introduces 16bit bytecode size. Previously, we had two versions of bytecodes, 8bit and 32bit. However,
in Gmail, we found that a lot of bytecodes get 32bit because they do not fit in 8bit. 8bit is very small and large
function easily emits a lot of 32bit bytecodes because of large VirtualRegister number etc. But they almost always
fit in 16bit. If we can have 16bit version of bytecode, we can make most of the current 32bit bytecodes 16bit and
save memory.

We rename rename op_wide to op_wide32 and introduce op_wide16. The mechanism is similar to old op_wide. When we
get op_wide16, the following bytecode data is 16bit, and we execute 16bit version of bytecode in LLInt.

We also disable this op_wide16 feature in Windows CLoop, which is used in AppleWin port. When the code size of
CLoop::execute increases, MSVC starts generating CLoop::execute function with very large stack allocation
requirement. Even before introducing this 16bit bytecode, CLoop::execute in AppleWin takes almost 100KB stack
height. After introducing this, it becomes 160KB. While the semantics of the function is correctly compiled,
such a large stack allocation is not essentially necessary, and this leads to stack overflow errors quite easily,
and tests fail with AppleWin port because it starts throwing stack overflow range error in various places.
In this patch, for now, we just disable op_wide16 feature for AppleWin so that CLoop::execute takes 100KB
stack allocation because this patch is not focusing on fixing AppleWin's CLoop issue. We introduce a new backend
type for LLInt, "C_LOOP_WIN". "C_LOOP_WIN" do not generate wide16 version of code to reduce the code size of
CLoop::execute. In the future, we should investigate whether this MSVC issue is fixed in Visual Studio 2019.
Or we should consider always enabling ASM LLInt for Windows.

This patch improves Gmail by 7MB at least.

* CMakeLists.txt:
* bytecode/BytecodeConventions.h:
* bytecode/BytecodeDumper.cpp:
(JSC::BytecodeDumper<Block>::dumpBlock):
* bytecode/BytecodeList.rb:
* bytecode/BytecodeRewriter.h:
(JSC::BytecodeRewriter::Fragment::align):
* bytecode/BytecodeUseDef.h:
(JSC::computeUsesForBytecodeOffset):
(JSC::computeDefsForBytecodeOffset):
* bytecode/CodeBlock.cpp:
(JSC::CodeBlock::finishCreation):
* bytecode/CodeBlock.h:
(JSC::CodeBlock::metadataTable const):
* bytecode/Fits.h:
* bytecode/Instruction.h:
(JSC::Instruction::opcodeID const):
(JSC::Instruction::isWide16 const):
(JSC::Instruction::isWide32 const):
(JSC::Instruction::hasMetadata const):
(JSC::Instruction::sizeShiftAmount const):
(JSC::Instruction::size const):
(JSC::Instruction::wide16 const):
(JSC::Instruction::wide32 const):
(JSC::Instruction::isWide const): Deleted.
(JSC::Instruction::wide const): Deleted.
* bytecode/InstructionStream.h:
(JSC::InstructionStreamWriter::write):
* bytecode/Opcode.h:
* bytecode/OpcodeSize.h:
* bytecompiler/BytecodeGenerator.cpp:
(JSC::BytecodeGenerator::alignWideOpcode16):
(JSC::BytecodeGenerator::alignWideOpcode32):
(JSC::BytecodeGenerator::emitGetByVal): Previously, we always emit 32bit op_get_by_val for bytecodes in `for-in` context because
its operand can be replaced to the other VirtualRegister later. But if we know that replacing VirtualRegister can fit in 8bit / 16bit
a-priori, we should not emit 32bit version. We expose OpXXX::checkWithoutMetadataID to check whether we could potentially compact
the bytecode for the given operands.

(JSC::BytecodeGenerator::emitYieldPoint):
(JSC::StructureForInContext::finalize):
(JSC::BytecodeGenerator::alignWideOpcode): Deleted.
* bytecompiler/BytecodeGenerator.h:
(JSC::BytecodeGenerator::write):
* dfg/DFGCapabilities.cpp:
(JSC::DFG::capabilityLevel):
* generator/Argument.rb:
* generator/DSL.rb:
* generator/Metadata.rb:
* generator/Opcode.rb: A little bit weird but checkImpl's argument must be reference. We are relying on that BoundLabel is once modified in
this check phase, and the modified BoundLabel will be used when emitting the code. If checkImpl copies the passed BoundLabel, this modification
will be discarded in this checkImpl function and make the code generation broken.

* generator/Section.rb:
* jit/JITExceptions.cpp:
(JSC::genericUnwind):
* llint/LLIntData.cpp:
(JSC::LLInt::initialize):
* llint/LLIntData.h:
(JSC::LLInt::opcodeMapWide16):
(JSC::LLInt::opcodeMapWide32):
(JSC::LLInt::getOpcodeWide16):
(JSC::LLInt::getOpcodeWide32):
(JSC::LLInt::getWide16CodePtr):
(JSC::LLInt::getWide32CodePtr):
(JSC::LLInt::opcodeMapWide): Deleted.
(JSC::LLInt::getOpcodeWide): Deleted.
(JSC::LLInt::getWideCodePtr): Deleted.
* llint/LLIntOfflineAsmConfig.h:
* llint/LLIntSlowPaths.cpp:
(JSC::LLInt::LLINT_SLOW_PATH_DECL):
* llint/LLIntSlowPaths.h:
* llint/LowLevelInterpreter.asm:
* llint/LowLevelInterpreter.cpp:
(JSC::CLoop::execute):
* llint/LowLevelInterpreter32_64.asm:
* llint/LowLevelInterpreter64.asm:
* offlineasm/arm.rb:
* offlineasm/arm64.rb:
* offlineasm/asm.rb:
* offlineasm/backends.rb:
* offlineasm/cloop.rb:
* offlineasm/instructions.rb:
* offlineasm/mips.rb:
* offlineasm/x86.rb: Load operation with sign extension should also have the extended size information. For example, loadbs should be
converted to loadbsi for 32bit sign extension (and loadbsq for 64bit sign extension). And use loadbsq / loadhsq for loading VirtualRegister
information in LowLevelInterpreter64 since they will be used for pointer arithmetic and they are using machine register width.

* parser/ResultType.h:
(JSC::OperandTypes::OperandTypes):
(JSC::OperandTypes::first const):
(JSC::OperandTypes::second const):
(JSC::OperandTypes::bits):
(JSC::OperandTypes::fromBits):
(): Deleted.
(JSC::OperandTypes::toInt): Deleted.
(JSC::OperandTypes::fromInt): Deleted.
We reduce sizeof(OperandTypes) from unsigned to uint16_t, which guarantees that OperandTypes always fit in 16bit bytecode.

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

6 months ago[Web GPU] Vertex Buffers/Input State API updates
justin_fan@apple.com [Thu, 30 May 2019 21:05:16 +0000 (21:05 +0000)]
[Web GPU] Vertex Buffers/Input State API updates
https://bugs.webkit.org/show_bug.cgi?id=194258
<rdar://problem/47806127>

Reviewed by Myles C. Maxfield.

Source/WebCore:

The vertex buffer attributes model for GPURenderPipelines in the WebGPU API has been updated.
Update our implementation to match.

No new tests. Existing tests updated to match new behavior.

* CMakeLists.txt:
* DerivedSources-input.xcfilelist:
* DerivedSources-output.xcfilelist:
* DerivedSources.make:
* Modules/webgpu/GPUVertexAttributeDescriptor.idl:
* Modules/webgpu/GPUVertexBufferDescriptor.idl: Renamed from Source/WebCore/Modules/webgpu/GPUInputStateDescriptor.idl.
* Modules/webgpu/GPUVertexInputDescriptor.idl:
* Modules/webgpu/WebGPURenderPipelineDescriptor.idl:
* Sources.txt:
* WebCore.xcodeproj/project.pbxproj:
* platform/graphics/gpu/GPURenderPipelineDescriptor.h:
* platform/graphics/gpu/GPUVertexAttributeDescriptor.h:
* platform/graphics/gpu/GPUVertexBufferDescriptor.h: Renamed from Source/WebCore/platform/graphics/gpu/GPUInputStateDescriptor.h.
* platform/graphics/gpu/GPUVertexInputDescriptor.h:
* platform/graphics/gpu/cocoa/GPURenderPipelineMetal.mm:
(WebCore::trySetVertexInput): Added. Populate Metal and WHLSL pipeline descriptors with vertex attribute metadata.
(WebCore::trySetColorStates): Added. Populate Metal and WHLSL pipeline descriptors with color attachment metadata.
(WebCore::convertLayout): Moved.
(WebCore::trySetMetalFunctions): Moved.
(WebCore::trySetFunctions): Added. WHLSL compilation to Metal SL happens here, then MSL functions are set on pipeline descriptor.
(WebCore::convertRenderPipelineDescriptor): Repurposed. Convert a GPURenderPipelineDescriptor to Metal and WHLSL versions.
(WebCore::tryCreateMtlRenderPipelineState):
(WebCore::GPURenderPipeline::tryCreate):
(WebCore::trySetMetalFunctionsForPipelineDescriptor): Deleted.
(WebCore::trySetWHLSLFunctionsForPipelineDescriptor): Deleted.
(WebCore::trySetFunctionsForPipelineDescriptor): Deleted.
(WebCore::trySetInputStateForPipelineDescriptor): Deleted.
(WebCore::setColorStatesForColorAttachmentArray): Deleted.

LayoutTests:

Update WebGPU tests for the new vertex buffer attributes model.

* webgpu/blend-triangle-strip.html:
* webgpu/buffer-command-buffer-races.html:
* webgpu/buffer-resource-triangles.html:
* webgpu/depth-enabled-triangle-strip.html:
* webgpu/draw-indexed-triangles.html:
* webgpu/js/webgpu-functions.js:
* webgpu/texture-triangle-strip.html:
* webgpu/vertex-buffer-triangle-strip.html:
* webgpu/whlsl-arbitrary-vertex-attribute-locations.html:
* webgpu/whlsl-dereference-pointer-should-type-check.html:
* webgpu/whlsl-dont-crash-parsing-enum.html:
* webgpu/whlsl-dot-expressions.html:
* webgpu/whlsl-nested-dot-expression-rvalue.html:
* webgpu/whlsl.html:

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

6 months agoStop StorageManager when network process is ready to suspend
sihui_liu@apple.com [Thu, 30 May 2019 21:00:57 +0000 (21:00 +0000)]
Stop StorageManager when network process is ready to suspend
https://bugs.webkit.org/show_bug.cgi?id=198201
<rdar://problem/49683172>

Reviewed by Youenn Fablet.

Source/WebKit:

To avoid local storage database operations that can hold lock to database files, suspend thread of
StorageManager when network process is about to suspend.

* NetworkProcess/NetworkProcess.cpp:
(WebKit::NetworkProcess::actualPrepareToSuspend):
(WebKit::NetworkProcess::resume):
* NetworkProcess/NetworkSession.cpp:
(WebKit::NetworkSession::~NetworkSession):
* NetworkProcess/WebStorage/StorageManager.cpp:
(WebKit::StorageManager::suspend):
(WebKit::StorageManager::resume):
* NetworkProcess/WebStorage/StorageManager.h:

Tools:

* TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
* TestWebKitAPI/Tests/WebKitCocoa/LocalStoragePersistence.mm:
(TEST):
* TestWebKitAPI/Tests/WebKitCocoa/local-storage-process-suspends-1.html: Added.
* TestWebKitAPI/Tests/WebKitCocoa/local-storage-process-suspends-2.html: Added.

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

6 months agoMissing caret when focusing an editable field if the selection was set when WKWebView...
wenson_hsieh@apple.com [Thu, 30 May 2019 20:06:38 +0000 (20:06 +0000)]
Missing caret when focusing an editable field if the selection was set when WKWebView wasn't first responder
https://bugs.webkit.org/show_bug.cgi?id=198356
<rdar://problem/50798593>

Reviewed by Tim Horton.

Source/WebKit:

In this bug, the DOM selection is initially set by script in a web view that is not the first responder. Then,
either the user begins editing by tapping somewhere such that the selection does not change, or an editable
element is programmatically focused and the client allows programmatic focus to show the keyboard. This is
because the selection clipping rect used by the UI process when computing the bounds of the caret view is empty,
causing the entire caret to be clipped.

This is due to two related issues: first, no updated editor state is sent to the UI process after the element is
focused, if the selection has not also changed. This means that while the selection geometry is sent over to the
UI process, the selection clipping rect (a member of the EditorState's PostLayoutData called
"focusedElementRect") becomes stale in the UI process, since the there was no focused element when the
previously computed editor state was sent to the UI process. To fix this, we schedule a full editor state update
when an element is focused, to ensure that the selection is eventually updated in the UI process.

Secondly, even once the editor state update is sent to the UI process, we will actually avoid updating any text
selection views, since there is no change in WKSelectionDrawingInfo, which currently consists of a selection
type, and either a caret rect or a list of selection rects. However, since selection drawing is also affected by
the selection clipping rect, it seems reasonable to add the selection clipping rect to the drawing info, and
trigger a selection update if this selection clipping rect has changed.

* UIProcess/ios/WKContentViewInteraction.h:
* UIProcess/ios/WKContentViewInteraction.mm:
(WebKit::WKSelectionDrawingInfo::WKSelectionDrawingInfo):

Add selectionClippingRect to WKSelectionDrawingInfo, and check against it when comparing two drawing infos.

(WebKit::operator==):
(WebKit::operator<<):
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::elementDidFocus):

Schedule an editor state update when focusing an element. In many cases, an editor state update has already been
scheduled when focusing an element, so this becomes a no-op; however, in this scenario, it delivers updated
selection clipping rects (i.e. the focused element rect) and other updated information to the UI process.

LayoutTests:

Add a new layout test to exercise this scenario.

* editing/selection/ios/caret-when-focusing-editable-element-with-selection-expected.txt: Added.
* editing/selection/ios/caret-when-focusing-editable-element-with-selection.html: Added.

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

6 months agoREGRESSION (r245756) [Mac] 2 TestWebKitAPI.DownloadProgress* and TestWebKitAPI._WKDow...
david_quesada@apple.com [Thu, 30 May 2019 19:52:57 +0000 (19:52 +0000)]
REGRESSION (r245756) [Mac] 2 TestWebKitAPI.DownloadProgress* and TestWebKitAPI._WKDownload.DownloadMonitorCancel are flaky timeouts
https://bugs.webkit.org/show_bug.cgi?id=198298
rdar://problem/51182393

Reviewed by Alexey Proskuryakov.

Source/WebKit:

When canceling a download, there has always been a race condition between:

 (A) the execution of Download::didCancel() within the block passed to
     -[NSURLSessionDownloadTask cancelByProducingResumeData:] within
     Download::platformCancelNetworkLoad(), and

 (B) the invocation of -[WKNetworkSessionDelegate URLSession:task:didCompleteWithError:]

If A happens before B, the block calls didCancel() on the download, which reports the
cancellation to the UI process and tears down the download. When B happens, WKNetworkSessionDelegate
gracefully handles the fact that the Download has been removed from the map, and nothing
else happens. Life is good.

If B happens before A, -URLSession:task:didCompleteWithError: invokes Download::didFail(),
which reports a download failure (*not* a cancellation) to the UI process and tears down
the Download and DownloadProxy. On release builds, this can leave the tests waiting for a
cancellation until they time out. When A happens, the block calls Download::didCancel().
This messages the UI process, which results in a debug assertion failure from an unhandled
message since the DownloadProxy was torn down when the failure was reported. Meanwhile,
the network process hits a debug assertion in DownloadManager::downloadFinished() when
trying to remove the Download *again*.

r245756 made the bad case (B before A) more likely by adding a delay before didCancel()
is called.

Make this race condition impossible by eliminating the didCancel() from the cancellation
block, and instead relying on -URLSession:task:didCompleteWithError: to report the
download as canceled. This also effectively coalesces calls to platformCancelNetworkLoad(),
which, if called multiple times before CFNetwork reports that the download was canceled,
could cause multiple calls to didCancel(), resulting in the same assertion failures seen
in the B-before-A case.

No new tests, as recreating this race condition in the test scenario would require
additional machinery, and is no longer even possible since we don't depend on the calling
of the cancellation handler in order to report the Download as canceled.

* NetworkProcess/Downloads/Download.cpp:
(WebKit::Download::cancel):
* NetworkProcess/Downloads/Download.h:
(WebKit::Download::wasCanceled const):
* NetworkProcess/Downloads/cocoa/DownloadCocoa.mm:
(WebKit::Download::platformCancelNetworkLoad):
* NetworkProcess/cocoa/NetworkSessionCocoa.mm:
(-[WKNetworkSessionDelegate URLSession:task:didCompleteWithError:]):

Tools:

Re-enable _WKDownload.DownloadMonitorCancel, which should no longer time out with this fix.

* TestWebKitAPI/Tests/WebKitCocoa/Download.mm:
(TestWebKitAPI::TEST):

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

6 months ago[iOS] Do not linkify telephone numbers inside <a> elements.
zalan@apple.com [Thu, 30 May 2019 19:41:53 +0000 (19:41 +0000)]
[iOS] Do not linkify telephone numbers inside <a> elements.
https://bugs.webkit.org/show_bug.cgi?id=198378

Reviewed by Chris Dumez.

Source/WebCore:

Phone number linkifying mutates the DOM in a potentially unexpected way triggering different kinds of failures with JS, CSS selectors etc.
This patch tightens the linkifying rule so that content inside an <a> element won't get linkified even when the <a> has no valid href attribute.

Test: fast/dom/linkify-phone-numbers.html

* html/parser/HTMLTreeBuilder.cpp:
(WebCore::disallowTelephoneNumberParsing):

LayoutTests:

* fast/dom/linkify-phone-numbers-expected.html: Added.
* fast/dom/linkify-phone-numbers.html: Added.

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

6 months ago[iOS] UIProcess' background task expiration handler may get called after the app...
cdumez@apple.com [Thu, 30 May 2019 19:34:19 +0000 (19:34 +0000)]
[iOS] UIProcess' background task expiration handler may get called after the app is foreground again
https://bugs.webkit.org/show_bug.cgi?id=198380
<rdar://problem/49762471>

Reviewed by Geoffrey Garen.

UIProcess' background task expiration handler may get called after the app is foreground again. When
this happens, we already have a foreground assertion on behalf of the WebContent process, and the view
is visible. We would send the WillSuspendImminently IPC to the WebContent process, which would freeze
its layers, even though it is visible on screen.

To address the issue, we now check if the app is visible in the expiration handler. If it is visible,
we do not notify clients of imminent suspension. Instead, we end the background task right away and
call _updateBackgroundTask asynchronously to start a new background task if necessary.

* UIProcess/ios/ProcessAssertionIOS.mm:
(-[WKProcessAssertionBackgroundTaskManager _updateBackgroundTask]):

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

6 months agoFix yet more deprecated uses of -[UIApplication interfaceOrientation]
krollin@apple.com [Thu, 30 May 2019 19:02:40 +0000 (19:02 +0000)]
Fix yet more deprecated uses of -[UIApplication interfaceOrientation]
https://bugs.webkit.org/show_bug.cgi?id=198381
<rdar://problem/51265846>

Reviewed by Wenson Hsieh.

r245267, r245272, and r245874 fixed many instances of this issue; this
change fixes the issue for tvOS.

* wtf/FeatureDefines.h:

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

6 months agoUnreviewed, rolling out r245883.
tsavell@apple.com [Thu, 30 May 2019 18:43:36 +0000 (18:43 +0000)]
Unreviewed, rolling out r245883.

Caused 6 webgpu/ layout test failures.

Reverted changeset:

"[WHLSL] Parsing and lexing the standard library is slow"
https://bugs.webkit.org/show_bug.cgi?id=192890
https://trac.webkit.org/changeset/245883

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

6 months ago[iOS] Third-party extensions using WKWebView are unable to render anything
cdumez@apple.com [Thu, 30 May 2019 18:39:19 +0000 (18:39 +0000)]
[iOS] Third-party extensions using WKWebView are unable to render anything
https://bugs.webkit.org/show_bug.cgi?id=198359
<rdar://problem/51105015>

Reviewed by Brent Fulgham and Geoff Garen.

Third-party extensions using WKWebView are unable to render anything because we do not get notified
when the extension's visibility changes. Because we do not recognize the extension showing the
WebView to be foreground, we do not take a process assertion on behalf of the child processes and
they get suspended before they get a chance to render anything.

The root of the issue is that WebKit was relying on BKSApplicationStateMonitor.handler to get
notified when the extension's state switches between foreground and background. However, the handler
never gets called unless the extension has an appropriate entitlement.

To address the issue, we now use the same logic for extensions and we do for view services.
I have verified that the _UIViewServiceHostDidEnterBackgroundNotification / _UIViewServiceHostWillEnterForegroundNotification
notifications get sent to the extensions (even third-party). We also properly detect MobileSafari as
host application and are able to get MobileSafari's foreground state accurately.

* UIProcess/ApplicationStateTracker.mm:

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

6 months agooss-fuzz: jsc: Issue 15016: jsc: Abrt in JSC::Wasm::AirIRGenerator::addLocal (15016)
justin_michaud@apple.com [Thu, 30 May 2019 18:06:09 +0000 (18:06 +0000)]
oss-fuzz: jsc: Issue 15016: jsc: Abrt in JSC::Wasm::AirIRGenerator::addLocal (15016)
https://bugs.webkit.org/show_bug.cgi?id=198355

Reviewed by Saam Barati.

JSTests:

* wasm/references/is_null.js:

Source/JavaScriptCore:

Fix missing anyref case in addLocal.

* wasm/WasmAirIRGenerator.cpp:
(JSC::Wasm::AirIRGenerator::addLocal):

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

6 months agoRare crash under `WebPage::shouldIgnoreMetaViewport const` when shrinking to fit...
wenson_hsieh@apple.com [Thu, 30 May 2019 18:05:18 +0000 (18:05 +0000)]
Rare crash under `WebPage::shouldIgnoreMetaViewport const` when shrinking to fit content
https://bugs.webkit.org/show_bug.cgi?id=198374
<rdar://problem/51261348>

Reviewed by Tim Horton.

This is a speculative fix for the crash; what appears to be happening is that the shrink-to-fit-content timer
is somehow being scheduled after the page has already been closed. We can probably fix this by bailing when
scheduling shrink-to-fit-content if m_isClosed is true.

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

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

6 months agoMove some HistoricalVelocityData code into the cpp file
simon.fraser@apple.com [Thu, 30 May 2019 17:02:19 +0000 (17:02 +0000)]
Move some HistoricalVelocityData code into the cpp file
https://bugs.webkit.org/show_bug.cgi?id=198353

Reviewed by Tim Horton.

Now that we have VelocityData.cpp put the non-trivial HistoricalVelocityData::velocityForNewData()
into it. append() can become a lambda function.

* platform/graphics/VelocityData.cpp:
(WebCore::HistoricalVelocityData::velocityForNewData):
* platform/graphics/VelocityData.h:
(WebCore::HistoricalVelocityData::velocityForNewData): Deleted.
(WebCore::HistoricalVelocityData::append): Deleted.

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

6 months agoUnreviewed, rolling out r245881.
tsavell@apple.com [Thu, 30 May 2019 16:58:54 +0000 (16:58 +0000)]
Unreviewed, rolling out r245881.

Broke 13 Layout tests on WK2

Reverted changeset:

"WKWebsiteDataStore API fails to fetch web storage data for
non-persistent data store"
https://bugs.webkit.org/show_bug.cgi?id=198317
https://trac.webkit.org/changeset/245881

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

6 months agoFix the iOS build after r245887
tsavell@apple.com [Thu, 30 May 2019 16:55:22 +0000 (16:55 +0000)]
Fix the iOS build after r245887
https://bugs.webkit.org/show_bug.cgi?id=198345

Unreviewed build fix.

* platform/audio/ios/MediaSessionManagerIOS.mm:
(WebCore::MediaSessionManageriOS::updateCarPlayIsConnected):

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

6 months agoASSERTION FAILED: m_scriptExecutionContext under WebCore::AudioContext::isPlayingAudi...
jer.noble@apple.com [Thu, 30 May 2019 16:49:29 +0000 (16:49 +0000)]
ASSERTION FAILED: m_scriptExecutionContext under WebCore::AudioContext::isPlayingAudioDidChange()
https://bugs.webkit.org/show_bug.cgi?id=181597
<rdar://problem/36474088>

Reviewed by Eric Carlson.

Because document() is usually null-checked before using (and we can add null-checks where missing),
there's no good reason to debug-assert that m_scriptExecutionContext is non-null before downcast<>ing
to Document*.

* Modules/webaudio/AudioContext.cpp:
(WebCore::AudioContext::constructCommon):
(WebCore::AudioContext::stop):
(WebCore::AudioContext::document const):
(WebCore::AudioContext::visibilityStateChanged):
(WebCore::AudioContext::willBeginPlayback):
(WebCore::AudioContext::willPausePlayback):
(WebCore::AudioContext::pageMutedStateDidChange):

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

6 months ago[PlayStation] Skip additional tests on PlayStation
stephan.szabo@sony.com [Thu, 30 May 2019 16:36:44 +0000 (16:36 +0000)]
[PlayStation] Skip additional tests on PlayStation
https://bugs.webkit.org/show_bug.cgi?id=198352

Reviewed by Don Olmstead.

Skip pow test on PlayStation due to behavior difference in standard library.
Skip incremental marking test due to OOM on PlayStation systems.

* stress/incremental-marking-should-not-dead-lock-in-new-property-transition.js:
* stress/math-pow-with-constants.js:
* stress/pow-with-constants.js:

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

6 months agoVideo playback in Safari should continue when CarPlay is plugged in
jer.noble@apple.com [Thu, 30 May 2019 16:29:38 +0000 (16:29 +0000)]
Video playback in Safari should continue when CarPlay is plugged in
https://bugs.webkit.org/show_bug.cgi?id=198345
<rdar://problem/45505750>

Reviewed by Eric Carlson.

Source/WebCore:

Test: media/video-isplayingtoautomotiveheadunit.html

* html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::shouldOverrideBackgroundPlaybackRestriction const):
* platform/audio/PlatformMediaSessionManager.cpp:
(WebCore::PlatformMediaSessionManager::setIsPlayingToAutomotiveHeadUnit):
* platform/audio/PlatformMediaSessionManager.h:
(WebCore::PlatformMediaSessionManager::isPlayingToAutomotiveHeadUnit const):
* platform/audio/ios/MediaSessionManagerIOS.h:
* platform/audio/ios/MediaSessionManagerIOS.mm:
(WebCore::MediaSessionManageriOS::MediaSessionManageriOS):
(WebCore::MediaSessionManageriOS::carPlayServerDied):
(WebCore::MediaSessionManageriOS::updateCarPlayIsConnected):
(-[WebMediaSessionHelper initWithCallback:]):
(-[WebMediaSessionHelper startMonitoringAirPlayRoutes]):
(-[WebMediaSessionHelper interruption:]):
(-[WebMediaSessionHelper applicationWillEnterForeground:]):
(-[WebMediaSessionHelper applicationDidBecomeActive:]):
(-[WebMediaSessionHelper applicationWillResignActive:]):
(-[WebMediaSessionHelper wirelessRoutesAvailableDidChange:]):
(-[WebMediaSessionHelper applicationDidEnterBackground:]):
(-[WebMediaSessionHelper carPlayServerDied:]):
(-[WebMediaSessionHelper carPlayIsConnectedDidChange:]):
* testing/Internals.cpp:
(WebCore::Internals::resetToConsistentState):
(WebCore::Internals::setIsPlayingToAutomotiveHeadUnit):
* testing/Internals.h:
* testing/Internals.idl:

LayoutTests:

* media/video-isplayingtoautomotiveheadunit-expected.txt: Added.
* media/video-isplayingtoautomotiveheadunit.html: Added.

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

6 months ago[ews-build] Update configuration to share bots across queues
aakash_jain@apple.com [Thu, 30 May 2019 16:17:05 +0000 (16:17 +0000)]
[ews-build] Update configuration to share bots across queues
https://bugs.webkit.org/show_bug.cgi?id=198370

Reviewed by Jonathan Bedard.

* BuildSlaveSupport/ews-build/config.json: Share bots across builder and API tester queues.
Also use ews119 instead of ews120 for mac API tests, as ews120 seems to have some issues as
noted in https://bugs.webkit.org/show_bug.cgi?id=197571#c1

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

6 months agowebkitpy: Switch run-webkit-tests to tailspin (Follow-up fix)
jbedard@apple.com [Thu, 30 May 2019 16:05:21 +0000 (16:05 +0000)]
webkitpy: Switch run-webkit-tests to tailspin (Follow-up fix)
https://bugs.webkit.org/show_bug.cgi?id=198144
<rdar://problem/32463212>

Unreviewed infrastructure fix.

* Scripts/webkitpy/port/darwin.py:
(DarwinPort.look_for_new_samples): Use tailspin_file_path instead of spindump_file_path.

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

6 months agoUnreviewed, WPE without a11y support build fix.
philn@webkit.org [Thu, 30 May 2019 14:52:00 +0000 (14:52 +0000)]
Unreviewed, WPE without a11y support build fix.

* UIProcess/wpe/WebPageProxyWPE.cpp: Include atk headers only when enabled.

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

6 months ago[WHLSL] Parsing and lexing the standard library is slow
rmorisset@apple.com [Thu, 30 May 2019 03:41:13 +0000 (03:41 +0000)]
[WHLSL] Parsing and lexing the standard library is slow
https://bugs.webkit.org/show_bug.cgi?id=192890
<rdar://problem/50746335>

Reviewed by Myles Maxfield.

The main idea is to avoid backtracking by instead peeking at the next token (and occasionally at the one after that).
This implies a few things:
- We can replace the stack of tokens by a trivial ring buffer of size 2 (holding the next token and the one after, or WTF::nullopt if we are at the end of the file).
- We now have "completeFooExpression" functions, to avoid having to reparse the prefix of some expression, if we find half-way through what it is.

I also fixed the following parser bug:
- https://bugs.webkit.org/show_bug.cgi?id=198305 [WHLSL] Multiple variables with initializers in a declaration statement crashes the compiler
    which was due to a mistake I made in the grammar

Finally I added two new macros: CONSUME_TYPE and PARSE to eliminate about 500 lines of error propagation boilerplate.

There are still lots of ways of improving the parser and lexer, such as:
- finishing the conversion of tokens in the lexer, not bothering with allocating string views
- make two special tokens Invalid and EOF, to remove the overhead of Optional
- make peekTypes and consumeTypes use templates to avoid constructing a Vector and calling find on it.
- Turn the entire lexer into a proper automata, not going through the same characters again and again (this is certainly the largest win by far)
- Remove the last few pieces of backtracking from the parser.

The current patch is already enough to make parsing the full standard library (something like 85k lines) approximately 260ms.
This is still longer than I would like, but nowhere near the bottleneck any longer because of some other parts of the compiler.

* Modules/webgpu/WHLSL/WHLSLLexer.h:
(WebCore::WHLSL::Lexer::Lexer):
(WebCore::WHLSL::Lexer::consumeToken):
(WebCore::WHLSL::Lexer::peek):
(WebCore::WHLSL::Lexer::peekFurther):
(WebCore::WHLSL::Lexer::state const):
(WebCore::WHLSL::Lexer::setState):
(WebCore::WHLSL::Lexer::unconsumeToken): Deleted.
* Modules/webgpu/WHLSL/WHLSLParser.cpp:
(WebCore::WHLSL::Parser::parse):
(WebCore::WHLSL::Parser::peek):
(WebCore::WHLSL::Parser::peekTypes):
(WebCore::WHLSL::Parser::tryType):
(WebCore::WHLSL::Parser::tryTypes):
(WebCore::WHLSL::Parser::consumeTypes):
(WebCore::WHLSL::Parser::parseConstantExpression):
(WebCore::WHLSL::Parser::parseTypeArgument):
(WebCore::WHLSL::Parser::parseTypeArguments):
(WebCore::WHLSL::Parser::parseTypeSuffixAbbreviated):
(WebCore::WHLSL::Parser::parseTypeSuffixNonAbbreviated):
(WebCore::WHLSL::Parser::parseType):
(WebCore::WHLSL::Parser::parseTypeDefinition):
(WebCore::WHLSL::Parser::parseResourceSemantic):
(WebCore::WHLSL::Parser::parseSpecializationConstantSemantic):
(WebCore::WHLSL::Parser::parseStageInOutSemantic):
(WebCore::WHLSL::Parser::parseSemantic):
(WebCore::WHLSL::Parser::parseQualifiers):
(WebCore::WHLSL::Parser::parseStructureElement):
(WebCore::WHLSL::Parser::parseStructureDefinition):
(WebCore::WHLSL::Parser::parseEnumerationDefinition):
(WebCore::WHLSL::Parser::parseEnumerationMember):
(WebCore::WHLSL::Parser::parseNativeTypeDeclaration):
(WebCore::WHLSL::Parser::parseNumThreadsFunctionAttribute):
(WebCore::WHLSL::Parser::parseAttributeBlock):
(WebCore::WHLSL::Parser::parseParameter):
(WebCore::WHLSL::Parser::parseParameters):
(WebCore::WHLSL::Parser::parseFunctionDefinition):
(WebCore::WHLSL::Parser::parseComputeFunctionDeclaration):
(WebCore::WHLSL::Parser::parseVertexFragmentFunctionDeclaration):
(WebCore::WHLSL::Parser::parseRegularFunctionDeclaration):
(WebCore::WHLSL::Parser::parseOperatorFunctionDeclaration):
(WebCore::WHLSL::Parser::parseFunctionDeclaration):
(WebCore::WHLSL::Parser::parseNativeFunctionDeclaration):
(WebCore::WHLSL::Parser::parseBlock):
(WebCore::WHLSL::Parser::parseBlockBody):
(WebCore::WHLSL::Parser::parseIfStatement):
(WebCore::WHLSL::Parser::parseSwitchStatement):
(WebCore::WHLSL::Parser::parseSwitchCase):
(WebCore::WHLSL::Parser::parseForLoop):
(WebCore::WHLSL::Parser::parseWhileLoop):
(WebCore::WHLSL::Parser::parseDoWhileLoop):
(WebCore::WHLSL::Parser::parseVariableDeclaration):
(WebCore::WHLSL::Parser::parseVariableDeclarations):
(WebCore::WHLSL::Parser::parseStatement):
(WebCore::WHLSL::Parser::parseEffectfulExpression):
(WebCore::WHLSL::Parser::parseEffectfulAssignment):
(WebCore::WHLSL::Parser::parseExpression):
(WebCore::WHLSL::Parser::parseTernaryConditional):
(WebCore::WHLSL::Parser::completeTernaryConditional):
(WebCore::WHLSL::Parser::parseAssignment):
(WebCore::WHLSL::Parser::completeAssignment):
(WebCore::WHLSL::Parser::parsePossibleTernaryConditional):
(WebCore::WHLSL::Parser::parsePossibleLogicalBinaryOperation):
(WebCore::WHLSL::Parser::completePossibleLogicalBinaryOperation):
(WebCore::WHLSL::Parser::parsePossibleRelationalBinaryOperation):
(WebCore::WHLSL::Parser::completePossibleRelationalBinaryOperation):
(WebCore::WHLSL::Parser::parsePossibleShift):
(WebCore::WHLSL::Parser::completePossibleShift):
(WebCore::WHLSL::Parser::parsePossibleAdd):
(WebCore::WHLSL::Parser::completePossibleAdd):
(WebCore::WHLSL::Parser::parsePossibleMultiply):
(WebCore::WHLSL::Parser::completePossibleMultiply):
(WebCore::WHLSL::Parser::parsePossiblePrefix):
(WebCore::WHLSL::Parser::parsePossibleSuffix):
(WebCore::WHLSL::Parser::parseCallExpression):
(WebCore::WHLSL::Parser::parseTerm):
(WebCore::WHLSL::Parser::parseAddressSpaceType): Deleted.
(WebCore::WHLSL::Parser::parseNonAddressSpaceType): Deleted.
(WebCore::WHLSL::Parser::parseEntryPointFunctionDeclaration): Deleted.
(WebCore::WHLSL::Parser::parseEffectfulPrefix): Deleted.
(WebCore::WHLSL::Parser::parseEffectfulSuffix): Deleted.
* Modules/webgpu/WHLSL/WHLSLParser.h:
(WebCore::WHLSL::Parser::Error::dump const):

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

6 months agoRemove some logic to suppress the text selection assistant during drop
wenson_hsieh@apple.com [Thu, 30 May 2019 02:41:10 +0000 (02:41 +0000)]
Remove some logic to suppress the text selection assistant during drop
https://bugs.webkit.org/show_bug.cgi?id=198354

Reviewed by Tim Horton.

Source/WebKit:

This logic was originally added to hide the ranged selection after performing a drop in editable content.
However, after r245803, we (1) no longer show the keyboard and/or text selection views when dropping, and (2)
the final selection is now a caret, so it's no longer necessary to suppress the selection assistant.

* UIProcess/ios/WKContentViewInteraction.h:
* UIProcess/ios/WKContentViewInteraction.mm:
(-[WKContentView dropInteraction:performDrop:]):
(-[WKContentView dropInteraction:concludeDrop:]):

Tools:

Adjust some API tests that currently check whether or not the selection assistant was suppressed during drop.

* TestWebKitAPI/Tests/ios/DragAndDropTestsIOS.mm:
(TestWebKitAPI::TEST):
* TestWebKitAPI/cocoa/DragAndDropSimulator.h:
* TestWebKitAPI/ios/DragAndDropSimulatorIOS.mm:
(-[DragAndDropSimulator _resetSimulatedState]):
(-[DragAndDropSimulator _webView:dataInteractionOperationWasHandled:forSession:itemProviders:]):

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

6 months agoWKWebsiteDataStore API fails to fetch web storage data for non-persistent data store
sihui_liu@apple.com [Thu, 30 May 2019 00:23:58 +0000 (00:23 +0000)]
WKWebsiteDataStore API fails to fetch web storage data for non-persistent data store
https://bugs.webkit.org/show_bug.cgi?id=198317

Reviewed by Alex Christensen.

Source/WebKit:

Use LocalStorageNameSpace instead of SessionStorageNameSpace for localStorage in ephemeral session or
websiteDataStore.

* NetworkProcess/WebStorage/StorageManager.cpp:
(WebKit::StorageManager::StorageArea::isEphemeral const):
(WebKit::StorageManager::StorageArea::removeListener):
(WebKit::StorageManager::StorageArea::setItems):
(WebKit::StorageManager::StorageArea::openDatabaseAndImportItemsIfNeeded const):
(WebKit::StorageManager::LocalStorageNamespace::~LocalStorageNamespace):
(WebKit::StorageManager::LocalStorageNamespace::getOrCreateStorageArea):
(WebKit::StorageManager::LocalStorageNamespace::clearAllStorageAreas):
(WebKit::StorageManager::LocalStorageNamespace::ephemeralOrigins const):
(WebKit::StorageManager::LocalStorageNamespace::cloneTo):
(WebKit::StorageManager::StorageManager):
(WebKit::StorageManager::cloneSessionStorageNamespace):
(WebKit::StorageManager::getLocalStorageOrigins):
(WebKit::StorageManager::getLocalStorageOriginDetails):
(WebKit::StorageManager::deleteLocalStorageEntriesForOrigin):
(WebKit::StorageManager::deleteLocalStorageOriginsModifiedSince):
(WebKit::StorageManager::deleteLocalStorageEntriesForOrigins):
(WebKit::StorageManager::createLocalStorageMap):
(WebKit::StorageManager::createTransientLocalStorageMap):
(WebKit::StorageManager::createSessionStorageMap):
(WebKit::StorageManager::destroyStorageMap):
(WebKit::StorageManager::getValues):
(WebKit::StorageManager::setItem):
(WebKit::StorageManager::removeItem):
(WebKit::StorageManager::clear):
(WebKit::StorageManager::StorageArea::isSessionStorage const): Deleted.
* NetworkProcess/WebStorage/StorageManager.h:
(): Deleted.
* WebProcess/WebStorage/StorageAreaMap.cpp:
(WebKit::StorageAreaMap::dispatchStorageEvent):
(WebKit::StorageAreaMap::dispatchSessionStorageEvent):
(WebKit::StorageAreaMap::connect):
* WebProcess/WebStorage/StorageNamespaceImpl.cpp:
(WebKit::StorageNamespaceImpl::createEphemeralLocalStorageNamespace):
(WebKit::StorageNamespaceImpl::createLocalStorageNamespace):
* WebProcess/WebStorage/StorageNamespaceImpl.h:
* WebProcess/WebStorage/WebStorageNamespaceProvider.cpp:
(WebKit::WebStorageNamespaceProvider::createLocalStorageNamespace):

Tools:

* TestWebKitAPI/Tests/WebKitCocoa/WKWebsiteDatastore.mm:
(TestWebKitAPI::TEST):

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

6 months agoBuild fix for branch.
achristensen@apple.com [Thu, 30 May 2019 00:14:48 +0000 (00:14 +0000)]
Build fix for branch.
<rdar://problem/50625279>

* TestWebKitAPI/Tests/WebKitCocoa/Challenge.mm:

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

6 months agoAttempt to fix JSC test timeouts after adding collectContinuously to WASM tests.
justin_michaud@apple.com [Wed, 29 May 2019 23:53:57 +0000 (23:53 +0000)]
Attempt to fix JSC test timeouts after adding collectContinuously to WASM tests.
https://bugs.webkit.org/show_bug.cgi?id=198322

Rubber-stamped by Michael Saboff. Disable running the new collectContinuously tests on debug builds.
This matches what we do for other jsc tests.

* Scripts/run-jsc-stress-tests:

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

6 months agoUnreviewed, update WebAuthN to "Supported In Preview"
jiewen_tan@apple.com [Wed, 29 May 2019 23:30:31 +0000 (23:30 +0000)]
Unreviewed, update WebAuthN to "Supported In Preview"

* features.json:

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

6 months agoREGRESSION (r244182) [Mac WK2] Layout Test imported/w3c/web-platform-tests/visual...
commit-queue@webkit.org [Wed, 29 May 2019 23:23:49 +0000 (23:23 +0000)]
REGRESSION (r244182) [Mac WK2] Layout Test imported/w3c/web-platform-tests/visual-viewport/viewport-resize-event-on-load-overflowing-page.html is a flaky failure
https://bugs.webkit.org/show_bug.cgi?id=197286

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

LayoutTests/imported/w3c:

This is a time sensitive test. It expects to receive a resize event within
two frames after the page load. Scheduling the page update through the
RenderingUpdate made updating the page for the first time happens not
immediately after the page load but after an additional frame.

So we need to wait for this additional frame before checking whether the
'resize' event was fired.

* web-platform-tests/visual-viewport/viewport-resize-event-on-load-overflowing-page.html:

LayoutTests:

* platform/mac-wk2/TestExpectations:

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

6 months agoClean up a few #include statements in WTF
ddkilzer@apple.com [Wed, 29 May 2019 23:07:29 +0000 (23:07 +0000)]
Clean up a few #include statements in WTF
<https://webkit.org/b/198351>

Reviewed by Alex Christensen.

* benchmarks/HashSetDFGReplay.cpp:
- Add missing "config.h" include.
* wtf/ParallelJobsGeneric.cpp:
- Replace include of ParallelJobs.h with
  ParallelJobsGeneric.h.
* wtf/StackBounds.cpp:
- Fix include ordering of StackBounds.h.

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

6 months agoRemove ENABLE definitions from WebKit config files
don.olmstead@sony.com [Wed, 29 May 2019 23:05:55 +0000 (23:05 +0000)]
Remove ENABLE definitions from WebKit config files
https://bugs.webkit.org/show_bug.cgi?id=197858

Reviewed by Simon Fraser.

.:

Add ENABLE flags into WebKitFeatures.cmake and set the values for GTK and WPE according
to what was present in the config files.

* Source/cmake/OptionsGTK.cmake:
* Source/cmake/OptionsWPE.cmake:
* Source/cmake/WebKitFeatures.cmake:

Source/JavaScriptCore:

Sync FeatureDefines.xcconfig.

* Configurations/FeatureDefines.xcconfig:

Source/WebCore:

Sync FeatureDefines.xcconfig.

* Configurations/FeatureDefines.xcconfig:

Source/WebCore/PAL:

* Configurations/FeatureDefines.xcconfig:

Source/WebKit:

Remove ENABLE flags that were present in the config files. Add the ENABLE flags
to FeatureDefines.xcconfig instead.

* Configurations/FeatureDefines.xcconfig:
* WebKit2Prefix.h:
* config.h:

Source/WebKitLegacy/mac:

Sync FeatureDefines.xcconfig.

* Configurations/FeatureDefines.xcconfig:

Tools:

Sync FeatureDefines.xcconfig.

* TestWebKitAPI/Configurations/FeatureDefines.xcconfig:

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

6 months agoFollowup to r245267 and r245272: fix even more deprecated uses of -[UIApplication...
krollin@apple.com [Wed, 29 May 2019 23:01:54 +0000 (23:01 +0000)]
Followup to r245267 and r245272: fix even more deprecated uses of -[UIApplication interfaceOrientation]
https://bugs.webkit.org/show_bug.cgi?id=198348
<rdar://problem/51234077>

Reviewed by Wenson Hsieh.

r245267 and r245272 fixed many instances of this issue; this change
fixes the issue for watchOS.

* wtf/FeatureDefines.h:

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

6 months agoReestablish WebSWClientConnection in case of network process crash
youenn@apple.com [Wed, 29 May 2019 22:21:08 +0000 (22:21 +0000)]
Reestablish WebSWClientConnection in case of network process crash
https://bugs.webkit.org/show_bug.cgi?id=198333

Reviewed by Alex Christensen.

Source/WebCore:

Refactor DocumentLoader to no longer take a ref to the SWClientConnection.
Instead, store the sessionID and get the SWClientConnection from it.
Remove unused code from ServiceWorkerContainer.

Test: http/wpt/service-workers/service-worker-networkprocess-crash.html

* loader/DocumentLoader.cpp:
(WebCore::DocumentLoader::registerTemporaryServiceWorkerClient):
(WebCore::DocumentLoader::unregisterTemporaryServiceWorkerClient):
* loader/DocumentLoader.h:
* workers/service/ServiceWorkerContainer.cpp:
* workers/service/ServiceWorkerContainer.h:
* workers/service/ServiceWorkerJobClient.h:

Source/WebKit:

WebSWClientConnection now takes a RefPtr<IPC::Connection> so that on network process crash, it will set it back to null.
On the next call that needs the connection, WebSWClientConnection will reinitialize its underlying IPC connection and its own identifier.
Make sure that all code paths requiring this initialization are covered.

* WebProcess/Network/NetworkProcessConnection.cpp:
(WebKit::NetworkProcessConnection::didClose):
(WebKit::NetworkProcessConnection::serviceWorkerConnectionForSession):
(WebKit::NetworkProcessConnection::isRegisteredActiveSWClientConnection):
(WebKit::NetworkProcessConnection::initializeSWClientConnection):
* WebProcess/Network/NetworkProcessConnection.h:
* WebProcess/Storage/WebSWClientConnection.cpp:
(WebKit::WebSWClientConnection::WebSWClientConnection):
(WebKit::WebSWClientConnection::~WebSWClientConnection):
(WebKit::WebSWClientConnection::initializeConnectionIfNeeded):
(WebKit::WebSWClientConnection::ensureConnectionAndSend):
(WebKit::WebSWClientConnection::scheduleJobInServer):
(WebKit::WebSWClientConnection::finishFetchingScriptInServer):
(WebKit::WebSWClientConnection::addServiceWorkerRegistrationInServer):
(WebKit::WebSWClientConnection::removeServiceWorkerRegistrationInServer):
(WebKit::WebSWClientConnection::registerServiceWorkerClient):
(WebKit::WebSWClientConnection::unregisterServiceWorkerClient):
(WebKit::WebSWClientConnection::didResolveRegistrationPromise):
(WebKit::WebSWClientConnection::matchRegistration):
(WebKit::WebSWClientConnection::runOrDelayTaskForImport):
(WebKit::WebSWClientConnection::whenRegistrationReady):
(WebKit::WebSWClientConnection::getRegistrations):
(WebKit::WebSWClientConnection::startFetch):
(WebKit::WebSWClientConnection::cancelFetch):
(WebKit::WebSWClientConnection::continueDidReceiveFetchResponse):
(WebKit::WebSWClientConnection::connectionToServerLost):
(WebKit::WebSWClientConnection::syncTerminateWorker):
(WebKit::WebSWClientConnection::serverConnectionIdentifier const):
(WebKit::WebSWClientConnection::updateThrottleState):
* WebProcess/Storage/WebSWClientConnection.h:

LayoutTests:

* http/wpt/service-workers/service-worker-networkprocess-crash-expected.txt: Added.
* http/wpt/service-workers/service-worker-networkprocess-crash.html: Added.

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

6 months ago[iOS] WebPage::positionInformation() may set InteractionInformationAtPosition.isImage...
commit-queue@webkit.org [Wed, 29 May 2019 22:07:29 +0000 (22:07 +0000)]
[iOS] WebPage::positionInformation() may set InteractionInformationAtPosition.isImage to true but leave image unset
https://bugs.webkit.org/show_bug.cgi?id=198202

Patch by Said Abou-Hallawa <sabouhallawa@apple.com> on 2019-05-29
Reviewed by Tim Horton.

Source/WebKit:

r192037 added the flags isLink and isImage to InteractionInformationAtPosition.
It also made WebPage::positionInformation() set isImage to true but before
ensuring there is a valid image at the position.

Safari WebKit additions assumes if isImage is true then the image has to
hold a valid ShareableBitmap pointer. Since WebPage::positionInformation()
is the only place that sets isImage, the fix is to set isImage to true
only  after passing all the image validation checks.

Since WebPage::positionInformation() is a little bit difficult to read
(182 lines), It was re-factored by splitting it to static functions.

* WebProcess/WebPage/ios/WebPageIOS.mm:
(WebKit::focusedElementPositionInformation):
(WebKit::linkIndicatorPositionInformation):
(WebKit::dataDetectorLinkPositionInformation):
(WebKit::imagePositionInformation):
(WebKit::boundsPositionInformation):
(WebKit::elementPositionInformation):
(WebKit::selectionPositionInformation):
(WebKit::textInteractionPositionInformation):
(WebKit::WebPage::positionInformation):

Tools:

The new test ensures InteractionInformationAtPosition::isImage will not
be to true for a broken image.

* TestWebKitAPI/Tests/WebKitCocoa/WKRequestActivatedElementInfo.mm:
(TestWebKitAPI::TEST):

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

6 months agoIndexedDatabase Server thread in com.apple.WebKit.Networking process leaks objects...
ddkilzer@apple.com [Wed, 29 May 2019 22:07:24 +0000 (22:07 +0000)]
IndexedDatabase Server thread in com.apple.WebKit.Networking process leaks objects into an autoreleasePool that's never cleared
<https://webkit.org/b/198346>
<rdar://problem/50895658>

Reviewed by Brent Fulgham.

Source/WebCore:

* Modules/indexeddb/server/IDBServer.cpp:
(WebCore::IDBServer::IDBServer::IDBServer):
- Pass AutodrainedPoolForRunLoop::Use when creating
  CrossThreadTaskHandler to fix the bug.

Source/WTF:

* wtf/CrossThreadTaskHandler.cpp:
(WTF::CrossThreadTaskHandler::CrossThreadTaskHandler):
- Add optional second argument to enable use of an
  AutodrainedPool when running the runloop.
(WTF::CrossThreadTaskHandler::taskRunLoop):
- Create an AutodrainedPool if requested when
  CrossThreadTaskHandler was created.
* wtf/CrossThreadTaskHandler.h:
(WTF::CrossThreadTaskHandler::AutodrainedPoolForRunLoop):
- Add enum class for enabling an AutodrainedPool for
  CrossThreadTaskHandler::taskRunLoop().
(WTF::CrossThreadTaskHandler::CrossThreadTaskHandler):
- Add optional second argument to enable use of an
  AutodrainedPool when running the runloop.

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

6 months agocheck-webkit-style reports false-positive build/include_order warning in WTF C++...
ddkilzer@apple.com [Wed, 29 May 2019 22:04:58 +0000 (22:04 +0000)]
check-webkit-style reports false-positive build/include_order warning in WTF C++ source files
<https://webkit.org/b/198349>

Reviewed by Alex Christensen.

* Scripts/webkitpy/style/checkers/cpp.py:
(_classify_include): Don't return early for <wtf/Header.h>
includes.
* Scripts/webkitpy/style/checkers/cpp_unittest.py:
(OrderOfIncludesTest.test_primary_header): Add tests for
<wtf/Header.h> includes.

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

6 months agoImplement Promise.allSettled
dino@apple.com [Wed, 29 May 2019 21:28:09 +0000 (21:28 +0000)]
Implement Promise.allSettled
https://bugs.webkit.org/show_bug.cgi?id=197600
<rdar://problem/50483885>

Reviewed by Keith Miller.

JSTests:

Start testing Promise.allSettled. We pass most of the tests.
The ones that fail are similar to the Promise.all tests we already fail.

* test262/config.yaml: Remove Promise.allSettled from skipped tests.
* test262/expectations.yaml: Add new expectations for allSettled tests.

Source/JavaScriptCore:

Implement Promise.allSettled
https://github.com/tc39/proposal-promise-allSettled/

Shipping in Firefox since version 68.
Shipping in V8 since https://chromium.googlesource.com/v8/v8.git/+/1f6d27e8df819b448712dface6ad367fb8de426b

* builtins/PromiseConstructor.js:
(allSettled.newResolveRejectElements.resolveElement):
(allSettled.newResolveRejectElements.rejectElement):
(allSettled.newResolveRejectElements):
(allSettled): Added.
* runtime/JSPromiseConstructor.cpp: Add ref to allSettled.

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

6 months agoWeakPtr breaks vtables when upcasting to base classes
ggaren@apple.com [Wed, 29 May 2019 21:15:54 +0000 (21:15 +0000)]
WeakPtr breaks vtables when upcasting to base classes
https://bugs.webkit.org/show_bug.cgi?id=188799

Reviewed by Youenn Fablet.

Source/WebCore:

* Modules/encryptedmedia/MediaKeySession.cpp:
(WebCore::MediaKeySession::MediaKeySession):
* Modules/encryptedmedia/MediaKeySession.h: Adopted modern WeakPtr APIs.
Removed redundant WeakPtrFactory.

* css/CSSFontFace.cpp:
(WebCore::CSSFontFace::existingWrapper):
* css/CSSFontFace.h: Moved functions out of line to avoid #include
explosion for .get().

* dom/ContainerNode.h:
* dom/Document.h:
* dom/Element.h: Moved CanMakeWeakPtr to ContainerNode because all
subclasses except for DocumentFragment were already so, and we have
code that uses WeakPtr<ContainerNode>, which, now that WeakPtr is
type-safe, is awkward to do when ContainerNode isn't CanMakeWeakPtr.

* dom/FullscreenManager.cpp:
(WebCore::FullscreenManager::fullscreenRenderer const):
* dom/FullscreenManager.h:
(WebCore::FullscreenManager::fullscreenRenderer const): Deleted.
* html/FormAssociatedElement.cpp:
(WebCore::FormAssociatedElement::form const):
* html/FormAssociatedElement.h:
(WebCore::FormAssociatedElement::form const): Deleted. Moved functions
out of line to avoid #include explosion for .get().

* html/HTMLMediaElement.h: It takes an extra using declaration
to disambiguate multiple CanMakeWeakPtr base classes now.

* loader/MediaResourceLoader.cpp:
(WebCore::MediaResourceLoader::requestResource): Removed redundant .get().

* page/DOMWindowProperty.cpp:
(WebCore::DOMWindowProperty::window const):
* page/DOMWindowProperty.h:
(WebCore::DOMWindowProperty::window const): Deleted.
* page/FrameViewLayoutContext.cpp:
(WebCore::FrameViewLayoutContext::subtreeLayoutRoot const):
* page/FrameViewLayoutContext.h:
(WebCore::FrameViewLayoutContext::subtreeLayoutRoot const): Deleted.
* page/UndoItem.cpp:
(WebCore::UndoItem::undoManager const):
* page/UndoItem.h:
(WebCore::UndoItem::undoManager const): Deleted. Moved functions out of
line to avoid #include explosion for .get().

* platform/ScrollView.h: It takes an extra using declaration
to disambiguate multiple CanMakeWeakPtr base classes now.

* platform/Widget.cpp:
(WebCore::Widget::parent const):
* platform/Widget.h:
(WebCore::Widget::parent const): Deleted. Moved functions out of line to avoid #include
explosion for .get().

* platform/encryptedmedia/CDMInstanceSession.h: Made
CDMInstanceSessionClient CanMakeWeakPtr because we use WeakPtr<CDMInstanceSessionClient>.

* platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h:
CanMakeWeakPtr is inherited now.

* platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
(WebCore::MediaPlayerPrivateAVFoundationObjC::MediaPlayerPrivateAVFoundationObjC):
(WebCore::MediaPlayerPrivateAVFoundationObjC::~MediaPlayerPrivateAVFoundationObjC):
* platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.h:
(WebCore::MediaPlayerPrivateMediaSourceAVFObjC::cdmSession const): Deleted.
(WebCore::MediaPlayerPrivateMediaSourceAVFObjC::createWeakPtr): Deleted.
* platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm:
(WebCore::CMTimebaseEffectiveRateChangedCallback):
(WebCore::MediaPlayerPrivateMediaSourceAVFObjC::MediaPlayerPrivateMediaSourceAVFObjC):
(WebCore::MediaPlayerPrivateMediaSourceAVFObjC::play):
(WebCore::MediaPlayerPrivateMediaSourceAVFObjC::pause):
(WebCore::MediaPlayerPrivateMediaSourceAVFObjC::seekWithTolerance):
(WebCore::MediaPlayerPrivateMediaSourceAVFObjC::durationChanged):
(WebCore::MediaPlayerPrivateMediaSourceAVFObjC::cdmSession const):
* platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.h:
* platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm:
(WebCore::SourceBufferPrivateAVFObjC::SourceBufferPrivateAVFObjC):
(WebCore::SourceBufferPrivateAVFObjC::trackDidChangeEnabled):
(WebCore::SourceBufferPrivateAVFObjC::setCDMSession):
(WebCore::SourceBufferPrivateAVFObjC::flushVideo):
(WebCore::SourceBufferPrivateAVFObjC::enqueueSample):
(WebCore::SourceBufferPrivateAVFObjC::notifyClientWhenReadyForMoreSamples):
(WebCore::SourceBufferPrivateAVFObjC::setVideoLayer):
(WebCore::SourceBufferPrivateAVFObjC::setDecompressionSession): Modernized WeakPtr API usage.

* rendering/RenderBlockFlow.cpp:
(WebCore::RenderBlockFlow::multiColumnFlowSlowCase const):
* rendering/RenderBlockFlow.h:
(WebCore::RenderBlockFlow::multiColumnFlow const):
* rendering/RenderMultiColumnFlow.cpp:
(WebCore::RenderMultiColumnFlow::findColumnSpannerPlaceholder const):
* rendering/RenderMultiColumnFlow.h:
* rendering/RenderTable.cpp:
(WebCore::RenderTable::header const):
(WebCore::RenderTable::footer const):
(WebCore::RenderTable::firstBody const):
(WebCore::RenderTable::topSection const):
* rendering/RenderTable.h:
(WebCore::RenderTable::header const): Deleted.
(WebCore::RenderTable::footer const): Deleted.
(WebCore::RenderTable::firstBody const): Deleted.
(WebCore::RenderTable::topSection const): Deleted. Moved functions out
of line to avoid #include explosion for .get().

Source/WebKit:

* NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp:
(WebKit::WebResourceLoadStatisticsStore::networkSession):
* NetworkProcess/Classifier/WebResourceLoadStatisticsStore.h:
* Shared/WebBackForwardListItem.cpp:
(WebKit::WebBackForwardListItem::suspendedPage const):
* Shared/WebBackForwardListItem.h:
(WebKit::WebBackForwardListItem::suspendedPage const): Deleted. Moved
functions out of line to avoid #include explosion for .get().

* UIProcess/Authentication/cocoa/SecKeyProxyStore.h:
(WebKit::SecKeyProxyStore::get const):
(WebKit::SecKeyProxyStore::weakPtrFactory const): Deleted. Adopted
CanMakeWeakPtr.

* UIProcess/WebAuthentication/AuthenticatorManager.h:
* UIProcess/WebProcessProxy.cpp: It takes an extra using declaration
to disambiguate multiple CanMakeWeakPtr base classes now.

(WebKit::WebProcessProxy::processPool const):
* UIProcess/WebProcessProxy.h:
(WebKit::WebProcessProxy::processPool const): Deleted. Moved
functions out of line to avoid #include explosion for .get().

Source/WTF:

This patch switches from reinterpret_cast to static_cast when loading
from WeakReference storage.

We know which type to cast *to* because it's specified by the type of
the calling WeakPtr.

We know which type to cast *from* because it's specified by a typedef
in CanMakeWeakPtr.

(Our convention is that we store a pointer to the class that derives
from CanMakeWeakPtr. We cast from that pointer to derived pointers when
we get(). This means that #include of the derived type header is now
required in order to get() the pointer.)

* wtf/WeakHashSet.h:
(WTF::HashTraits<Ref<WeakReference>>::isReleasedWeakValue): Definition
is now eagerly required because WeakReference is not a template anymore.

(WTF::WeakHashSet::WeakHashSetConstIterator::get const):
(WTF::WeakHashSet::WeakHashSetConstIterator::skipEmptyBuckets):
(WTF::WeakHashSet::remove):
(WTF::WeakHashSet::contains const):
(WTF::WeakHashSet::computesEmpty const):
(WTF::WeakHashSet::hasNullReferences const):
(WTF::WeakHashSet::computeSize const):
(WTF::HashTraits<Ref<WeakReference<T>>>::isReleasedWeakValue): Deleted.
Updated for new WeakReference get() API.

* wtf/WeakPtr.h: Use a macro for TestAPI support. We can't use template
specialization because WeakReference is not a class template anymore.
(Or maybe we could have kept it working with a dummy template argument?
Felt weird, so I switched.)

(WTF::WeakReference::create):
(WTF::WeakReference::~WeakReference):
(WTF::WeakReference::get const):
(WTF::WeakReference::operator bool const):
(WTF::WeakReference::WeakReference): WeakReference is just a void* now.
It's the caller's responsibility, when creating and getting, to use
a consistent storage type. We ensure a canonical storage type using a
typedef inside CanMakeWeakPtr.

(WTF::WeakPtr::WeakPtr):
(WTF::WeakPtr::get const):
(WTF::WeakPtr::operator bool const):
(WTF::WeakPtr::operator-> const):
(WTF::WeakPtr::operator* const): Adopted new WeakReference API.

(WTF::WeakPtrFactory::createWeakPtr const): No need for reinterpret_cast.

(WTF::weak_reference_cast): This isn't required for correctness, but it's
nice to show a complier error at WeakPtr construction sites when you know
that the types won't work. Otherwise, you get compiler errors at
dereference sites, which are slightly more mysterious ways of saying that
you constructed your WeakPtr incorrectly.

(WTF::WeakPtr<T>::WeakPtr):
(WTF::=):
(WTF::makeWeakPtr):
(WTF::weak_reference_upcast): Deleted.
(WTF::weak_reference_downcast): Deleted.

Tools:

* TestWebKitAPI/Tests/WTF/WeakPtr.cpp: Adopt the new macro API instead
of template specialization for observing weak references.

(TestWebKitAPI::Int::Int):
(TestWebKitAPI::Int::operator int const):
(TestWebKitAPI::Int::operator== const): Use a class for integer tests
because WeakPtr doesn't naturally support pointing to non-class objects
now.

(TestWebKitAPI::Base::foo):
(TestWebKitAPI::Derived::foo): Inherit from CanMakeWeakPtr to enable
deduction of the weak pointer type.

(TestWebKitAPI::TEST): Updated to use Int.

(TestWebKitAPI::Base::weakPtrFactory const): Deleted.
(WTF::WeakReference<TestWebKitAPI::Base>::WeakReference): Deleted.
(WTF::WeakReference<TestWebKitAPI::Base>::~WeakReference): Deleted.

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

6 months ago[Pointer Events] toElement and fromElement should be null
commit-queue@webkit.org [Wed, 29 May 2019 21:04:55 +0000 (21:04 +0000)]
[Pointer Events] toElement and fromElement should be null
https://bugs.webkit.org/show_bug.cgi?id=198338

Patch by Antoine Quint <graouts@apple.com> on 2019-05-29
Reviewed by Dean Jackson.

LayoutTests/imported/w3c:

Mark WPT progressions now that we return the correct values for toElement and fromElement.

* web-platform-tests/pointerevents/pointerevent_pointerenter_does_not_bubble-expected.txt:
* web-platform-tests/pointerevents/pointerevent_pointerleave_does_not_bubble-expected.txt:

Source/WebCore:

* dom/MouseEvent.h:
* dom/PointerEvent.h:

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

6 months agoVersioning.
kocsen_chung@apple.com [Wed, 29 May 2019 20:29:26 +0000 (20:29 +0000)]
Versioning.

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

6 months agoUnreviewed, rolling out r245857.
ryanhaddad@apple.com [Wed, 29 May 2019 20:07:56 +0000 (20:07 +0000)]
Unreviewed, rolling out r245857.

Breaks internal builds.

Reverted changeset:

"WeakPtr breaks vtables when upcasting to base classes"
https://bugs.webkit.org/show_bug.cgi?id=188799
https://trac.webkit.org/changeset/245857

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

6 months agoFix internal watchOS build
achristensen@apple.com [Wed, 29 May 2019 19:37:14 +0000 (19:37 +0000)]
Fix internal watchOS build
https://bugs.webkit.org/show_bug.cgi?id=198344
<rdar://problem/51128965>

Reviewed by Geoff Garen.

* Misc/WebDownload.h:
Fix watchOS like we did iosmac in r245596

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

6 months agoFix builds that don't use makeWindowFromView
krollin@apple.com [Wed, 29 May 2019 19:16:35 +0000 (19:16 +0000)]
Fix builds that don't use makeWindowFromView
https://bugs.webkit.org/show_bug.cgi?id=198342
<rdar://problem/51228563>

Reviewed by Wenson Hsieh.

In some configurations, VideoFullscreenInterfaceAVKit.mm declares but
does not use makeWindowFromView. Fix by conditionalizing the the
declaration on the same symbol as point where it's used.

No new tests -- no new functionality.

* platform/ios/VideoFullscreenInterfaceAVKit.mm:

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

6 months ago[iOS] The WebContent process needs proper entitlement to do secure drawing
cdumez@apple.com [Wed, 29 May 2019 19:15:26 +0000 (19:15 +0000)]
[iOS] The WebContent process needs proper entitlement to do secure drawing
https://bugs.webkit.org/show_bug.cgi?id=198343
<rdar://problem/50671257>

Reviewed by Tim Horton.

The WebContent process needs proper entitlement to do secure drawing on iOS.

* Configurations/WebContent-iOS.entitlements:

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

6 months agoUserMediaCaptureManager should remove a source from its map once the source is ended
youenn@apple.com [Wed, 29 May 2019 18:51:25 +0000 (18:51 +0000)]
UserMediaCaptureManager should remove a source from its map once the source is ended
https://bugs.webkit.org/show_bug.cgi?id=198337

Reviewed by Eric Carlson.

When the source is stopped, for instance using MediaStreamTrack.stop,
remove the source from UserMediaCaptureManager sources map.
This makes sure the map will not grow over time.
Add an if check to ensure that the source is still there before processing an incoming IPC call.

When UIProcess tells us the capture is finished (typically capture failed), remove the entry on WebProcess side as well.

* WebProcess/cocoa/UserMediaCaptureManager.cpp:
(WebKit::UserMediaCaptureManager::createCaptureSource):
(WebKit::UserMediaCaptureManager::sourceStopped):
(WebKit::UserMediaCaptureManager::captureFailed):
(WebKit::UserMediaCaptureManager::sourceMutedChanged):
(WebKit::UserMediaCaptureManager::sourceSettingsChanged):
(WebKit::UserMediaCaptureManager::storageChanged):
(WebKit::UserMediaCaptureManager::ringBufferFrameBoundsChanged):
(WebKit::UserMediaCaptureManager::audioSamplesAvailable):
(WebKit::UserMediaCaptureManager::remoteVideoSampleAvailable):
(WebKit::UserMediaCaptureManager::sourceEnded):
(WebKit::UserMediaCaptureManager::applyConstraintsSucceeded):
(WebKit::UserMediaCaptureManager::applyConstraintsFailed):

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

6 months agoUserMediaCaptureManagerProxy::SourceProxy should directly have access to its IPC...
youenn@apple.com [Wed, 29 May 2019 18:36:06 +0000 (18:36 +0000)]
UserMediaCaptureManagerProxy::SourceProxy should directly have access to its IPC connection
https://bugs.webkit.org/show_bug.cgi?id=198335

Reviewed by Eric Carlson.

Previously, SourceProxy was getting its IPC connection by going through its manager, then its process proxy.
As some calls can be done from a background thread, it is safer to directly make SourceProxy own a Ref of its IPC connection.

* UIProcess/Cocoa/UserMediaCaptureManagerProxy.cpp:
(WebKit::UserMediaCaptureManagerProxy::SourceProxy::SourceProxy):
(WebKit::UserMediaCaptureManagerProxy::createMediaSourceForCaptureDeviceWithConstraints):

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

6 months agoWeakPtr breaks vtables when upcasting to base classes
ggaren@apple.com [Wed, 29 May 2019 18:22:00 +0000 (18:22 +0000)]
WeakPtr breaks vtables when upcasting to base classes
https://bugs.webkit.org/show_bug.cgi?id=188799

Reviewed by Youenn Fablet.

Source/WebCore:

* Modules/encryptedmedia/MediaKeySession.cpp:
(WebCore::MediaKeySession::MediaKeySession):
* Modules/encryptedmedia/MediaKeySession.h: Adopted modern WeakPtr APIs.
Removed redundant WeakPtrFactory.

* css/CSSFontFace.cpp:
(WebCore::CSSFontFace::existingWrapper):
* css/CSSFontFace.h: Moved functions out of line to avoid #include
explosion for .get().

* dom/ContainerNode.h:
* dom/Document.h:
* dom/Element.h: Moved CanMakeWeakPtr to ContainerNode because all
subclasses except for DocumentFragment were already so, and we have
code that uses WeakPtr<ContainerNode>, which, now that WeakPtr is
type-safe, is awkward to do when ContainerNode isn't CanMakeWeakPtr.

* dom/FullscreenManager.cpp:
(WebCore::FullscreenManager::fullscreenRenderer const):
* dom/FullscreenManager.h:
(WebCore::FullscreenManager::fullscreenRenderer const): Deleted.
* html/FormAssociatedElement.cpp:
(WebCore::FormAssociatedElement::form const):
* html/FormAssociatedElement.h:
(WebCore::FormAssociatedElement::form const): Deleted. Moved functions
out of line to avoid #include explosion for .get().

* html/HTMLMediaElement.h: It takes an extra using declaration
to disambiguate multiple CanMakeWeakPtr base classes now.

* loader/MediaResourceLoader.cpp:
(WebCore::MediaResourceLoader::requestResource): Removed redundant .get().

* page/DOMWindowProperty.cpp:
(WebCore::DOMWindowProperty::window const):
* page/DOMWindowProperty.h:
(WebCore::DOMWindowProperty::window const): Deleted.
* page/FrameViewLayoutContext.cpp:
(WebCore::FrameViewLayoutContext::subtreeLayoutRoot const):
* page/FrameViewLayoutContext.h:
(WebCore::FrameViewLayoutContext::subtreeLayoutRoot const): Deleted.
* page/UndoItem.cpp:
(WebCore::UndoItem::undoManager const):
* page/UndoItem.h:
(WebCore::UndoItem::undoManager const): Deleted. Moved functions out of
line to avoid #include explosion for .get().

* platform/ScrollView.h: It takes an extra using declaration
to disambiguate multiple CanMakeWeakPtr base classes now.

* platform/Widget.cpp:
(WebCore::Widget::parent const):
* platform/Widget.h:
(WebCore::Widget::parent const): Deleted. Moved functions out of line to avoid #include
explosion for .get().

* platform/encryptedmedia/CDMInstanceSession.h: Made
CDMInstanceSessionClient CanMakeWeakPtr because we use WeakPtr<CDMInstanceSessionClient>.

* platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h:
CanMakeWeakPtr is inherited now.

* platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
(WebCore::MediaPlayerPrivateAVFoundationObjC::MediaPlayerPrivateAVFoundationObjC):
(WebCore::MediaPlayerPrivateAVFoundationObjC::~MediaPlayerPrivateAVFoundationObjC):
* platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.h:
(WebCore::MediaPlayerPrivateMediaSourceAVFObjC::cdmSession const): Deleted.
(WebCore::MediaPlayerPrivateMediaSourceAVFObjC::createWeakPtr): Deleted.
* platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm:
(WebCore::CMTimebaseEffectiveRateChangedCallback):
(WebCore::MediaPlayerPrivateMediaSourceAVFObjC::MediaPlayerPrivateMediaSourceAVFObjC):
(WebCore::MediaPlayerPrivateMediaSourceAVFObjC::play):
(WebCore::MediaPlayerPrivateMediaSourceAVFObjC::pause):
(WebCore::MediaPlayerPrivateMediaSourceAVFObjC::seekWithTolerance):
(WebCore::MediaPlayerPrivateMediaSourceAVFObjC::durationChanged):
(WebCore::MediaPlayerPrivateMediaSourceAVFObjC::cdmSession const):
* platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.h:
* platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm:
(WebCore::SourceBufferPrivateAVFObjC::SourceBufferPrivateAVFObjC):
(WebCore::SourceBufferPrivateAVFObjC::trackDidChangeEnabled):
(WebCore::SourceBufferPrivateAVFObjC::setCDMSession):
(WebCore::SourceBufferPrivateAVFObjC::flushVideo):
(WebCore::SourceBufferPrivateAVFObjC::enqueueSample):
(WebCore::SourceBufferPrivateAVFObjC::notifyClientWhenReadyForMoreSamples):
(WebCore::SourceBufferPrivateAVFObjC::setVideoLayer):
(WebCore::SourceBufferPrivateAVFObjC::setDecompressionSession): Modernized WeakPtr API usage.

* rendering/RenderBlockFlow.cpp:
(WebCore::RenderBlockFlow::multiColumnFlowSlowCase const):
* rendering/RenderBlockFlow.h:
(WebCore::RenderBlockFlow::multiColumnFlow const):
* rendering/RenderMultiColumnFlow.cpp:
(WebCore::RenderMultiColumnFlow::findColumnSpannerPlaceholder const):
* rendering/RenderMultiColumnFlow.h:
* rendering/RenderTable.cpp:
(WebCore::RenderTable::header const):
(WebCore::RenderTable::footer const):
(WebCore::RenderTable::firstBody const):
(WebCore::RenderTable::topSection const):
* rendering/RenderTable.h:
(WebCore::RenderTable::header const): Deleted.
(WebCore::RenderTable::footer const): Deleted.
(WebCore::RenderTable::firstBody const): Deleted.
(WebCore::RenderTable::topSection const): Deleted. Moved functions out
of line to avoid #include explosion for .get().

Source/WebKit:

* NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp:
(WebKit::WebResourceLoadStatisticsStore::networkSession):
* NetworkProcess/Classifier/WebResourceLoadStatisticsStore.h:
* Shared/WebBackForwardListItem.cpp:
(WebKit::WebBackForwardListItem::suspendedPage const):
* Shared/WebBackForwardListItem.h:
(WebKit::WebBackForwardListItem::suspendedPage const): Deleted. Moved
functions out of line to avoid #include explosion for .get().

* UIProcess/Authentication/cocoa/SecKeyProxyStore.h:
(WebKit::SecKeyProxyStore::get const):
(WebKit::SecKeyProxyStore::weakPtrFactory const): Deleted. Adopted
CanMakeWeakPtr.

* UIProcess/WebAuthentication/AuthenticatorManager.h:
* UIProcess/WebProcessProxy.cpp: It takes an extra using declaration
to disambiguate multiple CanMakeWeakPtr base classes now.

(WebKit::WebProcessProxy::processPool const):
* UIProcess/WebProcessProxy.h:
(WebKit::WebProcessProxy::processPool const): Deleted. Moved
functions out of line to avoid #include explosion for .get().

Source/WTF:

This patch switches from reinterpret_cast to static_cast when loading
from WeakReference storage.

We know which type to cast *to* because it's specified by the type of
the calling WeakPtr.

We know which type to cast *from* because it's specified by a typedef
in CanMakeWeakPtr.

(Our convention is that we store a pointer to the class that derives
from CanMakeWeakPtr. We cast from that pointer to derived pointers when
we get(). This means that #include of the derived type header is now
required in order to get() the pointer.)

* wtf/WeakHashSet.h:
(WTF::HashTraits<Ref<WeakReference>>::isReleasedWeakValue): Definition
is now eagerly required because WeakReference is not a template anymore.

(WTF::WeakHashSet::WeakHashSetConstIterator::get const):
(WTF::WeakHashSet::WeakHashSetConstIterator::skipEmptyBuckets):
(WTF::WeakHashSet::remove):
(WTF::WeakHashSet::contains const):
(WTF::WeakHashSet::computesEmpty const):
(WTF::WeakHashSet::hasNullReferences const):
(WTF::WeakHashSet::computeSize const):
(WTF::HashTraits<Ref<WeakReference<T>>>::isReleasedWeakValue): Deleted.
Updated for new WeakReference get() API.

* wtf/WeakPtr.h: Use a macro for TestAPI support. We can't use template
specialization because WeakReference is not a class template anymore.
(Or maybe we could have kept it working with a dummy template argument?
Felt weird, so I switched.)

(WTF::WeakReference::create):
(WTF::WeakReference::~WeakReference):
(WTF::WeakReference::get const):
(WTF::WeakReference::operator bool const):
(WTF::WeakReference::WeakReference): WeakReference is just a void* now.
It's the caller's responsibility, when creating and getting, to use
a consistent storage type. We ensure a canonical storage type using a
typedef inside CanMakeWeakPtr.

(WTF::WeakPtr::WeakPtr):
(WTF::WeakPtr::get const):
(WTF::WeakPtr::operator bool const):
(WTF::WeakPtr::operator-> const):
(WTF::WeakPtr::operator* const): Adopted new WeakReference API.

(WTF::WeakPtrFactory::createWeakPtr const): No need for reinterpret_cast.

(WTF::weak_reference_cast): This isn't required for correctness, but it's
nice to show a complier error at WeakPtr construction sites when you know
that the types won't work. Otherwise, you get compiler errors at
dereference sites, which are slightly more mysterious ways of saying that
you constructed your WeakPtr incorrectly.

(WTF::WeakPtr<T>::WeakPtr):
(WTF::=):
(WTF::makeWeakPtr):
(WTF::weak_reference_upcast): Deleted.
(WTF::weak_reference_downcast): Deleted.

Tools:

* TestWebKitAPI/Tests/WTF/WeakPtr.cpp: Adopt the new macro API instead
of template specialization for observing weak references.

(TestWebKitAPI::Int::Int):
(TestWebKitAPI::Int::operator int const):
(TestWebKitAPI::Int::operator== const): Use a class for integer tests
because WeakPtr doesn't naturally support pointing to non-class objects
now.

(TestWebKitAPI::Base::foo):
(TestWebKitAPI::Derived::foo): Inherit from CanMakeWeakPtr to enable
deduction of the weak pointer type.

(TestWebKitAPI::TEST): Updated to use Int.

(TestWebKitAPI::Base::weakPtrFactory const): Deleted.
(WTF::WeakReference<TestWebKitAPI::Base>::WeakReference): Deleted.
(WTF::WeakReference<TestWebKitAPI::Base>::~WeakReference): Deleted.

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

6 months agoModernize getting proxies of UserMediaCaptureManagerProxy
youenn@apple.com [Wed, 29 May 2019 18:12:40 +0000 (18:12 +0000)]
Modernize getting proxies of UserMediaCaptureManagerProxy
https://bugs.webkit.org/show_bug.cgi?id=198336

Reviewed by Eric Carlson.

No change of behavior, use HashMap::get instead of find.

* UIProcess/Cocoa/UserMediaCaptureManagerProxy.cpp:
(WebKit::UserMediaCaptureManagerProxy::startProducingData):
(WebKit::UserMediaCaptureManagerProxy::stopProducingData):
(WebKit::UserMediaCaptureManagerProxy::capabilities):
(WebKit::UserMediaCaptureManagerProxy::setMuted):
(WebKit::UserMediaCaptureManagerProxy::applyConstraints):

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