-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
[Unified Text Replacement] Replacements should maintain the original text attributes #25564
Conversation
EWS run on previous version of this PR (hash 4d62c9c) |
EXPECT_EQ(green, observedRed); | ||
EXPECT_EQ(green, observedGreen); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Was this just working before because the tested red and green values were always equal?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yup lol
EWS run on previous version of this PR (hash aa96629) |
|
||
auto newResolvedRange = resolveCharacterRange(*sessionRange, newRange); | ||
RELEASE_ASSERT(sessionRangeCharacterCount >= range.location + range.length); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is this release assert ok to leave in? It's needed because otherwise there would be an underflow in the below lines if this was somehow ever false. I could do an early return with a debug assert too, but this should never ever happen in the first place.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A RELEASE_ASSERT
is not the answer here, unless there is some security implication. Otherwise, why are we creating an even worse user experience because of a bug in our code?
EWS run on previous version of this PR (hash 36022a5) |
|
||
replaceTextInRange(*frame, newResolvedRange, newText); | ||
if (UNLIKELY(sessionRangeCharacterCount < range.location + range.length)) { | ||
RELEASE_LOG(UnifiedTextReplacement, "UnifiedTextReplacementController::textReplacementSessionDidReceiveTextWithReplacementRange (%s) => trying to replace a range larger than the context range (context range count: %llu, range.location %llu, range.length %llu)", uuid.toString().utf8().data(), sessionRangeCharacterCount, range.location, range.length); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit - RELEASE_LOG_ERROR
?
case WebKit::WebTextReplacementData::EditAction::UndoAll: { | ||
auto updatedContents = updatedLiveRange->cloneContents(); | ||
if (updatedContents.hasException()) { | ||
RELEASE_LOG(UnifiedTextReplacement, "UnifiedTextReplacementController::textReplacementSessionDidReceiveEditAction (%s) => exception when cloning contents after action", uuid.toString().utf8().data()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ditto
EWS run on current version of this PR (hash ba0c4ae) |
β¦text attributes https://bugs.webkit.org/show_bug.cgi?id=270606 rdar://122835651 Reviewed by Wenson Hsieh. Add support for attributed strings to work properly and have their attributes persisted. Also, add `WEBCORE_EXPORT` to `showTreeForThis` to ease future debugging, and make a correctness fix for an unrelated API test. * Source/WebCore/dom/Node.h: * Source/WebCore/editing/WebContentReader.h: * Source/WebCore/editing/cocoa/EditorCocoa.mm: (WebCore::Editor::replaceSelectionWithAttributedString): * Source/WebCore/editing/cocoa/WebContentReaderCocoa.mm: (WebCore::createFragment): (WebCore::WebContentReader::readRTFD): (WebCore::WebContentMarkupReader::readRTFD): (WebCore::WebContentReader::readRTF): (WebCore::WebContentMarkupReader::readRTF): (WebCore::createFragmentAndAddResources): Deleted. * Source/WebKit/Sources.txt: * Source/WebKit/SourcesCocoa.txt: * Source/WebKit/WebKit.xcodeproj/project.pbxproj: * Source/WebKit/WebProcess/WebPage/Cocoa/UnifiedTextReplacementController.mm: Renamed from Source/WebKit/WebProcess/WebPage/UnifiedTextReplacementController.cpp. (WebKit::replaceTextInRange): (WebKit::replaceContentsInRange): (WebKit::extendedBoundaryPoint): (WebKit::findReplacementMarkerByUUID): (WebKit::UnifiedTextReplacementController::UnifiedTextReplacementController): (WebKit::UnifiedTextReplacementController::willBeginTextReplacementSession): (WebKit::UnifiedTextReplacementController::didBeginTextReplacementSession): (WebKit::UnifiedTextReplacementController::textReplacementSessionDidReceiveReplacements): (WebKit::UnifiedTextReplacementController::textReplacementSessionDidUpdateStateForReplacement): (WebKit::UnifiedTextReplacementController::didEndTextReplacementSession): (WebKit::UnifiedTextReplacementController::textReplacementSessionDidReceiveTextWithReplacementRange): (WebKit::UnifiedTextReplacementController::textReplacementSessionDidReceiveEditAction): * Source/WebKit/WebProcess/WebPage/UnifiedTextReplacementController.h: * Tools/TestWebKitAPI/Tests/WebKitCocoa/CopyRTF.mm: (checkColor): Canonical link: https://commits.webkit.org/275821@main
ba0c4ae
to
6cffe2c
Compare
Committed 275821@main (6cffe2c): https://commits.webkit.org/275821@main Reviewed commits have been landed. Closing PR #25564 and removing active labels. |
6cffe2c
ba0c4ae
π§ͺ wpe-wk2π§ͺ mac-wk1π§ͺ gtk-wk2π tv-simπ§ͺ api-gtkπ watch-sim