WebKit-https.git
7 months ago(iPad) Link tapping is sluggish on many sites
dino@apple.com [Thu, 17 Jan 2019 19:15:57 +0000 (19:15 +0000)]
(iPad) Link tapping is sluggish on many sites
https://bugs.webkit.org/show_bug.cgi?id=193522
<rdar://problem/47102987>

Reviewed by Wenson Hsieh.

Source/WebKit:

Some WKWebView clients might set the initial zoom scale of the page to
something other than 1, which disables the "fast tap" behaviour.
The fix is very simple -- just check against the initial scale rather
than 1.

The most likely regression from this would be pages designed for desktop,
but provide a viewport tag saying width=device-width and initial-scale.
They might stop allowing double-tap-to-zoom.

* UIProcess/API/Cocoa/WKWebView.mm:
(-[WKWebView _allowsDoubleTapGestures]): Check against initial page scale.

LayoutTests:

Add a test that checks a double tap will trigger a click
event on a page that is at initial scale.

Extra bonus: for some reason adding this test, or making this code
change, uncovered a couple of bugs in existing tests. The
viewport-zooms-from-element-to-initial-scale test was completely wrong
because it was expecting the incorrect result, which was triggered by
the zoom callback firing early at a forced scale value. The
viewport-no-width-value-allows-double-tap test was triggering a JS
error in its UI script. I modernised both of these to use UIHelper instead.

* fast/events/ios/fast-click-double-tap-sends-click-when-initial-scale-expected.txt: Added.
* fast/events/ios/fast-click-double-tap-sends-click-when-initial-scale.html: Added.
* fast/events/ios/viewport-no-width-value-allows-double-tap.html:
* fast/events/ios/viewport-zooms-from-element-to-initial-scale-expected.txt:
* fast/events/ios/viewport-zooms-from-element-to-initial-scale.html:
* resources/ui-helper.js: Add doubleTapAt and zoomByDoubleTapAt helpers. Remove the
unnecessary "Done" return value from many of the callbacks. Give zoomToScale a return
value.
(window.UIHelper.tapAt.return.new.Promise):
(window.UIHelper.tapAt):
(window.UIHelper.doubleTapAt.return.new.Promise):
(window.UIHelper.doubleTapAt):
(window.UIHelper.zoomByDoubleTappingAt):
(window.UIHelper.activateAt.return.new.Promise):
(window.UIHelper.activateAt):
(window.UIHelper.toggleCapsLock):
(window.UIHelper.ensurePresentationUpdate.return.new.Promise):
(window.UIHelper.ensurePresentationUpdate):
(window.UIHelper.activateAndWaitForInputSessionAt.return.new.Promise.):
(window.UIHelper.activateFormControl.return.new.Promise.):
(window.UIHelper.replaceTextAtRange):
(window.UIHelper.zoomToScale):
(window.UIHelper.stylusTapAt.return.new.Promise):
(window.UIHelper.stylusTapAt):

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

7 months ago[Win] gperf command not found
pvollan@apple.com [Thu, 17 Jan 2019 19:13:50 +0000 (19:13 +0000)]
[Win] gperf command not found
https://bugs.webkit.org/show_bug.cgi?id=193538
<rdar://problem/47250549>

Reviewed by Brent Fulgham.

CMake only searches for gperf if ENABLE_WEBCORE is on. ENABLE_WEBCORE needs to be set to ON.

* Source/cmake/OptionsAppleWin.cmake:

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

7 months agoStop using NetworkStorageSession::storageSession in WebCore
achristensen@apple.com [Thu, 17 Jan 2019 19:10:53 +0000 (19:10 +0000)]
Stop using NetworkStorageSession::storageSession in WebCore
https://bugs.webkit.org/show_bug.cgi?id=193529

Reviewed by Tim Horton.

Source/WebCore:

Ownership of the map that NetworkStorageSession::storageSession searches needs to move to the WebKit/WebKitLegacy layer,
so when WebCore used to look in this map it needs to call a client function to ask the layer above it for the storage object.
I've called this client StorageSessionProvider::storageSession.  Right now it just looks in NetworkStorageSession::storageSession,
but this added abstraction makes it possible to move the currently process-global map to be a member of the NetworkProcess object.

* Modules/websockets/WebSocketChannel.cpp:
(WebCore::WebSocketChannel::connect):
* WebCore.xcodeproj/project.pbxproj:
* loader/CookieJar.cpp:
(WebCore::CookieJar::create):
(WebCore::CookieJar::CookieJar):
(WebCore::CookieJar::cookies const):
(WebCore::CookieJar::setCookies):
(WebCore::CookieJar::cookiesEnabled const):
(WebCore::CookieJar::cookieRequestHeaderFieldValue const):
(WebCore::CookieJar::getRawCookies const):
(WebCore::CookieJar::deleteCookie):
* loader/CookieJar.h:
* loader/EmptyClients.cpp:
(WebCore::pageConfigurationWithEmptyClients):
* page/Page.h:
* page/SocketProvider.cpp:
(WebCore::SocketProvider::createSocketStreamHandle):
* page/SocketProvider.h:
* platform/network/NetworkingContext.h:
* platform/network/SocketStreamHandleImpl.cpp:
(WebCore::cookieDataForHandshake):
(WebCore::SocketStreamHandleImpl::platformSendHandshake):
* platform/network/StorageSessionProvider.h: Added.
(WebCore::StorageSessionProvider::~StorageSessionProvider):
* platform/network/cf/SocketStreamHandleImpl.h:
(WebCore::SocketStreamHandleImpl::create):
* platform/network/cf/SocketStreamHandleImplCFNet.cpp:
(WebCore::SocketStreamHandleImpl::SocketStreamHandleImpl):
(WebCore::SocketStreamHandleImpl::getStoredCONNECTProxyCredentials):
* platform/network/curl/SocketStreamHandleImpl.h:
(WebCore::SocketStreamHandleImpl::create):
* platform/network/soup/SocketStreamHandleImpl.h:
* platform/network/soup/SocketStreamHandleImplSoup.cpp:
(WebCore::SocketStreamHandleImpl::create):

Source/WebKit:

* NetworkProcess/NetworkConnectionToWebProcess.cpp:
(WebKit::NetworkConnectionToWebProcess::createSocketStream):
* NetworkProcess/NetworkProcess.h:
* NetworkProcess/NetworkSocketStream.cpp:
(WebKit::NetworkSocketStream::create):
(WebKit::NetworkSocketStream::NetworkSocketStream):
* NetworkProcess/NetworkSocketStream.h:
* NetworkProcess/NetworkStorageSessionProvider.h: Added.
* WebKit.xcodeproj/project.pbxproj:
* WebProcess/Network/WebSocketProvider.cpp:
(WebKit::WebSocketProvider::createSocketStreamHandle):
* WebProcess/Network/WebSocketProvider.h:
* WebProcess/WebPage/WebCookieJar.cpp:
(WebKit::WebCookieJar::WebCookieJar):
* WebProcess/WebPage/WebCookieJar.h:

Source/WebKitLegacy:

* WebCoreSupport/PageStorageSessionProvider.h: Added.
* WebKitLegacy.xcodeproj/project.pbxproj:

Source/WebKitLegacy/mac:

* Misc/WebCache.mm:
(+[WebCache addImageToCache:forURL:forFrame:]):
* WebView/WebView.mm:
(-[WebView _commonInitializationWithFrameName:groupName:]):
(-[WebView initSimpleHTMLDocumentWithStyle:frame:preferences:groupName:]):

Source/WebKitLegacy/win:

* WebView.cpp:
(WebView::initWithFrame):

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

7 months agoLayout Test js/dfg-int-overflow-in-loop.html is failing
pvollan@apple.com [Thu, 17 Jan 2019 19:03:08 +0000 (19:03 +0000)]
Layout Test js/dfg-int-overflow-in-loop.html is failing
https://bugs.webkit.org/show_bug.cgi?id=193540

Unreviewed test gardening.

* platform/win/TestExpectations:

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

7 months agoGet rid of Sputnik tests.
ross.kirsling@sony.com [Thu, 17 Jan 2019 18:34:40 +0000 (18:34 +0000)]
Get rid of Sputnik tests.
https://bugs.webkit.org/show_bug.cgi?id=193464

Rubber stamped by Saam Barati.

* sputnik/: Removed.
* platform/gtk/sputnik/: Removed.
* platform/ios/sputnik/: Removed.
* platform/mac/sputnik/: Removed.
* platform/wpe/sputnik/: Removed.

* TestExpectations:
* platform/gtk/TestExpectations:
* platform/ios-wk2/TestExpectations:
* platform/ios/TestExpectations:
* platform/mac/TestExpectations:
* platform/win/TestExpectations:
* platform/wincairo/TestExpectations:
* platform/wpe/TestExpectations:
Remove all sputnik/ lines.

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

7 months agoStringObjectUse should not be a structure check for the original string object structure
sbarati@apple.com [Thu, 17 Jan 2019 17:50:27 +0000 (17:50 +0000)]
StringObjectUse should not be a structure check for the original string object structure
https://bugs.webkit.org/show_bug.cgi?id=193483
<rdar://problem/47280522>

Reviewed by Yusuke Suzuki.

JSTests:

* stress/cant-eliminate-string-object-structure-check-when-string-object-is-proven.js: Added.
(foo):
(a.valueOf.0):

Source/JavaScriptCore:

Prior to this patch, the use kind for StringObjectUse implied that we
do a StructureCheck on the input operand for the *original* StringObject
structure. This is generally not how we use UseKinds, so it's no surprise
that this is buggy. A UseKind should map to a set of SpeculatedTypes, not an
actual set of structures. This patch changes the meaning of StringObjectUse
to mean an object where jsDynamicCast<StringObject*> would succeed.

This patch also fixes a bug that was caused by the old and weird usage of the
UseKind to mean StructureCheck. Consider a program like this:
```
S1 = Original StringObject structure
S2 = Original StringObject structure with the field "f" added

a: GetLocal()
b: CheckStructure(@a, {S2})
c: ToString(StringObject:@a)
```

According to AI, in the above program, we would exit at @c, since
StringObject:@a implies a structure check of {S1}, and the intersection
of {S1} and {S2} is {}. So, we'd convert the program to be:
```
a: GetLocal()
b: CheckStructure(@a, {S2})
c: Check(StringObject:@a)
d: Unreachable
```

However, AI would set the proof status of the StringObject:@a edge
to be proven, since the SpeculatedType for @a is SpecStringObject.
This was incorrect of AI to do because the SpeculatedType itself
didn't capture the full power of StringObjectUse. However, having
a UseKind mean CheckStructure is weird precisely because what AI was
doing is a natural fit to how we typically we think about UseKinds.

So the above program would then incorrectly be converted to this, and
we'd crash when reaching the Unreachable node:
```
a: GetLocal()
b: CheckStructure(@a, {S2})
d: Unreachable
```

This patch makes it so that StringObjectUse just means that the object that
filters through a StringObjectUse check must !!jsDynamicCast<StringObject*>.
This is now in line with all other UseKinds. It also lets us simplify a bunch
of other code that had weird checks for the StringObjectUse UseKind.

This patch also makes it so that anywhere where we used to rely on
StringObjectUse implying a structure check we actually emit an explicit
CheckStructure node.

* JavaScriptCore.xcodeproj/project.pbxproj:
* bytecode/ExitKind.cpp:
(JSC::exitKindToString):
* bytecode/ExitKind.h:
* dfg/DFGAbstractInterpreterInlines.h:
(JSC::DFG::AbstractInterpreter<AbstractStateType>::executeEffects):
* dfg/DFGCSEPhase.cpp:
* dfg/DFGClobberize.h:
(JSC::DFG::clobberize):
* dfg/DFGEdgeUsesStructure.h: Removed.
* dfg/DFGFixupPhase.cpp:
(JSC::DFG::FixupPhase::attemptToForceStringArrayModeByToStringConversion):
(JSC::DFG::FixupPhase::addCheckStructureForOriginalStringObjectUse):
(JSC::DFG::FixupPhase::fixupToPrimitive):
(JSC::DFG::FixupPhase::fixupToStringOrCallStringConstructor):
(JSC::DFG::FixupPhase::attemptToMakeFastStringAdd):
(JSC::DFG::FixupPhase::isStringObjectUse): Deleted.
* dfg/DFGGraph.cpp:
(JSC::DFG::Graph::canOptimizeStringObjectAccess):
* dfg/DFGMayExit.cpp:
* dfg/DFGSpeculativeJIT.cpp:
(JSC::DFG::SpeculativeJIT::compileToStringOrCallStringConstructorOrStringValueOf):
(JSC::DFG::SpeculativeJIT::speculateStringObject):
(JSC::DFG::SpeculativeJIT::speculateStringOrStringObject):
* dfg/DFGSpeculativeJIT.h:
(JSC::DFG::SpeculativeJIT::speculateStringObjectForStructure): Deleted.
* dfg/DFGUseKind.h:
(JSC::DFG::alreadyChecked):
(JSC::DFG::usesStructure): Deleted.
* ftl/FTLLowerDFGToB3.cpp:
(JSC::FTL::DFG::LowerDFGToB3::compileToStringOrCallStringConstructorOrStringValueOf):
(JSC::FTL::DFG::LowerDFGToB3::speculateStringObject):
(JSC::FTL::DFG::LowerDFGToB3::speculateStringOrStringObject):
(JSC::FTL::DFG::LowerDFGToB3::speculateStringObjectForCell):
(JSC::FTL::DFG::LowerDFGToB3::speculateStringObjectForStructureID): Deleted.
* runtime/JSType.cpp:
(WTF::printInternal):
* runtime/JSType.h:
* runtime/StringObject.h:
(JSC::StringObject::createStructure):
* runtime/StringPrototype.h:

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

7 months ago[JSC] Add generateHeapSnapshotForGCDebugging function to dump GCDebugging data
yusukesuzuki@slowstart.org [Thu, 17 Jan 2019 17:32:38 +0000 (17:32 +0000)]
[JSC] Add generateHeapSnapshotForGCDebugging function to dump GCDebugging data
https://bugs.webkit.org/show_bug.cgi?id=193526

Reviewed by Michael Saboff.

This patch adds generateHeapSnapshotForGCDebugging to JSC shell to dump heap snapshot JSON string with GCDebugging option.
GCDebuggingSnapshot mode is slightly different from InspectorSnapshot in terms of both the output data and the behavior.
It always takes full snapshot, and it reports internal data too. This is useful to view the live heap objects after running
the code. Also, generateHeapSnapshotForGCDebugging returns String instead of parsing it to JSObject internally by calling
JSON.parse. If we convert the String to bunch of objects by using JSON.parse, it is difficult to call generateHeapSnapshotForGCDebugging
multiple times for debugging. Currently, it only generates a large string, which is easily distinguishable in the heap inspector tool.

* jsc.cpp:
(GlobalObject::finishCreation):
(functionGenerateHeapSnapshotForGCDebugging):

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

7 months ago[EME] Remove Amazon Prime Video from quirks list
jonlee@apple.com [Thu, 17 Jan 2019 16:36:31 +0000 (16:36 +0000)]
[EME] Remove Amazon Prime Video from quirks list
https://bugs.webkit.org/show_bug.cgi?id=193514
rdar://problem/47295330

Reviewed by Jer Noble.

* page/Quirks.cpp:
(WebCore::Quirks::hasBrokenEncryptedMediaAPISupportQuirk const):

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

7 months ago[LFC][BFC] An element with transform is a containing block for positioned descendants.
zalan@apple.com [Thu, 17 Jan 2019 16:24:14 +0000 (16:24 +0000)]
[LFC][BFC] An element with transform is a containing block for positioned descendants.
https://bugs.webkit.org/show_bug.cgi?id=193534

Reviewed by Antti Koivisto.

Source/WebCore:

"For elements whose layout is governed by the CSS box model, any value other than none for the transform
property also causes the element to establish a containing block for all descendants."
https://www.w3.org/TR/css-transforms-1/

* layout/layouttree/LayoutBox.cpp:
(WebCore::Layout::Box::containingBlock const):

Tools:

* LayoutReloaded/misc/LFC-passing-tests.txt:

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

7 months agoScrollingCoordinator: separate updating node geometry from node layers
simon.fraser@apple.com [Thu, 17 Jan 2019 16:07:24 +0000 (16:07 +0000)]
ScrollingCoordinator: separate updating node geometry from node layers
https://bugs.webkit.org/show_bug.cgi?id=193527

Reviewed by Antti Koivisto.

Updating scrolling tree node layers happens in a different code path from updating geometry;
the former has to be post-flush, when GraphicsLayer has made tiled or structural layers.
Geometry only needs to be updated after layout, and soon we'll do this via compositing updates.

We can also clean up the ScrollingCoordinator API and have a single function that updates
node layers (handling different node types), and separate functions for pushing viewport-constrained
and scrolling node geometry.

No observable behavior change.

* page/scrolling/AsyncScrollingCoordinator.cpp:
(WebCore::AsyncScrollingCoordinator::setNodeLayers):
(WebCore::AsyncScrollingCoordinator::setScrollingNodeGeometry):
(WebCore::AsyncScrollingCoordinator::setViewportConstraintedNodeGeometry):
(WebCore::AsyncScrollingCoordinator::updateFrameScrollingNode): Deleted.
(WebCore::AsyncScrollingCoordinator::updateOverflowScrollingNode): Deleted.
(WebCore::AsyncScrollingCoordinator::updateNodeLayer): Deleted.
(WebCore::AsyncScrollingCoordinator::updateNodeViewportConstraints): Deleted.
* page/scrolling/AsyncScrollingCoordinator.h:
* page/scrolling/ScrollingCoordinator.h:
(WebCore::ScrollingCoordinator::setNodeLayers):
(WebCore::ScrollingCoordinator::setScrollingNodeGeometry):
(WebCore::ScrollingCoordinator::setViewportConstraintedNodeGeometry):
(WebCore::ScrollingCoordinator::updateNodeLayer): Deleted.
(WebCore::ScrollingCoordinator::updateNodeViewportConstraints): Deleted.
(WebCore::ScrollingCoordinator::updateFrameScrollingNode): Deleted.
(WebCore::ScrollingCoordinator::updateOverflowScrollingNode): Deleted.
* rendering/RenderLayerCompositor.cpp:
(WebCore::RenderLayerCompositor::updateScrollCoordinationForThisFrame):
(WebCore::RenderLayerCompositor::updateScrollCoordinatedLayer):
* rendering/RenderLayerCompositor.h:

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

7 months ago[LFC][BFC][Quirk] Take body padding and border into account when stretching height.
zalan@apple.com [Thu, 17 Jan 2019 16:06:22 +0000 (16:06 +0000)]
[LFC][BFC][Quirk] Take body padding and border into account when stretching height.
https://bugs.webkit.org/show_bug.cgi?id=193528

Reviewed by Antti Koivisto.

Source/WebCore:

* layout/blockformatting/BlockFormattingContextQuirks.cpp:
(WebCore::Layout::BlockFormattingContext::Quirks::stretchedInFlowHeight):
* layout/displaytree/DisplayBox.h:
(WebCore::Display::Box::verticalBorder const):
(WebCore::Display::Box::horizontalBorder const):
(WebCore::Display::Box::verticalPadding const):
(WebCore::Display::Box::horizontalPadding const):
* page/FrameViewLayoutContext.cpp:
(WebCore::layoutUsingFormattingContext):

Tools:

* LayoutReloaded/misc/LFC-passing-tests.txt:

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

7 months agoSource/WebCore:
zalan@apple.com [Thu, 17 Jan 2019 16:00:14 +0000 (16:00 +0000)]
Source/WebCore:
[LFC][BFC] For height computation, the bottom edge of the last line box value should not include top border/padding
https://bugs.webkit.org/show_bug.cgi?id=193520

Reviewed by Antti Koivisto.

This is similar to the other "10.6.3" cases. The bottom edge of the last inline box is in the coordinate systyem
of the containing block's border box (and for content height computation it needs to be mapped to the containing block's content box instead).

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

Tools:
[LFC][BFC] For height computation, the bottom edge of the last line box value should include top border/padding
https://bugs.webkit.org/show_bug.cgi?id=193520

Reviewed by Antti Koivisto.

* LayoutReloaded/misc/LFC-passing-tests.txt:

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

7 months ago[ews-build] unapply-patch step should not update source
aakash_jain@apple.com [Thu, 17 Jan 2019 13:52:45 +0000 (13:52 +0000)]
[ews-build] unapply-patch step should not update source
https://bugs.webkit.org/show_bug.cgi?id=193234

Reviewed by Lucas Forschler.

* BuildSlaveSupport/ews-build/steps.py:
(CleanWorkingDirectory): Use clean-webkit script to clean the working directory.
(UnApplyPatchIfRequired): Use CleanWorkingDirectory as base class.

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

7 months ago[JSC] ToThis omission in DFGByteCodeParser is wrong
yusukesuzuki@slowstart.org [Thu, 17 Jan 2019 08:10:53 +0000 (08:10 +0000)]
[JSC] ToThis omission in DFGByteCodeParser is wrong
https://bugs.webkit.org/show_bug.cgi?id=193513
<rdar://problem/45842236>

Reviewed by Saam Barati.

JSTests:

* stress/to-this-omission-with-different-strict-modes.js: Added.
(thisA):
(thisAStrictWrapper):

Source/JavaScriptCore:

DFGByteCodeParser omitted ToThis node when we have `ToThis(ToThis(value))`. This semantics is wrong if ToThis has different semantics
in the sloppy mode and the strict mode. If we convert `ToThisInSloppyMode(ToThisInStrictMode(boolean))` to `ToThisInStrictMode(boolean)`,
we get boolean instead of BooleanObject.

This optimization is introduced more than 7 years ago, and from that, we have several optimizations that can remove such ToThis nodes
in BytecodeParser, AI, and Fixup. Furthermore, this optimization is simply wrong since `toThis()` function of JSCell can be defined
as they want. Before ensuring all the toThis function is safe, we should not fold `ToThis(ToThis(value))` => `ToThis(value)`.
This patch just removes the problematic optimization. The performance numbers look neutral.

* dfg/DFGAbstractInterpreterInlines.h:
(JSC::DFG::AbstractInterpreter<AbstractStateType>::executeEffects):
* dfg/DFGByteCodeParser.cpp:
(JSC::DFG::ByteCodeParser::parseBlock):

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

7 months agoStub out scrolling tree classes for overflow scrolling nodes on macOS
simon.fraser@apple.com [Thu, 17 Jan 2019 07:46:10 +0000 (07:46 +0000)]
Stub out scrolling tree classes for overflow scrolling nodes on macOS
https://bugs.webkit.org/show_bug.cgi?id=193524

Reviewed by Antti Koivisto.

Add an empty implementation of ScrollingTreeOverflowScrollingNodeMac for macOS. Change
ScrollingTreeMac::createScrollingTreeNode() to create these nodes.

Minor refactor of RenderLayerCompositor::useCoordinatedScrollingForLayer() code to ask
the scrolling coordinator if it can coordinate scrolling for this layer; no behavior
change for existing code paths.

* SourcesCocoa.txt:
* WebCore.xcodeproj/project.pbxproj:
* page/scrolling/ScrollingCoordinator.cpp:
(WebCore::ScrollingCoordinator::coordinatesScrollingForOverflowLayer const):
* page/scrolling/ScrollingCoordinator.h:
* page/scrolling/mac/ScrollingStateFrameScrollingNodeMac.mm:
* page/scrolling/mac/ScrollingTreeMac.cpp:
(ScrollingTreeMac::createScrollingTreeNode):
* page/scrolling/mac/ScrollingTreeOverflowScrollingNodeMac.h: Copied from Source/WebCore/page/scrolling/mac/ScrollingStateFrameScrollingNodeMac.mm.
* page/scrolling/mac/ScrollingTreeOverflowScrollingNodeMac.mm: Added.
(WebCore::ScrollingTreeOverflowScrollingNodeMac::create):
(WebCore::ScrollingTreeOverflowScrollingNodeMac::ScrollingTreeOverflowScrollingNodeMac):
(WebCore::ScrollingTreeOverflowScrollingNodeMac::~ScrollingTreeOverflowScrollingNodeMac):
(WebCore::ScrollingTreeOverflowScrollingNodeMac::commitStateBeforeChildren):
(WebCore::ScrollingTreeOverflowScrollingNodeMac::commitStateAfterChildren):
(WebCore::ScrollingTreeOverflowScrollingNodeMac::updateLayersAfterAncestorChange):
(WebCore::ScrollingTreeOverflowScrollingNodeMac::scrollPosition const):
(WebCore::ScrollingTreeOverflowScrollingNodeMac::setScrollLayerPosition):
(WebCore::ScrollingTreeOverflowScrollingNodeMac::updateLayersAfterDelegatedScroll):
* rendering/RenderLayer.cpp:
(WebCore::RenderLayer::usesAsyncScrolling const):
* rendering/RenderLayerCompositor.cpp:
(WebCore::RenderLayerCompositor::useCoordinatedScrollingForLayer const):
* rendering/RenderLayerCompositor.h:

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

7 months agoAdd UI in analysis task page to show commit testability information.
dewei_zhu@apple.com [Thu, 17 Jan 2019 05:56:18 +0000 (05:56 +0000)]
Add UI in analysis task page to show commit testability information.
https://bugs.webkit.org/show_bug.cgi?id=192972

Reviewed by Ryosuke Niwa.

Add UI in custom analysis task configuration and customizable test group form to show testability information.
Fix a bug in 'CustomAnalysisTaskConfigurator._updateCommitSetMap' that 'currentComparison' is incorrectly set.
SQL to update existing database:
    ALTER TABLE commits ADD COLUMN IF NOT EXISTS commit_testability varchar(128) DEFAULT NULL;

* browser-tests/custom-analysis-task-configurator-tests.js: Added a unit test for the bug in
'CustomAnalysisTaskConfigurator._updateCommitSetMap'.
Added a unit test to make sure 'CustomAnalysisTaskConfigurator' still works when commit fetching never returns.
* browser-tests/index.html: Imported ''custom-analysis-task-configurator-tests.js'.
* init-database.sql: Increase 'commit_testability' field length from 64 characters to 128.
* public/v3/components/custom-analysis-task-configurator.js: Added UI to show testability information.
(CustomAnalysisTaskConfigurator):
(CustomAnalysisTaskConfigurator.prototype._didUpdateSelectedPlatforms): Should reset related field for corresponding
repositories that user does not specify revision.
(CustomAnalysisTaskConfigurator.prototype._updateMapFromSpecifiedRevisionsForConfiguration): A helper function
to update '_specifiedCommits' and '_invalidRevisionsByConfiguration' per '_specifiedRevisions'.
(CustomAnalysisTaskConfigurator.prototype.render):
(CustomAnalysisTaskConfigurator.prototype._updateCommitSetMap): Fixed a bug that 'currentComparison' is incorrectly set.
(CustomAnalysisTaskConfigurator.prototype._computeCommitSet):
(CustomAnalysisTaskConfigurator.prototype.async._fetchCommitsForConfiguration):
(CustomAnalysisTaskConfigurator.prototype.async._resolveRevision):
(CustomAnalysisTaskConfigurator.prototype._buildRevisionTable):
(CustomAnalysisTaskConfigurator.prototype._buildTestabilityList):
(CustomAnalysisTaskConfigurator.prototype._selectRepositoryGroup):
(CustomAnalysisTaskConfigurator.prototype._buildRevisionInput):
(CustomAnalysisTaskConfigurator.cssTemplate):
* public/v3/components/customizable-test-group-form.js: Added UI to show testability information.
(CustomizableTestGroupForm.prototype._renderCustomRevisionTable):
(CustomizableTestGroupForm.prototype._constructTestabilityRows.):
(CustomizableTestGroupForm.prototype._constructTestabilityRows):
(CustomizableTestGroupForm.prototype._constructRevisionRadioButtons):
Changing either revision editor or radio button should trigger a re-render as testability
information for updated revision may change.
(CustomizableTestGroupForm.cssTemplate):
* public/v3/models/commit-set.js:
(IntermediateCommitSet.prototype.commitsWithTestability): Renamed from 'commitsWithTestabilityWarnings'.
(IntermediateCommitSet.prototype.commitsWithTestabilityWarnings): Deleted.

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

7 months agoUnreviewed GTK and WPE test gardening.
aboya@igalia.com [Thu, 17 Jan 2019 01:37:38 +0000 (01:37 +0000)]
Unreviewed GTK and WPE test gardening.
https://bugs.webkit.org/show_bug.cgi?id=193521

* platform/gtk/TestExpectations:
* platform/gtk/imported/w3c/web-platform-tests/fetch/security/dangling-markup-mitigation-data-url.tentative.sub-expected.txt: Added.
* platform/gtk/inspector/canvas/recording-bitmaprenderer-expected.txt:
* platform/wpe/TestExpectations:
* platform/wpe/imported/w3c/web-platform-tests/fetch/security/dangling-markup-mitigation-data-url.tentative.sub-expected.txt: Added.

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

7 months ago[WebGPU] Update vertex-buffer-triangle-strip.html to actually use vertex buffer
justin_fan@apple.com [Thu, 17 Jan 2019 01:35:01 +0000 (01:35 +0000)]
[WebGPU] Update vertex-buffer-triangle-strip.html to actually use vertex buffer
https://bugs.webkit.org/show_bug.cgi?id=193473

Reviewed by Dean Jackson and Myles Maxfield.

Source/WebCore:

Also, switch to using the inputSlot instead of the shaderLocation field, as this seems more correct.
As of now I cannot determine an analog for WebGPU's shaderLocation in Metal.

Test: Covered by vertex-buffer-triangle-strip.html. No change in behavior.

* platform/graphics/gpu/cocoa/GPURenderPipelineMetal.mm:
(WebCore::setInputStateForPipelineDescriptor): Use the inputSlot instead of shaderLocation as bufferIndex.

LayoutTests:

Refactor the vertex shader to use the vertex stage input, rather than buffer resources.

* webgpu/vertex-buffer-triangle-strip.html:

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

7 months agoAdd a new SPI for controlling getUserMedia
youenn@apple.com [Thu, 17 Jan 2019 01:18:05 +0000 (01:18 +0000)]
Add a new SPI for controlling getUserMedia
https://bugs.webkit.org/show_bug.cgi?id=192793

Reviewed by Eric Carlson.

Source/WebKit:

Some weaknesses of the current getUserMedia/enumerateDevices SPI were found.
In particular:
- The hash salt should be handled by WebKit not by apps using WebKit.
- No need to expose the frame URL, only the top level origin is needed.
- The names of the callback are changed to improve the intent of these callbacks.
Addressed these by creating a new SPI which will replace the current one.
The current SPI will be removed later on.

Did some refactoring by making the callbacks not return false.
Instead, implement the default behavior inside the request objects as deny methods.
Some further refactoring will be done as a follow-up to better align the C API with the Cocoa API.

* UIProcess/API/APIUIClient.h:
(API::UIClient::decidePolicyForUserMediaPermissionRequest):
(API::UIClient::checkUserMediaPermissionForOrigin):
* UIProcess/API/C/WKPage.cpp:
(WKPageSetPageUIClient):
* UIProcess/API/Cocoa/WKUIDelegatePrivate.h:
* UIProcess/API/Cocoa/WKWebView.mm:
(-[WKWebView _mediaCaptureState]):
(-[WKWebView _setMediaCaptureMuted:]):
* UIProcess/API/Cocoa/WKWebViewPrivate.h:
* UIProcess/API/glib/WebKitUIClient.cpp:
* UIProcess/Cocoa/MediaCaptureUtilities.h: Added.
* UIProcess/Cocoa/MediaCaptureUtilities.mm: Added.
* UIProcess/Cocoa/UIDelegate.h:
* UIProcess/Cocoa/UIDelegate.mm:
(WebKit::UIDelegate::setDelegate):
(WebKit::requestUserMediaAuthorizationForFrame):
(WebKit::UIDelegate::UIClient::decidePolicyForUserMediaPermissionRequest):
(WebKit::UIDelegate::UIClient::checkUserMediaPermissionForOrigin):
(WebKit::UIDelegate::UIClient::mediaCaptureStateDidChange):
* UIProcess/UserMediaPermissionCheckProxy.h:
(WebKit::UserMediaPermissionCheckProxy::deny):
* UIProcess/UserMediaPermissionRequestManagerProxy.cpp:
(WebKit::UserMediaPermissionRequestManagerProxy::requestUserMediaPermissionForFrame):
(WebKit::UserMediaPermissionRequestManagerProxy::getUserMediaPermissionInfo):
* UIProcess/UserMediaPermissionRequestProxy.h:

Tools:

* MiniBrowser/mac/WK2BrowserWindowController.m:
(-[WK2BrowserWindowController _webView:requestUserMediaAuthorizationForFrame:devices:decisionHandler:]):
(-[WK2BrowserWindowController _webView:isMediaCaptureAuthorizedForFrame:decisionHandler:]):
* TestWebKitAPI/Tests/WebKit/GetUserMediaNavigation.mm:
(-[NavigationWhileGetUserMediaPromptDisplayedUIDelegate _webView:requestMediaCaptureAuthorizationForFrame:devices:decisionHandler:]):
* TestWebKitAPI/Tests/WebKit/GetUserMediaReprompt.mm:
(-[GetUserMediaRepromptUIDelegate _webView:requestMediaCaptureAuthorizationForFrame:devices:decisionHandler:]):
* TestWebKitAPI/Tests/WebKit/MediaStreamTrackDetached.mm:
(-[MediaStreamTrackDetachedUIDelegate _webView:requestMediaCaptureAuthorizationForFrame:devices:decisionHandler:]):
* TestWebKitAPI/Tests/WebKitCocoa/UserMediaDisabled.mm:
(-[UserMediaUIDelegate _webView:requestMediaCaptureAuthorizationForFrame:devices:decisionHandler:]):
(-[UserMediaUIDelegate _webView:isMediaCaptureAuthorizedForFrame:decisionHandler:]):
* TestWebKitAPI/Tests/WebKitCocoa/UserMediaSimulateFailedSandbox.mm:
(-[SimulateFailedSandboxUIDelegate _webView:requestMediaCaptureAuthorizationForFrame:devices:decisionHandler:]):
(-[SimulateFailedSandboxUIDelegate _webView:isMediaCaptureAuthorizedForFrame:decisionHandler:]):

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

7 months agoPipe cache quota request from Network Process to UIProcess
youenn@apple.com [Thu, 17 Jan 2019 01:16:07 +0000 (01:16 +0000)]
Pipe cache quota request from Network Process to UIProcess
https://bugs.webkit.org/show_bug.cgi?id=193296

Reviewed by Alex Christensen.

When cache storage hits quota for a given origin, pipe the request back to NetworkProcess.
No record will be put until the quota request is answered.
The request is sent from CacheStorage::Caches to CacheStorage::Engine and to NetworkProcess.
NetworkProcess then sends it to NetworkProcessProxy.
Currently NetworkProcessProxy just answers by keeping the quota as it is.
In the future, NetworkProcessProxy should make a delegate call to let the app using WebKit
make a decision on the quota. This will allow prompting user to bump it as done for other data.

* NetworkProcess/NetworkProcess.cpp:
(WebKit::NetworkProcess::requestCacheStorageSpace):
* NetworkProcess/NetworkProcess.h:
* NetworkProcess/cache/CacheStorageEngine.cpp:
(WebKit::CacheStorage::Engine::~Engine):
(WebKit::CacheStorage::Engine::from):
(WebKit::CacheStorage::Engine::Engine):
(WebKit::CacheStorage::Engine::requestSpace):
(WebKit::CacheStorage::Engine::requestSpaceCompleted):
* NetworkProcess/cache/CacheStorageEngine.h:
* NetworkProcess/cache/CacheStorageEngineCache.cpp:
(WebKit::CacheStorage::Cache::put):
(WebKit::CacheStorage::Cache::retryPuttingPendingRecords):
* NetworkProcess/cache/CacheStorageEngineCache.h:
* NetworkProcess/cache/CacheStorageEngineCaches.cpp:
(WebKit::CacheStorage::Caches::requestSpace):
(WebKit::CacheStorage::Caches::notifyCachesOfRequestSpaceEnd):
* NetworkProcess/cache/CacheStorageEngineCaches.h:
(WebKit::CacheStorage::Caches::isRequestingSpace const):
* UIProcess/Network/NetworkProcessProxy.cpp:
(WebKit::NetworkProcessProxy::requestCacheStorageSpace):
* UIProcess/Network/NetworkProcessProxy.h:
* UIProcess/Network/NetworkProcessProxy.messages.in:

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

7 months ago[WHLSL] Add the function stage checker
mmaxfield@apple.com [Thu, 17 Jan 2019 01:08:27 +0000 (01:08 +0000)]
[WHLSL] Add the function stage checker
https://bugs.webkit.org/show_bug.cgi?id=193479

Reviewed by Dean Jackson and Robin Morisset.

This is a translation of https://github.com/gpuweb/WHLSL/blob/master/Source/CheckNativeFuncStages.mjs into C++.

No new tests because it isn't hooked up yet. Not enough of the compiler exists to have any meaningful sort
of test. When enough of the compiler is present, I'll port the reference implementation's test suite.

* Modules/webgpu/WHLSL/AST/WHLSLCallExpression.h:
(WebCore::WHLSL::AST::CallExpression::function):
* Modules/webgpu/WHLSL/WHLSLFunctionStageChecker.cpp: Added.
(WebCore::WHLSL::FunctionStageChecker::FunctionStageChecker):
(WebCore::WHLSL::checkFunctionStages):
* Modules/webgpu/WHLSL/WHLSLFunctionStageChecker.h: Added.
* Modules/webgpu/WHLSL/WHLSLIntrinsics.cpp:
(WebCore::WHLSL::Intrinsics::add):
* Modules/webgpu/WHLSL/WHLSLIntrinsics.h:
(WebCore::WHLSL::Intrinsics::ddx const):
(WebCore::WHLSL::Intrinsics::ddy const):
(WebCore::WHLSL::Intrinsics::allMemoryBarrier const):
(WebCore::WHLSL::Intrinsics::deviceMemoryBarrier const):
(WebCore::WHLSL::Intrinsics::groupMemoryBarrier const):
(WebCore::WHLSL::Intrinsics::WTF_ARRAY_LENGTH):
* Sources.txt:
* WebCore.xcodeproj/project.pbxproj:

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

7 months ago[WHLSL] Delete the 'restricted' keyword
mmaxfield@apple.com [Thu, 17 Jan 2019 00:59:15 +0000 (00:59 +0000)]
[WHLSL] Delete the 'restricted' keyword
https://bugs.webkit.org/show_bug.cgi?id=193469

Reviewed by Dean Jackson and Robin Morisset.

This change mirrors https://github.com/gpuweb/WHLSL/pull/304 in the reference implementation.

No new tests because it isn't hooked up yet. Not enough of the compiler exists to have any meaningful sort
of test. When enough of the compiler is present, I'll port the reference implementation's test suite.

* Modules/webgpu/WHLSL/AST/WHLSLFunctionDefinition.h:
(WebCore::WHLSL::AST::FunctionDefinition::FunctionDefinition):
(WebCore::WHLSL::AST::FunctionDefinition::block):
(WebCore::WHLSL::AST::FunctionDefinition::restricted const): Deleted.
* Modules/webgpu/WHLSL/AST/WHLSLNativeFunctionDeclaration.h:
(WebCore::WHLSL::AST::NativeFunctionDeclaration::NativeFunctionDeclaration):
(WebCore::WHLSL::AST::NativeFunctionDeclaration::restricted const): Deleted.
* Modules/webgpu/WHLSL/WHLSLChecker.cpp:
(WebCore::WHLSL::resolveWithOperatorAnderIndexer):
(WebCore::WHLSL::resolveWithOperatorLength):
(WebCore::WHLSL::resolveWithReferenceComparator):
* Modules/webgpu/WHLSL/WHLSLResolveOverloadImpl.cpp:
(WebCore::WHLSL::resolveFunctionOverloadImpl):
* Modules/webgpu/WHLSL/WHLSLSynthesizeArrayOperatorLength.cpp:
(WebCore::WHLSL::synthesizeArrayOperatorLength):
* Modules/webgpu/WHLSL/WHLSLSynthesizeConstructors.cpp:
(WebCore::WHLSL::synthesizeConstructors):
* Modules/webgpu/WHLSL/WHLSLSynthesizeEnumerationFunctions.cpp:
(WebCore::WHLSL::synthesizeEnumerationFunctions):
* Modules/webgpu/WHLSL/WHLSLSynthesizeStructureAccessors.cpp:
(WebCore::WHLSL::synthesizeStructureAccessors):

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

7 months ago[WHLSL] Implement the recursion checker
mmaxfield@apple.com [Thu, 17 Jan 2019 00:53:40 +0000 (00:53 +0000)]
[WHLSL] Implement the recursion checker
https://bugs.webkit.org/show_bug.cgi?id=193436

Reviewed by Saam Barati.

This is a translation of https://github.com/gpuweb/WHLSL/blob/master/Source/RecursionChecker.mjs into C++.

No new tests because it isn't hooked up yet. Not enough of the compiler exists to have any meaningful sort
of test. When enough of the compiler is present, I'll port the reference implementation's test suite.

* Modules/webgpu/WHLSL/AST/WHLSLCallExpression.h:
(WebCore::WHLSL::AST::CallExpression::function):
* Modules/webgpu/WHLSL/WHLSLRecursionChecker.cpp: Copied from Source/WebCore/Modules/webgpu/WHLSL/WHLSLRecursiveTypeChecker.cpp.
(WebCore::WHLSL::checkRecursion):
* Modules/webgpu/WHLSL/WHLSLRecursionChecker.h: Added.
* Modules/webgpu/WHLSL/WHLSLRecursiveTypeChecker.cpp:
* Sources.txt:
* WebCore.xcodeproj/project.pbxproj:

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

7 months ago[WHLSL] Add the literal type checker
mmaxfield@apple.com [Thu, 17 Jan 2019 00:31:20 +0000 (00:31 +0000)]
[WHLSL] Add the literal type checker
https://bugs.webkit.org/show_bug.cgi?id=193430

Reviewed by Dean Jackson.

This is a translation of https://github.com/gpuweb/WHLSL/blob/master/Source/LiteralTypeChecker.mjs into C++.

No new tests because it isn't hooked up yet. Not enough of the compiler exists to have any meaningful sort
of test. When enough of the compiler is present, I'll port the reference implementation's test suite.

* Modules/webgpu/WHLSL/AST/WHLSLFloatLiteralType.h:
(WebCore::WHLSL::AST::FloatLiteralType::value const):
* Modules/webgpu/WHLSL/AST/WHLSLIntegerLiteralType.h:
(WebCore::WHLSL::AST::IntegerLiteralType::value const):
* Modules/webgpu/WHLSL/AST/WHLSLUnsignedIntegerLiteralType.h:
(WebCore::WHLSL::AST::UnsignedIntegerLiteralType::value const):
* Modules/webgpu/WHLSL/WHLSLLiteralTypeChecker.cpp: Added.
(WebCore::WHLSL::getNativeTypeDeclaration):
(WebCore::WHLSL::LiteralTypeChecker::visit):
(WebCore::WHLSL::checkLiteralTypes):
* Modules/webgpu/WHLSL/WHLSLLiteralTypeChecker.h: Copied from Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLFloatLiteralType.h.
* Sources.txt:
* WebCore.xcodeproj/project.pbxproj:

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

7 months agosendBeacon to previously-unvisited https domain always fails
achristensen@apple.com [Thu, 17 Jan 2019 00:20:11 +0000 (00:20 +0000)]
sendBeacon to previously-unvisited https domain always fails
https://bugs.webkit.org/show_bug.cgi?id=193508

Reviewed by Geoffrey Garen.

* NetworkProcess/PingLoad.cpp:
(WebKit::PingLoad::didReceiveChallenge):
If a ping load is doing a TLS handshake, continue if the server has good certificates.

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

7 months ago[LFC][BFC] Inflow non-replaced used width should not be negative.
zalan@apple.com [Thu, 17 Jan 2019 00:17:58 +0000 (00:17 +0000)]
[LFC][BFC] Inflow non-replaced used width should not be negative.
https://bugs.webkit.org/show_bug.cgi?id=193495

Reviewed by Antti Koivisto.

Source/WebCore:

min-width (initial value 0) enforces non-negative used width.

* layout/blockformatting/BlockFormattingContext.cpp:
(WebCore::Layout::BlockFormattingContext::computeWidthAndMargin const):

Tools:

* LayoutReloaded/misc/LFC-passing-tests.txt:

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

7 months ago[WHLSL] Add a handwritten parser
mmaxfield@apple.com [Thu, 17 Jan 2019 00:14:38 +0000 (00:14 +0000)]
[WHLSL] Add a handwritten parser
https://bugs.webkit.org/show_bug.cgi?id=192355

Reviewed by Dean Jackson.

The parser is a mechanical representation of WHLSL's ANTLR grammar at
https://github.com/gpuweb/WHLSL/blob/master/Spec/WHLSL.g4. The parser
uses Expected<> to return an appropriate Error string when parsing fails.

This patch doesn't include the AST nodes themselves - those are in
https://bugs.webkit.org/show_bug.cgi?id=192991. I split up the patch to
aid easier reviewing.

No new tests because the parser isn't hooked up yet.

* Modules/webgpu/WHLSL/WHLSLParser.cpp:
(WebCore::WHLSL::Parser::Parser):
(WebCore::WHLSL::Parser::parse):
(WebCore::WHLSL::Parser::fail):
(WebCore::WHLSL::Parser::peek):
(WebCore::WHLSL::Parser::tryType):
(WebCore::WHLSL::Parser::tryTypes):
(WebCore::WHLSL::Parser::consumeType):
(WebCore::WHLSL::Parser::consumeTypes):
(WebCore::WHLSL::digitValue):
(WebCore::WHLSL::intLiteralToInt):
(WebCore::WHLSL::uintLiteralToUint):
(WebCore::WHLSL::floatLiteralToFloat):
(WebCore::WHLSL::Parser::consumeIntegralLiteral):
(WebCore::WHLSL::Parser::consumeNonNegativeIntegralLiteral):
(WebCore::WHLSL::recognizeSimpleUnsignedInteger):
(WebCore::WHLSL::Parser::parseConstantExpression):
(WebCore::WHLSL::Parser::parseTypeArgument):
(WebCore::WHLSL::Parser::parseTypeArguments):
(WebCore::WHLSL::Parser::parseTypeSuffixAbbreviated):
(WebCore::WHLSL::Parser::parseTypeSuffixNonAbbreviated):
(WebCore::WHLSL::Parser::parseAddressSpaceType):
(WebCore::WHLSL::Parser::parseNonAddressSpaceType):
(WebCore::WHLSL::Parser::parseType):
(WebCore::WHLSL::Parser::parseTypeDefinition):
(WebCore::WHLSL::Parser::parseBuiltInSemantic):
(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::parseEntryPointFunctionDeclaration):
(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::parseEffectfulPrefix):
(WebCore::WHLSL::Parser::parseEffectfulSuffix):
(WebCore::WHLSL::Parser::parseLimitedSuffixOperator):
(WebCore::WHLSL::Parser::parseSuffixOperator):
(WebCore::WHLSL::Parser::parseExpression):
(WebCore::WHLSL::Parser::parseTernaryConditional):
(WebCore::WHLSL::Parser::parseAssignment):
(WebCore::WHLSL::Parser::parsePossibleTernaryConditional):
(WebCore::WHLSL::Parser::parsePossibleLogicalBinaryOperation):
(WebCore::WHLSL::Parser::parsePossibleRelationalBinaryOperation):
(WebCore::WHLSL::Parser::parsePossibleShift):
(WebCore::WHLSL::Parser::parsePossibleAdd):
(WebCore::WHLSL::Parser::parsePossibleMultiply):
(WebCore::WHLSL::Parser::parsePossiblePrefix):
(WebCore::WHLSL::Parser::parsePossibleSuffix):
(WebCore::WHLSL::Parser::parseCallExpression):
(WebCore::WHLSL::Parser::parseTerm):
* Modules/webgpu/WHLSL/WHLSLParser.h:
(WebCore::WHLSL::Parser::Error::Error):
(WebCore::WHLSL::Parser::backtrackingScope):
(WebCore::WHLSL::Parser::SuffixExpression::SuffixExpression):
(WebCore::WHLSL::Parser::SuffixExpression::operator bool const):

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

7 months agoIndexedDB: UniqueIDBDatabase should not be freed if the database task queue is not...
sihui_liu@apple.com [Wed, 16 Jan 2019 23:52:36 +0000 (23:52 +0000)]
IndexedDB: UniqueIDBDatabase should not be freed if the database task queue is not empty.
https://bugs.webkit.org/show_bug.cgi?id=193093

Reviewed by Brady Eidson.

performUnconditionalDeleteBackingStore killed the database task queue immediately, but performPrefetchCursor
task may be scheduled behind performUnconditionalDeleteBackingStore on database thread.

* Modules/indexeddb/server/UniqueIDBDatabase.cpp:
(WebCore::IDBServer::UniqueIDBDatabase::shutdownForClose):
(WebCore::IDBServer::UniqueIDBDatabase::performPrefetchCursor):
(WebCore::IDBServer::UniqueIDBDatabase::isDoneWithHardClose):

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

7 months agoASSERTION FAILED: m_networkLoadInformationByID.contains(identifier) in WebKit::Networ...
youenn@apple.com [Wed, 16 Jan 2019 23:50:26 +0000 (23:50 +0000)]
ASSERTION FAILED: m_networkLoadInformationByID.contains(identifier) in WebKit::NetworkConnectionToWebProcess::addNetworkLoadInformationMetrics
https://bugs.webkit.org/show_bug.cgi?id=189097
<rdar://problem/43856423>

Reviewed by Alex Christensen.

In case where the inspector is launched, it will instruct the NetworkConnectionToWebProcess to start capturing network metrics.
If this happens in the middle of a load, addNetworkLoadInformationMetrics might fail since addNetworkLoadInformation will not be called.
To fix this issue, store whether to capture metrics at NetworkResourceLoader level.

To ensure that the case of switching back and forth capture of metrics, disable loader capture of metrics whenver NetworkConnectionToWebProcess is asked to.

* NetworkProcess/NetworkConnectionToWebProcess.cpp:
(WebKit::NetworkConnectionToWebProcess::setCaptureExtraNetworkLoadMetricsEnabled):
* NetworkProcess/NetworkConnectionToWebProcess.h:
(WebKit::NetworkConnectionToWebProcess::addNetworkLoadInformationMetrics):
* NetworkProcess/NetworkResourceLoader.cpp:
(WebKit::m_shouldCaptureExtraNetworkLoadMetrics):
(WebKit::NetworkResourceLoader::shouldCaptureExtraNetworkLoadMetrics const):
* NetworkProcess/NetworkResourceLoader.h:

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

7 months agoRevert r239938
achristensen@apple.com [Wed, 16 Jan 2019 23:32:34 +0000 (23:32 +0000)]
Revert r239938
https://bugs.webkit.org/show_bug.cgi?id=193267
<rdar://problem/47297304>

* Configurations/WebContent-iOS.entitlements:

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

7 months agoRegression(r240046) Several API tests are crashing
cdumez@apple.com [Wed, 16 Jan 2019 23:17:02 +0000 (23:17 +0000)]
Regression(r240046) Several API tests are crashing
https://bugs.webkit.org/show_bug.cgi?id=193509

Reviewed by Geoffrey Garen.

The crashes would happen because loadRequestShared() would take a WebProcessProxy& in parameter but
then call reattachToWebProcess() if the page is not valid, which would replace m_process and invalidate
our process reference.

To address the issue, move the reattachToWebProcess() call to loadRequest(), before calling
loadRequestShared(). Also, update *Shared() methods to take a Ref<WebProcessProxy>&& instead
of a WebProcessProxy& in parameter. Since we call client delegates, we need to make sure
our process stays alive.

* UIProcess/ProvisionalPageProxy.cpp:
(WebKit::ProvisionalPageProxy::loadData):
(WebKit::ProvisionalPageProxy::loadRequest):
(WebKit::ProvisionalPageProxy::didCreateMainFrame):
(WebKit::ProvisionalPageProxy::didPerformClientRedirect):
(WebKit::ProvisionalPageProxy::didStartProvisionalLoadForFrame):
(WebKit::ProvisionalPageProxy::didFailProvisionalLoadForFrame):
(WebKit::ProvisionalPageProxy::didNavigateWithNavigationData):
(WebKit::ProvisionalPageProxy::didChangeProvisionalURLForFrame):
(WebKit::ProvisionalPageProxy::decidePolicyForNavigationActionAsync):
(WebKit::ProvisionalPageProxy::decidePolicyForResponse):
(WebKit::ProvisionalPageProxy::startURLSchemeTask):
(WebKit::ProvisionalPageProxy::backForwardGoToItem):
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::loadRequest):
(WebKit::WebPageProxy::loadRequestWithNavigationShared):
(WebKit::WebPageProxy::loadData):
(WebKit::WebPageProxy::loadDataWithNavigationShared):
(WebKit::WebPageProxy::didPerformDragControllerAction):
(WebKit::WebPageProxy::findPlugin):
(WebKit::WebPageProxy::didCreateMainFrame):
(WebKit::WebPageProxy::didCreateSubframe):
(WebKit::WebPageProxy::didStartProvisionalLoadForFrame):
(WebKit::WebPageProxy::didStartProvisionalLoadForFrameShared):
(WebKit::WebPageProxy::didReceiveServerRedirectForProvisionalLoadForFrame):
(WebKit::WebPageProxy::didReceiveServerRedirectForProvisionalLoadForFrameShared):
(WebKit::WebPageProxy::willPerformClientRedirectForFrame):
(WebKit::WebPageProxy::didCancelClientRedirectForFrame):
(WebKit::WebPageProxy::didChangeProvisionalURLForFrame):
(WebKit::WebPageProxy::didChangeProvisionalURLForFrameShared):
(WebKit::WebPageProxy::didFailProvisionalLoadForFrame):
(WebKit::WebPageProxy::didFailProvisionalLoadForFrameShared):
(WebKit::WebPageProxy::didCommitLoadForFrame):
(WebKit::WebPageProxy::didFinishDocumentLoadForFrame):
(WebKit::WebPageProxy::didFinishLoadForFrame):
(WebKit::WebPageProxy::didFailLoadForFrame):
(WebKit::WebPageProxy::didSameDocumentNavigationForFrame):
(WebKit::WebPageProxy::didReceiveTitleForFrame):
(WebKit::WebPageProxy::didFirstVisuallyNonEmptyLayoutForFrame):
(WebKit::WebPageProxy::didDisplayInsecureContentForFrame):
(WebKit::WebPageProxy::didRunInsecureContentForFrame):
(WebKit::WebPageProxy::frameDidBecomeFrameSet):
(WebKit::WebPageProxy::decidePolicyForNavigationActionAsync):
(WebKit::WebPageProxy::decidePolicyForNavigationActionAsyncShared):
(WebKit::WebPageProxy::decidePolicyForNavigationAction):
(WebKit::WebPageProxy::decidePolicyForNavigationActionSync):
(WebKit::WebPageProxy::decidePolicyForNewWindowAction):
(WebKit::WebPageProxy::decidePolicyForResponse):
(WebKit::WebPageProxy::decidePolicyForResponseShared):
(WebKit::WebPageProxy::unableToImplementPolicy):
(WebKit::WebPageProxy::willSubmitForm):
(WebKit::WebPageProxy::didNavigateWithNavigationData):
(WebKit::WebPageProxy::didNavigateWithNavigationDataShared):
(WebKit::WebPageProxy::didPerformClientRedirect):
(WebKit::WebPageProxy::didPerformClientRedirectShared):
(WebKit::WebPageProxy::didPerformServerRedirect):
(WebKit::WebPageProxy::didUpdateHistoryTitle):
(WebKit::WebPageProxy::createNewPage):
(WebKit::WebPageProxy::runJavaScriptAlert):
(WebKit::WebPageProxy::runJavaScriptConfirm):
(WebKit::WebPageProxy::runJavaScriptPrompt):
(WebKit::WebPageProxy::unavailablePluginButtonClicked):
(WebKit::WebPageProxy::runBeforeUnloadConfirmPanel):
(WebKit::WebPageProxy::runOpenPanel):
(WebKit::WebPageProxy::printFrame):
(WebKit::WebPageProxy::backForwardGoToItem):
(WebKit::WebPageProxy::backForwardGoToItemShared):
(WebKit::WebPageProxy::learnWord):
(WebKit::WebPageProxy::ignoreWord):
(WebKit::WebPageProxy::didReceiveEvent):
(WebKit::WebPageProxy::editingRangeCallback):
(WebKit::WebPageProxy::rectForCharacterRangeCallback):
(WebKit::WebPageProxy::focusedFrameChanged):
(WebKit::WebPageProxy::frameSetLargestFrameChanged):
(WebKit::WebPageProxy::exceededDatabaseQuota):
(WebKit::WebPageProxy::requestGeolocationPermissionForFrame):
(WebKit::WebPageProxy::requestUserMediaPermissionForFrame):
(WebKit::WebPageProxy::enumerateMediaDevicesForFrame):
(WebKit::WebPageProxy::startURLSchemeTask):
(WebKit::WebPageProxy::startURLSchemeTaskShared):
(WebKit::WebPageProxy::stopURLSchemeTask):
(WebKit::WebPageProxy::loadSynchronousURLSchemeTask):
* UIProcess/WebPageProxy.h:

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

7 months agoInternal build fix.
achristensen@apple.com [Wed, 16 Jan 2019 22:52:00 +0000 (22:52 +0000)]
Internal build fix.

* platform/graphics/ca/cocoa/PlatformCALayerCocoa.mm:
(WebCore::layerContentsFormat):

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

7 months agoclang-tidy: Fix unnecessary copy/ref churn of for loop variables in libwebrtc
ddkilzer@apple.com [Wed, 16 Jan 2019 22:44:54 +0000 (22:44 +0000)]
clang-tidy: Fix unnecessary copy/ref churn of for loop variables in libwebrtc
<https://webkit.org/b/193498>

Reviewed by Youenn Fablet.

Fix unwanted copying/ref churn of loop variables by making them
const references.

* Source/webrtc/modules/bitrate_controller/loss_based_bandwidth_estimation.cc:
* Source/webrtc/modules/rtp_rtcp/source/rtcp_receiver.cc:
* Source/webrtc/p2p/base/mdns_message.cc:
* Source/webrtc/p2p/base/port.cc:
* Source/webrtc/p2p/base/stunrequest.cc:
* Source/webrtc/pc/jseptransportcontroller.cc:
* Source/webrtc/pc/peerconnection.cc:
* Source/webrtc/pc/rtcstatscollector.cc:
* Source/webrtc/pc/rtpreceiver.cc:
* Source/webrtc/pc/rtptransceiver.cc:
* Source/webrtc/pc/statscollector.cc:
* Source/webrtc/pc/trackmediainfomap.cc:
* Source/webrtc/rtc_base/filerotatingstream.cc:
* Source/webrtc/rtc_base/opensslsessioncache.cc:
* Source/webrtc/video/receive_statistics_proxy.cc:
* WebKit/0002-libwebrtc-fix-unnecessary-copy-of-for-loop-variables.diff: Added.

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

7 months agoWeb Inspector: Fix TreeOutline TypeError:​ this._indexesForSubtree is not a function
mattbaker@apple.com [Wed, 16 Jan 2019 22:04:35 +0000 (22:04 +0000)]
Web Inspector: Fix TreeOutline TypeError:​ this._indexesForSubtree is not a function
https://bugs.webkit.org/show_bug.cgi?id=193501
<rdar://problem/47323967>

Reviewed by Joseph Pecoraro.

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

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

7 months agoUnreviewed build fix.
timothy_horton@apple.com [Wed, 16 Jan 2019 21:06:45 +0000 (21:06 +0000)]
Unreviewed build fix.

* pal/spi/ios/UIKitSPI.h:
I don't even.

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

7 months agoServiceWorkerContainer is leaking due to a ref cycle
youenn@apple.com [Wed, 16 Jan 2019 20:51:19 +0000 (20:51 +0000)]
ServiceWorkerContainer is leaking due to a ref cycle
https://bugs.webkit.org/show_bug.cgi?id=193462
<rdar://problem/47026303>

Reviewed by Brady Eidson.

ServiceWorkerContainer keeps a reference to its ready promise.
The ready promise keeps a ref to its value which is a ServiceWorkerRegistration.
ServiceWorkerRegistration keeps a ref to ServiceWorkerContainer.

To break the reference cycle, set the ready promise to zero when ServiceWorkerContainer is stopped.

Covered by imported/w3c/web-platform-tests/service-workers/service-worker/ready.https.html no longer leaking.

* workers/service/ServiceWorkerContainer.cpp:
(WebCore::ServiceWorkerContainer::stop):

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

7 months agoBuild fix for iOSMac Reveal
megan_gardner@apple.com [Wed, 16 Jan 2019 20:48:48 +0000 (20:48 +0000)]
Build fix for iOSMac Reveal
https://bugs.webkit.org/show_bug.cgi?id=193503

Unreviewed build fix.

* pal/spi/ios/UIKitSPI.h:

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

7 months agoMake didCommitChangesForLayer() explicitly about the platform layer changing because...
simon.fraser@apple.com [Wed, 16 Jan 2019 20:40:59 +0000 (20:40 +0000)]
Make didCommitChangesForLayer() explicitly about the platform layer changing because of tile/non-tile swapping
https://bugs.webkit.org/show_bug.cgi?id=193290

Reviewed by Tim Horton.

RenderLayerCompositor::didFlushChangesForLayer() triggers updates scrolling tree nodes for
the flushed layer, but it's not clear what has changed at this point.

didCommitChangesForLayer()/didFlushChangesForLayer() were added to explicitly handle the
case where the underlying platform layer for a GraphicsLayer changes because the layer swaps
between tiled and non-tiled, and structural layer changes; we need to push the new layer to
the scrolling tree because it operates on platform layers. So the only work that
didFlushChangesForLayer() should do is to update layers on scrolling tree nodes; it doesn't
need to do any geometry updating. Move towards that goal by renaming this callback to
didChangePlatformLayerForLayer() to make its function more explicit.

* platform/graphics/GraphicsLayerClient.h:
(WebCore::GraphicsLayerClient::didChangePlatformLayerForLayer):
(WebCore::GraphicsLayerClient::didCommitChangesForLayer const): Deleted.
* platform/graphics/ca/GraphicsLayerCA.cpp:
(WebCore::GraphicsLayerCA::flushCompositingStateForThisLayerOnly):
(WebCore::GraphicsLayerCA::recursiveCommitChanges):
(WebCore::GraphicsLayerCA::commitLayerChangesBeforeSublayers):
* platform/graphics/ca/GraphicsLayerCA.h:
* rendering/RenderLayerBacking.cpp:
(WebCore::RenderLayerBacking::didChangePlatformLayerForLayer):
(WebCore::RenderLayerBacking::didCommitChangesForLayer const): Deleted.
* rendering/RenderLayerBacking.h:
* rendering/RenderLayerCompositor.cpp:
(WebCore::RenderLayerCompositor::didChangePlatformLayerForLayer):
(WebCore::LegacyWebKitScrollingLayerCoordinator::didChangePlatformLayerForLayer):
(WebCore::RenderLayerCompositor::didFlushChangesForLayer): Deleted.
(WebCore::RenderLayerCompositor::didCommitChangesForLayer const): Deleted.
(WebCore::LegacyWebKitScrollingLayerCoordinator::didFlushChangesForLayer): Deleted.
* rendering/RenderLayerCompositor.h:

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

7 months agoRegression(PSON) View becomes blank after click a cross-site download link
cdumez@apple.com [Wed, 16 Jan 2019 20:40:02 +0000 (20:40 +0000)]
Regression(PSON) View becomes blank after click a cross-site download link
https://bugs.webkit.org/show_bug.cgi?id=193361
<rdar://problem/47099573>

Reviewed by Geoffrey Garen.

Source/WebCore:

* loader/FrameLoader.cpp:
(WebCore::FrameLoader::commitProvisionalLoad):
When restoring from PageCache, make sure we notify the client that the load was committed
*before* we tell it that the navigation is complete. This would confuse the ProvisionalPageProxy
logic in the UIProcess.

Source/WebKit:

The issue tracked by rdar://problem/47099573 is that a provisional load may get
canceled (or converted into a download) *after* we've decided to process-swap.
In such cases, the view should keep displaying the current site and it should
still be interactive. However, with the previous PSON model, the view (pageProxy)
would have already swapped to the new process and would end up displaying the
initially empty document.

To address the issue, this patch introduces the concept of a provisional load
in the UIProcess, handled by a ProvisionalPageProxy which has its own privisional
process. The WebPageProxy owns the ProvisionalPageProxy but we do not commit the
provisional page until after the load was committed in the new process. This means
that the view / WebPageProxy keeps using the old process and displays the current
content until a load has committed in the provisional page. If no load commits
in the provisional process (e.g. because the load is cancelled or converted into
a download), then we merely destroy the ProvisionalPageProxy and terminate its
process, without impacting the WebPageProxy.

* Shared/WebPageCreationParameters.cpp:
(WebKit::WebPageCreationParameters::encode const):
(WebKit::WebPageCreationParameters::decode):
* Shared/WebPageCreationParameters.h:
Rename isSwapFromSuspended to isProcessSwap for clarity as we always want to
delay attaching the drawing area in case of a process-swap, no matter what
now that the previous process is kept alive until the provisional load is
committed in the new process.

* Shared/WebPolicyAction.h:
Drop Suspend policy action. At decidePolicyForNavigationAction time, in case of
process-swap, we now tell the previous process to simply ignore the load, while
we create a ProvisionalPageProxy to do the new load in a new process.
Suspension of the previous page in the old process, happens later, when a load
is actually committed in the new process.

* Sources.txt:
Add new ProvisionalPageProxy file.

* UIProcess/API/Cocoa/WKWebView.mm:
(-[WKWebView _killWebContentProcessAndResetState]):
When calling _killWebContentProcessAndResetState on a WKWebView, kill both the current
process and the provisional one, to maintain previous behavior in our API tests.

* UIProcess/API/gtk/PageClientImpl.cpp:
(WebKit::PageClientImpl::createDrawingAreaProxy):
* UIProcess/API/gtk/PageClientImpl.h:
* UIProcess/API/wpe/PageClientImpl.cpp:
(WebKit::PageClientImpl::createDrawingAreaProxy):
* UIProcess/API/wpe/PageClientImpl.h:
* UIProcess/AcceleratedDrawingAreaProxy.cpp:
(WebKit::AcceleratedDrawingAreaProxy::AcceleratedDrawingAreaProxy):
(WebKit::AcceleratedDrawingAreaProxy::didUpdateBackingStoreState):
(WebKit::AcceleratedDrawingAreaProxy::sendUpdateBackingStoreState):
(WebKit::AcceleratedDrawingAreaProxy::waitForAndDispatchDidUpdateBackingStoreState):
(WebKit::AcceleratedDrawingAreaProxy::setNativeSurfaceHandleForCompositing):
(WebKit::AcceleratedDrawingAreaProxy::destroyNativeSurfaceHandleForCompositing):
* UIProcess/AcceleratedDrawingAreaProxy.h:
* UIProcess/Cocoa/WebViewImpl.h:
* UIProcess/Cocoa/WebViewImpl.mm:
(WebKit::WebViewImpl::createDrawingAreaProxy):
* UIProcess/DrawingAreaProxy.cpp:
(WebKit::DrawingAreaProxy::DrawingAreaProxy):
(WebKit::DrawingAreaProxy::~DrawingAreaProxy):
(WebKit::DrawingAreaProxy::viewExposedRectChangedTimerFired):
* UIProcess/DrawingAreaProxy.h:
(WebKit::DrawingAreaProxy::process):
* UIProcess/DrawingAreaProxyImpl.cpp:
(WebKit::DrawingAreaProxyImpl::DrawingAreaProxyImpl):
(WebKit::DrawingAreaProxyImpl::update):
* UIProcess/DrawingAreaProxyImpl.h:
* UIProcess/PageClient.h:
* UIProcess/RemoteLayerTree/RemoteLayerTreeDrawingAreaProxy.h:
* UIProcess/RemoteLayerTree/RemoteLayerTreeDrawingAreaProxy.mm:
(WebKit::RemoteLayerTreeDrawingAreaProxy::RemoteLayerTreeDrawingAreaProxy):
(WebKit::RemoteLayerTreeDrawingAreaProxy::~RemoteLayerTreeDrawingAreaProxy):
(WebKit::RemoteLayerTreeDrawingAreaProxy::deviceScaleFactorDidChange):
(WebKit::RemoteLayerTreeDrawingAreaProxy::sendUpdateGeometry):
(WebKit::RemoteLayerTreeDrawingAreaProxy::acceleratedAnimationDidStart):
(WebKit::RemoteLayerTreeDrawingAreaProxy::acceleratedAnimationDidEnd):
(WebKit::RemoteLayerTreeDrawingAreaProxy::didRefreshDisplay):
(WebKit::RemoteLayerTreeDrawingAreaProxy::waitForDidUpdateActivityState):
(WebKit::RemoteLayerTreeDrawingAreaProxy::dispatchAfterEnsuringDrawing):
* UIProcess/ios/PageClientImplIOS.h:
* UIProcess/ios/PageClientImplIOS.mm:
(WebKit::PageClientImpl::createDrawingAreaProxy):
* UIProcess/ios/WKContentView.h:
* UIProcess/ios/WKContentView.mm:
(-[WKContentView _createDrawingAreaProxy:]):
* UIProcess/mac/PageClientImplMac.h:
* UIProcess/mac/PageClientImplMac.mm:
(WebKit::PageClientImpl::createDrawingAreaProxy):
* UIProcess/mac/TiledCoreAnimationDrawingAreaProxy.h:
* UIProcess/mac/TiledCoreAnimationDrawingAreaProxy.mm:
(WebKit::TiledCoreAnimationDrawingAreaProxy::TiledCoreAnimationDrawingAreaProxy):
(WebKit::TiledCoreAnimationDrawingAreaProxy::deviceScaleFactorDidChange):
(WebKit::TiledCoreAnimationDrawingAreaProxy::colorSpaceDidChange):
(WebKit::TiledCoreAnimationDrawingAreaProxy::waitForDidUpdateActivityState):
(WebKit::TiledCoreAnimationDrawingAreaProxy::createFence):
(WebKit::TiledCoreAnimationDrawingAreaProxy::sendUpdateGeometry):
(WebKit::TiledCoreAnimationDrawingAreaProxy::adjustTransientZoom):
(WebKit::TiledCoreAnimationDrawingAreaProxy::commitTransientZoom):
(WebKit::TiledCoreAnimationDrawingAreaProxy::dispatchAfterEnsuringDrawing):
* UIProcess/mac/WebPageProxyMac.mm:
* UIProcess/win/PageClientImpl.cpp:
(WebKit::PageClientImpl::createDrawingAreaProxy):
* UIProcess/win/PageClientImpl.h:
* UIProcess/win/PageClientImpl.cpp:
(WebKit::PageClientImpl::createDrawingAreaProxy):
* UIProcess/win/PageClientImpl.h:
* WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm:
(WebKit::TiledCoreAnimationDrawingArea::TiledCoreAnimationDrawingArea):
Pass the drawing area's associated process when constructing it and store it as a member
in addition to the page. This is necessary now that a page can be associated with 2
WebProcesses at a time, each having its own drawing area.

* UIProcess/Cocoa/WebPageProxyCocoa.mm:
(WebKit::WebPageProxy::createSandboxExtensionsIfNeeded):
Pass the process.

* UIProcess/ProvisionalPageProxy.cpp: Added.
(WebKit::ProvisionalPageProxy::ProvisionalPageProxy):
(WebKit::ProvisionalPageProxy::~ProvisionalPageProxy):
(WebKit::ProvisionalPageProxy::processDidTerminate):
(WebKit::ProvisionalPageProxy::takeDrawingArea):
(WebKit::ProvisionalPageProxy::cancel):
(WebKit::ProvisionalPageProxy::processDidFinishLaunching):
(WebKit::ProvisionalPageProxy::finishInitializingWebPageAfterProcessLaunch):
(WebKit::ProvisionalPageProxy::initializeWebPage):
(WebKit::ProvisionalPageProxy::loadData):
(WebKit::ProvisionalPageProxy::loadRequest):
(WebKit::ProvisionalPageProxy::goToBackForwardItem):
(WebKit::ProvisionalPageProxy::didCreateMainFrame):
(WebKit::ProvisionalPageProxy::didPerformClientRedirect):
(WebKit::ProvisionalPageProxy::didStartProvisionalLoadForFrame):
(WebKit::ProvisionalPageProxy::didFailProvisionalLoadForFrame):
(WebKit::ProvisionalPageProxy::didCommitLoadForFrame):
(WebKit::ProvisionalPageProxy::didNavigateWithNavigationData):
(WebKit::ProvisionalPageProxy::didChangeProvisionalURLForFrame):
(WebKit::ProvisionalPageProxy::decidePolicyForNavigationActionAsync):
(WebKit::ProvisionalPageProxy::decidePolicyForResponse):
(WebKit::ProvisionalPageProxy::startURLSchemeTask):
(WebKit::ProvisionalPageProxy::backForwardGoToItem):
(WebKit::ProvisionalPageProxy::didReceiveMessage):
(WebKit::ProvisionalPageProxy::didReceiveSyncMessage):
* UIProcess/ProvisionalPageProxy.h: Added.
(WebKit::ProvisionalPageProxy::page):
(WebKit::ProvisionalPageProxy::mainFrame const):
(WebKit::ProvisionalPageProxy::process):
(WebKit::ProvisionalPageProxy::processSwapRequestedByClient const):
(WebKit::ProvisionalPageProxy::navigationID const):
(WebKit::ProvisionalPageProxy::drawingArea const):
New WebPageProxy-like class which is owned by the WebPageProxy and proxies IPC from
the provisional process.

* UIProcess/SuspendedPageProxy.cpp:
(WebKit::SuspendedPageProxy::~SuspendedPageProxy):
(WebKit::SuspendedPageProxy::unsuspend):
(WebKit::SuspendedPageProxy::didProcessRequestToSuspend):
Unregister the SuspendedPageProxy as an IPC message receiver a little bit earlier
when we're going to unsuspend it. This avoids conflicting with the ProvisionalPageProxy
which tries to register itself as an IPC message receiver for the same pageID when
a process-swap occurs and we're switching to a suspended page.

* UIProcess/WebFrameProxy.cpp:
(WebKit::WebFrameProxy::isMainFrame const):
WebFrameProxy::isMainFrame() relies on checking that the frame is the WebPageProxy's m_mainFrame.
Now that the WebPageProxy can have a ProvisionalPageProxy, also check if it is the ProvisionalPageProxy's
m_mainFrame to maintain previous behavior.

* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::provisionalDrawingArea const):
Add getter for the provisional drawing area. We normally only deal with the page's current drawing area, but
the ViewGestureController needs access to the provisional once to display the swipe gesture snapshot.

(WebKit::WebPageProxy::swapToWebProcess):
swapToWebProcess() no longer takes care of unsuspending the SuspendedPage because we now call swapToWebProcess()
later, when a load is actually committed in the provisional page / process. swapToWebProcess() now also needs
to initialize some data members such as the drawing area and the main frame as it is transferring them over from
the ProvisionalPageProxy which started the provisional load.

(WebKit::WebPageProxy::finishAttachingToWebProcess):
We no longer need IsSwapFromSuspended parameter as this is called later now, after a load has actually been
committed in the provisional process.

(WebKit::WebPageProxy::setDrawingArea):
(WebKit::WebPageProxy::initializeWebPage):
- We no longer need IsSwapFromSuspended parameter as this is called later now, after a load has actually been
  committed in the provisional process.
- Factor some code out to WebPageProxy::setDrawingArea() so that it can be shared with swapToWebProcess().

(WebKit::WebPageProxy::maybeInitializeSandboxExtensionHandle):
(WebKit::WebPageProxy::loadRequest):
(WebKit::WebPageProxy::loadRequestWithNavigationShared):
Only call setPendingAPIRequestURL() in loadRequestWithNavigation() only if ShouldTreatAsContinuingLoad is not
Yes. This avoids hitting some assertions as this was already called during the first API call if needed.

(WebKit::WebPageProxy::loadData):
(WebKit::WebPageProxy::loadDataWithNavigationShared):
(WebKit::WebPageProxy::stopLoading):
(WebKit::WebPageProxy::reload):
(WebKit::WebPageProxy::didPerformDragControllerAction):
(WebKit::WebPageProxy::findPlugin):
(WebKit::WebPageProxy::receivedNavigationPolicyDecision):
In case of process swap, tell the previous process to ignore the load instead of suspending it right away.
Suspension now happens later, only if we end up committing the provisional load in the new process.
Also discard the SuspendedPage if it failed to suspend (we only reuse its process in this case). This used
to happen a bit later but it is clearer if we do this as early as possible I think.

(WebKit::WebPageProxy::commitProvisionalPage):
When the load is committed in the new process, we call WebPageProxy::commitProvisionalPage(). It takes care of:
- Actually swapping the WebPageProxy to the new process by calling processDidTerminate() / swapToWebProcess().
- Suspending the current page.
- Letting the client know the load is comitted
- Destroy the ProvisionalPageProxy.
This work used to happen earlier in continueNavigationInNewProcess().

(WebKit::WebPageProxy::continueNavigationInNewProcess):
Moved some of the logic to commitProvisionalPage(). We now merely start the load in a new ProvisionalPageProxy,
without actually having the WebPageProxy switch to the new process yet.

(WebKit::WebPageProxy::didCreateMainFrame):
(WebKit::WebPageProxy::didCreateSubframe):
(WebKit::WebPageProxy::didCreateWindow):
Drop some code that is no longer needed, now that the ProvisionalPageProxy takes care of this.

(WebKit::WebPageProxy::didDestroyNavigation):
On process-swap, when telling the previous process to ignore the load and starting the new load in a new
ProvisionalPageProxy, the previous WebPage attempts to destroy the navigation. In this case, we ignore
the call since the navigation is merely taken over by the ProvisionalPageProxy.

(WebKit::WebPageProxy::didStartProvisionalLoadForFrame):
(WebKit::WebPageProxy::didStartProvisionalLoadForFrameShared):
Moved some PSON logic to the ProvisionalPageProxy instead.

(WebKit::WebPageProxy::didReceiveServerRedirectForProvisionalLoadForFrame):
(WebKit::WebPageProxy::didReceiveServerRedirectForProvisionalLoadForFrameShared):
(WebKit::WebPageProxy::willPerformClientRedirectForFrame):
(WebKit::WebPageProxy::didCancelClientRedirectForFrame):
(WebKit::WebPageProxy::didChangeProvisionalURLForFrame):
(WebKit::WebPageProxy::didChangeProvisionalURLForFrameShared):

(WebKit::WebPageProxy::didFailProvisionalLoadForFrame):
(WebKit::WebPageProxy::didFailProvisionalLoadForFrameShared):
When didFailProvisionalLoadForFrame() is called for a ProvisionalPageProxy, destroy it.

(WebKit::WebPageProxy::didCommitLoadForFrame):
(WebKit::WebPageProxy::didFinishDocumentLoadForFrame):
(WebKit::WebPageProxy::didFinishLoadForFrame):
(WebKit::WebPageProxy::didFailLoadForFrame):
(WebKit::WebPageProxy::didSameDocumentNavigationForFrame):
(WebKit::WebPageProxy::didReceiveTitleForFrame):
(WebKit::WebPageProxy::didFirstVisuallyNonEmptyLayoutForFrame):
(WebKit::WebPageProxy::didDisplayInsecureContentForFrame):
(WebKit::WebPageProxy::didRunInsecureContentForFrame):
(WebKit::WebPageProxy::frameDidBecomeFrameSet):
(WebKit::WebPageProxy::decidePolicyForNavigationActionAsync):
(WebKit::WebPageProxy::decidePolicyForNavigationActionAsyncShared):
(WebKit::WebPageProxy::decidePolicyForNavigationAction):
(WebKit::WebPageProxy::decidePolicyForNavigationActionSync):
(WebKit::WebPageProxy::decidePolicyForNewWindowAction):
(WebKit::WebPageProxy::decidePolicyForResponse):
(WebKit::WebPageProxy::decidePolicyForResponseShared):
(WebKit::WebPageProxy::unableToImplementPolicy):
(WebKit::WebPageProxy::willSubmitForm):
(WebKit::WebPageProxy::didNavigateWithNavigationData):
(WebKit::WebPageProxy::didNavigateWithNavigationDataShared):
(WebKit::WebPageProxy::didPerformClientRedirect):
(WebKit::WebPageProxy::didPerformClientRedirectShared):
(WebKit::WebPageProxy::didPerformServerRedirect):
(WebKit::WebPageProxy::didUpdateHistoryTitle):
(WebKit::WebPageProxy::createNewPage):
(WebKit::WebPageProxy::runJavaScriptAlert):
(WebKit::WebPageProxy::runJavaScriptConfirm):
(WebKit::WebPageProxy::runJavaScriptPrompt):
(WebKit::WebPageProxy::unavailablePluginButtonClicked):
(WebKit::WebPageProxy::runBeforeUnloadConfirmPanel):
(WebKit::WebPageProxy::runOpenPanel):
(WebKit::WebPageProxy::printFrame):
(WebKit::WebPageProxy::backForwardGoToItem):
(WebKit::WebPageProxy::backForwardGoToItemShared):
(WebKit::WebPageProxy::learnWord):
(WebKit::WebPageProxy::ignoreWord):
(WebKit::WebPageProxy::didReceiveEvent):
(WebKit::WebPageProxy::editingRangeCallback):
(WebKit::WebPageProxy::rectForCharacterRangeCallback):
(WebKit::WebPageProxy::focusedFrameChanged):
(WebKit::WebPageProxy::frameSetLargestFrameChanged):

(WebKit::WebPageProxy::provisionalProcessDidTerminate):
Cancel the provisiona load and destroy the ProvisionalPageProxy if
the provisional process crashes.

(WebKit::WebPageProxy::resetState):
Drop some code that is no longer needed.

(WebKit::WebPageProxy::creationParameters):
- Move the hasRegisteredServiceWorkers flag initialization from the call site to here now that we have
more than one call site. This was just some bad factoring.
- Take the process in parameter now that we page can be associated with several processes at a time.

(WebKit::WebPageProxy::exceededDatabaseQuota):
(WebKit::WebPageProxy::requestGeolocationPermissionForFrame):
(WebKit::WebPageProxy::requestUserMediaPermissionForFrame):
(WebKit::WebPageProxy::enumerateMediaDevicesForFrame):
(WebKit::WebPageProxy::startURLSchemeTask):
(WebKit::WebPageProxy::startURLSchemeTaskShared):
(WebKit::WebPageProxy::stopURLSchemeTask):
(WebKit::WebPageProxy::loadSynchronousURLSchemeTask):
(WebKit::WebPageProxy::checkURLReceivedFromCurrentOrPreviousWebProcess):
(WebKit::WebPageProxy::willAcquireUniversalFileReadSandboxExtension):
* UIProcess/WebPageProxy.h:
(WebKit::WebPageProxy::visitedLinkStore):
(WebKit::WebPageProxy::provisionalPageProxy const):

* UIProcess/WebProcessProxy.cpp:
(WebKit::WebProcessProxy::hasProvisionalPageWithID const):
(WebKit::WebProcessProxy::updateBackForwardItem):
(WebKit::WebProcessProxy::processDidTerminateOrFailedToLaunch):
(WebKit::WebProcessProxy::didFinishLaunching):
(WebKit::WebProcessProxy::canTerminateChildProcess):
* UIProcess/WebProcessProxy.h:
(WebKit::WebProcessProxy::addProvisionalPageProxy):
(WebKit::WebProcessProxy::removeProvisionalPageProxy):
Before updating a BackForwardListItem, we normally make sure the process has a WebPageProxy with the
item's pageID. We have to tweak the logic because there may now be no WebPageProxy with this pageID
associated with this process yet, because it is still a ProvisionalPageProxy.

* UIProcess/WebURLSchemeHandler.cpp:
(WebKit::WebURLSchemeHandler::startTask):
* UIProcess/WebURLSchemeHandler.h:
* UIProcess/WebURLSchemeTask.cpp:
(WebKit::WebURLSchemeTask::create):
(WebKit::WebURLSchemeTask::WebURLSchemeTask):
(WebKit::WebURLSchemeTask::didPerformRedirection):
(WebKit::WebURLSchemeTask::didReceiveResponse):
(WebKit::WebURLSchemeTask::didReceiveData):
(WebKit::WebURLSchemeTask::didComplete):
(WebKit::WebURLSchemeTask::pageDestroyed):
* UIProcess/WebURLSchemeTask.h:
Pass the process when constructing a WebURLSchemeTask and store it as a data member in addition to
the page. This is necessary now that a WebPageProxy can be associated with several WebProcesses.

* UIProcess/ios/ViewGestureControllerIOS.mm:
(WebKit::ViewGestureController::endSwipeGesture):
Use the provisional drawing area to display the swipe snapshot as it may differ from the one currently
associated with the page in case of process swap.

* WebKit.xcodeproj/project.pbxproj:
Add ProvisionalPageProxy class.

* WebProcess/WebPage/WebFrame.cpp:
(WebKit::toPolicyAction):
(WebKit::WebFrame::didReceivePolicyDecision):
* WebProcess/WebPage/WebPage.cpp:
(WebKit::m_shouldAttachDrawingAreaOnPageTransition):
(WebKit::WebPage::reinitializeWebPage):
(WebKit::WebPage::didReceivePolicyDecision):
Stop dealing with WebPolicyAction::Suspend as it no longer exists.

(WebKit::WebPage::didCompletePageTransition):

(WebKit::WebPage::setIsSuspended):
Suspend the Page when setIsSuspended(true) is called, now that there is no longer a WebPolicyAction::Suspend.
setIsSuspended(true) IPC is sent when we actually commit the provisional page.

* WebProcess/WebPage/WebPage.h:

Tools:

Add API test coverage.

* TestWebKitAPI/Tests/WebKitCocoa/ProcessSwapOnNavigation.mm:
(-[PSONNavigationDelegate webView:decidePolicyForNavigationResponse:decisionHandler:]):

LayoutTests:

Skip test testing the cross-process DOMWindow API as I broke it with this patch.
The feature is far from ready and off by default anyway. I will add support back
in a follow-up.

* platform/wk2/TestExpectations:

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

7 months agoFrequent null-deref under TiledCoreAnimationDrawingArea::scaleViewToFitDocumentIfNeeded()
timothy_horton@apple.com [Wed, 16 Jan 2019 20:35:09 +0000 (20:35 +0000)]
Frequent null-deref under TiledCoreAnimationDrawingArea::scaleViewToFitDocumentIfNeeded()
https://bugs.webkit.org/show_bug.cgi?id=193468
<rdar://problem/38645869>

Reviewed by Zalan Bujtas.

* WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm:
(WebKit::TiledCoreAnimationDrawingArea::scaleViewToFitDocumentIfNeeded):
Adjust the null-check a bit; Zalan pointed out that the layout could
be responsible for the Frame/RenderView going away, so we should bail
*after* layout, not before.

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

7 months agoWeb Inspector: extend overlay element bounds lines to the right/below as well
drousso@apple.com [Wed, 16 Jan 2019 19:56:34 +0000 (19:56 +0000)]
Web Inspector: extend overlay element bounds lines to the right/below as well
https://bugs.webkit.org/show_bug.cgi?id=193336

Reviewed by Matt Baker.

This patch is purely a visual change for WebInspector, and doesn't affect anything else.

* inspector/InspectorOverlayPage.js:
(_drawBounds):

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

7 months agobmalloc should use JSC VM tag for gigacage
keith_miller@apple.com [Wed, 16 Jan 2019 19:08:21 +0000 (19:08 +0000)]
bmalloc should use JSC VM tag for gigacage
https://bugs.webkit.org/show_bug.cgi?id=193496

Reviewed by Mark Lam.

Source/bmalloc:

This patch moves the VMTag info from WTF to bmalloc so that we can
tag gigacage memory with the unused JSC memory tag. The JSC memory
tag was previously used for wasm but since wasm is now allocated
out of the primitive cage it was unused.

* bmalloc.xcodeproj/project.pbxproj:
* bmalloc/BVMTags.h: Copied from Source/WTF/wtf/VMTags.h.
* bmalloc/Gigacage.cpp:
(Gigacage::ensureGigacage):
* bmalloc/VMAllocate.h:
(bmalloc::tryVMAllocate):
(bmalloc::vmZeroAndPurge):

Source/WTF:

Move most of the macros for vm tagging to bmalloc.

* wtf/VMTags.h:

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

7 months agoPrevent WorkerRunLoop::runInMode from spinning in nested cases
youenn@apple.com [Wed, 16 Jan 2019 19:07:22 +0000 (19:07 +0000)]
Prevent WorkerRunLoop::runInMode from spinning in nested cases
https://bugs.webkit.org/show_bug.cgi?id=193359
<rdar://problem/46345353>

Reviewed by Joseph Pecoraro.

Speculative fix for some cases where service worker is spinning and consuming a lot of CPU.
The hypothesis is that:
- Service Worker is checking for its script freshness through WorkerScriptLoader.
This triggers the worker run loop to be nested.
- The run loop timer is active and needs to fire immediately.
The hypothesis is that this happens in some cases like restarting a device after sleep mode.

WorkerRunLoop::runInMode will then compute a 0 timeout value for getting a message.
This will trigger a timeout while waiting for the message queue.
Since the run loop is nested,  the run loop timer will not be able to fire,
and it will keep ask to fire immediately.
runInMode will return timeout as a result and WorkerRunLoop::run will call it immediately.

The fix is to prevent the shared timer to fire only when the run loop is being debugged through the web inspector.
We compute this by checking the run loop mode as debuggerMode().
Did some refactoring by introducing helper routines for running the loop and posting task in debugger mode.

* inspector/WorkerScriptDebugServer.cpp:
(WebCore::WorkerScriptDebugServer::runEventLoopWhilePaused):
* workers/WorkerInspectorProxy.cpp:
(WebCore::WorkerInspectorProxy::resumeWorkerIfPaused):
(WebCore::WorkerInspectorProxy::connectToWorkerInspectorController):
(WebCore::WorkerInspectorProxy::disconnectFromWorkerInspectorController):
(WebCore::WorkerInspectorProxy::sendMessageToWorkerInspectorController):
* workers/WorkerRunLoop.cpp:
(WebCore::ModePredicate::ModePredicate):
(WebCore::WorkerRunLoop::WorkerRunLoop):
(WebCore::debuggerMode):
(WebCore::RunLoopSetup::RunLoopSetup):
(WebCore::RunLoopSetup::~RunLoopSetup):
(WebCore::WorkerRunLoop::run):
(WebCore::WorkerRunLoop::runInDebuggerMode):
(WebCore::WorkerRunLoop::runInMode):
(WebCore::WorkerRunLoop::Task::performTask):
* workers/WorkerRunLoop.h:
(WebCore::WorkerRunLoop::isBeingDebugged const):
* workers/WorkerThread.cpp:
(WebCore::WorkerThread::startRunningDebuggerTasks):
* workers/service/context/ServiceWorkerInspectorProxy.cpp:
(WebCore::ServiceWorkerInspectorProxy::connectToWorker):
(WebCore::ServiceWorkerInspectorProxy::disconnectFromWorker):
(WebCore::ServiceWorkerInspectorProxy::sendMessageToWorker):

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

7 months agoRefactor new bytecode structs so that the fields are prefixed with "m_".
mark.lam@apple.com [Wed, 16 Jan 2019 18:44:25 +0000 (18:44 +0000)]
Refactor new bytecode structs so that the fields are prefixed with "m_".
https://bugs.webkit.org/show_bug.cgi?id=193467

Reviewed by Saam Barati and Tadeu Zagallo.

This makes it easier to do a manual audit of type correctness of the LLInt
instructions used to access these fields.  Without this change, it would be
difficult (and error prone) to distinguish the difference between field names and
macro variables.  This audit will be done after this patch lands.

* bytecode/BytecodeGeneratorification.cpp:
(JSC::BytecodeGeneratorification::BytecodeGeneratorification):
* bytecode/BytecodeUseDef.h:
(JSC::computeUsesForBytecodeOffset):
* bytecode/CallLinkStatus.cpp:
(JSC::CallLinkStatus::computeFromLLInt):
* bytecode/CodeBlock.cpp:
(JSC::CodeBlock::finishCreation):
(JSC::CodeBlock::propagateTransitions):
(JSC::CodeBlock::finalizeLLIntInlineCaches):
(JSC::CodeBlock::ensureCatchLivenessIsComputedForBytecodeOffset):
(JSC::CodeBlock::ensureCatchLivenessIsComputedForBytecodeOffsetSlow):
(JSC::CodeBlock::getArrayProfile):
(JSC::CodeBlock::notifyLexicalBindingShadowing):
(JSC::CodeBlock::tryGetValueProfileForBytecodeOffset):
(JSC::CodeBlock::arithProfileForPC):
(JSC::CodeBlock::insertBasicBlockBoundariesForControlFlowProfiler):
* bytecode/CodeBlockInlines.h:
(JSC::CodeBlock::forEachValueProfile):
(JSC::CodeBlock::forEachArrayProfile):
(JSC::CodeBlock::forEachArrayAllocationProfile):
(JSC::CodeBlock::forEachObjectAllocationProfile):
(JSC::CodeBlock::forEachLLIntCallLinkInfo):
* bytecode/GetByIdStatus.cpp:
(JSC::GetByIdStatus::computeFromLLInt):
* bytecode/LLIntPrototypeLoadAdaptiveStructureWatchpoint.cpp:
(JSC::LLIntPrototypeLoadAdaptiveStructureWatchpoint::clearLLIntGetByIdCache):
* bytecode/PreciseJumpTargetsInlines.h:
(JSC::jumpTargetForInstruction):
(JSC::extractStoredJumpTargetsForInstruction):
(JSC::updateStoredJumpTargetsForInstruction):
* bytecode/PutByIdStatus.cpp:
(JSC::PutByIdStatus::computeFromLLInt):
* bytecode/UnlinkedCodeBlock.cpp:
(JSC::dumpLineColumnEntry):
* bytecompiler/BytecodeGenerator.cpp:
(JSC::BytecodeGenerator::fuseCompareAndJump):
(JSC::BytecodeGenerator::fuseTestAndJmp):
(JSC::BytecodeGenerator::emitEqualityOp):
(JSC::BytecodeGenerator::endSwitch):
(JSC::StructureForInContext::finalize):
* dfg/DFGByteCodeParser.cpp:
(JSC::DFG::ByteCodeParser::handleCall):
(JSC::DFG::ByteCodeParser::handleVarargsCall):
(JSC::DFG::ByteCodeParser::parseGetById):
(JSC::DFG::ByteCodeParser::parseBlock):
(JSC::DFG::ByteCodeParser::handlePutByVal):
(JSC::DFG::ByteCodeParser::handlePutAccessorById):
(JSC::DFG::ByteCodeParser::handlePutAccessorByVal):
(JSC::DFG::ByteCodeParser::handleNewFunc):
(JSC::DFG::ByteCodeParser::handleNewFuncExp):
* dfg/DFGOSREntry.cpp:
(JSC::DFG::prepareCatchOSREntry):
* ftl/FTLOperations.cpp:
(JSC::FTL::operationMaterializeObjectInOSR):
* generator/Argument.rb:
* generator/Metadata.rb:
* generator/Opcode.rb:
* jit/JIT.h:
* jit/JITArithmetic.cpp:
(JSC::JIT::emit_op_unsigned):
(JSC::JIT::emit_compareAndJump):
(JSC::JIT::emit_compareUnsignedAndJump):
(JSC::JIT::emit_compareUnsigned):
(JSC::JIT::emit_compareAndJumpSlow):
(JSC::JIT::emit_op_inc):
(JSC::JIT::emit_op_dec):
(JSC::JIT::emit_op_mod):
(JSC::JIT::emit_op_negate):
(JSC::JIT::emitBitBinaryOpFastPath):
(JSC::JIT::emit_op_bitnot):
(JSC::JIT::emitRightShiftFastPath):
(JSC::JIT::emit_op_add):
(JSC::JIT::emitMathICFast):
(JSC::JIT::emitMathICSlow):
(JSC::JIT::emit_op_div):
(JSC::JIT::emit_op_mul):
(JSC::JIT::emit_op_sub):
* jit/JITArithmetic32_64.cpp:
(JSC::JIT::emit_compareAndJump):
(JSC::JIT::emit_compareUnsignedAndJump):
(JSC::JIT::emit_compareUnsigned):
(JSC::JIT::emit_compareAndJumpSlow):
(JSC::JIT::emit_op_unsigned):
(JSC::JIT::emit_op_inc):
(JSC::JIT::emit_op_dec):
(JSC::JIT::emitBinaryDoubleOp):
(JSC::JIT::emit_op_mod):
* jit/JITCall.cpp:
(JSC::JIT::emitPutCallResult):
(JSC::JIT::compileSetupFrame):
(JSC::JIT::compileCallEvalSlowCase):
(JSC::JIT::compileTailCall):
(JSC::JIT::compileOpCall):
* jit/JITCall32_64.cpp:
(JSC::JIT::emitPutCallResult):
(JSC::JIT::emit_op_ret):
(JSC::JIT::compileSetupFrame):
(JSC::JIT::compileCallEvalSlowCase):
(JSC::JIT::compileOpCall):
* jit/JITInlines.h:
(JSC::JIT::emitValueProfilingSiteIfProfiledOpcode):
(JSC::JIT::emitValueProfilingSite):
(JSC::JIT::copiedGetPutInfo):
(JSC::JIT::copiedArithProfile):
* jit/JITOpcodes.cpp:
(JSC::JIT::emit_op_mov):
(JSC::JIT::emit_op_end):
(JSC::JIT::emit_op_jmp):
(JSC::JIT::emit_op_new_object):
(JSC::JIT::emitSlow_op_new_object):
(JSC::JIT::emit_op_overrides_has_instance):
(JSC::JIT::emit_op_instanceof):
(JSC::JIT::emitSlow_op_instanceof):
(JSC::JIT::emit_op_is_empty):
(JSC::JIT::emit_op_is_undefined):
(JSC::JIT::emit_op_is_undefined_or_null):
(JSC::JIT::emit_op_is_boolean):
(JSC::JIT::emit_op_is_number):
(JSC::JIT::emit_op_is_cell_with_type):
(JSC::JIT::emit_op_is_object):
(JSC::JIT::emit_op_ret):
(JSC::JIT::emit_op_to_primitive):
(JSC::JIT::emit_op_set_function_name):
(JSC::JIT::emit_op_not):
(JSC::JIT::emit_op_jfalse):
(JSC::JIT::emit_op_jeq_null):
(JSC::JIT::emit_op_jneq_null):
(JSC::JIT::emit_op_jneq_ptr):
(JSC::JIT::emit_op_eq):
(JSC::JIT::emit_op_jeq):
(JSC::JIT::emit_op_jtrue):
(JSC::JIT::emit_op_neq):
(JSC::JIT::emit_op_jneq):
(JSC::JIT::emit_op_throw):
(JSC::JIT::compileOpStrictEq):
(JSC::JIT::compileOpStrictEqJump):
(JSC::JIT::emitSlow_op_jstricteq):
(JSC::JIT::emitSlow_op_jnstricteq):
(JSC::JIT::emit_op_to_number):
(JSC::JIT::emit_op_to_string):
(JSC::JIT::emit_op_to_object):
(JSC::JIT::emit_op_catch):
(JSC::JIT::emit_op_get_parent_scope):
(JSC::JIT::emit_op_switch_imm):
(JSC::JIT::emit_op_switch_char):
(JSC::JIT::emit_op_switch_string):
(JSC::JIT::emit_op_debug):
(JSC::JIT::emit_op_eq_null):
(JSC::JIT::emit_op_neq_null):
(JSC::JIT::emit_op_get_scope):
(JSC::JIT::emit_op_to_this):
(JSC::JIT::emit_op_create_this):
(JSC::JIT::emit_op_check_tdz):
(JSC::JIT::emitSlow_op_eq):
(JSC::JIT::emitSlow_op_neq):
(JSC::JIT::emitSlow_op_jeq):
(JSC::JIT::emitSlow_op_jneq):
(JSC::JIT::emitSlow_op_instanceof_custom):
(JSC::JIT::emit_op_new_regexp):
(JSC::JIT::emitNewFuncCommon):
(JSC::JIT::emitNewFuncExprCommon):
(JSC::JIT::emit_op_new_array):
(JSC::JIT::emit_op_new_array_with_size):
(JSC::JIT::emit_op_has_structure_property):
(JSC::JIT::emit_op_has_indexed_property):
(JSC::JIT::emitSlow_op_has_indexed_property):
(JSC::JIT::emit_op_get_direct_pname):
(JSC::JIT::emit_op_enumerator_structure_pname):
(JSC::JIT::emit_op_enumerator_generic_pname):
(JSC::JIT::emit_op_profile_type):
(JSC::JIT::emit_op_log_shadow_chicken_prologue):
(JSC::JIT::emit_op_log_shadow_chicken_tail):
(JSC::JIT::emit_op_profile_control_flow):
(JSC::JIT::emit_op_argument_count):
(JSC::JIT::emit_op_get_rest_length):
(JSC::JIT::emit_op_get_argument):
* jit/JITOpcodes32_64.cpp:
(JSC::JIT::emit_op_mov):
(JSC::JIT::emit_op_end):
(JSC::JIT::emit_op_jmp):
(JSC::JIT::emit_op_new_object):
(JSC::JIT::emitSlow_op_new_object):
(JSC::JIT::emit_op_overrides_has_instance):
(JSC::JIT::emit_op_instanceof):
(JSC::JIT::emitSlow_op_instanceof):
(JSC::JIT::emitSlow_op_instanceof_custom):
(JSC::JIT::emit_op_is_empty):
(JSC::JIT::emit_op_is_undefined):
(JSC::JIT::emit_op_is_undefined_or_null):
(JSC::JIT::emit_op_is_boolean):
(JSC::JIT::emit_op_is_number):
(JSC::JIT::emit_op_is_cell_with_type):
(JSC::JIT::emit_op_is_object):
(JSC::JIT::emit_op_to_primitive):
(JSC::JIT::emit_op_set_function_name):
(JSC::JIT::emit_op_not):
(JSC::JIT::emit_op_jfalse):
(JSC::JIT::emit_op_jtrue):
(JSC::JIT::emit_op_jeq_null):
(JSC::JIT::emit_op_jneq_null):
(JSC::JIT::emit_op_jneq_ptr):
(JSC::JIT::emit_op_eq):
(JSC::JIT::emitSlow_op_eq):
(JSC::JIT::emit_op_jeq):
(JSC::JIT::emitSlow_op_jeq):
(JSC::JIT::emit_op_neq):
(JSC::JIT::emitSlow_op_neq):
(JSC::JIT::emit_op_jneq):
(JSC::JIT::emitSlow_op_jneq):
(JSC::JIT::compileOpStrictEq):
(JSC::JIT::compileOpStrictEqJump):
(JSC::JIT::emitSlow_op_jstricteq):
(JSC::JIT::emitSlow_op_jnstricteq):
(JSC::JIT::emit_op_eq_null):
(JSC::JIT::emit_op_neq_null):
(JSC::JIT::emit_op_throw):
(JSC::JIT::emit_op_to_number):
(JSC::JIT::emit_op_to_string):
(JSC::JIT::emit_op_to_object):
(JSC::JIT::emit_op_catch):
(JSC::JIT::emit_op_get_parent_scope):
(JSC::JIT::emit_op_switch_imm):
(JSC::JIT::emit_op_switch_char):
(JSC::JIT::emit_op_switch_string):
(JSC::JIT::emit_op_debug):
(JSC::JIT::emit_op_get_scope):
(JSC::JIT::emit_op_create_this):
(JSC::JIT::emit_op_to_this):
(JSC::JIT::emit_op_check_tdz):
(JSC::JIT::emit_op_has_structure_property):
(JSC::JIT::emit_op_has_indexed_property):
(JSC::JIT::emitSlow_op_has_indexed_property):
(JSC::JIT::emit_op_get_direct_pname):
(JSC::JIT::emit_op_enumerator_structure_pname):
(JSC::JIT::emit_op_enumerator_generic_pname):
(JSC::JIT::emit_op_profile_type):
(JSC::JIT::emit_op_log_shadow_chicken_prologue):
(JSC::JIT::emit_op_log_shadow_chicken_tail):
* jit/JITOperations.cpp:
* jit/JITPropertyAccess.cpp:
(JSC::JIT::emit_op_get_by_val):
(JSC::JIT::emitGetByValWithCachedId):
(JSC::JIT::emitSlow_op_get_by_val):
(JSC::JIT::emit_op_put_by_val):
(JSC::JIT::emitGenericContiguousPutByVal):
(JSC::JIT::emitArrayStoragePutByVal):
(JSC::JIT::emitPutByValWithCachedId):
(JSC::JIT::emitSlow_op_put_by_val):
(JSC::JIT::emit_op_put_getter_by_id):
(JSC::JIT::emit_op_put_setter_by_id):
(JSC::JIT::emit_op_put_getter_setter_by_id):
(JSC::JIT::emit_op_put_getter_by_val):
(JSC::JIT::emit_op_put_setter_by_val):
(JSC::JIT::emit_op_del_by_id):
(JSC::JIT::emit_op_del_by_val):
(JSC::JIT::emit_op_try_get_by_id):
(JSC::JIT::emitSlow_op_try_get_by_id):
(JSC::JIT::emit_op_get_by_id_direct):
(JSC::JIT::emitSlow_op_get_by_id_direct):
(JSC::JIT::emit_op_get_by_id):
(JSC::JIT::emit_op_get_by_id_with_this):
(JSC::JIT::emitSlow_op_get_by_id):
(JSC::JIT::emitSlow_op_get_by_id_with_this):
(JSC::JIT::emit_op_put_by_id):
(JSC::JIT::emitSlow_op_put_by_id):
(JSC::JIT::emit_op_in_by_id):
(JSC::JIT::emitSlow_op_in_by_id):
(JSC::JIT::emit_op_resolve_scope):
(JSC::JIT::emit_op_get_from_scope):
(JSC::JIT::emitSlow_op_get_from_scope):
(JSC::JIT::emit_op_put_to_scope):
(JSC::JIT::emit_op_get_from_arguments):
(JSC::JIT::emit_op_put_to_arguments):
(JSC::JIT::emitIntTypedArrayPutByVal):
(JSC::JIT::emitFloatTypedArrayPutByVal):
* jit/JITPropertyAccess32_64.cpp:
(JSC::JIT::emit_op_put_getter_by_id):
(JSC::JIT::emit_op_put_setter_by_id):
(JSC::JIT::emit_op_put_getter_setter_by_id):
(JSC::JIT::emit_op_put_getter_by_val):
(JSC::JIT::emit_op_put_setter_by_val):
(JSC::JIT::emit_op_del_by_id):
(JSC::JIT::emit_op_del_by_val):
(JSC::JIT::emit_op_get_by_val):
(JSC::JIT::emitGetByValWithCachedId):
(JSC::JIT::emitSlow_op_get_by_val):
(JSC::JIT::emit_op_put_by_val):
(JSC::JIT::emitGenericContiguousPutByVal):
(JSC::JIT::emitArrayStoragePutByVal):
(JSC::JIT::emitPutByValWithCachedId):
(JSC::JIT::emitSlow_op_put_by_val):
(JSC::JIT::emit_op_try_get_by_id):
(JSC::JIT::emitSlow_op_try_get_by_id):
(JSC::JIT::emit_op_get_by_id_direct):
(JSC::JIT::emitSlow_op_get_by_id_direct):
(JSC::JIT::emit_op_get_by_id):
(JSC::JIT::emitSlow_op_get_by_id):
(JSC::JIT::emit_op_get_by_id_with_this):
(JSC::JIT::emitSlow_op_get_by_id_with_this):
(JSC::JIT::emit_op_put_by_id):
(JSC::JIT::emitSlow_op_put_by_id):
(JSC::JIT::emit_op_in_by_id):
(JSC::JIT::emitSlow_op_in_by_id):
(JSC::JIT::emit_op_resolve_scope):
(JSC::JIT::emit_op_get_from_scope):
(JSC::JIT::emitSlow_op_get_from_scope):
(JSC::JIT::emit_op_put_to_scope):
(JSC::JIT::emit_op_get_from_arguments):
(JSC::JIT::emit_op_put_to_arguments):
* llint/LLIntSlowPaths.cpp:
(JSC::LLInt::LLINT_SLOW_PATH_DECL):
(JSC::LLInt::setupGetByIdPrototypeCache):
(JSC::LLInt::getByVal):
(JSC::LLInt::genericCall):
(JSC::LLInt::varargsSetup):
(JSC::LLInt::commonCallEval):
* llint/LowLevelInterpreter.asm:
* llint/LowLevelInterpreter32_64.asm:
* llint/LowLevelInterpreter64.asm:
* runtime/CommonSlowPaths.cpp:
(JSC::SLOW_PATH_DECL):
(JSC::updateArithProfileForUnaryArithOp):
* runtime/CommonSlowPaths.h:
(JSC::CommonSlowPaths::tryCachePutToScopeGlobal):
(JSC::CommonSlowPaths::tryCacheGetFromScopeGlobal):

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

7 months agoJSFunction::canUseAllocationProfile() should account for builtin functions with no...
mark.lam@apple.com [Wed, 16 Jan 2019 18:10:44 +0000 (18:10 +0000)]
JSFunction::canUseAllocationProfile() should account for builtin functions with no own prototypes.
https://bugs.webkit.org/show_bug.cgi?id=193423
<rdar://problem/46209355>

Reviewed by Saam Barati.

JSTests:

* microbenchmarks/sinkable-new-object-with-builtin-constructor.js: Added.
* stress/constructing-builtin-functions-with-getter-prototype-should-only-call-getter-once-per-new-1.js: Added.
* stress/constructing-builtin-functions-with-getter-prototype-should-only-call-getter-once-per-new-2.js: Added.
* stress/jsfunction-cannot-use-allocation-profile-with-builtin-functions-with-no-prototype.js: Added.

Source/JavaScriptCore:

JSFunction::canUseAllocationProfile() should return false for most builtins
because the majority of them have no prototype property.  The only exception to
this is the few builtin functions that are explicitly used as constructors.

For these builtin constructors, JSFunction::canUseAllocationProfile() should also
return false if the prototype property is a getter or custom getter because
getting the prototype would then be effectful.

* dfg/DFGOperations.cpp:
* runtime/CommonSlowPaths.cpp:
(JSC::SLOW_PATH_DECL):
* runtime/JSFunctionInlines.h:
(JSC::JSFunction::canUseAllocationProfile):
* runtime/PropertySlot.h:

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

7 months agoIndexedDB: leak WebIDBConnectionToClient for retain cycle
sihui_liu@apple.com [Wed, 16 Jan 2019 17:11:47 +0000 (17:11 +0000)]
IndexedDB: leak WebIDBConnectionToClient for retain cycle
https://bugs.webkit.org/show_bug.cgi?id=193097
<rdar://problem/46899601>

Reviewed by David Kilzer.

Fix API test failure after r239887. After removing the retain cycle, IDBConnectionToClient will no longer live
forever so make sure it is not destructed before UniqueIDBDatabaseConnection unregisters itself.

* Modules/indexeddb/server/UniqueIDBDatabaseConnection.cpp:
(WebCore::IDBServer::UniqueIDBDatabaseConnection::UniqueIDBDatabaseConnection):
(WebCore::IDBServer::UniqueIDBDatabaseConnection::~UniqueIDBDatabaseConnection):
(WebCore::IDBServer::UniqueIDBDatabaseConnection::fireVersionChangeEvent):
(WebCore::IDBServer::UniqueIDBDatabaseConnection::didAbortTransaction):
(WebCore::IDBServer::UniqueIDBDatabaseConnection::didCommitTransaction):
(WebCore::IDBServer::UniqueIDBDatabaseConnection::didCreateObjectStore):
(WebCore::IDBServer::UniqueIDBDatabaseConnection::didDeleteObjectStore):
(WebCore::IDBServer::UniqueIDBDatabaseConnection::didRenameObjectStore):
(WebCore::IDBServer::UniqueIDBDatabaseConnection::didClearObjectStore):
(WebCore::IDBServer::UniqueIDBDatabaseConnection::didCreateIndex):
(WebCore::IDBServer::UniqueIDBDatabaseConnection::didDeleteIndex):
(WebCore::IDBServer::UniqueIDBDatabaseConnection::didRenameIndex):
* Modules/indexeddb/server/UniqueIDBDatabaseConnection.h:

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

7 months ago[WTF] Compilation fails with system malloc
berto@igalia.com [Wed, 16 Jan 2019 16:32:36 +0000 (16:32 +0000)]
[WTF] Compilation fails with system malloc
https://bugs.webkit.org/show_bug.cgi?id=172445

Reviewed by Michael Catanzaro.

Follow-up to r217270. The sysinfo() system call is specific to
Linux so update the #ifdef checks accordingly.

* wtf/RAMSize.cpp:
(WTF::computeRAMSize):

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

7 months agoAdd more assertions to find root cause for release assert hit in StyleResolver
antti@apple.com [Wed, 16 Jan 2019 16:03:31 +0000 (16:03 +0000)]
Add more assertions to find root cause for release assert hit in StyleResolver
https://bugs.webkit.org/show_bug.cgi?id=193488
<rdar://problem/30983040>

Reviewed by Zalan Bujtas.

* css/StyleResolver.cpp:
(WebCore::StyleResolver::~StyleResolver):

Release assert we are not resolving tree style.

* dom/Document.cpp:
(WebCore::Document::setIsResolvingTreeStyle):
* dom/Document.h:
(WebCore::Document::isResolvingTreeStyle const):
* style/StyleTreeResolver.cpp:
(WebCore::Style::TreeResolver::Scope::Scope):
(WebCore::Style::TreeResolver::Scope::~Scope):

Set isResolvingTreeStyle bit when we have a tree resolver scope.

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

7 months ago[LFC][Out-of-flow] Set used vertical margin values when top/height/bottom are non...
zalan@apple.com [Wed, 16 Jan 2019 15:23:24 +0000 (15:23 +0000)]
[LFC][Out-of-flow] Set used vertical margin values when top/height/bottom are non-auto.
https://bugs.webkit.org/show_bug.cgi?id=193470

Reviewed by Antti Koivisto.

Source/WebCore:

Non-auto vertical margin values (which is mostly the case) should be set as used values.

Test: fast/block/block-only/non-auto-top-bottom-height-with-margins.html

* layout/FormattingContextGeometry.cpp:
(WebCore::Layout::FormattingContext::Geometry::outOfFlowNonReplacedVerticalGeometry):

Tools:

* LayoutReloaded/misc/LFC-passing-tests.txt:

LayoutTests:

* fast/block/block-only/non-auto-top-bottom-height-with-margins-expected.txt: Added.
* fast/block/block-only/non-auto-top-bottom-height-with-margins.html: Added.

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

7 months ago[LFC] Adjust margin box verification.
zalan@apple.com [Wed, 16 Jan 2019 14:52:55 +0000 (14:52 +0000)]
[LFC] Adjust margin box verification.
https://bugs.webkit.org/show_bug.cgi?id=193482

Source/WebCore:

Reviewed by Antti Koivisto.

In certain cases, like out-of-flow boxes with margin auto, marginBoxRect() returns 0. It's clearly incorrect,
so let's check the individual margin values instead (and at this point we know that all other boxes match).

Test: fast/block/block-only/non-auto-top-bottom-height-with-auto-margins.html

* layout/Verification.cpp:
(WebCore::Layout::outputMismatchingBlockBoxInformationIfNeeded):

Tools:

Reviewed by Antti Koivisto.

* LayoutReloaded/misc/LFC-passing-tests.txt:

LayoutTests:

Reviewed by Antti Koivisto.

* fast/block/block-only/non-auto-top-bottom-height-with-auto-margins-expected.txt: Added.
* fast/block/block-only/non-auto-top-bottom-height-with-auto-margins.html: Added.

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

7 months ago[FreeType] Cache the zero-width space glyph in GlyphPage::fill()
zandobersek@gmail.com [Wed, 16 Jan 2019 11:05:08 +0000 (11:05 +0000)]
[FreeType] Cache the zero-width space glyph in GlyphPage::fill()
https://bugs.webkit.org/show_bug.cgi?id=193485

Reviewed by Carlos Garcia Campos.

In FreeType's implementation of GlyphPage::fill(), we can cache the
zero-width space glyph upon first retrieval through the
FcFreeTypeCharIndex() entrypoint, avoiding any subsequent calls
for other ignorable characters.

* platform/graphics/freetype/GlyphPageTreeNodeFreeType.cpp:
(WebCore::GlyphPage::fill):

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

7 months ago[WHLSL] Add the high zombie finder
mmaxfield@apple.com [Wed, 16 Jan 2019 10:53:16 +0000 (10:53 +0000)]
[WHLSL] Add the high zombie finder
https://bugs.webkit.org/show_bug.cgi?id=193432

Reviewed by Robin Morisset and Saam Barati.

This is a translation of https://github.com/gpuweb/WHLSL/blob/master/Source/HighZombieFinder.mjs into C++.

No new tests because it isn't hooked up yet. Not enough of the compiler exists to have any meaningful sort
of test. When enough of the compiler is present, I'll port the reference implementation's test suite.

* Modules/webgpu/WHLSL/WHLSLHighZombieFinder.cpp: Added.
(WebCore::WHLSL::findHighZombies):
* Modules/webgpu/WHLSL/WHLSLHighZombieFinder.h: Added.
* Sources.txt:
* WebCore.xcodeproj/project.pbxproj:

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

7 months agoUnreviewed WinCairo build fix.
Hironori.Fujii@sony.com [Wed, 16 Jan 2019 06:40:30 +0000 (06:40 +0000)]
Unreviewed WinCairo build fix.

Source/WebCore:

* platform/network/curl/ResourceHandleCurl.cpp:
(WebCore::ResourceHandle::createCurlRequest):
(WebCore::ResourceHandle::didReceiveAuthenticationChallenge):
(WebCore::ResourceHandle::receivedCredential):
(WebCore::ResourceHandle::getCredential):

Source/WebKit:

* WebProcess/WebPage/WebPageInspectorTargetController.cpp:
(WebKit::WebPageInspectorTargetController::connectInspector): Use 'auto' instead of unprefixed InspectorTarget.
(WebKit::WebPageInspectorTargetController::disconnectInspector): Ditto.
(WebKit::WebPageInspectorTargetController::sendMessageToTargetBackend): Ditto.

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

7 months agoReduce use of NetworkStorageSession::defaultStorageSession in WebCore
achristensen@apple.com [Wed, 16 Jan 2019 05:03:07 +0000 (05:03 +0000)]
Reduce use of NetworkStorageSession::defaultStorageSession in WebCore
https://bugs.webkit.org/show_bug.cgi?id=193368

Reviewed by Geoff Garen.

Source/WebCore:

The NetworkStorageSession ownership needs to move to the WebKit/WebKitLegacy layer instead of being a process-global static map.

* loader/EmptyClients.cpp:
* platform/network/CredentialStorage.cpp:
(WebCore::CredentialStorage::defaultCredentialStorage): Deleted.
* platform/network/CredentialStorage.h:
* platform/network/NetworkStorageSession.h:
* platform/network/cf/NetworkStorageSessionCFNet.cpp:
(WebCore::NetworkStorageSession::switchToNewTestingSession):
(WebCore::NetworkStorageSession::ensureSession):
* platform/network/cf/NetworkStorageSessionCFNetWin.cpp:
(WebCore::createPrivateStorageSession):
* platform/network/curl/ResourceHandleCurl.cpp:
(WebCore::ResourceHandle::didReceiveAuthenticationChallenge):
(WebCore::ResourceHandle::receivedCredential):
(WebCore::ResourceHandle::getCredential):

Source/WebKit:

* WebProcess/Plugins/PluginView.cpp:
(WebKit::PluginView::getAuthenticationInfo):

Source/WebKitLegacy/mac:

* Misc/WebCache.mm:
(+[WebCache clearCachedCredentials]):
* Misc/WebDownload.mm:
(-[WebDownloadInternal download:didReceiveAuthenticationChallenge:]):
* Plugins/WebBaseNetscapePluginView.mm:
(WebKit::getAuthenticationInfo):

Source/WebKitLegacy/win:

* WebDownloadCFNet.cpp:
(WebDownload::didReceiveAuthenticationChallenge):

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

7 months agoRemove more NetworkProcess::singleton use
achristensen@apple.com [Wed, 16 Jan 2019 04:57:54 +0000 (04:57 +0000)]
Remove more NetworkProcess::singleton use
https://bugs.webkit.org/show_bug.cgi?id=193484

Reviewed by Geoffrey Garen.

This removes the use of NetworkProcess::singleton in the LegacyCustomProtocolManager.
This is the kind of awful duct tape code that keeps me awake at night, but it's necessary
because we can't quite remove LegacyCustomProtocolManager yet but we need to allow more than
one NetworkProcess object.  To make it work well enough until we remove LegacyCustomProtocolManager,
use the last NetworkProcess object that has been created.

* NetworkProcess/CustomProtocols/Cocoa/LegacyCustomProtocolManagerCocoa.mm:
(newestNetworkProcess):
(LegacyCustomProtocolManager::networkProcessCreated):
(+[WKCustomProtocol canInitWithRequest:]):
(-[WKCustomProtocol initWithRequest:cachedResponse:client:]):
(-[WKCustomProtocol startLoading]):
(-[WKCustomProtocol stopLoading]):
* NetworkProcess/CustomProtocols/LegacyCustomProtocolManager.cpp:
(WebKit::LegacyCustomProtocolManager::LegacyCustomProtocolManager):
(WebKit::LegacyCustomProtocolManager::startLoading):
(WebKit::LegacyCustomProtocolManager::stopLoading):
* NetworkProcess/CustomProtocols/LegacyCustomProtocolManager.h:
* NetworkProcess/NetworkProcess.cpp:
(WebKit::NetworkProcess::NetworkProcess):

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

7 months agoFix WinCairo build after r240014
achristensen@apple.com [Wed, 16 Jan 2019 04:27:04 +0000 (04:27 +0000)]
Fix WinCairo build after r240014
https://bugs.webkit.org/show_bug.cgi?id=161106

* NetworkProcess/curl/NetworkDataTaskCurl.cpp:

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

7 months agoFix Windows build after r240014
achristensen@apple.com [Wed, 16 Jan 2019 04:20:48 +0000 (04:20 +0000)]
Fix Windows build after r240014
https://bugs.webkit.org/show_bug.cgi?id=161106

* WebView.cpp:

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

7 months agoVisualViewport API should be updated upon opening of keyboard
rniwa@webkit.org [Wed, 16 Jan 2019 03:35:59 +0000 (03:35 +0000)]
VisualViewport API should be updated upon opening of keyboard
https://bugs.webkit.org/show_bug.cgi?id=193475

Reviewed by Simon Fraser.

Source/WebCore:

Added a function to update the visual viewport API and schedule a resize event to FrameView.

Test: fast/visual-viewport/ios/resize-event-for-keyboard.html

* page/FrameView.cpp:
(WebCore::FrameView::didUpdateViewportOverrideRects):
* page/FrameView.h:

Source/WebKit:

The bug was caused by the changes to unobscuredContentRectRespectingInputViewBounds not updating the visual viewport
unless it caused a layout to happen. Added a code to update the visual viewport in WebPage::updateVisibleContentRects.

Also fixed the bug that VisibleContentRectUpdateInfo::operator== was not checking differences in
unobscuredContentRectRespectingInputViewBounds which resulted in the visual viewport override not getting updated
while the keyboard is getting brought up.

* Shared/VisibleContentRectUpdateInfo.h:
(WebKit::operator==):
* WebProcess/WebPage/ios/WebPageIOS.mm:
(WebKit::WebPage::updateVisibleContentRects):

LayoutTests:

Added a regression test.

* fast/visual-viewport/ios/resize-event-for-keyboard-expected.txt: Added.
* fast/visual-viewport/ios/resize-event-for-keyboard.html: Added.

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

7 months agoFix build after r240018
mmaxfield@apple.com [Wed, 16 Jan 2019 03:27:11 +0000 (03:27 +0000)]
Fix build after r240018
https://bugs.webkit.org/show_bug.cgi?id=193434

Unreviewed.

* Modules/webgpu/WHLSL/WHLSLLoopChecker.cpp:
(WebCore::WHLSL::checkLoops):
(WebCore::WHLSL::findHighZombies): Deleted.
* Modules/webgpu/WHLSL/WHLSLLoopChecker.h:

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

7 months agoFix API test WebKit.WebsiteDataStoreCustomPathsWithoutPrewarming after 193354
sihui_liu@apple.com [Wed, 16 Jan 2019 03:09:22 +0000 (03:09 +0000)]
Fix API test WebKit.WebsiteDataStoreCustomPathsWithoutPrewarming after 193354
https://bugs.webkit.org/show_bug.cgi?id=193451

Reviewed by Geoffrey Garen.

* TestWebKitAPI/Tests/WebKitCocoa/DuplicateCompletionHandlerCalls.mm:
(TEST):
* TestWebKitAPI/Tests/WebKitCocoa/WebsiteDataStoreCustomPaths.mm:
(runWebsiteDataStoreCustomPaths):

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

7 months ago[JSC] Use KnownStringUse for GetByVal(Array::String) since AI would offer wider type...
yusukesuzuki@slowstart.org [Wed, 16 Jan 2019 02:17:31 +0000 (02:17 +0000)]
[JSC] Use KnownStringUse for GetByVal(Array::String) since AI would offer wider type information and offer non-string type after removing Check(String)
https://bugs.webkit.org/show_bug.cgi?id=193438
<rdar://problem/45581249>

Reviewed by Saam Barati and Keith Miller.

JSTests:

Under the heavy load (like, compiling WebKit), AI in this code can broaden type information after the 1st run.
Then, GetByVal(String) crashed.

* stress/string-get-by-val-lowering.js: Added.
(shouldBe):
(test):
* stress/type-for-get-by-val-can-be-widen-after-ai.js: Added.
(Hello):
(foo):

Source/JavaScriptCore:

GetByVal(Array::String) emits Check(String) before that. But AI can broaden type constraint in the second run.
After the first run removes Check(String), it would happen that AI starts saying the type of 1st child is not String.
To claim that it *is* a String type, we should use KnownStringUse here.

* dfg/DFGFixupPhase.cpp:
(JSC::DFG::FixupPhase::fixupNode): StringCharAt and GetByVal(Array::String) share the underlying compiler code. We should
change StringUse => KnownStringUse for StringCharAt too. And StringCharAt and StringCharCodeAt potentially have the same
problem. This patch fixes it too.
* dfg/DFGSSALoweringPhase.cpp:
(JSC::DFG::SSALoweringPhase::lowerBoundsCheck):
* ftl/FTLLowerDFGToB3.cpp:
(JSC::FTL::DFG::LowerDFGToB3::compileStringCharAt):
(JSC::FTL::DFG::LowerDFGToB3::compileStringCharCodeAt):

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

7 months agoTry ripping out inferred types because it might be a performance improvement
sbarati@apple.com [Wed, 16 Jan 2019 01:41:42 +0000 (01:41 +0000)]
Try ripping out inferred types because it might be a performance improvement
https://bugs.webkit.org/show_bug.cgi?id=190906

Reviewed by Yusuke Suzuki.

This patch removes inferred types from JSC. Initial evidence shows that
this might be around a ~1% speedup on Speedometer2 and JetStream2.

* JavaScriptCore.xcodeproj/project.pbxproj:
* Sources.txt:
* bytecode/AccessCase.cpp:
(JSC::AccessCase::generateImpl):
* bytecode/Fits.h:
* bytecode/PutByIdFlags.cpp:
(WTF::printInternal):
* bytecode/PutByIdFlags.h:
* bytecode/PutByIdStatus.cpp:
(JSC::PutByIdStatus::computeFromLLInt):
(JSC::PutByIdStatus::computeForStubInfo):
(JSC::PutByIdStatus::computeFor):
* bytecode/PutByIdVariant.cpp:
(JSC::PutByIdVariant::operator=):
(JSC::PutByIdVariant::replace):
(JSC::PutByIdVariant::transition):
(JSC::PutByIdVariant::setter):
(JSC::PutByIdVariant::attemptToMerge):
(JSC::PutByIdVariant::dumpInContext const):
* bytecode/PutByIdVariant.h:
(JSC::PutByIdVariant::requiredType const): Deleted.
* dfg/DFGAbstractInterpreterInlines.h:
(JSC::DFG::AbstractInterpreter<AbstractStateType>::executeEffects):
* dfg/DFGAbstractValue.cpp:
(JSC::DFG::AbstractValue::isType const): Deleted.
* dfg/DFGAbstractValue.h:
* dfg/DFGByteCodeParser.cpp:
(JSC::DFG::ByteCodeParser::handleGetByOffset):
(JSC::DFG::ByteCodeParser::handlePutByOffset):
(JSC::DFG::ByteCodeParser::load):
(JSC::DFG::ByteCodeParser::store):
(JSC::DFG::ByteCodeParser::handlePutById):
(JSC::DFG::ByteCodeParser::parseBlock):
* dfg/DFGConstantFoldingPhase.cpp:
(JSC::DFG::ConstantFoldingPhase::foldConstants):
(JSC::DFG::ConstantFoldingPhase::emitGetByOffset):
(JSC::DFG::ConstantFoldingPhase::emitPutByOffset):
* dfg/DFGDesiredInferredType.h: Removed.
* dfg/DFGDesiredWatchpoints.cpp:
(JSC::DFG::DesiredWatchpoints::reallyAdd):
(JSC::DFG::DesiredWatchpoints::areStillValid const):
(JSC::DFG::DesiredWatchpoints::dumpInContext const):
(JSC::DFG::InferredTypeAdaptor::add): Deleted.
* dfg/DFGDesiredWatchpoints.h:
(JSC::DFG::DesiredWatchpoints::isWatched):
(JSC::DFG::InferredTypeAdaptor::hasBeenInvalidated): Deleted.
(JSC::DFG::InferredTypeAdaptor::dumpInContext): Deleted.
* dfg/DFGFixupPhase.cpp:
(JSC::DFG::FixupPhase::fixupNode):
* dfg/DFGGraph.cpp:
(JSC::DFG::Graph::dump):
(JSC::DFG::Graph::inferredValueForProperty):
(JSC::DFG::Graph::inferredTypeFor): Deleted.
* dfg/DFGGraph.h:
(JSC::DFG::Graph::registerInferredType): Deleted.
(JSC::DFG::Graph::inferredTypeForProperty): Deleted.
* dfg/DFGInferredTypeCheck.cpp: Removed.
* dfg/DFGInferredTypeCheck.h: Removed.
* dfg/DFGNode.h:
* dfg/DFGObjectAllocationSinkingPhase.cpp:
* dfg/DFGSafeToExecute.h:
(JSC::DFG::safeToExecute):
* ftl/FTLLowerDFGToB3.cpp:
(JSC::FTL::DFG::LowerDFGToB3::compileMultiPutByOffset):
(JSC::FTL::DFG::LowerDFGToB3::checkInferredType): Deleted.
* generator/DSL.rb:
* heap/Heap.cpp:
(JSC::Heap::finalizeUnconditionalFinalizers):
* jit/AssemblyHelpers.cpp:
(JSC::AssemblyHelpers::branchIfNotType): Deleted.
* jit/AssemblyHelpers.h:
* jit/Repatch.cpp:
(JSC::tryCachePutByID):
* llint/LLIntOffsetsExtractor.cpp:
* llint/LLIntSlowPaths.cpp:
(JSC::LLInt::LLINT_SLOW_PATH_DECL):
* llint/LowLevelInterpreter.asm:
* llint/LowLevelInterpreter32_64.asm:
* llint/LowLevelInterpreter64.asm:
* runtime/InferredStructure.cpp:
(JSC::InferredStructure::InferredStructure): Deleted.
* runtime/InferredStructure.h:
(): Deleted.
* runtime/InferredStructureWatchpoint.cpp:
(JSC::InferredStructureWatchpoint::fireInternal): Deleted.
* runtime/InferredType.cpp: Removed.
* runtime/InferredType.h: Removed.
* runtime/InferredTypeInlines.h: Removed.
* runtime/InferredTypeTable.cpp: Removed.
* runtime/InferredTypeTable.h: Removed.
* runtime/JSObjectInlines.h:
(JSC::JSObject::putDirectInternal):
* runtime/Structure.cpp:
(JSC::Structure::materializePropertyTable):
(JSC::Structure::addNewPropertyTransition):
(JSC::Structure::removePropertyTransition):
(JSC::Structure::willStoreValueSlow):
(JSC::Structure::visitChildren):
* runtime/Structure.h:
(JSC::PropertyMapEntry::PropertyMapEntry):
* runtime/StructureInlines.h:
(JSC::Structure::get):
* runtime/VM.cpp:
(JSC::VM::VM):
* runtime/VM.h:

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

7 months agowebkitpy: Support boolean simctl isAvailable
jbedard@apple.com [Wed, 16 Jan 2019 01:35:19 +0000 (01:35 +0000)]
webkitpy: Support boolean simctl isAvailable
https://bugs.webkit.org/show_bug.cgi?id=193472
<rdar://problem/47296150>

Reviewed by Ryosuke Niwa.

* Scripts/webkitpy/xcode/simulated_device.py:
(SimulatedDeviceManager._create_runtimes):
(SimulatedDeviceManager._create_device_with_runtime):

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

7 months agoAdd Reveal support in iOSMac
megan_gardner@apple.com [Wed, 16 Jan 2019 01:19:19 +0000 (01:19 +0000)]
Add Reveal support in iOSMac
https://bugs.webkit.org/show_bug.cgi?id=193408
<rdar://problem/47300699>

Reviewed by Tim Horton.

Source/WebCore:

iOSMac and Reveal are currently not testable.

Add support for the reveal SPI specifically for iOSMac.
Show the controller when called, and implement the delegate to
correctly re-paint the content with the auto-generated highlight from
the reveal framework.

* Configurations/WebCore.xcconfig:
* editing/cocoa/DictionaryLookup.mm:
(-[WebRevealHighlight initWithHighlightRect:view:]):
(-[WebRevealHighlight setImage:]):
(-[WebRevealHighlight highlightRectsForItem:]):
(-[WebRevealHighlight startHighlightingItem:]):
(-[WebRevealHighlight highlightItem:withProgress:]):
(-[WebRevealHighlight completeHighlightingItem:]):
(-[WebRevealHighlight stopHighlightingItem:]):
(-[WebRevealHighlight highlightRangeChangedForItem:]):
(-[WebRevealHighlight highlighting]):
(-[WebRevealHighlight drawHighlightContentForItem:context:]):
(WebCore::showPopupOrCreateAnimationController):
(WebCore::DictionaryLookup::showPopup):
* editing/mac/DictionaryLookup.h:

Source/WebCore/PAL:

Add additional needed SPI.

* pal/spi/cocoa/RevealSPI.h:

Source/WebKit:

Add calls to DictionaryLookup from the appropriate places.

* UIProcess/PageClient.h:
* UIProcess/ios/PageClientImplIOS.h:
* UIProcess/ios/PageClientImplIOS.mm:
(WebKit::PageClientImpl::didPerformDictionaryLookup):
* UIProcess/ios/WebPageProxyIOS.mm:
(WebKit::WebPageProxy::didPerformDictionaryLookup):
* WebProcess/WebPage/Cocoa/WebPageCocoa.mm:
(WebKit::WebPage::dictionaryPopupInfoForRange):

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

7 months ago[WHLSL] Add ending namespace comments to make namespace boundaries more clear
mmaxfield@apple.com [Wed, 16 Jan 2019 01:14:21 +0000 (01:14 +0000)]
[WHLSL] Add ending namespace comments to make namespace boundaries more clear
https://bugs.webkit.org/show_bug.cgi?id=193471

Reviewed by Saam Barati.

This patch only adds the comments to the files that are too long to fit on a single screen in my editor.

No new tests because there is no behavior change.

* Modules/webgpu/WHLSL/WHLSLCheckDuplicateFunctions.cpp:
* Modules/webgpu/WHLSL/WHLSLChecker.cpp:
* Modules/webgpu/WHLSL/WHLSLGatherEntryPointItems.cpp:
* Modules/webgpu/WHLSL/WHLSLGatherEntryPointItems.h:
* Modules/webgpu/WHLSL/WHLSLInferTypes.cpp:
* Modules/webgpu/WHLSL/WHLSLIntrinsics.cpp:
* Modules/webgpu/WHLSL/WHLSLIntrinsics.h:
* Modules/webgpu/WHLSL/WHLSLLexer.cpp:
* Modules/webgpu/WHLSL/WHLSLLexer.h:
* Modules/webgpu/WHLSL/WHLSLLoopChecker.cpp:
* Modules/webgpu/WHLSL/WHLSLNameContext.cpp:
* Modules/webgpu/WHLSL/WHLSLNameResolver.cpp:
* Modules/webgpu/WHLSL/WHLSLNameResolver.h:
* Modules/webgpu/WHLSL/WHLSLParser.h:
* Modules/webgpu/WHLSL/WHLSLProgram.h:
* Modules/webgpu/WHLSL/WHLSLRecursiveTypeChecker.cpp:
* Modules/webgpu/WHLSL/WHLSLResolveOverloadImpl.cpp:
* Modules/webgpu/WHLSL/WHLSLSynthesizeArrayOperatorLength.cpp:
* Modules/webgpu/WHLSL/WHLSLSynthesizeConstructors.cpp:
* Modules/webgpu/WHLSL/WHLSLSynthesizeEnumerationFunctions.cpp:
* Modules/webgpu/WHLSL/WHLSLSynthesizeStructureAccessors.cpp:
* Modules/webgpu/WHLSL/WHLSLVisitor.cpp:
* Modules/webgpu/WHLSL/WHLSLVisitor.h:

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

7 months ago[SOUP] Remove usage of NetworkProcess::singleton()
achristensen@apple.com [Wed, 16 Jan 2019 00:35:26 +0000 (00:35 +0000)]
[SOUP] Remove usage of NetworkProcess::singleton()
https://bugs.webkit.org/show_bug.cgi?id=193444

Patch by Claudio Saavedra <csaavedra@igalia.com> on 2019-01-15
Reviewed by Michael Catanzaro.

* NetworkProcess/soup/NetworkDataTaskSoup.cpp:
(WebKit::NetworkDataTaskSoup::download):
(WebKit::NetworkDataTaskSoup::didWriteDownload):
(WebKit::NetworkDataTaskSoup::didFinishDownload):
(WebKit::NetworkDataTaskSoup::didFailDownload):
* NetworkProcess/soup/NetworkSessionSoup.cpp:
(WebKit::NetworkSessionSoup::NetworkSessionSoup):

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

7 months ago[WHLSL] Implement the loop checker
mmaxfield@apple.com [Wed, 16 Jan 2019 00:27:00 +0000 (00:27 +0000)]
[WHLSL] Implement the loop checker
https://bugs.webkit.org/show_bug.cgi?id=193434

Reviewed by Saam Barati.

This is a translation of https://github.com/gpuweb/WHLSL/blob/master/Source/LoopChecker.mjs into C++.

No new tests because it isn't hooked up yet. Not enough of the compiler exists to have any meaningful sort
of test. When enough of the compiler is present, I'll port the reference implementation's test suite.

* Modules/webgpu/WHLSL/WHLSLLoopChecker.cpp: Added.
(WebCore::WHLSL::findHighZombies):
* Modules/webgpu/WHLSL/WHLSLLoopChecker.h: Added.
* Sources.txt:
* WebCore.xcodeproj/project.pbxproj:

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

7 months agoFix incorrect ASSERT added in r239840
eric.carlson@apple.com [Wed, 16 Jan 2019 00:08:52 +0000 (00:08 +0000)]
Fix incorrect ASSERT added in r239840
https://bugs.webkit.org/show_bug.cgi?id=193466
<rdar://problem/47095142>

Reviewed by Youenn Fablet.

* WebProcess/cocoa/UserMediaCaptureManager.cpp:
(WebKit::UserMediaCaptureManager::Source::Source):

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

7 months agoFrequent null-deref under TiledCoreAnimationDrawingArea::scaleViewToFitDocumentIfNeeded()
timothy_horton@apple.com [Tue, 15 Jan 2019 23:55:36 +0000 (23:55 +0000)]
Frequent null-deref under TiledCoreAnimationDrawingArea::scaleViewToFitDocumentIfNeeded()
https://bugs.webkit.org/show_bug.cgi?id=193468
<rdar://problem/38645869>

Reviewed by Beth Dakin.

* WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm:
(WebKit::TiledCoreAnimationDrawingArea::scaleViewToFitDocumentIfNeeded):
I'm not sure why this got *worse*, but we should null-check RenderView.
It's OK to bail from scaleViewToFitDocumentIfNeeded, we'll re-do it
the next time we paint (which will surely happen if we gain a RenderView).

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

7 months agoUnreviewed, rolling out r239993, r239995, r239997, and
cdumez@apple.com [Tue, 15 Jan 2019 23:48:31 +0000 (23:48 +0000)]
Unreviewed, rolling out r239993, r239995, r239997, and
r239999.

Caused assertions under
ViewGestureController::disconnectFromProcess()

Reverted changesets:

"Regression(PSON) View becomes blank after click a cross-site
download link"
https://bugs.webkit.org/show_bug.cgi?id=193361
https://trac.webkit.org/changeset/239993

"Unreviewed iOS build fix after r239993."
https://trac.webkit.org/changeset/239995

"Fix iOS build after r239993"
https://bugs.webkit.org/show_bug.cgi?id=193361
https://trac.webkit.org/changeset/239997

"Unreviewed, revert part of r239997 as it is not needed to fix
the build."
https://trac.webkit.org/changeset/239999

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

7 months agoStop using CookiesStrategy
achristensen@apple.com [Tue, 15 Jan 2019 23:31:33 +0000 (23:31 +0000)]
Stop using CookiesStrategy
https://bugs.webkit.org/show_bug.cgi?id=161106

Reviewed by Don Olmstead and Antti Koivisto.

Source/WebCore:

CookiesStrategy is process-global and makes it difficult to switch NetworkStorageSession from having a process-global map.
Instead, use a CookieJar object in the WebProcess.  This has the additional benefit of making it more clear which code
is used in the WebProcess and which code is used in the NetworkProcess.

* Modules/beacon/NavigatorBeacon.cpp:
* Modules/websockets/WebSocketChannel.cpp:
(WebCore::WebSocketChannel::processBuffer):
* Modules/websockets/WebSocketHandshake.cpp:
(WebCore::WebSocketHandshake::clientHandshakeRequest const):
(WebCore::WebSocketHandshake::clientHandshakeCookieRequestHeaderFieldProxy const):
* WebCore.xcodeproj/project.pbxproj:
* css/StyleRuleImport.cpp:
(WebCore::StyleRuleImport::requestStyleSheet):
* dom/Document.cpp:
(WebCore::Document::cookie):
(WebCore::Document::setCookie):
* html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::mediaPlayerGetRawCookies const):
* inspector/agents/InspectorPageAgent.cpp:
(WebCore::InspectorPageAgent::getCookies):
(WebCore::InspectorPageAgent::deleteCookie):
* loader/CookieJar.cpp:
(WebCore::CookieJar::shouldIncludeSecureCookies):
(WebCore::CookieJar::sameSiteInfo):
(WebCore::CookieJar::create):
(WebCore::CookieJar::cookies const):
(WebCore::CookieJar::cookieRequestHeaderFieldProxy):
(WebCore::CookieJar::setCookies):
(WebCore::CookieJar::cookiesEnabled const):
(WebCore::CookieJar::cookieRequestHeaderFieldValue const):
(WebCore::CookieJar::getRawCookies const):
(WebCore::CookieJar::deleteCookie):
(WebCore::shouldIncludeSecureCookies): Deleted.
(WebCore::sameSiteInfo): Deleted.
(WebCore::cookies): Deleted.
(WebCore::cookieRequestHeaderFieldProxy): Deleted.
(WebCore::setCookies): Deleted.
(WebCore::cookiesEnabled): Deleted.
(WebCore::cookieRequestHeaderFieldValue): Deleted.
(WebCore::getRawCookies): Deleted.
(WebCore::deleteCookie): Deleted.
* loader/CookieJar.h:
* loader/EmptyClients.cpp:
(WebCore::pageConfigurationWithEmptyClients):
* loader/ImageLoader.cpp:
(WebCore::ImageLoader::updateFromElement):
* loader/cache/CachedApplicationManifest.cpp:
(WebCore::CachedApplicationManifest::CachedApplicationManifest):
* loader/cache/CachedApplicationManifest.h:
* loader/cache/CachedCSSStyleSheet.cpp:
(WebCore::CachedCSSStyleSheet::CachedCSSStyleSheet):
* loader/cache/CachedCSSStyleSheet.h:
* loader/cache/CachedFont.cpp:
(WebCore::CachedFont::CachedFont):
* loader/cache/CachedFont.h:
* loader/cache/CachedImage.cpp:
(WebCore::CachedImage::CachedImage):
* loader/cache/CachedImage.h:
* loader/cache/CachedRawResource.cpp:
(WebCore::CachedRawResource::CachedRawResource):
* loader/cache/CachedRawResource.h:
* loader/cache/CachedResource.cpp:
(WebCore::CachedResource::CachedResource):
(WebCore::CachedResource::setResponse):
(WebCore::CachedResource::varyHeaderValuesMatch):
* loader/cache/CachedResource.h:
(WebCore::CachedResource::cookieJar const):
* loader/cache/CachedResourceLoader.cpp:
(WebCore::createResource):
(WebCore::CachedResourceLoader::requestUserCSSStyleSheet):
(WebCore::CachedResourceLoader::updateCachedResourceWithCurrentRequest):
(WebCore::CachedResourceLoader::requestResource):
(WebCore::CachedResourceLoader::revalidateResource):
(WebCore::CachedResourceLoader::loadResource):
* loader/cache/CachedResourceLoader.h:
* loader/cache/CachedSVGDocument.cpp:
(WebCore::CachedSVGDocument::CachedSVGDocument):
* loader/cache/CachedSVGDocument.h:
* loader/cache/CachedSVGFont.cpp:
(WebCore::CachedSVGFont::CachedSVGFont):
* loader/cache/CachedSVGFont.h:
* loader/cache/CachedScript.cpp:
(WebCore::CachedScript::CachedScript):
* loader/cache/CachedScript.h:
* loader/cache/CachedTextTrack.cpp:
(WebCore::CachedTextTrack::CachedTextTrack):
* loader/cache/CachedTextTrack.h:
* loader/cache/CachedXSLStyleSheet.cpp:
(WebCore::CachedXSLStyleSheet::CachedXSLStyleSheet):
* loader/cache/CachedXSLStyleSheet.h:
* loader/cache/MemoryCache.cpp:
(WebCore::MemoryCache::addImageToCache):
* loader/cache/MemoryCache.h:
* page/Navigator.cpp:
(WebCore::Navigator::cookieEnabled const):
* page/Page.cpp:
(WebCore::Page::Page):
* page/Page.h:
(WebCore::Page::cookieJar):
* page/PageConfiguration.cpp:
(WebCore::PageConfiguration::PageConfiguration):
* page/PageConfiguration.h:
* platform/CookiesStrategy.h: Removed.
* platform/PlatformStrategies.h:
(WebCore::PlatformStrategies::cookiesStrategy): Deleted.
* platform/network/CacheValidation.cpp:
(WebCore::cookieRequestHeaderFieldValue):
(WebCore::collectVaryingRequestHeaders):
(WebCore::verifyVaryingRequestHeaders):
* platform/network/CacheValidation.h:
* platform/network/CookieRequestHeaderFieldProxy.h:
* platform/network/cf/NetworkStorageSessionCFNetWin.cpp:
* platform/network/cocoa/NetworkStorageSessionCocoa.mm:
* platform/network/curl/ResourceHandleCurl.cpp:
* rendering/RenderSnapshottedPlugIn.cpp:
(WebCore::RenderSnapshottedPlugIn::updateSnapshot):
* testing/Internals.cpp:
(WebCore::Internals::getCookies const):

Source/WebKit:

* NetworkProcess/NetworkProcessPlatformStrategies.cpp:
(WebKit::NetworkProcessPlatformStrategies::createCookiesStrategy): Deleted.
* NetworkProcess/NetworkProcessPlatformStrategies.h:
* NetworkProcess/curl/NetworkDataTaskCurl.cpp:
* Scripts/webkit/messages.py:
* Sources.txt:
* WebKit.xcodeproj/project.pbxproj:
* WebProcess/Automation/WebAutomationSessionProxy.cpp:
(WebKit::WebAutomationSessionProxy::getCookiesForFrame):
(WebKit::WebAutomationSessionProxy::deleteCookie):
* WebProcess/Plugins/PluginView.cpp:
(WebKit::PluginView::cookiesForURL):
(WebKit::PluginView::setCookiesForURL):
* WebProcess/WebCoreSupport/WebPlatformStrategies.cpp:
(WebKit::WebPlatformStrategies::createCookiesStrategy): Deleted.
(WebKit::WebPlatformStrategies::cookiesForDOM): Deleted.
(WebKit::WebPlatformStrategies::setCookiesFromDOM): Deleted.
(WebKit::WebPlatformStrategies::cookiesEnabled): Deleted.
(WebKit::WebPlatformStrategies::cookieRequestHeaderFieldValue): Deleted.
(WebKit::WebPlatformStrategies::getRawCookies): Deleted.
(WebKit::WebPlatformStrategies::deleteCookie): Deleted.
* WebProcess/WebCoreSupport/WebPlatformStrategies.h:
* WebProcess/WebPage/WebCookieJar.cpp: Added.
(WebKit::WebCookieJar::cookies const):
(WebKit::WebCookieJar::setCookies):
(WebKit::WebCookieJar::cookiesEnabled const):
(WebKit::WebCookieJar::cookieRequestHeaderFieldValue const):
(WebKit::WebCookieJar::getRawCookies const):
(WebKit::WebCookieJar::deleteCookie):
* WebProcess/WebPage/WebCookieJar.h: Added.
* WebProcess/WebPage/WebPage.cpp:
(WebKit::m_shouldAttachDrawingAreaOnPageTransition):

Source/WebKitLegacy/mac:

* Misc/WebCache.mm:
(+[WebCache addImageToCache:forURL:forFrame:]):
* Plugins/Hosted/NetscapePluginInstanceProxy.mm:
(WebKit::NetscapePluginInstanceProxy::getCookies):
(WebKit::NetscapePluginInstanceProxy::setCookies):
* Plugins/WebNetscapePluginView.mm:
(-[WebNetscapePluginView getVariable:forURL:value:length:]):
(-[WebNetscapePluginView setVariable:forURL:value:length:]):
* WebCoreSupport/WebPlatformStrategies.h:
* WebCoreSupport/WebPlatformStrategies.mm:
(WebPlatformStrategies::createCookiesStrategy): Deleted.
(WebPlatformStrategies::cookiesForDOM): Deleted.
(WebPlatformStrategies::setCookiesFromDOM): Deleted.
(WebPlatformStrategies::cookiesEnabled): Deleted.
(WebPlatformStrategies::cookieRequestHeaderFieldValue): Deleted.
(WebPlatformStrategies::getRawCookies): Deleted.
(WebPlatformStrategies::deleteCookie): Deleted.
* WebView/WebView.mm:
(-[WebView _commonInitializationWithFrameName:groupName:]):
(-[WebView initSimpleHTMLDocumentWithStyle:frame:preferences:groupName:]):

Source/WebKitLegacy/win:

* Plugins/PluginView.cpp:
(WebCore::PluginView::getValueForURL):
(WebCore::PluginView::setValueForURL):
* WebCoreSupport/WebPlatformStrategies.cpp:
(WebPlatformStrategies::createBlobRegistry):
(WebPlatformStrategies::createCookiesStrategy): Deleted.
(WebPlatformStrategies::cookiesForDOM): Deleted.
(WebPlatformStrategies::setCookiesFromDOM): Deleted.
(WebPlatformStrategies::cookiesEnabled): Deleted.
(WebPlatformStrategies::cookieRequestHeaderFieldValue): Deleted.
(WebPlatformStrategies::getRawCookies): Deleted.
(WebPlatformStrategies::deleteCookie): Deleted.
* WebCoreSupport/WebPlatformStrategies.h:
* WebView.cpp:
(WebView::initWithFrame):

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

7 months agoRemove reporting for iOS mach lookups confirmed in-use
pvollan@apple.com [Tue, 15 Jan 2019 23:13:10 +0000 (23:13 +0000)]
Remove reporting for iOS mach lookups confirmed in-use
https://bugs.webkit.org/show_bug.cgi?id=193455
<rdar://problem/47259551>

Reviewed by Brent Fulgham.

* Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:

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

7 months agoAnimations should only trigger layer recomposite when necessary
simon.fraser@apple.com [Tue, 15 Jan 2019 23:06:11 +0000 (23:06 +0000)]
Animations should only trigger layer recomposite when necessary
https://bugs.webkit.org/show_bug.cgi?id=193450

Reviewed by Antoine Quint.

Animations only need to trigger compositing updates when their states change in a way
that affects compositing. RenderLayerCompositor::requiresCompositingForAnimation() checks for
running animations of properties that can be accelerated, so this patch fixes the legacy
animation logic to only set 'shouldRecompositeLayer' in TreeResolver::createAnimatedElementUpdate()
when the running state of such an animation changes.

ImplicitAnimation::animate() and KeyframeAnimation::animate() now return OptionSet<AnimateChange>.
This contains information about whether the running state changed, so CompositeAnimation::animate()
asks about whether the running state of an accelerated property changed, and returns this in
the AnimationUpdate result.

* page/animation/AnimationBase.h:
(WebCore::AnimationBase::isPausedState):
(WebCore::AnimationBase::isRunningState):
(WebCore::AnimationBase::inPausedState const):
(WebCore::AnimationBase::inRunningState const):
(WebCore::AnimationBase::isAnimatingProperty const):
* page/animation/CSSAnimationController.h:
* page/animation/CompositeAnimation.cpp:
(WebCore::CompositeAnimation::animate):
* page/animation/ImplicitAnimation.cpp:
(WebCore::ImplicitAnimation::animate):
(WebCore::ImplicitAnimation::affectsAcceleratedProperty const):
* page/animation/ImplicitAnimation.h:
* page/animation/KeyframeAnimation.cpp:
(WebCore::KeyframeAnimation::KeyframeAnimation):
(WebCore::KeyframeAnimation::animate):
(WebCore::KeyframeAnimation::computeStackingContextImpact): Deleted.
* page/animation/KeyframeAnimation.h:
* style/StyleTreeResolver.cpp:
(WebCore::Style::TreeResolver::createAnimatedElementUpdate):

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

7 months agoClean up code related to the updating of Dashboard and touch event regions
simon.fraser@apple.com [Tue, 15 Jan 2019 22:57:27 +0000 (22:57 +0000)]
Clean up code related to the updating of Dashboard and touch event regions
https://bugs.webkit.org/show_bug.cgi?id=193460

Reviewed by Zalan Bujtas.

In preparation for layout testing that can count the number of event region
updates, move the code related to updating "annotated" (Dashboard) regions, and
touch event regions into bottleneck functions in Document.

Updating these two kinds of regions is generally similar, but there are some code paths
that eagerly update annotated regions.

No behavior change.

* dom/Document.cpp:
(WebCore::Document::updateAnnotatedRegions): Moved from FrameView.
(WebCore::Document::invalidateRenderingDependentRegions):
(WebCore::Document::invalidateScrollbarDependentRegions):
(WebCore::Document::updateZOrderDependentRegions):
* dom/Document.h:
(WebCore::Document::setAnnotatedRegionsDirty):
(WebCore::Document::annotatedRegionsDirty const):
(WebCore::Document::hasAnnotatedRegions const):
* page/FrameView.cpp:
(WebCore::FrameView::didLayout):
(WebCore::FrameView::didPaintContents):
(WebCore::FrameView::updateAnnotatedRegions): Deleted.
* page/FrameView.h:
* rendering/RenderElement.cpp: Drive-by header cleanup.
(WebCore::RenderElement::styleWillChange):
* rendering/RenderLayer.cpp:
(WebCore::RenderLayer::scrollTo):
(WebCore::RenderLayer::setHasHorizontalScrollbar):
(WebCore::RenderLayer::setHasVerticalScrollbar):
(WebCore::RenderLayer::updateScrollbarsAfterLayout):
(WebCore::RenderLayer::calculateClipRects const):
* rendering/RenderListBox.cpp:
(WebCore::RenderListBox::setHasVerticalScrollbar):

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

7 months agoCannot tab out of WKWebView on macOS
timothy_horton@apple.com [Tue, 15 Jan 2019 22:53:39 +0000 (22:53 +0000)]
Cannot tab out of WKWebView on macOS
https://bugs.webkit.org/show_bug.cgi?id=161448
<rdar://problem/28100085>

Reviewed by Dean Jackson.

Source/WebCore/PAL:

* pal/spi/mac/NSViewSPI.h:
* pal/spi/mac/NSWindowSPI.h:
Move some SPI declarations in here from WebKitLegacy.

Source/WebKit:

* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::takeFocus):
If the UIDelegate doesn't implement takeFocus, provide a simple default
implementation that just uses AppKit's key view loop to move the focus.

* UIProcess/API/APIUIClient.h:
(API::UIClient::takeFocus):
* UIProcess/API/C/WKPage.cpp:
(WKPageSetPageUIClient):
* UIProcess/Cocoa/UIDelegate.h:
* UIProcess/Cocoa/UIDelegate.mm:
(WebKit::UIDelegate::UIClient::takeFocus):
Make API::UIClient's takeFocus return a bool indicating whether the
client implements it or not.

* UIProcess/PageClient.h:
* UIProcess/mac/PageClientImplMac.h:
* UIProcess/mac/PageClientImplMac.mm:
(WebKit::PageClientImpl::takeFocus):
Plumb takeFocus to WebViewImpl.

* UIProcess/Cocoa/WebViewImpl.h:
* UIProcess/Cocoa/WebViewImpl.mm:
(WebKit::WebViewImpl::takeFocus):
Borrow the relevant portion of WebKitLegacy's implementation of takeFocus,
shifting focus to the next/previous key view in the window.

Source/WebKitLegacy/mac:

* WebCoreSupport/WebChromeClient.mm:
* WebView/WebView.mm:
Make use of SPI headers.

Tools:

Add a test that tabbing into and out of WKWebView works correctly.

* TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
* TestWebKitAPI/Tests/WebKitCocoa/CommandBackForward.mm:
(WebKit2_CommandBackForwardTest::SetUp):
(-[CommandBackForwardOffscreenWindow isKeyWindow]): Deleted.
(-[CommandBackForwardOffscreenWindow isVisible]): Deleted.
* TestWebKitAPI/Tests/WebKitCocoa/TabOutOfWebView.mm: Added.
(-[FocusableView canBecomeKeyView]):
(TEST):
* TestWebKitAPI/mac/OffscreenWindow.h: Added.
* TestWebKitAPI/mac/OffscreenWindow.mm: Added.
(-[OffscreenWindow initWithSize:]):
(-[OffscreenWindow isKeyWindow]):
(-[OffscreenWindow isVisible]):
* TestWebKitAPI/mac/PlatformWebViewMac.mm:
(TestWebKitAPI::PlatformWebView::initialize):
(-[ActiveOffscreenWindow isKeyWindow]): Deleted.
(-[ActiveOffscreenWindow isVisible]): Deleted.
Factor ActiveOffscreenWindow out into OffscreenWindow and share it.

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

7 months agoRemove the specific handling of ephemeral sessions from CacheStorage::Engine::from
youenn@apple.com [Tue, 15 Jan 2019 22:34:34 +0000 (22:34 +0000)]
Remove the specific handling of ephemeral sessions from CacheStorage::Engine::from
https://bugs.webkit.org/show_bug.cgi?id=193400

Reviewed by Alex Christensen.

It is no longer needed as we correctly handle ephemeral sessions removal.

* NetworkProcess/cache/CacheStorageEngine.cpp:
(WebKit::CacheStorage::Engine::from):

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

7 months agoAdjust the arguments passed to run-javascriptcore-tests for the 32-bit JSC bot
ryanhaddad@apple.com [Tue, 15 Jan 2019 22:17:07 +0000 (22:17 +0000)]
Adjust the arguments passed to run-javascriptcore-tests for the 32-bit JSC bot
https://bugs.webkit.org/show_bug.cgi?id=193459

Reviewed by Mark Lam.

* BuildSlaveSupport/build.webkit.org-config/steps.py:
(Run32bitJSCTests): This queue should not run JIT, testair, testb3, or testmasm.

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

7 months agoLet Xcode have its way with the WebCore project
ddkilzer@apple.com [Tue, 15 Jan 2019 22:13:33 +0000 (22:13 +0000)]
Let Xcode have its way with the WebCore project

* WebCore.xcodeproj/project.pbxproj:
- Change the lastKnownFileType for *.gperf and *.idl files from
  "file" to "text".
- Resort source files into UUID order.

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

7 months agoREGRESSION (r239510): Remove duplicate copy of srtpsession.cc from 'webrtcpcrtc'...
ddkilzer@apple.com [Tue, 15 Jan 2019 22:13:30 +0000 (22:13 +0000)]
REGRESSION (r239510): Remove duplicate copy of srtpsession.cc from 'webrtcpcrtc' target in Xcode project

Fixes the following Xcode warning:

    warning: Skipping duplicate build file in Compile Sources build phase: Source/ThirdParty/libwebrtc/Source/webrtc/pc/srtpsession.cc (in target 'webrtcpcrtc')

* libwebrtc.xcodeproj/project.pbxproj: Remove duplicate copy of
srtpsession.cc from 'webrtcpcrtc' target.

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

7 months agoclang-tidy: Fix unnecessary copy of for loop variables in ANGLE
ddkilzer@apple.com [Tue, 15 Jan 2019 21:47:51 +0000 (21:47 +0000)]
clang-tidy: Fix unnecessary copy of for loop variables in ANGLE
<https://webkit.org/b/193443>

Reviewed by Alex Christensen.

Fix unwanted copying of loop variables by making them const
references.

* src/compiler/preprocessor/MacroExpander.cpp:
(pp::MacroExpander::ScopedMacroReenabler::~ScopedMacroReenabler):
- Prevents copy and reference churn of std::shared_ptr<Macro>
  objects.
* src/compiler/translator/Compiler.cpp:
(sh::TCompiler::useAllMembersInUnusedStandardAndSharedBlocks):
- Prevents copy of sh::InterfaceBlock structs.
(sh::TCompiler::initializeOutputVariables):
- Prevents copy of sh::Varying structs.
* src/libANGLE/Program.cpp:
(gl::(anonymous namespace)::IncludeSameArrayElement):
- Prevents copy of std::string objects.

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

7 months agoCorrectly handle rotation for local video playback
youenn@apple.com [Tue, 15 Jan 2019 21:21:02 +0000 (21:21 +0000)]
Correctly handle rotation for local video playback
https://bugs.webkit.org/show_bug.cgi?id=193412

Reviewed by Eric Carlson.

Update AVVideoCaptureSource to compute the size given to settings after rotating the sample.
This ensures computing the size of video elements appropriately.
Also makes sure to notify observers of size change whenever rotation happens as settings() call will provide a different size.
Covered by manual testing as we do not have yet emulation of local capture with rotation.

* platform/mediastream/RealtimeMediaSource.cpp:
(WebCore::RealtimeMediaSource::setIntrinsicSize):
* platform/mediastream/mac/AVVideoCaptureSource.mm:
(WebCore::AVVideoCaptureSource::settings):
(WebCore::AVVideoCaptureSource::computeSampleRotation):

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

7 months agoUnreviewed, revert part of r239997 as it is not needed to fix the build.
cdumez@apple.com [Tue, 15 Jan 2019 21:16:49 +0000 (21:16 +0000)]
Unreviewed, revert part of r239997 as it is not needed to fix the build.

* wtf/RefCounter.h:

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

7 months agoFix iOS build after r239993
achristensen@apple.com [Tue, 15 Jan 2019 20:29:50 +0000 (20:29 +0000)]
Fix iOS build after r239993
https://bugs.webkit.org/show_bug.cgi?id=193361

Source/WebKit:

* UIProcess/ProvisionalPageProxy.h:
* UIProcess/SuspendedPageProxy.h:

Source/WTF:

* wtf/RefCounter.h:

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

7 months ago[macOS] Adjust logging policy in WebKit's sandbox
pvollan@apple.com [Tue, 15 Jan 2019 20:28:36 +0000 (20:28 +0000)]
[macOS] Adjust logging policy in WebKit's sandbox
https://bugs.webkit.org/show_bug.cgi?id=193454
<rdar://problem/47256325>

Reviewed by Brent Fulgham.

* WebProcess/com.apple.WebProcess.sb.in:

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

7 months agoUnreviewed iOS build fix after r239993.
cdumez@apple.com [Tue, 15 Jan 2019 20:04:38 +0000 (20:04 +0000)]
Unreviewed iOS build fix after r239993.

* UIProcess/SuspendedPageProxy.h:

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

7 months agoAdd allow directive for MTLCompilerService.xpc to PluginProcess and WebContent
pvollan@apple.com [Tue, 15 Jan 2019 19:34:12 +0000 (19:34 +0000)]
Add allow directive for MTLCompilerService.xpc to PluginProcess and WebContent
https://bugs.webkit.org/show_bug.cgi?id=193453
<rdar://problem/47268166>

Reviewed by Brent Fulgham.

* PluginProcess/mac/com.apple.WebKit.plugin-common.sb.in:
* Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
* WebProcess/com.apple.WebProcess.sb.in:

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

7 months agoRegression(PSON) View becomes blank after click a cross-site download link
cdumez@apple.com [Tue, 15 Jan 2019 19:01:43 +0000 (19:01 +0000)]
Regression(PSON) View becomes blank after click a cross-site download link
https://bugs.webkit.org/show_bug.cgi?id=193361
<rdar://problem/47099573>

Reviewed by Geoff Garen.

Source/WebCore:

* loader/FrameLoader.cpp:
(WebCore::FrameLoader::commitProvisionalLoad):
When restoring from PageCache, make sure we notify the client that the load was committed
*before* we tell it that the navigation is complete. This would confuse the ProvisionalPageProxy
logic in the UIProcess.

Source/WebKit:

The issue tracked by rdar://problem/47099573 is that a provisional load may get
canceled (or converted into a download) *after* we've decided to process-swap.
In such cases, the view should keep displaying the current site and it should
still be interactive. However, with the previous PSON model, the view (pageProxy)
would have already swapped to the new process and would end up displaying the
initially empty document.

To address the issue, this patch introduces the concept of a provisional load
in the UIProcess, handled by a ProvisionalPageProxy which has its own privisional
process. The WebPageProxy owns the ProvisionalPageProxy but we do not commit the
provisional page until after the load was committed in the new process. This means
that the view / WebPageProxy keeps using the old process and displays the current
content until a load has committed in the provisional page. If no load commits
in the provisional process (e.g. because the load is cancelled or converted into
a download), then we merely destroy the ProvisionalPageProxy and terminate its
process, without impacting the WebPageProxy.

* Shared/WebPageCreationParameters.cpp:
(WebKit::WebPageCreationParameters::encode const):
(WebKit::WebPageCreationParameters::decode):
* Shared/WebPageCreationParameters.h:
Rename isSwapFromSuspended to isProcessSwap for clarity as we always want to
delay attaching the drawing area in case of a process-swap, no matter what
now that the previous process is kept alive until the provisional load is
committed in the new process.

* Shared/WebPolicyAction.h:
Drop Suspend policy action. At decidePolicyForNavigationAction time, in case of
process-swap, we now tell the previous process to simply ignore the load, while
we create a ProvisionalPageProxy to do the new load in a new process.
Suspension of the previous page in the old process, happens later, when a load
is actually committed in the new process.

* Sources.txt:
Add new ProvisionalPageProxy file.

* UIProcess/API/Cocoa/WKWebView.mm:
(-[WKWebView _killWebContentProcessAndResetState]):
When calling _killWebContentProcessAndResetState on a WKWebView, kill both the current
process and the provisional one, to maintain previous behavior in our API tests.

* UIProcess/PageClient.h:
Tiny build fix.

* UIProcess/ProvisionalPageProxy.cpp: Added.
(WebKit::ProvisionalPageProxy::ProvisionalPageProxy):
(WebKit::ProvisionalPageProxy::~ProvisionalPageProxy):
(WebKit::ProvisionalPageProxy::takeDrawingArea):
(WebKit::ProvisionalPageProxy::cancel):
(WebKit::ProvisionalPageProxy::initializeWebPage):
(WebKit::ProvisionalPageProxy::loadDataWithNavigation):
(WebKit::ProvisionalPageProxy::loadRequestWithNavigation):
(WebKit::ProvisionalPageProxy::goToBackForwardItem):
(WebKit::ProvisionalPageProxy::didCreateMainFrame):
(WebKit::ProvisionalPageProxy::didStartProvisionalLoadForFrame):
(WebKit::ProvisionalPageProxy::didFailProvisionalLoadForFrame):
(WebKit::ProvisionalPageProxy::didCommitLoadForFrame):
(WebKit::ProvisionalPageProxy::didReceiveMessage):
(WebKit::ProvisionalPageProxy::didReceiveSyncMessage):
* UIProcess/ProvisionalPageProxy.h: Added.
(WebKit::ProvisionalPageProxy::page):
(WebKit::ProvisionalPageProxy::mainFrame const):
(WebKit::ProvisionalPageProxy::process):
(WebKit::ProvisionalPageProxy::processSwapRequestedByClient const):
(WebKit::ProvisionalPageProxy::navigationID const):
Add new ProvisionalPageProxy class to wrap the provisional load in the new process
after a swap. The provisional page is owned by the WebPageProxy and we only commit
the provisional page when the load is committed. Until then, the WebPageProxy keeps
using the old process and displaying the current content.

* UIProcess/SuspendedPageProxy.cpp:
(WebKit::SuspendedPageProxy::~SuspendedPageProxy):
(WebKit::SuspendedPageProxy::unsuspend):
(WebKit::SuspendedPageProxy::didProcessRequestToSuspend):
Unregister the SuspendedPageProxy as an IPC message receiver a little bit earlier
when we're going to unsuspend it. This avoids conflicting with the ProvisionalPageProxy
which tries to register itself as an IPC message receiver for the same pageID when
a process-swap occurs and we're switching to a suspended page.

* UIProcess/WebFrameProxy.cpp:
(WebKit::WebFrameProxy::isMainFrame const):
WebFrameProxy::isMainFrame() relies on checking that the frame is the WebPageProxy's m_mainFrame.
Now that the WebPageProxy can have a ProvisionalPageProxy, also check if it is the ProvisionalPageProxy's
m_mainFrame to maintain previous behavior.

* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::swapToWebProcess):
swapToWebProcess() no longer takes care of unsuspending the SuspendedPage because we now call swapToWebProcess()
later, when a load is actually committed in the provisional page / process. swapToWebProcess() now also needs
to initialize some data members such as the drawing area and the main frame as it is transferring them over from
the ProvisionalPageProxy which started the provisional load.

(WebKit::WebPageProxy::finishAttachingToWebProcess):
We no longer need IsSwapFromSuspended parameter as this is called later now, after a load has actually been
committed in the provisional process.

(WebKit::WebPageProxy::initializeWebPage):
- We no longer need IsSwapFromSuspended parameter as this is called later now, after a load has actually been
  committed in the provisional process.
- Factor some code out to WebPageProxy::setDrawingArea() so that it can be shared with swapToWebProcess().

(WebKit::WebPageProxy::loadRequestWithNavigation):
Only call setPendingAPIRequestURL() in loadRequestWithNavigation() only if ShouldTreatAsContinuingLoad is not
Yes. This avoids hitting some assertions as this was already called during the first API call if needed.

(WebKit::WebPageProxy::receivedNavigationPolicyDecision):
In case of process swap, tell the previous process to ignore the load instead of suspending it right away.
Suspension now happens later, only if we end up committing the provisional load in the new process.
Also discard the SuspendedPage if it failed to suspend (we only reuse its process in this case). This used
to happen a bit later but it is clearer if we do this as early as possible I think.

(WebKit::WebPageProxy::commitProvisionalPage):
When the load is committed in the new process, we call WebPageProxy::commitProvisionalPage(). It takes care of:
- Actually swapping the WebPageProxy to the new process by calling processDidTerminate() / swapToWebProcess().
- Suspending the current page.
- Letting the client know the load is comitted
- Destroy the ProvisionalPageProxy.
This work used to happen earlier in continueNavigationInNewProcess().

(WebKit::WebPageProxy::continueNavigationInNewProcess):
Moved some of the logic to commitProvisionalPage(). We now merely start the load in a new ProvisionalPageProxy,
without actually having the WebPageProxy switch to the new process yet.

(WebKit::WebPageProxy::didCreateMainFrame):
(WebKit::WebPageProxy::didCreateWindow):
Drop some code that is no longer needed, now that the ProvisionalPageProxy takes care of this.

(WebKit::WebPageProxy::didDestroyNavigation):
On process-swap, when telling the previous process to ignore the load and starting the new load in a new
ProvisionalPageProxy, the previous WebPage attempts to destroy the navigation. In this case, we ignore
the call since the navigation is merely taken over by the ProvisionalPageProxy.

(WebKit::WebPageProxy::didStartProvisionalLoadForFrame):
Moved some PSON logic to the ProvisionalPageProxy instead.

(WebKit::WebPageProxy::didFailProvisionalLoadForFrame):
When didFailProvisionalLoadForFrame() is called for a ProvisionalPageProxy, destroy it.

(WebKit::WebPageProxy::decidePolicyForNavigationActionAsync):
(WebKit::WebPageProxy::decidePolicyForResponse):
Capture the process in the lambda, to make sure we send the policy decision to the same process that
asked for it, so as to not get confused by process swaps.

(WebKit::WebPageProxy::resetState):
Drop some code that is no longer needed.

(WebKit::WebPageProxy::creationParameters):
Move the hasRegisteredServiceWorkers flag initialization from the call site to here now that we have
more than one call site. This was just some bad factoring.

(WebKit::WebPageProxy::PageProcessOverride::PageProcessOverride):
(WebKit::WebPageProxy::PageProcessOverride::~PageProcessOverride):
* UIProcess/WebPageProxy.h:
(WebKit::WebPageProxy::temporarilyOverrideProcess):
Add utility class to temporarily override the WebPageProxy's m_process with the provisional one when
the ProvisionalPageProxy interacts with the WebPageProxy.

* UIProcess/WebProcessProxy.cpp:
(WebKit::WebProcessProxy::hasProvisionalPageWithID const):
(WebKit::WebProcessProxy::updateBackForwardItem):
Before updating a BackForwardListItem, we normally make sure the process has a WebPageProxy with the
item's pageID. We have to tweak the logic because there may now be no WebPageProxy with this pageID
associated with this process yet, because it is still a ProvisionalPageProxy.

(WebKit::WebProcessProxy::canTerminateChildProcess):
Do not terminate the WebProcess if there are ProvisionalPageProxy objects using it.

* UIProcess/WebProcessProxy.h:
(WebKit::WebProcessProxy::addProvisionalPageProxy):
(WebKit::WebProcessProxy::removeProvisionalPageProxy):

* WebKit.xcodeproj/project.pbxproj:

* WebProcess/WebPage/WebFrame.cpp:
(WebKit::toPolicyAction):
(WebKit::WebFrame::didReceivePolicyDecision):
Stop dealing with WebPolicyAction::Suspend as it no longer exists.

* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::reinitializeWebPage):
(WebKit::WebPage::didReceivePolicyDecision):

(WebKit::WebPage::setIsSuspended):
Suspend the Page when setIsSuspended(true) is called, now that there is no longer a WebPolicyAction::Suspend.
setIsSuspended(true) IPC is sent when we actually commit the provisional page.

* WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm:
(WebKit::TiledCoreAnimationDrawingArea::TiledCoreAnimationDrawingArea):

Tools:

Add API test coverage.

* TestWebKitAPI/Tests/WebKitCocoa/ProcessSwapOnNavigation.mm:
(-[PSONNavigationDelegate webView:decidePolicyForNavigationResponse:decisionHandler:]):

LayoutTests:

Skip test testing the cross-process DOMWindow API as I broke it with this patch.
The feature is far from ready and off by default anyway. I will add support back
in a follow-up.

* platform/wk2/TestExpectations:

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

7 months ago[LFC][Out-of-flow] Ignore bottom when the vertical values are over-constrained
zalan@apple.com [Tue, 15 Jan 2019 18:27:06 +0000 (18:27 +0000)]
[LFC][Out-of-flow] Ignore bottom when the vertical values are over-constrained
https://bugs.webkit.org/show_bug.cgi?id=193448

Reviewed by Antti Koivisto.

Source/WebCore:

Add missing check. We should only resolve auto values.

Test: fast/block/block-only/non-auto-top-bottom-left-right-widht-height-out-of-flow.html

* layout/FormattingContextGeometry.cpp:
(WebCore::Layout::FormattingContext::Geometry::outOfFlowNonReplacedVerticalGeometry):

Tools:

* LayoutReloaded/misc/LFC-passing-tests.txt:

LayoutTests:

* fast/block/block-only/non-auto-top-bottom-left-right-widht-height-out-of-flow-expected.txt: Added.
* fast/block/block-only/non-auto-top-bottom-left-right-widht-height-out-of-flow.html: Added.

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

7 months agoUnreviewed, test fix after r239976.
drousso@apple.com [Tue, 15 Jan 2019 18:03:05 +0000 (18:03 +0000)]
Unreviewed, test fix after r239976.

* inspector/model/remote-object-expected.txt:

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

7 months agowebkitpy: Implement device type specific expected results (Part 1)
jbedard@apple.com [Tue, 15 Jan 2019 17:46:31 +0000 (17:46 +0000)]
webkitpy: Implement device type specific expected results (Part 1)
https://bugs.webkit.org/show_bug.cgi?id=192162

Reviewed by Lucas Forschler.

Device type specific expected results covers two related ideas. The first (covered by this change)
is where to search for -expected.* files. The second is which tests to run based on the
TestExpectations.txt file.

After this change, the baseline search path will be determined by the type of device running a
test. Device type will be passed into any function which picks a file based on the baseline search
path.

* Scripts/webkitpy/layout_tests/controllers/layout_test_runner.py:
(Worker._update_test_input): Pass device_type to self._port.reference_files(...).
* Scripts/webkitpy/layout_tests/controllers/manager.py:
(Manager.run): Print baseline search path for each round of devices.
* Scripts/webkitpy/layout_tests/controllers/single_test_runner.py:
(SingleTestRunner.__init__): Pass device_type into expected_*(...).
(SingleTestRunner._expected_driver_output): Ditto.
(SingleTestRunner._driver_input): Ditto.
* Scripts/webkitpy/layout_tests/views/printing.py:
(Printer.print_config): Move printing of baseline search path to a separate function.
(Printer.print_baseline_search_path): Moved from Printer.print_config.
* Scripts/webkitpy/layout_tests/views/printing_unittest.py:
(Testprinter.test_print_config):
(Testprinter.test_print_baseline_search_path):
* Scripts/webkitpy/port/base.py:
(Port.baseline_search_path): Pass device_type through.
(Port._expected_baselines_for_suffixes): Ditto.
(Port.expected_baselines): Ditto.
(Port.expected_filename): Ditto.
(Port.expected_checksum): Ditto.
(Port.expected_image): Ditto.
(Port.expected_audio): Ditto.
(Port.expected_text): Ditto.
(Port.reference_files): Ditto.
(Port.tests): Ditto.
(Port._expanded_paths): Ditto.
(Port.skipped_layout_tests): Ditto.
(Port.expectations_dict): Ditto.
(Port._port_specific_expectations_files): Ditto.
(Port.expectations_files): Ditto.
(Port.test_search_path): Ditto.
(Port._tests_for_other_platforms): Ditto.
* Scripts/webkitpy/port/base_unittest.py:
(PortTest.test_additional_platform_directory): Accept, but do not use, device_type.
(PortTest.test_nonexistant_expectations): Ditto.
(test_ref_tests_platform_directory): Ditto.
* Scripts/webkitpy/port/darwin.py:
(DarwinPort._port_specific_expectations_files): Accept device_type.
* Scripts/webkitpy/port/driver.py:
(DriverProxy):
(DriverProxy.host): Expose _target_host for device_type information.
* Scripts/webkitpy/port/gtk.py:
(GtkPort._port_specific_expectations_files): Accept, but do not use, device_type.
* Scripts/webkitpy/port/ios.py:
(IOSPort. default_baseline_search_path): Remove memoized, since it does not accept **kwargs.
* Scripts/webkitpy/port/mac.py:
(MacPort. default_baseline_search_path): Ditto.
* Scripts/webkitpy/port/port_testcase.py:
(TestWebKitPort._tests_for_other_platforms): Accept, but do not use, device_type.
* Scripts/webkitpy/port/test.py:
* Scripts/webkitpy/port/watch.py:
(WatchPort. default_baseline_search_path): Remove memoized, since it does not accept **kwargs.
* Scripts/webkitpy/port/win.py:
(WinPort.test_search_path): Accept, but do not use, device_type.
* Scripts/webkitpy/port/wpe.py:
(WPEPort._port_specific_expectations_files): Ditto.
* Scripts/webkitpy/tool/servers/rebaselineserver.py:
(get_test_baselines.AllPlatformsPort.baseline_search_path): Ditto.

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

7 months agoWebDriver: update Create Window implementation to support newest specification
bburg@apple.com [Tue, 15 Jan 2019 17:15:44 +0000 (17:15 +0000)]
WebDriver: update Create Window implementation to support newest specification
https://bugs.webkit.org/show_bug.cgi?id=193333
<rdar://problem/45649489>

Reviewed by Carlos Garcia Campos.

link: https://w3c.github.io/webdriver/#create-window
The command as specified returns a value indicating whether the new browsing context
was presented as a new tab or new window. Add a new delegate method to query the current
'presentation' of the browsing context. The presentation can change over time due to
things such as screen orientation, so the value that is returned by the command only
reflects how the browsing context was initially presented to the user.

This is covered by existing WPT and internal tests. More will be added when Selenium
exposes this command in its various bindings.

* UIProcess/API/Cocoa/_WKAutomationSessionDelegate.h:
Add new SPI delegate method to query the 'presentation' (tab or window) for an automated WKWebView.

* UIProcess/API/APIAutomationSessionClient.h:
(API::AutomationSessionClient::currentPresentationOfPage):
* UIProcess/Cocoa/AutomationSessionClient.h:
* UIProcess/Cocoa/AutomationSessionClient.mm:
(WebKit::AutomationSessionClient::AutomationSessionClient):
(WebKit::toImpl):
(WebKit::AutomationSessionClient::currentPresentationOfPage):
* UIProcess/Automation/WebAutomationSession.cpp:
(WebKit::toProtocol):
(WebKit::WebAutomationSession::createBrowsingContext):
Add plumbing between ObjC delegate and C++.

* UIProcess/Automation/Automation.json:
Include the initial presentation in the createBrowsingContext command result.

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

7 months agoWeb Inspector: Audit: provide a way to determine whether a give node has event listeners
drousso@apple.com [Tue, 15 Jan 2019 16:31:05 +0000 (16:31 +0000)]
Web Inspector: Audit: provide a way to determine whether a give node has event listeners
https://bugs.webkit.org/show_bug.cgi?id=193226
<rdar://problem/46800005>

Reviewed by Joseph Pecoraro.

Source/WebCore:

Test: inspector/audit/run-dom.html

* inspector/InspectorAuditDOMObject.idl:
* inspector/InspectorAuditDOMObject.h:
* inspector/InspectorAuditDOMObject.cpp:
(WebCore::InspectorAuditDOMObject::hasEventListeners): Added.

LayoutTests:

* inspector/audit/run-dom.html: Added.
* inspector/audit/run-dom-expected.txt: Added.

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

7 months agoWeb Inspector: Audit: provide a way to query for all nodes with a given computed...
drousso@apple.com [Tue, 15 Jan 2019 16:28:37 +0000 (16:28 +0000)]
Web Inspector: Audit: provide a way to query for all nodes with a given computed Accessibility role
https://bugs.webkit.org/show_bug.cgi?id=193228
<rdar://problem/46787787>

Reviewed by Joseph Pecoraro.

Source/WebCore:

Test: inspector/audit/run-accessibility.html

* inspector/InspectorAuditAccessibilityObject.idl:
* inspector/InspectorAuditAccessibilityObject.h:
* inspector/InspectorAuditAccessibilityObject.cpp:
(WebCore::accessiblityObjectForNode): Added.
(WebCore::InspectorAuditAccessibilityObject::getElementsByComputedRole): Added.

LayoutTests:

* inspector/audit/run-accessibility.html: Added.
* inspector/audit/run-accessibility-expected.txt: Added.

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

7 months agoSimplify isRunningAnimationOnRenderer()
simon.fraser@apple.com [Tue, 15 Jan 2019 16:24:57 +0000 (16:24 +0000)]
Simplify isRunningAnimationOnRenderer()
https://bugs.webkit.org/show_bug.cgi?id=193435

Reviewed by Darin Adler.

All callers of CSSAnimationController::isRunningAnimationOnRenderer() pass AnimationBase::Running | AnimationBase::Paused,
so we can remove the parameter and just hardcode this behavior.

This will simplify a later patch that needs to consider state changes between running and not running.

No behavior change.

* page/animation/AnimationBase.h:
(WebCore::AnimationBase::isAnimatingProperty const):
* page/animation/CSSAnimationController.cpp:
(WebCore::CSSAnimationControllerPrivate::isRunningAnimationOnRenderer const):
(WebCore::CSSAnimationControllerPrivate::isRunningAcceleratedAnimationOnRenderer const):
(WebCore::CSSAnimationControllerPrivate::computeExtentOfAnimation const):
(WebCore::CSSAnimationController::isRunningAnimationOnRenderer const):
(WebCore::CSSAnimationController::isRunningAcceleratedAnimationOnRenderer const):
* page/animation/CSSAnimationController.h:
* page/animation/CSSAnimationControllerPrivate.h:
* page/animation/CompositeAnimation.cpp:
(WebCore::CompositeAnimation::isAnimatingProperty const):
* page/animation/CompositeAnimation.h:
* rendering/RenderLayer.cpp:
(WebCore::RenderLayer::currentTransform const):
* rendering/RenderLayerBacking.cpp:
(WebCore::RenderLayerBacking::updateGeometry):
* rendering/RenderLayerCompositor.cpp:
(WebCore::RenderLayerCompositor::requiresCompositingForAnimation const):
(WebCore::RenderLayerCompositor::isRunningTransformAnimation const):

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

7 months agoRemove unused fields from Scrollbar
antti@apple.com [Tue, 15 Jan 2019 15:46:19 +0000 (15:46 +0000)]
Remove unused fields from Scrollbar
https://bugs.webkit.org/show_bug.cgi?id=193442

Reviewed by Zalan Bujtas.

* platform/Scrollbar.cpp:
(WebCore::Scrollbar::Scrollbar):
* platform/Scrollbar.h:
(WebCore::Scrollbar::isCustomScrollbar const):

Make virtual so it doesn't need a bit.

(WebCore::Scrollbar::isAlphaLocked const): Deleted.
(WebCore::Scrollbar::setIsAlphaLocked): Deleted.
* platform/mac/ScrollAnimatorMac.mm:
(WebCore::ScrollAnimatorMac::shouldScrollbarParticipateInHitTesting):
* rendering/RenderScrollbar.cpp:
(WebCore::RenderScrollbar::RenderScrollbar):
* rendering/RenderScrollbar.h:

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

7 months ago[LFC] Use the containing block's padding box to position out-of-flow elements.
zalan@apple.com [Tue, 15 Jan 2019 14:48:54 +0000 (14:48 +0000)]
[LFC] Use the containing block's padding box to position out-of-flow elements.
https://bugs.webkit.org/show_bug.cgi?id=193431

Reviewed by Antti Koivisto.

Source/WebCore:

If the element has 'position: absolute', the containing block is established by the nearest ancestor
with a 'position' of 'absolute', 'relative' or 'fixed', in the following way:

1. In the case that the ancestor is an inline element, the containing block is the bounding box around the padding
boxes of the first and the last inline boxes generated for that element. In CSS 2.2, if the inline element is split
across multiple lines, the containing block is undefined.

2. Otherwise, the containing block is formed by the padding edge of the ancestor.

This patch covers #2.

Test: fast/block/block-only/out-of-flow-with-containing-block-border-padding.html

* layout/displaytree/DisplayBox.h:
(WebCore::Display::Box::width const):
(WebCore::Display::Box::height const):
(WebCore::Display::Box::contentBoxTop const):
(WebCore::Display::Box::contentBoxLeft const):
(WebCore::Display::Box::paddingBoxTop const):
(WebCore::Display::Box::paddingBoxLeft const):
(WebCore::Display::Box::paddingBoxBottom const):
(WebCore::Display::Box::paddingBoxRight const):
(WebCore::Display::Box::paddingBoxHeight const):
(WebCore::Display::Box::paddingBoxWidth const):
* page/FrameViewLayoutContext.cpp:
(WebCore::layoutUsingFormattingContext):

Tools:

* LayoutReloaded/misc/LFC-passing-tests.txt:

LayoutTests:

* fast/block/block-only/out-of-flow-with-containing-block-border-padding-expected.txt: Added.
* fast/block/block-only/out-of-flow-with-containing-block-border-padding.html: Added.

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

7 months agoUnreviewed, skip JIT tests if it's not enabled
tpopela@redhat.com [Tue, 15 Jan 2019 13:14:27 +0000 (13:14 +0000)]
Unreviewed, skip JIT tests if it's not enabled

* stress/bit-op-with-object-returning-int32.js:

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

7 months agoUnreviewed: Fix the -Wformat compiler warnings
tpopela@redhat.com [Tue, 15 Jan 2019 12:34:35 +0000 (12:34 +0000)]
Unreviewed: Fix the -Wformat compiler warnings

* jsc.cpp:
(jscmain):

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

7 months agoDFGByteCodeParser rules for bitwise operations should consider type of their operands
ticaiolima@gmail.com [Tue, 15 Jan 2019 10:14:31 +0000 (10:14 +0000)]
DFGByteCodeParser rules for bitwise operations should consider type of their operands
https://bugs.webkit.org/show_bug.cgi?id=192966

Reviewed by Yusuke Suzuki.

JSTests:

* stress/bit-op-with-object-returning-int32.js: Added.

Source/JavaScriptCore:

This patch is changing the logic how we lower bitwise operations, to
consider only the type of input nodes and fix them during FixupPhase,
if necessary. We are also changing the prediction propagation rules
for ValueBitOp to use `getHeapPrediction()`.

* dfg/DFGBackwardsPropagationPhase.cpp:
(JSC::DFG::BackwardsPropagationPhase::isWithinPowerOfTwo):
(JSC::DFG::BackwardsPropagationPhase::propagate):
* dfg/DFGByteCodeParser.cpp:
(JSC::DFG::ByteCodeParser::parseBlock):
* dfg/DFGFixupPhase.cpp:
(JSC::DFG::FixupPhase::fixupNode):
* dfg/DFGNode.h:
(JSC::DFG::Node::hasInt32Result):
(JSC::DFG::Node::hasNumberOrAnyIntResult):
(JSC::DFG::Node::hasHeapPrediction):
* dfg/DFGPredictionPropagationPhase.cpp:

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

7 months agoSkip a slow test and a flakey test on arm
guijemont@igalia.com [Tue, 15 Jan 2019 09:51:44 +0000 (09:51 +0000)]
Skip a slow test and a flakey test on arm

Unreviewed gardening.

JSTests:

* typeProfiler/getter-richards.js:
this test always times out, it used to be always skipped on arm and
mips, but got accidentally enabled by r237919 now that we have DFG on
arm. Also skipping on mips as we plan to soon enable DFG for it too.

LayoutTests:

* js/script-tests/stack-overflow-regexp.js: flakey on arm.

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