WebKit-https.git
8 months agoAllow WebKit clients to specify a minimum effective width for layout.
commit-queue@webkit.org [Wed, 28 Nov 2018 18:50:23 +0000 (18:50 +0000)]
Allow WebKit clients to specify a minimum effective width for layout.
https://bugs.webkit.org/show_bug.cgi?id=191499
<rdar://problem/45362678>

Patch by Yongjun Zhang <yongjun_zhang@apple.com> on 2018-11-28
Reviewed by Wenson Hsieh.

Source/WebCore:

If we ignore the meta viewport (_shouldIgnoreMetaViewport is true), the default layout width will be device
width. For clients that wish to lay out the content with a different width value, we would need to add a way
to specify the effective width for layout.

Tests: fast/viewport/ios/ipad/viewport-overriden-by-minimum-effective-width-if-ignore-meta-viewport.html
       fast/viewport/ios/ipad/viewport-unchanged-by-minimum-effective-width-if-not-ignore-meta-viewport.html

* page/ViewportConfiguration.cpp:
(WebCore::ViewportConfiguration::setViewLayoutSize): Add a new argument effectiveWidth.
(WebCore::ViewportConfiguration::nativeWebpageParameters): Make sure minimumScale for nativeWebpageParameters
    is small enough so that it won't clamp out the initial scale. If content is wider than the viewport, this
    ensures we can still zoom out the page.
(WebCore::ViewportConfiguration::updateConfiguration): update _minimumEffectiveDeviceWidth and apply that to
    the layout size scale computation.
(WebCore::ViewportConfiguration::effectiveLayoutSizeScaleFactor): A helper method to return the effective
    layout scale factor which is also effected by _minimumEffectiveDeviceWidth.
(WebCore::ViewportConfiguration::updateMinimumLayoutSize): Update m_minimumLayoutSize based on effectiveLayoutSizeScaleFactor().
(WebCore::ViewportConfiguration::description const): Also dump m_minimumEffectiveDeviceWidth.
* page/ViewportConfiguration.h: Add a member variable m_minimumEffectiveDeviceWidth.

Source/WebKit:

If we ignore the meta viewport (_shouldIgnoreMetaViewport is true), the default layout width will be device
width. For clients that wish to lay out the content with a different width value, we would need to add a way
to specify the effective width for layout.

* UIProcess/API/Cocoa/WKWebView.mm: Add an iVar _minimumEffectiveDeviceWidth.
(-[WKWebView _dispatchSetViewLayoutSize:]): Call the new setViewportConfigurationViewLayoutSize method.
(-[WKWebView _setViewScale:]): Ditto.
(-[WKWebView _setMinimumEffectiveWidth:]): The setter for _minimumEffectiveDeviceWidth.
(-[WKWebView _minimumEffectiveWidth]): Getter for _minimumEffectiveDeviceWidth
* UIProcess/API/Cocoa/WKWebViewPrivate.h: Add a property _minimumEffectiveDeviceWidth to WKWebView.
* UIProcess/WebPageProxy.h: Change setViewportConfigurationViewLayoutSize to take another argument minimumEffectiveDeviceWidth.
* UIProcess/ios/WebPageProxyIOS.mm:
(WebKit::WebPageProxy::setViewportConfigurationViewLayoutSize): Also send effectiveWidth to WebContent process.
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::WebPage): Set the initial effective width to 0 when creating a web page, this tells ViewportConfiguration
     to ignore the minimum effective width value.
* WebProcess/WebPage/WebPage.h: Change setViewportConfigurationViewLayoutSize to take another argument effectiveWidth.
* WebProcess/WebPage/WebPage.messages.in:
* WebProcess/WebPage/ios/WebPageIOS.mm:
(WebKit::WebPage::setViewportConfigurationViewLayoutSize): Also pass effectiveWidth value to ViewportConfiguration.

Tools:

Allow UIScriptController to set WKWebView's minimum effective width with a new `setMinimumEffectiveWidth` method.

* DumpRenderTree/ios/UIScriptControllerIOS.mm:
(WTR::UIScriptController::setMinimumEffectiveWidth):
* DumpRenderTree/mac/UIScriptControllerMac.mm:
(WTR::UIScriptController::setViewScale):
(WTR::UIScriptController::setMinimumEffectiveWidth):
* TestRunnerShared/UIScriptContext/Bindings/UIScriptController.idl:
* TestRunnerShared/UIScriptContext/UIScriptController.cpp:
(WTR::UIScriptController::setMinimumEffectiveWidth):
* TestRunnerShared/UIScriptContext/UIScriptController.h:
* WebKitTestRunner/UIScriptControllerCocoa.mm:
(WTR::UIScriptController::setMinimumEffectiveWidth):
* WebKitTestRunner/cocoa/TestControllerCocoa.mm:
(WTR::TestController::cocoaResetStateToConsistentValues):

LayoutTests:

Add two new tests. The first test verifies if we ignore meta viewport, setting a different effective width value
will change the layout width of the page. The second test verifies if we don't ignore meta viewport, we will always
respect that (980pt) and setting a different effective width value won't change the layout width.

* fast/viewport/ios/ipad/viewport-overriden-by-minimum-effective-width-if-ignore-meta-viewport-expected.txt: Added.
* fast/viewport/ios/ipad/viewport-overriden-by-minimum-effective-width-if-ignore-meta-viewport.html: Added.
* fast/viewport/ios/ipad/viewport-unchanged-by-minimum-effective-width-if-not-ignore-meta-viewport-expected.txt: Added.
* fast/viewport/ios/ipad/viewport-unchanged-by-minimum-effective-width-if-not-ignore-meta-viewport.html: Added.
* resources/ui-helper.js:
(window.UIHelper.setMinimumEffectiveWidth): Add a helper method to set the minimum effective width from a test.
(window.UIHelper):

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

8 months agoMake generic EventHandler methods
stephan.szabo@sony.com [Wed, 28 Nov 2018 18:24:06 +0000 (18:24 +0000)]
Make generic EventHandler methods
https://bugs.webkit.org/show_bug.cgi?id=192032

Reviewed by Michael Catanzaro.

No new tests. No new behavior.

Move mostly generic for non-Apple platform implementations
of methods from EventHandlerGlib into EventHandler. Two
of these also had different Windows implementations, so
to limit behavior change from this, those are currently
overridden for Windows as well as Mac and IOS.

* page/EventHandler.cpp:
(WebCore::EventHandler::passMousePressEventToSubframe):
(WebCore::EventHandler::passMouseReleaseEventToSubframe):
(WebCore::EventHandler::widgetDidHandleWheelEvent):
(WebCore::EventHandler::tabsToAllFormControls const):
(WebCore::EventHandler::passWidgetMouseDownEventToWidget):
(WebCore::EventHandler::passMouseDownEventToWidget):
(WebCore::EventHandler::focusDocumentView):
(WebCore::EventHandler::eventActivatedView const):
(WebCore::EventHandler::passMouseMoveEventToSubframe):
* page/win/EventHandlerWin.cpp:
(WebCore::EventHandler::passMouseMoveEventToSubframe):
(WebCore::EventHandler::passMousePressEventToSubframe): Deleted.
(WebCore::EventHandler::passMouseReleaseEventToSubframe): Deleted.
(WebCore::EventHandler::widgetDidHandleWheelEvent): Deleted.
(WebCore::EventHandler::tabsToAllFormControls const): Deleted.
(WebCore::EventHandler::focusDocumentView): Deleted.
(WebCore::EventHandler::passWidgetMouseDownEventToWidget): Deleted.
(WebCore::EventHandler::accessKeyModifiers): Deleted.
* platform/glib/EventHandlerGLib.cpp:
(WebCore::EventHandler::tabsToAllFormControls const): Deleted.
(WebCore::EventHandler::focusDocumentView): Deleted.
(WebCore::EventHandler::passWidgetMouseDownEventToWidget): Deleted.
(WebCore::EventHandler::passMouseDownEventToWidget): Deleted.
(WebCore::EventHandler::eventActivatedView const): Deleted.
(WebCore::EventHandler::widgetDidHandleWheelEvent): Deleted.
(WebCore::EventHandler::passMousePressEventToSubframe): Deleted.
(WebCore::EventHandler::passMouseMoveEventToSubframe): Deleted.
(WebCore::EventHandler::passMouseReleaseEventToSubframe): Deleted.
(WebCore::EventHandler::accessKeyModifiers): Deleted.

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

8 months agoRemove @no-unify of InjectedBundleRangeHandle.cpp and InjectedBundleNodeHandle.cpp
Hironori.Fujii@sony.com [Wed, 28 Nov 2018 18:16:10 +0000 (18:16 +0000)]
Remove @no-unify of InjectedBundleRangeHandle.cpp and InjectedBundleNodeHandle.cpp
https://bugs.webkit.org/show_bug.cgi?id=191853

Reviewed by Michael Catanzaro.

In r235845, I excluded InjectedBundleRangeHandle.cpp and
InjectedBundleNodeHandle.cpp from unify source builds in order to
work around a MSVC bug.

Then, I commited a different workaround for the MSVC bug in
r238386. Now, we can include InjectedBundleRangeHandle.cpp and
InjectedBundleNodeHandle.cpp in unified source builds. Revert
r235845.

* Sources.txt: Removed @no-unify of InjectedBundleRangeHandle.cpp
and InjectedBundleNodeHandle.cpp
* WebKit.xcodeproj/project.pbxproj: Unchecked Target Membership
not to be compiled by XCode.

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

8 months ago[CMake] Automatically disable JIT and enable USE_SYSTEM_MALLOC on unfamiliar architec...
mcatanzaro@igalia.com [Wed, 28 Nov 2018 18:05:31 +0000 (18:05 +0000)]
[CMake] Automatically disable JIT and enable USE_SYSTEM_MALLOC on unfamiliar architectures
https://bugs.webkit.org/show_bug.cgi?id=186722

Reviewed by Žan Doberšek.

Time for part #2! This change was defeated for GTK and WPE by the code that makes the
options public. We have three options: (a) duplicate the architecture check currently in
WebKitFeatures.cmake in both OptionsGTK.cmake and OptionsWPE.cmake, (b) rely on the result
of that check in OptionsGTK.cmake and OptionsWPE.cmake by using ENABLE_JIT_DEFAULT and
USE_SYSTEM_MALLOC_DEFAULT, a fragile encapsulation violation, or (c) just make the options
private. They have been public up until now because they needed to be turned off on
unsupported architectures. But now they are off by default and enabled only for particular
whitelisted architectures, so they shouldn't be needed anymore.

Note we have to hide ENABLE_SAMPLING_PROFILER as well, since it needs to match the value of
ENABLE_JIT. Again, this is handled properly in WebKitFeatures.cmake, and defeated here in
OptionsGTK.cmake. (This is not a problem for WPE.)

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

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

8 months agoFix webkitbot hi command.
lforschler@apple.com [Wed, 28 Nov 2018 17:52:07 +0000 (17:52 +0000)]
Fix webkitbot hi command.
https://bugs.webkit.org/show_bug.cgi?id=192080

Reviewed by Alexey Proskuryakov.

* Scripts/webkitpy/tool/bot/irc_command.py:
(Hi.execute):

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

8 months agoWeb Inspector: REGRESSION(r238378): reloading WebInspector after a settings change...
commit-queue@webkit.org [Wed, 28 Nov 2018 17:51:49 +0000 (17:51 +0000)]
Web Inspector: REGRESSION(r238378): reloading WebInspector after a settings change doesn't re-show WebInspector
https://bugs.webkit.org/show_bug.cgi?id=191971

Patch by Joseph Pecoraro <pecoraro@apple.com> on 2018-11-28
Reviewed by Matt Baker.

* WebProcess/WebPage/WebInspector.cpp:
(WebKit::WebInspector::reopen): Deleted.
* WebProcess/WebPage/WebInspector.h:
* WebProcess/WebPage/WebInspector.messages.in:
Move reopen out of the WebProcess...

* UIProcess/WebInspectorProxy.cpp:
(WebKit::WebInspectorProxy::reopen):
* UIProcess/WebInspectorProxy.h:
* UIProcess/WebInspectorProxy.messages.in:
And into the UIProcess where the order of messages won't
be as problematic.

* WebProcess/WebPage/WebInspectorUI.cpp:
(WebKit::WebInspectorUI::reopen):
Send a message to the WebInspectorProxy instead.

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

8 months agoVersioning.
kocsen_chung@apple.com [Wed, 28 Nov 2018 17:33:05 +0000 (17:33 +0000)]
Versioning.

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

8 months agoRemove another OS version check from NetworkDataTaskCocoa.mm
ap@apple.com [Wed, 28 Nov 2018 17:28:13 +0000 (17:28 +0000)]
Remove another OS version check from NetworkDataTaskCocoa.mm
https://bugs.webkit.org/show_bug.cgi?id=192046

Reviewed by Alex Christensen.

Source/WebKit:

* NetworkProcess/cocoa/NetworkDataTaskCocoa.mm:
(WebKit::NetworkDataTaskCocoa::statelessCookieStorage):

Source/WTF:

* wtf/Platform.h:

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

8 months agoModernize version checks for same site cookie support
ap@apple.com [Wed, 28 Nov 2018 17:19:39 +0000 (17:19 +0000)]
Modernize version checks for same site cookie support
https://bugs.webkit.org/show_bug.cgi?id=192054

Reviewed by Tim Horton.

Source/WebCore/PAL:

* pal/spi/cf/CFNetworkSPI.h:

Source/WebKit:

* NetworkProcess/cocoa/NetworkDataTaskCocoa.mm: (WebKit::updateTaskWithFirstPartyForSameSiteCookies):
Also removed runtime checks, which are no longer relevant.

Source/WTF:

* wtf/Platform.h:

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

8 months ago[LFC][Quirk] Use non-collapsed vertical margin values when the container is stretched...
zalan@apple.com [Wed, 28 Nov 2018 17:17:28 +0000 (17:17 +0000)]
[LFC][Quirk] Use non-collapsed vertical margin values when the container is stretched to the size of the ICB.
https://bugs.webkit.org/show_bug.cgi?id=192078

Reviewed by Antti Koivisto.

Source/WebCore:

This quirk happens when the body height is 0 which means its vertical margins collapse through (top and bottom margins are adjoining).
However now that we stretch the body they don't collapse through anymore, so we need to use the non-collapsed values instead.

* layout/LayoutUnits.h:
(WebCore::Layout::HeightAndMargin::usedMarginValues const):
* layout/blockformatting/BlockFormattingContextGeometry.cpp:
(WebCore::Layout::stretchHeightToInitialContainingBlock):

Tools:

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

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

8 months agoRemove Postprocess Headers dependencies
krollin@apple.com [Wed, 28 Nov 2018 16:50:40 +0000 (16:50 +0000)]
Remove Postprocess Headers dependencies
https://bugs.webkit.org/show_bug.cgi?id=192023
<rdar://problem/46283377>

Reviewed by Mark Lam.

JavaScriptCore's Xcode Postprocess Headers build phase used to have a
dependency on a specific handful of files. In r234227, the script used
in this phase (postprocess-headers.sh) was completely rewritten to
operate on *all* files in JSC's Public and Private headers directories
instead of just this handful. This rewrite makes the previous
dependency specification insufficient, leading to incorrect
incremental builds if the right files weren't touched. Address this by
removing the dependencies completely. This will cause
postprocess-headers.sh to always be executed, even when none of its
files are touch. Running this script all the time is OK, since it has
built-in protections against unnecessarily touching files that haven't
changed.

* JavaScriptCore.xcodeproj/project.pbxproj:

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

8 months ago[LFC] Add support for quirk container's collapsing top margin in quirks mode.
zalan@apple.com [Wed, 28 Nov 2018 15:30:05 +0000 (15:30 +0000)]
[LFC] Add support for quirk container's collapsing top margin in quirks mode.
https://bugs.webkit.org/show_bug.cgi?id=192070

Reviewed by Antti Koivisto.

Source/WebCore:

In quirk mode when the top margin collapsing is computed for a quirk container (body, table cell) and the canditate margin value is
also a quirk value, we just ignore it.

* layout/blockformatting/BlockMarginCollapse.cpp:
(WebCore::Layout::isQuirkContainer):
(WebCore::Layout::hasMarginTopQuirkValue):
(WebCore::Layout::shouldIgnoreMarginTopInQuirkContext):
(WebCore::Layout::isMarginTopCollapsedWithParent):
(WebCore::Layout::BlockFormattingContext::Geometry::MarginCollapse::marginTop):
* layout/layouttree/LayoutBox.h:
(WebCore::Layout::Box::isTableCell const):

Tools:

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

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

8 months agoIntersection Observer: rootMargin: '' gives weird results
ajuma@chromium.org [Wed, 28 Nov 2018 15:06:19 +0000 (15:06 +0000)]
Intersection Observer: rootMargin: '' gives weird results
https://bugs.webkit.org/show_bug.cgi?id=191975

Reviewed by Simon Fraser.

LayoutTests/imported/w3c:

Add test coverage.

* web-platform-tests/intersection-observer/empty-root-margin-expected.txt: Added.
* web-platform-tests/intersection-observer/empty-root-margin.html: Added.

Source/WebCore:

When converting the rootMargin string into a LengthBox, explicitly construct a Length
of size 0px for each dimension, instead of using Length's default constructor. The
default constructor creates a Length with value Auto, which causes us to incorrectly
apply a non-zero rootMargin.

Test: imported/w3c/web-platform-tests/intersection-observer/empty-root-margin.html

* page/IntersectionObserver.cpp:
(WebCore::parseRootMargin):

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

8 months ago[WebRTC][GStreamer] Make sure to have the default microphone on the top of the list
commit-queue@webkit.org [Wed, 28 Nov 2018 14:56:11 +0000 (14:56 +0000)]
[WebRTC][GStreamer] Make sure to have the default microphone on the top of the list
https://bugs.webkit.org/show_bug.cgi?id=192026

Patch by Thibault Saunier <tsaunier@igalia.com> on 2018-11-28
Reviewed by Philippe Normand.

Otherwise we might end up picking a useless one in some applications
(not sure what those application do though).

GStreamer patch proposed as https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/merge_requests/34/diffs

Source/WebCore:

* platform/mediastream/gstreamer/GStreamerCaptureDeviceManager.cpp:
(WebCore::sortDevices):
(WebCore::GStreamerCaptureDeviceManager::addDevice):
(WebCore::GStreamerCaptureDeviceManager::refreshCaptureDevices):
* platform/mediastream/gstreamer/GStreamerCaptureDeviceManager.h:

Tools:

* flatpak/org.webkit.CommonModules.yaml:
* gstreamer/jhbuild.modules:
* gstreamer/patches/gst-plugins-good-0014-pulse-Mark-default-devices-as-default.patch: Added.

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

8 months ago[GTK] Silence compilation warnings in glib unittests
tpopela@redhat.com [Wed, 28 Nov 2018 13:50:42 +0000 (13:50 +0000)]
[GTK] Silence compilation warnings in glib unittests
https://bugs.webkit.org/show_bug.cgi?id=192009

Reviewed by Michael Catanzaro.

Mark the destructor as virtual.

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

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

8 months ago[WebRTC][GStreamer] Tag all cameras with as 'Unknown' facing mode
commit-queue@webkit.org [Wed, 28 Nov 2018 12:51:46 +0000 (12:51 +0000)]
[WebRTC][GStreamer] Tag all cameras with as 'Unknown' facing mode
https://bugs.webkit.org/show_bug.cgi?id=192028

Patch by Thibault Saunier <tsaunier@igalia.com> on 2018-11-28
Reviewed by Philippe Normand.

* platform/mediastream/gstreamer/GStreamerVideoCaptureSource.cpp:
(WebCore::GStreamerVideoCaptureSource::capabilities):

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

8 months ago[WebRTC][GStreamer] Use a GUniquePtr to hold the GstAudioConverter in our OutgoingAud...
commit-queue@webkit.org [Wed, 28 Nov 2018 12:41:51 +0000 (12:41 +0000)]
[WebRTC][GStreamer] Use a GUniquePtr to hold the GstAudioConverter in our OutgoingAudioSource
https://bugs.webkit.org/show_bug.cgi?id=192027

Patch by Thibault Saunier <tsaunier@igalia.com> on 2018-11-28
Reviewed by Xabier Rodriguez-Calvar.

Cleaning up a bit the code.

It is a minor refactoring, no new test required.

* platform/graphics/gstreamer/GUniquePtrGStreamer.h:
* platform/mediastream/gstreamer/RealtimeOutgoingAudioSourceLibWebRTC.cpp:
(WebCore::RealtimeOutgoingAudioSourceLibWebRTC::~RealtimeOutgoingAudioSourceLibWebRTC):
(WebCore::RealtimeOutgoingAudioSourceLibWebRTC::audioSamplesAvailable):
(WebCore::RealtimeOutgoingAudioSourceLibWebRTC::pullAudioData):
* platform/mediastream/gstreamer/RealtimeOutgoingAudioSourceLibWebRTC.h:

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

8 months ago[GStreamer][WebRTC] Do not run device monitor for device type we do not handle
commit-queue@webkit.org [Wed, 28 Nov 2018 12:40:08 +0000 (12:40 +0000)]
[GStreamer][WebRTC] Do not run device monitor for device type we do not handle
https://bugs.webkit.org/show_bug.cgi?id=191904

This is useless work and it throws warning about use GstDeviceMonitor without filters.

Patch by Thibault Saunier <tsaunier@igalia.com> on 2018-11-28
Reviewed by Philippe Normand.

* platform/mediastream/gstreamer/GStreamerCaptureDeviceManager.cpp:
(WebCore::GStreamerCaptureDeviceManager::refreshCaptureDevices):

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

8 months agoBlock more ports (427, 548, 6697)
rwlbuis@webkit.org [Wed, 28 Nov 2018 08:28:12 +0000 (08:28 +0000)]
Block more ports (427, 548, 6697)
https://bugs.webkit.org/show_bug.cgi?id=186092

Reviewed by Frédéric Wang.

Update request-bad-port.html to latest version.

* web-platform-tests/fetch/api/request/request-bad-port-expected.txt:
* web-platform-tests/fetch/api/request/request-bad-port.html:

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

8 months agoWeb Inspector: Elements tab should allow selecting/deleting multiple DOM nodes
mattbaker@apple.com [Wed, 28 Nov 2018 06:49:34 +0000 (06:49 +0000)]
Web Inspector: Elements tab should allow selecting/deleting multiple DOM nodes
https://bugs.webkit.org/show_bug.cgi?id=192059
<rdar://problem/46294827>

Reviewed by Devin Rousso.

Enable multiple DOM node selection in the DOMTreeContentView.

* UserInterface/Controllers/SelectionController.js:
(WI.SelectionController):
(WI.SelectionController.prototype.get allowsEmptySelection):
(WI.SelectionController.prototype.set allowsEmptySelection):
Allow clients to control whether the last selected item can be deselected.
(WI.SelectionController.prototype.deselectItem):
(WI.SelectionController.prototype.didInsertItem):
Rewritten to prevent infinite loop.
(WI.SelectionController.prototype.didRemoveItem):
(WI.SelectionController.prototype._updateSelectedItems):
(WI.SelectionController.prototype._adjustIndexesAfter): Deleted.

* UserInterface/Views/DOMTreeContentView.js:
(WI.DOMTreeContentView):

* UserInterface/Views/DOMTreeElement.js:
(WI.DOMTreeElement.prototype.updateSelectionArea):
* UserInterface/Views/DOMTreeOutline.js:
(WI.DOMTreeOutline.prototype.updateSelection):
Updating the selection area DOM element should not assume that only one
TreeElement is selected at a time.

* UserInterface/Views/TreeOutline.js:
(WI.TreeOutline.prototype.get allowsEmptySelection):
(WI.TreeOutline.prototype.set allowsEmptySelection):
(WI.TreeOutline.prototype.set selectedTreeElement):
(WI.TreeOutline.prototype.get selectedTreeElements):
(WI.TreeOutline.prototype._treeKeyDown):

* UserInterface/Views/TreeOutlineGroup.js:
(WI.TreeOutlineGroup):
(WI.TreeOutlineGroup.prototype._removeConflictingTreeSelections):
Eliminate use of `TreeElement.prototype.deselect`.

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

8 months agoLog WebRTC stats in inspector console only when setting is verbose
youenn@apple.com [Wed, 28 Nov 2018 04:48:30 +0000 (04:48 +0000)]
Log WebRTC stats in inspector console only when setting is verbose
https://bugs.webkit.org/show_bug.cgi?id=192014

Reviewed by Eric Carlson.

Add a WebRTCStats channel that is used by default to output WebRTC stats in console.
When WebRTC Debug logging is enabled, log WebRTC stats in WebRTC channel,
so that they appear as debug information in Web Inspector.

No change of JS behavior.
Covered by manually testing what is logged in inspector and console.

* Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp:
(WebCore::LibWebRTCMediaEndpoint::OnStatsDelivered):
* platform/Logging.h:

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

8 months agoFix the mis-spelled "m_clienstWaitingForAsyncDecoding"
simon.fraser@apple.com [Wed, 28 Nov 2018 03:05:16 +0000 (03:05 +0000)]
Fix the mis-spelled "m_clienstWaitingForAsyncDecoding"
https://bugs.webkit.org/show_bug.cgi?id=192060

Reviewed by Wenson Hsieh.

Fix the mis-spelling of "m_clienstWaitingForAsyncDecoding".

* loader/cache/CachedImage.cpp:
(WebCore::CachedImage::didRemoveClient):
(WebCore::CachedImage::isClientWaitingForAsyncDecoding const):
(WebCore::CachedImage::addClientWaitingForAsyncDecoding):
(WebCore::CachedImage::removeAllClientsWaitingForAsyncDecoding):
(WebCore::CachedImage::allClientsRemoved):
(WebCore::CachedImage::clear):
(WebCore::CachedImage::createImage):
(WebCore::CachedImage::imageFrameAvailable):
* loader/cache/CachedImage.h:

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

8 months agoWeb Inspector: TreeOutline should re-use multiple-selection logic from Table
mattbaker@apple.com [Wed, 28 Nov 2018 02:55:42 +0000 (02:55 +0000)]
Web Inspector: TreeOutline should re-use multiple-selection logic from Table
https://bugs.webkit.org/show_bug.cgi?id=191483
<rdar://problem/45953305>

Reviewed by Devin Rousso.

Update TreeOutline to use SelectionController. Adopting SelectionController
in TreeOutline is not as straightforward as it was in Table. Selected items
are tracked by index, and TreeElement lacks an explicit index. As a consequence
TreeElement indexes are calcualted as needed and cached. The cache is cleared
whenever an element is added or removed.

* UserInterface/Controllers/SelectionController.js:
(WI.SelectionController.prototype.didInsertItem):
(WI.SelectionController.prototype.didRemoveItem):
(WI.SelectionController.prototype.handleKeyDown):
Drive-by syntax error fix.
(WI.SelectionController.prototype._adjustIndexesAfter):
(WI.SelectionController):

* UserInterface/Views/DOMTreeElement.js:
(WI.DOMTreeElement.prototype.canSelectOnMouseDown):
(WI.DOMTreeElement.prototype.selectOnMouseDown): Deleted.

* UserInterface/Views/DOMTreeOutline.js:
(WI.DOMTreeOutline.prototype._onmousedown):
Item selection is now handled by SelectionController.

* UserInterface/Views/ShaderProgramTreeElement.js:
(WI.ShaderProgramTreeElement.prototype.canSelectOnMouseDown):
(WI.ShaderProgramTreeElement.prototype.selectOnMouseDown): Deleted.

* UserInterface/Views/TreeElement.js:
(WI.TreeElement.prototype.canSelectOnMouseDown):
(WI.TreeElement.prototype._attach):
(WI.TreeElement.prototype.select):
(WI.TreeElement.prototype.deselect):
Route item selection through the parent TreeOutline, in order to go though
the TreeOutline's SelectionController.

(WI.TreeElement.treeElementMouseDown): Deleted.
Moved handler to TreeOutline, which owns the SelectionController that
needs to respond to mouse events.

* UserInterface/Views/TreeOutline.js:
(WI.TreeOutline):
(WI.TreeOutline.prototype.get allowsMultipleSelection):
(WI.TreeOutline.prototype.set allowsMultipleSelection):
(WI.TreeOutline.prototype.get selectedTreeElement):
(WI.TreeOutline.prototype.set selectedTreeElement):
(WI.TreeOutline.prototype.insertChild):
(WI.TreeOutline.prototype.removeChildAtIndex):
(WI.TreeOutline.prototype._rememberTreeElement):
(WI.TreeOutline.prototype._forgetTreeElement):
(WI.TreeOutline.prototype._treeKeyDown):
(WI.TreeOutline.prototype.selectionControllerNumberOfItems):
(WI.TreeOutline.prototype.selectionControllerSelectionDidChange):
(WI.TreeOutline.prototype.selectionControllerNextSelectableIndex):
(WI.TreeOutline.prototype.selectionControllerPreviousSelectableIndex):
(WI.TreeOutline.prototype.selectTreeElementInternal):
(WI.TreeOutline._generateStyleRulesIfNeeded._indexOfTreeElement.previousElement):
(WI.TreeOutline._generateStyleRulesIfNeeded):

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

8 months agoUnreviewed, test gardening
jiewen_tan@apple.com [Wed, 28 Nov 2018 02:16:25 +0000 (02:16 +0000)]
Unreviewed, test gardening

Add a time out parameter to the following test cases such that WebAuthN requests will timeout
themselves instead of letting the wpt wrapper or test runner kill them.

* http/wpt/webauthn/public-key-credential-create-success-hid.https.html:
* http/wpt/webauthn/public-key-credential-get-success-hid.https.html:
* platform/mac-wk2/TestExpectations:

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

8 months agoENABLE_FAST_JIT_PERMISSIONS should be false for iosmac.
mark.lam@apple.com [Wed, 28 Nov 2018 02:10:50 +0000 (02:10 +0000)]
ENABLE_FAST_JIT_PERMISSIONS should be false for iosmac.
https://bugs.webkit.org/show_bug.cgi?id=192055
<rdar://problem/46288783>

Reviewed by Saam Barati.

Source/JavaScriptCore:

* Configurations/FeatureDefines.xcconfig:

Source/WebCore:

No new tests needed.  Removing an invalid configuration that is not used in WebCore.

* Configurations/FeatureDefines.xcconfig:

Source/WebCore/PAL:

* Configurations/FeatureDefines.xcconfig:

Source/WebKit:

* Configurations/FeatureDefines.xcconfig:

Source/WebKitLegacy/mac:

* Configurations/FeatureDefines.xcconfig:

Tools:

* TestWebKitAPI/Configurations/FeatureDefines.xcconfig:

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

8 months agor238510 broke scopes of size zero
sbarati@apple.com [Wed, 28 Nov 2018 02:03:20 +0000 (02:03 +0000)]
r238510 broke scopes of size zero
https://bugs.webkit.org/show_bug.cgi?id=192033
<rdar://problem/46281734>

Reviewed by Keith Miller.

JSTests:

* stress/r238510-bad-loop.js: Added.
(foo):

Source/JavaScriptCore:

In r238510, I wrote the loop like this:
`for (ScopeOffset offset { 0 }; offset <= symbolTable->maxScopeOffset(); offset += 1)`

This breaks for scopes of size zero because maxScopeOffset() will be UINT_MAX.

This patch fixes this by writing the loop as:
`for (unsigned offset = 0; offset < symbolTable->scopeSize(); ++offset)`

* dfg/DFGObjectAllocationSinkingPhase.cpp:

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

8 months agoASSERTION FAILED: capacity && isPageAligned(capacity) in JSC::CLoopStack::CLoopStack...
mark.lam@apple.com [Wed, 28 Nov 2018 01:48:36 +0000 (01:48 +0000)]
ASSERTION FAILED: capacity && isPageAligned(capacity) in JSC::CLoopStack::CLoopStack(JSC::VM&).
https://bugs.webkit.org/show_bug.cgi?id=192018

Reviewed by Saam Barati.

This assertion failed because the regress-191579.js test was specifying
--maxPerThreadStackUsage=400000 i.e. it was running with a stack size that is not
page aligned.  Given that the user can specify any arbitrary stack size, and the
CLoop stack expects to be page aligned, we'll just round up the requested capacity
to the next page alignment.

* interpreter/CLoopStack.cpp:
(JSC::CLoopStack::CLoopStack):

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

8 months agoWeb Inspector: Experimental Computed panel is unreadable in Dark Mode
nvasilyev@apple.com [Wed, 28 Nov 2018 01:45:17 +0000 (01:45 +0000)]
Web Inspector: Experimental Computed panel is unreadable in Dark Mode
https://bugs.webkit.org/show_bug.cgi?id=192053

Reviewed by Matt Baker.

* UserInterface/Views/ComputedStyleDetailsPanel.css:
(@media (prefers-dark-interface)):
(.computed-with-traces .details-section.computed-style-properties:not(.collapsed) > :matches(.header, .content)):
* UserInterface/Views/ComputedStyleSection.css:
(.computed-style-section .computed-property-item.expanded):
(.computed-style-section .computed-property-item.expanded + .computed-property-item):
(@media (prefers-dark-interface)):

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

8 months agoMake synchronous IPC introduced in r237267 asynchronous
commit-queue@webkit.org [Wed, 28 Nov 2018 01:44:28 +0000 (01:44 +0000)]
Make synchronous IPC introduced in r237267 asynchronous
https://bugs.webkit.org/show_bug.cgi?id=190757

Patch by Alex Christensen <achristensen@webkit.org> on 2018-11-27
Reviewed by Chris Dumez.

Source/WebKit:

* UIProcess/API/Cocoa/WKProcessPool.mm:
(-[WKProcessPool _getActivePagesOriginsInWebProcessForTesting:completionHandler:]):
(-[WKProcessPool _getActivePagesOriginsInWebProcessForTesting:]): Deleted.
* UIProcess/API/Cocoa/WKProcessPoolPrivate.h:
* UIProcess/WebProcessPool.cpp:
(WebKit::WebProcessPool::activePagesOriginsInWebProcessForTesting):
* UIProcess/WebProcessPool.h:
* UIProcess/WebProcessProxy.cpp:
(WebKit::WebProcessProxy::activePagesDomainsForTesting):
* UIProcess/WebProcessProxy.h:
* WebProcess/WebProcess.cpp:
(WebKit::WebProcess::getActivePagesOriginsForTesting):
* WebProcess/WebProcess.messages.in:
* WebProcess/cocoa/WebProcessCocoa.mm:
(WebKit::WebProcess::getActivePagesOriginsForTesting):

Tools:

* TestWebKitAPI/Tests/WebKitCocoa/ProcessSwapOnNavigation.mm:

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

8 months agoResync service-workers web platform tests from upstream
cdumez@apple.com [Wed, 28 Nov 2018 01:14:50 +0000 (01:14 +0000)]
Resync service-workers web platform tests from upstream
https://bugs.webkit.org/show_bug.cgi?id=192035

Reviewed by Youenn Fablet.

LayoutTests/imported/w3c:

Resync service-workers web platform tests from upstream 73507a79fc.

* web-platform-tests/: Updated.

LayoutTests:

* TestExpectations:
* tests-options.json:

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

8 months agowebkitpy: Add watchOS ports
jbedard@apple.com [Wed, 28 Nov 2018 00:29:40 +0000 (00:29 +0000)]
webkitpy: Add watchOS ports
https://bugs.webkit.org/show_bug.cgi?id=191974
<rdar://problem/46251051>

Reviewed by Aakash Jain.

* Scripts/webkitpy/port/factory.py:
(PortFactory): Add WatchDevice and WatchSimulator ports.
* Scripts/webkitpy/port/watch.py: Added.
(WatchPort): Base class for watchOS ports.
* Scripts/webkitpy/port/watch_device.py: Added.
(WatchDevicePort): Class for running layout tests on a watchOS device.
* Scripts/webkitpy/port/watch_simulator.py: Added.
(WatchSimulatorPort): Class for running layout tests on a watchOS simulator.
* Scripts/webkitpy/port/watch_simulator_unittest.py: Added.
(WatchSimulatorTest):
* Scripts/webkitpy/port/watch_testcase.py: Added.
(WatchTest):

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

8 months agoWeb Inspector: Computed panel: allow to expand properties to show list of overridden...
nvasilyev@apple.com [Wed, 28 Nov 2018 00:28:06 +0000 (00:28 +0000)]
Web Inspector: Computed panel: allow to expand properties to show list of overridden values
https://bugs.webkit.org/show_bug.cgi?id=191984

Reviewed by Devin Rousso.

Introduce the new experimental Computed Style Cascades.

Each property now can expand to show a list of overridden values, their corresponding
selectors, and source locations.

* Localizations/en.lproj/localizedStrings.js:
* UserInterface/Base/Setting.js:
* UserInterface/Main.html:
* UserInterface/Models/DOMNodeStyles.js:
(WI.DOMNodeStyles.prototype.get uniqueOrderedStyles):
Move `uniqueOrderedStyles` function unmodified from SpreadsheetRulesStyleDetailsPanel so it can be used by ComputedStyleDetailsPanel, too.

* UserInterface/Views/ComputedStyleDetailsPanel.css:
(.computed-with-traces .computed-style-properties):
(.computed-with-traces .details-section.computed-style-properties:not(.collapsed) > :matches(.header, .content)):
(.computed-with-traces .details-section.computed-style-properties > .content):
(.computed-with-traces .computed-style-properties .property .go-to-arrow):

* UserInterface/Views/ComputedStyleDetailsPanel.js:
(WI.ComputedStyleDetailsPanel.prototype.refresh):
(WI.ComputedStyleDetailsPanel.prototype.applyFilter):
(WI.ComputedStyleDetailsPanel.prototype.focusFirstSection):
(WI.ComputedStyleDetailsPanel.prototype.initialLayout):
(WI.ComputedStyleDetailsPanel.prototype._computePropertyTraces):
(WI.ComputedStyleDetailsPanel.prototype._computedStyleShowAllCheckboxValueChanged):
(WI.ComputedStyleDetailsPanel.prototype._handlePropertiesSectionCollapsedStateChanged):
(WI.ComputedStyleDetailsPanel.prototype._handleEditorFilterApplied):
(WI.ComputedStyleDetailsPanel):
Use the new Computed section (WI.ComputedStyleSection) only when it's enabled in the experimental settings.
Otherwise, use the current Computed section.

* UserInterface/Views/ComputedStyleDetailsSidebarPanel.js:
(WI.ComputedStyleDetailsSidebarPanel):

* UserInterface/Views/ComputedStyleSection.css: Added.
(.computed-style-section):
(.computed-style-section .computed-property-item):
(.computed-style-section .computed-property-item.expanded):
(.computed-style-section .computed-property-item.expanded + .computed-property-item):
(.computed-style-section .computed-property-item .disclosure-button):
(.computed-style-section .computed-property-item .property-traces):
(.computed-style-section .computed-property-item.expanded .property-traces):
(.computed-style-section .computed-property-item.expanded .disclosure-button):
(.computed-style-section .computed-property-item .property-trace-item):
(.computed-style-section .computed-property-item .property-trace-item .property.overridden .value):
(.computed-style-section .property-trace-item-left,):
(.computed-style-section .property-trace-item-right):
(.computed-style-section .computed-property-item .property-trace-item .value):
(.computed-style-section .property .value):
(.computed-style-section .computed-property-item .property):
(.computed-style-section .computed-property-item .property .name):
(.computed-style-section .computed-property-item .property-trace-item .selector):
(.computed-style-section .computed-property-item .origin):
(.computed-style-section .computed-property-item .go-to-link):
(.computed-style-section .property-trace-item .property .name,):
(.computed-style-section .property-trace-item .property .value + span):
(.computed-style-properties.details-section > .content,):

* UserInterface/Views/ComputedStyleSection.js: Added.
(WI.ComputedStyleSection):
(WI.ComputedStyleSection.prototype.get style):
(WI.ComputedStyleSection.prototype.set style):
(WI.ComputedStyleSection.prototype.get styleTraces):
(WI.ComputedStyleSection.prototype.set styleTraces):
(WI.ComputedStyleSection.prototype.set showsImplicitProperties):
(WI.ComputedStyleSection.prototype.set alwaysShowPropertyNames):
(WI.ComputedStyleSection.prototype.set propertyVisibilityMode):
(WI.ComputedStyleSection.prototype.set hideFilterNonMatchingProperties):
(WI.ComputedStyleSection.prototype.get propertiesToRender):
(WI.ComputedStyleSection.prototype.layout):
(WI.ComputedStyleSection.prototype.detached):
(WI.ComputedStyleSection.prototype.hidden):
(WI.ComputedStyleSection.prototype.applyFilter):
(WI.ComputedStyleSection.prototype.spreadsheetStylePropertyShowProperty):
(WI.ComputedStyleSection.prototype._createTrace):
(WI.ComputedStyleSection.prototype._handlePropertiesChanged):

* UserInterface/Views/ExpandableView.js: Added.
(WI.ExpandableView):
(WI.ExpandableView.prototype.get element):
(WI.ExpandableView.prototype._onDisclosureButtonClick):
(WI.ExpandableView.prototype._update):

* UserInterface/Views/SettingsTabContentView.js:
(WI.SettingsTabContentView.prototype._createExperimentalSettingsView):

* UserInterface/Views/SpreadsheetCSSStyleDeclarationSection.js:
(WI.SpreadsheetCSSStyleDeclarationSection.prototype.initialLayout):
(WI.SpreadsheetCSSStyleDeclarationSection.prototype.layout):
Replace `_renderOrigin` with WI.StyleOriginView so it could be used by WI.ComputedStyleSection.

* UserInterface/Views/SpreadsheetRulesStyleDetailsPanel.js:
(WI.SpreadsheetRulesStyleDetailsPanel.prototype.layout):

* UserInterface/Views/SpreadsheetStyleProperty.js:
(WI.SpreadsheetStyleProperty.prototype.update):
(WI.SpreadsheetStyleProperty.prototype._isEditable):
(WI.SpreadsheetStyleProperty.prototype._createInlineSwatch):
Introduce `readOnly` option so WI.SpreadsheetStyleProperty could be used by WI.ComputedStyleSection.

* UserInterface/Views/StyleOriginView.js: Added.
(WI.StyleOriginView):

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

8 months agoRemove kCCNotVerified
jiewen_tan@apple.com [Wed, 28 Nov 2018 00:26:09 +0000 (00:26 +0000)]
Remove kCCNotVerified
https://bugs.webkit.org/show_bug.cgi?id=192034
<rdar://problem/46235863>

Reviewed by Alexey Proskuryakov.

No change of behaviours.

* crypto/CommonCryptoUtilities.h:
* crypto/mac/CryptoAlgorithmRSASSA_PKCS1_v1_5Mac.cpp:
(WebCore::verifyRSASSA_PKCS1_v1_5):

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

8 months agoSafe browsing warning text needs to be visible on High Sierra
achristensen@apple.com [Wed, 28 Nov 2018 00:15:01 +0000 (00:15 +0000)]
Safe browsing warning text needs to be visible on High Sierra
https://bugs.webkit.org/show_bug.cgi?id=192022

Reviewed by Tim Horton.

Source/WebKit:

Something about AppKit, autolayout, view insertion order, and NSTextView makes the text lay
out with initial size of {0, 0} on High Sierra. Using an NSTextField instead makes the details visible.

Covered by an API test.

* UIProcess/Cocoa/WKSafeBrowsingWarning.h:
* UIProcess/Cocoa/WKSafeBrowsingWarning.mm:
(makeLabel):
(-[WKSafeBrowsingWarning addContent]):
(-[WKSafeBrowsingWarning showDetailsClicked]):
(-[WKSafeBrowsingWarning layoutText]):
(makeTitleLabel): Deleted.

Tools:

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

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

8 months agoUnreviewed, fix the watchOS engineering build
wenson_hsieh@apple.com [Tue, 27 Nov 2018 23:54:06 +0000 (23:54 +0000)]
Unreviewed, fix the watchOS engineering build

Disable a newly added API test, since DDScannerResult is unavailable on watchOS.

* TestWebKitAPI/Tests/WebKitCocoa/DataDetection.mm:

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

8 months agoAvoid triggering compositing updates when only the root layer is composited
simon.fraser@apple.com [Tue, 27 Nov 2018 23:46:18 +0000 (23:46 +0000)]
Avoid triggering compositing updates when only the root layer is composited
https://bugs.webkit.org/show_bug.cgi?id=191813

Reviewed by Zalan Bujtas.

If we know that the only composited layer is the root, we can avoid triggering deep
compositing updates sometimes, for example when layout changes size or position,
or when z-order lists change.

* rendering/RenderLayer.cpp:
(WebCore::RenderLayer::addChild):
(WebCore::RenderLayer::removeChild):
(WebCore::RenderLayer::updateLayerPosition):
(WebCore::RenderLayer::scrollTo):
(WebCore::RenderLayer::updateCompositingLayersAfterScroll):
(WebCore::outputPaintOrderTreeRecursive):
* rendering/RenderLayerCompositor.cpp:
(WebCore::RenderLayerCompositor::updateBackingAndHierarchy): Consult the layer.hasCompositingDescendant()
flag to cut off descendants traversal when possible.
(WebCore::RenderLayerCompositor::layerStyleChanged):

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

8 months agoRefactor duplicate code for calling into media controls
eric.carlson@apple.com [Tue, 27 Nov 2018 23:45:43 +0000 (23:45 +0000)]
Refactor duplicate code for calling into media controls
https://bugs.webkit.org/show_bug.cgi?id=192040
<rdar://problem/46278931>

Reviewed by Youenn Fablet.

No new tests, no functional change.

* html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::setupAndCallJS):
(WebCore::HTMLMediaElement::updateCaptionContainer):
(WebCore::HTMLMediaElement::configureTextTrackDisplay):
(WebCore::HTMLMediaElement::ensureMediaControlsInjectedScript):
(WebCore::HTMLMediaElement::setControllerJSProperty):
(WebCore::HTMLMediaElement::didAddUserAgentShadowRoot):
(WebCore::HTMLMediaElement::updateMediaControlsAfterPresentationModeChange):
(WebCore::HTMLMediaElement::getCurrentMediaControlsStatus):
* html/HTMLMediaElement.h:

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

8 months ago[Re-landing] NaNs read from Wasm code needs to be be purified.
mark.lam@apple.com [Tue, 27 Nov 2018 23:23:42 +0000 (23:23 +0000)]
[Re-landing] NaNs read from Wasm code needs to be be purified.
https://bugs.webkit.org/show_bug.cgi?id=191056
<rdar://problem/45660341>

Reviewed by Filip Pizlo.

* wasm/regress/regress-191056.js: Added.

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

8 months agoWKNavigation.AutomaticViewReloadAfterWebProcessCrash asserts after r238538
timothy_horton@apple.com [Tue, 27 Nov 2018 23:20:25 +0000 (23:20 +0000)]
WKNavigation.AutomaticViewReloadAfterWebProcessCrash asserts after r238538
https://bugs.webkit.org/show_bug.cgi?id=192038
<rdar://problem/46288457>

Reviewed by Wenson Hsieh.

* UIProcess/WebPageProxy.cpp:
(WebKit::m_resetRecentCrashCountTimer):
(WebKit::WebPageProxy::finishAttachingToWebProcess):
(WebKit::WebPageProxy::resetState):
(WebKit::m_editableImageController): Deleted.
Properly invalidate m_editableImageController when resetting WebPageProxy.
Otherwise, the MessageReceiverMaps get invalidated, then later when
EditableImageController goes away we assert trying to remove the receiver.

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

8 months ago(r238246) [ MacOS Debug ] Layout Test http/wpt/webauthn/ctap-hid-failure.https.html...
jiewen_tan@apple.com [Tue, 27 Nov 2018 22:40:51 +0000 (22:40 +0000)]
(r238246) [ MacOS Debug ] Layout Test http/wpt/webauthn/ctap-hid-failure.https.html is Crashing
https://bugs.webkit.org/show_bug.cgi?id=191757

Reviewed by Chris Dumez.

Wrong nonce error causes retransmission, which then trigger wrong nonce error. This is expected
behavior for mock testing. However, the main thread could time out when MockHidConnection::send
is excuting the block on another thread. The block will then return without invoking the callback,
which triggers this WTFCrash. The solution is always invoking the callback before return in the
block.

* UIProcess/WebAuthentication/Mock/MockHidConnection.cpp:
(WebKit::MockHidConnection::send):

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

8 months ago[Re-landing] NaNs read from Wasm code needs to be be purified.
mark.lam@apple.com [Tue, 27 Nov 2018 22:14:56 +0000 (22:14 +0000)]
[Re-landing] NaNs read from Wasm code needs to be be purified.
https://bugs.webkit.org/show_bug.cgi?id=191056
<rdar://problem/45660341>

Reviewed by Filip Pizlo.

* wasm/js/WebAssemblyModuleRecord.cpp:
(JSC::WebAssemblyModuleRecord::link):

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

8 months agoBetter parsing of comments in generate-message*.py
krollin@apple.com [Tue, 27 Nov 2018 22:12:53 +0000 (22:12 +0000)]
Better parsing of comments in generate-message*.py
https://bugs.webkit.org/show_bug.cgi?id=191866
<rdar://problem/46189563>

Reviewed by Chris Dumez.

The script parsing the *.messages.in files would treat a line starting
with '#' as a comment, but not a line starting with '<whitespace>#'.
This means that jamming a '#' right in front of the first character of
a message definition (as opposed to the beginning of a line) will have
no effect and the line will get treated just the same as a
non-commented line. Fix this by trimming all white space from the
beginning and ending of the line before processing it.

* Scripts/webkit/parser.py:
(parse):
* Scripts/webkit/test-messages.in:

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

8 months agoMomentum scrolling ends at the wrong place when a scrolling overflow element has...
simon.fraser@apple.com [Tue, 27 Nov 2018 22:03:19 +0000 (22:03 +0000)]
Momentum scrolling ends at the wrong place when a scrolling overflow element has a non-zero border
https://bugs.webkit.org/show_bug.cgi?id=191322

Reviewed by Dean Jackson.
Source/WebCore:

The scrolling momentum logic in ScrollController::handleWheelEvent() which computes whether the scroll is pinned
to the end makes use of ScrollableArea::visibleContentRect(). RenderLayer's implementation of this was incorrect when
the layer's element had borders, causing the momentum scroll to stop early.

Fix by using the correct size (visible size, not layer size).

Test: fast/scrolling/momentum-scroll-with-borders.html

* rendering/RenderLayer.cpp:
(WebCore::RenderLayer::visibleContentRectInternal const):

LayoutTests:

* fast/scrolling/momentum-scroll-with-borders-expected.txt: Added.
* fast/scrolling/momentum-scroll-with-borders.html: Added.
* platform/ios/TestExpectations:

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

8 months agoComposited and tiled layers fail to update on scrolling in WebView
simon.fraser@apple.com [Tue, 27 Nov 2018 21:50:03 +0000 (21:50 +0000)]
Composited and tiled layers fail to update on scrolling in WebView
https://bugs.webkit.org/show_bug.cgi?id=191821
rdar://problem/46009272

Reviewed by Zalan Bujtas.

Source/WebCore:

We relied on AppKit calling -[NSView viewWillDraw] on scrolling to trigger compositing
layer flushes which are necessary to update backing store attachment, and tile coverage
for tiled layers. However, we no longer get these reliably in WebView, so explicitly trigger
flushes if necessary from FrameView::scrollOffsetChangedViaPlatformWidgetImpl().
didChangeVisibleRect() is the same code path used by iOS UIWebView for the same purpose.

Tests: compositing/backing/backing-store-attachment-scroll.html
       compositing/tiling/tile-coverage-on-scroll.html

* page/FrameView.cpp:
(WebCore::FrameView::scrollOffsetChangedViaPlatformWidgetImpl):
* platform/graphics/ca/GraphicsLayerCA.cpp:
(WebCore::GraphicsLayerCA::updateCoverage):

LayoutTests:

Tests for backing store attachment, and tile coverage before and after scrolling.

* compositing/backing/backing-store-attachment-scroll-expected.txt: Added.
* compositing/backing/backing-store-attachment-scroll.html: Added.
* compositing/tiling/tile-coverage-on-scroll-expected.txt: Added.
* compositing/tiling/tile-coverage-on-scroll.html: Added.
* platform/mac-wk1/compositing/tiling/tile-coverage-on-scroll-expected.txt: Added. Root isn't tiled on WK1, so different result.

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

8 months ago[GTK|WPE] Allow disabling WebRTC unified plan SDP through an env var
commit-queue@webkit.org [Tue, 27 Nov 2018 21:48:47 +0000 (21:48 +0000)]
[GTK|WPE] Allow disabling WebRTC unified plan SDP through an env var
https://bugs.webkit.org/show_bug.cgi?id=192024

Patch by Thibault Saunier <tsaunier@igalia.com> on 2018-11-27
Reviewed by Michael Catanzaro.

* UIProcess/API/glib/WebKitSettings.cpp:
(webKitSettingsConstructed):

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

8 months agoFix test timeout following <https://trac.webkit.org/changeset/238545>
dbates@webkit.org [Tue, 27 Nov 2018 21:22:35 +0000 (21:22 +0000)]
Fix test timeout following  <https://trac.webkit.org/changeset/238545>
(https://bugs.webkit.org/show_bug.cgi?id=191969)

Actually call HTMLInputElement.setSelectionRange().

* fast/forms/auto-fill-button/caps-lock-indicator-should-be-visible-after-hiding-auto-fill-strong-password-button-expected.html:

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

8 months agoWeb Inspector: Add support for forcing color scheme appearance in DOM tree.
timothy@apple.com [Tue, 27 Nov 2018 21:16:07 +0000 (21:16 +0000)]
Web Inspector: Add support for forcing color scheme appearance in DOM tree.
https://bugs.webkit.org/show_bug.cgi?id=191820
rdar://problem/46153172

Reviewed by Devin Rousso.

Source/JavaScriptCore:

* inspector/protocol/Page.json: Added setForcedAppearance.
Also added the defaultAppearanceDidChange event and Appearance enum.

Source/WebCore:

Test: inspector/css/force-page-appearance.html

* inspector/InspectorInstrumentation.cpp:
(WebCore::InspectorInstrumentation::defaultAppearanceDidChangeImpl):
* inspector/InspectorInstrumentation.h:
(WebCore::InspectorInstrumentation::defaultAppearanceDidChange):
* inspector/agents/InspectorPageAgent.cpp:
(WebCore::InspectorPageAgent::enable): Fire defaultAppearanceDidChange() on macOS Majave.
(WebCore::InspectorPageAgent::disable): Call setForcedAppearance() with empty string.
(WebCore::InspectorPageAgent::defaultAppearanceDidChange): Added.
(WebCore::InspectorPageAgent::setForcedAppearance): Added.
* inspector/agents/InspectorPageAgent.h:
* page/Page.cpp:
(WebCore::Page::setUseDarkAppearance): Call InspectorInstrumentation::defaultAppearanceDidChange().
(WebCore::Page::useDarkAppearance const): Return override value if not nullopt.
(WebCore::Page::setUseDarkAppearanceOverride): Added.
* page/Page.h:
(WebCore::Page::defaultUseDarkAppearance const): Added.

Source/WebInspectorUI:

* Localizations/en.lproj/localizedStrings.js: Updated.
* UserInterface/Controllers/CSSManager.js:
(WI.CSSManager):
(WI.CSSManager.prototype.get defaultAppearance): Added.
(WI.CSSManager.prototype.get forcedAppearance): Added.
(WI.CSSManager.prototype.set forcedAppearance): Added.
(WI.CSSManager.prototype.canForceAppearance): Added.
(WI.CSSManager.prototype.defaultAppearanceDidChange): Added.
* UserInterface/Images/Appearance.svg: Added.
* UserInterface/Protocol/PageObserver.js:
(WI.PageObserver.prototype.defaultAppearanceChanged): Added.
* UserInterface/Views/DOMTreeContentView.js:
(WI.DOMTreeContentView):
(WI.DOMTreeContentView.prototype.get navigationItems):
(WI.DOMTreeContentView.prototype._defaultAppearanceDidChange): Added.
(WI.DOMTreeContentView.prototype._toggleAppearance): Added.

LayoutTests:

* TestExpectations: Skip dark mode tests on other platforms.
* inspector/css/force-page-appearance-expected.txt: Added.
* inspector/css/force-page-appearance.html: Added.
* platform/mac/TestExpectations: Expect dark mode tests to pass on Mojave and later.

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

8 months agoWeb Inspector: Cookies table needs copy keyboard shortcut and context menu support
mattbaker@apple.com [Tue, 27 Nov 2018 21:06:52 +0000 (21:06 +0000)]
Web Inspector: Cookies table needs copy keyboard shortcut and context menu support
https://bugs.webkit.org/show_bug.cgi?id=191482
<rdar://problem/45953002>

Reviewed by Joseph Pecoraro.

* UserInterface/Views/CookieStorageContentView.js:
(WI.CookieStorageContentView.prototype.handleCopyEvent):
(WI.CookieStorageContentView.prototype.tableCellContextMenuClicked):
As with Delete, if the target row is selected, all selected rows are copied.
Otherwise only the target row is copied. This distinction will be surfaced
in the UI in https://webkit.org/b/191095.

(WI.CookieStorageContentView.prototype.tablePopulateCell):
(WI.CookieStorageContentView.prototype._cookiesAtIndexes):
(WI.CookieStorageContentView.prototype._formatCookiesAsText):
(WI.CookieStorageContentView.prototype._formatCookiePropertyForColumn):
(WI.CookieStorageContentView):
Break Cookie property formatting into a helper method, which is used for
formatting Table cells and creating plain text for the clipboard.

* UserInterface/Views/Table.js:
(WI.Table.prototype.get columns):

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

8 months agoUnreviewed, rolling out r238509.
ryanhaddad@apple.com [Tue, 27 Nov 2018 21:03:29 +0000 (21:03 +0000)]
Unreviewed, rolling out r238509.

Causes JSC tests to fail on iOS.

Reverted changeset:

"NaNs read from Wasm code needs to be be purified."
https://bugs.webkit.org/show_bug.cgi?id=191056
https://trac.webkit.org/changeset/238509

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

8 months agoModernize the check for async _saveCookies existence
ap@apple.com [Tue, 27 Nov 2018 20:40:40 +0000 (20:40 +0000)]
Modernize the check for async _saveCookies existence
https://bugs.webkit.org/show_bug.cgi?id=191987

Reviewed by Dean Jackson.

Source/WebCore/PAL:

* pal/spi/cf/CFNetworkSPI.h: Also removed a check around _socketStreamProperties,
which exists everywhere.

Source/WebKit:

* NetworkProcess/cocoa/NetworkProcessCocoa.mm:
(WebKit::NetworkProcess::platformSyncAllCookies):

Source/WTF:

* wtf/Platform.h: Added a specific macro for this. Not changing the behavior here,
although it seems very likely that we want to do the same on other iOS family OSes.

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

8 months agoSerialize and deserialize editable image strokes
timothy_horton@apple.com [Tue, 27 Nov 2018 20:20:18 +0000 (20:20 +0000)]
Serialize and deserialize editable image strokes
https://bugs.webkit.org/show_bug.cgi?id=192002
<rdar://problem/30900149>

Reviewed by Dean Jackson.

Source/WebCore:

Test: editing/images/paste-editable-image.html

* html/HTMLImageElement.cpp:
(WebCore::HTMLImageElement::parseAttribute):
(WebCore::HTMLImageElement::insertedIntoAncestor):
(WebCore::HTMLImageElement::didFinishInsertingNode):
(WebCore::HTMLImageElement::removedFromAncestor):
(WebCore::HTMLImageElement::hasEditableImageAttribute const):
(WebCore::HTMLImageElement::updateEditableImage):
Call updateEditableImage() from didFinishInsertingNode instead of insertedIntoAncestor.
This is helpful because it means we get the final, deduplicated attachment identifier
instead of the original one when cloning or pasting.

This also means that isConnected() is now always accurate when updateEditableImage()
is called, so we can remove the argument that allowed us to lie from inside insertedIntoAncestor.

* html/HTMLImageElement.h:
* rendering/RenderImage.cpp:
(WebCore::RenderImage::isEditableImage const):
Make use of hasEditableImage instead of separately checking for the attribute.

Source/WebKit:

* UIProcess/API/APIAttachment.cpp:
(API::Attachment::updateAttributes):
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::willUpdateAttachmentAttributes):
* UIProcess/WebPageProxy.h:
When an attachment would update its DOM attributes, plumb a notification
to EditableImageController, and allow it to block the update (because
we don't really want to set src for editable image attachments,
we just want the UI process to fully own the data).

* Platform/spi/ios/PencilKitSPI.h:
Add some SPI.

* UIProcess/ios/EditableImageController.h:
* UIProcess/ios/EditableImageController.mm:
(WebKit::EditableImageController::loadStrokesFromAttachment):
Add a helper to load strokes from an attachment.

(WebKit::EditableImageController::associateWithAttachment):
Try to load strokes from the attachment when initially associated.
Don't create a file wrapper around a null image, so it will be regenerated later.

(WebKit::EditableImageController::willUpdateAttachmentAttributes):
The aforementioned plumbing at update time.

* UIProcess/ios/WKDrawingView.h:
* UIProcess/ios/WKDrawingView.mm:
(-[WKDrawingView layoutSubviews]):
Invalidate the attachment (so it will be regenerated upon request) if the
canvas size changes.

(-[WKDrawingView PNGRepresentation]):
Serialize strokes into the EXIF User Comment field.
We will find a different field to use (ideally a custom vendor-specific
field that nobody else will use for anything), but this works for now.

Don't try to render an image if we don't have a size or scale;
PKImageRenderer will just fail anyway, so bail early.

In the iOS Simulator, PKImageRenderer currently returns an unusable image.
Instead, so that we have a image on which to serialize the strokes,
create a transparent 1x1 image. This makes it possible to serialize strokes
even though we don't have a usable rendered image, so that we can still test
this change (and future changes).

(-[WKDrawingView loadDrawingFromPNGRepresentation:]):
If available, deserialize strokes from the EXIF User Comment field.

(-[WKDrawingView drawingDidChange:]):
(-[WKDrawingView invalidateAttachment]):
Factor invalidateAttachment out of drawingDidChange so we can call
it from layoutSubviews too!

LayoutTests:

* editing/images/paste-editable-image-expected.txt: Added.
* editing/images/paste-editable-image.html: Added.
Add a test that we can copy and paste and editable image and
continue to edit it, and are affecting a different attachment than the original.

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

8 months agoRegression(PSON) crash under WebPageProxy::didReceiveServerRedirectForProvisionalLoad...
cdumez@apple.com [Tue, 27 Nov 2018 19:52:36 +0000 (19:52 +0000)]
Regression(PSON) crash under WebPageProxy::didReceiveServerRedirectForProvisionalLoadForFrame()
https://bugs.webkit.org/show_bug.cgi?id=191983
<rdar://problem/46246863>

Reviewed by Geoffrey Garen.

Source/WebKit:

* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::continueNavigationInNewProcess):
Make sure the navigation still exists in m_mainFrameCreationHandler and return early if it
does not.

(WebKit::WebPageProxy::resetState):
Clear out m_mainFrameCreationHandler / m_mainFrameWindowCreationHandler if we resetting the state
after a crash. At this point, there is no chance the WebProcess will send us the IPC that will
cause these to get called and we do not want old state to remain for future navigations.

Tools:

Add API test coverage.

* TestWebKitAPI/Tests/WebKitCocoa/ProcessSwapOnNavigation.mm:

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

8 months agoIntroducing a ENABLE_SEPARATED_WX_HEAP macro.
mark.lam@apple.com [Tue, 27 Nov 2018 19:47:17 +0000 (19:47 +0000)]
Introducing a ENABLE_SEPARATED_WX_HEAP macro.
https://bugs.webkit.org/show_bug.cgi?id=192013
<rdar://problem/45494310>

Reviewed by Keith Miller.

This makes the code a little more readable.

I put the definition of ENABLE_SEPARATED_WX_HEAP in JSC's config.h instead of
Platform.h because ENABLE_SEPARATED_WX_HEAP is only needed inside JSC.  Also,
ENABLE_SEPARATED_WX_HEAP depends on ENABLE(FAST_JIT_PERMISSIONS), which is only
defined for JSC.

* config.h:
* jit/ExecutableAllocator.cpp:
(JSC::FixedVMPoolExecutableAllocator::FixedVMPoolExecutableAllocator):
(JSC::FixedVMPoolExecutableAllocator::initializeSeparatedWXHeaps):
* jit/ExecutableAllocator.h:
(JSC::performJITMemcpy):
* runtime/Options.cpp:
(JSC::recomputeDependentOptions):

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

8 months agoWeb Inspector: Table selection should be handled by a SelectionController
mattbaker@apple.com [Tue, 27 Nov 2018 19:41:17 +0000 (19:41 +0000)]
Web Inspector: Table selection should be handled by a SelectionController
https://bugs.webkit.org/show_bug.cgi?id=191977
<rdar://problem/46253093>

Reviewed by Devin Rousso.

Add a SelectionController class, which manages an IndexSet of selected
items, and provides operations for adding and removing items from the
selection. Complex behaviors such as shift-clicking to select a range of
items, and updating the selection using the keyboard, are forwarded to
the controller using special-purpose methods that accept DOM Event objects.

* UserInterface/Base/Utilities.js:

* UserInterface/Controllers/SelectionController.js: Added.
(WI.SelectionController):
(WI.SelectionController.prototype.get delegate):
(WI.SelectionController.prototype.get lastSelectedItem):
(WI.SelectionController.prototype.get selectedItems):
(WI.SelectionController.prototype.get allowsMultipleSelection):
(WI.SelectionController.prototype.set allowsMultipleSelection):
(WI.SelectionController.prototype.get numberOfItems):
(WI.SelectionController.prototype.hasSelectedItem):
(WI.SelectionController.prototype.selectItem):
(WI.SelectionController.prototype.deselectItem):
(WI.SelectionController.prototype.selectAll):
(WI.SelectionController.prototype.deselectAll):
(WI.SelectionController.prototype.removeSelectedItems):
(WI.SelectionController.prototype.reset):
(WI.SelectionController.prototype.didRemoveItem):
(WI.SelectionController.prototype.handleKeyDown):
(WI.SelectionController.prototype.handleItemMouseDown.normalizeRange):
(WI.SelectionController.prototype.handleItemMouseDown):
(WI.SelectionController.prototype._deselectAllAndSelect):
(WI.SelectionController.prototype._selectItemsFromArrowKey):
(WI.SelectionController.prototype._nextSelectableIndex):
(WI.SelectionController.prototype._previousSelectableIndex):
(WI.SelectionController.prototype._updateSelectedItems):

* UserInterface/Main.html:
* UserInterface/Test.html:

* UserInterface/Views/Table.js:
(WI.Table):
(WI.Table.prototype.get selectedRow):
(WI.Table.prototype.get selectedRows):
(WI.Table.prototype.get allowsMultipleSelection):
(WI.Table.prototype.set allowsMultipleSelection):
(WI.Table.prototype.isRowSelected):
(WI.Table.prototype.reloadData):
(WI.Table.prototype.selectRow):
(WI.Table.prototype.deselectRow):
(WI.Table.prototype.selectAll):
(WI.Table.prototype.deselectAll):
(WI.Table.prototype.removeRow):
(WI.Table.prototype.removeSelectedRows):
(WI.Table.prototype.selectionControllerSelectionDidChange):
(WI.Table.prototype.selectionControllerNumberOfItems):
(WI.Table.prototype.selectionControllerNextSelectableIndex):
(WI.Table.prototype.selectionControllerPreviousSelectableIndex):
(WI.Table.prototype._handleKeyDown):
(WI.Table.prototype._handleMouseDown):
(WI.Table.prototype._removeRows):
(WI.Table.prototype._toggleSelectedRowStyle):
(WI.Table.prototype._selectRowsFromArrowKey): Deleted.
(WI.Table.prototype._handleMouseDown.normalizeRange): Deleted.
(WI.Table.prototype._deselectAllAndSelect): Deleted.
(WI.Table.prototype._notifySelectionDidChange): Deleted.
(WI.Table.prototype._updateSelectedRows): Deleted.

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

8 months agoDisallow loading webarchives as iframes
jiewen_tan@apple.com [Tue, 27 Nov 2018 19:38:18 +0000 (19:38 +0000)]
Disallow loading webarchives as iframes
https://bugs.webkit.org/show_bug.cgi?id=191728
<rdar://problem/45524528>

Reviewed by Youenn Fablet.

Source/WebCore:

Disallow loading webarchives as iframes. We don't allow loading remote webarchives.
Now, this policy is hardened to disallow loading webarchives as iframes for local
documents as well.

To allow old tests still be able to run, a flag is added to always allow loading local
webarchives in document. The flag can be set via window.internals.

Tests: webarchive/loading/test-loading-archive-subresource.html
       webarchive/loading/test-loading-top-archive.html

* dom/Document.h:
(WebCore::Document::setAlwaysAllowLocalWebarchive):
(WebCore::Document::alwaysAllowLocalWebarchive):
* loader/DocumentLoader.cpp:
(WebCore::disallowWebArchive):
(WebCore::DocumentLoader::continueAfterContentPolicy):
(WebCore::isRemoteWebArchive): Deleted.
* testing/Internals.cpp:
(WebCore::Internals::setAlwaysAllowLocalWebarchive const):
* testing/Internals.h:
* testing/Internals.idl:

Source/WebKit:

* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::unableToImplementPolicy):
Add a check to prevent null pointer dereference.

LayoutTests:

* platform/mac-wk1/webarchive/loading/test-loading-archive-subresource-expected.txt: Added.
* platform/mac/fast/loader/webarchive-encoding-respected.html:
* webarchive/loading/cache-expired-subresource.html:
* webarchive/loading/mainresource-null-mimetype-crash.html:
* webarchive/loading/missing-data.html:
* webarchive/loading/resources/test-loading-archive-main.webarchive: Copied from LayoutTests/webarchive/loading/test-loading-archive.html.
* webarchive/loading/test-loading-archive-subresource-expected.txt: Added.
* webarchive/loading/test-loading-archive-subresource-null-mimetype.html:
* webarchive/loading/test-loading-archive-subresource.html: Copied from LayoutTests/webarchive/loading/test-loading-archive.html.
* webarchive/loading/test-loading-archive.html:
* webarchive/loading/test-loading-top-archive-expected.txt: Added.
* webarchive/loading/test-loading-top-archive.html: Added.

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

8 months agoUnregister CDMSessionMediaSourceAVFObjC for error notifications during destruction.
jer.noble@apple.com [Tue, 27 Nov 2018 19:34:06 +0000 (19:34 +0000)]
Unregister CDMSessionMediaSourceAVFObjC for error notifications during destruction.
https://bugs.webkit.org/show_bug.cgi?id=191985
<rdar://problem/45972018>

Reviewed by Eric Carlson.

* platform/graphics/avfoundation/objc/CDMSessionMediaSourceAVFObjC.mm:
(WebCore::CDMSessionMediaSourceAVFObjC::~CDMSessionMediaSourceAVFObjC):

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

8 months agoAdopt -setOverrideRouteSharingPolicy:routingContextUID: SPI
jer.noble@apple.com [Tue, 27 Nov 2018 19:31:51 +0000 (19:31 +0000)]
Adopt -setOverrideRouteSharingPolicy:routingContextUID: SPI
https://bugs.webkit.org/show_bug.cgi?id=190951
<rdar://problem/45213065>

Further follow-up build fix; add ASSUME_NONNULL macros to SPI declaration.

* pal/spi/cocoa/AVKitSPI.h:

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

8 months ago[GStreamer][WebRTC] Use LibWebRTC provided vp8 decoders and encoders
commit-queue@webkit.org [Tue, 27 Nov 2018 17:34:28 +0000 (17:34 +0000)]
[GStreamer][WebRTC] Use LibWebRTC provided vp8 decoders and encoders
https://bugs.webkit.org/show_bug.cgi?id=191861

Source/ThirdParty/libwebrtc:

Patch by Thibault Saunier <tsaunier@igalia.com> on 2018-11-27
Reviewed by Philippe Normand.

* CMakeLists.txt: Build LibVPX vp8 encoder and decoders.

Source/WebCore:

The GStreamer implementations are less feature full and less tested, now that Apple
also use the LibWebRTC provided implementations it makes a lot of sense for us to
do the same.

Basically everything related to temporal scalability is not implemented in GStreamer.

We should make sure to use GStreamer elements on low powered platforms and for
accelerated encoders and decoders.

Patch by Thibault Saunier <tsaunier@igalia.com> on 2018-11-27
Reviewed by Philippe Normand.

This is mostly refactoring, no new test required.

* platform/graphics/gstreamer/GStreamerCommon.h: Added GstMappedFrame similar to GstMappedBuffer but for video frames.
(WebCore::GstMappedFrame::GstMappedFrame):
(WebCore::GstMappedFrame::get):
(WebCore::GstMappedFrame::ComponentData):
(WebCore::GstMappedFrame::ComponentStride):
(WebCore::GstMappedFrame::info):
(WebCore::GstMappedFrame::width):
(WebCore::GstMappedFrame::height):
(WebCore::GstMappedFrame::format):
(WebCore::GstMappedFrame::~GstMappedFrame):
(WebCore::GstMappedFrame::operator bool const):
* platform/graphics/gstreamer/GUniquePtrGStreamer.h:
* platform/mediastream/gstreamer/GStreamerVideoFrameLibWebRTC.cpp:
(WebCore::GStreamerVideoFrameLibWebRTC::ToI420): Implemented support for converting frame formats with the GstVideoConverter API
* platform/mediastream/libwebrtc/GStreamerVideoDecoderFactory.cpp:
(WebCore::GStreamerVideoDecoder::GstDecoderFactory):
(WebCore::GStreamerVideoDecoder::HasGstDecoder):
(WebCore::VP8Decoder::Create): Creates a `webrtc::LibvpxVp8Decoder()` if GStreamer decoder would be the LibVPX based one.
(WebCore::GStreamerVideoDecoderFactory::CreateVideoDecoder):
* platform/mediastream/libwebrtc/GStreamerVideoEncoder.cpp:
(gst_webrtc_video_encoder_class_init):
* platform/mediastream/libwebrtc/GStreamerVideoEncoderFactory.cpp: Stop using vp8enc and use LibWebRTC based implementation
(WebCore::GStreamerH264Encoder::GStreamerH264Encoder): Renamed H264Encoder to GStreamerH264Encoder to be more coherent with what is done in LibVPX
(WebCore::GStreamerVP8Encoder::GStreamerVP8Encoder): Renamed VP8Encoder to GStreamerVP8Encoder to be more coherent with what is done in LibVPX
(WebCore::GStreamerVideoEncoderFactory::CreateVideoEncoder):
(WebCore::GStreamerVideoEncoderFactory::GetSupportedFormats const):

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

8 months agoAdopt -setOverrideRouteSharingPolicy:routingContextUID: SPI
jer.noble@apple.com [Tue, 27 Nov 2018 17:28:23 +0000 (17:28 +0000)]
Adopt -setOverrideRouteSharingPolicy:routingContextUID: SPI
https://bugs.webkit.org/show_bug.cgi?id=190951
<rdar://problem/45213065>

Follow-up build fix when building against older SDKs.

* pal/spi/cocoa/AVKitSPI.h:

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

8 months agoLayout Test svg/text/monospace-text-size-in-img.html is failing
pvollan@apple.com [Tue, 27 Nov 2018 17:05:35 +0000 (17:05 +0000)]
Layout Test svg/text/monospace-text-size-in-img.html is failing
https://bugs.webkit.org/show_bug.cgi?id=192011

Unreviewed test gardening.

* platform/win/TestExpectations:

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

8 months agoLayout Test fast/inline/simple-inline-with-out-of-flow-descendant.html is failing
pvollan@apple.com [Tue, 27 Nov 2018 17:00:48 +0000 (17:00 +0000)]
Layout Test fast/inline/simple-inline-with-out-of-flow-descendant.html is failing
https://bugs.webkit.org/show_bug.cgi?id=192010

Unreviewed test gardening.

* platform/win/TestExpectations:

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

8 months agoWebKit.AddAndRemoveDataDetectors hits a debug assertion after r238515
wenson_hsieh@apple.com [Tue, 27 Nov 2018 15:51:43 +0000 (15:51 +0000)]
WebKit.AddAndRemoveDataDetectors hits a debug assertion after r238515
https://bugs.webkit.org/show_bug.cgi?id=191996

Reviewed by Tim Horton.

This assertion is hit because `decode(Decoder& decoder, NSArray<Class> *allowedClasses)` expects the decoded
object (of class `_NSArrayM`) to be equal to `NSArray.class`.

We fix the crash by relaxing the debug assertion when decoding securely-codable objects over IPC. Instead of
checking that the class of the decoded object is equal to one of the allowed classes, check that the object is a
kind of any of the allowed classes.

* Shared/Cocoa/ArgumentCodersCocoa.h:
(IPC::isObjectClassAllowed):
(IPC::decode):

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

8 months ago[GTK][WPE] Remove temporary workaround in Source/WebKit/Platform*.cmake
tpopela@redhat.com [Tue, 27 Nov 2018 15:29:55 +0000 (15:29 +0000)]
[GTK][WPE] Remove temporary workaround in Source/WebKit/Platform*.cmake
https://bugs.webkit.org/show_bug.cgi?id=192008

Reviewed by Michael Catanzaro.

Looks like it's not needed anymore as the code compiles fine without
it.

* PlatformGTK.cmake:
* PlatformWPE.cmake:

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

8 months ago[css-grid] align-self center and position sticky don't work together
jfernandez@igalia.com [Tue, 27 Nov 2018 13:52:57 +0000 (13:52 +0000)]
[css-grid] align-self center and position sticky don't work together
https://bugs.webkit.org/show_bug.cgi?id=191963

Reviewed by Manuel Rego Casasnovas.

LayoutTests/imported/w3c:

This change makes several cases of the following tests to pass now.

* web-platform-tests/css/css-grid/alignment/grid-column-axis-alignment-sticky-positioned-items-001-expected.txt:
* web-platform-tests/css/css-grid/alignment/grid-column-axis-alignment-sticky-positioned-items-002-expected.txt:
* web-platform-tests/css/css-grid/alignment/grid-row-axis-alignment-sticky-positioned-items-001-expected.txt:
* web-platform-tests/css/css-grid/alignment/grid-row-axis-alignment-sticky-positioned-items-002-expected.txt:

Source/WebCore:

This is a fix for a regression introduced in r515391, where we landed
the implementation of alignment for positioned objects in a Grid Layout
container.

We assumed that items with non-static positions shouldn't honor the
CSS Box Alignment properties. This is only true for out-of-flow items,
absolute or fixed positioned elements. However, sticky positioned
elements are treated as relative positioned items, but they indeed use
non-static position to define their behavior.

No new tests, this change is covered by current tests and make several cases to pass now.

* rendering/RenderGrid.cpp:
(WebCore::RenderGrid::columnAxisPositionForChild const):
(WebCore::RenderGrid::rowAxisPositionForChild const):

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

8 months agoFactor mask layer applying in RemoteLayerTreePropertyApplier into a shared function
antti@apple.com [Tue, 27 Nov 2018 13:34:17 +0000 (13:34 +0000)]
Factor mask layer applying in RemoteLayerTreePropertyApplier into a shared function
https://bugs.webkit.org/show_bug.cgi?id=192001

Reviewed by Tim Horton.

* Shared/RemoteLayerTree/RemoteLayerTreePropertyApplier.h:
* Shared/RemoteLayerTree/RemoteLayerTreePropertyApplier.mm:
(WebKit::RemoteLayerTreePropertyApplier::applyProperties):
(WebKit::RemoteLayerTreePropertyApplier::updateMask):

Shared function, with some special tricks for iOS backdrop layers.

(WebKit::RemoteLayerTreePropertyApplier::applyPropertiesToUIView):

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

8 months agoStop collecting related layers in RemoteLayerTreeHost::updateLayerTree
antti@apple.com [Tue, 27 Nov 2018 12:39:27 +0000 (12:39 +0000)]
Stop collecting related layers in RemoteLayerTreeHost::updateLayerTree
https://bugs.webkit.org/show_bug.cgi?id=192003

Reviewed by Tim Horton.

We can pass the node hash directly to RemoteLayerTreePropertyApplier. The collection step doesn't seem
to add anything except an extra hash lookup.

* Shared/RemoteLayerTree/RemoteLayerTreePropertyApplier.h:
* UIProcess/RemoteLayerTree/RemoteLayerTreeHost.mm:
(WebKit::RemoteLayerTreeHost::updateLayerTree):

Pass m_nodes directly.
Some random cleanups.

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

8 months ago[ews-app] Add support to communicate with Buildbot (Follow-up fix)
aakash_jain@apple.com [Tue, 27 Nov 2018 12:27:29 +0000 (12:27 +0000)]
[ews-app] Add support to communicate with Buildbot (Follow-up fix)
https://bugs.webkit.org/show_bug.cgi?id=191935
<rdar://problem/46262314>

Unreviewed infrastructure fix.

* BuildSlaveSupport/ews-app/ews/common/buildbot.py:
(Buildbot.send_patch_to_buildbot):

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

8 months agoRemote tile layers shouldn't be UIViews
antti@apple.com [Tue, 27 Nov 2018 09:12:03 +0000 (09:12 +0000)]
Remote tile layers shouldn't be UIViews
https://bugs.webkit.org/show_bug.cgi?id=191953

Reviewed by Tim Horton.

They don't need any UIView functionality, nor do they ever have UIView descendants.
We can use lighter weight objects.

* Shared/RemoteLayerTree/RemoteLayerTreePropertyApplier.h:
* Shared/RemoteLayerTree/RemoteLayerTreePropertyApplier.mm:
(WebKit::RemoteLayerTreePropertyApplier::applyProperties):
(WebKit::RemoteLayerTreePropertyApplier::updateChildren):

Factor to a function shared between platforms.
Support having both views and plain layers in the same tree.
Assert that all siblings are of the same type and that we don't attempt to add views to layers.

(WebKit::RemoteLayerTreePropertyApplier::applyPropertiesToUIView):
* UIProcess/RemoteLayerTree/RemoteLayerTreeHost.mm:
(WebKit::RemoteLayerTreeHost::makeNode):

Use new plain layer on Mac too.

* UIProcess/RemoteLayerTree/RemoteLayerTreeNode.h:
* UIProcess/RemoteLayerTree/RemoteLayerTreeNode.mm:
(-[WKPlainRemoteLayer description]):

Add a CALayer subclass so we can have a description, similar to WKCompositingView and pals.

(WebKit::RemoteLayerTreeNode::createWithPlainLayer):
(WebKit::RemoteLayerTreeNode::detachFromParent):

Support having null view.

(WebKit::RemoteLayerTreeNode::appendLayerDescription):

Helper for layer descriptions.

* UIProcess/RemoteLayerTree/ios/RemoteLayerTreeHostIOS.mm:
(WebKit::RemoteLayerTreeHost::makeNode):

Construct plain layers for tiles.

* UIProcess/RemoteLayerTree/ios/RemoteLayerTreeViews.mm:
(-[WKCompositingView description]):
(-[WKUIRemoteView description]):
(-[WKBackdropView description]):

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

8 months agoRemove "using namespace WebCore" under Source/WebKit/WebProcess/InjectedBundle/API
Hironori.Fujii@sony.com [Tue, 27 Nov 2018 08:59:00 +0000 (08:59 +0000)]
Remove "using namespace WebCore" under Source/WebKit/WebProcess/InjectedBundle/API
https://bugs.webkit.org/show_bug.cgi?id=191995

Reviewed by Alex Christensen.

The statement "using namespace WebCore" should be placed inside
namespace WebKit for unified source builds. But, source files
defining WebKit API can't be enclosed by namespace WebKit { }
becuase they are defined in the global scope.

"using namespace WebCore" in global scope and unified source
builds may cause build breaks (Bug 191853).

Remove "using namespace WebCore" in the global scope. Use
"WebCore::" prefix instead.

* WebProcess/InjectedBundle/API/c/WKBundle.cpp:
(WKBundleClearAllDatabases):
(WKBundleSetDatabaseQuota):
(WKBundleClearResourceLoadStatistics):
(WKBundleResourceLoadStatisticsNotifyObserver):
* WebProcess/InjectedBundle/API/c/WKBundleFrame.cpp:
(WKBundleFrameGetFrameLoadState):
(WKBundleFrameClearOpener):
(WKBundleFrameCallShouldCloseOnWebView):
(WKBundleFrameCopySecurityOrigin):
(WKBundleFrameFocus):
* WebProcess/InjectedBundle/API/c/WKBundleInspector.cpp:
* WebProcess/InjectedBundle/API/c/WKBundlePageOverlay.cpp:

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

8 months agoREGRESSION (r238078): Do not draw caps lock indicator when Strong Password button...
dbates@webkit.org [Tue, 27 Nov 2018 04:17:11 +0000 (04:17 +0000)]
REGRESSION (r238078): Do not draw caps lock indicator when Strong Password button is shown
https://bugs.webkit.org/show_bug.cgi?id=191969
<rdar://problem/46247569>

Reviewed by Dean Jackson.

Source/WebCore:

Following r238078 we now support drawing the caps lock indicator in password fields on iOS.
However it is not meaningful to show the caps lock indicator when the Strong Password button
is visible because the password field is not editable. We should not paint the caps lock
indicator when the Strong Password button is visible.

Tests: fast/forms/auto-fill-button/caps-lock-indicator-should-be-visible-after-hiding-auto-fill-strong-password-button.html
       fast/forms/auto-fill-button/caps-lock-indicator-should-not-be-visible-when-auto-fill-strong-password-button-is-visible.html

* html/TextFieldInputType.cpp:
(WebCore::TextFieldInputType::shouldDrawCapsLockIndicator const): Do not draw the caps
lock indicator when the password field has the Strong Password button.
(WebCore::TextFieldInputType::updateAutoFillButton): Call capsLockStateMayHaveChanged() to
update the visibility of the caps lock indicator when the auto fill button has changed.

LayoutTests:

Add tests to ensure that we show or hide the caps lock indicator depending on whether the
Strong Password button is visible.

* TestExpectations: Skip the tests below on all platforms. We will selectively enable them on Mac.
* fast/forms/auto-fill-button/caps-lock-indicator-should-be-visible-after-hiding-auto-fill-strong-password-button-expected.html: Added.
* fast/forms/auto-fill-button/caps-lock-indicator-should-be-visible-after-hiding-auto-fill-strong-password-button.html: Added.
* fast/forms/auto-fill-button/caps-lock-indicator-should-not-be-visible-when-auto-fill-strong-password-button-is-visible-expected.html: Added.
* fast/forms/auto-fill-button/caps-lock-indicator-should-not-be-visible-when-auto-fill-strong-password-button-is-visible.html: Added.
* platform/mac-wk2/TestExpectations: Mark the tests above as PASS so that we run them.

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

8 months ago[Cocoa] No way for clients to tell whether the content view is in the responder chain...
wenson_hsieh@apple.com [Tue, 27 Nov 2018 03:32:06 +0000 (03:32 +0000)]
[Cocoa] No way for clients to tell whether the content view is in the responder chain when the web view is
https://bugs.webkit.org/show_bug.cgi?id=169212
<rdar://problem/30899656>

Reviewed by Tim Horton.

Source/WebKit:

Add an SPI hook to allow internal WKWebView clients to determine whether the WKWebView's content view is the
first responder. Intended for use by clients, such as Mail, that embed native text input views and other views
that may become first responder within the view hierarchy of the WKWebView.

* UIProcess/API/Cocoa/WKWebView.mm:
(-[WKWebView _contentViewIsFirstResponder]):
* UIProcess/API/Cocoa/WKWebViewPrivate.h:

Tools:

Add an API test to exercise the behavior of `-_contentViewIsFirstResponder` when an embedded text input becomes
and resigns first responder.

* TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
* TestWebKitAPI/Tests/WebKitCocoa/WKWebViewFirstResponderTests.mm: Added.
(-[FirstResponderTestingView initWithFrame:]):
(-[FirstResponderTestingView inputField]):
(TestWebKitAPI::TEST):

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

8 months agoRe-introduce op_bitnot
ticaiolima@gmail.com [Tue, 27 Nov 2018 02:26:59 +0000 (02:26 +0000)]
Re-introduce op_bitnot
https://bugs.webkit.org/show_bug.cgi?id=190923

Reviewed by Yusuke Suzuki.

JSTests:

* stress/bit-not-must-generate.js: Added.
* stress/bitwise-not-no-int32.js: Added.

Source/JavaScriptCore:

With the introduction of BigInt as a new type, we can't emit bitwise
not as `x ^ -1` anymore, because this is incompatible with the new type.
Based on that, this Patch is adding `op_bitnot` as a new operation
into LLInt, as well as introducing ArithBitNot node into DFG to support
JIT compilation of such opcode. We will use the ValueProfile of this
intruction in the future to generate better code when its operand
is not Int32.

* assembler/MacroAssemblerARM64.h:
(JSC::MacroAssemblerARM64::not32):
* assembler/MacroAssemblerARMv7.h:
(JSC::MacroAssemblerARMv7::not32):
* assembler/MacroAssemblerMIPS.h:
(JSC::MacroAssemblerMIPS::not32):
* bytecode/BytecodeList.rb:
* bytecode/BytecodeUseDef.h:
(JSC::computeUsesForBytecodeOffset):
(JSC::computeDefsForBytecodeOffset):
* bytecode/CodeBlock.cpp:
(JSC::CodeBlock::finishCreation):
* bytecode/Opcode.h:
(JSC::padOpcodeName):
* bytecompiler/BytecodeGenerator.cpp:
(JSC::BytecodeGenerator::emitUnaryOp):
* bytecompiler/NodesCodegen.cpp:
(JSC::UnaryPlusNode::emitBytecode):
(JSC::BitwiseNotNode::emitBytecode): Deleted.
* dfg/DFGAbstractInterpreterInlines.h:
(JSC::DFG::AbstractInterpreter<AbstractStateType>::executeEffects):
* dfg/DFGBackwardsPropagationPhase.cpp:
(JSC::DFG::BackwardsPropagationPhase::propagate):
* dfg/DFGByteCodeParser.cpp:
(JSC::DFG::ByteCodeParser::parseBlock):
* dfg/DFGCapabilities.cpp:
(JSC::DFG::capabilityLevel):
* dfg/DFGClobberize.h:
(JSC::DFG::clobberize):
* dfg/DFGDoesGC.cpp:
(JSC::DFG::doesGC):
* dfg/DFGFixupPhase.cpp:
(JSC::DFG::FixupPhase::fixupNode):
* dfg/DFGNodeType.h:
* dfg/DFGOperations.cpp:
* dfg/DFGOperations.h:
* dfg/DFGPredictionPropagationPhase.cpp:
* dfg/DFGSafeToExecute.h:
(JSC::DFG::safeToExecute):
* dfg/DFGSpeculativeJIT.cpp:
(JSC::DFG::SpeculativeJIT::compileBitwiseNot):
* dfg/DFGSpeculativeJIT.h:
* dfg/DFGSpeculativeJIT32_64.cpp:
(JSC::DFG::SpeculativeJIT::compile):
* dfg/DFGSpeculativeJIT64.cpp:
(JSC::DFG::SpeculativeJIT::compile):
* ftl/FTLCapabilities.cpp:
(JSC::FTL::canCompile):
* ftl/FTLLowerDFGToB3.cpp:
(JSC::FTL::DFG::LowerDFGToB3::compileNode):
(JSC::FTL::DFG::LowerDFGToB3::compileArithBitNot):
* jit/JIT.cpp:
(JSC::JIT::privateCompileMainPass):
(JSC::JIT::privateCompileSlowCases):
* jit/JIT.h:
* jit/JITArithmetic.cpp:
(JSC::JIT::emit_op_bitnot):
* llint/LowLevelInterpreter32_64.asm:
* llint/LowLevelInterpreter64.asm:
* offlineasm/cloop.rb:
* parser/NodeConstructors.h:
(JSC::BitwiseNotNode::BitwiseNotNode):
* parser/Nodes.h:
* parser/ResultType.h:
(JSC::ResultType::bigIntOrInt32Type):
(JSC::ResultType::forBitOp):
* runtime/CommonSlowPaths.cpp:
(JSC::SLOW_PATH_DECL):
* runtime/CommonSlowPaths.h:

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

8 months ago[Clang][WebKitLegacy][Win] MarshallingHelpers.h(65,47): warning: extra qualification...
Hironori.Fujii@sony.com [Tue, 27 Nov 2018 02:09:01 +0000 (02:09 +0000)]
[Clang][WebKitLegacy][Win] MarshallingHelpers.h(65,47): warning: extra qualification on member 'windowsEpochAbsoluteTime' [-Wmicrosoft-extra-qualification]
https://bugs.webkit.org/show_bug.cgi?id=191959

Reviewed by Alex Christensen.

* MarshallingHelpers.h: Removed extra "MarshallingHelpers::" of windowsEpochAbsoluteTime declaration.

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

8 months ago[Win][Clang] SOFT_LINK reports warning: implicit conversion between pointer-to-functi...
Hironori.Fujii@sony.com [Tue, 27 Nov 2018 02:01:07 +0000 (02:01 +0000)]
[Win][Clang] SOFT_LINK reports warning: implicit conversion between pointer-to-function and pointer-to-object is a Microsoft extension [-Wmicrosoft-cast]
https://bugs.webkit.org/show_bug.cgi?id=191960

Reviewed by Alex Christensen.

* wtf/win/SoftLinking.h: Do reinterpret_cast<void*> a function
pointer argument of EncodePointer. Changed the type of stored
function pointer returned by EncodePointer.

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

8 months agoUnreviewed, rolling out r238357.
ryanhaddad@apple.com [Tue, 27 Nov 2018 01:59:19 +0000 (01:59 +0000)]
Unreviewed, rolling out r238357.

One of the layout tests added with this change is failing on Mojave.

Reverted changeset:
"REGRESSION (r238078): Do not draw caps lock indicator when Strong Password button is shown"
https://bugs.webkit.org/show_bug.cgi?id=191969
https://trac.webkit.org/changeset/238513

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

8 months ago[CMake] Remove ENABLE_ACCESSIBILITY CMake variable
Hironori.Fujii@sony.com [Tue, 27 Nov 2018 01:54:59 +0000 (01:54 +0000)]
[CMake] Remove ENABLE_ACCESSIBILITY CMake variable
https://bugs.webkit.org/show_bug.cgi?id=191831

Reviewed by Michael Catanzaro.

.:

ENABLE_ACCESSIBILITY is a bit confusing name because there is no
such ENABLE_ACCESSIBILITY macros in C++ source files.

* Source/cmake/OptionsGTK.cmake: Removed ENABLE_ACCESSIBILITY.
* Source/cmake/OptionsWPE.cmake: Ditto.
* Source/cmake/OptionsWin.cmake: Ditto.
* Source/cmake/WebKitFeatures.cmake: Ditto.

Tools:

* WebKitTestRunner/CMakeLists.txt:

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

8 months agoInsert <attachment> elements under editable images to make their backing data accessible
timothy_horton@apple.com [Tue, 27 Nov 2018 01:37:22 +0000 (01:37 +0000)]
Insert <attachment> elements under editable images to make their backing data accessible
https://bugs.webkit.org/show_bug.cgi?id=191844
<rdar://problem/30900149>

Reviewed by Simon Fraser.

Source/WebCore:

Test: editing/images/editable-image-creates-attachment.html

* html/HTMLImageElement.cpp:
(WebCore::HTMLImageElement::parseAttribute):
(WebCore::HTMLImageElement::insertedIntoAncestor):
(WebCore::HTMLImageElement::removedFromAncestor):
When the x-apple-editable-image attribute changes, or the element is
moved into or out of a document, call updateEditableImage.

(WebCore::HTMLImageElement::editableImageViewID const):
Adopt EditableImageReference.

(WebCore::HTMLImageElement::updateEditableImage):
When the image element moves into a document, the setting is on, and
the appropriate attribute is applied, add an <attachment> into the
shadow DOM, and inform the UI process both of the editable image's
creation and that it should be associated with the new attachment.

Use an EditableImageReference to extend the lifetime of the
corresponding editable image in the UI process, and to communicate
the attachment association.

If the element was cloned from another editable image element, use the
EditableImageReference and attachmentID from the original; the embedded
view will be re-parented under this element's layer, and the attachment
will be cloned (with a new ID) by editing code if the element is parented.

(WebCore::HTMLImageElement::attachmentIdentifier const):
(WebCore::HTMLImageElement::copyNonAttributePropertiesFromElement):
Store the aforementioned bits of information when cloned so that we can
reconstitute the appropriate attachment data and embedded view.

* html/HTMLImageElement.h:
* page/ChromeClient.h:

* Sources.txt:
* WebCore.xcodeproj/project.pbxproj:
* page/EditableImageReference.cpp: Added.
(WebCore::EditableImageReference::EditableImageReference):
(WebCore::EditableImageReference::~EditableImageReference):
(WebCore::EditableImageReference::associateWithAttachment):
* page/EditableImageReference.h: Added.
(WebCore::EditableImageReference::create):
(WebCore::EditableImageReference::embeddedViewID const):
Add EditableImageReference, which manages the lifetime of the UI-side
EditableImage and helps clients communicate about it. It is refcounted
so that cloned <img> elements can potentially borrow the UI-side state
(in the case where they end up getting parented).

* page/NavigatorBase.cpp:
Fix an unrelated unified build failure that I exposed.

Source/WebKit:

* DerivedSources.make:
* SourcesCocoa.txt:
* UIProcess/API/APIAttachment.h:
fileWrapper() is no longer a trivial getter; it can now construct
the file wrapper from a file wrapper generator if necessary.

Add setFileWrapperGenerator() and invalidateGeneratedFileWrapper().

Make m_fileWrapper mutable so it can be adjusted inside its own getter.

* UIProcess/API/Cocoa/APIAttachmentCocoa.mm:
(API::Attachment::fileWrapper const):
If we have a fileWrapperGenerator and don't have a cached file wrapper,
create one before returning it.

(API::Attachment::invalidateGeneratedFileWrapper):
Invalidate the currently-cached file wrapper. The next time a client
requests the file wrapper it will be regenerated.

(API::Attachment::fileName const):
(API::Attachment::fileSizeForDisplay const):
(API::Attachment::enclosingImageData const):
(API::Attachment::isEmpty const):
(API::Attachment::createSerializedRepresentation const):
Make use of fileWrapper() instead of m_fileWrapper directly, to ensure
that it is created lazily if necessary.

(API::Attachment::setFileWrapperGenerator):
* UIProcess/RemoteLayerTree/ios/RemoteLayerTreeHostIOS.mm:
(WebKit::RemoteLayerTreeHost::createEmbeddedView):
* UIProcess/RemoteLayerTree/ios/RemoteLayerTreeViews.h:
* UIProcess/RemoteLayerTree/ios/RemoteLayerTreeViews.mm:
(-[WKEmbeddedView initWithEmbeddedViewID:]):
Defer to EditableImageController for creating WKDrawingViews for
editable images. This is done primarily so we don't have to pollute
Remote Layer Tree and DrawingArea interfaces with editable-image-specific messages.

* UIProcess/WebPageProxy.cpp:
(WebKit::m_editableImageController):
(WebKit::m_resetRecentCrashCountTimer): Deleted.
* UIProcess/WebPageProxy.h:
(WebKit::WebPageProxy::editableImageController):
Keep an EditableImageController on the WebPageProxy.

* UIProcess/ios/EditableImageController.h: Added.
* UIProcess/ios/EditableImageController.messages.in: Added.
* UIProcess/ios/EditableImageController.mm: Added.
(WebKit::EditableImageController::EditableImageController):
(WebKit::EditableImageController::~EditableImageController):
(WebKit::EditableImageController::ensureEditableImage):
(WebKit::EditableImageController::editableImage):
(WebKit::EditableImageController::didCreateEditableImage):
(WebKit::EditableImageController::didDestroyEditableImage):
(WebKit::EditableImageController::associateWithAttachment):
(WebKit::EditableImageController::invalidateAttachmentForEditableImage):
Add EditableImageController, which keeps track of EditableImages.
It can be messaged directly to create or destroy the UI-side state
of an editable image, and also to associate a WKDrawingView with
a particular attachment.

* UIProcess/ios/WKDrawingView.h:
* UIProcess/ios/WKDrawingView.mm:
(-[WKDrawingView initWithEmbeddedViewID:webPageProxy:]):
Store the WebPageProxy (weakly) so that we can get to the EditableImageController.

(-[WKDrawingView layoutSubviews]):
(-[WKDrawingView PNGRepresentation]):
Synchronously render the PKCanvasView to PNG.

(-[WKDrawingView drawingDidChange:]):
If the drawing changes, inform the APIAttachment that it needs
to discard its NSFileWrapper; a new one will be generated lazily.

(-[WKDrawingView init]): Deleted.
* WebKit.xcodeproj/project.pbxproj:
* WebProcess/WebCoreSupport/WebChromeClient.h:
* WebProcess/WebCoreSupport/ios/WebChromeClientIOS.mm:
(WebKit::WebChromeClient::associateEditableImageWithAttachment):
(WebKit::WebChromeClient::didCreateEditableImage):
(WebKit::WebChromeClient::didDestroyEditableImage):

Tools:

* DumpRenderTree/ios/UIScriptControllerIOS.mm:
(WTR::UIScriptController::attachmentInfo):
* TestRunnerShared/UIScriptContext/Bindings/UIScriptController.idl:
* TestRunnerShared/UIScriptContext/UIScriptController.cpp:
(WTR::UIScriptController::attachmentInfo):
* TestRunnerShared/UIScriptContext/UIScriptController.h:
* WebKitTestRunner/ios/UIScriptControllerIOS.mm:
(WTR::UIScriptController::attachmentInfo):
Add a UIScriptController mechanism to retrieve information about
a given attachment.

LayoutTests:

* editing/images/editable-image-creates-attachment-expected.txt: Added.
* editing/images/editable-image-creates-attachment.html: Added.
* resources/ui-helper.js:
(window.UIHelper.attachmentInfo):
(window.UIHelper):

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

8 months ago[ews-app] Add support to communicate with Buildbot
aakash_jain@apple.com [Tue, 27 Nov 2018 01:05:53 +0000 (01:05 +0000)]
[ews-app] Add support to communicate with Buildbot
https://bugs.webkit.org/show_bug.cgi?id=191935

Reviewed by Lucas Forschler.

* BuildSlaveSupport/ews-app/ews/common/__init__.py: Added.
* BuildSlaveSupport/ews-app/ews/common/buildbot.py: Added.

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

8 months agowebkitpy: Race condition in ServerProcess tests
jbedard@apple.com [Tue, 27 Nov 2018 01:02:42 +0000 (01:02 +0000)]
webkitpy: Race condition in ServerProcess tests
https://bugs.webkit.org/show_bug.cgi?id=191989
<rdar://problem/45536844>

Reviewed by Lucas Forschler.

Serializing these tests to prevent the race conditions.

* Scripts/webkitpy/port/server_process_unittest.py:
(TestServerProcess.serial_test_basic):
(TestServerProcess.serial_test_read_after_process_exits):
(TestServerProcess.serial_test_process_crashing):
(TestServerProcess.serial_test_process_crashing_no_data):
(TestServerProcess.test_basic): Deleted.
(TestServerProcess.test_read_after_process_exits): Deleted.
(TestServerProcess.test_process_crashing): Deleted.
(TestServerProcess.test_process_crashing_no_data): Deleted.

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

8 months ago[ews-app] Add field in Patch object to indicate if it has been sent to Buildbot
aakash_jain@apple.com [Tue, 27 Nov 2018 00:48:51 +0000 (00:48 +0000)]
[ews-app] Add field in Patch object to indicate if it has been sent to Buildbot
https://bugs.webkit.org/show_bug.cgi?id=191929

Reviewed by Lucas Forschler.

* BuildSlaveSupport/ews-app/ews/models/patch.py:
(Patch): Added sent_to_buildbot field.
(Patch.is_patch_sent_to_buildbot): Checks if the patch has been sent to Buildbot.

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

8 months ago[ews-app] Add a config file
aakash_jain@apple.com [Tue, 27 Nov 2018 00:29:53 +0000 (00:29 +0000)]
[ews-app] Add a config file
https://bugs.webkit.org/show_bug.cgi?id=191933

Reviewed by Lucas Forschler.

* BuildSlaveSupport/ews-app/ews/config.py: Added.

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

8 months ago[ews-app] Add methods to save patch to database
aakash_jain@apple.com [Tue, 27 Nov 2018 00:21:37 +0000 (00:21 +0000)]
[ews-app] Add methods to save patch to database
https://bugs.webkit.org/show_bug.cgi?id=191928

Reviewed by Lucas Forschler.

* BuildSlaveSupport/ews-app/ews/models/patch.py:
(Patch.save_patch): Method to save the patch to database.
(Patch.save_patches): Method to save multiple patches to database.
(Patch.is_valid_patch_id): Checks if the patch id is valid.
(Patch.is_existing_patch_id): Checks if the patch id already exists in database.

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

8 months agoAdopt -setOverrideRouteSharingPolicy:routingContextUID: SPI
jer.noble@apple.com [Tue, 27 Nov 2018 00:02:28 +0000 (00:02 +0000)]
Adopt -setOverrideRouteSharingPolicy:routingContextUID: SPI
https://bugs.webkit.org/show_bug.cgi?id=190951
<rdar://problem/45213065>

Reviewed by Alex Christensen.

Source/WebCore:

Request the correct route policy and context from the VideoFullscreenModel.

* platform/cocoa/VideoFullscreenModel.h:
(WebCore::VideoFullscreenModel::requestRouteSharingPolicyAndContextUID):
* platform/cocoa/VideoFullscreenModelVideoElement.h:
* platform/cocoa/VideoFullscreenModelVideoElement.mm:
(WebCore::VideoFullscreenModelVideoElement::requestRouteSharingPolicyAndContextUID):
* platform/ios/VideoFullscreenInterfaceAVKit.h:
* platform/ios/VideoFullscreenInterfaceAVKit.mm:
(-[WebAVPlayerViewController setWebKitOverrideRouteSharingPolicy:routingContextUID:]):
(VideoFullscreenInterfaceAVKit::setVideoFullscreenModel):
(VideoFullscreenInterfaceAVKit::doSetup):

Source/WebCore/PAL:

* pal/spi/cocoa/AVKitSPI.h:

Source/WebKit:

Add an asyncronous reply request to VideoFullscreenManager.

* Platform/IPC/MessageSender.h:
(IPC::MessageSender::sendWithAsyncReply):
* UIProcess/Cocoa/VideoFullscreenManagerProxy.h:
* UIProcess/Cocoa/VideoFullscreenManagerProxy.mm:
(WebKit::VideoFullscreenModelContext::requestRouteSharingPolicyAndContextUID):
* WebProcess/cocoa/VideoFullscreenManager.h:
* WebProcess/cocoa/VideoFullscreenManager.messages.in:
* WebProcess/cocoa/VideoFullscreenManager.mm:
(WebKit::VideoFullscreenManager::requestRouteSharingPolicyAndContextUID):

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

8 months agoRename WKWebView._safeBrowsingWarningForTesting to _safeBrowsingWarning to use it...
achristensen@apple.com [Mon, 26 Nov 2018 23:06:57 +0000 (23:06 +0000)]
Rename WKWebView._safeBrowsingWarningForTesting to _safeBrowsingWarning to use it for more than testing
https://bugs.webkit.org/show_bug.cgi?id=191981

Reviewed by Tim Horton.

Source/WebKit:

* UIProcess/API/Cocoa/WKWebView.mm:
(-[WKWebView _safeBrowsingWarning]):
(-[WKWebView _safeBrowsingWarningForTesting]): Deleted.
* UIProcess/API/Cocoa/WKWebViewPrivate.h:

Tools:

* TestWebKitAPI/Tests/WebKitCocoa/SafeBrowsing.mm:
(TEST):
(safeBrowsingView):

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

8 months agoREGRESSION (r237738): Command Down Arrow doesn't scroll to the end of a page anymore
dbates@webkit.org [Mon, 26 Nov 2018 22:57:44 +0000 (22:57 +0000)]
REGRESSION (r237738): Command Down Arrow doesn't scroll to the end of a page anymore
https://bugs.webkit.org/show_bug.cgi?id=191967
<rdar://problem/45976390>

Reviewed by Tim Horton.

Source/WebKit:

Fixes an issue where pressing Command + Down Arrow does not scroll the view to the end of the page.

Following r237738 the value of the enumerations used to identify modifier keys (e.g. Shift) changed
to match the values of the corresponding enumerations in GraphicsServices, which are the
enumerations UIKit uses to computes the modifier flags bitmask when instantiating a WebEvent to
pass to WebKit. Before r237738 WebKit was using enumerations whose values matched the values
of the corresponding UIKit public API UIKeyModifier* enumerations. For non-content editable elements,
WebKit intercepts UIKit events in -_handleKeyUIEvent, synthesizes and dispatches its own WebEvent.
However it was creating WebEvents with a modifier flags bitmask built from the UIKeyModifier* enumerations,
-_modifierFlags, as opposed to a bitmask from the GraphicsServices enumerations, -_gsModifierFlags.
Instead WebKit should call -_gsModifierFlags to compute the GraphicsServices-compatible modifier
flags bitmask when instantiating a WebEvent.

* Platform/spi/ios/UIKitSPI.h: Expose -_gsModifierFlags and remove -_modifierFlags.
* UIProcess/ios/WKContentViewInteraction.mm:
(-[WKContentView _handleKeyUIEvent:]): Remove unnecessary code to update the current modifier state.
This will be done by the WebProcess when it receives the keyboard event.
(-[WKContentView _didHandleKeyEvent:eventWasHandled:]): Do not pass modifier flags changed events
to the scrolling animator as it does not know how to handle these kinds of events and triggers an
assertion failure when it tries to read the input string from the event (calls -charactersIgnoringModifiers).
FlagsChanged WebEvents events do not have an input string just like a FlagsChanged NSEvent that
they model on Mac.
* UIProcess/ios/WKWebEvent.mm:
(-[WKWebEvent initWithEvent:]): Pass the value of -_gsModifierFlags for the modifier flags bitmask
instead of the value of -_modifierFlags.

Tools:

Add more test infrastructure to dispatch key up events.

* WebKitTestRunner/ios/HIDEventGenerator.h:
* WebKitTestRunner/ios/HIDEventGenerator.mm:
(createHIDKeyEvent): Renamed from createHIDKeyDownEvent() and modified to take a boolean as
to whether to create an event for a key down or key up.
(createHIDKeyDownEvent): Deleted; renamed to createHIDKeyEvent().
* WebKitTestRunner/ios/UIScriptControllerIOS.mm:
(WTR::createUIPhysicalKeyboardEvent): Added. Convenience function to create a UIPhysicalKeyboardEvent.
(WTR::UIScriptController::keyDown): Modified to dispatch a key up event in addition to dispatching
a key down event.

LayoutTests:

Add tests to ensure that Command + Down Arrow and Command + Up Arrow scroll to the end of
the page and the top of the page, respectively.

* fast/scrolling/ios/key-command-scroll-to-bottom-expected.html: Added.
* fast/scrolling/ios/key-command-scroll-to-bottom.html: Added.
* fast/scrolling/ios/key-command-scroll-to-top-expected.html: Added.
* fast/scrolling/ios/key-command-scroll-to-top.html: Added.
* resources/ui-helper.js:
(window.UIHelper.keyDown): Pass the modifiers array to EventSender.keyDown() to make
this function work on Mac.

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

8 months ago[PSON] process pre-warming should not be on for everyone
cdumez@apple.com [Mon, 26 Nov 2018 22:54:48 +0000 (22:54 +0000)]
[PSON] process pre-warming should not be on for everyone
https://bugs.webkit.org/show_bug.cgi?id=191966
<rdar://problem/46138499>

Reviewed by Ryosuke Niwa.

If automatic process-prewarming is not explicitly turned on/off by the client, then we now only
turn it on automatically after the first process swap. Previously, it was always enabled if
process-swap on cross-site navigation was enabled (which is the case by default for all apps).

This is important because some apps do not actually browse (only display static content) or never
browse cross-site, and thus would not benefit from process prewarming and yet pay a memory cost.

* UIProcess/API/APIProcessPoolConfiguration.h:
Add m_clientWouldBenefitFromAutomaticProcessPrewarming flag which is false by default and is used
as a fallback if the client did not call setIsAutomaticProcessWarmingEnabled().

* UIProcess/API/C/WKContextConfigurationRef.cpp:
(WKContextConfigurationPrewarmsProcessesAutomatically):
(WKContextConfigurationSetPrewarmsProcessesAutomatically):
Add C API to toggle automatic process prewarming. It is needed for Safari to turn on this feature
by default for browsing. This way Safari does not have to wait for the first process swap to
start prewarming.

* UIProcess/API/C/WKContextConfigurationRef.h:
* UIProcess/WebProcessPool.cpp:
(WebKit::WebProcessPool::didReachGoodTimeToPrewarm):
Only do automatic process prewarming if process-swap on cross-site navigation is also enabled.
This is needed for clients like Safari that explicitly enable automatic process prewarming but
only want to have it enabled if PSON is also enabled via experimental features.

(WebKit::WebProcessPool::processForNavigation):
On first process swap, if the client did not explicitly turn on or off automatic process prewarming
then we enable it then. This avoids paying the cost of process prewarming in apps that would not
benefit from it.

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

8 months agoSVG use element inside a shadow tree cannot reference an element in the same tree
rniwa@webkit.org [Mon, 26 Nov 2018 22:48:08 +0000 (22:48 +0000)]
SVG use element inside a shadow tree cannot reference an element in the same tree
https://bugs.webkit.org/show_bug.cgi?id=174977
<rdar://problem/33665636>

Reviewed by Zalan Bujtas.

Source/WebCore:

Make fragment URL references used by SVGelements within a shadow tree to refer to other elements
in the same shadow tree. To do this, this patch makes targetElementFromIRIString take a TreeScope
instead of a Document, and updates its call sites.

This patch updates the most uses of targetElementFromIRIString except CSS cursor image, altGraph,
and glyphRef since the cursor image isn't really a SVG feature, and there aren't really real world
use cases in which altGraph and glyphRef are used within shadow trees.

Tests: fast/shadow-dom/svg-animate-href-change-in-shadow-tree.html
       fast/shadow-dom/svg-animate-href-in-shadow-tree.html
       fast/shadow-dom/svg-feimage-href-in-shadow-tree.html
       fast/shadow-dom/svg-linear-gradient-href-in-shadow-tree.html
       fast/shadow-dom/svg-mpath-href-change-in-shadow-tree.html
       fast/shadow-dom/svg-mpath-href-in-shadow-tree.html
       fast/shadow-dom/svg-radial-gradient-href-in-shadow-tree.html
       fast/shadow-dom/svg-text-path-href-change-in-shadow-tree.html
       fast/shadow-dom/svg-text-path-href-in-shadow-tree.html
       fast/shadow-dom/svg-thref-href-change-in-shadow-tree.html
       fast/shadow-dom/svg-thref-href-in-shadow-tree.html
       fast/shadow-dom/svg-use-href-change-in-shadow-tree.html
       fast/shadow-dom/svg-use-href-in-shadow-tree.html

* accessibility/AccessibilitySVGElement.cpp:
(WebCore::AccessibilitySVGElement::targetForUseElement const):
* css/CSSCursorImageValue.cpp:
* rendering/svg/RenderSVGTextPath.cpp:
(WebCore::RenderSVGTextPath::layoutPath const):
* svg/SVGAltGlyphElement.cpp:
(WebCore::SVGAltGlyphElement::hasValidGlyphElements const):
* svg/SVGFEImageElement.cpp:
(WebCore::SVGFEImageElement::buildPendingResource):
(WebCore::SVGFEImageElement::build):
* svg/SVGGlyphRefElement.cpp:
(WebCore::SVGGlyphRefElement::hasValidGlyphElement const):
* svg/SVGLinearGradientElement.cpp:
(WebCore::SVGLinearGradientElement::collectGradientAttributes):
* svg/SVGMPathElement.cpp:
(WebCore::SVGMPathElement::buildPendingResource):
(WebCore::SVGMPathElement::pathElement):
* svg/SVGRadialGradientElement.cpp:
(WebCore::SVGRadialGradientElement::collectGradientAttributes):
* svg/SVGTRefElement.cpp:
(WebCore::SVGTRefElement::buildPendingResource):
* svg/SVGTextPathElement.cpp:
(WebCore::SVGTextPathElement::buildPendingResource):
* svg/SVGURIReference.cpp:
(WebCore::SVGURIReference::targetElementFromIRIString):
* svg/SVGURIReference.h:
* svg/SVGUseElement.cpp:
(WebCore::SVGUseElement::updateShadowTree):
(WebCore::SVGUseElement::findTarget const):
* svg/animation/SVGSMILElement.cpp:
(WebCore::SVGSMILElement::buildPendingResource):
(WebCore::SVGSMILElement::insertedIntoAncestor):
* svg/graphics/filters/SVGFEImage.cpp:
(WebCore::FEImage::FEImage):
(WebCore::FEImage::createWithIRIReference):
(WebCore::FEImage::referencedRenderer const):
* svg/graphics/filters/SVGFEImage.h:

LayoutTests:

Added tests for specifying a fragment URL to refer to other elements within shadow trees.

This patch doesn't add a test for updating a fragment URL of linearGradient and radialGradient
since it doesn't work at all even outside shadow trees. See webkit.org/b/191934.

* fast/shadow-dom/svg-animate-href-change-in-shadow-tree-expected.html: Added.
* fast/shadow-dom/svg-animate-href-change-in-shadow-tree.html: Added.
* fast/shadow-dom/svg-animate-href-in-shadow-tree-expected.html: Added.
* fast/shadow-dom/svg-animate-href-in-shadow-tree.html: Added.
* fast/shadow-dom/svg-feimage-href-in-shadow-tree-expected.html: Added.
* fast/shadow-dom/svg-feimage-href-in-shadow-tree.html: Added.
* fast/shadow-dom/svg-linear-gradient-href-in-shadow-tree-expected.html: Added.
* fast/shadow-dom/svg-linear-gradient-href-in-shadow-tree.html: Added.
* fast/shadow-dom/svg-mpath-href-change-in-shadow-tree-expected.html: Added.
* fast/shadow-dom/svg-mpath-href-change-in-shadow-tree.html: Added.
* fast/shadow-dom/svg-mpath-href-in-shadow-tree-expected.html: Added.
* fast/shadow-dom/svg-mpath-href-in-shadow-tree.html: Added.
* fast/shadow-dom/svg-radial-gradient-href-in-shadow-tree-expected.html: Added.
* fast/shadow-dom/svg-radial-gradient-href-in-shadow-tree.html: Added.
* fast/shadow-dom/svg-text-path-href-change-in-shadow-tree-expected.html: Added.
* fast/shadow-dom/svg-text-path-href-change-in-shadow-tree.html: Added.
* fast/shadow-dom/svg-text-path-href-in-shadow-tree-expected.html: Added.
* fast/shadow-dom/svg-text-path-href-in-shadow-tree.html: Added.
* fast/shadow-dom/svg-thref-href-change-in-shadow-tree-expected.html: Added.
* fast/shadow-dom/svg-thref-href-change-in-shadow-tree.html: Added.
* fast/shadow-dom/svg-thref-href-in-shadow-tree-expected.html: Added.
* fast/shadow-dom/svg-thref-href-in-shadow-tree.html: Added.
* fast/shadow-dom/svg-use-href-change-in-shadow-tree-expected.html: Added.
* fast/shadow-dom/svg-use-href-change-in-shadow-tree.html: Added.
* fast/shadow-dom/svg-use-href-in-shadow-tree-expected.html: Added.
* fast/shadow-dom/svg-use-href-in-shadow-tree.html: Added.

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

8 months agoUnreviewed, rolling out r238357.
tsavell@apple.com [Mon, 26 Nov 2018 22:22:07 +0000 (22:22 +0000)]
Unreviewed, rolling out r238357.

Casued three css tests to fail and crash on ios sim

Reverted changeset:

"Avoid triggering compositing updates when only the root layer
is composited"
https://bugs.webkit.org/show_bug.cgi?id=191813
https://trac.webkit.org/changeset/238357

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

8 months agoCaret disappears at end of password field when caps lock indicator is shown; password...
dbates@webkit.org [Mon, 26 Nov 2018 22:15:16 +0000 (22:15 +0000)]
Caret disappears at end of password field when caps lock indicator is shown; password field
not scrolled when caps lock indicator is shown
https://bugs.webkit.org/show_bug.cgi?id=191164
<rdar://problem/45738179>

Reviewed by Dean Jackson.

Source/WebCore:

Fixes an issue where the caret may be occluded by- or paint on top of- the caps lock indicator on
Mac and iOS, respectively.

If there has not been a previous selection in a focused password field, including a caret
selection made by pressing the arrow keys, then we never scroll the password field to reveal
the current selection when the caps lock indicator is made visible. When the caps lock indicator
is made visible or hidden the size of the inner text renderer changes as it shrinks or expands
to make space for the caps lock indicator or to fill the void of the now hidden caps lock indicator,
respectively. We should detect such size changes and schedule an update and reveal of the current
selection after layout.

Test: fast/forms/password-scrolled-after-caps-lock-toggled.html

* editing/FrameSelection.cpp:
(WebCore::FrameSelection::setNeedsSelectionUpdate): Modified to take an enum to override the current
selection reveal mode for the next update.
* editing/FrameSelection.h:
* rendering/RenderTextControlSingleLine.cpp:
(WebCore::RenderTextControlSingleLine::layout): Schedule post-layout a selection update that
reveals the current selection. We pass FrameSelection::RevealSelectionAfterUpdate::Forced to ensure
that the scheduled selection update scrolls to the reveal the current selection regardless of selection
reveal mode. This is necessary because typing into a password field does not change the current
selection reveal mode.

LayoutTests:

Add a test to ensure that we scroll the password field when caps lock is toggled.

* TestExpectations: Skip the test on all platforms as we only support toggling Caps Lock in
WebKit2 on Mac at the moment.
* fast/forms/password-scrolled-after-caps-lock-toggled-expected.txt: Added.
* fast/forms/password-scrolled-after-caps-lock-toggled.html: Added.
* platform/mac-wk2/TestExpectations: Mark the test as PASS so that we run it.

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

8 months agoPlaceholder text is not repainted after caps lock indicator is hidden
dbates@webkit.org [Mon, 26 Nov 2018 21:55:42 +0000 (21:55 +0000)]
Placeholder text is not repainted after caps lock indicator is hidden
https://bugs.webkit.org/show_bug.cgi?id=191968
<rdar://problem/46247234>

Substitute UIHelper.toggleCapsLock() for testRunner.toggleCapsLock() as the former replaces
the latter following r238512.

* fast/repaint/placeholder-after-caps-lock-hidden.html:

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

8 months agoPlaceholder text is not repainted after caps lock indicator is hidden
dbates@webkit.org [Mon, 26 Nov 2018 21:50:17 +0000 (21:50 +0000)]
Placeholder text is not repainted after caps lock indicator is hidden
https://bugs.webkit.org/show_bug.cgi?id=191968
<rdar://problem/46247234>

Reviewed by Zalan Bujtas.

Source/WebCore:

Fixes an issue where the placeholder text in a password field is not repainted when the
caps lock indicator is hidden.

The placeholder renderer is special. It is an excluded child renderer and does not take
part in normal flow layout. It is also created and destroyed as needed. The caps lock
indicator is also special in that it is implemented as a RenderImage and we do not know
its dimensions before it is loaded and the load happens asynchronously. As a result we
detect when the inner text size changes and mark the placeholder as dirty as a way to
keep the dimensions of the placeholder in sync with the dimensions of the inner text.

Test: fast/repaint/placeholder-after-caps-lock-hidden.html

* rendering/RenderTextControlSingleLine.cpp:
(WebCore::RenderTextControlSingleLine::layout): Mark the placeholder as needing layout
the size of the inner text changes.

LayoutTests:

Add a test to ensure to that the placeholder text is repainted when the caps lock indicator is hidden.

* TestExpectations: Skip the test on all platforms as we only support toggling Caps Lock in
WebKit2 on Mac at the moment.
* fast/repaint/placeholder-after-caps-lock-hidden.html: Added.
* platform/mac-wk2/TestExpectations: Mark the test as PASS so that we run it.

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

8 months ago[ews-app] Set Foreign Keys in EWS Django app models
aakash_jain@apple.com [Mon, 26 Nov 2018 21:44:27 +0000 (21:44 +0000)]
[ews-app] Set Foreign Keys in EWS Django app models
https://bugs.webkit.org/show_bug.cgi?id=191790

Reviewed by Lucas Forschler.

* BuildSlaveSupport/ews-app/ews/models/builds.py: Set Foreign Key.
* BuildSlaveSupport/ews-app/ews/models/steps.py: Ditto.

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

8 months ago[ews-app] Do not store patch content in database
aakash_jain@apple.com [Mon, 26 Nov 2018 21:39:46 +0000 (21:39 +0000)]
[ews-app] Do not store patch content in database
https://bugs.webkit.org/show_bug.cgi?id=191788

Reviewed by Lucas Forschler.

* BuildSlaveSupport/ews-app/ews/models/patch.py: Removed content field.

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

8 months agoPicture-in-picture window size changes unnecesarily when URL changes.
commit-queue@webkit.org [Mon, 26 Nov 2018 21:19:52 +0000 (21:19 +0000)]
Picture-in-picture window size changes unnecesarily when URL changes.
https://bugs.webkit.org/show_bug.cgi?id=191787

Patch by Jeremy Jones <jeremyj@apple.com> on 2018-11-26
Reviewed by Jer Noble.

When loading a new URL, the video dimensions are temporarily 0,0. Instead of
defaulting back to 4:3 sized pip window temporarily, keep the old dimensions until
there is a new valid size.

* platform/ios/VideoFullscreenInterfaceAVKit.mm:
(VideoFullscreenInterfaceAVKit::videoDimensionsChanged):

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

8 months ago[Cocoa] Make it easier to encode NSObjects
aestes@apple.com [Mon, 26 Nov 2018 21:13:47 +0000 (21:13 +0000)]
[Cocoa] Make it easier to encode NSObjects
https://bugs.webkit.org/show_bug.cgi?id=191948

Reviewed by Dean Jackson.

Source/WebCore:

* Modules/applepay/Payment.h: Changed the PKPayment * constructor to take a
RetainPtr<PKPayment>&& instead.
* Modules/applepay/PaymentContact.h: Ditto for PKContact.
* Modules/applepay/PaymentMerchantSession.h: Ditto for PKPaymentMerchantSession.
* Modules/applepay/PaymentMethod.h: Ditto for PKPaymentMethod.
* Modules/applepay/cocoa/PaymentCocoa.mm:
(WebCore::Payment::Payment): Moved definition out-of-line.
(WebCore::Payment::pkPayment const): Ditto.
* Modules/applepay/cocoa/PaymentContactCocoa.mm:
(WebCore::PaymentContact::PaymentContact): Ditto.
(WebCore::PaymentContact::pkContact const): Ditto.
* Modules/applepay/cocoa/PaymentMethodCocoa.mm:
(WebCore::PaymentMethod::PaymentMethod): Ditto.
(WebCore::PaymentMethod::pkPaymentMethod const): Ditto.

Source/WebCore/PAL:

* pal/spi/cocoa/PassKitSPI.h: Declared some classes that secretly conform to NSSecureCoding.

Source/WebKit:

It should be easier to encode objects that conform to NSSecureCoding for WebKit IPC. Right
now, several argument coders duplicate the logic for encoding and decoding objects using
NSKeyedArchiver and NSKeyedUnarchiver.

This patch adds encodeObject() and decodeObject() primitives for encoding and decoding using
Foundation keyed archiving. It then partially specializes ArgumentCoder for raw pointers and
RetainPtrs whose pointee conforms to NSSecureCoding to call these new primitives.

This allows us to use Encoder::operator<< to encode raw pointers or RetainPtrs and use
Decoder::operator>> to decode to an optional RetainPtr. By default, IPC::decode infers the
allowed class for decoding by calling `[T class]`. We can also specify the allowed classes
explicitly for containers and classes that are loaded at runtime.

* Shared/Cocoa/ArgumentCodersCocoa.h: Added.
* Shared/Cocoa/ArgumentCodersCocoa.mm: Added.
* Shared/Cocoa/DataDetectionResult.mm:
(WebKit::DataDetectionResult::encode const): Removed custom encoding code and used ArgumentCodersCocoa instead.
(WebKit::DataDetectionResult::decode): Ditto.
* Shared/Cocoa/WebCoreArgumentCodersCocoa.mm:
(IPC::ArgumentCoder<WebCore::Payment>::encode): Ditto.
(IPC::ArgumentCoder<WebCore::Payment>::decode): Ditto.
(IPC::ArgumentCoder<WebCore::PaymentAuthorizationResult>::decode): Ditto.
(IPC::ArgumentCoder<WebCore::PaymentContact>::encode): Ditto.
(IPC::ArgumentCoder<WebCore::PaymentContact>::decode): Ditto.
(IPC::ArgumentCoder<WebCore::PaymentMerchantSession>::encode): Ditto.
(IPC::ArgumentCoder<WebCore::PaymentMerchantSession>::decode): Ditto.
(IPC::ArgumentCoder<WebCore::PaymentMethod>::encode): Ditto.
(IPC::ArgumentCoder<WebCore::PaymentMethod>::decode): Ditto.
(IPC::ArgumentCoder<ApplePaySessionPaymentRequest>::decode): Ditto.
* Shared/RemoteLayerTree/RemoteLayerTreeTransaction.mm:
(WebKit::RemoteLayerTreeTransaction::description const): Added some needed namespaces due to unified source shuffling.
* Shared/WebCoreArgumentCoders.h: Modernized several decoders.
* Shared/ios/InteractionInformationAtPosition.mm:
(WebKit::InteractionInformationAtPosition::encode const): Removed custom encoding code and used ArgumentCodersCocoa instead.
(WebKit::InteractionInformationAtPosition::decode): Ditto.
* Shared/mac/WebCoreArgumentCodersMac.mm:
(IPC::ArgumentCoder<WebCore::ProtectionSpace>::encodePlatformData): Ditto.
(IPC::ArgumentCoder<WebCore::ProtectionSpace>::decodePlatformData): Ditto.
(IPC::ArgumentCoder<WebCore::Credential>::encodePlatformData): Ditto.
(IPC::ArgumentCoder<WebCore::Credential>::decodePlatformData): Ditto.
(IPC::ArgumentCoder<WebCore::MediaPlaybackTargetContext>::encodePlatformData): Ditto.
(IPC::ArgumentCoder<WebCore::MediaPlaybackTargetContext>::decodePlatformData): Ditto.
(IPC::deviceContextKey): Deleted.
* Shared/mac/WebHitTestResultData.mm:
(WebKit::WebHitTestResultData::platformEncode const): Ditto.
(WebKit::WebHitTestResultData::platformDecode): Ditto.
* SourcesCocoa.txt: Added ArgumentCodersCocoa.mm.
* WebKit.xcodeproj/project.pbxproj: Ditto.

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

8 months agowebkitpy: Retry app installation on watchOS simulators (Follow-up fix)
jbedard@apple.com [Mon, 26 Nov 2018 20:55:42 +0000 (20:55 +0000)]
webkitpy: Retry app installation on watchOS simulators (Follow-up fix)
https://bugs.webkit.org/show_bug.cgi?id=191769
<rdar://problem/46139850>

Unreviewed infrastructure fix.

* Scripts/webkitpy/xcode/simulated_device.py:
(SimulatedDevice): Increase retry attempts.

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

8 months agoREGRESSION (r238078): Do not draw caps lock indicator when Strong Password button...
dbates@webkit.org [Mon, 26 Nov 2018 20:42:22 +0000 (20:42 +0000)]
REGRESSION (r238078): Do not draw caps lock indicator when Strong Password button is shown
https://bugs.webkit.org/show_bug.cgi?id=191969
<rdar://problem/46247569>

Reviewed by Dean Jackson.

Source/WebCore:

Following r238078 we now support drawing the caps lock indicator in password fields on iOS.
However it is not meaningful to show the caps lock indicator when the Strong Password button
is visible because the password field is not editable. We should not paint the caps lock
indicator when the Strong Password button is visible.

Tests: fast/forms/auto-fill-button/caps-lock-indicator-should-be-visible-when-after-hiding-auto-fill-strong-password-button.html
       fast/forms/auto-fill-button/caps-lock-indicator-should-not-be-visible-when-auto-fill-strong-password-button-is-visible.html

* html/TextFieldInputType.cpp:
(WebCore::TextFieldInputType::shouldDrawCapsLockIndicator const): Do not draw the caps
lock indicator when the password field has the Strong Password button.
(WebCore::TextFieldInputType::updateAutoFillButton): Call capsLockStateMayHaveChanged() to
update the visibility of the caps lock indicator when the auto fill button has changed.

LayoutTests:

Add tests to ensure that we show or hide the caps lock indicator depending on whether the
Strong Password button is visible.

* TestExpectations: Skip the tests below on all platforms. We will selectively enable them on Mac.
* fast/forms/auto-fill-button/caps-lock-indicator-should-be-visible-when-after-hiding-auto-fill-strong-password-button-expected.html: Added.
* fast/forms/auto-fill-button/caps-lock-indicator-should-be-visible-when-after-hiding-auto-fill-strong-password-button.html: Added.
* fast/forms/auto-fill-button/caps-lock-indicator-should-not-be-visible-when-auto-fill-strong-password-button-is-visible-expected.html: Added.
* fast/forms/auto-fill-button/caps-lock-indicator-should-not-be-visible-when-auto-fill-strong-password-button-is-visible.html: Added.
* platform/mac-wk2/TestExpectations: Mark the tests above as PASS so that we run them.

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

8 months agoMove testRunner.toggleCapsLock() to uiController
dbates@webkit.org [Mon, 26 Nov 2018 20:41:19 +0000 (20:41 +0000)]
Move testRunner.toggleCapsLock() to uiController
https://bugs.webkit.org/show_bug.cgi?id=191972

Reviewed by Tim Horton.

Tools:

Move testRunner.toggleCapsLock() to uiController as uiController is the preferred JavaScript
object for UI test functions. Having this functionality be on uiController makes it an
asynchronous function naturally and complements use of onkeydown, onkeyup listeners to know
when the Caps Lock key event is dispatched. It also facilitates its use directly as part of
scripts with other uiController functions invocations that are passed in a single invocation
of testRunner.runUIScript().

* DumpRenderTree/ios/UIScriptControllerIOS.mm:
(WTR::UIScriptController::toggleCapsLock):
* DumpRenderTree/mac/UIScriptControllerMac.mm:
(WTR::UIScriptController::toggleCapsLock):
Added stub functions that invoke the callback. We do not support toggling caps lock in Legacy
WebKit at the moment. Legacy WebKit reads the caps lock key state directly from the OS. Modern
WebKit caches the caps lock state in the WebProcess as a natural side effect of the fact that
the UIProcess is the only process capable of querying the caps lock key state from the OS and
hence the UIProcess must send over this state to the WebProcess.

* TestRunnerShared/UIScriptContext/Bindings/UIScriptController.idl: Add IDL for new function.
* TestRunnerShared/UIScriptContext/UIScriptController.cpp:
(WTR::UIScriptController::toggleCapsLock): Added empty implementation for ports non-Cocoa ports.
* TestRunnerShared/UIScriptContext/UIScriptController.h:

* WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl:
* WebKitTestRunner/InjectedBundle/TestRunner.cpp:
(WTR::TestRunner::toggleCapsLock): Deleted.
* WebKitTestRunner/InjectedBundle/TestRunner.h:
* WebKitTestRunner/TestController.h:
* WebKitTestRunner/TestInvocation.cpp:
(WTR::TestInvocation::didReceiveSynchronousMessageFromInjectedBundle):
* WebKitTestRunner/cocoa/TestControllerCocoa.mm:
(WTR::TestController::toggleCapsLock): Deleted; moved to UIScriptController::toggleCapsLock().
Removed logic to handle testRunner.toggleCapsLock().

* WebKitTestRunner/ios/UIScriptControllerIOS.mm:
(WTR::UIScriptController::toggleCapsLock): Add stub function that invokes the callback
and a FIXME comment that explains that we will implement this function in <https://bugs.webkit.org/show_bug.cgi?id=191815>.
* WebKitTestRunner/mac/UIScriptControllerMac.mm:
(WTR::UIScriptController::toggleCapsLock): Moved the implementation from TestController::toggleCapsLock().

LayoutTests:

Updated existing test to use UIHelper.toggleCapsLock(), which calls uiController.toggleCapsLock(),
now that testRunner.toggleCapsLock() was removed.

* fast/events/detect-caps-lock.html:
* resources/ui-helper.js:
(window.UIHelper.toggleCapsLock): Added. Convenience function to call uiController.toggleCapsLock()
and return a Promise that is resolved once the UIProcess has dispatched the NSEvent to simulate
pressing the caps lock key.

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

8 months agoInPlaceAbstractState::endBasicBlock rule for SetLocal should filter the value based...
sbarati@apple.com [Mon, 26 Nov 2018 20:29:33 +0000 (20:29 +0000)]
InPlaceAbstractState::endBasicBlock rule for SetLocal should filter the value based on the flush format
https://bugs.webkit.org/show_bug.cgi?id=191956
<rdar://problem/45665806>

Reviewed by Yusuke Suzuki.

JSTests:

* stress/end-basic-block-set-local-should-filter-type.js: Added.
(bar):
(foo):

Source/JavaScriptCore:

This is a similar bug to what Keith fixed in r232134. The issue is if we have
a program like this:

a: JSConstant(jsNumber(0))
b: SetLocal(Int32:@a, loc1, FlushedInt32)
c: ArrayifyToStructure(Cell:@a)
d: Jump(...)

At the point in the program right after the Jump, a GetLocal for loc1
would return whatever the ArrayifyToStructure resulting type is. This breaks
the invariant that a GetLocal must return a value that is a subtype of its
FlushFormat. InPlaceAbstractState::endBasicBlock will know if a SetLocal is
the final node touching a local slot. If so, it'll see if any nodes later
in the block may have refined the type of the value stored in that slot. If
so, endBasicBlock() further refines the type to ensure that any GetLocals
loading from the same slot will result in having this more refined type.
However, we must ensure that this logic only considers types within the
hierarchy of the variable access data's FlushFormat, otherwise, we may
break the invariant that a GetLocal's type is a subtype of its FlushFormat.

* dfg/DFGInPlaceAbstractState.cpp:
(JSC::DFG::InPlaceAbstractState::endBasicBlock):

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

8 months agoObject allocation sinking phase needs to iterate each scope offset instead of just...
sbarati@apple.com [Mon, 26 Nov 2018 20:14:41 +0000 (20:14 +0000)]
Object allocation sinking phase needs to iterate each scope offset instead of just iterating the symbol table's hashmap when handling an activation
https://bugs.webkit.org/show_bug.cgi?id=191958
<rdar://problem/46221877>

Reviewed by Yusuke Suzuki.

JSTests:

* stress/object-allocation-sinking-phase-needs-to-write-to-each-scope-offset.js: Added.
(x):
(foo):

Source/JavaScriptCore:

There may be more entries in an activation than unique variables
in a symbol table's hashmap. For example, if you have two parameters
to a function, and they both are the same name, and the function
uses eval, we'll end up with two scope slots, but only a single
entry in the hashmap in the symbol table. Object allocation sinking
phase was previously iterating over the hashmap, assuming these
values were equivalent. This is wrong in the above case. Instead,
we need to iterate over each scope offset.

* dfg/DFGObjectAllocationSinkingPhase.cpp:
* runtime/GenericOffset.h:
(JSC::GenericOffset::operator+=):
(JSC::GenericOffset::operator-=):

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