Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move EditorState to generated serialization #5540

Conversation

achristensen07
Copy link
Contributor

@achristensen07 achristensen07 commented Oct 19, 2022

897a438

Move EditorState to generated serialization
https://bugs.webkit.org/show_bug.cgi?id=246748

Reviewed by Žan Doberšek.

* Source/WebKit/CMakeLists.txt:
* Source/WebKit/DerivedSources-input.xcfilelist:
* Source/WebKit/DerivedSources.make:
* Source/WebKit/Shared/EditorState.cpp:
(WebKit::operator<<):
(WebKit::EditorState::encode const): Deleted.
(WebKit::EditorState::decode): Deleted.
(WebKit::EditorState::PostLayoutData::encode const): Deleted.
(WebKit::EditorState::PostLayoutData::decode): Deleted.
* Source/WebKit/Shared/EditorState.h:
(WebKit::EditorState::isMissingPostLayoutData const):
(WebKit::EditorState::postLayoutData): Deleted.
(WebKit::EditorState::postLayoutData const const): Deleted.
* Source/WebKit/Shared/EditorState.serialization.in: Added.
* Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm:
(dictionaryRepresentationForEditorState):
* Source/WebKit/UIProcess/API/mac/WKWebViewTestingMac.mm:
(-[WKWebView _candidateRect]):
* Source/WebKit/UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::updateFontAttributesAfterEditorStateChange):
* Source/WebKit/UIProcess/ios/WKContentView.mm:
(-[WKContentView _didCommitLayerTree:]):
* Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm:
(WebKit::WKSelectionDrawingInfo::WKSelectionDrawingInfo):
(-[WKContentView shouldHideSelectionWhenScrolling]):
(-[WKContentView rectToRevealWhenZoomingToFocusedElement]):
(-[WKContentView _selectionClipRect]):
(-[WKContentView canShowNonEmptySelectionView]):
(-[WKContentView webSelectionRects]):
(-[WKContentView _lookupForWebView:]):
(-[WKContentView _shareForWebView:]):
(-[WKContentView _translateForWebView:]):
(-[WKContentView _addShortcutForWebView:]):
(-[WKContentView selectedText]):
(-[WKContentView alternativesForSelectedText]):
(-[WKContentView isReplaceAllowed]):
(-[WKContentView _promptForReplaceForWebView:]):
(-[WKContentView _transliterateChineseForWebView:]):
(-[WKContentView textStylingAtPosition:inDirection:]):
(-[WKContentView _cascadeInteractionTintColor]):
(-[WKContentView canPerformActionForWebView:withSender:]):
(-[WKContentView _showDictionary:]):
(-[WKContentView removeBackgroundMenu]):
(-[WKContentView doAfterComputingImageAnalysisResultsForBackgroundRemoval:]):
(-[WKContentView _characterInRelationToCaretSelection:]):
(-[WKContentView _selectionAtDocumentStart]):
(-[WKContentView textFirstRect]):
(-[WKContentView textLastRect]):
(-[WKContentView textInRange:]):
(-[WKContentView selectedTextRange]):
(-[WKContentView markedTextRange]):
(-[WKContentView hasText]):
(-[WKContentView hasContent]):
(-[WKContentView isPosition:atBoundary:inDirection:]):
(-[WKContentView _updateSelectionAssistantSuppressionState]):
(-[WKContentView _selectionChanged]):
(-[WKContentView _updateChangedSelection:]):
* Source/WebKit/UIProcess/ios/WebPageProxyIOS.mm:
(WebKit::WebPageProxy::dispatchDidUpdateEditorState):
(WebKit::WebPageProxy::selectionBoundingRectInRootViewCoordinates const):
* Source/WebKit/UIProcess/mac/WebViewImpl.mm:
(WebKit::WebViewImpl::selectionDidChange):
(WebKit::WebViewImpl::requestCandidatesForSelectionIfNeeded):
(WebKit::WebViewImpl::handleRequestedCandidates):
(WebKit::WebViewImpl::handleAcceptedCandidate):
(WebKit::WebViewImpl::updateTextTouchBar):
* Source/WebKit/WebKit.xcodeproj/project.pbxproj:
* Source/WebKit/WebProcess/WebPage/Cocoa/WebPageCocoa.mm:
(WebKit::WebPage::getPlatformEditorStateCommon const):
* Source/WebKit/WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::editorState const):
(WebKit::WebPage::sendEditorStateUpdate):
* Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm:
(WebKit::WebPage::getPlatformEditorState const):
* Source/WebKit/WebProcess/WebPage/mac/WebPageMac.mm:
(WebKit::WebPage::getPlatformEditorState const):

Canonical link: https://commits.webkit.org/255806@main

b475818

Misc iOS, tvOS & watchOS macOS Linux Windows
✅ 🧪 style ✅ 🛠 ios ✅ 🛠 mac ✅ 🛠 wpe
✅ 🛠 ios-sim ✅ 🛠 mac-debug ✅ 🛠 gtk ✅ 🛠 wincairo
✅ 🧪 webkitperl ✅ 🧪 ios-wk2 ✅ 🛠 mac-AS-debug ✅ 🧪 gtk-wk2
✅ 🧪 api-ios 🧪 api-mac ✅ 🧪 api-gtk
✅ 🛠 tv ✅ 🧪 mac-wk1
✅ 🛠 tv-sim ✅ 🧪 mac-wk2
✅ 🛠 watch ✅ 🧪 mac-AS-debug-wk2
✅ 🛠 🧪 unsafe-merge ✅ 🛠 watch-sim ✅ 🧪 mac-wk2-stress

@achristensen07 achristensen07 self-assigned this Oct 19, 2022
@achristensen07 achristensen07 added WebKit Local Build WebKit Misc. For miscellaneous bugs in the WebKit framework (and not JavaScriptCore or WebCore). labels Oct 19, 2022
@webkit-ews-buildbot webkit-ews-buildbot added the merging-blocked Applied to prevent a change from being merged label Oct 19, 2022
@achristensen07 achristensen07 force-pushed the eng/Move-EditorState-to-generated-serialization branch from ef74d03 to d566a20 Compare October 19, 2022 17:11
@achristensen07 achristensen07 force-pushed the eng/Move-EditorState-to-generated-serialization branch from d566a20 to 60fb854 Compare October 19, 2022 22:38
@achristensen07 achristensen07 requested review from a team and zdobersek as code owners October 19, 2022 22:38
@achristensen07 achristensen07 force-pushed the eng/Move-EditorState-to-generated-serialization branch from 60fb854 to 0eadda6 Compare October 20, 2022 05:12
@whsieh whsieh self-requested a review October 20, 2022 05:13
bool hasPlainText;
bool editableRootIsTransparentOrFullyClipped;
WebCore::Color caretColor;
bool atStartOfSentence;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This one seems completely unused FWIW, and it wasn't even coded before.

@zdobersek
Copy link
Contributor

Build fixes on GTK/WPE:

diff --git a/Source/WebKit/WebProcess/WebPage/WebPage.cpp b/Source/WebKit/WebProcess/WebPage/WebPage.cpp
index 7c914299fd43..865bdfaa4a1e 100644
--- a/Source/WebKit/WebProcess/WebPage/WebPage.cpp
+++ b/Source/WebKit/WebProcess/WebPage/WebPage.cpp
@@ -1293,7 +1293,7 @@ EditorState WebPage::editorState(ShouldPerformLayout shouldPerformLayout) const
 
     if (auto* frameView = document->view(); frameView && !frameView->needsLayout()) {
         if (!result.postLayoutData)
-            result.postLayoutData = { { } };
+            result.postLayoutData = EditorState::PostLayoutData { };
         result.postLayoutData->canCut = editor.canCut();
         result.postLayoutData->canCopy = editor.canCopy();
         result.postLayoutData->canPaste = editor.canPaste();
diff --git a/Source/WebKit/WebProcess/WebPage/glib/WebPageGLib.cpp b/Source/WebKit/WebProcess/WebPage/glib/WebPageGLib.cpp
index ce6868cf8cce..aa38e4ed708a 100644
--- a/Source/WebKit/WebProcess/WebPage/glib/WebPageGLib.cpp
+++ b/Source/WebKit/WebProcess/WebPage/glib/WebPageGLib.cpp
@@ -104,7 +104,7 @@ void WebPage::getPlatformEditorState(Frame& frame, EditorState& result) const
     if (result.isMissingPostLayoutData() || !frame.view() || frame.view()->needsLayout())
         return;
 
-    auto& postLayoutData = *result.postLayoutData();
+    auto& postLayoutData = *result.postLayoutData;
     postLayoutData.caretRectAtStart = frame.selection().absoluteCaretBounds();
 
     const VisibleSelection& selection = frame.selection().selection();

@achristensen07 achristensen07 force-pushed the eng/Move-EditorState-to-generated-serialization branch from 0eadda6 to b475818 Compare October 20, 2022 19:45
@achristensen07
Copy link
Contributor Author

Thanks, Zan!

@achristensen07 achristensen07 added unsafe-merge-queue Applied to send a pull request to merge-queue, but skip building and testing and removed merging-blocked Applied to prevent a change from being merged labels Oct 20, 2022
https://bugs.webkit.org/show_bug.cgi?id=246748

Reviewed by Žan Doberšek.

* Source/WebKit/CMakeLists.txt:
* Source/WebKit/DerivedSources-input.xcfilelist:
* Source/WebKit/DerivedSources.make:
* Source/WebKit/Shared/EditorState.cpp:
(WebKit::operator<<):
(WebKit::EditorState::encode const): Deleted.
(WebKit::EditorState::decode): Deleted.
(WebKit::EditorState::PostLayoutData::encode const): Deleted.
(WebKit::EditorState::PostLayoutData::decode): Deleted.
* Source/WebKit/Shared/EditorState.h:
(WebKit::EditorState::isMissingPostLayoutData const):
(WebKit::EditorState::postLayoutData): Deleted.
(WebKit::EditorState::postLayoutData const const): Deleted.
* Source/WebKit/Shared/EditorState.serialization.in: Added.
* Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm:
(dictionaryRepresentationForEditorState):
* Source/WebKit/UIProcess/API/mac/WKWebViewTestingMac.mm:
(-[WKWebView _candidateRect]):
* Source/WebKit/UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::updateFontAttributesAfterEditorStateChange):
* Source/WebKit/UIProcess/ios/WKContentView.mm:
(-[WKContentView _didCommitLayerTree:]):
* Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm:
(WebKit::WKSelectionDrawingInfo::WKSelectionDrawingInfo):
(-[WKContentView shouldHideSelectionWhenScrolling]):
(-[WKContentView rectToRevealWhenZoomingToFocusedElement]):
(-[WKContentView _selectionClipRect]):
(-[WKContentView canShowNonEmptySelectionView]):
(-[WKContentView webSelectionRects]):
(-[WKContentView _lookupForWebView:]):
(-[WKContentView _shareForWebView:]):
(-[WKContentView _translateForWebView:]):
(-[WKContentView _addShortcutForWebView:]):
(-[WKContentView selectedText]):
(-[WKContentView alternativesForSelectedText]):
(-[WKContentView isReplaceAllowed]):
(-[WKContentView _promptForReplaceForWebView:]):
(-[WKContentView _transliterateChineseForWebView:]):
(-[WKContentView textStylingAtPosition:inDirection:]):
(-[WKContentView _cascadeInteractionTintColor]):
(-[WKContentView canPerformActionForWebView:withSender:]):
(-[WKContentView _showDictionary:]):
(-[WKContentView removeBackgroundMenu]):
(-[WKContentView doAfterComputingImageAnalysisResultsForBackgroundRemoval:]):
(-[WKContentView _characterInRelationToCaretSelection:]):
(-[WKContentView _selectionAtDocumentStart]):
(-[WKContentView textFirstRect]):
(-[WKContentView textLastRect]):
(-[WKContentView textInRange:]):
(-[WKContentView selectedTextRange]):
(-[WKContentView markedTextRange]):
(-[WKContentView hasText]):
(-[WKContentView hasContent]):
(-[WKContentView isPosition:atBoundary:inDirection:]):
(-[WKContentView _updateSelectionAssistantSuppressionState]):
(-[WKContentView _selectionChanged]):
(-[WKContentView _updateChangedSelection:]):
* Source/WebKit/UIProcess/ios/WebPageProxyIOS.mm:
(WebKit::WebPageProxy::dispatchDidUpdateEditorState):
(WebKit::WebPageProxy::selectionBoundingRectInRootViewCoordinates const):
* Source/WebKit/UIProcess/mac/WebViewImpl.mm:
(WebKit::WebViewImpl::selectionDidChange):
(WebKit::WebViewImpl::requestCandidatesForSelectionIfNeeded):
(WebKit::WebViewImpl::handleRequestedCandidates):
(WebKit::WebViewImpl::handleAcceptedCandidate):
(WebKit::WebViewImpl::updateTextTouchBar):
* Source/WebKit/WebKit.xcodeproj/project.pbxproj:
* Source/WebKit/WebProcess/WebPage/Cocoa/WebPageCocoa.mm:
(WebKit::WebPage::getPlatformEditorStateCommon const):
* Source/WebKit/WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::editorState const):
(WebKit::WebPage::sendEditorStateUpdate):
* Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm:
(WebKit::WebPage::getPlatformEditorState const):
* Source/WebKit/WebProcess/WebPage/mac/WebPageMac.mm:
(WebKit::WebPage::getPlatformEditorState const):

Canonical link: https://commits.webkit.org/255806@main
@webkit-early-warning-system webkit-early-warning-system force-pushed the eng/Move-EditorState-to-generated-serialization branch from b475818 to 897a438 Compare October 20, 2022 22:41
@webkit-commit-queue
Copy link
Collaborator

Committed 255806@main (897a438): https://commits.webkit.org/255806@main

Reviewed commits have been landed. Closing PR #5540 and removing active labels.

@webkit-early-warning-system webkit-early-warning-system merged commit 897a438 into WebKit:main Oct 20, 2022
@webkit-commit-queue webkit-commit-queue removed the unsafe-merge-queue Applied to send a pull request to merge-queue, but skip building and testing label Oct 20, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
WebKit Misc. For miscellaneous bugs in the WebKit framework (and not JavaScriptCore or WebCore).
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants