Commit Graph

3078 Commits

Author SHA1 Message Date
Adrien Destugues 0195b40b77 Merge commit 'e4390067fab9a407b0c303e04f03c77381cb2ddb' into Haiku 2021-08-30 17:59:07 +02:00
Wenson Hsieh 58daa961d4 [iOS] Remove support for the meaningful tap heuristic
https://bugs.webkit.org/show_bug.cgi?id=229298
rdar://82130066

Reviewed by Tim Horton.

Source/WebCore:

See WebKit ChangeLog for more details.

* page/ChromeClient.h:
(WebCore::ChromeClient::didHandleOrPreventMouseDownOrMouseUpEvent): Deleted.
* page/EventHandler.cpp:
(WebCore::EventHandler::handleMousePressEvent):
(WebCore::EventHandler::handleMouseDoubleClickEvent):
(WebCore::EventHandler::handleMouseReleaseEvent):

Source/WebKit:

Remove all support for the meaningful tap heuristic, which was used to allow users to toggle tab pill visibility
in earlier versions of the Safari redesign. As of the latest iOS 15 beta, this heuristic is no longer necessary,
so we don't need this SPI support anymore.

* UIProcess/API/APIUIClient.h:
(API::UIClient::didNotHandleTapAsClick):
(API::UIClient::didTapAtPoint): Deleted.
* UIProcess/API/Cocoa/WKUIDelegatePrivate.h:
* UIProcess/API/ios/WKWebViewPrivateForTestingIOS.h:
* UIProcess/API/ios/WKWebViewTestingIOS.mm:
(-[WKWebView _didTapAtPoint:withResult:]): Deleted.
* UIProcess/Cocoa/UIDelegate.h:
* UIProcess/Cocoa/UIDelegate.mm:
(WebKit::UIDelegate::setDelegate):
(WebKit::UIDelegate::UIClient::didTapAtPoint): Deleted.
* UIProcess/PageClient.h:
* UIProcess/WebPageProxy.h:
* UIProcess/WebPageProxy.messages.in:
* UIProcess/ios/PageClientImplIOS.h:
* UIProcess/ios/PageClientImplIOS.mm:
(WebKit::PageClientImpl::didTapAtPoint): Deleted.
* UIProcess/ios/WebPageProxyIOS.mm:
(WebKit::WebPageProxy::didTapAtPoint): Deleted.
* WebProcess/WebCoreSupport/WebChromeClient.cpp:
(WebKit::WebChromeClient::didHandleOrPreventMouseDownOrMouseUpEvent): Deleted.
* WebProcess/WebCoreSupport/WebChromeClient.h:
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::isPlayingMediaDidChange):
* WebProcess/WebPage/WebPage.h:

Drive-by fix: initialize `m_appHighlightsVisible` using the correct type.

(WebKit::WebPage::platformNeedsLayoutForEditorState const):
(WebKit::WebPage::prepareToRunModalJavaScriptDialog):
(WebKit::WebPage::didHandleOrPreventMouseDownOrMouseUpEvent): Deleted.
(WebKit::WebPage::platformIsPlayingMediaDidChange): Deleted.
* WebProcess/WebPage/ios/WebPageIOS.mm:
(WebKit::WebPage::completeSyntheticClick):
(WebKit::WebPage::attemptSyntheticClick):
(WebKit::WebPage::handleTwoFingerTapAtPoint):
(WebKit::WebPage::commitPotentialTapFailed):
(WebKit::WebPage::clearSelectionAfterTapIfNeeded):
(WebKit::isProbablyMeaningfulClick): Deleted.
(WebKit::WebPage::didHandleOrPreventMouseDownOrMouseUpEvent): Deleted.
(WebKit::WebPage::platformIsPlayingMediaDidChange): Deleted.

Tools:

Remove test runner support for testing the meaningful tap heuristic.

* WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl:
* WebKitTestRunner/InjectedBundle/InjectedBundle.cpp:
(WTR::InjectedBundle::didReceiveMessageToPage):
* WebKitTestRunner/InjectedBundle/TestRunner.cpp:
(WTR::TestRunner::installDidHandleTapCallback): Deleted.
(WTR::TestRunner::callDidHandleTapCallback): Deleted.
* WebKitTestRunner/InjectedBundle/TestRunner.h:
* WebKitTestRunner/TestController.cpp:
(WTR::TestController::didHandleTap): Deleted.
* WebKitTestRunner/TestController.h:
* WebKitTestRunner/TestInvocation.cpp:
(WTR::TestInvocation::didHandleTap): Deleted.
* WebKitTestRunner/TestInvocation.h:
* WebKitTestRunner/cocoa/TestRunnerWKWebView.mm:
(-[TestRunnerWKWebView _didTapAtPoint:withResult:]): Deleted.

LayoutTests:

Remove all layout tests that exercised the meaningful tap heuristic.

* fast/events/ios/did-not-handle-meaningful-click-expected.txt: Removed.
* fast/events/ios/did-not-handle-meaningful-click.html: Removed.
* fast/events/ios/meaningful-click-when-focusing-body-expected.txt: Removed.
* fast/events/ios/meaningful-click-when-focusing-body.html: Removed.
* fast/events/ios/meaningful-click-when-playing-media-expected.txt: Removed.
* fast/events/ios/meaningful-click-when-playing-media.html: Removed.
* fast/events/ios/meaningful-click-when-tapping-draggable-content-expected.txt: Removed.
* fast/events/ios/meaningful-click-when-tapping-draggable-content.html: Removed.
* fast/events/ios/non-meaningful-click-when-tapping-document-expected.txt: Removed.
* fast/events/ios/non-meaningful-click-when-tapping-document.html: Removed.


Canonical link: https://commits.webkit.org/240704@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@281279 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-08-19 23:17:35 +00:00
Andres Gonzalez 3ccce48b8c Rename AccessibilityUIElement::setSelectedVisibleTextRange to setSelectedTextMarkerRange for naming consistency and maintainability.
https://bugs.webkit.org/show_bug.cgi?id=229290
<rdar://problem/82128453>

Reviewed by Chris Fleizach.

Tools:

Renamed this method for consistency and to reflect what it is actually
doing. The goal is to avoid confusion with methods for VisiblePosition,
VisibleSelection and so forth, which are Core objects not exposed to AX
clients.

* DumpRenderTree/AccessibilityUIElement.cpp:
(setSelectedTextMarkerRangeCallback):
(AccessibilityUIElement::setSelectedTextMarkerRange):
(AccessibilityUIElement::getJSClass):
(setSelectedVisibleTextRangeCallback): Deleted.
(AccessibilityUIElement::setSelectedVisibleTextRange): Deleted.
* DumpRenderTree/AccessibilityUIElement.h:
* DumpRenderTree/ios/AccessibilityUIElementIOS.mm:
(AccessibilityUIElement::setSelectedTextMarkerRange):
(AccessibilityUIElement::setSelectedVisibleTextRange): Deleted.
* DumpRenderTree/mac/AccessibilityUIElementMac.mm:
(AccessibilityUIElement::setSelectedTextMarkerRange):
(AccessibilityUIElement::setSelectedVisibleTextRange): Deleted.
* WebKitTestRunner/InjectedBundle/AccessibilityUIElement.h:
* WebKitTestRunner/InjectedBundle/Bindings/AccessibilityUIElement.idl:
* WebKitTestRunner/InjectedBundle/atk/AccessibilityUIElementAtk.cpp:
(WTR::AccessibilityUIElement::setSelectedTextMarkerRange):
(WTR::AccessibilityUIElement::setSelectedVisibleTextRange): Deleted.
* WebKitTestRunner/InjectedBundle/ios/AccessibilityUIElementIOS.mm:
(WTR::AccessibilityUIElement::setSelectedTextMarkerRange):
(WTR::AccessibilityUIElement::setSelectedVisibleTextRange): Deleted.
* WebKitTestRunner/InjectedBundle/mac/AccessibilityUIElementMac.mm:
(WTR::AccessibilityUIElement::setSelectedTextMarkerRange):
(WTR::AccessibilityUIElement::setSelectedVisibleTextRange): Deleted.
* WebKitTestRunner/InjectedBundle/win/AccessibilityUIElementWin.cpp:
(WTR::AccessibilityUIElement::setSelectedTextMarkerRange):
(WTR::AccessibilityUIElement::setSelectedVisibleTextRange): Deleted.

LayoutTests:

Updated all test files to use new name.

* accessibility/mac/selected-visible-position-range.html:
* accessibility/mac/selection-sync.html:
* accessibility/mac/wk1-set-selected-text-marker-range-input-element.html:


Canonical link: https://commits.webkit.org/240699@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@281274 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-08-19 22:28:50 +00:00
Adrien Destugues 9cabb795d1 Merge commit '788086b3b8ba5a5894f8cfe1094ed237351b2dea' into Haiku 2021-08-19 20:21:07 +02:00
David Kilzer b2984f80cf Bug 229265: run-webkit-tests --leaks should check for leaks in the GPU process
<https://webkit.org/b/229265>
<rdar://problem/82101453>

Reviewed by Alex Christensen.

Source/WebKit:

* UIProcess/API/C/WKPage.cpp:
(WKPageGetGPUProcessIdentifier): Add.
* UIProcess/API/C/WKPagePrivate.h:
(WKPageGetGPUProcessIdentifier): Add.
- Add function to return the PID for the GPU process.

Tools:

* WebKitTestRunner/TestController.cpp:
(WTR::TestController::findAndDumpWebKitProcessIdentifiers):
- Include the GPU process PID if it's enabled when sending a
  list of PIDs back to run-webkit-tests.
(WTR::TestController::gpuProcessName): Add.
* WebKitTestRunner/TestController.h:
(WTR::TestController::databaseProcessName): Delete.
- The implementation was removed a while ago.
(WTR::TestController::gpuProcessName): Add.


Canonical link: https://commits.webkit.org/240658@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@281221 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-08-19 03:40:37 +00:00
Andres Gonzalez 84a3f71676 Add layout test for WebAccessibilityObjectWrapper handler for attribute AXLineForTextMarker on MacOS.
https://bugs.webkit.org/show_bug.cgi?id=229220
<rdar://problem/82057459>

Reviewed by Chris Fleizach.

Source/WebCore:

Test: accessibility/mac/line-index-for-textmarker.html

There was not a layout test that exercised directly the handler for the
AXLineForTextMarker attribute in [WebAccessibilityObjectWrapper
accessibilityAttributeValue:withParameter:].
This patch adds the above test to exercise this method for textarea and
contenteditable elements. The text in these elements includes soft and
hard linebreaks, which are important test cases for this API.
The handler for AXLineForTextMarker in turn calls
AccessibilityObject::lineForPosition, and analyzing this method, made a
minor optimization by getting rid off of an unnecessary local variable
and object copy.

* accessibility/AccessibilityObject.cpp:
(WebCore::AccessibilityObject::lineForPosition const):

Tools:

Added AccessibilityUIElement::lineIndexForTextMarker.

* WebKitTestRunner/InjectedBundle/AccessibilityUIElement.cpp:
(WTR::AccessibilityUIElement::lineIndexForTextMarker const):
* WebKitTestRunner/InjectedBundle/AccessibilityUIElement.h:
* WebKitTestRunner/InjectedBundle/Bindings/AccessibilityUIElement.idl:
* WebKitTestRunner/InjectedBundle/mac/AccessibilityUIElementMac.mm:
(WTR::AccessibilityUIElement::lineIndexForTextMarker const):

LayoutTests:

* accessibility/mac/line-index-for-textmarker-expected.txt: Added.
* accessibility/mac/line-index-for-textmarker.html: Added.
* platform/mac-wk1/TestExpectations:


Canonical link: https://commits.webkit.org/240644@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@281200 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-08-18 17:57:24 +00:00
Andres Gonzalez 31879374af Expose [WebAccessibilityObjectWrapper lineRectsAndText] on MacOS.
https://bugs.webkit.org/show_bug.cgi?id=229045
<rdar://81819301>

Reviewed by Chris Fleizach.

Source/WebCore:

Test: accessibility/element-line-rects-and-text.html

Moved the [WebAccessibilityObjectWrapper lineRectsAndText] method, and
supporting methods and functions, from the iOS subclass to the base
(Cocoa) class so that it can be used in both iOS and MacOS.

* accessibility/ios/WebAccessibilityObjectWrapperIOS.mm:
Moved the following methods and functions to WebAccessibilityObjectWrapperBase.mm.
(-[WebAccessibilityObjectWrapper _prepareAccessibilityCall]): Deleted.
(-[WebAccessibilityObjectWrapper _addAccessibilityObject:toTextMarkerArray:]): Deleted.
(blockquoteLevel): Deleted.
(AXAttributeStringSetLanguage): Deleted.
(AXAttributeStringSetBlockquoteLevel): Deleted.
(AXAttributeStringSetHeadingLevel): Deleted.
(AXAttributeStringSetFont): Deleted.
(AXAttributeStringSetNumber): Deleted.
(AXAttributeStringSetStyle): Deleted.
(AXAttributedStringAppendText): Deleted.
(-[WebAccessibilityObjectWrapper contentForSimpleRange:attributed:]): Deleted.
(-[WebAccessibilityObjectWrapper lineRectsAndText]): Deleted.
* accessibility/mac/WebAccessibilityObjectWrapperBase.h:
* accessibility/mac/WebAccessibilityObjectWrapperBase.mm:
(-[WebAccessibilityObjectWrapperBase _prepareAccessibilityCall]):
(addObjectWrapperToArray):
(blockquoteLevel):
(AXAttributeStringSetLanguage):
(AXAttributeStringSetBlockquoteLevel):
(AXAttributeStringSetHeadingLevel):
(AXAttributeStringSetFont):
(AXAttributeStringSetNumber):
(AXAttributeStringSetStyle):
(AXAttributedStringAppendText):
(-[WebAccessibilityObjectWrapperBase contentForSimpleRange:attributed:]):
(-[WebAccessibilityObjectWrapperBase lineRectsAndText]):
* accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
(-[WebAccessibilityObjectWrapper accessibilityAttributeValue:]):
Added handling of the attribute "AXLineRectsAndText".

Tools:

* WebKitTestRunner/InjectedBundle/AccessibilityUIElement.cpp:
(WTR::AccessibilityUIElement::attributedStringForElement):
(WTR::AccessibilityUIElement::lineRectsAndText const):
* WebKitTestRunner/InjectedBundle/mac/AccessibilityUIElementMac.mm:
(WTR::AccessibilityUIElement::lineRectsAndText const):

LayoutTests:

* accessibility/element-line-rects-and-text.html: Renamed from LayoutTests/accessibility/ios-simulator/element-line-rects-and-text.html.
* platform/ios/TestExpectations:
* platform/ios/accessibility/element-line-rects-and-text-expected.txt: Renamed from LayoutTests/accessibility/ios-simulator/element-line-rects-and-text-expected.txt.
* platform/mac/accessibility/element-line-rects-and-text-expected.txt: Added.
* platform/mac-wk1/TestExpectations:
* platform/win/TestExpectations:


Canonical link: https://commits.webkit.org/240567@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@281108 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-08-16 21:04:19 +00:00
David Kilzer e7b2ba4278 "make analyze" should run clang static analyzer in deep mode
<https://webkit.org/b/229127>
<rdar://problem/81960587>

Reviewed by Alexey Proskuryakov.

.:

* Makefile.shared:
- Add "analyze" argument to xcodebuild command when invoking
  "make analyze" to run clang static analyzer in deep mode.
  Simplify "make analyze" since $(PATH_TO_SCAN_BUILD) does not
  need to be set.

Source/ThirdParty/ANGLE:

* ANGLE.xcodeproj/project.pbxproj:
- Treat "analyze" the same as "build" for "ACTION" environment
  variable.

Source/WebCore:

* Scripts/generate-derived-sources.sh:
- Treat "analyze" the same as "build" for "ACTION" environment
  variable.

Source/WebKit:

* Scripts/generate-derived-sources.sh:
* WebKit.xcodeproj/project.pbxproj:
- Treat "analyze" the same as "build" for "ACTION" environment
  variable.

Source/WebKitLegacy/mac:

* migrate-headers.sh:
- Treat "analyze" the same as "build" for "ACTION" environment
  variable.

Tools:

* DumpRenderTree/Scripts/generate-derived-sources.sh:
* WebKitTestRunner/Scripts/generate-derived-sources.sh:
- Treat "analyze" the same as "build" for "ACTION" environment
  variable.


Canonical link: https://commits.webkit.org/240548@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@281088 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-08-16 16:31:24 +00:00
Wenson Hsieh 8fd4a9df7a [iOS 15] editing/selection/ios/select-all-in-readonly-input-does-not-overflow.html is a flaky timeout
https://bugs.webkit.org/show_bug.cgi?id=229126
rdar://80384801

Reviewed by Tim Horton.

Source/WebKit:

Remove the (now-unused) testing SPI `-[WKWebView _doAfterResettingSingleTapGesture:]`. See Tools/ChangeLog for
more information.

* UIProcess/API/ios/WKWebViewPrivateForTestingIOS.h:
* UIProcess/API/ios/WKWebViewTestingIOS.mm:
(-[WKWebView _doAfterResettingSingleTapGesture:]): Deleted.
* UIProcess/ios/WKContentViewInteraction.h:
* UIProcess/ios/WKContentViewInteraction.mm:
(-[WKContentView _singleTapDidReset:]):
(-[WKContentView _doAfterResettingSingleTapGesture:]): Deleted.

Tools:

This test exercises the ability to cause platform selection views to show up after tapping the web view while a
DOM selection is set. In this codepath, selection views are installed when the web view becomes first responder,
when we call into `-[UIWKTextInteractionAssistant activateSelection]`; the call to `-becomeFirstResponder`, in
turn, comes from UIKit's internal `UITextTapRecognizer` gesture, which recognizes the single tap and makes the
content view first responder.

In the case where this test fails, the synthesized tap gesture fails to activate the text tap recognizer; this
happens because the timing of when the `UITextTapRecognizer` gets reset (i.e. `-_resetGestureRecognizer`) races
against the timing of when the synthesized touch event is sent to the gesture recognizer. When the touch is
delivered to the gesture *before* the text tap gesture is reset, we end up timing out because the text tap
gesture's action never fires and makes the content view first responder.

To ensure that we don't lose this race and time out, we augment the existing mechanism in
`UIScriptControllerIOS::waitForSingleTapToReset()` to wait for *all* enabled single tap (and single touch)
gestures to reset, instead of only waiting for the web view's synthetic click gesture. Importantly, this
includes `UITextTapRecognizer`, which ensures that the touches are delivered to the gesture only after the text
tap gesture has been reset (and transitions to Possible state).

* WebKitTestRunner/ios/UIScriptControllerIOS.mm:
(WTR::UIScriptControllerIOS::waitForSingleTapToReset const):

Instead of using testing SPI (`-_doAfterResettingSingleTapGesture:`) to wait for the single tap to reset, we can
just directly iterate through all the gestures on the content view and wait for all enabled single tap gestures
to transition back to Possible state.

LayoutTests:

Update test expectations for this flaky test.

* platform/ios-14/TestExpectations:
* platform/ios/TestExpectations:


Canonical link: https://commits.webkit.org/240529@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@281068 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-08-16 03:34:05 +00:00
Wenson Hsieh dba3abc6e2 [ iOS Debug] 3 editing/pasteboard/smart-paste-paragraph tests are flaky failing
https://bugs.webkit.org/show_bug.cgi?id=228285
rdar://81118724

Reviewed by Tim Horton and Aditya Keerthi.

Source/WebKit:

Add SPI declarations. See Tools/ChangeLog for more details.

* Platform/spi/ios/TextInputSPI.h:
* Platform/spi/ios/UIKitSPI.h:

Tools:

These three editing tests occasionally fail when synthesizing a double-tap gesture in order to select a word in
editable content. This happens because unless UIKit has observed at least one keypress event (e.g. from a
previous editing test), it presents the software keyboard underneath `-[UIKeyboardImpl showKeyboardIfNeeded]`
when setting the selection via UITextSelectionInteraction. This causes the input view frame to expand from the
collapsed (UCB) height of 44pt to the full software keyboard height, which in turn causes the second touch in
the synthesized double tap gesture to _sometimes_ hit-test to the wrong location, resulting in these test
failures.

To mitigate this, ensure that we have consistent behavior in layout tests when changing the text selection in
editable content by directly setting a TextInput default to make the keyboard behave as if it has previously
seen a keypress via the hardware keyboard.

* WebKitTestRunner/ios/TestControllerIOS.mm:
(WTR::TestController::platformResetStateToConsistentValues):

LayoutTests:

Remove the flaky test failure expectations.

* platform/ios-wk2/TestExpectations:


Canonical link: https://commits.webkit.org/240486@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@280986 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-08-12 21:13:45 +00:00
Sam Weinig 9cc977ee4d Allow testing of the final UIView tree on iOS platforms
https://bugs.webkit.org/show_bug.cgi?id=229016

Reviewed by Tim Horton.

Source/WebKit:

Test: remote-layer-tree/ios/uiview-tree-basic.html

* UIProcess/API/ios/WKWebViewPrivateForTestingIOS.h:
* UIProcess/API/ios/WKWebViewTestingIOS.mm:
(allowListedClassToString):
(dumpUIView):
(-[WKWebView _uiViewTreeAsText]):
Add partner SPI called _uiViewTreeAsText that dumps the WKWebView's
UIView tree as constructed via remote layer creation. It currently
dumps some basic properties of each view and uses an allow list of
class names so changes to implementation details in frameworks below
us, like UIKit, don't cause tests to fail.

Tools:

* TestRunnerShared/UIScriptContext/Bindings/UIScriptController.idl:
* TestRunnerShared/UIScriptContext/UIScriptController.h:
(WTR::UIScriptController::uiViewTreeAsText const):
* WebKitTestRunner/ios/UIScriptControllerIOS.h:
* WebKitTestRunner/ios/UIScriptControllerIOS.mm:
(WTR::UIScriptControllerIOS::uiViewTreeAsText const):
Pipe new _uiViewTreeAsText SPI through to UIScriptController, matching the pattern
established by scrollingTreeAsText.

LayoutTests:

* remote-layer-tree: Added.
* remote-layer-tree/ios: Added.
* remote-layer-tree/ios/uiview-tree-basic-expected.txt: Added.
* remote-layer-tree/ios/uiview-tree-basic.html: Added.
Add basic test case excercising UIView tree dumping to ensure
it is working properly.

* resources/ui-helper.js:
(window.UIHelper.getUIViewTree):
Add helper to use get the UIView tree as text.

* TestExpectations:
* platform/ios/TestExpectations:
Ensure these tests are only run on iOS.


Canonical link: https://commits.webkit.org/240481@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@280980 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-08-12 20:16:51 +00:00
Lauro Moura 5204d61c0c [WPE] Handle escape key in wpeKeySymForKeyRef
https://bugs.webkit.org/show_bug.cgi?id=228981

Reviewed by Carlos Garcia Campos.

Some dialog tests were failing due to "escape" key ref being
translated to the 'e' keysym.

Covered by existing tests.

* WebKitTestRunner/wpe/EventSenderProxyWPE.cpp:
(WTR::wpeKeySymForKeyRef):


Canonical link: https://commits.webkit.org/240425@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@280888 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-08-11 07:46:55 +00:00
Tim Horton 1ca2c1a71f macCatalyst: Flexible viewport tests that dump the window size fail because it doesn't match iPad
https://bugs.webkit.org/show_bug.cgi?id=228964

Reviewed by Darin Adler.

* WebKitTestRunner/ios/TestControllerIOS.mm:
(WTR::TestController::platformConfigureViewForTest):
For platforms where we control the size of the window/scene, resize it
to match the chosen default testing iPad size (768x1024), but with the
default testing iPad's status bar subtracted out, and the current platform's
added in, so that the end result is a WKWebView of identical size to
one on the default testing iPad.


Canonical link: https://commits.webkit.org/240407@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@280867 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-08-10 22:17:32 +00:00
Kimmo Kinnunen adb7a45761 Scripts/generate-derived-sources.sh: line 19: [: binary operator expected while building Source/WebKit
https://bugs.webkit.org/show_bug.cgi?id=228908

Patch by Kimmo Kinnunen <kkinnunen@apple.com> on 2021-08-10
Reviewed by Per Arne Vollan.

Source/JavaScriptCore:

* Scripts/generate-derived-sources.sh:
Quote the use of CC so that future copy-paste does not make the same mistake
as this bug.

Source/WebCore:

* Scripts/generate-derived-sources.sh:
Quote the use of CC so that future copy-paste does not make the same mistake
as this bug.

Source/WebKit:

Change variable references in the sh script to quoted "$VAR".
[ -z $VAR ] with VAR="a b" would mean
[ -z a b ].
 -z is unary operator, so the expression b would be in position
where test would expect an operator.
The correct form is [ -z "a b" ].

In general, sh scripts usually refer to variables using quotes.

* Scripts/generate-derived-sources.sh:
Fix a bug where multiple space separated paths in
WEBKITADDITIONS_HEADER_SEARCH_PATHS would cause
test expression to receive arguments after the -z arg.

Quote the use of CC so future copy-paste does not make the same mistake
as this bug.

Tools:

* DumpRenderTree/Scripts/generate-derived-sources.sh:
* WebKitTestRunner/Scripts/generate-derived-sources.sh:
Quote the use of CC so that future copy-paste does not make the same mistake
as this bug.

Canonical link: https://commits.webkit.org/240397@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@280854 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-08-10 17:35:35 +00:00
Wenson Hsieh b2d7d3d04a caret-color does not work on first click in ios
https://bugs.webkit.org/show_bug.cgi?id=228859
rdar://81674787

Reviewed by Tim Horton.

Source/WebKit:

Addresses a couple of issues that cause the `caret-color` CSS property to not be applied when focusing editable
content on iOS. See below for more details.

Test: editing/caret/ios/caret-color-after-refocusing-input.html

* Platform/spi/ios/UIKitSPI.h:
* UIProcess/API/ios/WKWebViewPrivateForTestingIOS.h:
* UIProcess/API/ios/WKWebViewTestingIOS.mm:
(-[WKWebView _serializedSelectionCaretBackgroundColorForTesting]):

Add support for a new test-only helper method. See Tools/ChangeLog for more information.

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

Make a minor adjustment to ensure that changes to `caretColor` in `EditorState` are propagated to UIKit's
selection views. To achieve this, we add `caretColor` to `WKSelectionDrawingInfo`, and force the text selection
view to update the caret background color when the caret color changes (alongside other selection UI geometry
changes, which are applied underneath the call to `-selectionChanged`).

(-[WKContentView _updateChangedSelection:]):
(-[WKContentView textInteractionAssistant]):
* WebProcess/WebPage/ios/WebPageIOS.mm:
(WebKit::WebPage::getPlatformEditorState const):

Address an existing FIXME which (mostly) fixes this bug. Currently, the caret color is only computed when
`WebPage::m_focusedElement` is set. However, when resigning first responder, we clear out `WebPage`'s
`m_focusedElement`) right before updating the DOM selection, which creates a brief window during which we
compute an `EditorState` with a `caretColor` of transparent black.

To avoid this inconsistency, we instead compute the caret color from the selection container; this has the
additional benefit of allowing the caret color to change when changing selection within a single editable host
with multiple caret colors (instead of always just using the focused element's caret color).

Note that while this adjustment to `WebPage::getPlatformEditorState` is sufficient to ensure that the value of
`-[WKContentView insertionPointColor]` (which is based on `EditorState`) is always up-to-date, this doesn't
guarantee that the actual color of UIKit's caret view reflects the updated `-insertionPointColor`, which results
in situations where the caret color appears out-of-date after hiding the keyboard and refocusing an input field.
To fix this, we need the other adjustment in WKContentView (see above).

Tools:

Make it possible to test this bug by adding a UIScriptController hook to request the background color of the
current selection view's caret view, as serialized CSS text. See LayoutTests/ChangeLog for more details.

* TestRunnerShared/UIScriptContext/Bindings/UIScriptController.idl:
* TestRunnerShared/UIScriptContext/UIScriptController.h:
(WTR::UIScriptController::selectionCaretBackgroundColor const):
* WebKitTestRunner/ios/UIScriptControllerIOS.h:
* WebKitTestRunner/ios/UIScriptControllerIOS.mm:
(WTR::UIScriptControllerIOS::selectionCaretBackgroundColor const):

LayoutTests:

Add a new layout test that exercises the issue, as reported in Bugzilla (the call to `-resignFirstResponder`
simulates backgrounding Safari). To achieve this, we also introduce a script controller testing helper to grab
the native background color of the `UITextSelectionView`'s caret view; see Tools/ChangeLog for more details.

* editing/caret/ios/caret-color-after-refocusing-input-expected.txt: Added.
* editing/caret/ios/caret-color-after-refocusing-input.html: Added.
* resources/ui-helper.js:
(window.UIHelper.selectionCaretBackgroundColor):


Canonical link: https://commits.webkit.org/240352@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@280767 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-08-09 01:21:41 +00:00
Fujii Hironori 4c96573f0f [Win][WebKitTestRunner] WTR::PlatformWebView leaks m_view (WKViewRef)
https://bugs.webkit.org/show_bug.cgi?id=228857

Reviewed by Don Olmstead.

Windows WebKitTestRunner leaked a lot of object because it leaked
WebKit::WebView that retains WebKit::WebPageProxy.

* WebKitTestRunner/win/PlatformWebViewWin.cpp:
(WTR::PlatformWebView::~PlatformWebView): Release m_view.

Canonical link: https://commits.webkit.org/240321@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@280734 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-08-06 20:24:31 +00:00
Jer Noble 91f29e5c6a WebKitTestRunner should dump current results in the case of a timeout
https://bugs.webkit.org/show_bug.cgi?id=228706
<rdar://79154019>

Reviewed by Jonathan Bedard.

When WKTR encounters a timeout, it current prints a "PID UNRESPONSIVE" and "FAIL: timed out" message,
but the WebContent process may not actually be unresponsive; it may just be waiting for an event
which hasn't fired, or a condition to become true. In these cases, it would be very helpful to see
the results of the test so far, so as to diagnose what is keeping the test from running to completion.

When, in the WKTR process, TestInvocation's "waitToDumpWatchdogTimer" fires, first try sending a message
to the InjectedBundle, requesting it to "ForceImmediateCompletion". Only if this message fails to be
acted upon will WKTR print the "PID UNRESPONSIVE" message.

* WebKitTestRunner/InjectedBundle/InjectedBundle.cpp:
(WTR::InjectedBundle::didReceiveMessageToPage):
* WebKitTestRunner/TestInvocation.cpp:
(WTR::TestInvocation::TestInvocation):
(WTR::TestInvocation::waitToDumpWatchdogTimerFired):
(WTR::TestInvocation::initializeWaitForPostDumpWatchdogTimerIfNeeded):
(WTR::TestInvocation::invalidateWaitForPostDumpWatchdogTimer):
(WTR::TestInvocation::waitForPostDumpWatchdogTimerFired):
(WTR::TestInvocation::done):
* WebKitTestRunner/TestInvocation.h:


Canonical link: https://commits.webkit.org/240232@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@280619 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-08-03 22:23:44 +00:00
Adrien Destugues 3c03b69045 Merge commit 'e09283eaa2c87b3bb00c5380c76ccc1292a165c2' into Haiku branch 2021-08-01 10:58:52 +02:00
Devin Rousso d5bda802aa [Modern Media Controls] [macOS] Overflow button still shows as `on` even after contextmenu is dismissed
https://bugs.webkit.org/show_bug.cgi?id=228310
<rdar://problem/81124786>

Reviewed by Wenson Hsieh.

Source/WebCore:

Test: media/modern-media-controls/overflow-support/button-state.html

* page/ContextMenuController.h:
* page/ContextMenuController.cpp:
(WebCore::ContextMenuController::didDismissContextMenu): Added.
* page/ContextMenuProvider.h:
(WebCore::ContextMenuProvider::didDismissContextMenu): Added.
Add plumbing from WebKit to the `ContextMenuProvider` for when the contextmenu is dismissed.

* Modules/mediacontrols/MediaControlsHost.cpp:
(WebCore::MediaControlsContextMenuProvider::didDismissContextMenu): Added.
When the contextmenu is dismissed, invoke the callback provided to `MediaControlsHost::showMediaControlsContextMenu`
as that's the signal to the `MediaController` that the contextmenu interaction is over,
which adjusts the `on` state of the `Button`.

Source/WebKit:

Pipe along the `-[NSMenuDelegate menuDidClose:]` signal to the WebProcess so the `WebCore::ContextMenuProvider`
can handle it if needed.

* UIProcess/WebContextMenuProxy.cpp:
(WebKit::WebContextMenuProxy::useContextMenuItems):
* UIProcess/mac/WebContextMenuProxyMac.mm:
(-[WKMenuDelegate menuWillOpen:]):
(-[WKMenuDelegate menuDidClose:]):

* UIProcess/WebPageProxy.h:
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::showContextMenu):
(WebKit::WebPageProxy::didShowContextMenu):
(WebKit::WebPageProxy::didDismissContextMenu): Added.

* WebProcess/WebPage/WebContextMenu.cpp:
(WebKit::WebContextMenu::show):

* WebProcess/WebPage/WebPage.messages.in:
* WebProcess/WebPage/WebPage.h:
(WebKit::WebPage::startWaitingForContextMenuToShow): Added.
(WebKit::WebPage::contextMenuShowing): Deleted.
(WebKit::WebPage::contextMenuHidden): Deleted.
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::didShowContextMenu): Added.
(WebKit::WebPage::didDismissContextMenu): Added.
(WebKit::WebPage::mouseEvent):
Drive-by: Rename `m_contextMenuShowing` to `m_waitingForContextMenuToShow` for clarity.

Tools:

* WebKitTestRunner/cocoa/TestRunnerWKWebView.mm:
(-[TestRunnerWKWebView dismissActiveMenu]):
(-[TestRunnerWKWebView immediatelyDismissContextMenuIfNeeded]):
(-[TestRunnerWKWebView _dismissAllContextMenuInteractions]): Added.

LayoutTests:

* media/modern-media-controls/overflow-support/button-state.html: Added.
* media/modern-media-controls/overflow-support/button-state-expected.txt: Added.

* media/modern-media-controls/overflow-support/playback-speed.html:
* media/modern-media-controls/tracks-support/click-track-in-contextmenu.html:
Adjust how these tests wait for and dismiss the contextmenu.


Canonical link: https://commits.webkit.org/240018@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@280374 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-07-28 03:56:44 +00:00
Wenson Hsieh 1a180891ec [iOS] Unified field is unselected after focusing URL bar if text was selected in a fixed position container
https://bugs.webkit.org/show_bug.cgi?id=228269
rdar://80556392

Reviewed by Tim Horton.

Source/WebKit:

In Safari on iOS 15, if the selection (either ranged or caret) is inside a fixed position container when the
user taps on the unified field, we'll immediately clear the text selection inside the unified field upon
bringing up the keyboard. This happens because the tab pill in iOS 15 is lowered as the URL bar is focused,
which causes the web view to scroll slightly. This, in turn, induces a brief unstable scrolling tree state,
which then causes us to temporarily hide and show selection views while scrolling in unstable state (see
r209931) by calling `-deactivateSelection` and then `-activateSelection` on the text interaction assistant.
Calling `-[UIWKTextInteractionAssistant activateSelection]` then causes UIKit to dispatch a
UITextSelectionViewActivatedNotification; In the unified field, which is a UITextField subclass, UIKit code then
listens for this notification and responds to it by clearing the selection if the newly activated selection's
host view (WKContentView) is different than itself, thereby causing the bug.

To fix this, we simply make two (minor) adjustments to the logic for temporarily hiding and showing the
selection while performing an unstable scroll. See below for more details.

Test: editing/selection/ios/scrolling-with-fixed-selection-does-not-unselect-native-text-field.html

* UIProcess/ios/WKContentViewInteraction.mm:
(-[WKContentView shouldHideSelectionWhenScrolling]):

Only hide and (later) restore the selection in non-editable text if the selection is ranged. This is because
caret selections in non-editable content are not user-visible anyways, so there's no need to temporarily
suppress the selection.

(-[WKContentView _updateChangedSelection:]):

Only attempt to show the selection views again if doing so doesn't cause us to steal first responder status away
from the existing first responder; otherwise, we'll wait until we `-becomeFirstResponder` to `-activateSelection`.

(-[WKContentView selectionInteractionAssistant]): Deleted.

Tools:

We already have some very basic support for installing and removing native text fields in the view hierarchy,
through `TestRunner::(add|remove)ChromeInputField()`. In order to support the new layout test, we additionally
implement the ability to:

- Set text inside the native chrome input field that was installed using `addChromeInputField()`.
- Select all text inside the chrome input field.
- Query the chrome input field for the currently selected text.

We only support iOS for the time being, with stubs on other platforms, since the new test that uses this
functionality is iOS-specific; if needed in the future for a similar test on other platforms, we can implement
the stubbed testing hooks on TestRunner and PlatformWebView as well.

* DumpRenderTree/TestRunner.h:
* DumpRenderTree/mac/TestRunnerMac.mm:
(TestRunner::setTextInChromeInputField):
(TestRunner::selectChromeInputField):
(TestRunner::getSelectedTextInChromeInputField):
* DumpRenderTree/win/TestRunnerWin.cpp:
(TestRunner::setTextInChromeInputField):
(TestRunner::selectChromeInputField):
(TestRunner::getSelectedTextInChromeInputField):
* WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl:
* WebKitTestRunner/InjectedBundle/InjectedBundle.cpp:
(WTR::InjectedBundle::didReceiveMessageToPage):
(WTR::InjectedBundle::postSetTextInChromeInputField):
(WTR::InjectedBundle::postSelectChromeInputField):
(WTR::InjectedBundle::postGetSelectedTextInChromeInputField):
* WebKitTestRunner/InjectedBundle/InjectedBundle.h:
* WebKitTestRunner/InjectedBundle/TestRunner.cpp:
(WTR::TestRunner::setTextInChromeInputField):
(WTR::TestRunner::selectChromeInputField):
(WTR::TestRunner::getSelectedTextInChromeInputField):
(WTR::TestRunner::callSetTextInChromeInputFieldCallback):
(WTR::TestRunner::callSelectChromeInputFieldCallback):
(WTR::TestRunner::callGetSelectedTextInChromeInputFieldCallback):
* WebKitTestRunner/InjectedBundle/TestRunner.h:
* WebKitTestRunner/PlatformWebView.h:
* WebKitTestRunner/TestInvocation.cpp:
(WTR::TestInvocation::didReceiveMessageFromInjectedBundle):
* WebKitTestRunner/gtk/PlatformWebViewGtk.cpp:
(WTR::PlatformWebView::setTextInChromeInputField):
(WTR::PlatformWebView::selectChromeInputField):
(WTR::PlatformWebView::getSelectedTextInChromeInputField):
* WebKitTestRunner/ios/PlatformWebViewIOS.mm:
(WTR::chromeInputField):

Additionally do some light refactoring by pulling out logic for grabbing the chrome input field (i.e. a view
with a tag of 1 under the window) out into a separate helper method. Use this helper in a few places below.

(WTR::PlatformWebView::addChromeInputField):
(WTR::PlatformWebView::setTextInChromeInputField):
(WTR::PlatformWebView::selectChromeInputField):
(WTR::PlatformWebView::getSelectedTextInChromeInputField):
(WTR::PlatformWebView::removeChromeInputField):
* WebKitTestRunner/mac/PlatformWebViewMac.mm:
(WTR::PlatformWebView::setTextInChromeInputField):
(WTR::PlatformWebView::selectChromeInputField):
(WTR::PlatformWebView::getSelectedTextInChromeInputField):
* WebKitTestRunner/win/PlatformWebViewWin.cpp:
(WTR::PlatformWebView::setTextInChromeInputField):
(WTR::PlatformWebView::selectChromeInputField):
(WTR::PlatformWebView::getSelectedTextInChromeInputField):
* WebKitTestRunner/wpe/PlatformWebViewWPE.cpp:
(WTR::PlatformWebView::setTextInChromeInputField):
(WTR::PlatformWebView::selectChromeInputField):
(WTR::PlatformWebView::getSelectedTextInChromeInputField):

LayoutTests:

Add a new layout test that installs, focuses, and selects text inside a native UITextField (simulating Safari's
URL field) while the DOM selection is inside a fixed position container, and then scrolls the web view a bit to
temporarily induce an unstable scrolling tree state. After this, we verify that the text selection inside the
native text field has not been cleared.

See Tools/ changes for more details.

* editing/selection/ios/scrolling-with-fixed-selection-does-not-unselect-native-text-field-expected.txt: Added.
* editing/selection/ios/scrolling-with-fixed-selection-does-not-unselect-native-text-field.html: Added.
* resources/ui-helper.js:
(window.UIHelper.addChromeInputField):
(window.UIHelper.removeChromeInputField):
(window.UIHelper.setTextInChromeInputField):
(window.UIHelper.selectChromeInputField):
(window.UIHelper.getSelectedTextInChromeInputField):
(window.UIHelper):


Canonical link: https://commits.webkit.org/239946@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@280288 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-07-25 19:40:36 +00:00
Andres Gonzalez 1847da0dbb Add a method to WebAccessibilityObjectWrapper so that clients can retrieve the text of each line and their corresponding bounding rectangles.
https://bugs.webkit.org/show_bug.cgi?id=228251
Source/WebCore:

rdar://77184036

Reviewed by Chris Fleizach.

Test: accessibility/ios-simulator/element-line-rects-and-text.html

Accessibility clients often need to retrieve a line of text and its
corresponding bounding rectangle screen coordinates. There was not a
clear way of doing this. This patch provides lineRectsAndText as the
mechanism to retrieve the lines of text and their corresponding
rectangles for a given accessibility object. This is the iOS
implementation. MacOS implementation will be done in a separate patch.

* accessibility/ios/WebAccessibilityObjectWrapperIOS.mm:
(-[WebAccessibilityObjectWrapper stringsForSimpleRange:attributed:]):
(-[WebAccessibilityObjectWrapper arrayOfTextForTextMarkers:attributed:]):
(-[WebAccessibilityObjectWrapper lineRectsAndText]):
(-[WebAccessibilityObjectWrapper lineRectsForTextMarkerRange:]):

Tools:

Reviewed by Chris Fleizach.

* WebKitTestRunner/InjectedBundle/AccessibilityUIElement.cpp:
(WTR::AccessibilityUIElement::lineRectsAndText const):
* WebKitTestRunner/InjectedBundle/AccessibilityUIElement.h:
* WebKitTestRunner/InjectedBundle/Bindings/AccessibilityUIElement.idl:
* WebKitTestRunner/InjectedBundle/ios/AccessibilityUIElementIOS.mm:
(WTR::AccessibilityUIElement::lineRectsAndText const):
* WebKitTestRunner/InjectedBundle/mac/AccessibilityCommonMac.mm:
(WTR::makeJSArray):

LayoutTests:

Reviewed by Chris Fleizach.

* accessibility/ios-simulator/element-line-rects-and-text-expected.txt: Added.
* accessibility/ios-simulator/element-line-rects-and-text.html: Added.


Canonical link: https://commits.webkit.org/239940@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@280282 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-07-24 03:48:01 +00:00
Adrien Destugues 6fa86ddd8b Merge commit '533b089dc9634a2d7afcd133d96f9f46d347f1a7' into Haiku 2021-07-20 21:31:28 +02:00
Adrien Destugues 5ed61c0e9d Merge commit 'ec22083ba85576871d51823bd67ff81b2c2d8bf8' into Haiku branch 2021-07-19 19:23:04 +02:00
Kate Cheney af1435cdfb Allow layout tests to specify app initiated loads or not
https://bugs.webkit.org/show_bug.cgi?id=227825
<rdar://problem/80355582>

Reviewed by Brent Fulgham.

Source/WebKit:

Tests: http/tests/app-privacy-report/app-attribution-load-url.html
       http/tests/app-privacy-report/app-attribution-ping-load.html
       http/tests/app-privacy-report/app-attribution-post-request.html
       http/tests/app-privacy-report/app-attribution-preflight-async.html
       http/tests/app-privacy-report/app-attribution-preflight-sync.html
       http/tests/app-privacy-report/app-attribution-speculative-revalidation.html
       http/tests/app-privacy-report/user-attribution-load-url.html
       http/tests/app-privacy-report/user-attribution-ping-load.html
       http/tests/app-privacy-report/user-attribution-post-request.html
       http/tests/app-privacy-report/user-attribution-preflight-async.html
       http/tests/app-privacy-report/user-attribution-preflight-sync.html
       http/tests/app-privacy-report/user-attribution-speculative-revalidation.html

Add a parameter to the WebView configuration that allows a test to
override the default NSURLRequest attribution value. We don't need
this to be dynamic per-test, so we can store it in the configuration.

* UIProcess/API/APIPageConfiguration.cpp:
(API::PageConfiguration::copy const):
* UIProcess/API/APIPageConfiguration.h:
(API::PageConfiguration::appInitiatedOverrideValueForTesting const):
(API::PageConfiguration::setAppInitiatedOverrideValueForTesting):
* UIProcess/API/Cocoa/WKWebViewConfiguration.mm:
(toWKAttributionOverrideTesting):
(toAttributionOverrideTesting):
(-[WKWebViewConfiguration _setAppInitiatedOverrideValueForTesting:]):
(-[WKWebViewConfiguration _appInitiatedOverrideValueForTesting]):
* UIProcess/API/Cocoa/WKWebViewConfigurationPrivate.h:
* UIProcess/Cocoa/WebPageProxyCocoa.mm:
(WebKit::WebPageProxy::setLastNavigationWasAppInitiated):

Tools:

Add a test option that specifies whether the test should mark the
main page navigation as app-initiated or not.

* WebKitTestRunner/TestOptions.cpp:
(WTR::TestOptions::defaults):
(WTR::TestOptions::keyTypeMapping):
* WebKitTestRunner/TestOptions.h:
(WTR::TestOptions::isAppInitiated const):
* WebKitTestRunner/cocoa/TestControllerCocoa.mm:
(WTR::TestController::platformCreateWebView):

LayoutTests:

Added new tests to cover the user initiated case.

* http/tests/app-privacy-report/app-attribution-load-url-expected.txt: Renamed from LayoutTests/http/tests/app-privacy-report/attribution-load-url-expected.txt.
* http/tests/app-privacy-report/app-attribution-load-url.html: Copied from LayoutTests/http/tests/app-privacy-report/attribution-load-url.html.
* http/tests/app-privacy-report/app-attribution-ping-load-expected.txt: Copied from LayoutTests/http/tests/app-privacy-report/attribution-ping-load-expected.txt.
* http/tests/app-privacy-report/app-attribution-ping-load.html: Copied from LayoutTests/http/tests/app-privacy-report/attribution-ping-load.html.
* http/tests/app-privacy-report/app-attribution-post-request-expected.txt: Renamed from LayoutTests/http/tests/app-privacy-report/attribution-post-request-expected.txt.
* http/tests/app-privacy-report/app-attribution-post-request.html: Copied from LayoutTests/http/tests/app-privacy-report/attribution-post-request.html.
* http/tests/app-privacy-report/app-attribution-preflight-async-expected.txt: Copied from LayoutTests/http/tests/app-privacy-report/attribution-preflight-async-expected.txt.
* http/tests/app-privacy-report/app-attribution-preflight-async.html: Copied from LayoutTests/http/tests/app-privacy-report/attribution-preflight-async.html.
* http/tests/app-privacy-report/app-attribution-preflight-sync-expected.txt: Copied from LayoutTests/http/tests/app-privacy-report/attribution-preflight-sync-expected.txt.
* http/tests/app-privacy-report/app-attribution-preflight-sync.html: Copied from LayoutTests/http/tests/app-privacy-report/attribution-preflight-sync.html.
* http/tests/app-privacy-report/app-attribution-speculative-revalidation-expected.txt: Copied from LayoutTests/http/tests/app-privacy-report/attribution-speculative-revalidation-expected.txt.
* http/tests/app-privacy-report/app-attribution-speculative-revalidation.html: Copied from LayoutTests/http/tests/app-privacy-report/attribution-speculative-revalidation.html.
* http/tests/app-privacy-report/resources/app-initiated-post.py: Copied from LayoutTests/http/tests/app-privacy-report/resources/post.py.
* http/tests/app-privacy-report/resources/user-initiated-post.py: Renamed from LayoutTests/http/tests/app-privacy-report/resources/post.py.
* http/tests/app-privacy-report/user-attribution-load-url-expected.txt: Added.
* http/tests/app-privacy-report/user-attribution-load-url.html: Renamed from LayoutTests/http/tests/app-privacy-report/attribution-load-url.html.
* http/tests/app-privacy-report/user-attribution-ping-load-expected.txt: Renamed from LayoutTests/http/tests/app-privacy-report/attribution-ping-load-expected.txt.
* http/tests/app-privacy-report/user-attribution-ping-load.html: Renamed from LayoutTests/http/tests/app-privacy-report/attribution-ping-load.html.
* http/tests/app-privacy-report/user-attribution-post-request-expected.txt: Added.
* http/tests/app-privacy-report/user-attribution-post-request.html: Renamed from LayoutTests/http/tests/app-privacy-report/attribution-post-request.html.
* http/tests/app-privacy-report/user-attribution-preflight-async-expected.txt: Renamed from LayoutTests/http/tests/app-privacy-report/attribution-preflight-async-expected.txt.
* http/tests/app-privacy-report/user-attribution-preflight-async.html: Renamed from LayoutTests/http/tests/app-privacy-report/attribution-preflight-async.html.
* http/tests/app-privacy-report/user-attribution-preflight-sync-expected.txt: Renamed from LayoutTests/http/tests/app-privacy-report/attribution-preflight-sync-expected.txt.
* http/tests/app-privacy-report/user-attribution-preflight-sync.html: Renamed from LayoutTests/http/tests/app-privacy-report/attribution-preflight-sync.html.
* http/tests/app-privacy-report/user-attribution-speculative-revalidation-expected.txt: Renamed from LayoutTests/http/tests/app-privacy-report/attribution-speculative-revalidation-expected.txt.
* http/tests/app-privacy-report/user-attribution-speculative-revalidation.html: Renamed from LayoutTests/http/tests/app-privacy-report/attribution-speculative-revalidation.html.
* http/tests/navigation/resources/check-ping-user-initiated-data.py: Added.


Canonical link: https://commits.webkit.org/239627@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@279874 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-07-13 16:40:12 +00:00
Wenson Hsieh 20586209d4 [watchOS] Make a few additional adjustments to support system minimum layout margins
https://bugs.webkit.org/show_bug.cgi?id=227859
rdar://80113612

Reviewed by Tim Horton.

Source/WebCore:

Reduce the default minimum viewport scale on watchOS to avoid horizontal scrolling when loading wide fixed-
viewport-width web content. See WebKit ChangeLog for more details.

* page/ViewportConfiguration.cpp:
(WebCore::platformDeviceWidthOverride):
(WebCore::platformMinimumScaleForWebpage):
(WebCore::shouldOverrideShrinkToFitArgument):
(WebCore::ViewportConfiguration::nativeWebpageParametersWithShrinkToFit):
(WebCore::ViewportConfiguration::webpageParameters):

Source/WebKit:

Make a couple of minor adjustments to deal with the fact that `-contentInset` includes system content insets
(specifically, `-_contentScrollInset`) on watchOS, due to method swizzling that happens in PepperUICore. See
changes below for more detail.

Test: fast/viewport/watchos/viewport-with-system-minimum-layout-margins.html

* UIProcess/API/ios/WKWebViewIOS.mm:
(-[WKWebView _computedContentInset]):

Only apply `-safeAreaInsets` on top of `-contentInset` when computing the total scroll view content inset on
watchOS (as opposed to applying both `-safeAreaInsets` and `-_contentScrollInset`); this is because
`-contentInset` on watchOS is actually equivalent to `-_effectiveContentInset` on other iOS-family platforms, so
additionally adding `-_contentScrollInset` here would result in the scroll content inset being double-counted.

* UIProcess/ios/WKScrollView.mm:
(-[WKScrollView setContentInset:]):
(-[WKScrollView _setContentScrollInsetInternal:]):
(-[WKScrollView _updateContentScrollInset]):

In the case where the WebKit client explicitly sets the scroll view's content insets using `-[WKScrollView
setContentInset:]`, set a flag (`_contentInsetWasExternallyOverridden`) and immediately revert any internally
specified `-_contentScrollInset` on WKScrollView. Due to the swizzled implementation of `-[UIScrollView
contentInset]` described above, it's practically impossible for any client to use `-setContentInset:` correctly
when there is a nonzero `-_contentScrollInset` on watchOS, so preferable to simply get out of the way of the
client in this scenario.

In the context of _SFNanoBrowserViewController, this ensures that scroll view content inset adjustment logic in
Safari doesn't inadvertently cause horizontal content insets to increase by `-_contentScrollInset` every time
`-[WKScrollView setContentInset:]` is invoked by the client.

Tools:

Add support for simulating arbitrary horizontal (trailing and leading) values for `-systemMinimumLayoutMargin`
in WebKitTestRunner, via a new "horizontalSystemMinimumLayoutMargin" test option. By default, this is 0.

* WebKitTestRunner/TestOptions.cpp:
(WTR::TestOptions::defaults):
(WTR::TestOptions::keyTypeMapping):
* WebKitTestRunner/TestOptions.h:
(WTR::TestOptions::horizontalSystemMinimumLayoutMargin const):
* WebKitTestRunner/ios/PlatformWebViewIOS.mm:
(-[PlatformWebViewController systemMinimumLayoutMargins]):

Override this UIViewController method and replace the leading and trailing layout margin values with the values
from test options.

(WTR::PlatformWebView::PlatformWebView):
* WebKitTestRunner/ios/TestControllerIOS.mm:
(WTR::TestController::platformResetStateToConsistentValues):

Additionally make a slight adjustment here to avoid calling `-setContentInset` on the scroll view in between
tests if the content insets aren't changing. This is needed in order for the new layout test to work on watchOS.

LayoutTests:

Add a new layout test that uses the new test option to verify that nonzero horizontal system minimum layout
margins shrink the width of the viewport on watchOS (this test also disables watchOS device adaptations and uses
a device-width viewport with `initial-scale=1` such that we can simply check the value of `innerWidth`).

* fast/viewport/watchos/viewport-with-system-minimum-layout-margins-expected.txt: Added.
* fast/viewport/watchos/viewport-with-system-minimum-layout-margins.html: Added.


Canonical link: https://commits.webkit.org/239591@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@279830 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-07-12 16:15:13 +00:00
Kate Cheney 9b8c5e9572 Clean up App Privacy Report code
https://bugs.webkit.org/show_bug.cgi?id=227326
<rdar://problem/79696849>

Reviewed by Brent Fulgham.

Source/WebCore:

Tests: http/tests/app-privacy-report/attribution-load-url.html
       http/tests/app-privacy-report/attribution-ping-load.html
       http/tests/app-privacy-report/attribution-post-request.html
       http/tests/app-privacy-report/attribution-preflight-async.html
       http/tests/app-privacy-report/attribution-preflight-sync.html
       http/tests/app-privacy-report/attribution-speculative-revalidation.html

Rename App Privacy Report code to better align with the code's purpose
of attributing loads to the app or not. The default value should
be app initiated based on the documentation, so this patch also adjusts
the default value as needed.

* loader/CrossOriginAccessControl.cpp:
(WebCore::createAccessControlPreflightRequest):
* loader/DocumentLoader.h:
(WebCore::DocumentLoader::lastNavigationWasAppInitiated const):
(WebCore::DocumentLoader::setLastNavigationWasAppInitiated):
(WebCore::DocumentLoader::lastNavigationWasAppBound const): Deleted.
(WebCore::DocumentLoader::setLastNavigationWasAppBound): Deleted.
* loader/FrameLoader.cpp:
(WebCore::FrameLoader::load):
(WebCore::FrameLoader::updateRequestAndAddExtraFields):
* loader/FrameLoader.h:
* platform/network/ResourceRequestBase.cpp:
(WebCore::ResourceRequestBase::setAsIsolatedCopy):
* platform/network/ResourceRequestBase.h:
(WebCore::ResourceRequestBase::isAppInitiated const):
(WebCore::ResourceRequestBase::setIsAppInitiated):
(WebCore::ResourceRequestBase::ResourceRequestBase):
(WebCore::ResourceRequestBase::encodeBase const):
(WebCore::ResourceRequestBase::decodeBase):
(WebCore::ResourceRequestBase::isAppBound const): Deleted.
(WebCore::ResourceRequestBase::setIsAppBound): Deleted.
* testing/ServiceWorkerInternals.cpp:
(WebCore::ServiceWorkerInternals::lastNavigationWasAppInitiated):
(WebCore::ServiceWorkerInternals::lastNavigationWasAppBound): Deleted.
* testing/ServiceWorkerInternals.h:
* testing/ServiceWorkerInternals.idl:
* workers/service/ServiceWorkerClientData.cpp:
(WebCore::ServiceWorkerClientData::isolatedCopy const):
(WebCore::ServiceWorkerClientData::from):
* workers/service/ServiceWorkerClientData.h:
(WebCore::ServiceWorkerClientData::encode const):
(WebCore::ServiceWorkerClientData::decode):
* workers/service/ServiceWorkerContextData.cpp:
(WebCore::ServiceWorkerContextData::isolatedCopy const):
* workers/service/ServiceWorkerContextData.h:
(WebCore::ServiceWorkerContextData::encode const):
(WebCore::ServiceWorkerContextData::decode):
* workers/service/context/ServiceWorkerThreadProxy.cpp:
(WebCore::ServiceWorkerThreadProxy::ServiceWorkerThreadProxy):
(WebCore::ServiceWorkerThreadProxy::setLastNavigationWasAppInitiated):
(WebCore::ServiceWorkerThreadProxy::lastNavigationWasAppInitiated):
(WebCore::ServiceWorkerThreadProxy::setLastNavigationWasAppBound): Deleted.
(WebCore::ServiceWorkerThreadProxy::lastNavigationWasAppBound): Deleted.
* workers/service/context/ServiceWorkerThreadProxy.h:
* workers/service/server/RegistrationDatabase.cpp:
(WebCore::RegistrationDatabase::importRecords):
* workers/service/server/SWServer.cpp:
(WebCore::SWServer::startScriptFetch):
(WebCore::SWServer::updateWorker):
(WebCore::SWServer::clientIsAppInitiatedForRegistrableDomain):
(WebCore::SWServer::updateAppInitiatedValueForWorkers):
(WebCore::SWServer::registerServiceWorkerClient):
(WebCore::SWServer::unregisterServiceWorkerClient):
(WebCore::SWServer::clientIsAppBoundForRegistrableDomain): Deleted.
(WebCore::SWServer::updateAppBoundValueForWorkers): Deleted.
* workers/service/server/SWServer.h:
* workers/service/server/SWServerRegistration.cpp:
(WebCore::SWServerRegistration::scheduleSoftUpdate):
* workers/service/server/SWServerRegistration.h:
(WebCore::SWServerRegistration::isAppInitiated):
(WebCore::SWServerRegistration::isAppBound): Deleted.
* workers/service/server/SWServerToContextConnection.h:
* workers/service/server/SWServerWorker.cpp:
(WebCore::m_lastNavigationWasAppInitiated):
(WebCore::SWServerWorker::contextData const):
(WebCore::SWServerWorker::updateAppInitiatedValue):
(WebCore::m_lastNavigationWasAppBound): Deleted.
(WebCore::SWServerWorker::updateAppBoundValue): Deleted.
* workers/service/server/SWServerWorker.h:

Source/WebKit:

Rename App Privacy Report code to better align with the code's purpose
of attributing loads to the app or not. The default value should
be app initiated based on the documentation, so this patch also adjusts
the default value as needed.

This also adopts the new NSURLRequest attribution API and removes
the deprecated _isNonAppInitiated SPI.

Covered by existing layout and API tests.

* NetworkProcess/NetworkProcess.cpp:
(WebKit::NetworkProcess::preconnectTo):
(WebKit::NetworkProcess::appPrivacyReportTestingData):
(WebKit::NetworkProcess::clearAppPrivacyReportTestingData):
(WebKit::NetworkProcess::appBoundNavigationData): Deleted.
(WebKit::NetworkProcess::clearAppBoundNavigationData): Deleted.
* NetworkProcess/NetworkProcess.h:
* NetworkProcess/NetworkProcess.messages.in:
* NetworkProcess/NetworkResourceLoader.cpp:
(WebKit::NetworkResourceLoader::continueWillSendRedirectedRequest):
(WebKit::NetworkResourceLoader::isAppBound):
* NetworkProcess/NetworkSession.h:
(WebKit::NetworkSession::appPrivacyReportTestingData):
(WebKit::NetworkSession::appBoundNavigationTestingData): Deleted.
* NetworkProcess/ServiceWorker/ServiceWorkerFetchTask.cpp:
(WebKit::ServiceWorkerFetchTask::softUpdateIfNeeded):
* NetworkProcess/ServiceWorker/ServiceWorkerSoftUpdateLoader.cpp:
(WebKit::ServiceWorkerSoftUpdateLoader::loadFromNetwork):
* NetworkProcess/ServiceWorker/WebSWServerConnection.cpp:
(WebKit::WebSWServerConnection::controlClient):
(WebKit::WebSWServerConnection::createFetchTask):
* NetworkProcess/ServiceWorker/WebSWServerToContextConnection.cpp:
(WebKit::WebSWServerToContextConnection::updateAppInitiatedValue):
(WebKit::WebSWServerToContextConnection::updateAppBoundValue): Deleted.
* NetworkProcess/ServiceWorker/WebSWServerToContextConnection.h:
* NetworkProcess/cache/NetworkCacheSpeculativeLoadManager.cpp:
(WebKit::NetworkCache::constructRevalidationRequest):
(WebKit::NetworkCache::SpeculativeLoadManager::registerLoad):
(WebKit::NetworkCache::SpeculativeLoadManager::startSpeculativeRevalidation):
* NetworkProcess/cache/NetworkCacheSubresourcesEntry.h:
(WebKit::NetworkCache::SubresourceInfo::isAppInitiated const):
(WebKit::NetworkCache::SubresourceInfo::setIsAppInitiated):
(WebKit::NetworkCache::SubresourceInfo::isAppBound const): Deleted.
(WebKit::NetworkCache::SubresourceInfo::setIsAppBound): Deleted.
* NetworkProcess/cocoa/NetworkDataTaskCocoa.mm:
(WebKit::NetworkDataTaskCocoa::NetworkDataTaskCocoa):
* Scripts/webkit/messages.py:
(headers_for_type):
* Shared/AppPrivacyReport.h:
(WebKit::AppPrivacyReportTestingData::setDidPerformSoftUpdate):
(WebKit::AppPrivacyReportTestingData::clearAppPrivacyReportTestingData):
(WebKit::AppPrivacyReportTestingData::didLoadAppInitiatedRequest):
(WebKit::AppPrivacyReportTestingData::encode const):
(WebKit::AppPrivacyReportTestingData::decode):
* Shared/Cocoa/WebCoreArgumentCodersCocoa.mm:
(IPC::ArgumentCoder<WebCore::ResourceRequest>::encodePlatformData):
(IPC::ArgumentCoder<WebCore::ResourceRequest>::decodePlatformData):
* Shared/NavigatingToAppBoundDomain.h:
(WebKit::AppBoundNavigationTestingData::setDidPerformSoftUpdate): Deleted.
(WebKit::AppBoundNavigationTestingData::clearAppBoundNavigationDataTesting): Deleted.
(WebKit::AppBoundNavigationTestingData::updateAppBoundNavigationTestingData): Deleted.
(WebKit::AppBoundNavigationTestingData::encode const): Deleted.
(WebKit::AppBoundNavigationTestingData::decode): Deleted.
(): Deleted.
* Shared/WebPageCreationParameters.cpp:
(WebKit::WebPageCreationParameters::encode const):
(WebKit::WebPageCreationParameters::decode):
* Shared/WebPageCreationParameters.h:
* UIProcess/API/Cocoa/WKWebView.mm:
(-[WKWebView _didLoadAppInitiatedRequest:]):
(-[WKWebView _didLoadNonAppInitiatedRequest:]):
(-[WKWebView _appBoundNavigationDataForDomain:completionHandler:]): Deleted.
Removed now that we no longer need to test attribution context, that
is all it was used for.

(-[WKWebView _didLoadAppBoundRequest:]): Deleted.
(-[WKWebView _didLoadNonAppBoundRequest:]): Deleted.
* UIProcess/API/Cocoa/WKWebViewPrivate.h:
* UIProcess/API/Cocoa/WKWebViewPrivateForTesting.h:
* UIProcess/API/Cocoa/WKWebViewTesting.mm:
(-[WKWebView _lastNavigationWasAppInitiated:]):
(-[WKWebView _appPrivacyReportTestingData:]):
(-[WKWebView _clearAppPrivacyReportTestingData:]):
(-[WKWebView _lastNavigationWasAppBound:]): Deleted.
(-[WKWebView _appBoundNavigationData:]): Deleted.
(-[WKWebView _clearAppBoundNavigationData:]): Deleted.
* UIProcess/Cocoa/WebPageProxyCocoa.mm:
(WebKit::WebPageProxy::setLastNavigationWasAppInitiated):
(WebKit::WebPageProxy::lastNavigationWasAppInitiated):
(WebKit::WebPageProxy::setLastNavigationWasAppBound): Deleted.
(WebKit::WebPageProxy::lastNavigationWasAppBound): Deleted.
* UIProcess/Network/NetworkProcessProxy.cpp:
(WebKit::NetworkProcessProxy::preconnectTo):
* UIProcess/Network/NetworkProcessProxy.h:
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::loadRequest):
(WebKit::WebPageProxy::preconnectTo):
(WebKit::WebPageProxy::creationParameters):
(WebKit::WebPageProxy::appPrivacyReportTestingData):
(WebKit::WebPageProxy::clearAppPrivacyReportTestingData):
(WebKit::WebPageProxy::appBoundNavigationData): Deleted.
(WebKit::WebPageProxy::clearAppBoundNavigationData): Deleted.
* UIProcess/WebPageProxy.h:
* WebKit.xcodeproj/project.pbxproj:
* WebProcess/Network/WebLoaderStrategy.cpp:
(WebKit::WebLoaderStrategy::loadResource):
(WebKit::WebLoaderStrategy::preconnectTo):
* WebProcess/Storage/WebSWContextManagerConnection.cpp:
(WebKit::WebSWContextManagerConnection::updateAppInitiatedValue):
(WebKit::WebSWContextManagerConnection::startFetch):
(WebKit::WebSWContextManagerConnection::updateAppBoundValue): Deleted.
* WebProcess/Storage/WebSWContextManagerConnection.h:
* WebProcess/Storage/WebSWContextManagerConnection.messages.in:
* WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
(WebKit::WebFrameLoaderClient::dispatchWillSendRequest):
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::loadRequest):
(WebKit::WebPage::createDocumentLoader):
(WebKit::WebPage::lastNavigationWasAppInitiated):
(WebKit::WebPage::lastNavigationWasAppBound): Deleted.
* WebProcess/WebPage/WebPage.h:
(WebKit::WebPage::setLastNavigationWasAppInitiated):
(WebKit::WebPage::setLastNavigationWasAppBound): Deleted.
* WebProcess/WebPage/WebPage.messages.in:

Tools:

Delete testing functions related to attribution context. Move App
Privacy Report tests into their own file.

* TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
* TestWebKitAPI/Tests/WebKitCocoa/AppPrivacyReport.mm: Added.
(TEST):
(catch):
(function):
(-[SWAppInitiatedRequestMessageHandler userContentController:didReceiveScriptMessage:]):
* TestWebKitAPI/Tests/WebKitCocoa/AppPrivacyReportPlugIn.mm: Renamed from Tools/TestWebKitAPI/Tests/WebKitCocoa/InAppBrowserPrivacyPlugIn.mm.
(-[AppPrivacyReportPlugIn webProcessPlugInBrowserContextController:frame:willSendRequestForResource:request:redirectResponse:]):
* TestWebKitAPI/Tests/WebKitCocoa/InAppBrowserPrivacy.mm:
(-[SWAppBoundRequestMessageHandler userContentController:didReceiveScriptMessage:]): Deleted.
* TestWebKitAPI/Tests/WebKitCocoa/app-privacy-report-iframe.html: Added.
* WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl:
* WebKitTestRunner/InjectedBundle/InjectedBundle.cpp:
(WTR::InjectedBundle::didReceiveMessageToPage):
* WebKitTestRunner/InjectedBundle/TestRunner.cpp:
(WTR::TestRunner::didLoadAppInitiatedRequest):
(WTR::TestRunner::didLoadNonAppInitiatedRequest):
(WTR::TestRunner::appBoundRequestContextDataForDomain): Deleted.
(WTR::TestRunner::callDidReceiveAppBoundRequestContextDataForDomainCallback): Deleted.
(WTR::TestRunner::didLoadAppBoundRequest): Deleted.
(WTR::TestRunner::didLoadNonAppBoundRequest): Deleted.
* WebKitTestRunner/InjectedBundle/TestRunner.h:
* WebKitTestRunner/TestController.cpp:
(WTR::TestController::resetStateToConsistentValues):
(WTR::TestController::didLoadAppInitiatedRequest):
(WTR::TestController::didLoadNonAppInitiatedRequest):
(WTR::TestController::clearAppPrivacyReportTestingData):
(WTR::TestController::appBoundRequestContextDataForDomain): Deleted.
(WTR::TestController::didLoadAppBoundRequest): Deleted.
(WTR::TestController::didLoadNonAppBoundRequest): Deleted.
(WTR::TestController::clearAppBoundNavigationData): Deleted.
* WebKitTestRunner/TestController.h:
* WebKitTestRunner/TestInvocation.cpp:
(WTR::TestInvocation::didReceiveMessageFromInjectedBundle):
(WTR::TestInvocation::didReceiveSynchronousMessageFromInjectedBundle):
(WTR::TestInvocation::didReceiveAppBoundRequestContextDataForDomain): Deleted.
* WebKitTestRunner/TestInvocation.h:
* WebKitTestRunner/cocoa/TestControllerCocoa.mm:
(WTR::TestController::didLoadAppInitiatedRequest):
(WTR::TestController::didLoadNonAppInitiatedRequest):
(WTR::TestController::clearAppPrivacyReportTestingData):
(WTR::TestController::appBoundRequestContextDataForDomain): Deleted.
(WTR::TestController::didLoadAppBoundRequest): Deleted.
(WTR::TestController::didLoadNonAppBoundRequest): Deleted.
(WTR::TestController::clearAppBoundNavigationData): Deleted.
* WebKitTestRunner/cocoa/TestRunnerWKWebView.h:
* WebKitTestRunner/cocoa/TestRunnerWKWebView.mm:
(-[TestRunnerWKWebView _didLoadAppInitiatedRequest:]):
(-[TestRunnerWKWebView _didLoadNonAppInitiatedRequest:]):
(-[TestRunnerWKWebView _appBoundNavigationDataForDomain:completionHandler:]): Deleted.
(-[TestRunnerWKWebView _didLoadAppBoundRequest:]): Deleted.
(-[TestRunnerWKWebView _didLoadNonAppBoundRequest:]): Deleted.

LayoutTests:

Move App Privacy Report tests into their own directory.

* TestExpectations:
* http/tests/app-privacy-report/attribution-load-url-expected.txt: Added.
* http/tests/app-privacy-report/attribution-load-url.html: Renamed from LayoutTests/http/tests/in-app-browser-privacy/app-bound-attribution-load-url.html.
* http/tests/app-privacy-report/attribution-ping-load-expected.txt: Renamed from LayoutTests/http/tests/in-app-browser-privacy/app-bound-attribution-ping-load-expected.txt.
* http/tests/app-privacy-report/attribution-ping-load.html: Renamed from LayoutTests/http/tests/in-app-browser-privacy/app-bound-attribution-ping-load.html.
* http/tests/app-privacy-report/attribution-post-request-expected.txt: Added.
* http/tests/app-privacy-report/attribution-post-request.html: Renamed from LayoutTests/http/tests/in-app-browser-privacy/app-bound-attribution-post-request.html.
* http/tests/app-privacy-report/attribution-preflight-async-expected.txt: Renamed from LayoutTests/http/tests/in-app-browser-privacy/app-bound-attribution-preflight-async-expected.txt.
* http/tests/app-privacy-report/attribution-preflight-async.html: Renamed from LayoutTests/http/tests/in-app-browser-privacy/app-bound-attribution-preflight-async.html.
* http/tests/app-privacy-report/attribution-preflight-sync-expected.txt: Renamed from LayoutTests/http/tests/in-app-browser-privacy/app-bound-attribution-preflight-sync-expected.txt.
* http/tests/app-privacy-report/attribution-preflight-sync.html: Renamed from LayoutTests/http/tests/in-app-browser-privacy/app-bound-attribution-preflight-sync.html.
* http/tests/app-privacy-report/attribution-speculative-revalidation-expected.txt: Renamed from LayoutTests/http/tests/in-app-browser-privacy/app-bound-attribution-speculative-revalidation-expected.txt.
* http/tests/app-privacy-report/attribution-speculative-revalidation.html: Renamed from LayoutTests/http/tests/in-app-browser-privacy/app-bound-attribution-speculative-revalidation.html.
* http/tests/app-privacy-report/resources/frame-with-authenticated-resource.py: Renamed from LayoutTests/http/tests/in-app-browser-privacy/resources/frame-with-authenticated-resource.py.
* http/tests/app-privacy-report/resources/post.py: Added.
* http/tests/app-privacy-report/resources/resource-with-auth.py: Renamed from LayoutTests/http/tests/in-app-browser-privacy/resources/resource-with-auth.py.
* http/tests/in-app-browser-privacy/app-bound-attribution-load-url-expected.txt: Removed.
* http/tests/in-app-browser-privacy/app-bound-attribution-post-request-expected.txt: Removed.
* http/tests/in-app-browser-privacy/context-string-for-subframe-expected.txt: Removed.
* http/tests/in-app-browser-privacy/context-string-for-subframe.html: Removed.
* http/tests/in-app-browser-privacy/context-string-preconnect-expected.txt: Removed.
* http/tests/in-app-browser-privacy/context-string-preconnect.html: Removed.
* http/tests/in-app-browser-privacy/context-string-preflight-expected.txt: Removed.
* http/tests/in-app-browser-privacy/context-string-preflight.html: Removed.
* http/tests/in-app-browser-privacy/resources/post.py: Removed.
* http/tests/navigation/resources/check-ping-app-initiated-data.py: Renamed from LayoutTests/http/tests/navigation/resources/check-ping-app-bound-data.py.
* platform/ios-wk2/TestExpectations:


Canonical link: https://commits.webkit.org/239526@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@279750 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-07-08 20:54:04 +00:00
Wenson Hsieh da76891bee [iOS] Augment -_webView:didNotHandleTapAsMeaningfulClickAtPoint: to include meaningful taps
https://bugs.webkit.org/show_bug.cgi?id=227666
rdar://80094962

Reviewed by Tim Horton.

Source/WebKit:

The private UI delegate method `-_webView:didNotHandleTapAsMeaningfulClickAtPoint:` is currently only invoked
when a tap was not handled as a "meaningful" synthetic click (where the notion of "meaningful" is heuristically
determined). However, in order to support revised tab pill minimization behaviors, Safari requires knowledge of
taps that were handled as meaningful clicks as well.

To support this, replace what is currently `-_webView:didNotHandleTapAsMeaningfulClickAtPoint:` with another
delegate method, `-_webView:didTapAtPoint:withResult:`, that is always invoked when a tap gesture is recognized
in the web view. The `result` parameter, a new `_WKTapHandlingResult` enum, then indicates to the client how the
tap was handled; this currently includes 3 values: one to indicate that the tap gesture did not result in a
synthetic click being dispatched, and two more to indicate whether the synthetic click that was dispatched as a
result of the tap was "meaningfully" handled.

To facilitate the transition from `-_webView:didNotHandleTapAsMeaningfulClickAtPoint:` to the new SPI, we still
call the old SPI as long as the tap handling result type is not equal to TapHandlingResult::MeaningfulClick;
however, mark the old SPI as deprecated with `-_webView:didTapAtPoint:withResult:` as the replacement.

Tests:  fast/events/ios/did-not-handle-meaningful-click.html
        fast/events/ios/meaningful-click-when-focusing-body.html
        fast/events/ios/meaningful-click-when-playing-media.html
        fast/events/ios/non-meaningful-click-when-tapping-document.html

* Shared/ios/TapHandlingResult.h: Added.

Add a new C++ enum type to represent the tap handling result type (see description above).

* UIProcess/API/APIUIClient.h:
(API::UIClient::didTapAtPoint):
(API::UIClient::didNotHandleTapAsMeaningfulClickAtPoint): Deleted.
* UIProcess/API/Cocoa/WKUIDelegatePrivate.h:
* UIProcess/API/Cocoa/_WKTapHandlingResult.h: Added.
* UIProcess/API/ios/WKWebViewIOS.h:
* UIProcess/API/ios/WKWebViewIOS.mm:
(wkTapHandlingResult):

Add a helper method to convert from the WebKit::TapHandlingResult enum to the SPI-exposed _WKTapHandlingResult.

* UIProcess/API/ios/WKWebViewPrivateForTestingIOS.h:
* UIProcess/API/ios/WKWebViewTestingIOS.mm:
(-[WKWebView _didTapAtPoint:withResult:]):
(-[WKWebView _didNotHandleTapAsMeaningfulClickAtPoint:]): Deleted.
* UIProcess/Cocoa/UIDelegate.h:
* UIProcess/Cocoa/UIDelegate.mm:
(WebKit::UIDelegate::setDelegate):
(WebKit::UIDelegate::UIClient::didTapAtPoint):

Note that we still invoke the old UI delegate SPI here to ensure that these changes don't break Safari before
they have a chance to adopt the new SPI.

(WebKit::UIDelegate::UIClient::didNotHandleTapAsMeaningfulClickAtPoint): Deleted.
* UIProcess/PageClient.h:
* UIProcess/WebPageProxy.h:
* UIProcess/WebPageProxy.messages.in:

Replace the `DidNotHandleTapAsMeaningfulClickAtPoint` message with `DidTapAtPoint`, which takes both a location
and a flag indicating how the tap was handled by web content.

* UIProcess/ios/PageClientImplIOS.h:
* UIProcess/ios/PageClientImplIOS.mm:
(WebKit::PageClientImpl::didTapAtPoint):
(WebKit::PageClientImpl::didNotHandleTapAsMeaningfulClickAtPoint): Deleted.
* UIProcess/ios/WebPageProxyIOS.mm:
(WebKit::WebPageProxy::didTapAtPoint):
(WebKit::WebPageProxy::didNotHandleTapAsMeaningfulClickAtPoint): Deleted.
* WebKit.xcodeproj/project.pbxproj:
* WebProcess/WebPage/ios/WebPageIOS.mm:
(WebKit::WebPage::completeSyntheticClick):

The meaningful tap heuristic no longer determines whether we send an IPC message or not, but rather the type of
TapHandlingResult to send (namely, whether to send NonMeaningfulClick or MeaningfulClick).

(WebKit::WebPage::attemptSyntheticClick):
(WebKit::WebPage::handleTwoFingerTapAtPoint):
(WebKit::WebPage::commitPotentialTapFailed):

Tools:

Update the layout test harness to use the replacement SPI instead of the newly deprecated SPI. See
WebKit/ChangeLog for more details.

* WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl:
* WebKitTestRunner/InjectedBundle/InjectedBundle.cpp:
(WTR::InjectedBundle::didReceiveMessageToPage):
* WebKitTestRunner/InjectedBundle/TestRunner.cpp:
(WTR::TestRunner::installDidHandleTapCallback):
(WTR::TestRunner::callDidHandleTapCallback):
(WTR::TestRunner::installDidNotHandleTapAsMeaningfulClickCallback): Deleted.
(WTR::TestRunner::callDidNotHandleTapAsMeaningfulClickCallback): Deleted.

Rename this to just DidHandleTapCallback, and make it take a boolean argument indicating whether the tap was
handled as a meaningful click.

* WebKitTestRunner/InjectedBundle/TestRunner.h:
* WebKitTestRunner/TestController.cpp:
(WTR::TestController::didHandleTap):
(WTR::TestController::didNotHandleTapAsMeaningfulClick): Deleted.
* WebKitTestRunner/TestController.h:
* WebKitTestRunner/TestInvocation.cpp:
(WTR::TestInvocation::didHandleTap):
(WTR::TestInvocation::didNotHandleTapAsMeaningfulClick): Deleted.
* WebKitTestRunner/TestInvocation.h:
* WebKitTestRunner/cocoa/TestRunnerWKWebView.mm:
(-[TestRunnerWKWebView _didTapAtPoint:withResult:]):
(-[TestRunnerWKWebView _didNotHandleTapAsMeaningfulClickAtPoint:]): Deleted.

LayoutTests:

Update the existing layout tests. The new UI delegate method should now be invoked in all of the cases; however,
we should only observe meaningful clicks in some of the below scenarios. See WebKit/ChangeLog for more details.

* fast/events/ios/did-not-handle-meaningful-click-expected.txt:
* fast/events/ios/did-not-handle-meaningful-click.html:
* fast/events/ios/meaningful-click-when-focusing-body-expected.txt:
* fast/events/ios/meaningful-click-when-focusing-body.html:
* fast/events/ios/meaningful-click-when-playing-media-expected.txt:
* fast/events/ios/meaningful-click-when-playing-media.html:
* fast/events/ios/non-meaningful-click-when-tapping-document-expected.txt:
* fast/events/ios/non-meaningful-click-when-tapping-document.html:


Canonical link: https://commits.webkit.org/239393@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@279562 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-07-05 05:54:12 +00:00
Xabier Rodriguez-Calvar 70207145a0 [GTK] media/event-attributes.html fails if mixer is not at 100%
https://bugs.webkit.org/show_bug.cgi?id=83704

Reviewed by Philippe Normand.

Tools:

* WebKitTestRunner/TestController.cpp:
(WTR::TestController::resetStateToConsistentValues): GStreamer
ports use fakesink to avoid sound output and setting the page
volume to 0 creates trouble with volume events. Let's avoid it in
GStreamer ports.

LayoutTests:

* platform/glib/TestExpectations: Unflagged that test and other
that get fixed with this patch.


Canonical link: https://commits.webkit.org/239351@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@279499 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-07-02 07:01:19 +00:00
Adrien Destugues 02a20bc61c Merge commit '8e12736b4bafcb267c3bc157239f3110d7e6d85e' into HEAD 2021-06-30 08:20:23 +02:00
Wenson Hsieh 472457b5d6 REGRESSION (r279310): Occasional crash when focusing login fields on iPad with a software keyboard
https://bugs.webkit.org/show_bug.cgi?id=227472
rdar://79876040

Reviewed by Tim Horton.

Source/WebKit:

I added a mechanism in r279310 to defer calling `-[WKContentView _setSuppressSoftwareKeyboard:NO]` until we've
gotten a response from the web process containing an up-to-date autocorrection context. However, in the case
where the WKWebView client sets `_suppressSoftwareKeyboard` to `YES` and then immediately to `NO` underneath the
scope of a call to `-_webView:willStartInputSession:`, we'll end up calling into `-_setSuppressSoftwareKeyboard:`
inside the scope of `-requestAutocorrectionContextWithCompletionHandler:`, when we've received an
autocorrection context while sync-waiting. This is problematic because it breaks UIKeyboardTaskQueue's state,
since the call to `-_setSuppressSoftwareKeyboard:` will attempt to enqueue a new task after the previous task's
context has already returned execution to the parent.

To fix this, we instead invoke `self._suppressSoftwareKeyboard = NO;` *before* calling the completion block in
`-_handleAutocorrectionContext:`. This allows the request for an autocorrection context underneath
`-_setSuppressSoftwareKeyboard:` to be handled (and completed) as a child task of the previous task, which keeps
UIKeyboardTaskQueue in a valid state.

Test: fast/forms/ios/suppress-software-keyboard-while-focusing-input.html

* UIProcess/ios/WKContentViewInteraction.mm:
(-[WKContentView _handleAutocorrectionContext:]):

Tools:

Make it possible to induce the crash (prior to the fix) by introducing two new testing primitives on iOS:

-   `UIScriptController.suppressSoftwareKeyboard`, a readwrite attribute that can be used to suppress the
    appearance of the software keyboard on iOS by calling `-[WKWebView _setSuppressSoftwareKeyboard:]`.

-   `UIScriptController.willStartInputSessionCallback`, a callback that is invoked when we're about to start a
    UI-process-side input session. On iOS, this corresponds to
    `-[_WKInputDelegate _webView:willStartInputSession:`].

* TestRunnerShared/UIScriptContext/Bindings/UIScriptController.idl:
* TestRunnerShared/UIScriptContext/UIScriptContext.h:
* TestRunnerShared/UIScriptContext/UIScriptController.h:
(WTR::UIScriptController::suppressSoftwareKeyboard const):
(WTR::UIScriptController::setSuppressSoftwareKeyboard):
* TestRunnerShared/UIScriptContext/UIScriptControllerShared.cpp:
(WTR::UIScriptController::setWillStartInputSessionCallback):
(WTR::UIScriptController::willStartInputSessionCallback const):
* WebKitTestRunner/cocoa/TestRunnerWKWebView.h:
* WebKitTestRunner/cocoa/TestRunnerWKWebView.mm:
(-[TestRunnerWKWebView initWithFrame:configuration:]):
(-[TestRunnerWKWebView resetInteractionCallbacks]):
(-[TestRunnerWKWebView _webView:willStartInputSession:]):
* WebKitTestRunner/ios/TestControllerIOS.mm:
(WTR::TestController::platformResetStateToConsistentValues):

Make sure that we revert `_suppressSoftwareKeyboard` to `NO`, in case a layout test ends while leaving this on,
to prevent subsequent layout tests from behaving in unexpected ways.

* WebKitTestRunner/ios/UIScriptControllerIOS.h:
* WebKitTestRunner/ios/UIScriptControllerIOS.mm:
(WTR::UIScriptControllerIOS::setWillStartInputSessionCallback):
(WTR::UIScriptControllerIOS::suppressSoftwareKeyboard const):
(WTR::UIScriptControllerIOS::setSuppressSoftwareKeyboard):

LayoutTests:

Add a new layout test to exercise the crash. See Tools and Source/WebKit ChangeLogs for more information.
This new test suppresses and then immediately un-suppresses the software keyboard inside the
`-_webView:willStartInputSession:` input delegate hook while focusing a regular text field.

* fast/forms/ios/suppress-software-keyboard-while-focusing-input-expected.txt: Added.
* fast/forms/ios/suppress-software-keyboard-while-focusing-input.html: Added.


Canonical link: https://commits.webkit.org/239227@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@279361 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-06-29 03:11:28 +00:00
eocanha@igalia.com 1e51fcaac6 [GTK] media/muted-video-is-playing-audio.html is timing out
https://bugs.webkit.org/show_bug.cgi?id=208321

Reviewed by Xabier Rodriguez-Calvar.

Source/WebCore:

Added setPageMediaVolume() API to set the Page mediaVolume. This was 0
by default and a way to set it to a non-zero value was needed in order
to prevent a zero effectiveVolume in HTMLMediaElement.

* testing/Internals.cpp:
(WebCore::Internals::setPageMediaVolume): Set the Page mediaVolume.
* testing/Internals.h: Added setPageMediaVolume().
* testing/Internals.idl: Ditto.

Tools:

Set the WebKitTestRunnerWPE application name on user-agent to ease the
detection of the WPE port from the layout tests using the isWPE()
function in platform-helper.js.

* WebKitTestRunner/wpe/TestControllerWPE.cpp:
(WTR::TestController::platformConfigureViewForTest): Set WebKitTestRunnerWPE application name on user-agent.

LayoutTests:

Changed the test to set a non-zero mediaVolume, because a zero one
(default value set by TestController::resetStateToConsistentValues())
would multiply any other volume in HTMLMediaElement::effectiveVolume(),
cause a zero effectiveVolume (being considered in practice as "no audio" by
HTMLMediaElement::mediaState()) and prevent the IsPlayingAudio MediaState
being set.

Also, adapted the test to still expect IsPlayingAudio after mute on the
glib ports (GTK & WPE), since on those ports a muted video is expected to
report IsPlayingAudio, as per the HTMLMediaElement::mediaState() source
code comments.

* media/muted-video-is-playing-audio.html: Test changed as described above.
* platform/glib/media/muted-video-is-playing-audio-expected.txt: Added expectation for glib port.
* resources/platform-helper.js:
(isGtk): Clarified where the GTK user-agent string comes from.
(isWPE): New function to check if a WPE port is being used.


Canonical link: https://commits.webkit.org/239103@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@279217 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-06-24 09:31:16 +00:00
Andres Gonzalez 7c0f13f37e Accessibility support for image text recognition.
https://bugs.webkit.org/show_bug.cgi?id=224280
rdar://76348740

Reviewed by Chris Fleizach.

Source/WebCore:

Test: accessibility/ios-simulator/image-overlay-elements.html

Exposes to accessibility clients the elements created by
WebPage::requestTextRecognition for static images. This allows clients
to present the recognized text in images to assistive technology users.
- Added a new AXObject subclass, AXImage, to encapsulate this functionality.
This class can be expanded to offload some of the image specific code
contained in AccessibilityRenderObject, AccessibilityNodeObject,
AccessibilityObject and others.
- Since requestTextRecognition is an async call, added an AXNotification
to notify clients when the image overlay elements are available for
consumption.

* Sources.txt:
* WebCore.xcodeproj/project.pbxproj:
* accessibility/AXImage.cpp: Added.
(WebCore::AXImage::AXImage):
(WebCore::AXImage::create):
(WebCore::AXImage::roleValue const):
(WebCore::AXImage::imageOverlayElements):
* accessibility/AXImage.h: Added.
* accessibility/AXLogger.cpp:
(WebCore::operator<<):
* accessibility/AXObjectCache.cpp:
(WebCore::isSimpleImage): Determines whether a given element is a static
image.
(WebCore::createFromRenderer): Instantiate an AXImage object when
appropriate.
* accessibility/AXObjectCache.h:
* accessibility/AccessibilityNodeObject.cpp:
(WebCore::AccessibilityNodeObject::canHaveChildren const): Images can
have children.
* accessibility/AccessibilityObject.h:
* accessibility/AccessibilityObjectInterface.h:
* accessibility/ios/AXObjectCacheIOS.mm:
(WebCore::AXObjectCache::notificationPlatformName):
* accessibility/ios/WebAccessibilityObjectWrapperIOS.mm:
(-[WebAccessibilityObjectWrapper accessibilityElements]):
(-[WebAccessibilityObjectWrapper accessibilityImageOverlayElements]):
* accessibility/isolatedtree/AXIsolatedObject.cpp:
(WebCore::AXIsolatedObject::isAXImageInstance const):
* accessibility/isolatedtree/AXIsolatedObject.h:
* accessibility/mac/AXObjectCacheMac.mm:
(WebCore::AXObjectCache::postPlatformNotification):
* accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
(-[WebAccessibilityObjectWrapper ALLOW_DEPRECATED_IMPLEMENTATIONS_END]):
(-[WebAccessibilityObjectWrapper accessibilityAttributeValue:]):

Tools:

* WebKitTestRunner/InjectedBundle/AccessibilityUIElement.cpp:
(WTR::AccessibilityUIElement::children const):
* WebKitTestRunner/InjectedBundle/AccessibilityUIElement.h:
* WebKitTestRunner/InjectedBundle/Bindings/AccessibilityUIElement.idl:
* WebKitTestRunner/InjectedBundle/ios/AccessibilityUIElementIOS.mm:
(WTR::AccessibilityUIElement::children const):
(WTR::AccessibilityUIElement::imageOverlayElements const):
* WebKitTestRunner/InjectedBundle/mac/AccessibilityUIElementMac.mm:
(WTR::AccessibilityUIElement::children const):
(WTR::AccessibilityUIElement::imageOverlayElements const):

LayoutTests:

* accessibility/image-link-expected.txt:
* accessibility/ios-simulator/image-overlay-elements-expected.txt: Added.
* accessibility/ios-simulator/image-overlay-elements.html: Added.
* accessibility/resources/green-400x400.png: Added.


Canonical link: https://commits.webkit.org/239068@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@279171 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-06-23 16:59:34 +00:00
Adrien Destugues c6e4bb5d32 Merge commit '20307a3cb5047e4a3a5d1133a37d2db95a84164c' into HEAD 2021-06-12 20:52:37 +02:00
Darin Adler 786e7036ff Remove <wtf/Optional.h>
https://bugs.webkit.org/show_bug.cgi?id=226437

Reviewed by Chris Dumez.

Source/JavaScriptCore:

* <many files>: Remove include of <wtf/Optional.h>.

* inspector/scripts/codegen/generate_cpp_backend_dispatcher_header.py:
(CppBackendDispatcherHeaderGenerator._generate_secondary_header_includes): Don't generate
an include of wtf/Optional.h; including WTFString.h takes care of this anyway.
* inspector/scripts/codegen/generate_cpp_frontend_dispatcher_header.py:
(CppFrontendDispatcherHeaderGenerator._generate_secondary_header_includes): Ditto.
* inspector/scripts/codegen/generate_cpp_protocol_types_header.py:
(CppProtocolTypesHeaderGenerator._generate_secondary_header_includes): Ditto.

* inspector/scripts/codegen/generate_cpp_protocol_types_implementation.py:
(CppProtocolTypesImplementationGenerator.generate_output): Generate an include of <optional>
instead of <wtf/Optional.h>.

* inspector/scripts/tests/expected/*: Regenerate.

Source/WebCore:

* <many files>: Removed include of <wtf/Optional.h>.

* platform/graphics/Font.h: Tweaked style a bit.

* Modules/geolocation/GeolocationClient.h: Added include of <optional>.
* Modules/mediastream/DoubleRange.h: Ditto.
* Modules/mediastream/LongRange.h: Ditto.
* Modules/webauthn/AuthenticationExtensionsClientOutputs.h: Ditto.
* css/CSSToLengthConversionData.h: Ditto.
* css/DOMMatrix2DInit.h: Ditto.
* dom/AddEventListenerOptions.h: Ditto.
* dom/DeviceMotionData.h: Ditto.
* dom/DeviceOrientationData.h: Ditto.
* dom/SuccessOr.h: Ditto.
* html/DateTimeFieldsState.h: Ditto.
* html/ImageBitmapOptions.h: Ditto.
* html/canvas/PredefinedColorSpace.h: Ditto.
* layout/LayoutPhase.h: Ditto.
* layout/MarginTypes.h: Ditto.
* loader/ResourceLoadNotifier.h: Ditto.
* page/RuntimeEnabledFeatures.h: Ditto.
* page/ScrollOptions.h: Ditto.
* platform/MediaCapabilitiesInfo.h: Ditto.
* platform/cocoa/SystemBattery.h: Ditto.
* platform/graphics/DecodingOptions.h: Ditto.
* platform/graphics/DestinationColorSpace.h: Ditto.
* platform/graphics/DisplayRefreshMonitorClient.h: Ditto.
* platform/graphics/FloatLine.h: Ditto.
* platform/graphics/gpu/GPURequestAdapterOptions.h: Ditto.
* platform/graphics/x11/PlatformDisplayX11.h: Ditto.
* platform/ios/SelectionGeometry.h: Ditto.
* platform/mac/NSScrollerImpDetails.h: Ditto.
* platform/network/DNS.h: Ditto.
* platform/text/EncodingTables.h: Ditto.
* platform/text/TextCodecCJK.h: Ditto.
* platform/text/TextCodecUTF16.h: Ditto.
* platform/text/TextFlags.h: Ditto.

Source/WebCore/PAL:

* pal/SessionID.h: Include <optional>.
* pal/crypto/gcrypt/Utilities.h: Ditto.
* pal/crypto/tasn1/Utilities.cpp: Removed include of <wtf/Optional.h>.

Source/WebDriver:

* SessionHost.h: Removed include of <wtf/Optional.h>.

Source/WebKit:

* <many files>: Removed include of <wtf/Optional.h>.

Source/WebKitLegacy/mac:

* DOM/DOMRangeInternal.h: Added import of <optional>.
* WebView/WebGeolocationPosition.mm: Removed import of <wtf/Optional.h>.
* WebView/WebGeolocationPositionInternal.h: Added import of <optional>.

Source/WTF:

* <many files>: Removed include of <wtf/Optional.h>.

* WTF.xcodeproj/project.pbxproj: Removed Optional.h.

* wtf/Markable.h: Added include of <optional>.
* wtf/OptionSet.h: Ditto.

* wtf/Optional.h: Emptied this file. On the Windows build system, we can't
seem to build successfully without an empty file here. The copied forwarding
header seems to linger even if we remove the original. Until we fix the
Windows build system, if we want to support incremental builds, we need
to keep this empty file around.

* wtf/PrintStream.h: Added include of <optional>.
* wtf/Seconds.h: Ditto.
* wtf/StackTrace.h: Ditto.

* wtf/StdLibExtras.h: Moved the valueOrCompute function here from Optional.h.
Re-sorted the "using" at the bottom of the file.

* wtf/URLHelpers.h: Added include of <optional>.
* wtf/Vector.h: Ditto.

Tools:

* <many files>: Removed include of <wtf/Optional.h>.


Canonical link: https://commits.webkit.org/238372@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@278340 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-06-02 06:45:51 +00:00
Darin Adler e98ff129bc Remove WTF::Optional synonym for std::optional, using that class template directly instead
https://bugs.webkit.org/show_bug.cgi?id=226433

Reviewed by Chris Dumez.

Source/JavaScriptCore:

* <many files>: Let the do-webcore-rename script rename Optional<> to std::optional<>.

* inspector/scripts/codegen/generate_objc_protocol_types_implementation.py:
(ObjCProtocolTypesImplementationGenerator._generate_init_method_for_payload): Use auto instead
of Optional<>. Also use * instead of value() and nest the definition of the local inside an if
statement in the case where it's an optional.

* inspector/scripts/tests/expected/*: Regenerated these results.

Source/WebCore:

* <many files>: Let the do-webcore-rename script rename Optional<> to std::optional<>.

Source/WebCore/PAL:

* <many files>: Let the do-webcore-rename script rename Optional<> to std::optional<>.

Source/WebDriver:

* <many files>: Let the do-webcore-rename script rename Optional<> to std::optional<>.

Source/WebKit:

* <many files>: Let the do-webcore-rename script rename Optional<> to std::optional<>.

* Scripts/webkit/tests: Regenerated expected results, by running the command "python
Scripts/webkit/messages_unittest.py -r". (How am I supposed to know to do that?)

Source/WebKitLegacy/ios:

* WebCoreSupport/WebChromeClientIOS.h: Let the do-webcore-rename script rename
Optional<> to std::optional<>.

Source/WebKitLegacy/mac:

* <many files>: Let the do-webcore-rename script rename Optional<> to std::optional<>.

Source/WebKitLegacy/win:

* <many files>: Let the do-webcore-rename script rename Optional<> to std::optional<>.

Source/WTF:

* <many files>: Let the do-webcore-rename script rename Optional<> to std::optional<>.

* wtf/Optional.h: Remove WTF::Optional.

Tools:

* <many files>: Let the do-webcore-rename script rename Optional<> to std::optional<>.


Canonical link: https://commits.webkit.org/238290@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@278253 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-05-30 16:11:40 +00:00
Darin Adler ddf6645723 Clients of optional should use has_value instead of relying on hasValue macro
https://bugs.webkit.org/show_bug.cgi?id=226395

Reviewed by Chris Dumez.

Source/JavaScriptCore:

* bytecompiler/NodesCodegen.cpp:
(JSC::RegExpNode::emitBytecode): Don't use hasValue.

Source/WebCore:

In some files we are touching, moved from Optional to std::optional, but doing
that consistently in files we are not otherwise modifying is out of scope here.

In some places, use has_value instead of hasValue. In others, improved further
by not using has_value explicitly when it's clearer to do so. Wasn't 100%
consistent about that, but did aim to cover 100% of the hasValue call sites.

* Modules/webaudio/AudioContext.cpp:
(WebCore::AudioContext::create): Don't use hasValue.
* Modules/webxr/WebXRFrame.cpp:
(WebCore::WebXRFrame::getViewerPose): Ditto.
(WebCore::WebXRFrame::getPose): Ditto.
* Modules/webxr/WebXRGamepad.cpp:
(WebCore::WebXRGamepad::WebXRGamepad): Ditto.

* Modules/webxr/WebXRInputSource.cpp:
(WebCore::WebXRInputSource::requiresInputSourceChange): Use has_value.
* bindings/js/DOMPromiseProxy.h:
(WebCore::DOMPromiseProxy<IDLType>::isFulfilled const): Ditto.
(WebCore::DOMPromiseProxy<IDLUndefined>::isFulfilled const): Ditto.
(WebCore::DOMPromiseProxyWithResolveCallback<IDLType>::isFulfilled const): Ditto.
* bindings/js/SerializedScriptValue.cpp:
(WebCore::CloneDeserializer::readTerminal): Ditto.

* css/CSSFontFaceSet.cpp:
(WebCore::CSSFontFaceSet::addToFacesLookupTable): Removed unneeded double check
of optional value. !x and !x.has_value() check the same thing.
(WebCore::CSSFontFaceSet::remove): Ditto.
(WebCore::CSSFontFaceSet::fontFace): Simplified code with extra local variables
to use an idiom that does not use hasValue. Since using *, ->, or value() on an
optional already asserts, there is no need to explicitly assert in the caller.

* css/CSSGradientValue.cpp:
(WebCore::GradientStop::isSpecified const): Use has_value.

* css/CSSSegmentedFontFace.cpp:
(WebCore::CSSSegmentedFontFace::fontRanges): Removed unneeded calls to hasValue.

* css/FontFace.cpp:
(WebCore::FontFace::family const): Use has_value.
(WebCore::FontFace::style const): Ditto.
(WebCore::FontFace::weight const): Ditto.
(WebCore::FontFace::stretch const): Ditto.
(WebCore::FontFace::unicodeRange const): Ditto.
(WebCore::FontFace::featureSettings const): Ditto.
(WebCore::FontFace::display const): Ditto.
* css/parser/CSSSelectorParser.cpp:
(WebCore::consumeANPlusB): Ditto.
* display/css/DisplayStyle.h: Ditto.
* dom/DataTransferItemList.h: Ditto.
* dom/Document.cpp:
(WebCore::Document::updateHighlightPositions): Ditto.
* dom/EventTarget.cpp:
(WebCore::EventTarget::addEventListener): Ditto.
* editing/AlternativeTextController.cpp:
(WebCore::AlternativeTextController::hasPendingCorrection const): Ditto.

* editing/ApplyStyleCommand.cpp:
(WebCore::ApplyStyleCommand::applyInlineStyle): Don't call hasValue.
* html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::captionDisplayMode): Ditto.
* html/ImageBitmap.h: Ditto.

* inspector/agents/InspectorPageAgent.cpp:
(WebCore::InspectorPageAgent::setScreenSizeOverride): Use has_value.
* layout/LayoutPhase.cpp:
(WebCore::Layout::PhaseScope::PhaseScope): Ditto.
* layout/formattingContexts/inline/InlineContentBreaker.cpp:
(WebCore::Layout::InlineContentBreaker::tryBreakingTextRun const): Ditto.
* layout/formattingContexts/inline/InlineLine.h: Ditto.
* loader/CrossOriginPreflightResultCache.cpp:
(WebCore::parseAccessControlMaxAge): Ditto.
* page/EventHandler.cpp:
(WebCore::EventHandler::defaultWheelEventHandler): Ditto.
* page/ios/ContentChangeObserver.cpp:
(WebCore::ContentChangeObserver::StyleChangeScope::~StyleChangeScope): Ditto.
* page/scrolling/ScrollSnapOffsetsInfo.cpp:
(WebCore::closestSnapOffsetWithInfoAndAxis): Ditto.

* platform/ScrollController.cpp:
(WebCore::ScrollController::adjustScrollDestination): Don't use hasValue.

* platform/cocoa/SystemBattery.mm:
(WebCore::systemHasBattery): Use has_value.
(WebCore::systemHasAC): Use has_value.
* platform/graphics/Gradient.h: Ditto.
* platform/graphics/ImageSource.h: Ditto.

* platform/graphics/MediaPlayer.cpp:
(WebCore::MediaPlayer::wouldTaintOrigin const): Changed idiom to not use hasValue.

* platform/graphics/gstreamer/GLVideoSinkGStreamer.cpp:
(setGLContext): Do not use hasValue.
* platform/graphics/gstreamer/GStreamerRegistryScanner.cpp:
(WebCore::GStreamerRegistryScanner::ElementFactories::hasElementForMediaType const): Ditto.
* platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
(WebCore::MediaPlayerPrivateGStreamer::playbackPosition const): Ditto.
(WebCore::MediaPlayerPrivateGStreamer::performTaskAtMediaTime): Ditto.
(WebCore::MediaPlayerPrivateGStreamer::triggerRepaint): Ditto.

* platform/graphics/gstreamer/eme/CDMProxyThunder.cpp:
(WebCore::CDMProxyThunder::getDecryptionSession const): Use has_value.
* platform/graphics/gstreamer/eme/CDMThunder.cpp:
(WebCore::ParsedResponseMessage::hasType const): Use has_value.
(WebCore::CDMInstanceSessionThunder::cdmInstanceThunder const): Use
a pointer for the erturn value instead of Optional<&>. This hasn't
compiled since we switched to std::optional so I suspect this code is
not compiled by EWS or the buildbot.
* platform/graphics/gstreamer/eme/CDMThunder.h: Updated to match above.

* platform/graphics/gstreamer/mse/AppendPipeline.cpp:
(WebCore::AppendPipeline::parseDemuxerSrcPadCaps): Use value_or.
(WebCore::AppendPipeline::appsinkCapsChanged): Do not use has_value.
* platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.cpp:
(WebCore::MediaPlayerPrivateGStreamerMSE::trackDetected): Ditto.

* platform/graphics/transforms/TransformState.h: Use has_value.
* platform/ios/VideoFullscreenInterfaceAVKit.mm:
(WebCore::supportsPictureInPicture): Ditto.
* platform/mac/NSScrollerImpDetails.mm:
(WebCore::ScrollerStyle::recommendedScrollerStyle): Ditto.
* platform/network/ResourceRequestBase.cpp:
(WebCore::ResourceRequestBase::isSystemPreview const): Ditto.
* platform/xr/openxr/OpenXRInputSource.cpp:
(PlatformXR::OpenXRInputSource::getInputSource const): Ditto.
* rendering/EventRegion.h: Ditto.

* rendering/GridTrackSizingAlgorithm.h: Remove unnecessary assertion, since
the * operator already does the assertion.

* rendering/RenderFlexibleBox.cpp:
(WebCore::RenderFlexibleBox::canComputePercentageFlexBasis): Use has_value.
* rendering/RenderListItem.cpp:
(WebCore::RenderListItem::setExplicitValue): Ditto.
* rendering/RenderThemeIOS.mm:
(WebCore::RenderThemeIOS::systemFocusRingColor): Ditto.
* rendering/updating/RenderTreeBuilder.cpp:
(WebCore::RenderTreeBuilder::removeAnonymousWrappersForInlineChildrenIfNeeded): Ditto.

* svg/SVGSVGElement.cpp:
(WebCore::SVGSVGElement::createSVGTransformFromMatrix): Changed idiom to not
call hasValue.
* svg/SVGTransform.h: Ditto.
* testing/WebFakeXRDevice.cpp:
(WebCore::WebFakeXRDevice::setViews): Ditto.

Source/WebDriver:

* socket/SessionHostSocket.cpp:
(WebDriver::SessionHost::isConnected const): Use has_value.

Source/WebKit:

* Platform/IPC/ArgumentCoders.h: Use std::optional; there was no hasValue
in here and I edited it by mistake, but we want to do this eventually.

* Shared/Cocoa/WebCoreArgumentCodersCocoa.mm: Removed using namespace WebCore.
(IPC::ArgumentCoder<Ref<WebCore::Font>>::decodePlatformData): Use has_value.
* Shared/EntryPointUtilities/Cocoa/XPCService/XPCServiceEntryPoint.mm:
(WebKit::XPCServiceInitializerDelegate::getClientSDKVersion): Ditto.

* Shared/WebCoreArgumentCoders.cpp:
(IPC::decodeImage): Changed idiom to not call hasValue.
(IPC::ArgumentCoder<Ref<Font>>::decode): Ditto.

* Shared/mac/MediaFormatReader/MediaFormatReader.cpp:
(WebKit::MediaFormatReader::finishParsing): Use has_value.
(WebKit::MediaFormatReader::copyProperty): Ditto.
(WebKit::MediaFormatReader::copyTrackArray): Ditto.

* Shared/win/WebCoreArgumentCodersWin.cpp:
(IPC::ArgumentCoder<Ref<Font>>::decodePlatformData): Do not call hasValue.

* UIProcess/API/Cocoa/WKWebViewConfiguration.mm:
(-[WKWebViewConfiguration encodeWithCoder:]): Changed idiom to not use hasValue.

* UIProcess/API/glib/InputMethodFilter.cpp:
(WebKit::InputMethodFilter::setState): Use has_value.

* UIProcess/Automation/WebAutomationSession.cpp:
(WebKit::AutomationCommandError::toProtocolString): Changed idiom to not use hasValue.

* UIProcess/Cocoa/WebPasteboardProxyCocoa.mm:
(WebKit::WebPasteboardProxy::determineDataOwner const): Use has_value.

* UIProcess/Inspector/socket/RemoteInspectorClient.cpp:
(WebKit::RemoteInspectorClient::sendWebInspectorEvent): Changed idiom to not use hasValue.
* UIProcess/glib/UserMediaPermissionRequestManagerProxyGLib.cpp:
(WebKit::UserMediaPermissionRequestManagerProxy::platformValidateUserMediaRequestConstraints): Ditto.

* WebProcess/GPU/media/MediaSourcePrivateRemote.cpp:
(WebKit::MediaSourcePrivateRemote::addSourceBuffer): Use has_value.
* WebProcess/WebPage/Cocoa/WebPageCocoa.mm:
(WebKit::WebPage::platformDidReceiveLoadParameters): Ditto.

* WebProcess/cocoa/WebProcessCocoa.mm:
(WebKit::WebProcess::notifyPreferencesChanged): Changed idiom to not
call hasValue.

Source/WTF:

* wtf/Hasher.h: Use has_value.

* wtf/Optional.h: Remove hasValue macro. Not needed any more, but also a bit
dangerous because of how widespread the use of hasValue is for things other
than WTF::Optional.

Tools:

* TestWebKitAPI/Tests/WebCore/CBORReaderTest.cpp: Use has_value.
* TestWebKitAPI/Tests/WebCore/CBORWriterTest.cpp: Ditto.
* TestWebKitAPI/Tests/WebKitGLib/TestWebKitPolicyClient.cpp: Ditto.
* TestWebKitAPI/Tests/WebKitGLib/TestWebKitWebView.cpp:
(AudioRenderingWebViewTest::handleStart): Ditto.
* WebKitTestRunner/GeolocationProviderMock.cpp:
(WTR::GeolocationProviderMock::setPosition): Ditto.
* WebKitTestRunner/cocoa/TestRunnerWKWebView.mm:
(-[TestRunnerWKWebView canPerformAction:withSender:]): Ditto.

Canonical link: https://commits.webkit.org/238281@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@278244 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-05-29 22:08:56 +00:00
Darin Adler 695e0888fe Next step toward using std::optional directly instead of through WTF::Optional typedef
https://bugs.webkit.org/show_bug.cgi?id=226280

Reviewed by Chris Dumez.

Source/JavaScriptCore:

* <many files>: Accept the renaming done by do-webcore-rename.

* yarr/YarrSyntaxChecker.cpp: Since the style checker complained about this file,
tweaked style to make it happy after the renaming done by do-webcore-rename, and
also hand-updated Optional to std::optional as long as we were touching it.

Source/WebCore:

* <many files>: Accept the renaming done by do-webcore-rename.

* Modules/webauthn/fido/DeviceRequestConverter.h: Since style checker complained
about the names of some arguments, fixed them, and also hand-updated Optional to
std::optional as long as we were touching it.

* loader/EmptyClients.cpp: Since style checker complained about the mix of
WEBCORE_EXPORT and inlined functions, moved them out of line, and
also hand-updated Optional to std::optional as long as we were touching it.
Also removed is<EmptyFrameLoaderClient>().
* loader/EmptyFrameLoaderClient.h: Ditto.

Source/WebCore/PAL:

* <many files>: Accept the renaming done by do-webcore-rename.

Source/WebDriver:

* <many files>: Accept the renaming done by do-webcore-rename.

Source/WebKit:

* <many files>: Accept the renaming done by do-webcore-rename.

Source/WebKitLegacy:

* Storage/StorageTracker.cpp:
(WebKit::StorageTracker::diskUsageForOrigin): Accept the renaming done by do-webcore-rename.

Source/WebKitLegacy/mac:

* <many files>: Accept the renaming done by do-webcore-rename.

Source/WebKitLegacy/win:

* <many files>: Accept the renaming done by do-webcore-rename.

Source/WTF:

* <many files>: Accept the renaming done by do-webcore-rename.

* wtf/Optional.h: Remove WTF::nullopt_t and WTF::makeOptional.

* wtf/URLHelpers.cpp:
(WTF::URLHelpers::mapHostName): Convert from nullopt to std::nullopt.

Tools:

* Scripts/do-webcore-rename: Use script to rename valueOr, WTF::nullopt, WTF::nullopt_t,
WTF::Optional, WTF::makeOptional, and makeOptional. Other renamings can't necessarily
be done by the script and so will be done in later passes.

* <many files>: Accept the renaming done by do-webcore-rename.

Canonical link: https://commits.webkit.org/238228@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@278185 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-05-28 01:26:23 +00:00
Chris Fleizach fa4d19f8bf AX: Improve string conversion in AccessibilityController::injectAccessibilityPreference
https://bugs.webkit.org/show_bug.cgi?id=226239

Reviewed by Darin Adler.

* WebKitTestRunner/InjectedBundle/mac/AccessibilityControllerMac.mm:
(WTR::AccessibilityController::injectAccessibilityPreference):
* WebKitTestRunner/WebKitTestRunner.xcodeproj/project.pbxproj:
* WebKitTestRunner/cocoa/StringFunctionsCocoa.h: Added.
(WTR::toWK):


Canonical link: https://commits.webkit.org/238146@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@278065 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-05-26 00:15:23 +00:00
Adrien Destugues 8fe7de1f76 Merge commit '17e4ef947b901efe5b83003cb46fb9b6b67227c3' into Haiku branch 2021-05-25 20:01:40 +02:00
Chris Fleizach c795aadda9 AX: Fix build failure for WK API WTF::String usage
https://bugs.webkit.org/show_bug.cgi?id=226204
Source/WebKit:

Reviewed by Tim Horton.

Build fix for WTF string usage.

* WebProcess/InjectedBundle/API/c/WKBundlePage.cpp:
(WKAccessibilityTestingInjectPreference):
* WebProcess/InjectedBundle/API/c/WKBundlePagePrivate.h:

Tools:

<rdar://problem/78428840>

Reviewed by Tim Horton.

* WebKitTestRunner/InjectedBundle/mac/AccessibilityControllerMac.mm:
(WTR::AccessibilityController::injectAccessibilityPreference):


Canonical link: https://commits.webkit.org/238100@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@277987 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-05-25 02:33:14 +00:00
Chris Fleizach e2e5b5b097 AX: Settings: Increase contrast isn't detected in browser until an additional setting is applied
https://bugs.webkit.org/show_bug.cgi?id=225909

Reviewed by Per Arne Vollan.

Source/WebCore/PAL:

* pal/spi/mac/HIServicesSPI.h:

Source/WebKit:

Tests: accessibility/mac/media-query-values-change.html

1) WebContent blocks access to distributed notification center, so we can't rely on that to re-post notifications
2) AppKit caches the values of these AX settings, so we need to invalidate that cache directly

* Platform/spi/mac/AppKitSPI.h:
* WebProcess/InjectedBundle/API/c/WKBundlePage.cpp:
(WKAccessibilityTestingInjectPreference):
* WebProcess/InjectedBundle/API/c/WKBundlePagePrivate.h:
* WebProcess/cocoa/WebProcessCocoa.mm:
(WebKit::invertColorsPreferenceKey):
(WebKit::dispatchSimulatedNotificationsForPreferenceChange):
(WebKit::setPreferenceValue):
(WebKit::reduceMotionPreferenceKey): Deleted.

Tools:

* WebKitTestRunner/InjectedBundle/AccessibilityController.cpp:
(WTR::AccessibilityController::injectAccessibilityPreference):
* WebKitTestRunner/InjectedBundle/AccessibilityController.h:
* WebKitTestRunner/InjectedBundle/Bindings/AccessibilityController.idl:
* WebKitTestRunner/InjectedBundle/mac/AccessibilityControllerMac.mm:
(WTR::AccessibilityController::injectAccessibilityPreference):

LayoutTests:

* accessibility/mac/media-query-values-change-expected.txt: Added.
* accessibility/mac/media-query-values-change.html: Added.


Canonical link: https://commits.webkit.org/238093@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@277971 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-05-24 22:27:01 +00:00
Darin Adler 4d78e56eb5 Remove StringBuilder::appendLiteral
https://bugs.webkit.org/show_bug.cgi?id=226137

Reviewed by Chris Dumez.

Source/JavaScriptCore:

* API/tests/PingPongStackOverflowTest.cpp:
(PingPongStackOverflowObject_hasInstance): Use append instead of appendLiteral.

* bindings/ScriptFunctionCall.cpp:
(Deprecated::ScriptCallArgumentHandler::appendArgument): Remove unnecessary cast
from const char* to String, which defeats optimization and has no benefit.

* bytecompiler/NodesCodegen.cpp:
(JSC::ArrayPatternNode::toString const): Use append instead of appendLiteral.
(JSC::RestParameterNode::toString const): Ditto.

* heap/HeapSnapshotBuilder.cpp:
(JSC::HeapSnapshotBuilder::json): Use append instead of appendLiteral.
Removed unnecesary use of appendQuotedJSONString to append the result of
snapshotTypeToString and edgeTypeToString, which return a const char* that
never contains characters that require special quoting consideration, so
can be appended efficiently with the normal append function.

* inspector/agents/InspectorAuditAgent.cpp:
(Inspector::InspectorAuditAgent::run): Use makeString instead of StringBuilder.

* inspector/agents/InspectorConsoleAgent.cpp: Use auto for the result of makeString.

* jsc.cpp: Use appned instead of appendLiteral.

* parser/ParserArena.cpp:
(JSC::IdentifierArena::makePrivateIdentifier): Use auto for the result of makeString.

* runtime/ConsoleClient.cpp:
(JSC::ConsoleClient::printConsoleMessage): Use append instead of appendLiteral.
Also use variadic append when practical for better efficiency.
(JSC::ConsoleClient::printConsoleMessageWithArguments): Ditto.
* runtime/DateConversion.cpp:
(JSC::formatDateTime): Ditto.

* runtime/ErrorInstance.cpp:
(JSC::ErrorInstance::sanitizedToString): Use makeString instead of StringBuilder.

* runtime/ExceptionHelpers.cpp:
(JSC::notAFunctionSourceAppender): Use append instead of appendLiteral.
* runtime/IntlDateTimeFormat.cpp:
(JSC::IntlDateTimeFormat::initializeDateTimeFormat): Ditto.
* runtime/IntlNumberFormat.cpp:
(JSC::IntlNumberFormat::initializeNumberFormat): Ditto.

* runtime/JSCustomGetterFunction.cpp:
(JSC::JSCustomGetterFunction::create): Use auto and cut down on reference count
churn by using passing the StringImpl to makeString.
* runtime/JSCustomSetterFunction.cpp:
(JSC::JSCustomSetterFunction::create): Ditto.

* runtime/JSGlobalObjectFunctions.cpp: Use more const and use variadic
append for better efficiency.

* runtime/JSONObject.cpp:
(JSC::Stringifier::appendStringifiedValue): Use append instead of appendLiteral.
(JSC::Stringifier::Holder::appendNextProperty): Ditto.

* runtime/JSStringJoiner.h: Deleted unused appendLiteral function.
Unrelated to StringBuilder::appendLiteral, but dead code.

* runtime/Options.cpp:
(JSC::Options::dumpOption): Use append instead of appendLiteral.
* runtime/RegExpPrototype.cpp:
(JSC::appendLineTerminatorEscape<UChar>): Ditto.

* runtime/SamplingProfiler.cpp:
(JSC::SamplingProfiler::reportTopFunctions): Use auto for the result of makeString.
(JSC::SamplingProfiler::reportTopBytecodes): Ditto.

* runtime/TypeProfiler.cpp:
(JSC::TypeProfiler::typeInformationForExpressionAtOffset): Use append instead of
appendLiteral.

* runtime/TypeSet.cpp:
(JSC::TypeSet::dumpTypes const): Use append instead of appendLiteral.
(JSC::TypeSet::toJSONString const): Ditto.
(JSC::StructureShape::propertyHash): Ditto.
(JSC::StructureShape::toJSONString const): Ditto.

Source/WebCore:

* Modules/fetch/FetchBodyConsumer.cpp:
(WebCore::packageFormData): Use auto for the result of makeString.

* Modules/indexeddb/IDBKeyData.cpp:
(WebCore::IDBKeyData::loggingString const): Use append instead
of appendLiteral.

* Modules/indexeddb/server/SQLiteIDBBackingStore.cpp:
(WebCore::IDBServer::SQLiteIDBBackingStore::addRecord): Use auto
for the result of makeString.

* Modules/indexeddb/server/SQLiteIDBCursor.cpp:
(WebCore::IDBServer::buildPreIndexStatement): Use makeString
instead of StringBuilder.
(WebCore::IDBServer::buildIndexStatement): Ditto.
(WebCore::IDBServer::buildObjectStoreStatement): Ditto.

* Modules/websockets/WebSocket.cpp:
(WebCore::encodeProtocolString): Use append instead of appendLiteral.
* Modules/websockets/WebSocketExtensionDispatcher.cpp:
(WebCore::WebSocketExtensionDispatcher::appendAcceptedExtension): Ditto.

* Modules/websockets/WebSocketHandshake.cpp:
(WebCore::WebSocketHandshake::clientHandshakeMessage const): Use
makeString instead of StringBuilder.
(WebCore::WebSocketHandshake::clientHandshakeRequest const): Tweak
to match the function above more closely, and use ASCIILiteral.

* accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
(formatForDebugger): Use makeString instead of StringBuilder.

* contentextensions/CombinedURLFilters.cpp:
(WebCore::ContentExtensions::prefixTreeVertexToString): Use
append instead of appendLiteral.
* css/CSSBasicShapes.cpp:
(WebCore::buildCircleString): Ditto.
(WebCore::buildEllipseString): Ditto.
(WebCore::buildPathString): Ditto.
(WebCore::buildPolygonString): Ditto.
(WebCore::buildInsetString): Ditto.
* css/CSSGradientValue.cpp:
(WebCore::CSSLinearGradientValue::customCSSText const): Ditto.
(WebCore::CSSRadialGradientValue::customCSSText const): Ditto.
(WebCore::CSSConicGradientValue::customCSSText const): Ditto.

* css/CSSGridIntegerRepeatValue.cpp:
(WebCore::CSSGridIntegerRepeatValue::customCSSText const):
Use makeString instead of StringBuilder.

* css/CSSImageSetValue.cpp:
(WebCore::CSSImageSetValue::customCSSText const): Use append
instead of appendLiteral.

* css/CSSImportRule.cpp:
(WebCore::CSSImportRule::cssText const): Use makeString instead
of StringBuilder.
* css/CSSKeyframeRule.cpp:
(WebCore::StyleRuleKeyframe::cssText const): Ditto.

* css/CSSKeyframesRule.cpp:
(WebCore::CSSKeyframesRule::cssText const): Use variadic append.

* css/CSSLineBoxContainValue.cpp:
(WebCore::CSSLineBoxContainValue::customCSSText const): Use
append instead of appendLiteral.
* css/CSSNamespaceRule.cpp:
(WebCore::CSSNamespaceRule::cssText const): Ditto.

* css/CSSPageRule.cpp:
(WebCore::CSSPageRule::cssText const): Use makeString instead of
StringBuilder.
* css/CSSPaintImageValue.cpp:
(WebCore::CSSPaintImageValue::customCSSText const): Ditto.

* css/CSSPrimitiveValue.cpp:
(WebCore::CSSPrimitiveValue::formatNumberForCustomCSSText const):
Use append instead of appendLiteral.

* css/CSSSelector.cpp:
(WebCore::appendLangArgumentList): Use variadic append.
(WebCore::CSSSelector::selectorText const): Ditto. Also use
append instead of appendLiteral and make some improvements to
cut down on allocations a little.

* css/CSSSelectorList.cpp:
(WebCore::CSSSelectorList::buildSelectorsText const): Use
append instead of appendLiteral.

* css/CSSStyleSheet.cpp:
(WebCore::CSSStyleSheet::CSSStyleSheet): Moved more of the
data member initialization to the class definition.
(WebCore::CSSStyleSheet::addRule): Use makeString instead of
StringBuilder.
* css/CSSStyleSheet.h: Moved initialization here.

* css/CSSTimingFunctionValue.cpp:
(WebCore::CSSStepsTimingFunctionValue::customCSSText const):
Use makeString instead of StringBuilder.
(WebCore::CSSSpringTimingFunctionValue::customCSSText const):
Ditto.

* css/MediaList.cpp:
(WebCore::MediaQuerySet::mediaText const): Use append instead
of appendLiteral.
* css/MediaQuery.cpp:
(WebCore::MediaQuery::serialize const): Ditto.

* css/MediaQueryExpression.cpp:
(WebCore::MediaQueryExpression::serialize const): Use makeString
instead of StringBuilder.

* css/StyleProperties.cpp:
(WebCore::StyleProperties::getLayeredShorthandValue const):
Use append instead of appendLiteral.

* css/parser/CSSParserToken.cpp:
(WebCore::CSSParserToken::serialize const): Removed a lot of
unnecessary braces. Use variadic append and append instead of appendLiteral.

* dom/Document.cpp:
(WebCore::Document::initSecurityContext): Use auto for the result
of makeString.

* dom/Element.cpp:
(WebCore::appendAttributes): Use variadic append and append
instead of appendLiteral.
* dom/SecurityContext.cpp:
(WebCore::SecurityContext::parseSandboxPolicy): Ditto.
* editing/HTMLInterchange.cpp:
(WebCore::convertHTMLTextToInterchangeFormat): Ditto.

* editing/TextIterator.cpp:
(WebCore::createSearcher): Use auto for the result of makeString.

* editing/markup.cpp:
(WebCore::StyledMarkupAccumulator::appendStyleNodeOpenTag):
Use append instead of appendLiteral.
(WebCore::StyledMarkupAccumulator::appendStartTag): Ditto.
(WebCore::urlToMarkup): Ditto.
* html/FormController.cpp:
(WebCore::recordFormStructure): Ditto.

* html/HTMLFormControlElement.cpp:
(WebCore::HTMLFormControlElement::reportValidity): Use auto for
the result of makeString.
* html/HTMLFormElement.cpp:
(WebCore::HTMLFormElement::validateInteractively): Ditto.

* html/HTMLImageElement.cpp:
(WebCore::HTMLImageElement::completeURLsInAttributeValue const):
Use append insteaed of appendLiteral.

* html/MediaElementSession.cpp:
(WebCore::restrictionNames): Use auto for the result of makeString.
* html/canvas/WebGLRenderingContextBase.cpp:
(WebCore::WebGLRenderingContextBase::getUniformLocation): Ditto.
* html/parser/HTMLTreeBuilder.cpp:
(WebCore::HTMLTreeBuilder::ExternalCharacterTokenBuffer::takeRemaining): Ditto.

* html/parser/XSSAuditorDelegate.cpp:
(WebCore::buildConsoleError): Use makeString instead of StringBuilder.
* html/track/TextTrackCue.cpp:
(WebCore::TextTrackCue::rebuildDisplayTree): Ditto.

* inspector/InspectorFrontendAPIDispatcher.cpp:
(WebCore::expressionForEvaluatingCommand): Use append instead of appendLiteral.

* inspector/InspectorOverlay.cpp:
(WebCore::InspectorOverlay::drawElementTitle): Use auto for the result of makeString.

* inspector/InspectorStyleSheet.cpp:
(WebCore::InspectorStyleSheet::addRule): Use append instead of appendLiteral.

* inspector/agents/InspectorApplicationCacheAgent.cpp:
(WebCore::InspectorApplicationCacheAgent::buildObjectForApplicationCacheResource):
Use makeString instead of StringBuilder.

* inspector/agents/WebConsoleAgent.cpp:
(WebCore::WebConsoleAgent::didReceiveResponse): Use auto for the result of makeString.
(WebCore::WebConsoleAgent::didFailLoading): Ditto.
* loader/MixedContentChecker.cpp:
(WebCore::logWarning): Ditto
(WebCore::MixedContentChecker::checkFormForMixedContent): Ditto

* loader/PrivateClickMeasurement.cpp:
(WebCore::makeValidURL): Added. Used for various cases below that all construct
URLs in the same way with the same kinds of checks. Use makeString here instead
of StringBuilder.
(WebCore::attributionReportURL): Call makeValidURL.
(WebCore::PrivateClickMeasurement::tokenSignatureURL const): Ditto.
(WebCore::PrivateClickMeasurement::tokenPublicKeyURL const): Ditto.

* loader/ResourceLoadStatistics.cpp:
(WebCore::appendBoolean): Use append instead of appendLiteral.
(WebCore::appendHashSet): Ditto.
(WebCore::appendNavigatorAPIOptionSet): Ditto.
(WebCore::appendScreenAPIOptionSet): Ditto.
(WebCore::ResourceLoadStatistics::toString const): Ditto.

* loader/WorkerThreadableLoader.cpp:
(WebCore::WorkerThreadableLoader::loadResourceSynchronously): Use auto for
the result of makeString.
* page/DOMWindow.cpp:
(WebCore::DOMWindow::postMessage): Ditto.

* page/Frame.cpp:
(WebCore::createRegExpForLabels): Use append instead of appendLiteral.
Also tweak coding style a bit.

* page/FrameView.cpp:
(WebCore::FrameView::logMockScrollAnimatorMessage const): Use makeString
instead of StringBuilder.

* page/PageSerializer.cpp:
(WebCore::PageSerializer::SerializerMarkupAccumulator::appendStartTag):
Use append instead of appendLiteral.
(WebCore::PageSerializer::serializeCSSStyleSheet): Ditto.
(WebCore::PageSerializer::urlForBlankFrame): Use auto for the result of
makeString.

* page/PerformanceLoggingClient.cpp:
(WebCore::PerformanceLoggingClient::synchronousScrollingReasonsAsString):
Use makeString instead of StringBuilder.

* page/cocoa/ResourceUsageOverlayCocoa.mm:
(WebCore::ResourceUsageOverlay::platformDraw): Use auto for the result of
makeString.

* page/csp/ContentSecurityPolicy.cpp:
(WebCore::consoleMessageForViolation): Use makeString instsead of StringBuilder.
(WebCore::ContentSecurityPolicy::allowRunningOrDisplayingInsecureContent): Ditto.
(WebCore::ContentSecurityPolicy::reportInvalidDirectiveValueCharacter const):
Get rid of local variable for result of makeString.
(WebCore::ContentSecurityPolicy::reportInvalidPathCharacter const): Ditto.
(WebCore::ContentSecurityPolicy::reportInvalidSourceExpression const): Ditto.

* page/csp/ContentSecurityPolicyDirectiveList.cpp:
(WebCore::ContentSecurityPolicyDirectiveList::create): Get rid of local
variable for result of makeString.

* page/scrolling/ScrollingCoordinator.cpp:
(WebCore::ScrollingCoordinator::synchronousScrollingReasonsAsText):
Use makeString instead of StringBulder.

* platform/Decimal.cpp:
(WebCore::Decimal::toString const): Use append instead of appendLiteral.

* platform/animation/TimingFunction.cpp:
(WebCore::TimingFunction::createFromCSSText): Use makeString instead
of StringBuilder.

* platform/audio/HRTFElevation.cpp:
(WebCore::HRTFElevation::calculateKernelsForAzimuthElevation): Use auto
for the result of makeString.

* platform/glib/UserAgentGLib.cpp:
(WebCore::buildUserAgentString): Use append instead of appendLiteral.

* platform/graphics/avfoundation/InbandTextTrackPrivateAVF.cpp:
(WebCore::InbandTextTrackPrivateAVF::processCueAttributes): Use
append instead of appendLiteral.

* platform/graphics/ca/GraphicsLayerCA.cpp:
(WebCore::GraphicsLayerCA::recursiveCommitChanges): Got rid of local
variable for result of makeString.
(WebCore::GraphicsLayerCA::appendToUncommittedAnimations): Use auto
for result of makeString.

* platform/graphics/ca/TileController.cpp:
(WebCore::TileController::tileRevalidationTimerFired): Update to
use OptionSet.

* platform/graphics/ca/TileGrid.cpp:
(WebCore::validationPolicyAsString): Use OptionSet.
(WebCore::TileGrid::setNeedsDisplayInRect): Use auto for iterator
and range-based for loop.
(WebCore::TileGrid::updateTileLayerProperties): Ditto.
(WebCore::TileGrid::blankPixelCount const): Ditto.
(WebCore::TileGrid::removeTiles): Use HashCountedSet.
(WebCore::TileGrid::revalidateTiles): Use OptionSet.
(WebCore::TileGrid::retainedTileBackingStoreMemory const): Use
ranged-based for loop.
(WebCore::TileGrid::drawTileMapContents const): Use range-based
for loop and use writeIntegerToBuffer instead of String::number.
(WebCore::TileGrid::platformCALayerRepaintCount const): Use
HashCountedSet.
(WebCore::TileGrid::platformCALayerIncrementRepaintCount): Ditto.
This cuts us down from 3 hash table lookups to 1.
(WebCore::TileGrid::removeUnparentedTilesNow): Removed local
variable to make code a little tighter.
* platform/graphics/ca/TileGrid.h: Use OptionSet and HashCountedSet.
Removed some type names.

* platform/graphics/ca/cocoa/PlatformCAFiltersCocoa.mm:
(WebCore::PlatformCAFilters::setFiltersOnLayer): Use auto for
reuslt of makeString.
* platform/mock/MockRealtimeVideoSource.cpp:
(WebCore::MockRealtimeVideoSource::drawText): Ditto.

* platform/mock/ScrollAnimatorMock.cpp:
(WebCore::ScrollAnimatorMock::scrollbarPrefix const): Added
helper function for use below.
(WebCore::ScrollAnimatorMock::mouseEnteredScrollbar const): Use
makeString instead of StringBuilder.
(WebCore::ScrollAnimatorMock::mouseExitedScrollbar const): Ditto.
(WebCore::ScrollAnimatorMock::mouseIsDownInScrollbar const): Ditto.
* platform/mock/ScrollAnimatorMock.h: Ditto.

* platform/network/ProxyServer.cpp:
(WebCore::appendProxyServerString): Use append instead of appendLiteral.
(WebCore::toString): Ditto.

* platform/network/ResourceResponseBase.cpp:
(WebCore::ResourceResponseBase::sanitizeSuggestedFilename): Get rid
of local variable with result of maekString in it.

* platform/playstation/UserAgentPlayStation.cpp:
(WebCore::platformForUAString): Deleted. No need for a global variable
to hold the result of something called only once.
(WebCore::platformVersionForUAString): Ditto.
(WebCore::buildUserAgentString): Deleted.
(WebCore::standardUserAgentStatic): Moved the logic from buildUserAgentString
here, using makeString instead of StringBuilder.

* platform/sql/SQLiteDatabase.cpp:
(WebCore::SQLiteDatabase::open): Use auto for result of makeString.
* platform/sql/SQLiteFileSystem.cpp:
(WebCore::SQLiteFileSystem::deleteDatabaseFile): Ditto.

* platform/text/DateTimeFormat.cpp:
(WebCore::DateTimeFormat::quoteAndAppendLiteral): Use append instead
of appendLiteral and StringView::substring instead of String::substring.

* platform/win/ClipboardUtilitiesWin.cpp:
(WebCore::replaceNewlinesWithWindowsStyleNewlines): Use append
instead of appendLiteral.

* platform/win/UserAgentWin.cpp:
(WebCore::standardUserAgent): Use makeString instead of StringBuildeer.
* rendering/RenderLayer.cpp:
(WebCore::RenderLayer::name const): Ditto.
(WebCore::RenderLayer::debugDescription const): Ditto.

* rendering/RenderLayerCompositor.cpp:
(WebCore::RenderLayerCompositor::logLayerInfo): Use append instead of
appendLiteral.
* rendering/RenderTreeAsText.cpp:
(WebCore::quoteAndEscapeNonPrintables): Ditto.
(WebCore::nodePosition): Ditto.
* svg/SVGPathStringBuilder.cpp:
(WebCore::SVGPathStringBuilder::moveTo): Ditto.
(WebCore::SVGPathStringBuilder::lineTo): Ditto.
(WebCore::SVGPathStringBuilder::lineToHorizontal): Ditto.
(WebCore::SVGPathStringBuilder::lineToVertical): Ditto.
(WebCore::SVGPathStringBuilder::curveToCubic): Ditto.
(WebCore::SVGPathStringBuilder::curveToCubicSmooth): Ditto.
(WebCore::SVGPathStringBuilder::curveToQuadratic): Ditto.
(WebCore::SVGPathStringBuilder::curveToQuadraticSmooth): Ditto.
(WebCore::SVGPathStringBuilder::arcTo): Ditto.
(WebCore::SVGPathStringBuilder::closePath): Ditto.
* testing/Internals.cpp:
(WebCore::Internals::dumpMarkerRects): Ditto.
(WebCore::appendOffsets):
(WebCore::Internals::scrollSnapOffsets): Ditto.

* workers/WorkerScriptLoader.cpp:
(WebCore::WorkerScriptLoader::validateWorkerResponse): Use auto
for reuslt of makeString.

Source/WebKit:

* NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.cpp:
(WebKit::ResourceLoadStatisticsDatabaseStore::ensureAndMakeDomainList): Use append
instead of appendLiteral.
(WebKit::domainsToString): Ditto.
(WebKit::buildList): Ditto.
(WebKit::ResourceLoadStatisticsDatabaseStore::findNotVeryPrevalentResources): Ditto.
(WebKit::ResourceLoadStatisticsDatabaseStore::dumpResourceLoadStatistics): Ditto.
(WebKit::appendBoolean): Ditto.
(WebKit::appendNextEntry): Ditto.
(WebKit::ResourceLoadStatisticsDatabaseStore::appendSubStatisticList const): Ditto.
(WebKit::ResourceLoadStatisticsDatabaseStore::resourceToString const): Ditto.
(WebKit::ResourceLoadStatisticsDatabaseStore::attributionToString): Ditto.
(WebKit::ResourceLoadStatisticsDatabaseStore::privateClickMeasurementToString): Ditto.
* NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.cpp:
(WebKit::ResourceLoadStatisticsMemoryStore::dumpResourceLoadStatistics): Ditto.
* NetworkProcess/Classifier/ResourceLoadStatisticsStore.cpp: Ditto.
(WebKit::domainsToString): Ditto.

* NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp:
(WebKit::WebResourceLoadStatisticsStore::create): Moved this here from the header.
(WebKit::WebResourceLoadStatisticsStore::ThirdPartyDataForSpecificFirstParty::toString const): Ditto.
(WebKit::WebResourceLoadStatisticsStore::ThirdPartyDataForSpecificFirstParty::encode const): Ditto.
(WebKit::WebResourceLoadStatisticsStore::ThirdPartyDataForSpecificFirstParty::decode): Ditto.
(WebKit::WebResourceLoadStatisticsStore::ThirdPartyDataForSpecificFirstParty::operator== const): Ditto.
(WebKit::WebResourceLoadStatisticsStore::ThirdPartyData::toString const): Ditto.
(WebKit::WebResourceLoadStatisticsStore::ThirdPartyData::encode const): Ditto.
(WebKit::WebResourceLoadStatisticsStore::ThirdPartyData::decode): Ditto.
(WebKit::WebResourceLoadStatisticsStore::ThirdPartyData::operator< const): Ditto.
* NetworkProcess/Classifier/WebResourceLoadStatisticsStore.h: Moved member
functions of the nested structures into the implementation file and fixed
the indentation of the structures to indicate the nesting.

* NetworkProcess/NetworkLoadChecker.cpp:
(WebKit::NetworkLoadChecker::continueCheckingRequest): Do not use a local
variable for the reuslt of makeString.
* NetworkProcess/NetworkProcess.cpp:
(WebKit::NetworkProcess::newTestingSession): Ditto.

* NetworkProcess/cache/NetworkCache.cpp:
(WebKit::NetworkCache::Cache::dumpContentsToFile): Use append instead of appendLiteral
* NetworkProcess/cache/NetworkCacheEntry.cpp:
(WebKit::NetworkCache::Entry::asJSON const): Ditto.

* NetworkProcess/cache/NetworkCacheStorage.cpp:
(WebKit::NetworkCache::makeVersionedDirectoryPath): Do not use a local variable for
the result of makeString.

* NetworkProcess/soup/NetworkProcessSoup.cpp:
(WebKit::buildAcceptLanguages): Use append instead of appendLiteral.
* NetworkProcess/soup/WebSocketTaskSoup.cpp:
(WebKit::WebSocketTask::acceptedExtensions const): Ditto.

* NetworkProcess/webrtc/NetworkMDNSRegister.cpp:
(WebKit::NetworkMDNSRegister::registerMDNSName): Use auto for the result of makeString.
* Shared/WebMemorySampler.cpp:
(WebKit::WebMemorySampler::writeHeaders): Ditto.

* Shared/mac/AuxiliaryProcessMac.mm:
(WebKit::initializeSandboxParameters): Do not use a local variable for the result of
makeString. Also, take advantage of the support for concatenating an NSString instead
of converting it to a WTF::String.

* Shared/mac/WebMemorySampler.mac.mm:
(WebKit::WebMemorySampler::sampleWebKit const): Use ASCIILiteral and remove explicit
conversion to String.

* UIProcess/API/glib/WebKitWebView.cpp:
(webkitWebViewRunJavaScriptCallback): Use append instead of appendLiteral.

* UIProcess/Automation/WebAutomationSession.cpp:
(WebKit::fileCanBeAcceptedForUpload): Use auto for result of makeString.

* WebProcess/InjectedBundle/API/glib/WebKitWebPage.cpp: Use makeString instead of
StringBuilder.

* UIProcess/Network/NetworkProcessProxy.cpp:
(WebKit::NetworkProcessProxy::requestStorageSpace): Use auto for result of makeString.

* UIProcess/WebBackForwardList.cpp:
(WebKit::WebBackForwardList::loggingString): Use append instead of appendLiteral.

* UIProcess/WebProcessPool.cpp:
(WebKit::WebProcessPool::processDidFinishLaunching): Use auto for result of makeString.
(WebKit::WebProcessPool::startMemorySampler): Ditto.

* WebProcess/WebPage/WebPage.cpp:
(WebKit::dumpHistoryItem): Use append instead of appendLiteral.
(WebKit::WebPage::getContentsAsString): Ditto.

Source/WebKitLegacy:

* WebCoreSupport/NetworkStorageSessionMap.cpp:
(NetworkStorageSessionMap::switchToNewTestingSession): Do not use local
for return value of makeString.

Source/WebKitLegacy/mac:

* WebView/WebHTMLRepresentation.mm:
(regExpForLabels): Use append instead of appendLiteral.
Also imrpove local variable names a bit.

Source/WebKitLegacy/win:

* AccessibleBase.cpp:
(AccessibleBase::get_accKeyboardShortcut): Use append instead of appnedLiteral.
* WebView.cpp: Ditto.

Source/WTF:

The optimization done by appendLiteral has minimal value and is something we
can do without. It does not cut down the number of allocations, which is the
main cost of the StringBuilder class. Getting rid of the differently named
appendLiteral improves the design of the StringBuilder class for callers.
Our goal is to get as close as possible to a single append function.

If we decide we need an optimization for literals, we can come up with a
different way that is compatible with append. For example, we could assume
that any char array is a literal and check that at compile time in
StringConcatenate; that optimization would work for both makeString and
StringBuilder. Or we could use a strategy like ASCIILiteral.

* wtf/FileSystem.cpp:
(WTF::FileSystemImpl::encodeForFileName): Streamline logic,
and use variadic append to make this more efficient.

* wtf/JSONValues.cpp:
(WTF::JSONImpl::Value::escapeString): Use append instead
of appendLiteral.
(WTF::JSONImpl::Value::writeJSON const): Ditto.

* wtf/Logger.h:
(WTF::Logger::log): Use auto for result of makeString.
(WTF::Logger::logVerbose): Ditto.

* wtf/MediaTime.cpp:
(WTF::MediaTime::toString const): Use makeString instead of StringBuilder.

* wtf/text/IntegerToStringConversion.h:
Made lengthOfIntegerAsString a constexpr function so we can use it to
compute the required size of arrays for conversion. Added using for both
lengthOfIntegerAsString and writeIntegerToBuffer so we can use them without
the WTF prefix as is customary for functions in WTF.

* wtf/text/StringBuilder.h:
(WTF::StringBuilder::appendLiteral): Deleted.

* wtf/text/StringConcatenate.h: Added support for appending StringImpl&,
StringImpl*, AtomStringImpl&, and AtomStringImpl*.

Tools:

* TestWebKitAPI/Tests/WTF/StringBuilder.cpp:
Use append instead of appendLiteral.
* TestWebKitAPI/Tests/WebCore/FileMonitor.cpp:
(TestWebKitAPI::createCommand): Use makeString instead of StringBuilder.
* TestWebKitAPI/Tests/WebCore/Logging.cpp:
(TestWebKitAPI::TEST_F): Made lots of fixes to code inside #if TEST_OUTPUT,
which hasn't compiled in a long time. Still not 100% there, but closer.
* TestWebKitAPI/Tests/WebCore/TextCodec.cpp:
(TestWebKitAPI::testDecode): Use append instead of appendLiteral.
* WebKitTestRunner/InjectedBundle/atk/AccessibilityUIElementAtk.cpp:
(WTR::AccessibilityUIElement::helpText const): Ditto.


Canonical link: https://commits.webkit.org/238091@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@277967 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-05-24 21:51:47 +00:00
Chris Dumez e801aaaa0b Make CheckedLock the default Lock
https://bugs.webkit.org/show_bug.cgi?id=226157

Reviewed by Darin Adler.

Make CheckedLock the default Lock so that we get more benefits from Clang
Thread Safety Analysis. Note that CheckedLock 100% relies on the existing
Source/JavaScriptCore:

Lock implementation and merely adds the clang anotations for thread
safety.

That this patch does is:
1. Rename the Lock class to UncheckedLock
2. Rename the CheckedLock class to Lock
3. Rename the Condition class to UncheckedCondition
4. Rename the CheckedCondition class to Condition
5. Update the types of certain variables from Lock / Condition to
   UncheckedLock / UncheckedCondition if I got a build failure. Build
   failures are usually caused by the following facts:
   - Locker<CheckedLock> doesn't subclass AbstractLocker which a lot of
     JSC code passes as argument
   - Locker<CheckedLock> has no move constructor
   - Locker<CheckedLock> cannot be constructed from a lock pointer, only
     a reference

For now, CheckedLock and CheckedCondition remain as aliases to Lock and
Condition, in their respective CheckedLock.h / CheckedCondition.h headers.
I will drop them in a follow-up to reduce patch size.

I will also follow-up to try and get rid of as much usage of UncheckedLock
and UncheckedCondition as possible. I did not try very hard in this patch
to reduce patch size.

* assembler/testmasm.cpp:
* dfg/DFGCommon.cpp:
* dfg/DFGThreadData.h:
* dfg/DFGWorklist.cpp:
(JSC::DFG::Worklist::Worklist):
* dfg/DFGWorklist.h:
* dynbench.cpp:
* heap/BlockDirectory.h:
(JSC::BlockDirectory::bitvectorLock):
* heap/CodeBlockSet.h:
(JSC::CodeBlockSet::getLock):
* heap/Heap.cpp:
(JSC::Heap::Heap):
* heap/Heap.h:
* heap/MarkedSpace.h:
(JSC::MarkedSpace::directoryLock):
* heap/MarkingConstraintSolver.h:
* heap/SlotVisitor.cpp:
(JSC::SlotVisitor::donateKnownParallel):
* heap/SlotVisitor.h:
* jit/ExecutableAllocator.cpp:
(JSC::ExecutableAllocator::getLock const):
(JSC::dumpJITMemory):
* jit/ExecutableAllocator.h:
(JSC::ExecutableAllocatorBase::getLock const):
* jit/JITWorklist.cpp:
(JSC::JITWorklist::JITWorklist):
* jit/JITWorklist.h:
* jsc.cpp:
* profiler/ProfilerDatabase.h:
* runtime/ConcurrentJSLock.h:
* runtime/DeferredWorkTimer.h:
* runtime/JSLock.h:
* runtime/SamplingProfiler.cpp:
(JSC::FrameWalker::FrameWalker):
(JSC::CFrameWalker::CFrameWalker):
(JSC::SamplingProfiler::takeSample):
* runtime/SamplingProfiler.h:
(JSC::SamplingProfiler::getLock):
* runtime/VM.h:
* runtime/VMTraps.cpp:
(JSC::VMTraps::invalidateCodeBlocksOnStack):
(JSC::VMTraps::VMTraps):
* runtime/VMTraps.h:
* tools/FunctionOverrides.h:
* tools/VMInspector.cpp:
(JSC::ensureIsSafeToLock):
* tools/VMInspector.h:
(JSC::VMInspector::getLock):
* wasm/WasmCalleeRegistry.h:
(JSC::Wasm::CalleeRegistry::getLock):
* wasm/WasmPlan.h:
* wasm/WasmStreamingCompiler.h:
* wasm/WasmThunks.h:
* wasm/WasmWorklist.cpp:
(JSC::Wasm::Worklist::Worklist):
* wasm/WasmWorklist.h:

Source/WebCore:

Lock implementation and merely adds the clang anotations for thread
safety.

That this patch does is:
1. Rename the Lock class to UncheckedLock
2. Rename the CheckedLock class to Lock
3. Rename the Condition class to UncheckedCondition
4. Rename the CheckedCondition class to Condition
5. Update the types of certain variables from Lock / Condition to
   UncheckedLock / UncheckedCondition if I got a build failure. Build
   failures are usually caused by the following facts:
   - Locker<CheckedLock> doesn't subclass AbstractLocker which a lot of
     JSC code passes as argument
   - Locker<CheckedLock> has no move constructor
   - Locker<CheckedLock> cannot be constructed from a lock pointer, only
     a reference

For now, CheckedLock and CheckedCondition remain as aliases to Lock and
Condition, in their respective CheckedLock.h / CheckedCondition.h headers.
I will drop them in a follow-up to reduce patch size.

I will also follow-up to try and get rid of as much usage of UncheckedLock
and UncheckedCondition as possible. I did not try very hard in this patch
to reduce patch size.

* Modules/indexeddb/server/IDBServer.cpp:
* Modules/webaudio/MediaElementAudioSourceNode.h:
* Modules/webdatabase/OriginLock.cpp:
* bindings/js/JSDOMGlobalObject.h:
* dom/Node.cpp:
* html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::createMediaPlayer):
* html/canvas/WebGLContextGroup.cpp:
(WebCore::WebGLContextGroup::objectGraphLockForAContext):
* html/canvas/WebGLContextGroup.h:
* html/canvas/WebGLContextObject.cpp:
(WebCore::WebGLContextObject::objectGraphLockForContext):
* html/canvas/WebGLContextObject.h:
* html/canvas/WebGLObject.h:
* html/canvas/WebGLRenderingContextBase.cpp:
(WebCore::WebGLRenderingContextBase::objectGraphLock):
* html/canvas/WebGLRenderingContextBase.h:
* html/canvas/WebGLSharedObject.cpp:
(WebCore::WebGLSharedObject::objectGraphLockForContext):
* html/canvas/WebGLSharedObject.h:
* page/scrolling/mac/ScrollingTreeMac.h:
* platform/audio/ReverbConvolver.cpp:
(WebCore::ReverbConvolver::backgroundThreadEntry):
* platform/graphics/ShadowBlur.cpp:
(WebCore::ScratchBuffer::lock):
(WebCore::ShadowBlur::drawRectShadowWithTiling):
(WebCore::ShadowBlur::drawInsetShadowWithTiling):
* platform/graphics/gstreamer/VideoSinkGStreamer.cpp:
* platform/graphics/gstreamer/eme/WebKitCommonEncryptionDecryptorGStreamer.cpp:

Source/WebKit:

Lock implementation and merely adds the clang anotations for thread
safety.

That this patch does is:
1. Rename the Lock class to UncheckedLock
2. Rename the CheckedLock class to Lock
3. Rename the Condition class to UncheckedCondition
4. Rename the CheckedCondition class to Condition
5. Update the types of certain variables from Lock / Condition to
   UncheckedLock / UncheckedCondition if I got a build failure. Build
   failures are usually caused by the following facts:
   - Locker<CheckedLock> doesn't subclass AbstractLocker which a lot of
     JSC code passes as argument
   - Locker<CheckedLock> has no move constructor
   - Locker<CheckedLock> cannot be constructed from a lock pointer, only
     a reference

For now, CheckedLock and CheckedCondition remain as aliases to Lock and
Condition, in their respective CheckedLock.h / CheckedCondition.h headers.
I will drop them in a follow-up to reduce patch size.

I will also follow-up to try and get rid of as much usage of UncheckedLock
and UncheckedCondition as possible. I did not try very hard in this patch
to reduce patch size.

* GPUProcess/graphics/RemoteGraphicsContextGL.cpp:
(WebKit::RemoteGraphicsContextGL::paintPixelBufferToImageBuffer):
* NetworkProcess/IndexedDB/WebIDBServer.cpp:
* UIProcess/API/glib/IconDatabase.h:
* UIProcess/mac/WKPrintingView.mm:
(-[WKPrintingView knowsPageRange:]):

Source/WTF:

Lock implementation and merely adds the clang anotations for thread
safety.

That this patch does is:
1. Rename the Lock class to UncheckedLock
2. Rename the CheckedLock class to Lock
3. Rename the Condition class to UncheckedCondition
4. Rename the CheckedCondition class to Condition
5. Update the types of certain variables from Lock / Condition to
   UncheckedLock / UncheckedCondition if I got a build failure. Build
   failures are usually caused by the following facts:
   - Locker<CheckedLock> doesn't subclass AbstractLocker which a lot of
     JSC code passes as argument
   - Locker<CheckedLock> has no move constructor
   - Locker<CheckedLock> cannot be constructed from a lock pointer, only
     a reference

For now, CheckedLock and CheckedCondition remain as aliases to Lock and
Condition, in their respective CheckedLock.h / CheckedCondition.h headers.
I will drop them in a follow-up to reduce patch size.

I will also follow-up to try and get rid of as much usage of UncheckedLock
and UncheckedCondition as possible. I did not try very hard in this patch
to reduce patch size.

* wtf/AutomaticThread.cpp:
(WTF::AutomaticThreadCondition::wait):
(WTF::AutomaticThreadCondition::waitFor):
(WTF::AutomaticThread::AutomaticThread):
* wtf/AutomaticThread.h:
* wtf/CheckedCondition.h:
* wtf/CheckedLock.h:
* wtf/Condition.h:
* wtf/Lock.cpp:
(WTF::UncheckedLock::lockSlow):
(WTF::UncheckedLock::unlockSlow):
(WTF::UncheckedLock::unlockFairlySlow):
(WTF::UncheckedLock::safepointSlow):
* wtf/Lock.h:
(WTF::WTF_ASSERTS_ACQUIRED_LOCK):
* wtf/MetaAllocator.cpp:
(WTF::MetaAllocator::release):
(WTF::MetaAllocator::MetaAllocator):
(WTF::MetaAllocator::allocate):
(WTF::MetaAllocator::currentStatistics):
* wtf/MetaAllocator.h:
* wtf/ParallelHelperPool.cpp:
(WTF::ParallelHelperPool::ParallelHelperPool):
* wtf/ParallelHelperPool.h:
* wtf/RecursiveLockAdapter.h:
* wtf/WorkerPool.cpp:
(WTF::WorkerPool::WorkerPool):
* wtf/WorkerPool.h:

Tools:

Lock implementation and merely adds the clang anotations for thread
safety.

That this patch does is:
1. Rename the Lock class to UncheckedLock
2. Rename the CheckedLock class to Lock
3. Rename the Condition class to UncheckedCondition
4. Rename the CheckedCondition class to Condition
5. Update the types of certain variables from Lock / Condition to
   UncheckedLock / UncheckedCondition if I got a build failure. Build
   failures are usually caused by the following facts:
   - Locker<CheckedLock> doesn't subclass AbstractLocker which a lot of
     JSC code passes as argument
   - Locker<CheckedLock> has no move constructor
   - Locker<CheckedLock> cannot be constructed from a lock pointer, only
     a reference

For now, CheckedLock and CheckedCondition remain as aliases to Lock and
Condition, in their respective CheckedLock.h / CheckedCondition.h headers.
I will drop them in a follow-up to reduce patch size.

I will also follow-up to try and get rid of as much usage of UncheckedLock
and UncheckedCondition as possible. I did not try very hard in this patch
to reduce patch size.

* TestWebKitAPI/Tests/WTF/CheckedConditionTest.cpp:
* TestWebKitAPI/Tests/WTF/Condition.cpp:
* TestWebKitAPI/Tests/WTF/MetaAllocator.cpp:
* WebKitTestRunner/InjectedBundle/AccessibilityController.cpp:
(WTR::AXThread::createThreadIfNeeded):


Canonical link: https://commits.webkit.org/238070@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@277943 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-05-24 05:37:41 +00:00
Adrien Destugues 2739e4d5c4 Merge commit 'a9ad6be2f57e2093525317ffb3d1284b45b87d10' into HEAD 2021-05-22 17:30:30 +02:00
Chris Dumez 90b42ca61f Stop using holdLock() in WebKit/WebKitLegacy/Tools as it is not compatible with Clang thread safety analysis
https://bugs.webkit.org/show_bug.cgi?id=226127

Reviewed by Alex Christensen.

Source/WebKit:

* GPUProcess/webrtc/LibWebRTCCodecsProxy.mm:
(WebKit::LibWebRTCCodecsProxy::close):
(WebKit::LibWebRTCCodecsProxy::createH264Decoder):
(WebKit::LibWebRTCCodecsProxy::createH265Decoder):
(WebKit::LibWebRTCCodecsProxy::createVP9Decoder):
(WebKit::LibWebRTCCodecsProxy::releaseDecoder):
(WebKit::LibWebRTCCodecsProxy::createEncoder):
(WebKit::LibWebRTCCodecsProxy::releaseEncoder):
(WebKit::LibWebRTCCodecsProxy::allowsExitUnderMemoryPressure const):
* Platform/IPC/Connection.cpp:
(IPC::Connection::SyncMessageState::enqueueMatchingMessages):
(IPC::Connection::SyncMessageState::processIncomingMessage):
(IPC::Connection::SyncMessageState::dispatchMessages):
(IPC::Connection::SyncMessageState::dispatchMessagesAndResetDidScheduleDispatchMessagesForConnection):
* Shared/CoordinatedGraphics/threadedcompositor/ThreadedDisplayRefreshMonitor.cpp:
(WebKit::ThreadedDisplayRefreshMonitor::requestRefreshCallback):
(WebKit::ThreadedDisplayRefreshMonitor::requiresDisplayRefreshCallback):
(WebKit::ThreadedDisplayRefreshMonitor::invalidate):
(WebKit::ThreadedDisplayRefreshMonitor::displayRefreshCallback):
* Shared/mac/MediaFormatReader/MediaSampleCursor.cpp:
(WebKit::MediaSampleCursor::copy):
(WebKit::MediaSampleCursor::getSampleMap const):
* UIProcess/mac/WKPrintingView.mm:
(-[WKPrintingView _preparePDFDataForPrintingOnSecondaryThread]):
(prepareDataForPrintingOnSecondaryThread):

Source/WebKitLegacy/ios:

* WebCoreSupport/WebFixedPositionContent.mm:
(-[WebFixedPositionContent scrollOrZoomChanged:]):
(-[WebFixedPositionContent overflowScrollPositionForLayer:changedTo:]):
(-[WebFixedPositionContent setViewportConstrainedLayers:stickyContainerMap:]):
(-[WebFixedPositionContent hasFixedOrStickyPositionLayers]):

Source/WebKitLegacy/win:

* WebKitQuartzCoreAdditions/CAD3DRenderer.cpp:
(WKQCA::CAD3DRenderer::swapChain):
(WKQCA::CAD3DRenderer::renderAndPresent):
(WKQCA::CAD3DRenderer::renderToImage):
* WebKitQuartzCoreAdditions/CAView.cpp:
(WKQCA::CAView::releaseAllD3DResources):
(WKQCA::CAView::CAView):
(WKQCA::CAView::~CAView):
(WKQCA::CAView::setLayer):
(WKQCA::CAView::update):
(WKQCA::CAView::drawToWindow):
(WKQCA::CAView::drawToImage):
(WKQCA::CAView::drawIntoDC):
(WKQCA::CAView::setShouldInvertColors):
(WKQCA::CAView::scheduleNextDraw):
(WKQCA::CAView::displayLinkReachedCAMediaTime):
(WKQCA::CAView::contextDidChange):
(WKQCA::CAView::updateSoon):
(WKQCA::CAView::updateViewsNow):
(WKQCA::CAView::d3dDevice9):
* WebLocalizableStrings.cpp:
(findCachedString):
(cacheString):

Tools:

* DumpRenderTree/JavaScriptThreading.cpp:
(runJavaScriptThread):
(startJavaScriptThreads):
(stopJavaScriptThreads):
* Scripts/webkitpy/style/checkers/cpp.py:
(check_lock_guard):
* Scripts/webkitpy/style/checkers/cpp_unittest.py:
(WebKitStyleTest.test_lock_guard):
* TestWebKitAPI/Tests/WTF/Condition.cpp:
* TestWebKitAPI/Tests/WTF/ThreadGroup.cpp:
(TestWebKitAPI::testThreadGroup):
(TestWebKitAPI::TEST):
* WebKitTestRunner/InjectedBundle/AccessibilityController.cpp:
(WTR::AXThread::dispatch):
(WTR::AXThread::dispatchFunctionsFromAXThread):
* WebKitTestRunner/InjectedBundle/mac/AccessibilityControllerMac.mm:
(WTR::AXThread::initializeRunLoop):


Canonical link: https://commits.webkit.org/238044@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@277911 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-05-22 04:34:08 +00:00
Devin Rousso 91245aaddd Add a way to create `"wheel"` events from gesture/touch events
https://bugs.webkit.org/show_bug.cgi?id=225788
<rdar://problem/76714308>

Reviewed by Simon Fraser.

Source/WebCore:

Test: fast/events/gesture/wheel-from-gesture.html

Other browsers have taken the approach of dispatching `"wheel"` events with `ctrlKey` and
`deltaY` when handling multi-touch pinch-to-zoom gestures. Add helper functions to do this.

* platform/PlatformWheelEvent.h:
* platform/PlatformWheelEvent.cpp:
(WebCore::PlatformWheelEvent::createFromGesture): Added.

Tools:

* WebKitTestRunner/InjectedBundle/Bindings/EventSendingController.idl:
* WebKitTestRunner/InjectedBundle/EventSendingController.h:
* WebKitTestRunner/InjectedBundle/EventSendingController.cpp:
(WTR::EventSendingController::scaleGestureStart): Added.
(WTR::EventSendingController::scaleGestureChange): Added.
(WTR::EventSendingController::scaleGestureEnd): Added.
* WebKitTestRunner/TestController.cpp:
(WTR::TestController::didReceiveSynchronousMessageFromInjectedBundle):
* WebKitTestRunner/EventSenderProxy.h:
* WebKitTestRunner/mac/EventSenderProxy.mm:
(EventSenderCGGesturePhaseFromNSEventPhase):
(-[EventSenderSyntheticEvent initPressureEventAtLocation:globalLocation:stage:pressure:stageTransition:phase:time:eventNumber:window:]):
(-[EventSenderSyntheticEvent initMagnifyEventAtLocation:globalLocation:magnification:phase:time:eventNumber:window:]): Added.
(-[EventSenderSyntheticEvent magnification]): Added.
(WTR::EventSenderProxy::mouseDown):
(WTR::EventSenderProxy::mouseUp):
(WTR::EventSenderProxy::sendMouseDownToStartPressureEvents):
(WTR::EventSenderProxy::beginPressureEvent):
(WTR::EventSenderProxy::pressureChangeEvent):
(WTR::EventSenderProxy::mouseForceClick):
(WTR::EventSenderProxy::startAndCancelMouseForceClick):
(WTR::EventSenderProxy::mouseMoveTo):
(WTR::EventSenderProxy::scaleGestureStart): Added.
(WTR::EventSenderProxy::scaleGestureChange): Added.
(WTR::EventSenderProxy::scaleGestureEnd): Added.
Allow tests to synthesize scale (a.k.a. magnify) gesture events.

* WebKitTestRunner/InjectedBundle/ios/EventSenderProxyIOS.mm:
(WTR::EventSenderProxy::EventSenderProxy):
Drive-by: Rename `eventNumber` to `m_eventNumber` since it's a member variable.

* DumpRenderTree/Scripts/generate-derived-sources.sh:
* DumpRenderTree/DerivedSources.make:
* WebKitTestRunner/Scripts/generate-derived-sources.sh:
* WebKitTestRunner/DerivedSources.make:
Make sure to pass all feature flags when generating JS files from IDL files.

LayoutTests:

* fast/events/gesture/wheel-from-gesture.html: Added.
* fast/events/gesture/wheel-from-gesture-expected.txt: Added.

* TestExpectations:


Canonical link: https://commits.webkit.org/237933@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@277772 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-05-20 02:26:07 +00:00
Darin Adler c8156cc287 Move CFStringRef and NSString support from StringBuilder into StringConcatenateCF
https://bugs.webkit.org/show_bug.cgi?id=225839

Reviewed by Sam Weinig.

Source/JavaScriptCore:

* inspector/ConsoleMessage.cpp:
(Inspector::ConsoleMessage::ConsoleMessage): Use StringBuilder::clear instead of
StringBuilder::resize; no advantage to the latter after calling StringBuilder::toString.

* runtime/JSONObject.cpp:
(JSC::Stringifier::Holder::appendNextProperty): Update for name change of
StringBuilder::resize to StringBuilder::shrink.
* runtime/TypeSet.cpp:
(JSC::StructureShape::stringRepresentation): Ditto.

Source/WebCore:

* Modules/airplay/WebMediaSessionManager.cpp:
(WebCore::mediaProducerStateString): Use StringBuilder exclusively instead of
mixing it with makeString. Also updated for StringBuilder::shrink name.
* html/HTMLTextFormControlElement.cpp:
(WebCore::stripTrailingNewline): Updated for StringBuilder::shrink name.

* page/CaptionUserPreferencesMediaAF.cpp:
(WebCore::CaptionUserPreferencesMediaAF::captionsTextColor const): Tweaked
coding style a bit.
(WebCore::appendCSS): Use variadic StringBuilder::append instead of many
separate calls.
(WebCore::CaptionUserPreferencesMediaAF::captionsDefaultFontCSS const):
Tweaked coding style a bit, and use variadic StrinBuilder::append calls
to reduce the number of calls and streamline the code.
(WebCore::CaptionUserPreferencesMediaAF::captionsStyleSheetOverride const):
Ditto. Also removed unnecessary checks that strings are empty before appending.

* page/scrolling/ScrollingCoordinator.cpp:
(WebCore::ScrollingCoordinator::synchronousScrollingReasonsAsText):
Updated for StringBuilder::shrink name.

* platform/LayoutUnit.h: Updated for saturatedSum/Difference names.

* platform/network/cocoa/NetworkStorageSessionCocoa.mm:
(WebCore::NetworkStorageSession::cookiesForSession const): Tweaked codin
style a bit, and use variadic StrinBuilder::append calls to reduce the
number of calls and streamline the code.

* rendering/RenderCounter.cpp:
(WebCore::planCounter): Updated for saturatedSum name.
* style/StyleBuilderCustom.h:
(WebCore::Style::BuilderCustom::applyValueCounter): Ditto.

* svg/SVGPathStringBuilder.cpp:
(WebCore::SVGPathStringBuilder::result): Updated for StringBuilder::shrink name.
* testing/Internals.cpp:
(WebCore::Internals::pageMediaState): Ditto.
* xml/XSLTProcessorLibxslt.cpp:
(WebCore::saveResultToString): Ditto.

Source/WebKit:

* UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm:
(WebKit::WebsiteDataStore::platformSetNetworkParameters): Use makeString instead
of StringBuilder.

Source/WTF:

The new header makes CFStringRef and NSString work with string concatenation,
which means it now works with the variadic StringBuilder::append and makeString,
and still works with the single-argument StringBuilder::append. More efficient
that the old version because it does not allocate a temporary WTF::String for
the 16-bit character path.

Also made many other small improvements to the StringBuilder implementation.

* WTF.xcodeproj/project.pbxproj: Added StringConcatenateCF.h.

* wtf/CheckedArithmetic.h: Removed ConditionalCrashOnOverflow, which was only
here for use by StringBuilder, which does not use CheckedArithmetic any more.

* wtf/PlatformFTW.cmake: Added StringConcatenateCF.h..
* wtf/PlatformMac.cmake: Ditto.
* wtf/PlatformWin.cmake: Ditto.

* wtf/SaturatedArithmetic.h: Moved the contents of this file inside the
WTF namespace.
(WTF::signedAddInt32Overflows): Renamed this function. The type here is
important, and we are not doing anything to prevent type conversion or
create ambiguity, so it's good to be explicit in the function name.
(WTF::saturatedSum<int32_t>): Renamed this from saturatedAddition for
clarity. The function returns a sum, so that's a better name than calling
it "addition". Also, it's clearer to be explicit about the return type.
(WTF::signedSubtractInt32Overflows): Renamed. Same reason as above.
(WTF::saturatedDifference<int32_t>): Ditto.
(WTF::saturatedSum): Added. Does unsigned integer saturated addition.
This one can be written in a portable manner and still get really
efficient code on at least Intel and ARM64.
(WTF::saturatedSum): Added a function template that lets callers pass
larger number of arguments to saturatedSum, rather than exactly two.

* wtf/text/StringBuilder.cpp:
(WTF::expandedCapacity): Renamed to use the term capacity rather than
length for the new required capacity.
(WTF::StringBuilder::didOverflow): Implement the new approach to
overflow, meaning we need to write the CRASH() here explicitly and
in the non-crashing mode, set m_length.
(WTF::StringBuilder::reifyString const): Changed the overflow check
into a RELEASE_ASSERT. This is now responsible for doing the check that
callers were doing earlier, so we want it in production builds. Also
simplified this since our m_length member is a simple integer now,
and removed the unused m_isReified.
(WTF::StringBuilder::shrink): Renamed this to shrink to match the
Vector::shrink function, since this has never supported making the
builder larger. Removed unnecessary overflow checks, since shrinking
cannot cause overflow.
(WTF::StringBuilder::allocateBuffer): Replaced two separate functions
with a single simpler function template. Removed extra overflow checks
because the StringImpl::tryCreateUninitialized function already does
the only overflow check we need. Also move to StringImpl::copyCharacters
for copying characters rather than using std::memcpy directly.
Removed code to set m_is8Bit and m_bufferCharacters.
(WTF::StringBuilder::reallocateBuffer): Replaced two separate
functions with a function template and a cover that calls the
appropriate instance of the template for places where we aren't
already in character-type-specific code paths. This version now
supports allocating a buffer for the first time in cases where
we have m_string and not m_buffer, which used to be handled at
the higher level. Removed code to set m_bufferCharacters.
(WTF::StringBuilder::reserveCapacity): Rewrote for simplicity.
By relying on the overflow checking inside reallocateBuffer and
allocateBuffer we no longer need checking of the passed-in value
at this level.
(WTF::StringBuilder::extendBufferForAppending): Removed the
version of this that takes additionalLength since it's
potentially confusing to have a family of functions that have the
same name and take the same type of argument, but interpret it
subtly differently. Streamlined the code using std::exchange.
This function now also includes the logic from the function named
extendBufferForAppendingWithoutOverflowCheck, which was subtly
misnamed since that was not the only semantic difference. Also
removed the ALWAYS_INLINE because the compiler will do the right
thing without such heavy handed advice.
(WTF::StringBuilder::extendBufferForAppendingSlowCase): Streamlined
this by using std::exchange and removed additional overflow checks
at this level since reallocateBuffer already does them. Also added
a check for the case where the new total length is 0, which would
not be handled correctly and efficiently by reallocateBuffer.
(WTF::StringBuilder::extendBufferForAppendingLChar): Renamed this
from extendBufferForAppending8, since it's now identical to calling
extendBufferForAppending<LChar>, except for inlining and linkage.
(WTF::StringBuilder::extendBufferForAppendingWithUpconvert):
Renamed this from extendBufferForAppending16. It is different from
the other extendBuffer functions because is supports upconverting
from LChar to UChar. Like the others it relies on allocateBuffer
for the overflow checking.
(WTF::StringBuilder::appendCharacters): Removed an unnecessary
assertion that the characters pointer is non-null; that will fail
in an obvious way without an assertion. Simplified the logic and
removed some invariant assertions that don't help us much. Changed
overflow checking by using saturatedSum to compute the new length.
In overflow cases, the new sum will be larger than the maximum
string length, but will fit in an unsigned, so we can pass it
down to lower levels and let functions like reallocateBuffer do
the actual overflow checking. Also use StringImpl::copyCharacters.
(WTF::StringBuilder::append): Removed the CFStringRef overload.
(WTF::StringBuilder::shouldShrinkToFit const): Rename this from
canShrink. Simplify the function a bit and remove the vague FIXME
that says "this should be tuned". That may be so, but the FIXME
is not really driving us to action.
(WTF::StringBuilder::shrinkToFit): Simplify by using the new
reallocateBuffer and std::exchange. Removed unneeded assertion
about overflow that doesn't help us maintain the invariant.
(WTF::StringBuilder::isAllASCII const): Was tempted to remove
this function, but for now just made it use the StringView
version for brevity.

* wtf/text/StringBuilder.h: Removed many unneeded includes, and
notably included SaturatedArithmetic.h instead of
CheckedArithmetic.h because we now use the former instead of the
latter. Changed the overflow checking implementation to work
more simply based on saturated addition rather than Checked.
This allowed us to get rid of dependency on our own unique mode
for Checked, called ConditionalCrashOnOverflow. Removed a
comment about making a templatized version of StringBuilder.
We can do it if we like, but does not seem urgent. Moved
fucntion bodies out of the class definition so it's easier to
see what's going on in the class. Since m_length is now an
ordinary integer, the check for overflowed simply checks to see
if the length is larger than the maximum string length. When we
encounter overflow that is not about length computation, we set
the length to the maximum integer to indicate the failure.
Deleted the append overloads for CFStringRef and NSString.
Removed m_bufferCharacters, m_is8Bit, and m_isReified.
(WTF::StringBuilder::StringBuilder): Simplified the constructor
since we only have to initialize the m_shouldCrashOnOverflow member.
(WTF::StringBuilder::clear): Fixed a mistake where this was not
resetting the m_isReified flag.
(WTF::StringBuilder::swap): Updated for changes in the data members.
(WTF::StringBuilder::operator StringView const): Moved out of line.
Made sure to call the length() function so we crash if this is
called after overflow.
(WTF::StringBuilder::append): Remove some of the unnecessary checks
and special cases in the various versions of append. Most of the
checking is done inside appendCharacters, with only a few exceptions.
(WTF::StringBuilder::appendSubstring): Moved out of the class
definition without making significant changes.
(WTF::StringBuilder::appendCharacter): Ditto.
(WTF::StringBuilder::toString): Greatly simplified this function
by relying on overflow checking in the reifyString function instead
of doing it here and removing unneeded invariant assertions.
(WTF::StringBuilder::toStringPreserveCapacity const): Ditto.
(WTF::StringBuilder::toAtomString const): Rewrote this to streamline,
removing explicit overflow checks.
(WTF::StringBuilder::length const): Moved out of the class
definition without making significant changes.
(WTF::StringBuilder::capacity const): Ditto.
(WTF::StringBuilder::operator[] const): Ditto.
(WTF::StringBuilder::characters const): Implemented this operation
in the function template. Now rather than having this call the
characters8 and characters16 functions, they can call it.
(WTF::StringBuilder::getBufferCharacters<LChar>): Deleted.
(WTF::StringBuilder::getBufferCharacters<UChar>): Deleted.
(WTF::StringBuilder::appendFromAdapters): Use saturatedSum to
compute the required length, which allows the extendBuffer
functions to do overflow checking without having to take special
checked integer types for arguments.
(WTF::StringBuilder::equal): Implement using StringView.

* wtf/text/StringBuilderJSON.cpp:
(WTF::StringBuilder::appendQuotedJSONString): Simplified the checked
arithmetic for computing the required capacity. Updated since we
removed m_bufferCharacters and changed the type of m_length.

* wtf/text/cf/StringConcatenateCF.h: Added. Specializes StringTypeAdapter for
both CFStringRef and NSString *. If CFStringGetCStringPtr works for Latin-1, then
does the 8-bit code path, otherwise the 16-bit.

* wtf/text/cocoa/TextStreamCocoa.mm: Include StringConcatenateCF.h, since it's
now needed to use CFStringRef with StringBuilder.

Tools:

* TestWebKitAPI/Tests/WTF/SaturatedArithmeticOperations.cpp: Updated
tests for changes to SaturatedArithmetic.h.

* TestWebKitAPI/Tests/WTF/StringBuilder.cpp: Updated tests for changes
to StringBuilder.
* TestWebKitAPI/Tests/WebKit/GetUserMedia.mm:
(TestWebKitAPI::wkMediaCaptureStateString): Ditto.

* WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp:
Added include of StringConcatenateCF.h.
Added StringTypeAdapter for WKStringRef.
(WTR::styleDecToStr): Use ASCIILiteral instead of StringBuilder.
(WTR::string): Removed unneeded toWTFString since the WKStringRef
StringTypeAdapter takes care of it.
(WTR::string): Renamed from frameToStr. Use makeString.
(WTR::dumpResourceURL): Use append instead of appendLiteral.
(WTR::dumpFrameDescriptionSuitableForTestResult): Deleted.
(WTR::dumpLoadEvent): Use makeString.
(WTR::string): Renamed from a longer name. Return a String
instead of building in a StringBuilder. Use makeString.
(WTR::string): Ditto.
(WTR::dumpErrorDescriptionSuitableForTestResult): Removed
unneeded toWTFString.
(WTR::dumpFrameScrollPosition): Ditto.
(WTR::dumpDescendantFramesText): Ditto.
(WTR::InjectedBundlePage::dumpDOMAsWebArchive): Removed an
unneeded local variable.
(WTR::InjectedBundlePage::dump): Removed unneeded toWTFString.
(WTR::InjectedBundlePage::didReceiveTitleForFrame): Ditto.
(WTR::InjectedBundlePage::didFinishDocumentLoadForFrame):
Updated for functon name change.
(WTR::InjectedBundlePage::willSendRequestForFrame): Ditto.
Also use variadic append. Also use makeString.
(WTR::InjectedBundlePage::didReceiveResponseForResource): Ditto.
(WTR::InjectedBundlePage::didFinishLoadForResource): Ditto.
(WTR::InjectedBundlePage::didFailLoadForResource): Ditto.
(WTR::InjectedBundlePage::decidePolicyForNavigationAction): Ditto.
(WTR::InjectedBundlePage::decidePolicyForResponse): Ditto.
(WTR::InjectedBundlePage::willAddMessageToConsole): Ditto.
(WTR::InjectedBundlePage::willSetStatusbarText): Ditto.
(WTR::InjectedBundlePage::willRunJavaScriptPrompt): Ditto.
(WTR::InjectedBundlePage::didExceedDatabaseQuota): Ditto.
(WTR::InjectedBundlePage::shouldInsertNode): Ditto.
(WTR::InjectedBundlePage::shouldInsertText): Ditto.
(WTR::InjectedBundlePage::shouldDeleteRange): Ditto.
(WTR::InjectedBundlePage::shouldChangeSelectedRange): Ditto.
(WTR::InjectedBundlePage::shouldApplyStyle): Ditto.
(WTR::InjectedBundlePage::didBeginEditing): Ditto.
(WTR::InjectedBundlePage::didEndEditing): Ditto.
(WTR::InjectedBundlePage::didChange): Ditto.
(WTR::InjectedBundlePage::didChangeSelection): Ditto.
(WTR::InjectedBundlePage::dumpHistory): Ditto.

Canonical link: https://commits.webkit.org/237916@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@277744 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-05-19 19:37:21 +00:00
Alex Christensen 9615b64253 Unreviewed, reverting r277605.
Broke iOS tests

Reverted changeset:

"Remove _WKUserContentFilter and _WKUserContentExtensionStore"
https://bugs.webkit.org/show_bug.cgi?id=224391
https://commits.webkit.org/r277605


Canonical link: https://commits.webkit.org/237838@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@277627 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-05-18 01:33:52 +00:00
Alex Christensen c0681244b0 Remove _WKUserContentFilter and _WKUserContentExtensionStore
https://bugs.webkit.org/show_bug.cgi?id=224391

Patch by Alex Christensen <achristensen@webkit.org> on 2021-05-17
Reviewed by Darin Adler.

Source/WebKit:

I removed their use in rdar://75889414
They were replaced by WKContentRuleList and WKContentRuleListStore.

* UIProcess/API/Cocoa/WKUserContentController.mm:
(-[WKUserContentController _addUserContentFilter:]):
(-[WKUserContentController _removeAllUserContentFilters]):
* UIProcess/API/Cocoa/WKUserContentControllerPrivate.h:
* UIProcess/API/Cocoa/_WKUserContentExtensionStore.h:
* UIProcess/API/Cocoa/_WKUserContentExtensionStore.mm:
(+[_WKUserContentExtensionStore defaultStore]):
(+[_WKUserContentExtensionStore storeWithURL:]):
(-[_WKUserContentExtensionStore compileContentExtensionForIdentifier:encodedContentExtension:completionHandler:]):
(-[_WKUserContentExtensionStore lookupContentExtensionForIdentifier:completionHandler:]):
(-[_WKUserContentExtensionStore removeContentExtensionForIdentifier:completionHandler:]):
(toUserContentRuleListStoreError): Deleted.
(-[_WKUserContentExtensionStore _apiObject]): Deleted.
(-[_WKUserContentExtensionStore _removeAllContentExtensions]): Deleted.
(-[_WKUserContentExtensionStore _invalidateContentExtensionVersionForIdentifier:]): Deleted.
(-[_WKUserContentExtensionStore _initWithWKContentRuleListStore:]): Deleted.
(-[_WKUserContentExtensionStore _contentRuleListStore]): Deleted.
* UIProcess/API/Cocoa/_WKUserContentExtensionStoreInternal.h: Removed.
* UIProcess/API/Cocoa/_WKUserContentExtensionStorePrivate.h: Removed.
* UIProcess/API/Cocoa/_WKUserContentFilter.h:
* UIProcess/API/Cocoa/_WKUserContentFilter.mm:
(-[_WKUserContentFilter _initWithWKContentRuleList:]):
(-[_WKUserContentFilter _apiObject]): Deleted.
* UIProcess/API/Cocoa/_WKUserContentFilterInternal.h: Removed.
* UIProcess/API/Cocoa/_WKUserContentFilterPrivate.h: Removed.
* UIProcess/WebProcessPool.h:
* WebKit.xcodeproj/project.pbxproj:

Tools:

* MiniBrowser/mac/ExtensionManagerWindowController.m:
(-[ExtensionManagerWindowController init]):
(-[ExtensionManagerWindowController add:]):
(-[ExtensionManagerWindowController remove:]):
* TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
* TestWebKitAPI/Tests/WebKitCocoa/WebsitePolicies.mm:
(TEST):
* TestWebKitAPI/Tests/WebKitCocoa/_WKUserContentExtensionStore.mm: Removed.
These tests had already been copied to a version that uses WKContentRuleList.
* WebKitTestRunner/cocoa/TestControllerCocoa.mm:
(WTR::TestController::resetContentExtensions):
* WebKitTestRunner/mac/TestControllerMac.mm:
(WTR::TestController::configureContentExtensionForTest):

Canonical link: https://commits.webkit.org/237822@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@277605 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-05-17 21:13:58 +00:00
Ryosuke Niwa 0f56588ba3 Delete WebSQL code from WebKit2
https://bugs.webkit.org/show_bug.cgi?id=225739

Reviewed by Sihui Liu.

Source/WebCore:

* page/RuntimeEnabledFeatures.h:
(WebCore::RuntimeEnabledFeatures::setWebSQLEnabled): Replaced setWebSQLDisabled.

Source/WebKit:

Deleted WebSQL code. We keep some code for website data store since it's possible
for user's device to still have WebSQL data, and we should be able to delete them.

* NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp:
(WebKit::WebResourceLoadStatisticsStore::monitoredDataTypes):
* Shared/WebProcessDataStoreParameters.h:
(WebKit::WebProcessDataStoreParameters::encode const):
(WebKit::WebProcessDataStoreParameters::decode):
* UIProcess/API/C/WKPreferences.cpp:
(WKPreferencesSetWebSQLDisabled):
(WKPreferencesGetWebSQLDisabled):
* UIProcess/API/C/WKPreferencesRef.h:
* UIProcess/WebProcessPool.cpp:
(WebKit::WebProcessPool::webProcessDataStoreParameters):
* WebProcess/WebProcess.cpp:
(WebKit::WebProcess::setWebsiteDataStoreParameters):
* WebProcess/cocoa/WebProcessCocoa.mm:
(WebKit::WebProcess::platformSetWebsiteDataStoreParameters):

Source/WebKitLegacy/mac:

* WebView/WebView.mm:
(-[WebView _preferencesChanged:]):

Source/WebKitLegacy/win:

* WebView.cpp:
(WebView::notifyPreferencesChanged):

Source/WTF:

Deleted the experimental feature to disable WebSQL since we've been shipping this,
and made the flag to selectively enable WebSQL in WebKit1 an internal debug setting
since nobody should be enabling this now.

* Scripts/Preferences/WebPreferencesExperimental.yaml:
* Scripts/Preferences/WebPreferencesInternal.yaml:

Tools:

* MiniBrowser/playstation/WebContext.cpp:
(WebContext::WebContext):
* TestWebKitAPI/Tests/WebKitCocoa/WebsiteDataStoreCustomPaths.mm:
(runWebsiteDataStoreCustomPaths):
* WebKitTestRunner/TestController.cpp:
(WTR::TestController::configureWebsiteDataStoreTemporaryDirectories):


Canonical link: https://commits.webkit.org/237792@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@277564 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-05-16 06:36:30 +00:00