Skip to content

Commit

Permalink
Text not visible after undo-ing UnifiedTextReplacement.
Browse files Browse the repository at this point in the history
https://bugs.webkit.org/show_bug.cgi?id=274427
rdar://128292480

Reviewed by Wenson Hsieh and Aditya Keerthi.

We were only clearing document markers in a specific range,
but after text has been replaced, those nodes might not be
in that range any longer. Just clear all the markers associated
with an ID, regardless of location.

* Source/WebCore/dom/DocumentMarkerController.h:
* Source/WebKit/WebProcess/WebPage/Cocoa/UnifiedTextReplacementController.mm:
(WebKit::UnifiedTextReplacementController::removeTransparentMarkersForUUID):

Canonical link: https://commits.webkit.org/279078@main
  • Loading branch information
megangardner committed May 21, 2024
1 parent 435af5b commit b21235b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Source/WebCore/dom/DocumentMarkerController.h
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ class DocumentMarkerController final : public CanMakeCheckedPtr<DocumentMarkerCo
WEBCORE_EXPORT void filterMarkers(const SimpleRange&, const Function<FilterMarkerResult(const DocumentMarker&)>& filterFunction, OptionSet<DocumentMarker::Type> = DocumentMarker::allMarkers(), RemovePartiallyOverlappingMarker = RemovePartiallyOverlappingMarker::No);

WEBCORE_EXPORT void removeMarkers(OptionSet<DocumentMarker::Type> = DocumentMarker::allMarkers());
WEBCORE_EXPORT void removeMarkers(OptionSet<DocumentMarker::Type>, const Function<FilterMarkerResult(const RenderedDocumentMarker&)>& filterFunction);
void removeMarkers(Node&, OptionSet<DocumentMarker::Type> = DocumentMarker::allMarkers());
void repaintMarkers(OptionSet<DocumentMarker::Type> = DocumentMarker::allMarkers());
void shiftMarkers(Node&, unsigned startOffset, int delta);
Expand Down Expand Up @@ -115,7 +116,6 @@ class DocumentMarkerController final : public CanMakeCheckedPtr<DocumentMarkerCo
using MarkerMap = HashMap<Ref<Node>, std::unique_ptr<Vector<RenderedDocumentMarker>>>;

bool possiblyHasMarkers(OptionSet<DocumentMarker::Type>) const;
void removeMarkers(OptionSet<DocumentMarker::Type>, const Function<FilterMarkerResult(const RenderedDocumentMarker&)>& filterFunction);
OptionSet<DocumentMarker::Type> removeMarkersFromList(MarkerMap::iterator, OptionSet<DocumentMarker::Type>, const Function<FilterMarkerResult(const RenderedDocumentMarker&)>& filterFunction = nullptr);

void forEachOfTypes(OptionSet<DocumentMarker::Type>, Function<bool(Node&, RenderedDocumentMarker&)>&&);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -332,9 +332,9 @@
return;
}

document->markers().filterMarkers(range, [&](const WebCore::DocumentMarker& marker) {
document->markers().removeMarkers({ WebCore::DocumentMarker::Type::TransparentContent }, [&](const WebCore::DocumentMarker& marker) {
return std::get<WebCore::DocumentMarker::TransparentContentData>(marker.data()).uuid == uuid ? WebCore::FilterMarkerResult::Remove : WebCore::FilterMarkerResult::Keep;
}, { WebCore::DocumentMarker::Type::TransparentContent });
});
}

void UnifiedTextReplacementController::removeTransparentMarkersForSession(const WTF::UUID& uuid, RemoveAllMarkersForSession removeAll)
Expand Down

0 comments on commit b21235b

Please sign in to comment.