Commit Graph

3595 Commits

Author SHA1 Message Date
Adrien Destugues 0195b40b77 Merge commit 'e4390067fab9a407b0c303e04f03c77381cb2ddb' into Haiku 2021-08-30 17:59:07 +02: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 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
Cameron McCormack 05339fcdde Restore color profiles correctly on displays with multiple named modes
https://bugs.webkit.org/show_bug.cgi?id=228313
<rdar://problem/81146417>

Reviewed by Alexey Proskuryakov.

Look up a device's current color profile by checking the default mode
rather than assuming it is "1".  The device info dictionary returned
by ColorSyncDeviceCopyDeviceInfo has this shape:

{
    CustomProfiles = {
        ModeName1 = "file:///path/to/custom/profile.ics";
    };
    FactoryProfiles = {
        DeviceDefaultProfileID = "ModeName1";
        ModeName1 = {
            DeviceModeDescription = "Mode Name 1";
            DeviceProfileURL = "file:///path/to/factory/profile1.ics";
        };
        ModeName2 = {
            DeviceModeDescription = "Mode Name 2";
            DeviceProfileURL = "file:///path/to/factory/profile2.ics";
        };
    };
}

where CustomProfiles is only present if a custom profile has been
selected, and the default mode name is "1".  Displays connected over
HDMI don't use the default mode name.

* DumpRenderTree/mac/LayoutTestHelper.m:
(colorProfileURLForDisplay):


Canonical link: https://commits.webkit.org/240410@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@280871 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-08-10 23:51:39 +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
Adrien Destugues d6974a01e1 Merge commit '4c93d7c924a050bdef974543bb03c118cf962acc' into Haiku 2021-08-08 14:31:09 +02:00
Wenson Hsieh 42b5e59341 [macOS] Web process crashes when detaching Document with uncommitted marked text
https://bugs.webkit.org/show_bug.cgi?id=228841
rdar://79960890

Reviewed by Ryosuke Niwa.

Source/WebCore:

In the case where the document is in the process of being detached (underneath `willBeRemovedFromFrame()`), if
there is currently uncommitted marked text in the document, we will attempt to cancel the IME composition in the
process of clearing out the selection. On macOS, this calls into `Editor::cancelComposition()` which
subsequently triggers layout under various call stacks (DOM mutations, text event dispatch, and when scrolling
to reveal the selection); this triggers a security release assertion inside `Document::updateLayout()`.

To mitigate this, we avoid calling into this codepath if the Document no longer has a living render tree (i.e.,
the render tree has either been destroyed, is being destroyed, or has not been created yet).

Test: editing/inserting/remove-frame-with-marked-text.html

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

Source/WebKit:

Deploy a similar fix on iOS, to avoid any attempts to compute editor state due to discarding uncommitted marked
text during Document teardown. This is required in order to avoid the same security assertion when running the
new layout test on iOS.

* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::sendEditorStateUpdate):

Tools:

Make a small adjustment to DumpRenderTree, such that TextInputController targets the selected frame (or the main
frame, if there is no DOM selection). This behavior matches that of WebKitTestRunner, and allows layout tests
that use TextInputController to simulate setting marked text inside subframes.

* DumpRenderTree/mac/TextInputControllerMac.m:
(-[TextInputController selectedOrMainFrame]):
(-[TextInputController textInput]):

LayoutTests:

Add a layout test to exercise the crash.

* editing/inserting/remove-frame-with-marked-text-expected.txt: Added.
* editing/inserting/remove-frame-with-marked-text.html: Added.


Canonical link: https://commits.webkit.org/240347@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@280762 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-08-07 22:47:09 +00:00
Fujii Hironori 5722df7a9b [Win][DumpRenderTree] Clean up IndexedDB files between tests
https://bugs.webkit.org/show_bug.cgi?id=228692

Reviewed by Ryosuke Niwa.

storage/indexeddb/getdatabases.html was failing because it counted
up the remaining databases of previous tests.

Mac DRT removes IndexedDB after the testing (Bug 192796, r240358).
Win DRT also should do it.

* DumpRenderTree/win/DumpRenderTree.cpp:
(runTest): Call TestRunner::clearAllDatabases after the testing.

Canonical link: https://commits.webkit.org/240156@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@280524 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-08-02 02:46:00 +00:00
Adrien Destugues 3c03b69045 Merge commit 'e09283eaa2c87b3bb00c5380c76ccc1292a165c2' into Haiku branch 2021-08-01 10:58:52 +02: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
Adrien Destugues 89494020d1 Merge commit '6fbe35566296ef4716d35074d3ebb6ff71abb226' into HEAD 2021-06-29 18:42:07 +02:00
Adrien Destugues 333916fbb0 Merge commit 'bd708bb50d9feb3c098035e778f1f0b91d9b8112' into haiku branch 2021-06-20 18:56:20 +02:00
Adrien Destugues 4ca614559e Fix build after merge: removal of std::optional 2021-06-19 18:36:39 +02:00
Alex Christensen 1c6be76d45 Remove empty header WebTypesInternal.h
https://bugs.webkit.org/show_bug.cgi?id=227094

Reviewed by Fujii Hironori.

Source/WebKitLegacy:

* WebKitLegacy.xcodeproj/project.pbxproj:

Source/WebKitLegacy/mac:

* DefaultDelegates/WebDefaultUIDelegate.mm:
* History/WebBackForwardList.mm:
* History/WebHistory.mm:
* History/WebHistoryItem.mm:
* Misc/WebDownload.mm:
* Misc/WebElementDictionary.mm:
* Misc/WebNSDataExtras.h:
* Misc/WebTypesInternal.h: Removed.
* Plugins/WebBasePluginPackage.mm:
* Plugins/WebNetscapePluginPackage.mm:
* WebView/WebArchive.mm:
* WebView/WebDelegateImplementationCaching.h:
* WebView/WebHTMLRepresentation.mm:
* WebView/WebHTMLView.mm:
* WebView/WebPDFDocumentExtras.mm:
* WebView/WebPDFRepresentation.mm:
* WebView/WebTextCompletionController.mm:
* WebView/WebTextIterator.mm:
* WebView/WebViewData.h:
* WebView/WebViewInternal.h:

Tools:

* DumpRenderTree/mac/AccessibilityUIElementMac.mm:
* DumpRenderTree/mac/DumpRenderTreePasteboard.h:
* DumpRenderTree/mac/DumpRenderTreePasteboard.mm:
* DumpRenderTree/mac/TextInputControllerMac.m:



Canonical link: https://commits.webkit.org/238919@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@278993 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-06-17 17:05:13 +00:00
Adrien Destugues c6e4bb5d32 Merge commit '20307a3cb5047e4a3a5d1133a37d2db95a84164c' into HEAD 2021-06-12 20:52:37 +02:00
Fujii Hironori fbcb09ced1 [Win][DumpRenderTree] --no-timeout switch doesn't work
https://bugs.webkit.org/show_bug.cgi?id=226913

Reviewed by Don Olmstead.

r177542 added a variable 'useTimeoutWatchdog', but used nowhere.

* DumpRenderTree/win/DumpRenderTree.cpp:
* DumpRenderTree/win/DumpRenderTreeWin.h:
* DumpRenderTree/win/TestRunnerWin.cpp:
(TestRunner::setWaitToDump): Check useTimeoutWatchdog to start the timer.


Canonical link: https://commits.webkit.org/238762@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@278805 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-06-12 02:30:49 +00:00
Chris Dumez 66fb3851f1 Use `const uint8_t*` type more consistently to store bytes in WebKit
https://bugs.webkit.org/show_bug.cgi?id=226688

Reviewed by Darin Adler.

Source/WebCore:

* Modules/cache/DOMCache.cpp:
(WebCore::DOMCache::addAll):
(WebCore::DOMCache::put):
* Modules/fetch/FetchBodyConsumer.cpp:
(WebCore::FetchBodyConsumer::resolve):
(WebCore::FetchBodyConsumer::append):
* Modules/fetch/FetchBodyConsumer.h:
* Modules/mediastream/libwebrtc/LibWebRTCDataChannelHandler.cpp:
(WebCore::LibWebRTCDataChannelHandler::OnMessage):
* Modules/websockets/WebSocketChannel.cpp:
(WebCore::WebSocketChannel::send):
(WebCore::WebSocketChannel::didReceiveSocketStreamData):
(WebCore::WebSocketChannel::appendToBuffer):
(WebCore::WebSocketChannel::startClosingHandshake):
(WebCore::WebSocketChannel::processFrame):
(WebCore::WebSocketChannel::enqueueRawFrame):
(WebCore::WebSocketChannel::processOutgoingFrameQueue):
(WebCore::WebSocketChannel::sendFrame):
* Modules/websockets/WebSocketChannel.h:
* Modules/websockets/WebSocketDeflater.cpp:
(WebCore::setStreamParameter):
(WebCore::WebSocketDeflater::addBytes):
(WebCore::WebSocketInflater::addBytes):
(WebCore::WebSocketInflater::finish):
* Modules/websockets/WebSocketDeflater.h:
(WebCore::WebSocketDeflater::data):
(WebCore::WebSocketInflater::data):
* Modules/websockets/WebSocketFrame.cpp:
(WebCore::WebSocketFrame::parseFrame):
(WebCore::appendFramePayload):
(WebCore::WebSocketFrame::makeFrameData):
(WebCore::WebSocketFrame::WebSocketFrame):
* Modules/websockets/WebSocketFrame.h:
* Modules/websockets/WebSocketHandshake.cpp:
(WebCore::trimInputSample):
(WebCore::WebSocketHandshake::readServerHandshake):
(WebCore::WebSocketHandshake::readStatusLine):
(WebCore::WebSocketHandshake::readHTTPHeaders):
* Modules/websockets/WebSocketHandshake.h:
* Modules/websockets/WorkerThreadableWebSocketChannel.cpp:
(WebCore::WorkerThreadableWebSocketChannel::Bridge::send):
* contentextensions/SerializedNFA.cpp:
(WebCore::ContentExtensions::writeAllToFile):
* crypto/SubtleCrypto.cpp:
(WebCore::SubtleCrypto::unwrapKey):
* crypto/mac/SerializedCryptoKeyWrapMac.mm:
(WebCore::findMasterKey):
* dom/DecodedDataDocumentParser.cpp:
(WebCore::DecodedDataDocumentParser::appendBytes):
* dom/DecodedDataDocumentParser.h:
* dom/DocumentParser.h:
* dom/RawDataDocumentParser.h:
* html/ImageDocument.cpp:
(WebCore::ImageDocumentParser::appendBytes):
* html/MediaDocument.cpp:
(WebCore::MediaDocumentParser::appendBytes):
* html/PluginDocument.cpp:
(WebCore::PluginDocumentParser::appendBytes):
* html/track/InbandTextTrack.h:
* html/track/InbandWebVTTTextTrack.cpp:
(WebCore::InbandWebVTTTextTrack::parseWebVTTCueData):
* html/track/InbandWebVTTTextTrack.h:
* html/track/WebVTTParser.cpp:
(WebCore::WebVTTParser::parseBytes):
(WebCore::WebVTTParser::fileFinished):
* html/track/WebVTTParser.h:
* loader/DocumentWriter.cpp:
(WebCore::DocumentWriter::addData):
* loader/DocumentWriter.h:
* loader/SinkDocument.cpp:
* loader/TextTrackLoader.cpp:
(WebCore::TextTrackLoader::processNewCueData):
* platform/graphics/InbandTextTrackPrivateClient.h:
* platform/graphics/gstreamer/InbandTextTrackPrivateGStreamer.cpp:
(WebCore::InbandTextTrackPrivateGStreamer::notifyTrackOfSample):
* platform/network/HTTPParsers.cpp:
(WebCore::trimInputSample):
(WebCore::isValidHeaderNameCharacter):
(WebCore::parseHTTPHeader):
(WebCore::parseHTTPRequestBody):
* platform/network/HTTPParsers.h:
* platform/network/SocketStreamHandle.cpp:
(WebCore::SocketStreamHandle::sendData):
* platform/network/SocketStreamHandle.h:
* platform/network/SocketStreamHandleClient.h:
* platform/network/cf/SocketStreamHandleImplCFNet.cpp:
(WebCore::SocketStreamHandleImpl::readStreamCallback):
* svg/graphics/SVGImage.cpp:
(WebCore::SVGImage::dataChanged):

Source/WebKit:

* GPUProcess/media/RemoteTextTrackProxy.cpp:
(WebKit::RemoteTextTrackProxy::parseWebVTTCueData):
* GPUProcess/media/RemoteTextTrackProxy.h:
* WebProcess/GPU/media/TextTrackPrivateRemote.cpp:
(WebKit::TextTrackPrivateRemote::parseWebVTTCueData):


Canonical link: https://commits.webkit.org/238530@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@278532 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-06-06 05:25:41 +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
Adrien Destugues 8fe7de1f76 Merge commit '17e4ef947b901efe5b83003cb46fb9b6b67227c3' into Haiku branch 2021-05-25 20:01:40 +02:00
Sam Weinig 8827b78b01 Convert DestinationColorSpace from an enum to class wrapping a platform color space (CGColorSpaceRef for CG ports, etc.)
https://bugs.webkit.org/show_bug.cgi?id=226143

Reviewed by Darin Adler.

Source/WebCore:

Replace enumeration based DestinationColorSpace with a struct wrapping
a platform color space (CGColorSpaceRef for CG ports, etc.). For ports
that don't have a platform level color space type, a builtin PlatformColorSpace
type is provided that is just the old enum renamed to PlatformColorSpace::Name.

The goal of this change is to unify the currently bifurcated concept of an
ImageBuffer's color space, which previosly could either be based on the
DestinationColorSpace (and reflected in the colorSpace() member function),
or (for CG ports) based on a CGColorSpaceRef, with the colorSpace() function
returning sRGB even if the ImageBuffer was not.

* Headers.cmake:
* Modules/async-clipboard/ClipboardItemBindingsDataSource.cpp:
(WebCore::ClipboardItemBindingsDataSource::ClipboardItemTypeLoader::sanitizeDataIfNeeded):
* Modules/mediasession/MediaMetadata.cpp:
(WebCore::ArtworkImageLoader::notifyFinished):
* Sources.txt:
* WebCore.xcodeproj/project.pbxproj:
* bindings/js/SerializedScriptValue.cpp:
(WebCore::CloneSerializer::dumpImageBitmap):
(WebCore::CloneDeserializer::readImageBitmap):
* css/CSSFilterImageValue.cpp:
(WebCore::CSSFilterImageValue::image):
* html/CustomPaintCanvas.cpp:
(WebCore::CustomPaintCanvas::copiedImage const):
* html/CustomPaintImage.cpp:
(WebCore::CustomPaintImage::drawPattern):
* html/HTMLCanvasElement.cpp:
(WebCore::HTMLCanvasElement::toMediaSample):
(WebCore::HTMLCanvasElement::createImageBuffer const):
* html/HTMLVideoElement.cpp:
(WebCore::HTMLVideoElement::createBufferForPainting const):
* html/HTMLVideoElement.h:
* html/ImageBitmap.cpp:
(WebCore::ImageBitmap::createImageBuffer):
(WebCore::ImageBitmap::createPromise):
* html/OffscreenCanvas.cpp:
(WebCore::OffscreenCanvas::commitToPlaceholderCanvas):
* html/canvas/CanvasRenderingContext.cpp:
(WebCore::CanvasRenderingContext::colorSpace const):
* html/canvas/CanvasRenderingContext.h:
* html/canvas/CanvasRenderingContext2D.cpp:
* html/canvas/ImageBitmapRenderingContext.cpp:
(WebCore::ImageBitmapRenderingContext::setOutputBitmap):
* html/canvas/PredefinedColorSpace.cpp:
(WebCore::toDestinationColorSpace):
(WebCore::toPredefinedColorSpace):
* html/canvas/PredefinedColorSpace.h:
* html/canvas/WebGLRenderingContextBase.cpp:
(WebCore::WebGLRenderingContextBase::LRUImageBufferCache::imageBuffer):
* html/shadow/MediaControlTextTrackContainerElement.cpp:
(WebCore::MediaControlTextTrackContainerElement::createTextTrackRepresentationImage):
* inspector/InspectorCanvas.cpp:
(WebCore::InspectorCanvas::indexForData):
(WebCore::InspectorCanvas::buildArrayForCanvasPattern):
* page/Chrome.cpp:
(WebCore::Chrome::createImageBuffer const):
* page/Chrome.h:
* page/ChromeClient.h:
(WebCore::ChromeClient::createImageBuffer const):
* page/FrameSnapshotting.cpp:
(WebCore::snapshotFrameRectWithClip):
* page/PageColorSampler.cpp:
(WebCore::sampleColor):
* page/PageConsoleClient.cpp:
(WebCore::PageConsoleClient::screenshot):
* platform/HostWindow.h:
* platform/PlatformColorSpace.h: Added.
(WebCore::PlatformColorSpace::get const):
* platform/PlatformScreen.h:
* platform/ScreenProperties.h:
(WebCore::ScreenProperties::encode const):
(WebCore::ScreenData::encode const):
(WebCore::ScreenData::decode):
* platform/graphics/BitmapImage.cpp:
(WebCore::BitmapImage::preTransformedNativeImageForCurrentFrame):
(WebCore::BitmapImage::drawPattern):
* platform/graphics/Color.cpp:
(WebCore::Color::toColorComponentsInColorSpace const):
* platform/graphics/Color.h:
* platform/graphics/ColorConversion.cpp:
(WebCore::converColorComponents):
* platform/graphics/ColorConversion.h:
* platform/graphics/ColorSpace.cpp:
* platform/graphics/ColorSpace.h:
* platform/graphics/ConcreteImageBuffer.h:
(WebCore::ConcreteImageBuffer::create):
* platform/graphics/CrossfadeGeneratedImage.cpp:
(WebCore::CrossfadeGeneratedImage::drawPattern):
* platform/graphics/DestinationColorSpace.cpp: Added.
(WebCore::DestinationColorSpace::SRGB):
(WebCore::DestinationColorSpace::LinearSRGB):
(WebCore::DestinationColorSpace::DisplayP3):
(WebCore::DestinationColorSpace::DestinationColorSpace):
(WebCore::operator==):
(WebCore::operator!=):
(WebCore::operator<<):
* platform/graphics/DestinationColorSpace.h: Added.
(WebCore::DestinationColorSpace::platformColorSpace const):
(WebCore::DestinationColorSpace::encode const):
(WebCore::DestinationColorSpace::decode):
* platform/graphics/GradientImage.cpp:
(WebCore::GradientImage::drawPattern):
* platform/graphics/GraphicsContext.cpp:
(WebCore::GraphicsContext::clipToDrawingCommands):
* platform/graphics/GraphicsContext.h:
* platform/graphics/GraphicsContextImpl.h:
* platform/graphics/ImageBuffer.cpp:
(WebCore::ImageBuffer::create):
(WebCore::ImageBuffer::createCompatibleBuffer):
(WebCore::ImageBuffer::copyRectToBuffer):
* platform/graphics/ImageBuffer.h:
* platform/graphics/ImageBufferBackend.cpp:
(WebCore::ImageBufferBackend::getPixelBuffer const):
(WebCore::ImageBufferBackend::putPixelBuffer):
* platform/graphics/ImageBufferBackend.h:
(WebCore::ImageBufferBackend::transformColorSpace):
(WebCore::ImageBufferBackend::colorSpace const):
* platform/graphics/PixelBuffer.h:
(WebCore::PixelBuffer::decode):
* platform/graphics/PixelBufferConversion.cpp:
(WebCore::makeVImageCGImageFormat):
* platform/graphics/PixelBufferFormat.h:
(WebCore::PixelBufferFormat::decode):
* platform/graphics/RemoteVideoSample.cpp:
(WebCore::transferBGRAPixelBufferToIOSurface):
(WebCore::RemoteVideoSample::create):
(WebCore::RemoteVideoSample::RemoteVideoSample):
(WebCore::RemoteVideoSample::surface const):
* platform/graphics/RemoteVideoSample.h:
* platform/graphics/ShadowBlur.cpp:
(WebCore::ScratchBuffer::getScratchBuffer):
(WebCore::ShadowBlur::drawRectShadowWithoutTiling):
(WebCore::ShadowBlur::drawInsetShadowWithoutTiling):
(WebCore::ShadowBlur::drawRectShadowWithTiling):
(WebCore::ShadowBlur::drawInsetShadowWithTiling):
(WebCore::ShadowBlur::blurShadowBuffer):
(WebCore::ShadowBlur::drawShadowLayer):
* platform/graphics/angle/GraphicsContextGLANGLE.cpp:
(WebCore::GraphicsContextGLOpenGL::readPixelsForPaintResults):
* platform/graphics/cairo/ImageBufferCairoBackend.cpp:
(WebCore::ImageBufferCairoBackend::transformColorSpace):
* platform/graphics/cairo/ImageBufferCairoBackend.h:
* platform/graphics/cg/ColorCG.cpp:
(WebCore::convertToCGCompatibleComponents):
(WebCore::createCGColor):
(WebCore::platformConvertColorComponents):
* platform/graphics/cg/ColorSpaceCG.h:
(WebCore::cachedCGColorSpace): Deleted.
* platform/graphics/cg/GraphicsContextGLCG.cpp:
(WebCore::GraphicsContextGLOpenGL::paintToCanvas):
* platform/graphics/cg/IOSurfacePool.cpp:
(WebCore::surfaceMatchesParameters):
(WebCore::IOSurfacePool::takeSurface):
* platform/graphics/cg/IOSurfacePool.h:
* platform/graphics/cg/ImageBufferCGBackend.cpp:
(WebCore::createBitmapImageAfterScalingIfNeeded):
(WebCore::ImageBufferCGBackend::copyCGImageForEncoding const):
* platform/graphics/cg/ImageBufferCGBitmapBackend.cpp:
(WebCore::ImageBufferCGBitmapBackend::create):
(WebCore::ImageBufferCGBitmapBackend::copyNativeImage const):
* platform/graphics/cg/ImageBufferCGBitmapBackend.h:
* platform/graphics/cg/ImageBufferIOSurfaceBackend.cpp:
(WebCore::ImageBufferIOSurfaceBackend::create):
* platform/graphics/cg/ImageBufferIOSurfaceBackend.h:
* platform/graphics/cg/ImageBufferUtilitiesCG.cpp:
(WebCore::encode):
* platform/graphics/cg/NativeImageCG.cpp:
(WebCore::NativeImage::singlePixelSolidColor const):
* platform/graphics/cocoa/GraphicsContextGLOpenGLCocoa.mm:
(WebCore::GraphicsContextGLOpenGL::allocateAndBindDisplayBufferBacking):
* platform/graphics/cocoa/IOSurface.h:
* platform/graphics/cocoa/IOSurface.mm:
(WebCore::IOSurface::surfaceFromPool):
(WebCore::IOSurface::create):
(WebCore::IOSurface::createFromSendRight):
(WebCore::IOSurface::createFromSurface):
(WebCore::IOSurface::createFromImage):
(WebCore::IOSurface::createFromPixelBuffer):
(WebCore::IOSurface::IOSurface):
(WebCore::IOSurface::ensurePlatformContext):
(WebCore::IOSurface::migrateColorSpaceToProperties):
* platform/graphics/coreimage/FilterEffectRendererCoreImage.mm:
(WebCore::FilterEffectRendererCoreImage::renderToImageBuffer):
* platform/graphics/cv/ImageTransferSessionVT.mm:
(WebCore::ImageTransferSessionVT::createPixelBuffer):
* platform/graphics/cv/PixelBufferConformerCV.cpp:
(WebCore::PixelBufferConformerCV::createImageFromPixelBuffer):
* platform/graphics/displaylists/DisplayListImageBuffer.h:
(WebCore::DisplayList::ImageBuffer::create):
* platform/graphics/displaylists/DisplayListItemBuffer.cpp:
(WebCore::DisplayList::ItemHandle::destroy):
* platform/graphics/displaylists/DisplayListItems.h:
(WebCore::DisplayList::BeginClipToDrawingCommands::BeginClipToDrawingCommands):
(WebCore::DisplayList::BeginClipToDrawingCommands::colorSpace const):
(WebCore::DisplayList::BeginClipToDrawingCommands::encode const):
(WebCore::DisplayList::BeginClipToDrawingCommands::decode):
(WebCore::DisplayList::GetPixelBuffer::GetPixelBuffer):
(WebCore::DisplayList::GetPixelBuffer::outputFormat const):
(WebCore::DisplayList::GetPixelBuffer::encode const):
(WebCore::DisplayList::GetPixelBuffer::decode):
* platform/graphics/displaylists/DisplayListRecorder.cpp:
(WebCore::DisplayList::Recorder::clipToDrawingCommands):
* platform/graphics/displaylists/DisplayListRecorder.h:
* platform/graphics/filters/FEDisplacementMap.cpp:
(WebCore::FEDisplacementMap::setResultColorSpace):
* platform/graphics/filters/FEDisplacementMap.h:
* platform/graphics/filters/FEFlood.h:
* platform/graphics/filters/FETile.cpp:
(WebCore::FETile::platformApplySoftware):
* platform/graphics/filters/FilterEffect.cpp:
(WebCore::FilterEffect::convertPixelBufferToColorSpace):
(WebCore::FilterEffect::convertImageBufferToColorSpace):
(WebCore::FilterEffect::copyConvertedImageBufferToDestination):
(WebCore::FilterEffect::copyConvertedPixelBufferToDestination):
(WebCore::FilterEffect::requiresPixelBufferColorSpaceConversion):
(WebCore::FilterEffect::transformResultColorSpace):
* platform/graphics/filters/FilterEffect.h:
(WebCore::FilterEffect::operatingColorSpace const):
(WebCore::FilterEffect::setOperatingColorSpace):
(WebCore::FilterEffect::resultColorSpace const):
(WebCore::FilterEffect::setResultColorSpace):
* platform/graphics/filters/SourceGraphic.h:
(WebCore::SourceGraphic::SourceGraphic):
* platform/gtk/PlatformScreenGtk.cpp:
(WebCore::screenColorSpace):
* platform/ios/PlatformScreenIOS.mm:
(WebCore::screenColorSpace):
(WebCore::collectScreenProperties):
* platform/mac/PlatformScreenMac.mm:
(WebCore::collectScreenProperties):
(WebCore::screenColorSpace):
* platform/mac/ThemeMac.mm:
(WebCore::ThemeMac::drawCellOrFocusRingWithViewIntoContext):
* platform/mediastream/mac/ScreenDisplayCapturerMac.mm:
(WebCore::ScreenDisplayCapturerMac::createDisplayStream):
* platform/mock/MockRealtimeVideoSource.cpp:
(WebCore::MockRealtimeVideoSource::imageBuffer const):
* platform/playstation/PlatformScreenPlayStation.cpp:
(WebCore::screenColorSpace):
* platform/win/PlatformScreenWin.cpp:
(WebCore::screenColorSpace):
* platform/wpe/PlatformScreenWPE.cpp:
(WebCore::screenColorSpace):
* platform/xr/PlatformXR.h:
(PlatformXR::Device::FrameData::LayerData::decode):
* rendering/CSSFilter.cpp:
(WebCore::CSSFilter::buildReferenceFilter):
(WebCore::CSSFilter::build):
(WebCore::CSSFilter::allocateBackingStoreIfNeeded):
(WebCore::CSSFilter::apply):
* rendering/RenderBoxModelObject.cpp:
(WebCore::RenderBoxModelObject::paintFillLayerExtended):
* rendering/RenderLayerBacking.cpp:
(WebCore::patternForDescription):
* rendering/RenderThemeIOS.mm:
(WebCore::RenderThemeIOS::paintSystemPreviewBadge):
* rendering/RenderThemeMac.mm:
(WebCore::RenderThemeMac::paintProgressBar):
* rendering/shapes/Shape.cpp:
(WebCore::Shape::createRasterShape):
* rendering/svg/RenderSVGResourceClipper.cpp:
(WebCore::RenderSVGResourceClipper::applyClippingToContext):
* rendering/svg/RenderSVGResourceFilter.cpp:
(WebCore::RenderSVGResourceFilter::buildPrimitives const):
(WebCore::RenderSVGResourceFilter::applyResource):
(WebCore::RenderSVGResourceFilter::postApplyResource):
* rendering/svg/RenderSVGResourceGradient.cpp:
(WebCore::createMaskAndSwapContextForTextGradient):
* rendering/svg/RenderSVGResourceMasker.cpp:
(WebCore::RenderSVGResourceMasker::applyResource):
(WebCore::RenderSVGResourceMasker::drawContentIntoMaskImage):
* rendering/svg/RenderSVGResourceMasker.h:
* rendering/svg/RenderSVGResourcePattern.cpp:
(WebCore::RenderSVGResourcePattern::createTileImage const):
* rendering/svg/SVGRenderingContext.cpp:
(WebCore::SVGRenderingContext::createImageBuffer):
(WebCore::SVGRenderingContext::bufferForeground):
* rendering/svg/SVGRenderingContext.h:
* svg/graphics/SVGImage.cpp:
(WebCore::SVGImage::nativeImage):
(WebCore::SVGImage::drawPatternForContainer):
* svg/graphics/filters/SVGFEImage.cpp:
(WebCore::FEImage::platformApplySoftware):

Source/WebCore/PAL:

* pal/spi/cg/CoreGraphicsSPI.h:
Add addional SPI for working with CGColorSpaceRefs.

Source/WebKit:

- Update ImageBuffer subclass signatures to use "const DestinationColorSpace&" to
  conform to the base class.
- Replace ColorSpaceData with Optional<DestinationColorSpace>. No reason to have two
  types that are the same.
- Give all ports a color space configuration for ShareableBitmap now that there is
  a common class for representing color space.
- Update DisplayList decoding to account for BeginClipToDrawingCommands and GetPixelBuffer
  no longer being inlineable due to now having non-trivial destructors due to
  DestinationColorSpace member.

* GPUProcess/graphics/RemoteImageBuffer.h:
(WebKit::RemoteImageBuffer::create):
* GPUProcess/graphics/RemoteRenderingBackend.cpp:
(WebKit::RemoteRenderingBackend::createImageBuffer):
* GPUProcess/graphics/RemoteRenderingBackend.h:
* GPUProcess/media/RemoteImageDecoderAVFProxy.cpp:
(WebKit::RemoteImageDecoderAVFProxy::createFrameImageAtIndex):
* GPUProcess/media/RemoteImageDecoderAVFProxy.h:
* GPUProcess/media/RemoteImageDecoderAVFProxy.messages.in:
* Shared/RemoteLayerTree/RemoteLayerBackingStore.mm:
(WebKit::RemoteLayerBackingStore::swapToValidFrontBuffer):
(WebKit::RemoteLayerBackingStore::applyBackingStoreToLayer):
* Shared/ShareableBitmap.cpp:
(WebKit::ShareableBitmap::Configuration::encode const):
(WebKit::ShareableBitmap::Configuration::decode):
* Shared/ShareableBitmap.h:
* Shared/WebCoreArgumentCoders.h:
* Shared/WebPageCreationParameters.cpp:
(WebKit::WebPageCreationParameters::decode):
* Shared/WebPageCreationParameters.h:
* Shared/cg/ShareableBitmapCG.cpp:
(WebKit::colorSpace):
* Shared/mac/ColorSpaceData.h: Removed.
* Shared/mac/ColorSpaceData.mm: Removed.
* SourcesCocoa.txt:
* UIProcess/API/ios/WKWebViewIOS.mm:
(-[WKWebView _takeViewSnapshot]):
(-[WKWebView _snapshotRect:intoImageOfWidth:completionHandler:]):
* UIProcess/Cocoa/WebViewImpl.h:
* UIProcess/Cocoa/WebViewImpl.mm:
(WebKit::WebViewImpl::colorSpace):
* UIProcess/PageClient.h:
* UIProcess/RemoteLayerTree/RemoteLayerTreeHost.mm:
(WebKit::recursivelyMapIOSurfaceBackingStore):
* UIProcess/WebPageProxy.h:
* UIProcess/mac/PageClientImplMac.h:
* UIProcess/mac/PageClientImplMac.mm:
(WebKit::PageClientImpl::colorSpace):
* UIProcess/mac/TiledCoreAnimationDrawingAreaProxy.mm:
* UIProcess/mac/WebPageProxyMac.mm:
(WebKit::WebPageProxy::colorSpace):
* WebKit.xcodeproj/project.pbxproj:
* WebProcess/GPU/graphics/ImageBufferShareableBitmapBackend.cpp:
(WebKit::ImageBufferShareableBitmapBackend::configuration):
* WebProcess/GPU/graphics/RemoteGraphicsContextGLProxy.cpp:
(WebKit::RemoteGraphicsContextGLProxy::prepareForDisplay):
* WebProcess/GPU/graphics/RemoteImageBufferProxy.h:
(WebKit::RemoteImageBufferProxy::create):
* WebProcess/GPU/graphics/RemoteRenderingBackendProxy.cpp:
(WebKit::RemoteRenderingBackendProxy::createImageBuffer):
* WebProcess/GPU/graphics/RemoteRenderingBackendProxy.h:
* WebProcess/GPU/graphics/cocoa/ImageBufferShareableMappedIOSurfaceBackend.cpp:
(WebKit::ImageBufferShareableMappedIOSurfaceBackend::create):
* WebProcess/GPU/media/RemoteImageDecoderAVF.cpp:
(WebKit::RemoteImageDecoderAVF::createFrameImageAtIndex):
* WebProcess/GPU/media/cocoa/MediaPlayerPrivateRemoteCocoa.mm:
(WebKit::MediaPlayerPrivateRemote::nativeImageForCurrentTime):
(WebKit::MediaPlayerPrivateRemote::pixelBufferForCurrentTime):
* WebProcess/Plugins/PDF/PDFPlugin.mm:
(WebKit::PDFPlugin::PDFPlugin):
* WebProcess/WebCoreSupport/ShareableBitmapUtilities.cpp:
(WebKit::createShareableBitmap):
* WebProcess/WebCoreSupport/WebChromeClient.cpp:
(WebKit::WebChromeClient::createImageBuffer const):
* WebProcess/WebCoreSupport/WebChromeClient.h:
* WebProcess/WebCoreSupport/mac/WebDragClientMac.mm:
(WebKit::convertDragImageToBitmap):
* WebProcess/WebPage/DrawingArea.h:
(WebKit::DrawingArea::setColorSpace):
* WebProcess/WebPage/DrawingArea.messages.in:
* WebProcess/WebPage/WebPage.cpp:
(WebKit::snapshotOptionsToBitmapConfiguration):
* WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.h:
* WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm:
(WebKit::TiledCoreAnimationDrawingArea::TiledCoreAnimationDrawingArea):
(WebKit::TiledCoreAnimationDrawingArea::setColorSpace):

Source/WebKitLegacy/mac:

* WebCoreSupport/WebContextMenuClient.mm:
(WebContextMenuClient::imageForCurrentSharingServicePickerItem):
Update for new DestinationColorSpace class.

Tools:

* TestWebKitAPI/Tests/WebCore/cg/DisplayListTestsCG.cpp:
(TestWebKitAPI::TEST):
Upate test to use new DestinationColorSpace type.


Canonical link: https://commits.webkit.org/238099@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@277986 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-05-25 01:26:18 +00:00
Commit Queue 403b09d9be Unreviewed, reverting r277940.
https://bugs.webkit.org/show_bug.cgi?id=226182

Caused Safari crash under IPC::typeFromCFTypeRef

Reverted changeset:

"Convert DestinationColorSpace from an enum to class wrapping
a platform color space (CGColorSpaceRef for CG ports, etc.)"
https://bugs.webkit.org/show_bug.cgi?id=226143
https://trac.webkit.org/changeset/277940

Canonical link: https://commits.webkit.org/238086@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@277961 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-05-24 18:54:26 +00:00
Sam Weinig a336c84fdc Convert DestinationColorSpace from an enum to class wrapping a platform color space (CGColorSpaceRef for CG ports, etc.)
https://bugs.webkit.org/show_bug.cgi?id=226143

Reviewed by Darin Adler.

Source/WebCore:

Replace enumeration based DestinationColorSpace with a struct wrapping
a platform color space (CGColorSpaceRef for CG ports, etc.). For ports
that don't have a platform level color space type, a builtin PlatformColorSpace
type is provided that is just the old enum renamed to PlatformColorSpace::Name.

The goal of this change is to unify the currently bifurcated concept of an
ImageBuffer's color space, which previosly could either be based on the
DestinationColorSpace (and reflected in the colorSpace() member function),
or (for CG ports) based on a CGColorSpaceRef, with the colorSpace() function
returning sRGB even if the ImageBuffer was not.

* Headers.cmake:
* Modules/async-clipboard/ClipboardItemBindingsDataSource.cpp:
(WebCore::ClipboardItemBindingsDataSource::ClipboardItemTypeLoader::sanitizeDataIfNeeded):
* Modules/mediasession/MediaMetadata.cpp:
(WebCore::ArtworkImageLoader::notifyFinished):
* Sources.txt:
* WebCore.xcodeproj/project.pbxproj:
* bindings/js/SerializedScriptValue.cpp:
(WebCore::CloneSerializer::dumpImageBitmap):
(WebCore::CloneDeserializer::readImageBitmap):
* css/CSSFilterImageValue.cpp:
(WebCore::CSSFilterImageValue::image):
* html/CustomPaintCanvas.cpp:
(WebCore::CustomPaintCanvas::copiedImage const):
* html/CustomPaintImage.cpp:
(WebCore::CustomPaintImage::drawPattern):
* html/HTMLCanvasElement.cpp:
(WebCore::HTMLCanvasElement::toMediaSample):
(WebCore::HTMLCanvasElement::createImageBuffer const):
* html/HTMLVideoElement.cpp:
(WebCore::HTMLVideoElement::createBufferForPainting const):
* html/HTMLVideoElement.h:
* html/ImageBitmap.cpp:
(WebCore::ImageBitmap::createImageBuffer):
(WebCore::ImageBitmap::createPromise):
* html/OffscreenCanvas.cpp:
(WebCore::OffscreenCanvas::commitToPlaceholderCanvas):
* html/canvas/CanvasRenderingContext.cpp:
(WebCore::CanvasRenderingContext::colorSpace const):
* html/canvas/CanvasRenderingContext.h:
* html/canvas/CanvasRenderingContext2D.cpp:
* html/canvas/ImageBitmapRenderingContext.cpp:
(WebCore::ImageBitmapRenderingContext::setOutputBitmap):
* html/canvas/PredefinedColorSpace.cpp:
(WebCore::toDestinationColorSpace):
(WebCore::toPredefinedColorSpace):
* html/canvas/PredefinedColorSpace.h:
* html/canvas/WebGLRenderingContextBase.cpp:
(WebCore::WebGLRenderingContextBase::LRUImageBufferCache::imageBuffer):
* html/shadow/MediaControlTextTrackContainerElement.cpp:
(WebCore::MediaControlTextTrackContainerElement::createTextTrackRepresentationImage):
* inspector/InspectorCanvas.cpp:
(WebCore::InspectorCanvas::indexForData):
(WebCore::InspectorCanvas::buildArrayForCanvasPattern):
* page/Chrome.cpp:
(WebCore::Chrome::createImageBuffer const):
* page/Chrome.h:
* page/ChromeClient.h:
(WebCore::ChromeClient::createImageBuffer const):
* page/FrameSnapshotting.cpp:
(WebCore::snapshotFrameRectWithClip):
* page/PageColorSampler.cpp:
(WebCore::sampleColor):
* page/PageConsoleClient.cpp:
(WebCore::PageConsoleClient::screenshot):
* platform/HostWindow.h:
* platform/PlatformColorSpace.h: Added.
(WebCore::PlatformColorSpace::get const):
* platform/PlatformScreen.h:
* platform/ScreenProperties.h:
(WebCore::ScreenProperties::encode const):
(WebCore::ScreenData::encode const):
(WebCore::ScreenData::decode):
* platform/graphics/BitmapImage.cpp:
(WebCore::BitmapImage::preTransformedNativeImageForCurrentFrame):
(WebCore::BitmapImage::drawPattern):
* platform/graphics/Color.cpp:
(WebCore::Color::toColorComponentsInColorSpace const):
* platform/graphics/Color.h:
* platform/graphics/ColorConversion.cpp:
(WebCore::converColorComponents):
* platform/graphics/ColorConversion.h:
* platform/graphics/ColorSpace.cpp:
* platform/graphics/ColorSpace.h:
* platform/graphics/ConcreteImageBuffer.h:
(WebCore::ConcreteImageBuffer::create):
* platform/graphics/CrossfadeGeneratedImage.cpp:
(WebCore::CrossfadeGeneratedImage::drawPattern):
* platform/graphics/DestinationColorSpace.cpp: Added.
(WebCore::DestinationColorSpace::SRGB):
(WebCore::DestinationColorSpace::LinearSRGB):
(WebCore::DestinationColorSpace::DisplayP3):
(WebCore::DestinationColorSpace::DestinationColorSpace):
(WebCore::operator==):
(WebCore::operator!=):
(WebCore::operator<<):
* platform/graphics/DestinationColorSpace.h: Added.
(WebCore::DestinationColorSpace::platformColorSpace const):
(WebCore::DestinationColorSpace::encode const):
(WebCore::DestinationColorSpace::decode):
* platform/graphics/GradientImage.cpp:
(WebCore::GradientImage::drawPattern):
* platform/graphics/GraphicsContext.cpp:
(WebCore::GraphicsContext::clipToDrawingCommands):
* platform/graphics/GraphicsContext.h:
* platform/graphics/GraphicsContextImpl.h:
* platform/graphics/ImageBuffer.cpp:
(WebCore::ImageBuffer::create):
(WebCore::ImageBuffer::createCompatibleBuffer):
(WebCore::ImageBuffer::copyRectToBuffer):
* platform/graphics/ImageBuffer.h:
* platform/graphics/ImageBufferBackend.cpp:
(WebCore::ImageBufferBackend::getPixelBuffer const):
(WebCore::ImageBufferBackend::putPixelBuffer):
* platform/graphics/ImageBufferBackend.h:
(WebCore::ImageBufferBackend::transformColorSpace):
(WebCore::ImageBufferBackend::colorSpace const):
* platform/graphics/PixelBuffer.h:
(WebCore::PixelBuffer::decode):
* platform/graphics/PixelBufferConversion.cpp:
(WebCore::makeVImageCGImageFormat):
* platform/graphics/PixelBufferFormat.h:
(WebCore::PixelBufferFormat::decode):
* platform/graphics/RemoteVideoSample.cpp:
(WebCore::transferBGRAPixelBufferToIOSurface):
(WebCore::RemoteVideoSample::create):
(WebCore::RemoteVideoSample::RemoteVideoSample):
(WebCore::RemoteVideoSample::surface const):
* platform/graphics/RemoteVideoSample.h:
* platform/graphics/ShadowBlur.cpp:
(WebCore::ScratchBuffer::getScratchBuffer):
(WebCore::ShadowBlur::drawRectShadowWithoutTiling):
(WebCore::ShadowBlur::drawInsetShadowWithoutTiling):
(WebCore::ShadowBlur::drawRectShadowWithTiling):
(WebCore::ShadowBlur::drawInsetShadowWithTiling):
(WebCore::ShadowBlur::blurShadowBuffer):
(WebCore::ShadowBlur::drawShadowLayer):
* platform/graphics/angle/GraphicsContextGLANGLE.cpp:
(WebCore::GraphicsContextGLOpenGL::readPixelsForPaintResults):
* platform/graphics/cairo/ImageBufferCairoBackend.cpp:
(WebCore::ImageBufferCairoBackend::transformColorSpace):
* platform/graphics/cairo/ImageBufferCairoBackend.h:
* platform/graphics/cg/ColorCG.cpp:
(WebCore::convertToCGCompatibleComponents):
(WebCore::createCGColor):
(WebCore::platformConvertColorComponents):
* platform/graphics/cg/ColorSpaceCG.h:
(WebCore::cachedCGColorSpace): Deleted.
* platform/graphics/cg/GraphicsContextGLCG.cpp:
(WebCore::GraphicsContextGLOpenGL::paintToCanvas):
* platform/graphics/cg/IOSurfacePool.cpp:
(WebCore::surfaceMatchesParameters):
(WebCore::IOSurfacePool::takeSurface):
* platform/graphics/cg/IOSurfacePool.h:
* platform/graphics/cg/ImageBufferCGBackend.cpp:
(WebCore::createBitmapImageAfterScalingIfNeeded):
(WebCore::ImageBufferCGBackend::copyCGImageForEncoding const):
* platform/graphics/cg/ImageBufferCGBitmapBackend.cpp:
(WebCore::ImageBufferCGBitmapBackend::create):
(WebCore::ImageBufferCGBitmapBackend::copyNativeImage const):
* platform/graphics/cg/ImageBufferCGBitmapBackend.h:
* platform/graphics/cg/ImageBufferIOSurfaceBackend.cpp:
(WebCore::ImageBufferIOSurfaceBackend::create):
* platform/graphics/cg/ImageBufferIOSurfaceBackend.h:
* platform/graphics/cg/ImageBufferUtilitiesCG.cpp:
(WebCore::encode):
* platform/graphics/cg/NativeImageCG.cpp:
(WebCore::NativeImage::singlePixelSolidColor const):
* platform/graphics/cocoa/GraphicsContextGLOpenGLCocoa.mm:
(WebCore::GraphicsContextGLOpenGL::allocateAndBindDisplayBufferBacking):
* platform/graphics/cocoa/IOSurface.h:
* platform/graphics/cocoa/IOSurface.mm:
(WebCore::IOSurface::surfaceFromPool):
(WebCore::IOSurface::create):
(WebCore::IOSurface::createFromSendRight):
(WebCore::IOSurface::createFromSurface):
(WebCore::IOSurface::createFromImage):
(WebCore::IOSurface::createFromPixelBuffer):
(WebCore::IOSurface::IOSurface):
(WebCore::IOSurface::ensurePlatformContext):
(WebCore::IOSurface::migrateColorSpaceToProperties):
* platform/graphics/coreimage/FilterEffectRendererCoreImage.mm:
(WebCore::FilterEffectRendererCoreImage::renderToImageBuffer):
* platform/graphics/cv/ImageTransferSessionVT.mm:
(WebCore::ImageTransferSessionVT::createPixelBuffer):
* platform/graphics/cv/PixelBufferConformerCV.cpp:
(WebCore::PixelBufferConformerCV::createImageFromPixelBuffer):
* platform/graphics/displaylists/DisplayListImageBuffer.h:
(WebCore::DisplayList::ImageBuffer::create):
* platform/graphics/displaylists/DisplayListItemBuffer.cpp:
(WebCore::DisplayList::ItemHandle::destroy):
* platform/graphics/displaylists/DisplayListItems.h:
(WebCore::DisplayList::BeginClipToDrawingCommands::BeginClipToDrawingCommands):
(WebCore::DisplayList::BeginClipToDrawingCommands::colorSpace const):
(WebCore::DisplayList::BeginClipToDrawingCommands::encode const):
(WebCore::DisplayList::BeginClipToDrawingCommands::decode):
(WebCore::DisplayList::GetPixelBuffer::GetPixelBuffer):
(WebCore::DisplayList::GetPixelBuffer::outputFormat const):
(WebCore::DisplayList::GetPixelBuffer::encode const):
(WebCore::DisplayList::GetPixelBuffer::decode):
* platform/graphics/displaylists/DisplayListRecorder.cpp:
(WebCore::DisplayList::Recorder::clipToDrawingCommands):
* platform/graphics/displaylists/DisplayListRecorder.h:
* platform/graphics/filters/FEDisplacementMap.cpp:
(WebCore::FEDisplacementMap::setResultColorSpace):
* platform/graphics/filters/FEDisplacementMap.h:
* platform/graphics/filters/FEFlood.h:
* platform/graphics/filters/FETile.cpp:
(WebCore::FETile::platformApplySoftware):
* platform/graphics/filters/FilterEffect.cpp:
(WebCore::FilterEffect::convertPixelBufferToColorSpace):
(WebCore::FilterEffect::convertImageBufferToColorSpace):
(WebCore::FilterEffect::copyConvertedImageBufferToDestination):
(WebCore::FilterEffect::copyConvertedPixelBufferToDestination):
(WebCore::FilterEffect::requiresPixelBufferColorSpaceConversion):
(WebCore::FilterEffect::transformResultColorSpace):
* platform/graphics/filters/FilterEffect.h:
(WebCore::FilterEffect::operatingColorSpace const):
(WebCore::FilterEffect::setOperatingColorSpace):
(WebCore::FilterEffect::resultColorSpace const):
(WebCore::FilterEffect::setResultColorSpace):
* platform/graphics/filters/SourceGraphic.h:
(WebCore::SourceGraphic::SourceGraphic):
* platform/gtk/PlatformScreenGtk.cpp:
(WebCore::screenColorSpace):
* platform/ios/PlatformScreenIOS.mm:
(WebCore::screenColorSpace):
(WebCore::collectScreenProperties):
* platform/mac/PlatformScreenMac.mm:
(WebCore::collectScreenProperties):
(WebCore::screenColorSpace):
* platform/mac/ThemeMac.mm:
(WebCore::ThemeMac::drawCellOrFocusRingWithViewIntoContext):
* platform/mediastream/mac/ScreenDisplayCapturerMac.mm:
(WebCore::ScreenDisplayCapturerMac::createDisplayStream):
* platform/mock/MockRealtimeVideoSource.cpp:
(WebCore::MockRealtimeVideoSource::imageBuffer const):
* platform/playstation/PlatformScreenPlayStation.cpp:
(WebCore::screenColorSpace):
* platform/win/PlatformScreenWin.cpp:
(WebCore::screenColorSpace):
* platform/wpe/PlatformScreenWPE.cpp:
(WebCore::screenColorSpace):
* platform/xr/PlatformXR.h:
(PlatformXR::Device::FrameData::LayerData::decode):
* rendering/CSSFilter.cpp:
(WebCore::CSSFilter::buildReferenceFilter):
(WebCore::CSSFilter::build):
(WebCore::CSSFilter::allocateBackingStoreIfNeeded):
(WebCore::CSSFilter::apply):
* rendering/RenderBoxModelObject.cpp:
(WebCore::RenderBoxModelObject::paintFillLayerExtended):
* rendering/RenderLayerBacking.cpp:
(WebCore::patternForDescription):
* rendering/RenderThemeIOS.mm:
(WebCore::RenderThemeIOS::paintSystemPreviewBadge):
* rendering/RenderThemeMac.mm:
(WebCore::RenderThemeMac::paintProgressBar):
* rendering/shapes/Shape.cpp:
(WebCore::Shape::createRasterShape):
* rendering/svg/RenderSVGResourceClipper.cpp:
(WebCore::RenderSVGResourceClipper::applyClippingToContext):
* rendering/svg/RenderSVGResourceFilter.cpp:
(WebCore::RenderSVGResourceFilter::buildPrimitives const):
(WebCore::RenderSVGResourceFilter::applyResource):
(WebCore::RenderSVGResourceFilter::postApplyResource):
* rendering/svg/RenderSVGResourceGradient.cpp:
(WebCore::createMaskAndSwapContextForTextGradient):
* rendering/svg/RenderSVGResourceMasker.cpp:
(WebCore::RenderSVGResourceMasker::applyResource):
(WebCore::RenderSVGResourceMasker::drawContentIntoMaskImage):
* rendering/svg/RenderSVGResourceMasker.h:
* rendering/svg/RenderSVGResourcePattern.cpp:
(WebCore::RenderSVGResourcePattern::createTileImage const):
* rendering/svg/SVGRenderingContext.cpp:
(WebCore::SVGRenderingContext::createImageBuffer):
(WebCore::SVGRenderingContext::bufferForeground):
* rendering/svg/SVGRenderingContext.h:
* svg/graphics/SVGImage.cpp:
(WebCore::SVGImage::nativeImage):
(WebCore::SVGImage::drawPatternForContainer):
* svg/graphics/filters/SVGFEImage.cpp:
(WebCore::FEImage::platformApplySoftware):

Source/WebCore/PAL:

* pal/spi/cg/CoreGraphicsSPI.h:
Add addional SPI for working with CGColorSpaceRefs.

Source/WebKit:

- Update ImageBuffer subclass signatures to use "const DestinationColorSpace&" to
  conform to the base class.
- Replace ColorSpaceData with Optional<DestinationColorSpace>. No reason to have two
  types that are the same.
- Give all ports a color space configuration for ShareableBitmap now that there is
  a common class for representing color space.
- Update DisplayList decoding to account for BeginClipToDrawingCommands and GetPixelBuffer
  no longer being inlineable due to now having non-trivial destructors due to
  DestinationColorSpace member.

* GPUProcess/graphics/RemoteImageBuffer.h:
(WebKit::RemoteImageBuffer::create):
* GPUProcess/graphics/RemoteRenderingBackend.cpp:
(WebKit::RemoteRenderingBackend::createImageBuffer):
* GPUProcess/graphics/RemoteRenderingBackend.h:
* GPUProcess/media/RemoteImageDecoderAVFProxy.cpp:
(WebKit::RemoteImageDecoderAVFProxy::createFrameImageAtIndex):
* GPUProcess/media/RemoteImageDecoderAVFProxy.h:
* GPUProcess/media/RemoteImageDecoderAVFProxy.messages.in:
* Shared/RemoteLayerTree/RemoteLayerBackingStore.mm:
(WebKit::RemoteLayerBackingStore::swapToValidFrontBuffer):
(WebKit::RemoteLayerBackingStore::applyBackingStoreToLayer):
* Shared/ShareableBitmap.cpp:
(WebKit::ShareableBitmap::Configuration::encode const):
(WebKit::ShareableBitmap::Configuration::decode):
* Shared/ShareableBitmap.h:
* Shared/WebCoreArgumentCoders.h:
* Shared/WebPageCreationParameters.cpp:
(WebKit::WebPageCreationParameters::decode):
* Shared/WebPageCreationParameters.h:
* Shared/cg/ShareableBitmapCG.cpp:
(WebKit::colorSpace):
* Shared/mac/ColorSpaceData.h: Removed.
* Shared/mac/ColorSpaceData.mm: Removed.
* SourcesCocoa.txt:
* UIProcess/API/ios/WKWebViewIOS.mm:
(-[WKWebView _takeViewSnapshot]):
(-[WKWebView _snapshotRect:intoImageOfWidth:completionHandler:]):
* UIProcess/Cocoa/WebViewImpl.h:
* UIProcess/Cocoa/WebViewImpl.mm:
(WebKit::WebViewImpl::colorSpace):
* UIProcess/PageClient.h:
* UIProcess/RemoteLayerTree/RemoteLayerTreeHost.mm:
(WebKit::recursivelyMapIOSurfaceBackingStore):
* UIProcess/WebPageProxy.h:
* UIProcess/mac/PageClientImplMac.h:
* UIProcess/mac/PageClientImplMac.mm:
(WebKit::PageClientImpl::colorSpace):
* UIProcess/mac/TiledCoreAnimationDrawingAreaProxy.mm:
* UIProcess/mac/WebPageProxyMac.mm:
(WebKit::WebPageProxy::colorSpace):
* WebKit.xcodeproj/project.pbxproj:
* WebProcess/GPU/graphics/ImageBufferShareableBitmapBackend.cpp:
(WebKit::ImageBufferShareableBitmapBackend::configuration):
* WebProcess/GPU/graphics/RemoteGraphicsContextGLProxy.cpp:
(WebKit::RemoteGraphicsContextGLProxy::prepareForDisplay):
* WebProcess/GPU/graphics/RemoteImageBufferProxy.h:
(WebKit::RemoteImageBufferProxy::create):
* WebProcess/GPU/graphics/RemoteRenderingBackendProxy.cpp:
(WebKit::RemoteRenderingBackendProxy::createImageBuffer):
* WebProcess/GPU/graphics/RemoteRenderingBackendProxy.h:
* WebProcess/GPU/graphics/cocoa/ImageBufferShareableMappedIOSurfaceBackend.cpp:
(WebKit::ImageBufferShareableMappedIOSurfaceBackend::create):
* WebProcess/GPU/media/RemoteImageDecoderAVF.cpp:
(WebKit::RemoteImageDecoderAVF::createFrameImageAtIndex):
* WebProcess/GPU/media/cocoa/MediaPlayerPrivateRemoteCocoa.mm:
(WebKit::MediaPlayerPrivateRemote::nativeImageForCurrentTime):
(WebKit::MediaPlayerPrivateRemote::pixelBufferForCurrentTime):
* WebProcess/Plugins/PDF/PDFPlugin.mm:
(WebKit::PDFPlugin::PDFPlugin):
* WebProcess/WebCoreSupport/ShareableBitmapUtilities.cpp:
(WebKit::createShareableBitmap):
* WebProcess/WebCoreSupport/WebChromeClient.cpp:
(WebKit::WebChromeClient::createImageBuffer const):
* WebProcess/WebCoreSupport/WebChromeClient.h:
* WebProcess/WebCoreSupport/mac/WebDragClientMac.mm:
(WebKit::convertDragImageToBitmap):
* WebProcess/WebPage/DrawingArea.h:
(WebKit::DrawingArea::setColorSpace):
* WebProcess/WebPage/DrawingArea.messages.in:
* WebProcess/WebPage/WebPage.cpp:
(WebKit::snapshotOptionsToBitmapConfiguration):
* WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.h:
* WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm:
(WebKit::TiledCoreAnimationDrawingArea::TiledCoreAnimationDrawingArea):
(WebKit::TiledCoreAnimationDrawingArea::setColorSpace):

Source/WebKitLegacy/mac:

* WebCoreSupport/WebContextMenuClient.mm:
(WebContextMenuClient::imageForCurrentSharingServicePickerItem):
Update for new DestinationColorSpace class.

Tools:

* TestWebKitAPI/Tests/WebCore/cg/DisplayListTestsCG.cpp:
(TestWebKitAPI::TEST):
Upate test to use new DestinationColorSpace type.


Canonical link: https://commits.webkit.org/238067@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@277940 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-05-24 00:31:28 +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
Alex Christensen 9303ca8b34 Add support for Navigation Timing Level 2
https://bugs.webkit.org/show_bug.cgi?id=184363

Reviewed by Ryosuke Niwa.

LayoutTests/imported/w3c:

* web-platform-tests/navigation-timing/META.yml: Added.
* web-platform-tests/navigation-timing/dom_interactive_image_document-expected.txt: Added.
* web-platform-tests/navigation-timing/dom_interactive_image_document.html: Added.
* web-platform-tests/navigation-timing/dom_interactive_media_document-expected.txt: Added.
* web-platform-tests/navigation-timing/dom_interactive_media_document.html: Added.
* web-platform-tests/navigation-timing/idlharness.window.js:
* web-platform-tests/navigation-timing/nav2_test_attributes_exist-expected.txt: Added.
* web-platform-tests/navigation-timing/nav2_test_attributes_exist.html: Added.
This test fails because we have not implemented transferSize, encodedBodySize, and decodedBodySize as noted in PerformanceResourceTiming.idl
* web-platform-tests/navigation-timing/nav2_test_attributes_values-expected.txt: Added.
* web-platform-tests/navigation-timing/nav2_test_attributes_values.html: Added.
This test fails because we have not implemented transferSize, encodedBodySize, and decodedBodySize as noted in PerformanceResourceTiming.idl
* web-platform-tests/navigation-timing/nav2_test_document_open-expected.txt:
* web-platform-tests/navigation-timing/nav2_test_document_open.html:
* web-platform-tests/navigation-timing/nav2_test_document_replaced-expected.txt:
* web-platform-tests/navigation-timing/nav2_test_document_replaced.html:
* web-platform-tests/navigation-timing/nav2_test_frame_removed-expected.txt:
* web-platform-tests/navigation-timing/nav2_test_instance_accessible_from_the_start-expected.txt:
* web-platform-tests/navigation-timing/nav2_test_instance_accessible_from_the_start.html:
* web-platform-tests/navigation-timing/nav2_test_instance_accessors-expected.txt: Added.
* web-platform-tests/navigation-timing/nav2_test_instance_accessors.html: Added.
* web-platform-tests/navigation-timing/nav2_test_navigate_iframe-expected.txt: Added.
* web-platform-tests/navigation-timing/nav2_test_navigate_iframe.html: Added.
* web-platform-tests/navigation-timing/nav2_test_navigate_within_document-expected.txt:
* web-platform-tests/navigation-timing/nav2_test_navigate_within_document.html:
* web-platform-tests/navigation-timing/nav2_test_navigation_type_backforward-expected.txt:
* web-platform-tests/navigation-timing/nav2_test_navigation_type_backforward.html:
* web-platform-tests/navigation-timing/nav2_test_navigation_type_navigate-expected.txt: Added.
* web-platform-tests/navigation-timing/nav2_test_navigation_type_navigate.html: Added.
* web-platform-tests/navigation-timing/nav2_test_navigation_type_reload-expected.txt:
* web-platform-tests/navigation-timing/nav2_test_navigation_type_reload.html:
* web-platform-tests/navigation-timing/nav2_test_redirect_chain_xserver_final_original_origin-expected.txt: Added.
This test fails because our test infrastructure doesn't support loading from www.localhost.
* web-platform-tests/navigation-timing/nav2_test_redirect_chain_xserver_final_original_origin.html: Copied from LayoutTests/imported/w3c/web-platform-tests/navigation-timing/nav2_test_redirect_chain_xserver_partial_opt_in.html.
* web-platform-tests/navigation-timing/nav2_test_redirect_chain_xserver_partial_opt_in-expected.txt:
This test fails because our test infrastructure doesn't support loading from www.localhost.
* web-platform-tests/navigation-timing/nav2_test_redirect_chain_xserver_partial_opt_in.html:
* web-platform-tests/navigation-timing/nav2_test_redirect_none-expected.txt: Added.
* web-platform-tests/navigation-timing/nav2_test_redirect_none.html: Added.
* web-platform-tests/navigation-timing/nav2_test_redirect_server-expected.txt:
This test failure needs further investigation.
* web-platform-tests/navigation-timing/nav2_test_redirect_server.html:
* web-platform-tests/navigation-timing/nav2_test_redirect_xserver-expected.txt:
This test fails because our test infrastructure doesn't support loading from www.localhost.
* web-platform-tests/navigation-timing/nav2_test_redirect_xserver.html:
* web-platform-tests/navigation-timing/nav2_test_unique_nav_instances-expected.txt: Added.
This test failure needs further investigation.
* web-platform-tests/navigation-timing/nav2_test_unique_nav_instances.html: Added.
* web-platform-tests/navigation-timing/po-navigation-expected.txt: Added.
* web-platform-tests/navigation-timing/po-navigation.html: Added.
* web-platform-tests/navigation-timing/resources/webperftestharness.js:
(test_namespace):
(test_attribute_exists):
(test_enum):
* web-platform-tests/navigation-timing/secure-connection-start-reuse.https-expected.txt: Added.
* web-platform-tests/navigation-timing/secure-connection-start-reuse.https.html: Added.
* web-platform-tests/navigation-timing/secure_connection_start_non_zero.https-expected.txt:
This test has been marked as flaky.  It needs to be fixed to not rely on no initial connection reuse.
* web-platform-tests/navigation-timing/supported_navigation_type.any-expected.txt:
* web-platform-tests/navigation-timing/supported_navigation_type.any.worker-expected.txt:
* web-platform-tests/navigation-timing/test_document_onload-expected.txt: Added.
* web-platform-tests/navigation-timing/test_document_onload.html: Added.
This test failure needs further investigation.
* web-platform-tests/navigation-timing/unload-event-same-origin-check-expected.txt:
* web-platform-tests/navigation-timing/unload-event-same-origin-check.html:
* web-platform-tests/performance-timeline/META.yml: Added.
* web-platform-tests/performance-timeline/buffered-flag-after-timeout.any.js: Added.
(async_test.t.t.step_timeout):
* web-platform-tests/performance-timeline/buffered-flag-observer.any.js: Added.
* web-platform-tests/performance-timeline/get-invalid-entries-expected.txt: Added.
* web-platform-tests/performance-timeline/get-invalid-entries.html: Added.
* web-platform-tests/performance-timeline/idlharness.any.js: Added.
(async idl_array):
* web-platform-tests/performance-timeline/multiple-buffered-flag-observers.any.js: Added.
(promise_test):
* web-platform-tests/performance-timeline/not-clonable-expected.txt: Added.
* web-platform-tests/performance-timeline/not-clonable.html: Added.
* web-platform-tests/performance-timeline/observer-buffered-false.any.js: Added.
(async_test.t.t.step_timeout):
* web-platform-tests/performance-timeline/performanceentry-tojson.any.js: Added.
(test):
* web-platform-tests/performance-timeline/po-callback-mutate.any.js: Added.
(async_test):
* web-platform-tests/performance-timeline/po-disconnect-removes-observed-types.any.js: Added.
(async_test):
* web-platform-tests/performance-timeline/po-disconnect.any.js: Added.
(async_test):
(test):
* web-platform-tests/performance-timeline/po-entries-sort.any.js: Added.
(async_test):
* web-platform-tests/performance-timeline/po-getentries.any.js: Added.
(async_test):
* web-platform-tests/performance-timeline/po-mark-measure.any.js: Added.
(async_test):
* web-platform-tests/performance-timeline/po-observe-expected.txt: Added.
* web-platform-tests/performance-timeline/po-observe-repeated-type.any.js: Added.
(async_test):
* web-platform-tests/performance-timeline/po-observe.html: Added.
* web-platform-tests/performance-timeline/po-resource-expected.txt: Added.
* web-platform-tests/performance-timeline/po-resource.html: Added.
* web-platform-tests/performance-timeline/po-takeRecords.any.js: Added.
(async_test):
* web-platform-tests/performance-timeline/resources/postmessage-entry.html: Added.
* web-platform-tests/performance-timeline/resources/worker-invalid-entries.js: Added.
* web-platform-tests/performance-timeline/resources/worker-with-performance-observer.js: Added.
(catch):
* web-platform-tests/performance-timeline/supportedEntryTypes.any-expected.txt:
This test failure needs further investigation.  It's a bindings generation problem I've unsuccessfully looked into before.
* web-platform-tests/performance-timeline/supportedEntryTypes.any.js:
(test):
* web-platform-tests/performance-timeline/supportedEntryTypes.any.worker-expected.txt:
* web-platform-tests/performance-timeline/webtiming-resolution.any.js: Added.
(testTimeResolution):
(timeByUserTiming):
* web-platform-tests/performance-timeline/worker-with-performance-observer-expected.txt: Added.
* web-platform-tests/performance-timeline/worker-with-performance-observer.html: Added.
* web-platform-tests/service-workers/service-worker/navigation-timing.https-expected.txt:
This existing test failure needs more investigation.  We are probably close to a fix after this patch.

Source/WebCore:

This is basically just a new shape for exposing the same data as window.performance.navigation, but with a shape that fits better into the rest of the
performance timeline measurements that have been added to the web platform since performance.navigation.

I noted that exposing transfer size is problematic, and some of the tests for reading transfer size still fail.
There are still a few relatively minor test failures to fix in future patches.  Each one is annotated in the LayoutTests ChangeLogs.

Tests: imported/w3c/web-platform-tests/navigation-timing/dom_interactive_image_document.html
       imported/w3c/web-platform-tests/navigation-timing/dom_interactive_media_document.html
       imported/w3c/web-platform-tests/navigation-timing/nav2_test_attributes_exist.html
       imported/w3c/web-platform-tests/navigation-timing/nav2_test_attributes_values.html
       imported/w3c/web-platform-tests/navigation-timing/nav2_test_instance_accessors.html
       imported/w3c/web-platform-tests/navigation-timing/nav2_test_navigate_iframe.html
       imported/w3c/web-platform-tests/navigation-timing/nav2_test_navigation_type_navigate.html
       imported/w3c/web-platform-tests/navigation-timing/nav2_test_redirect_chain_xserver_final_original_origin.html
       imported/w3c/web-platform-tests/navigation-timing/nav2_test_redirect_none.html
       imported/w3c/web-platform-tests/navigation-timing/nav2_test_unique_nav_instances.html
       imported/w3c/web-platform-tests/navigation-timing/po-navigation.html
       imported/w3c/web-platform-tests/navigation-timing/secure-connection-start-reuse.https.html
       imported/w3c/web-platform-tests/navigation-timing/test_document_onload.html
       imported/w3c/web-platform-tests/performance-timeline/get-invalid-entries.html
       imported/w3c/web-platform-tests/performance-timeline/not-clonable.html
       imported/w3c/web-platform-tests/performance-timeline/po-observe.html
       imported/w3c/web-platform-tests/performance-timeline/po-resource.html
       imported/w3c/web-platform-tests/performance-timeline/worker-with-performance-observer.html

* CMakeLists.txt:
* DerivedSources-input.xcfilelist:
* DerivedSources-output.xcfilelist:
* DerivedSources.make:
* Sources.txt:
* WebCore.xcodeproj/project.pbxproj:
* bindings/js/JSPerformanceEntryCustom.cpp:
(WebCore::toJSNewlyCreated):
* dom/Document.cpp:
(WebCore::Document::setReadyState):
Sometimes the ready state jumps right to Complete without hitting Interactive along the way.
When this happens, we want to mark both m_documentTiming.domComplete and m_documentTiming.domInteractive.
* loader/DocumentLoader.cpp:
(WebCore::DocumentLoader::notifyFinished):
Call addNavigationTiming in notifyFinished to create the navigation timing object when we are done navigating
* loader/ResourceLoader.cpp:
(WebCore::ResourceLoader::didFinishLoading):
* loader/ResourceLoader.h:
* loader/ResourceTiming.cpp:
(WebCore::ResourceTiming::fromLoad):
Add a URL parameter.  Sometimes we need to use the request's URL and sometimes the response's.  Different specs written at different times.
(WebCore::ResourceTiming::populateServerTiming const):
(WebCore::ResourceTiming::populateServerTiming): Deleted.
* loader/ResourceTiming.h:
(WebCore::ResourceTiming::url const):
(WebCore::ResourceTiming::initiator const):
(WebCore::ResourceTiming::loadTiming const):
(WebCore::ResourceTiming::networkLoadMetrics const):
* loader/SubresourceLoader.cpp:
(WebCore::SubresourceLoader::reportResourceTiming):
* page/Performance.cpp:
(WebCore::Performance::getEntries const):
(WebCore::Performance::getEntriesByType const):
(WebCore::Performance::getEntriesByName const):
(WebCore::Performance::appendBufferedEntriesByType const):
(WebCore::Performance::addNavigationTiming):
(WebCore::Performance::registerPerformanceObserver):
(WebCore::Performance::queueEntry):
(WebCore::Performance::scheduleTaskIfNeeded):
* page/Performance.h:
* page/PerformanceEntry.h:
(WebCore::PerformanceEntry::startTime const):
(WebCore::PerformanceEntry::duration const):
(WebCore::PerformanceEntry::isResource const): Deleted.
(WebCore::PerformanceEntry::isMark const): Deleted.
(WebCore::PerformanceEntry::isMeasure const): Deleted.
(WebCore::PerformanceEntry::isPaint const): Deleted.
* page/PerformanceMark.h:
(isType): Deleted.
SPECIALIZE_TYPE_TRAITS_BEGIN/END doesn't work well with PerformanceNavigationTiming which inherits from PerformanceResourceTiming which both have distinct types.
is<PerformanceResourceTiming> doesn't give us the info we need.  I replaced that with "switch (entry->performanceEntryType())" in the one place it's used, and it works like a charm.
Also renamed type to performanceEntryType so it doesn't conflict with PerformanceNavigationTiming::type, which is specified in the idl.
* page/PerformanceMeasure.h:
(isType): Deleted.
* page/PerformanceNavigationTiming.cpp: Added.
(WebCore::toPerformanceNavigationTimingNavigationType):
(WebCore::PerformanceNavigationTiming::PerformanceNavigationTiming):
(WebCore::PerformanceNavigationTiming::millisecondsSinceOrigin const):
(WebCore::PerformanceNavigationTiming::sameOriginCheckFails const):
(WebCore::PerformanceNavigationTiming::unloadEventStart const):
(WebCore::PerformanceNavigationTiming::unloadEventEnd const):
(WebCore::PerformanceNavigationTiming::domInteractive const):
(WebCore::PerformanceNavigationTiming::domContentLoadedEventStart const):
(WebCore::PerformanceNavigationTiming::domContentLoadedEventEnd const):
(WebCore::PerformanceNavigationTiming::domComplete const):
(WebCore::PerformanceNavigationTiming::loadEventStart const):
(WebCore::PerformanceNavigationTiming::loadEventEnd const):
(WebCore::PerformanceNavigationTiming::type const):
(WebCore::PerformanceNavigationTiming::redirectCount const):
(WebCore::PerformanceNavigationTiming::startTime const):
(WebCore::PerformanceNavigationTiming::duration const):
* page/PerformanceNavigationTiming.h: Added.
* page/PerformanceNavigationTiming.idl: Copied from Source/WebCore/page/PerformanceObserver.idl.
* page/PerformanceObserver.cpp:
(WebCore::PerformanceObserver::takeRecords):
(WebCore::PerformanceObserver::disconnect):
(WebCore::PerformanceObserver::deliver):
(WebCore::PerformanceObserver::supportedEntryTypes):
* page/PerformanceObserver.h:
* page/PerformanceObserver.idl:
* page/PerformanceObserverEntryList.cpp:
(WebCore::PerformanceObserverEntryList::getEntriesByName const):
* page/PerformancePaintTiming.h:
(isType): Deleted.
* page/PerformanceResourceTiming.cpp:
(WebCore::PerformanceResourceTiming::PerformanceResourceTiming):
(WebCore::PerformanceResourceTiming::nextHopProtocol const):
(WebCore::PerformanceResourceTiming::redirectStart const):
(WebCore::PerformanceResourceTiming::redirectEnd const):
(WebCore::PerformanceResourceTiming::fetchStart const):
(WebCore::PerformanceResourceTiming::domainLookupStart const):
(WebCore::PerformanceResourceTiming::domainLookupEnd const):
(WebCore::PerformanceResourceTiming::connectStart const):
(WebCore::PerformanceResourceTiming::connectEnd const):
(WebCore::PerformanceResourceTiming::secureConnectionStart const):
(WebCore::PerformanceResourceTiming::requestStart const):
(WebCore::PerformanceResourceTiming::responseStart const):
(WebCore::PerformanceResourceTiming::responseEnd const):
(WebCore::PerformanceResourceTiming::networkLoadTimeToDOMHighResTimeStamp const):
* page/PerformanceResourceTiming.h:
(WebCore::PerformanceResourceTiming::initiatorType const):
(isType): Deleted.
* page/PerformanceResourceTiming.idl:
* platform/network/BlobResourceHandle.cpp:
(WebCore::doNotifyFinish):
* platform/network/NetworkLoadMetrics.h:
* platform/network/ResourceHandleClient.h:
(WebCore::ResourceHandleClient::didFinishLoading):
* platform/network/SynchronousLoaderClient.cpp:
(WebCore::SynchronousLoaderClient::didFinishLoading):
* platform/network/SynchronousLoaderClient.h:
* platform/network/cf/ResourceHandleCFURLConnectionDelegateWithOperationQueue.cpp:
(WebCore::ResourceHandleCFURLConnectionDelegateWithOperationQueue::didFinishLoading):
Pass metrics including the response end time from NSURLConnection so we don't assert in WebKitLegacy.
* platform/network/cocoa/NetworkLoadMetrics.mm:
(WebCore::copyTimingData):
Use currentRequest instead of passing in the response so we can call it from didFinishLoading, where we don't have a response stored anywhere.
We're just looking for whether it's http or https, so the currentRequest (which is the request after all the redirects) fits our purpose.
* platform/network/curl/ResourceHandleCurl.cpp:
(WebCore::ResourceHandle::handleDataURL):
* platform/network/mac/WebCoreResourceHandleAsOperationQueueDelegate.mm:
(-[WebCoreResourceHandleAsOperationQueueDelegate connection:didReceiveResponse:]):
(-[WebCoreResourceHandleAsOperationQueueDelegate connectionDidFinishLoading:]):

Source/WebKit:

* NetworkProcess/cocoa/NetworkSessionCocoa.mm:
(-[WKNetworkSessionDelegate URLSession:task:didFinishCollectingMetrics:]):
Mark reused TLS connections in complete metrics like I did in incomplete metrics in r277493.

Source/WebKitLegacy:

* WebCoreSupport/PingHandle.h:

Source/WTF:

* Scripts/Preferences/WebPreferencesExperimental.yaml:

LayoutTests:

* TestExpectations:
Annoyingly secure_connection_start_non_zero.https.html becomes flaky with a correct implementation because it assumes
that no connection is reused.  However, when running this test after other tests, another connection is often reused.
* performance-api/paint-timing/performance-observer-first-contentful-paint-expected.txt:
* performance-api/paint-timing/performance-observer-first-contentful-paint.html:
* performance-api/performance-observer-api-expected.txt:
* performance-api/performance-timeline-api-expected.txt:
* performance-api/resources/timeline-api.js:
* platform/mac-wk1/imported/w3c/web-platform-tests/navigation-timing/nav2_test_attributes_values-expected.txt:
Next hop protocol isn't implemented in ResourceHandle.  That's probably no big deal because WebKitLegacy is deprecated and not used by Safari.



Canonical link: https://commits.webkit.org/237930@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@277767 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-05-20 00:33:02 +00:00
Chris Dumez 503659938f Rename FileSystem::directoryName() to FileSystem::parentPath()
https://bugs.webkit.org/show_bug.cgi?id=225768

Reviewed by Darin Adler.

Rename FileSystem::directoryName() to FileSystem::parentPath() for clarity and
consistency with std::filesystem::parent_path() which is used internally.

Source/JavaScriptCore:

* API/JSScript.mm:
(validateBytecodeCachePath):

Source/WebCore:

* Modules/entriesapi/DOMFileSystem.cpp:
(WebCore::DOMFileSystem::DOMFileSystem):
* loader/appcache/ApplicationCacheStorage.cpp:
(WebCore::ApplicationCacheStorage::writeDataToUniqueFileInDirectory):
(WebCore::ApplicationCacheStorage::checkForDeletedResources):
* platform/graphics/avfoundation/objc/CDMSessionAVContentKeySession.mm:
(WebCore::CDMSessionAVContentKeySession::contentKeySession):
* platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
(WebCore::MediaPlayerPrivateGStreamer::purgeOldDownloadFiles):
* platform/network/curl/CookieJarDB.cpp:
(WebCore::CookieJarDB::openDatabase):
* platform/sql/SQLiteFileSystem.cpp:
(WebCore::SQLiteFileSystem::ensureDatabaseFileExists):
* platform/win/SearchPopupMenuDB.cpp:
(WebCore::SearchPopupMenuDB::openDatabase):
* workers/service/server/SWScriptStorage.cpp:
(WebCore::SWScriptStorage::store):

Source/WebKit:

* NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.cpp:
(WebKit::ResourceLoadStatisticsDatabaseStore::openITPDatabase):
* NetworkProcess/cache/CacheStorageEngine.cpp:
(WebKit::CacheStorage::Engine::writeFile):
* Shared/glib/ProcessExecutablePathGLib.cpp:
(WebKit::getExecutablePath):
* UIProcess/API/glib/IconDatabase.cpp:
(WebKit::IconDatabase::IconDatabase):
* UIProcess/API/glib/WebKitWebsiteDataManager.cpp:
(webkit_website_data_manager_get_disk_cache_directory):
* UIProcess/Launcher/glib/BubblewrapLauncher.cpp:
(WebKit::bubblewrapSpawn):
* UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm:
(WebKit::WebsiteDataStore::platformSetNetworkParameters):
* UIProcess/WebsiteData/WebsiteDataStore.cpp:
(WebKit::WebsiteDataStore::resolveDirectoriesIfNecessary):

Source/WebKitLegacy:

* Storage/StorageTracker.cpp:
(WebKit::ensureDatabaseFileExists):

Source/WebKitLegacy/win:

* Plugins/PluginDatabase.cpp:
(WebCore::PluginDatabase::loadPersistentMetadataCache):

Source/WTF:

* wtf/FileSystem.cpp:
(WTF::FileSystemImpl::readOrMakeSalt):
(WTF::FileSystemImpl::parentPath):
(WTF::FileSystemImpl::directoryName): Deleted.
* wtf/FileSystem.h:

Tools:

* DumpRenderTree/win/DumpRenderTree.cpp:
(findFontFallback):
* TestWebKitAPI/Tests/WTF/FileSystem.cpp:
(TestWebKitAPI::TEST_F):
* TestWebKitAPI/win/PlatformUtilitiesWin.cpp:
(TestWebKitAPI::Util::moduleDirectory):


Canonical link: https://commits.webkit.org/237697@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@277449 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-05-13 20:47:38 +00:00
Sam Weinig 28e215969b Add preliminary support for specifying a color space for 2D canvas
https://bugs.webkit.org/show_bug.cgi?id=225286

Reviewed by Dean Jackson.

Source/WebCore:

Tests: fast/canvas/CanvasRenderingContext2DSettings-colorSpace-disabled.html
       fast/canvas/CanvasRenderingContext2DSettings-colorSpace-enabled.html
       fast/canvas/canvas-color-space-display-p3.html

* CMakeLists.txt:
* DerivedSources-input.xcfilelist:
* DerivedSources-output.xcfilelist:
* DerivedSources.make:
* Sources.txt:
* WebCore.xcodeproj/project.pbxproj:
Add new files.

* html/canvas/CanvasRenderingContext2DSettings.idl:
* html/canvas/CanvasRenderingContext2DSettings.h:
Add a new setting blocked member to the CanvasRenderingContext2DSettings
dictionary for specifying a color space.

* html/canvas/PredefinedColorSpace.cpp: Added.
* html/canvas/PredefinedColorSpace.h: Added.
* html/canvas/PredefinedColorSpace.idl: Added.
Add a new IDL enumeration to represent the possible color spaces supported.
For ports that don't support DisplayP3, trying to use it will result in
type error from JS.

* html/HTMLCanvasElement.cpp:
(WebCore::HTMLCanvasElement::reset):
Add checks for color space and pixel format to 2d context reset optimation.
This can happen if the image buffer is allocated prior to the context being
requested (such as via canvas.toDataURL() or canvas.toBlob()).

(WebCore::HTMLCanvasElement::createImageBuffer const):
Pass the correct color space and pixel format (though
the later is always BGRA8 at the moment) to the ImageBuffer
create function to make a backing store in the right format.

* html/HTMLVideoElement.cpp:
(WebCore::HTMLVideoElement::createBufferForPainting const):
* html/HTMLVideoElement.h:
Pass color space and pixel format through to ensure the helper
buffer matches the correct color space.

* html/ImageBitmap.cpp:
(WebCore::ImageBitmap::createPromise):
Pass the existing defaults to HTMLVideoElement::createBufferForPainting.
In the future, ImageBitmap will also gain color space and pixel
format specificity and this will be updated.

* html/canvas/CanvasRenderingContext.cpp:
(WebCore::CanvasRenderingContext::pixelFormat const):
(WebCore::CanvasRenderingContext::colorSpace const):
* html/canvas/CanvasRenderingContext.h:
Add virtual base implementations of colorSpace and pixelFormat
which CanvasRenderingContext2D can override to return the
values specified in the CanvasRenderingContext2DSettings.

* html/canvas/CanvasRenderingContext2D.h:
* html/canvas/CanvasRenderingContext2D.cpp:
(WebCore::CanvasRenderingContext2D::fontProxy const):
Fix incorrect formatting.

(WebCore::CanvasRenderingContext2D::pixelFormat const):
(WebCore::CanvasRenderingContext2D::colorSpace const):
Add overrides, return m_settings.colorSpace for colorSpace.

* html/canvas/CanvasRenderingContext2DBase.cpp:
(WebCore::CanvasRenderingContext2DBase::drawImage):
(WebCore::CanvasRenderingContext2DBase::createCompositingBuffer):
(WebCore::CanvasRenderingContext2DBase::createPattern):
(WebCore::CanvasRenderingContext2DBase::drawTextUnchecked):
Pass along the colorSpace and pixelFormat when creating buffers.

* html/shadow/DateTimeSymbolicFieldElement.cpp:
Add missing includes that are now needed.

Source/WTF:

Add new experimental feature, CanvasColorSpaceEnabled, which blocks
access to the new ability to specify color spaces for 2D canvas.

* Scripts/Preferences/WebPreferencesExperimental.yaml:

Tools:

* DumpRenderTree/TestOptions.cpp:
(WTR::TestOptions::defaults):
Add CanvasColorSpaceEnabled for windows.

LayoutTests:

Add basic tests for color space in canvas support.

* fast/canvas/CanvasRenderingContext2DSettings-colorSpace-disabled-expected.txt: Added.
* fast/canvas/CanvasRenderingContext2DSettings-colorSpace-disabled.html: Added.
* fast/canvas/CanvasRenderingContext2DSettings-colorSpace-enabled-expected.txt: Added.
* fast/canvas/CanvasRenderingContext2DSettings-colorSpace-enabled.html: Added.
* fast/canvas/canvas-color-space-display-p3-expected.html: Added.
* fast/canvas/canvas-color-space-display-p3.html: Added.


Canonical link: https://commits.webkit.org/237338@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@277024 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-05-05 16:36:55 +00:00
Kimmo Kinnunen d433fbaa4d [GPUP] Move GPUProcess WebGL to Experimental Feature
https://bugs.webkit.org/show_bug.cgi?id=222836
rdar://75048190

Patch by Kimmo Kinnunen <kkinnunen@apple.com> on 2021-05-03
Reviewed by Brent Fulgham.

Move the setting for WebGL in GPU process
to experimental features but disable it by default,
even on layout tests.

Source/WTF:

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

Tools:

* DumpRenderTree/TestOptions.cpp:
(WTR::TestOptions::defaults):
* Scripts/webkitpy/layout_tests/run_webkit_tests.py:
(parse_args):
* WebKitTestRunner/TestOptions.cpp:
(WTR::TestOptions::defaults):

Canonical link: https://commits.webkit.org/237281@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@276948 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-05-04 06:33:52 +00:00
Adrien Destugues 067ed1a600 Merge commit '64d90e2833c6ba1d42029acb522543d3772ddeae' into haiku 2021-04-30 20:37:33 +02:00
Alex Christensen e53d1b3560 Remove support for NPAPI plugins in WebView
https://bugs.webkit.org/show_bug.cgi?id=224449

Patch by Alex Christensen <achristensen@webkit.org> on 2021-04-28
Reviewed by Geoffrey Garen.

Source/WebKitLegacy/mac:

In r275912 I turned off all plugin support in WebView after looking into use of NP_Initialize, the entry point for NPAPI plugins.
That was too aggressive, as we found some use of the older WebKit plugin entry point, plugInViewWithArguments, and reverted in r276652.
This cuts out only support for NPAPI plugins for now.

* WebCoreSupport/WebFrameLoaderClient.mm:
(WebFrameLoaderClient::createPlugin):

Source/WTF:

* Scripts/Preferences/WebPreferencesInternal.yaml:

Tools:

* DumpRenderTree/TestOptions.cpp:
(WTR::TestOptions::defaults):

Canonical link: https://commits.webkit.org/237124@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@276720 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-04-28 17:19:32 +00:00
Alex Christensen 74df1a2f89 Unreviewed, reverting r275912.
rdar://77179042

Broke internal client

Reverted changeset:

"Remove support for NPAPI plugins in WebView"
https://bugs.webkit.org/show_bug.cgi?id=224449
https://commits.webkit.org/r275912


Canonical link: https://commits.webkit.org/237079@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@276652 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-04-27 18:52:48 +00:00
Ryosuke Niwa b573ea2acf Add an option to not enable all experimental features in DumpRenderTree
https://bugs.webkit.org/show_bug.cgi?id=225041

Reviewed by Wenson Hsieh.

Added --no-enable-all-experimental-features to DumpRenderTree as we did
for WebKitTestRunner in r276559.

* DumpRenderTree/mac/DumpRenderTree.mm:
(setWebPreferencesForTestOptions):
(initializeGlobalsFromCommandLineOptions):


Canonical link: https://commits.webkit.org/237017@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@276581 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-04-26 05:51:23 +00:00
Adrien Destugues 4f70bc5d40 Merge 'd9f40e97aec73d30021f41104087c450e7958f8c' into haiku branch 2021-04-25 19:38:40 +02:00
Tyler Wilcock 711a9d7742 [css-counter-styles] Parse @counter-style descriptors
https://bugs.webkit.org/show_bug.cgi?id=224718

Patch by Tyler Wilcock <twilco.o@protonmail.com> on 2021-04-22
Reviewed by Darin Adler.

LayoutTests/imported/w3c:

Parsing for all @counter-style descriptors is implemented with this
patch, so mark more tests passing.

You'll notice that some @counter-style descriptors implemented in this
patch did not gain any passing tests (e.g. `pad`, `negative`).  In all
of these cases, the expected results contain a <string> value, and we
fail only because we incorrectly don't serialize these <string> values
with quotes.  I have manually confirmed in all cases that these values
are properly parsed, so it's just the serialization that's incorrect.

These <string> values serialize without quotes because WebKit's representation
of custom identifiers is not a separate type, but instead overloaded onto the
CSS_STRING type.  This means that during serialization time, WebKit must guess
whether it is actually serializing a string (and include quotes if so), or if
it's serializing a custom ident (leaving off quotes if so).

Relevant code snippet:

36caeec079/Source/WebCore/css/CSSMarkup.cpp (L153)#L161

Relevant changelog snippet from David Hyatt, 2016-12-07:

> We also overload CSS_STRING primitive value type and have it act as both a string
> and a custom identifier. This is lame, since the parser should have made two different
> types of objects instead, but since our parser doesn't do that yet, I added a serializeAsStringOrCustomIdent
> that preserves our old behavior of "quote the string only if needed." In this case what
> that really meant was "Try to guess that we were originally a custom ident and leave off
> quotes if so." This function will go away once we properly create CSSStringValues and
> CSSCustomIdentValues instead of turning the latter into strings.

* web-platform-tests/css/css-counter-styles/counter-style-fallback-expected.txt:
* web-platform-tests/css/css-counter-styles/counter-style-prefix-suffix-syntax-expected.txt:
* web-platform-tests/css/css-counter-styles/counter-style-range-syntax-expected.txt:
* web-platform-tests/css/css-counter-styles/counter-style-speak-as-syntax-expected.txt:
* web-platform-tests/css/css-counter-styles/counter-style-system-syntax-expected.txt:

Source/WebCore:

Implement parsing and CSSCounterStyleRule IDL interface for @counter-style descriptors.
See spec for full details on all descriptors:

https://drafts.csswg.org/css-counter-styles-3/#the-counter-style-rule

Test: webexposed/counter-style-image-symbols-not-exposed.html and WPTs

* css/CSSComputedStyleDeclaration.cpp:
(WebCore::ComputedStyleExtractor::valueForPropertyInStyle):
Return `nullptr` for new @counter-style descriptor properties.

* css/CSSCounterStyleRule.cpp:
(WebCore::toCounterStyleSystemEnum):
(WebCore::symbolsValidForSystem):
(WebCore::StyleRuleCounterStyle::newValueInvalidOrEqual const):
(WebCore::CSSCounterStyleRule::cssText const):
(WebCore::CSSCounterStyleRule::setName):
(WebCore::CSSCounterStyleRule::setterInternal):
(WebCore::CSSCounterStyleRule::setSystem):
(WebCore::CSSCounterStyleRule::setNegative):
(WebCore::CSSCounterStyleRule::setPrefix):
(WebCore::CSSCounterStyleRule::setSuffix):
(WebCore::CSSCounterStyleRule::setRange):
(WebCore::CSSCounterStyleRule::setPad):
(WebCore::CSSCounterStyleRule::setFallback):
(WebCore::CSSCounterStyleRule::setSymbols):
(WebCore::CSSCounterStyleRule::setAdditiveSymbols):
(WebCore::CSSCounterStyleRule::setSpeakAs):
Implement setters and tangential functionality required by setters.

* css/CSSCounterStyleRule.h:
Replace FIXME with actual descriptor getter and setter
implementations.

* css/CSSProperties.json:
Add @counter-style descriptor properties.

* css/CSSValueKeywords.in:
Add new values required for `system` and `speak-as`
@counter-style descriptor properties.

* css/parser/CSSParserContext.cpp:
(WebCore::CSSParserContext::isPropertyRuntimeDisabled const):
Ensure new @counter-style descriptors are disabled at runtime based
on CSSParserContext state.

* css/parser/CSSPropertyParser.cpp:
(WebCore::consumeCounterStyleSystem):
(WebCore::consumeCounterStyleSymbol):
(WebCore::consumeCounterStyleNegative):
(WebCore::consumeCounterStyleRangeBound):
(WebCore::consumeCounterStyleRange):
(WebCore::consumeCounterStylePad):
(WebCore::consumeCounterStyleSymbols):
(WebCore::consumeCounterStyleAdditiveSymbols):
(WebCore::consumeCounterStyleSpeakAs):
(WebCore::CSSPropertyParser::parseCounterStyleDescriptor):
Parse @counter-style descriptors.

Tools:

* DumpRenderTree/TestOptions.cpp:
(WTR::TestOptions::defaults):
Fix typo (missing 's').  CSSCounterStyleAtRulesEnabled, not
CSSCounterStyleAtRuleEnabled.

LayoutTests:

Add test ensuring <image> @counter-style symbol values cannot be
parsed when the `counterStyleAtRuleImageSymbolsEnabled` feature flag
is disabled.

---

This test is skipped on Windows because I haven't been able to get the
required feature flags (CSSCounterStyleAtRulesEnabled and
CSSCounterStyleAtRuleImageSymbolsEnabled) to work properly for that
port.

The code hidden behind these flags is all in the CSS parser, which is not
unique to Windows, so I think we can be confident that if the test passes
on all other platforms, that the behavior is correct on Windows too.

One attempt at implementing the necessary Windows-specific flag functionality is here:

https://bugs.webkit.org/attachment.cgi?id=426371&action=edit

Which failed to compile[1] with this error:

> C:\cygwin\home\buildbot\worker\Windows-EWS\build\Tools\DumpRenderTree\win\DumpRenderTree.cpp(834,51): error C2039: 'setCSSCounterStyleAtRulesEnabled': is not a member of 'IWebPreferencesPrivate7' [C:\cygwin\home\buildbot\worker\Windows-EWS\build\WebKitBuild\Release\Tools\DumpRenderTree\DumpRenderTreeLib.vcxproj]
> C:\cygwin\home\buildbot\worker\Windows-EWS\build\Tools\DumpRenderTree\win\DumpRenderTree.cpp(835,62): error C2039: 'setCSSCounterStyleAtRuleImageSymbolsEnabled': is not a member of 'IWebPreferencesPrivate7' [C:\cygwin\home\buildbot\worker\Windows-EWS\build\WebKitBuild\Release\Tools\DumpRenderTree\DumpRenderTreeLib.vcxproj]

Those methods are present in `IWebPreferencesPrivate7.idl`, and implemented similarly to other
flags in other places (e.g. win/WebPreferences.{h, cpp}, win/WebPreferenceKeysPrivate.h).
I can't reproduce this compilation error on my Windows machine.

I then tried removing the lines that caused the above compilation failure.
Those setters are called in DumpRenderTree::enableExperimentalFeatures, so in
lieu of enabling these flags there I could enable the flag I need via test header.

That patch is: https://bugs.webkit.org/attachment.cgi?id=426509&action=edit

This results in successful compilation, but causes lots (all?) of the
layout tests to fail[2] with a stacktrace that looks like:

Canonical link: https://commits.webkit.org/236947@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@276488 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-04-23 05:25:40 +00:00
Commit Queue ec44d70717 Unreviewed, reverting r276380 and r276386.
https://bugs.webkit.org/show_bug.cgi?id=224912

Caused WPT css/css-counter-styles/cssom test crashes on macOS
WK1 with ASan

Reverted changesets:

"[css-counter-styles] Parse @counter-style descriptors"
https://bugs.webkit.org/show_bug.cgi?id=224718
https://trac.webkit.org/changeset/276380

"CSSComputedStyleDeclaration.cpp should use C++ style
comments"
https://bugs.webkit.org/show_bug.cgi?id=224875
https://trac.webkit.org/changeset/276386

Canonical link: https://commits.webkit.org/236883@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@276418 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-04-22 03:28:03 +00:00
Tyler Wilcock 6a0eb9e405 [css-counter-styles] Parse @counter-style descriptors
https://bugs.webkit.org/show_bug.cgi?id=224718

Patch by Tyler Wilcock <twilco.o@protonmail.com> on 2021-04-21
Reviewed by Darin Adler.

LayoutTests/imported/w3c:

Parsing for all @counter-style descriptors is implemented with this
patch, so mark more tests passing.

You'll notice that some @counter-style descriptors implemented in this
patch did not gain any passing tests (e.g. `pad`, `negative`).  In all
of these cases, the expected results contain a <string> value, and we
fail only because we incorrectly don't serialize these <string> values
with quotes.  I have manually confirmed in all cases that these values
are properly parsed, so it's just the serialization that's incorrect.

These <string> values serialize without quotes because WebKit's representation
of custom identifiers is not a separate type, but instead overloaded onto the
CSS_STRING type.  This means that during serialization time, WebKit must guess
whether it is actually serializing a string (and include quotes if so), or if
it's serializing a custom ident (leaving off quotes if so).

Relevant code snippet:

36caeec079/Source/WebCore/css/CSSMarkup.cpp (L153)#L161

Relevant changelog snippet from David Hyatt, 2016-12-07:

> We also overload CSS_STRING primitive value type and have it act as both a string
> and a custom identifier. This is lame, since the parser should have made two different
> types of objects instead, but since our parser doesn't do that yet, I added a serializeAsStringOrCustomIdent
> that preserves our old behavior of "quote the string only if needed." In this case what
> that really meant was "Try to guess that we were originally a custom ident and leave off
> quotes if so." This function will go away once we properly create CSSStringValues and
> CSSCustomIdentValues instead of turning the latter into strings.

* web-platform-tests/css/css-counter-styles/counter-style-fallback-expected.txt:
* web-platform-tests/css/css-counter-styles/counter-style-prefix-suffix-syntax-expected.txt:
* web-platform-tests/css/css-counter-styles/counter-style-range-syntax-expected.txt:
* web-platform-tests/css/css-counter-styles/counter-style-speak-as-syntax-expected.txt:
* web-platform-tests/css/css-counter-styles/counter-style-system-syntax-expected.txt:

Source/WebCore:

Implement parsing and CSSCounterStyleRule IDL interface for @counter-style descriptors.
See spec for full details on all descriptors:

https://drafts.csswg.org/css-counter-styles-3/#the-counter-style-rule

Test: webexposed/counter-style-image-symbols-not-exposed.html and WPTs

* css/CSSComputedStyleDeclaration.cpp:
(WebCore::ComputedStyleExtractor::valueForPropertyInStyle):
Return `nullptr` for new @counter-style descriptor properties.

* css/CSSCounterStyleRule.cpp:
(WebCore::toCounterStyleSystemEnum):
(WebCore::symbolsValidForSystem):
(WebCore::StyleRuleCounterStyle::newValueInvalidOrEqual const):
(WebCore::CSSCounterStyleRule::cssText const):
(WebCore::CSSCounterStyleRule::setName):
(WebCore::CSSCounterStyleRule::setterInternal):
(WebCore::CSSCounterStyleRule::setSystem):
(WebCore::CSSCounterStyleRule::setNegative):
(WebCore::CSSCounterStyleRule::setPrefix):
(WebCore::CSSCounterStyleRule::setSuffix):
(WebCore::CSSCounterStyleRule::setRange):
(WebCore::CSSCounterStyleRule::setPad):
(WebCore::CSSCounterStyleRule::setFallback):
(WebCore::CSSCounterStyleRule::setSymbols):
(WebCore::CSSCounterStyleRule::setAdditiveSymbols):
(WebCore::CSSCounterStyleRule::setSpeakAs):
Implement setters and tangential functionality required by setters.

* css/CSSCounterStyleRule.h:
Replace FIXME with actual descriptor getter and setter
implementations.

* css/CSSProperties.json:
Add @counter-style descriptor properties.

* css/CSSValueKeywords.in:
Add new values required for `system` and `speak-as`
@counter-style descriptor properties.

* css/parser/CSSPropertyParser.cpp:
(WebCore::consumeCounterStyleSystem):
(WebCore::consumeCounterStyleSymbol):
(WebCore::consumeCounterStyleNegative):
(WebCore::consumeCounterStyleRangeBound):
(WebCore::consumeCounterStyleRange):
(WebCore::consumeCounterStylePad):
(WebCore::consumeCounterStyleSymbols):
(WebCore::consumeCounterStyleAdditiveSymbols):
(WebCore::consumeCounterStyleSpeakAs):
(WebCore::CSSPropertyParser::parseCounterStyleDescriptor):
Parse @counter-style descriptors.

Tools:

* DumpRenderTree/TestOptions.cpp:
(WTR::TestOptions::defaults):
Fix typo (missing 's').  CSSCounterStyleAtRulesEnabled, not
CSSCounterStyleAtRuleEnabled.

LayoutTests:

Add test ensuring <image> @counter-style symbol values cannot be
parsed when the `counterStyleAtRuleImageSymbolsEnabled` feature flag
is disabled.

---

This test is skipped on Windows because I haven't been able to get the
required feature flags (CSSCounterStyleAtRulesEnabled and
CSSCounterStyleAtRuleImageSymbolsEnabled) to work properly for that
port.

The code hidden behind these flags is all in the CSS parser, which is not
unique to Windows, so I think we can be confident that if the test passes
on all other platforms, that the behavior is correct on Windows too.

One attempt at implementing the necessary Windows-specific flag functionality is here:

https://bugs.webkit.org/attachment.cgi?id=426371&action=edit

Which failed to compile[1] with this error:

> C:\cygwin\home\buildbot\worker\Windows-EWS\build\Tools\DumpRenderTree\win\DumpRenderTree.cpp(834,51): error C2039: 'setCSSCounterStyleAtRulesEnabled': is not a member of 'IWebPreferencesPrivate7' [C:\cygwin\home\buildbot\worker\Windows-EWS\build\WebKitBuild\Release\Tools\DumpRenderTree\DumpRenderTreeLib.vcxproj]
> C:\cygwin\home\buildbot\worker\Windows-EWS\build\Tools\DumpRenderTree\win\DumpRenderTree.cpp(835,62): error C2039: 'setCSSCounterStyleAtRuleImageSymbolsEnabled': is not a member of 'IWebPreferencesPrivate7' [C:\cygwin\home\buildbot\worker\Windows-EWS\build\WebKitBuild\Release\Tools\DumpRenderTree\DumpRenderTreeLib.vcxproj]

Those methods are present in `IWebPreferencesPrivate7.idl`, and implemented similarly to other
flags in other places (e.g. win/WebPreferences.{h, cpp}, win/WebPreferenceKeysPrivate.h).
I can't reproduce this compilation error on my Windows machine.

I then tried removing the lines that caused the above compilation failure.
Those setters are called in DumpRenderTree::enableExperimentalFeatures, so in
lieu of enabling these flags there I could enable the flag I need via test header.

That patch is: https://bugs.webkit.org/attachment.cgi?id=426509&action=edit

This results in successful compilation, but causes lots (all?) of the
layout tests to fail[2] with a stacktrace that looks like:

00 00000065`738fdf00 00007ffc`3e9e3113 WebKit!WebPreferences::speechRecognitionEnabled(int * enabled = 0x00007ffc`3eae0f50)+0x29 [C:\cygwin\home\buildbot\worker\Windows-EWS\build\Source\WebKitLegacy\win\WebPreferences.cpp @ 2617]
01 00000065`738fdf30 00007ffc`3e9e3cc0 DumpRenderTreeLib!resetWebPreferencesToConsistentValues(struct IWebPreferences * preferences = 0x00000205`e2f204b0)+0x63 [C:\cygwin\home\buildbot\worker\Windows-EWS\build\Tools\DumpRenderTree\win\DumpRenderTree.cpp @ 847]
02 00000065`738fdfa0 00007ffc`3e9e4171 DumpRenderTreeLib!resetWebViewToConsistentStateBeforeTesting(class WTR::TestOptions * options = 0x00000065`738fea60)+0x2e0 [C:\cygwin\home\buildbot\worker\Windows-EWS\build\Tools\DumpRenderTree\win\DumpRenderTree.cpp @ 1054]
03 00000065`738fe050 00007ffc`3e9e67d3 DumpRenderTreeLib!runTest(class std::basic_string<char,std::char_traits<char>,std::allocator<char> > * inputLine = <Value unavailable error>)+0x2f1 [C:\cygwin\home\buildbot\worker\Windows-EWS\build\Tools\DumpRenderTree\win\DumpRenderTree.cpp @ 1239]
04 00000065`738feca0 00007ff7`89952f30 DumpRenderTreeLib!main(int argc = <Value unavailable error>, char ** argv = <Value unavailable error>)+0x5d3 [C:\cygwin\home\buildbot\worker\Windows-EWS\build\Tools\DumpRenderTree\win\DumpRenderTree.cpp @ 1676]
05 00000065`738ff5b0 00007ff7`89953884 DumpRenderTree!main(int argc = 0n2, char ** argv = 0x00000205`e2e74b80)+0x880 [C:\cygwin\home\buildbot\worker\Windows-EWS\build\Tools\win\DLLLauncher\DLLLauncherMain.cpp @ 232]

I haven't done much digging into why this happens, and cannot reproduce it on my Windows machine.

[1]: https://ews-build.webkit.org/#/builders/10/builds/86747
[2]: https://ews-build.webkit.org/#/builders/10/builds/86897

* platform/win/TestExpectations: Skip newly added test on Windows.
* webexposed/counter-style-image-symbols-not-exposed-expected.txt: Added.
* webexposed/counter-style-image-symbols-not-exposed.html: Added.

Canonical link: https://commits.webkit.org/236855@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@276380 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-04-21 19:07:50 +00:00
Tyler Wilcock d720a89a49 [css-counter-styles] Parse and add feature flag for @counter-style
https://bugs.webkit.org/show_bug.cgi?id=223150

Patch by Tyler Wilcock <twilco.o@protonmail.com> on 2021-04-16
Reviewed by Darin Adler.

LayoutTests/imported/w3c:

@counter-style and its descriptors are now exposed behind a feature
flag, so pass some tests and fail others for a different reason
because this patch doesn't actually implement descriptor parsing and
setting yet.

* web-platform-tests/css/css-counter-styles/counter-style-additive-symbols-syntax-expected.txt:
* web-platform-tests/css/css-counter-styles/counter-style-fallback-expected.txt:
* web-platform-tests/css/css-counter-styles/counter-style-name-syntax-expected.txt:
* web-platform-tests/css/css-counter-styles/counter-style-negative-syntax-expected.txt:
* web-platform-tests/css/css-counter-styles/counter-style-pad-syntax-expected.txt:
* web-platform-tests/css/css-counter-styles/counter-style-prefix-suffix-syntax-expected.txt:
* web-platform-tests/css/css-counter-styles/counter-style-range-syntax-expected.txt:
* web-platform-tests/css/css-counter-styles/counter-style-speak-as-syntax-expected.txt:
* web-platform-tests/css/css-counter-styles/counter-style-symbols-syntax-expected.txt:
* web-platform-tests/css/css-counter-styles/counter-style-system-syntax-expected.txt:
* web-platform-tests/css/css-counter-styles/idlharness-expected.txt:
* web-platform-tests/css/cssom/CSSCounterStyleRule-expected.txt:

Source/WebCore:

Parse @counter-style (without implementing descriptor parsing) behind
a new feature flag, CSSCounterStyleAtRulesEnabled.  A separate feature
flag for @counter-style <image> symbol values has also been added, as
image symbols have extra complexities that we won't want to hold the
entire feature back on.
https://www.w3.org/TR/css-counter-styles-3

The CSSCounterStyleRule IDL interface is also added and implemented,
and similarly feature flagged.
https://www.w3.org/TR/css-counter-styles-3/#apis

Test: webexposed/counter-style-is-not-exposed.html and existing WPTs.

* CMakeLists.txt:
Add CSSCounterStyleRule.idl.

* DerivedSources-input.xcfilelist:
Add CSSCounterStyleRule.idl.

* DerivedSources-output.xcfilelist:
Add JSCSSCounterStyleRule.h and JSCSSCounterStyleRule.cpp.

* DerivedSources.make:
Add CSSCounterStyleRule.idl.

* Sources.txt:
Add CSSCounterStyleRule.cpp and JSCSSCounterStyleRule.cpp.

* WebCore.xcodeproj/project.pbxproj:
Add CounterStyle.h, CounterStyle.cpp, and CounterStyle.idl.

* bindings/js/JSCSSRuleCustom.cpp:
(WebCore::toJSNewlyCreated):
Support CSSCounterStyleRule.

* bindings/js/WebCoreBuiltinNames.h:
Add macro(CSSCounterStyleRule) to generate counter-style built-in
names.

* css/CSSCounterStyleRule.cpp: Added.
(WebCore::StyleRuleCounterStyle::StyleRuleCounterStyle):
(WebCore::StyleRuleCounterStyle::create):
(WebCore::StyleRuleCounterStyle::mutableProperties):
(WebCore::CSSCounterStyleRule::CSSCounterStyleRule):
(WebCore::CSSCounterStyleRule::reattach):
(WebCore::CSSCounterStyleRule::cssText const):

* css/CSSCounterStyleRule.h: Added.
(isType): Add specialized rule.isCounterStyleRule() implementation.

* css/CSSCounterStyleRule.idl: Added.
* css/CSSRule.cpp: Add new StyleRuleType::CounterStyle COMPILE_ASSERT.
* css/CSSRule.h:
Add COUNTER_STYLE_RULE constant.  Also add comment `// WebIDL enum` to
disable enum_casing lint, since these values are named to match IDL
attributes.
* css/CSSRule.idl: Add COUNTER_STYLE_RULE constant behind flag.

* css/StyleRule.cpp:
(WebCore::StyleRuleBase::destroy):
(WebCore::StyleRuleBase::copy const):
(WebCore::StyleRuleBase::createCSSOMWrapper const):
Handle newly added StyleRuleType::CounterStyle.

* css/StyleRule.h:
(WebCore::StyleRuleBase::isCounterStyleRule const): Added.

* css/StyleRuleType.h: Add StyleRuleType::CounterStyle

* css/StyleSheetContents.cpp:
(WebCore::traverseRulesInVector):
(WebCore::StyleSheetContents::traverseSubresources const):
If @counter-style image symbols flag is enabled, do traverse
subresources.

* css/parser/CSSAtRuleID.cpp:
If the @counter-style feature flag is enabled, return newly added
CSSAtRuleCounterStyle ID.

(WebCore::cssAtRuleID):
* css/parser/CSSAtRuleID.h:
Add CSSAtRuleCounterStyle ID.

* css/parser/CSSParserContext.cpp:
(WebCore::operator==):
* css/parser/CSSParserContext.h:
(WebCore::CSSParserContextHash::hash):
Add cssCounterStyleAtRulesEnabled and
cssCounterStyleAtRuleImageSymbolsEnabled flags.

* css/parser/CSSParserFastPaths.cpp:
(WebCore::CSSParserFastPaths::isValidKeywordPropertyAndValue):
Refactor to use new CSSPropertyParserHelpers::isPredefinedCounterStyle
method.

* css/parser/CSSParserImpl.cpp:
(WebCore::computeNewAllowedRules):
(WebCore::CSSParserImpl::consumeAtRule):
(WebCore::CSSParserImpl::consumeCounterStyleRule): Added.
(WebCore::CSSParserImpl::consumeDeclarationList):
(WebCore::CSSParserImpl::consumeDeclaration):
* css/parser/CSSParserImpl.h:
Handle new @counter-style rule.

* css/parser/CSSPropertyParser.cpp:
(WebCore::CSSPropertyParser::parseValue): Handle
StyleRuleType::CounterStyle.
(WebCore::consumeCounterContent):
Refactor to use new CSSPropertyParserHelpers::isPredefinedCounterStyle
method.
(WebCore::CSSPropertyParser::parseCounterStyleDescriptor):
Add placeholder for future @counter-style descriptor parsing work.

* css/parser/CSSPropertyParser.h:
Add parseCounterStyleDescriptor method

* css/parser/CSSPropertyParserHelpers.h:
* css/parser/CSSPropertyParserHelpers.cpp:
(WebCore::CSSPropertyParserHelpers::consumeCustomIdent):
Add new flag that allows consumed custom ident values to be lowercased
on-parse.  This is necessary for some <counter-style-name> values.
(WebCore::CSSPropertyParserHelpers::isPredefinedCounterStyle): Added.
(WebCore::CSSPropertyParserHelpers::consumeCounterStyleName):
(WebCore::CSSPropertyParserHelpers::consumeCounterStyleNameInPrelude):
Parse @counter-style names, both in-prelude names and non-prelude
names (e.g. as part of the `extends` descriptor).

Source/WTF:

* Scripts/Preferences/WebPreferencesExperimental.yaml:
 Add CSSCounterStyleAtRulesEnabled and CSSCounterStyleAtRuleImageSymbolsEnabled flags.

Tools:

* DumpRenderTree/TestOptions.cpp:
(WTR::TestOptions::defaults):
Add `false` defaults for CSSCounterStyleAtRulesEnabled and
CSSCounterStyleAtRuleImageSymbolsEnabled flags.

LayoutTests:

Add tests ensuring @counter-style is not exposed when feature flag is
disabled.

* webexposed/counter-style-is-not-exposed-expected.txt: Added.
* webexposed/counter-style-is-not-exposed.html: Added.

Canonical link: https://commits.webkit.org/236643@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@276152 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-04-16 19:19:04 +00:00
Alex Christensen 7b31fcc135 Remove support for NPAPI plugins in WebView
https://bugs.webkit.org/show_bug.cgi?id=224449

Patch by Alex Christensen <achristensen@webkit.org> on 2021-04-13
Reviewed by Chris Dumez.

Source/WebKitLegacy/mac:

* WebView/WebPreferences.mm:
(-[WebPreferences setPlugInsEnabled:]):

Source/WTF:

* Scripts/Preferences/WebPreferences.yaml:

Tools:

Keep them on in tests until we remove the code.

* DumpRenderTree/TestOptions.cpp:
(WTR::TestOptions::defaults):

Canonical link: https://commits.webkit.org/236476@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@275912 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-04-13 21:20:56 +00:00
Cameron McCormack e59f03b96d Enable AspectRatioOfImgFromWidthAndHeightEnabled for WebKitLegacy.
https://bugs.webkit.org/show_bug.cgi?id=223815

Reviewed by Sam Weinig.

Source/WTF:

There's no reason this is enabled for WebKit and not WebKitLegacy.
And set WebCore = true since this feature could conceivably be
used in SVG images.

* Scripts/Preferences/WebPreferencesExperimental.yaml:

Tools:

* DumpRenderTree/TestOptions.cpp:
(WTR::TestOptions::defaults):


Canonical link: https://commits.webkit.org/235862@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@275159 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-03-29 05:27:15 +00:00
Adrien Destugues 26916f086c Merge commit 'e98c8002727a676a11981f290452a9f39dfc1b67' into haiku 2021-03-27 21:53:05 +01:00
Adrien Destugues 15aa9c7f7b Merge commit 'd159f8bec75790a9b50cbe42f16dda4236bc4f00' into haiku 2021-03-27 16:37:25 +01:00
Don Olmstead d174fa3a75 [CMake] Deprecate using DERIVED_SOURCES_DIR/FOWARDING_HEADERS_DIR directly
https://bugs.webkit.org/show_bug.cgi?id=223763

Reviewed by Michael Catanzaro.

.:

Remove any usages of DERIVED_SOURCES_DIR and FOWARDING_HEADERS_DIR. There are still some
uses in GTK/WPE but those should be phased out.

Sets the directory structure to look like an Apple build in terms of where headers and
derived sources are held. Rather than having one root derived sources and one root
header directory those directories are now per project. This helps catch any errors with
header includes.

Deletes some old Mac CMake code that is no longer relevant around creating forwarding
headers.

For AppleWin the old structure is used because of its internal build which assumes the
old structure.

* Source/cmake/OptionsAppleWin.cmake:
* Source/cmake/OptionsFTW.cmake:
* Source/cmake/OptionsGTK.cmake:
* Source/cmake/OptionsPlayStation.cmake:
* Source/cmake/OptionsWPE.cmake:
* Source/cmake/OptionsWinCairo.cmake:
* Source/cmake/WebKitCommon.cmake:
* Source/cmake/WebKitFS.cmake:
* Source/cmake/WebKitMacros.cmake:

Source/JavaScriptCore:

Remove any usages of DERIVED_SOURCES_DIR and FOWARDING_HEADERS_DIR.

* CMakeLists.txt:
* PlatformMac.cmake:

Source/WebCore:

Remove any usages of DERIVED_SOURCES_DIR and FOWARDING_HEADERS_DIR.

* PlatformFTW.cmake:
* PlatformWin.cmake:

Source/WebKit:

Remove any usages of DERIVED_SOURCES_DIR and FOWARDING_HEADERS_DIR.

* PlatformGTK.cmake:
* PlatformMac.cmake: Remove creation of forwarding headers.

Source/WebKitLegacy:

Remove any usages of DERIVED_SOURCES_DIR and FOWARDING_HEADERS_DIR.

* PlatformMac.cmake:

Tools:

Remove any usages of DERIVED_SOURCES_DIR and FOWARDING_HEADERS_DIR.

* DumpRenderTree/PlatformMac.cmake:
* MiniBrowser/gtk/CMakeLists.txt:
* MiniBrowser/mac/CMakeLists.txt:
* WebKitTestRunner/PlatformMac.cmake:
* wpe/backends/CMakeLists.txt:


Canonical link: https://commits.webkit.org/235819@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@275111 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-03-26 20:37:09 +00:00
Rob Buis c20b3bede2 [css-contain] Parse CSS contain property
https://bugs.webkit.org/show_bug.cgi?id=223252

Patch by Rob Buis <rbuis@igalia.com> on 2021-03-22
Reviewed by Darin Adler.

LayoutTests/imported/w3c:

Adjust test expectations.

* web-platform-tests/css/css-cascade/all-prop-initial-xml-expected.txt:
* web-platform-tests/css/css-contain/content-visibility/content-visibility-026-expected.txt:
* web-platform-tests/css/css-contain/inheritance-expected.txt:
* web-platform-tests/css/css-contain/parsing/contain-computed-expected.txt:
* web-platform-tests/css/css-contain/parsing/contain-valid-expected.txt:
* web-platform-tests/css/cssom/cssstyledeclaration-csstext-expected.txt:

Source/WebCore:

Parse CSS contain property according to the specification [1].
This patch also adds the experimental feature CSSContainment and
makes contain invisible from style when disabled.

[1] https://drafts.csswg.org/css-contain-1/#contain-property

Test: fast/css/contain-invalidate-if-disabled.html

* css/CSSComputedStyleDeclaration.cpp:
(WebCore::ComputedStyleExtractor::valueForPropertyInStyle):
* css/CSSProperties.json:
* css/CSSValueKeywords.in:
* css/parser/CSSParserContext.cpp:
(WebCore::operator==):
(WebCore::CSSParserContext::isPropertyRuntimeDisabled const):
* css/parser/CSSParserContext.h:
(WebCore::CSSParserContextHash::hash):
* css/parser/CSSPropertyParser.cpp:
(WebCore::consumeContain):
(WebCore::CSSPropertyParser::parseSingleValue):
* rendering/style/RenderStyle.h:
(WebCore::RenderStyle::contain const):
(WebCore::RenderStyle::setContain):
(WebCore::RenderStyle::initialContainment):
(WebCore::RenderStyle::strictContainment):
(WebCore::RenderStyle::contentContainment):
* rendering/style/RenderStyleConstants.h:
* rendering/style/StyleRareNonInheritedData.cpp:
(WebCore::StyleRareNonInheritedData::StyleRareNonInheritedData):
(WebCore::StyleRareNonInheritedData::operator== const):
* rendering/style/StyleRareNonInheritedData.h:
* style/StyleBuilderCustom.h:
(WebCore::Style::BuilderCustom::applyInitialContain):
(WebCore::Style::BuilderCustom::applyInheritContain):
(WebCore::Style::BuilderCustom::applyValueContain):

Source/WTF:

Add experimental feature flag.

* Scripts/Preferences/WebPreferencesExperimental.yaml:

Tools:

Add support for disabling aspect-ratio in win wk1.

* DumpRenderTree/TestOptions.cpp:
(WTR::TestOptions::defaults):

LayoutTests:

Add test to verify that contain is invisible from style when disabled.

* fast/css/contain-invalidate-if-disabled-expected.txt: Added.
* fast/css/contain-invalidate-if-disabled.html: Added.
* platform/gtk/imported/w3c/web-platform-tests/css/cssom/cssstyledeclaration-csstext-expected.txt:
* platform/ios-wk2/imported/w3c/web-platform-tests/css/cssom/cssstyledeclaration-csstext-expected.txt:
* platform/wpe/imported/w3c/web-platform-tests/css/cssom/cssstyledeclaration-csstext-expected.txt:

Canonical link: https://commits.webkit.org/235596@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@274793 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-03-22 20:51:10 +00:00
Fujii Hironori 2f9792e8af [Win][WK1] Add a new API IWebPreferences::startBatchingUpdates to defer WebPreferencesChangedNotification
https://bugs.webkit.org/show_bug.cgi?id=223109

Reviewed by Sam Weinig.

Source/WebKitLegacy/win:

Some JS tests are timing out for Windows WebKit1 Debug build since
r274111. Those tests generate very large pages. r274111 resets
WebPreferences to the initial state. Changing a preference causes
relayout. Thus, resetting preferences caused layouts repeatedly.

r274040 (Bug 218024) added _batchUpdatePreferencesInBlock to
WebPreferences for Mac WebKit1 to defer the notification.

* Interfaces/IWebPreferencesPrivate.idl:
* WebPreferences.cpp:
(WebPreferences::postPreferencesChangesNotification):
(WebPreferences::startBatchingUpdates): Added.
(WebPreferences::stopBatchingUpdates): Added.
* WebPreferences.h:

Tools:

* DumpRenderTree/win/DumpRenderTree.cpp:
(resetWebViewToConsistentStateBeforeTesting):


Canonical link: https://commits.webkit.org/235274@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@274407 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-03-15 00:57:22 +00:00
Chris Dumez 8c6e0d8723 Introduce WorkQueue::main() to get the main thread's work queue
https://bugs.webkit.org/show_bug.cgi?id=223087

Reviewed by Geoffrey Garen.

Introduce WorkQueue::main() to get the main thread's work queue. This allows us to port some more code from
dispatch_queue to WorkQueue. It also simplifies some code that has to deal that sometimes needs to run on
the main thread and other times on a background queue. Having a single WorkQueue type to represent both the
main thread and a background queue makes writing such code more convenient.

Source/WebCore:

* platform/ios/WebVideoFullscreenControllerAVKit.mm:
(VideoFullscreenControllerContext::~VideoFullscreenControllerContext):
* platform/ios/wak/WebCoreThread.mm:
(WebThreadRunOnMainThread):

Source/WebKit:

* NetworkProcess/cache/CacheStorageEngine.cpp:
(WebKit::CacheStorage::Engine::writeFile):
(WebKit::CacheStorage::Engine::readFile):
* NetworkProcess/cache/CacheStorageEngineCaches.cpp:
(WebKit::CacheStorage::Caches::retrieveOriginFromDirectory):
* NetworkProcess/cache/NetworkCacheIOChannel.h:
* NetworkProcess/cache/NetworkCacheIOChannelCocoa.mm:
(WebKit::NetworkCache::IOChannel::read):
(WebKit::NetworkCache::IOChannel::write):
* NetworkProcess/cache/NetworkCacheIOChannelCurl.cpp:
(WebKit::NetworkCache::IOChannel::read):
(WebKit::NetworkCache::IOChannel::write):
* NetworkProcess/cache/NetworkCacheIOChannelGLib.cpp:
(WebKit::NetworkCache::inputStreamReadReadyCallback):
(WebKit::NetworkCache::IOChannel::read):
(WebKit::NetworkCache::IOChannel::readSyncInThread):
(WebKit::NetworkCache::outputStreamWriteReadyCallback):
(WebKit::NetworkCache::IOChannel::write):
* NetworkProcess/cache/NetworkCacheStorage.cpp:
(WebKit::NetworkCache::Storage::dispatchReadOperation):
(WebKit::NetworkCache::Storage::dispatchWriteOperation):
(WebKit::NetworkCache::Storage::traverse):
* Shared/Cocoa/WebKit2InitializeCocoa.mm:
(WebKit::InitializeWebKit2):
* Shared/EntryPointUtilities/Cocoa/XPCService/XPCServiceMain.mm:
(WebKit::XPCServiceEventHandler):
* UIProcess/API/Cocoa/WKBrowsingContextController.mm:
(+[WKBrowsingContextController registerSchemeForCustomProtocol:]):
(+[WKBrowsingContextController unregisterSchemeForCustomProtocol:]):
* UIProcess/Cocoa/WebPageProxyCocoa.mm:
(WebKit::WebPageProxy::scheduleActivityStateUpdate):
* UIProcess/PDF/WKPDFHUDView.mm:
(-[WKPDFHUDView initWithFrame:pluginIdentifier:page:]):
* UIProcess/WebsiteData/WebsiteDataStore.cpp:
(WebKit::WebsiteDataStore::fetchData):
(WebKit::WebsiteDataStore::fetchDataAndApply):
* UIProcess/WebsiteData/WebsiteDataStore.h:
* UIProcess/ios/ProcessAssertionIOS.mm:
(-[WKProcessAssertionBackgroundTaskManager _scheduleReleaseTask]):
* UIProcess/ios/WKContentViewInteraction.mm:
(-[WKContentView requestRectsToEvadeForSelectionCommandsWithCompletionHandler:]):
* UIProcess/ios/WebPageProxyIOS.mm:
(WebKit::WebPageProxy::willOpenAppLink):
* UIProcess/mac/ServicesController.mm:
(WebKit::ServicesController::refreshExistingServices):

Source/WebKitLegacy/mac:

* Misc/WebDownload.mm:
(callOnDelegateThreadAndWait):

Source/WTF:

* wtf/WorkQueue.cpp:
(WTF::WorkQueue::main):
* wtf/WorkQueue.h:
* wtf/cocoa/WorkQueueCocoa.cpp:
(WTF::WorkQueue::constructMainWorkQueue):
(WTF::WorkQueue::WorkQueue):
* wtf/generic/WorkQueueGeneric.cpp:
(WorkQueue::constructMainWorkQueue):
(WorkQueue::WorkQueue):

Tools:

* DumpRenderTree/ios/UIScriptControllerIOS.mm:
(WTR::UIScriptControllerIOS::doAsyncTask):
* DumpRenderTree/mac/DumpRenderTree.mm:
(-[DumpRenderTree _webThreadInvoked]):
* DumpRenderTree/mac/UIScriptControllerMac.mm:
(WTR::UIScriptControllerMac::doAsyncTask):
(WTR::UIScriptControllerMac::activateDataListSuggestion):
(WTR::UIScriptControllerMac::removeViewFromWindow):
(WTR::UIScriptControllerMac::addViewToWindow):
* WebKitTestRunner/mac/UIScriptControllerMac.mm:
(WTR::UIScriptControllerMac::activateDataListSuggestion):
(WTR::UIScriptControllerMac::chooseMenuAction):
(WTR::UIScriptControllerMac::activateAtPoint):

Canonical link: https://commits.webkit.org/235201@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@274307 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-03-12 00:01:20 +00:00
Chris Dumez 27d4cf22ef Use RetainPtr<> / OSObjectPtr<> more in WebKit
https://bugs.webkit.org/show_bug.cgi?id=223030

Reviewed by Darin Adler.

Source/JavaScriptCore:

* inspector/remote/cocoa/RemoteInspectorCocoa.mm:
(Inspector::RemoteInspector::setupXPCConnectionIfNeeded):
* inspector/remote/cocoa/RemoteInspectorXPCConnection.h:
* inspector/remote/cocoa/RemoteInspectorXPCConnection.mm:
(Inspector::RemoteInspectorXPCConnection::RemoteInspectorXPCConnection):
(Inspector::RemoteInspectorXPCConnection::closeFromMessage):
(Inspector::RemoteInspectorXPCConnection::closeOnQueue):
(Inspector::RemoteInspectorXPCConnection::handleEvent):
(Inspector::RemoteInspectorXPCConnection::sendMessage):
* jsc.cpp:
(jscmain):

Source/WebCore:

* bridge/objc/objc_class.mm:
(JSC::Bindings::classesByIsA):
(JSC::Bindings::_createClassesByIsAIfNecessary):
(JSC::Bindings::ObjcClass::classForIsA):
* editing/SmartReplaceCF.cpp:
(WebCore::getSmartSet):
* page/cocoa/ResourceUsageOverlayCocoa.mm:
(WebCore::createColor):
(WebCore::ResourceUsageOverlay::platformInitialize):
(WebCore::drawGraphLabel):
(WebCore::drawCpuHistory):
(WebCore::drawGCHistory):
(WebCore::ResourceUsageOverlay::platformDraw):
* platform/cf/win/CertificateCFWin.cpp:
(WebCore::createCertContextDeallocator):
(WebCore::copyCertificateToData):
* platform/graphics/FontPlatformData.h:
* platform/graphics/Pattern.h:
* platform/graphics/avfoundation/cf/MediaPlayerPrivateAVFoundationCF.cpp:
(WebCore::AVFWrapper::dispatchQueue const):
(WebCore::createMetadataKeyNames):
(WebCore::metadataKeyNames):
(WebCore::AVFWrapper::AVFWrapper):
(WebCore::AVFWrapper::~AVFWrapper):
(WebCore::AVFWrapper::createAssetForURL):
(WebCore::AVFWrapper::createPlayer):
(WebCore::AVFWrapper::createPlayerItem):
(WebCore::AVFWrapper::checkPlayability):
(WebCore::AVFWrapper::createAVCFVideoLayer):
* platform/graphics/cg/ColorCG.cpp:
(WTF::RetainPtr<CGColorRef>>::createValueForKey):
(WebCore::createCGColor):
(WebCore::cachedCGColor):
* platform/graphics/cg/ColorSpaceCG.cpp:
(WebCore::namedColorSpace):
* platform/graphics/cg/GraphicsContextCG.cpp:
(WebCore::GraphicsContext::applyStrokePattern):
(WebCore::GraphicsContext::applyFillPattern):
* platform/graphics/cg/GraphicsContextPlatformPrivateCG.h:
(WebCore::GraphicsContextPlatformPrivate::GraphicsContextPlatformPrivate):
* platform/graphics/cg/PathCG.cpp:
(WebCore::createScratchContext):
(WebCore::scratchContext):
(WebCore::copyCGPathClosingSubpaths):
(WebCore::Path::contains const):
* platform/graphics/cg/PatternCG.cpp:
(WebCore::Pattern::createPlatformPattern const):
* platform/graphics/coretext/FontPlatformDataCoreText.cpp:
(WebCore::FontPlatformData::FontPlatformData):
* platform/graphics/cv/ImageTransferSessionVT.mm:
(WebCore::ImageTransferSessionVT::createPixelBuffer):
* platform/graphics/mac/ComplexTextControllerCoreText.mm:
(WebCore::ComplexTextController::collectComplexTextRunsForCharacters):
* platform/graphics/mac/SimpleFontDataCoreText.cpp:
(WebCore::Font::getCFStringAttributes const):
* platform/graphics/win/GraphicsContextCGWin.cpp:
(WebCore::CGContextWithHDC):
* platform/ios/Device.cpp:
(WebCore::deviceName):
* platform/ios/DragImageIOS.mm:
(WebCore::cascadeForSystemFont):
* platform/ios/wak/WebCoreThread.mm:
(webThreadReleaseSource):
(webThreadReleaseObjArray):
(delegateSource):
(mainRunLoopAutoUnlockObserver):
(SendDelegateMessage):
(WebThreadAdoptAndRelease):
(HandleWebThreadReleaseSource):
(MainRunLoopAutoUnlock):
(_WebThreadAutoLock):
(_WebRunLoopEnableNestedFromMainThread):
(_WebRunLoopDisableNestedFromMainThread):
(RunWebThread):
(StartWebThread):
* platform/ios/wak/WebCoreThreadRun.cpp:
* platform/mac/PowerObserverMac.cpp:
(WebCore::PowerObserver::PowerObserver):
(WebCore::PowerObserver::~PowerObserver):
* platform/mac/PowerObserverMac.h:
* platform/mediarecorder/cocoa/AudioSampleBufferCompressor.h:
* platform/mediarecorder/cocoa/AudioSampleBufferCompressor.mm:
(WebCore::AudioSampleBufferCompressor::AudioSampleBufferCompressor):
(WebCore::AudioSampleBufferCompressor::~AudioSampleBufferCompressor):
(WebCore::AudioSampleBufferCompressor::finish):
(WebCore::AudioSampleBufferCompressor::addSampleBuffer):
* platform/mediarecorder/cocoa/VideoSampleBufferCompressor.h:
* platform/mediarecorder/cocoa/VideoSampleBufferCompressor.mm:
(WebCore::VideoSampleBufferCompressor::VideoSampleBufferCompressor):
(WebCore::VideoSampleBufferCompressor::~VideoSampleBufferCompressor):
(WebCore::VideoSampleBufferCompressor::finish):
(WebCore::VideoSampleBufferCompressor::addSampleBuffer):
* platform/mediastream/ios/AVAudioSessionCaptureDeviceManager.h:
* platform/mediastream/ios/AVAudioSessionCaptureDeviceManager.mm:
(WebCore::AVAudioSessionCaptureDeviceManager::AVAudioSessionCaptureDeviceManager):
(WebCore::AVAudioSessionCaptureDeviceManager::~AVAudioSessionCaptureDeviceManager):
(WebCore::AVAudioSessionCaptureDeviceManager::refreshAudioCaptureDevices):
(WebCore::AVAudioSessionCaptureDeviceManager::getCaptureDevices):
(WebCore::AVAudioSessionCaptureDeviceManager::disableAllDevicesQuery):
* platform/network/NetworkStorageSession.h:
* platform/network/cf/AuthenticationCF.cpp:
(WebCore::createCF):
* platform/network/cf/AuthenticationCF.h:
* platform/network/cf/CertificateInfoCFNet.cpp:
(WebCore::CertificateInfo::certificateChainFromSecTrust):
* platform/network/cf/CredentialStorageCFNet.cpp:
(WebCore::copyCredentialFromProtectionSpace):
(WebCore::CredentialStorage::getFromPersistentStorage):
* platform/network/cf/LoaderRunLoopCF.cpp:
(WebCore::loaderRunLoop):
* platform/network/cf/NetworkStorageSessionCFNetWin.cpp:
(WebCore::createPrivateStorageSession):
* platform/network/cf/ProtectionSpaceCFNet.cpp:
(WebCore::ProtectionSpace::receivesCredentialSecurely const):
* platform/network/cf/ResourceHandleCFNet.cpp:
(WebCore::ResourceHandle::tryHandlePasswordBasedAuthentication):
(WebCore::ResourceHandle::receivedCredential):
(WebCore::ResourceHandle::platformLoadResourceSynchronously):
* platform/network/cf/ResourceHandleCFURLConnectionDelegateWithOperationQueue.cpp:
(WebCore::getRunLoop):
* platform/network/cf/ResourceRequestCFNet.cpp:
(WebCore::siteForCookies):
(WebCore::ResourceRequest::doUpdatePlatformRequest):
(WebCore::ResourceRequest::doUpdatePlatformHTTPBody):
(WebCore::ResourceRequest::setStorageSession):
* platform/network/cocoa/NetworkStorageSessionCocoa.mm:
(WebCore::createPrivateStorageSession):
* platform/network/ios/WebCoreURLResponseIOS.mm:
(WebCore::createExtensionToMIMETypeMap):
(WebCore::adjustMIMETypeIfNecessary):
* platform/network/mac/WebCoreURLResponse.mm:
(WebCore::createExtensionToMIMETypeMap):
(WebCore::adjustMIMETypeIfNecessary):
* platform/text/mac/TextBoundaries.mm:
(WebCore::tokenizerForString):
* platform/win/DragImageCGWin.cpp:
(WebCore::allocImage):
* rendering/RenderThemeIOS.mm:
(WebCore::getSharedFunctionRef):
* testing/cocoa/WebArchiveDumpSupport.mm:
(WebCoreTestSupport::createCFURLResponseFromResponseData):
(WebCoreTestSupport::convertWebResourceResponseToDictionary):

Source/WebKit:

* NetworkProcess/NetworkProcess.cpp:
(WebKit::NetworkProcess::newTestingSession):
(WebKit::NetworkProcess::ensureSession):
* NetworkProcess/NetworkProcess.h:
* NetworkProcess/cocoa/NetworkProcessCocoa.mm:
(WebKit::NetworkProcess::clearDiskCache):
* NetworkProcess/mac/NetworkProcessMac.mm:
(WebKit::NetworkProcess::platformTerminate):
* Platform/IPC/Connection.h:
* Platform/IPC/cocoa/ConnectionCocoa.mm:
(IPC::Connection::platformInvalidate):
(IPC::Connection::cancelReceiveSource):
(IPC::Connection::open):
(IPC::Connection::initializeSendSource):
(IPC::Connection::receiveSourceEventHandler):
* Shared/Cocoa/DefaultWebBrowserChecks.mm:
(WebKit::itpQueue):
(WebKit::determineITPState):
(WebKit::doesAppHaveITPEnabled):
* Shared/EntryPointUtilities/Cocoa/XPCService/XPCServiceMain.mm:
(WebKit::XPCServiceEventHandler):
* Shared/ShareableResource.cpp:
(WebKit::createShareableResourceDeallocator):
(WebKit::ShareableResource::wrapInSharedBuffer):
* Shared/cf/ArgumentCodersCF.cpp:
(IPC::decode):
* UIProcess/mac/LegacySessionStateCoding.cpp:
(WebKit::encodeSessionHistoryEntryData):
* WebProcess/WebPage/Cocoa/WebCookieCacheCocoa.mm:
(WebKit::WebCookieCache::inMemoryStorageSession):
* WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.h:
* WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.mm:
(WebKit::RemoteLayerTreeDrawingArea::RemoteLayerTreeDrawingArea):
(WebKit::RemoteLayerTreeDrawingArea::updateRendering):

Source/WebKitLegacy:

223030_RetainPtr

* WebCoreSupport/NetworkStorageSessionMap.cpp:
(NetworkStorageSessionMap::switchToNewTestingSession):
(NetworkStorageSessionMap::ensureSession):

Source/WebKitLegacy/ios:

* WebView/WebPDFViewIOS.mm:
(createCGColorWithDeviceWhite):
(+[WebPDFView shadowColor]):
(+[WebPDFView backgroundColor]):

Source/WebKitLegacy/mac:

* Misc/WebElementDictionary.mm:
(lookupTable):
(addLookupKey):
(+[WebElementDictionary initializeLookupTable]):
(-[WebElementDictionary _fillCache]):
(-[WebElementDictionary objectForKey:]):
* WebView/WebView.mm:
(+[WebView _makeAllWebViewsPerformSelector:]):
(-[WebView _removeFromAllWebViewsSet]):
(-[WebView _addToAllWebViewsSet]):
(+[WebView closeAllWebViews]):
(+[WebView _maxCacheModelInAnyInstance]):

Source/WebKitLegacy/win:

* WebApplicationCache.cpp:
(WebApplicationCache::originsWithCache):
* WebDownloadCFNet.cpp:
(WebDownload::useCredential):
(WebDownload::didReceiveAuthenticationChallenge):
* WebKitQuartzCoreAdditions/CAD3DRenderer.cpp:
(WKQCA::updateBounds):
* WebLocalizableStrings.cpp:
(LocalizedString::LocalizedString):
(LocalizedString::operator CFStringRef const):
(LocalizedString::operator LPCTSTR const):
(copyLocalizedStringFromBundle):
* WebPreferences.cpp:
(defaultSettings):
(WebPreferences::initializeDefaultSettings):
(WebPreferences::valueForKey):
(WebPreferences::copyWebKitPreferencesToCFPreferences):

Source/WTF:

* wtf/MemoryPressureHandler.cpp:
(WTF::MemoryPressureHandler::setDispatchQueue):
* wtf/MemoryPressureHandler.h:
* wtf/WorkQueue.h:
* wtf/cocoa/MemoryPressureHandlerCocoa.mm:
(WTF::MemoryPressureHandler::install):
(WTF::MemoryPressureHandler::uninstall):
(WTF::MemoryPressureHandler::holdOff):
* wtf/cocoa/WorkQueueCocoa.cpp:
(WTF::WorkQueue::dispatch):
(WTF::WorkQueue::dispatchAfter):
(WTF::WorkQueue::platformInitialize):
(WTF::WorkQueue::platformInvalidate):
* wtf/text/cf/StringImplCF.cpp:
(WTF::StringWrapperCFAllocator::allocator):
(WTF::StringImpl::createCFString):

Tools:

* DumpRenderTree/cg/PixelDumpSupportCG.cpp:
(createBitmapContext):
* DumpRenderTree/cg/PixelDumpSupportCG.h:
(BitmapContext::createByAdoptingBitmapAndContext):
(BitmapContext::BitmapContext):
* DumpRenderTree/mac/DumpRenderTree.mm:
(WebThreadLockAfterDelegateCallbacksHaveCompleted):
* DumpRenderTree/win/PixelDumpSupportWin.cpp:
(createBitmapContextFromWebView):
* ImageDiff/ImageDiff.xcodeproj/project.pbxproj:
* ImageDiff/cg/PlatformImageCG.cpp:
(ImageDiff::PlatformImage::pixels const):
* WebKitTestRunner/cg/TestInvocationCG.cpp:
(WTR::createCGContextFromCGImage):
(WTR::createCGContextFromImage):
(WTR::TestInvocation::dumpPixelsAndCompareWithExpected):

Canonical link: https://commits.webkit.org/235156@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@274252 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-03-11 01:08:15 +00:00
Sam Weinig 6f6f12c59e Add preference reseting to WebKitLegacy Windows to simplify testing reset
https://bugs.webkit.org/show_bug.cgi?id=222865

Reviewed by Brent Fulgham.

Source/WebKitLegacy/win:

Add resetForTesting() function to allow easy reseting of all preferences
for testing, matching functionality added to Cocoa WebKitLegacy.

* Interfaces/IWebPreferencesPrivate.idl:
* WebPreferences.cpp:
(WebPreferences::resetForTesting):
* WebPreferences.h:

Tools:

* DumpRenderTree/win/DumpRenderTree.cpp:
(resetWebPreferencesToConsistentValues):
Call the new resetForTesting() method to ensure all values are reset back
to defaults for each test without have to explicitly list them.


Canonical link: https://commits.webkit.org/235041@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@274111 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-03-08 22:47:21 +00:00
Sam Weinig 122243d9f2 Transition Cocoa DumpRenderTree to allow any preference keys, not just hard coded supported ones
https://bugs.webkit.org/show_bug.cgi?id=222868

Reviewed by Simon Fraser.

This allows any preference key in a WebPreference*.yaml to be used for Cocoa WebKitLegacy
tests in the comment header command, just like WebKitTestRunner.

* DumpRenderTree/TestOptions.cpp:
(WTR::TestOptions::defaults):
Update defaults to only the default values that don't match
defaults in WebPreference*.yaml files and experimental features
that are not supported in but still declare support in the file.

* DumpRenderTree/TestRunner.h:
Remove unimplemented function declaration.

* DumpRenderTree/mac/DumpRenderTree.mm:
(setWebPreferencesForTestOptions):
(setDefaultsToConsistentValuesForTesting):
(prepareConsistentTestingEnvironment):
(resetWebPreferencesToConsistentValues): Deleted.
(webPreferenceFeatureValue): Deleted.
Replace most explicit reseting with the combination of _resetForTesting, automatic
enabling experimental features, and use of _set<type>PreferenceForTestingWithValue
from TestOptions.


Canonical link: https://commits.webkit.org/234988@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@274052 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-03-07 17:41:50 +00:00