WebKit Bugzilla
Attachment 347959 Details for
Bug 188898
: [iOS] Test editing/undo/replace-text-in-node-preserving-markers-crash.html crashes
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
bug-188898-20180823150716.patch (text/plain), 4.05 KB, created by
Daniel Bates
on 2018-08-23 15:07:17 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Daniel Bates
Created:
2018-08-23 15:07:17 PDT
Size:
4.05 KB
patch
obsolete
>Subversion Revision: 235181 >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index 9bb2f679318956483a969cfb524c62e017e67954..39463a10baa7fb8ed054274ea02febbf6e12481f 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,25 @@ >+2018-08-23 Daniel Bates <dabates@apple.com> >+ >+ [iOS] Test editing/undo/replace-text-in-node-preserving-markers-crash.html crashes >+ https://bugs.webkit.org/show_bug.cgi?id=188898 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Not all document markers may have a dictation metadata on iOS. >+ >+ Currently we assume that every marker has dictation alternatives (i.e. DocumentMarker::alternatives() >+ can be called) when deleting a selection preserving document markers on iOS. However, only markers >+ for dictation may have dictation alternatives. For example, document markers for misspelled words do >+ not have dictation metadata by definition. Instead of assuming every marker has dictation alternatives >+ on iOS we need to check the marker type to determine whether it has associated dictation metadata and >+ invoke the appropriate DocumentMarkerController::addMarker() overload. >+ >+ * dom/DocumentMarker.h: >+ (WebCore::DocumentMarker::isDictation const): Added. >+ * editing/CompositeEditCommand.cpp: >+ (WebCore::CompositeEditCommand::replaceTextInNodePreservingMarkers): Only access DocumentMarker::alternatives() >+ and add a dictation marker on iOS if the marker is a dictation marker. >+ > 2018-08-22 Daniel Bates <dabates@apple.com> > > HTML{Image, Link, Script}Element::crossOrigin() should return an AtomicString >diff --git a/Source/WebCore/dom/DocumentMarker.h b/Source/WebCore/dom/DocumentMarker.h >index 3ef6319bbc97dfc01bc15a083ce9451539724a46..7b5fea87575b9b3b12feee68ecee896eef669310 100644 >--- a/Source/WebCore/dom/DocumentMarker.h >+++ b/Source/WebCore/dom/DocumentMarker.h >@@ -127,6 +127,7 @@ public: > void shiftOffsets(int delta); > > #if PLATFORM(IOS) >+ bool isDictation() const; > const Vector<String>& alternatives() const; > void setAlternative(const String&, size_t index); > id metadata() const; >@@ -222,7 +223,12 @@ inline DocumentMarker::DocumentMarker(MarkerType type, unsigned startOffset, uns > , m_endOffset(endOffset) > , m_data(DictationAlternativesData { alternatives, metadata }) > { >- ASSERT(type == DictationPhraseWithAlternatives || type == DictationResult); >+ ASSERT(isDictation()); >+} >+ >+inline bool DocumentMarker::isDictation() const >+{ >+ return m_type == DictationPhraseWithAlternatives || m_type == DictationResult; > } > > inline const Vector<String>& DocumentMarker::alternatives() const >diff --git a/Source/WebCore/editing/CompositeEditCommand.cpp b/Source/WebCore/editing/CompositeEditCommand.cpp >index ea15a0803c1ce83896ce40f142e43aa0eeee056a..d7088a96479ddfbf5315d4827dda220f94c0c006 100644 >--- a/Source/WebCore/editing/CompositeEditCommand.cpp >+++ b/Source/WebCore/editing/CompositeEditCommand.cpp >@@ -769,12 +769,15 @@ void CompositeEditCommand::replaceTextInNodePreservingMarkers(Text& node, unsign > auto markers = copyMarkers(markerController.markersInRange(Range::create(document(), &node, offset, &node, offset + count), DocumentMarker::allMarkers())); > replaceTextInNode(node, offset, count, replacementText); > RefPtr<Range> newRange = Range::create(document(), &node, offset, &node, offset + replacementText.length()); >- for (const auto& marker : markers) >+ for (const auto& marker : markers) { > #if PLATFORM(IOS) >- markerController.addMarker(newRange.get(), marker.type(), marker.description(), marker.alternatives(), marker.metadata()); >-#else >+ if (marker.isDictation()) { >+ markerController.addMarker(newRange.get(), marker.type(), marker.description(), marker.alternatives(), marker.metadata()); >+ continue; >+ } >+#endif > markerController.addMarker(newRange.get(), marker.type(), marker.description()); >-#endif // PLATFORM(IOS) >+ } > } > > Position CompositeEditCommand::positionOutsideTabSpan(const Position& position)
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 188898
:
347947
| 347959