From d8d8fef2337e5f4be0601af03b2aae72aced2b0f Mon Sep 17 00:00:00 2001 From: Commit Queue Date: Tue, 25 Feb 2020 16:03:12 +0000 Subject: [PATCH] Merge r256563 - Unreviewed, rolling out r254557. https://bugs.webkit.org/show_bug.cgi?id=207725 The assert is correct, but unfortunately it will alwasy fail since there is an existing bug in HTMLTextFormControlElement::indexForPosition(). See bug Reverted changeset: "Enable the offset assertion in HTMLTextFormControlElement::indexForPosition" https://bugs.webkit.org/show_bug.cgi?id=205706 https://trac.webkit.org/changeset/254557 --- Source/WebCore/ChangeLog | 17 +++++++++++++++++ Source/WebCore/accessibility/AXObjectCache.cpp | 2 +- .../AccessibilityRenderObject.cpp | 6 ++++-- .../atk/WebKitAccessibleHyperlink.cpp | 2 +- .../atk/WebKitAccessibleInterfaceText.cpp | 4 ++-- .../accessibility/atk/WebKitAccessibleUtil.cpp | 4 ++-- Source/WebCore/editing/ApplyStyleCommand.cpp | 8 ++++---- .../WebCore/editing/CompositeEditCommand.cpp | 12 +++++------- Source/WebCore/editing/Editing.cpp | 8 ++++---- Source/WebCore/editing/Editing.h | 4 +--- Source/WebCore/editing/TextIterator.cpp | 18 ++++-------------- Source/WebCore/editing/TextIterator.h | 5 ++--- Source/WebCore/editing/TextIteratorBehavior.h | 5 ----- .../editing/ios/DictationCommandIOS.cpp | 5 ++--- .../html/HTMLTextFormControlElement.cpp | 13 ++++++++----- Source/WebCore/page/EventHandler.cpp | 2 +- Source/WebKit/ChangeLog | 17 +++++++++++++++++ .../WebProcess/WebPage/ios/WebPageIOS.mm | 2 +- 18 files changed, 76 insertions(+), 58 deletions(-) diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog index fcfde5deb773..2c9fcd56fee4 100644 --- a/Source/WebCore/ChangeLog +++ b/Source/WebCore/ChangeLog @@ -1,3 +1,20 @@ +2020-02-13 Commit Queue + + Unreviewed, rolling out r254557. + https://bugs.webkit.org/show_bug.cgi?id=207725 + + The assert is correct, but unfortunately it will alwasy fail + since there is an existing bug in + HTMLTextFormControlElement::indexForPosition(). See bug + #207724 for more details. (Requested by dydz on #webkit). + + Reverted changeset: + + "Enable the offset assertion in + HTMLTextFormControlElement::indexForPosition" + https://bugs.webkit.org/show_bug.cgi?id=205706 + https://trac.webkit.org/changeset/254557 + 2020-02-13 Adrian Perez de Castro Non-unified build fixes mid February 2020 edition diff --git a/Source/WebCore/accessibility/AXObjectCache.cpp b/Source/WebCore/accessibility/AXObjectCache.cpp index 328a5eb24029..bd2d8c39113e 100644 --- a/Source/WebCore/accessibility/AXObjectCache.cpp +++ b/Source/WebCore/accessibility/AXObjectCache.cpp @@ -1933,7 +1933,7 @@ RefPtr AXObjectCache::rangeMatchesTextNearRange(RefPtr originalRan return nullptr; auto range = Range::create(m_document, startPosition, originalRange->startPosition()); - unsigned targetOffset = TextIterator::rangeLength(range.ptr(), { TextIteratorLengthOption::GenerateSpacesForReplacedElements }); + unsigned targetOffset = TextIterator::rangeLength(range.ptr(), true); return findClosestPlainText(searchRange.get(), matchText, { }, targetOffset); } diff --git a/Source/WebCore/accessibility/AccessibilityRenderObject.cpp b/Source/WebCore/accessibility/AccessibilityRenderObject.cpp index 9034d693808f..96f33cb734a7 100644 --- a/Source/WebCore/accessibility/AccessibilityRenderObject.cpp +++ b/Source/WebCore/accessibility/AccessibilityRenderObject.cpp @@ -2032,10 +2032,12 @@ int AccessibilityRenderObject::indexForVisiblePosition(const VisiblePosition& po #if USE(ATK) // We need to consider replaced elements for GTK, as they will be // presented with the 'object replacement character' (0xFFFC). - return WebCore::indexForVisiblePosition(*node, position, { TextIteratorLengthOption::GenerateSpacesForReplacedElements }); + bool forSelectionPreservation = true; #else - return WebCore::indexForVisiblePosition(*node, position); + bool forSelectionPreservation = false; #endif + + return WebCore::indexForVisiblePosition(*node, position, forSelectionPreservation); } Element* AccessibilityRenderObject::rootEditableElementForPosition(const Position& position) const diff --git a/Source/WebCore/accessibility/atk/WebKitAccessibleHyperlink.cpp b/Source/WebCore/accessibility/atk/WebKitAccessibleHyperlink.cpp index fd13fc402ea1..a461c1fadaf8 100644 --- a/Source/WebCore/accessibility/atk/WebKitAccessibleHyperlink.cpp +++ b/Source/WebCore/accessibility/atk/WebKitAccessibleHyperlink.cpp @@ -154,7 +154,7 @@ static AtkObject* webkitAccessibleHyperlinkGetObject(AtkHyperlink* link, gint in static gint rangeLengthForObject(AccessibilityObject& obj, Range* range) { // This is going to be the actual length in most of the cases - int baseLength = TextIterator::rangeLength(range, { TextIteratorLengthOption::GenerateSpacesForReplacedElements }); + int baseLength = TextIterator::rangeLength(range, true); // Check whether the current hyperlink belongs to a list item. // If so, we need to consider the length of the item's marker diff --git a/Source/WebCore/accessibility/atk/WebKitAccessibleInterfaceText.cpp b/Source/WebCore/accessibility/atk/WebKitAccessibleInterfaceText.cpp index 08fc78b40e35..b2715c7c53ca 100644 --- a/Source/WebCore/accessibility/atk/WebKitAccessibleInterfaceText.cpp +++ b/Source/WebCore/accessibility/atk/WebKitAccessibleInterfaceText.cpp @@ -410,9 +410,9 @@ static void getSelectionOffsetsForObject(AccessibilityObject* coreObject, Visibl // Set values for start offsets and calculate initial range length. // These values might be adjusted later to cover special cases. - startOffset = webCoreOffsetToAtkOffset(coreObject, TextIterator::rangeLength(rangeInParent.ptr(), { TextIteratorLengthOption::GenerateSpacesForReplacedElements })); + startOffset = webCoreOffsetToAtkOffset(coreObject, TextIterator::rangeLength(rangeInParent.ptr(), true)); auto nodeRange = Range::create(node->document(), nodeRangeStart, nodeRangeEnd); - int rangeLength = TextIterator::rangeLength(nodeRange.ptr(), { TextIteratorLengthOption::GenerateSpacesForReplacedElements }); + int rangeLength = TextIterator::rangeLength(nodeRange.ptr(), true); // Special cases that are only relevant when working with *_END boundaries. if (selection.affinity() == UPSTREAM) { diff --git a/Source/WebCore/accessibility/atk/WebKitAccessibleUtil.cpp b/Source/WebCore/accessibility/atk/WebKitAccessibleUtil.cpp index 509dee5d6c8d..56392c0bd83d 100644 --- a/Source/WebCore/accessibility/atk/WebKitAccessibleUtil.cpp +++ b/Source/WebCore/accessibility/atk/WebKitAccessibleUtil.cpp @@ -247,10 +247,10 @@ AXCoreObject* objectFocusedAndCaretOffsetUnignored(AXCoreObject* referenceObject offset = 0; else if (!isStartOfLine(endPosition)) { RefPtr range = makeRange(startPosition, endPosition.previous()); - offset = TextIterator::rangeLength(range.get(), { TextIteratorLengthOption::GenerateSpacesForReplacedElements }) + 1; + offset = TextIterator::rangeLength(range.get(), true) + 1; } else { RefPtr range = makeRange(startPosition, endPosition); - offset = TextIterator::rangeLength(range.get(), { TextIteratorLengthOption::GenerateSpacesForReplacedElements }); + offset = TextIterator::rangeLength(range.get(), true); } return firstUnignoredParent; diff --git a/Source/WebCore/editing/ApplyStyleCommand.cpp b/Source/WebCore/editing/ApplyStyleCommand.cpp index d80b02111d48..52e6e4e0b17d 100644 --- a/Source/WebCore/editing/ApplyStyleCommand.cpp +++ b/Source/WebCore/editing/ApplyStyleCommand.cpp @@ -252,8 +252,8 @@ void ApplyStyleCommand::applyBlockStyle(EditingStyle& style) auto startRange = Range::create(document(), firstPositionInNode(scope), visibleStart.deepEquivalent().parentAnchoredEquivalent()); auto endRange = Range::create(document(), firstPositionInNode(scope), visibleEnd.deepEquivalent().parentAnchoredEquivalent()); - int startIndex = TextIterator::rangeLength(startRange.ptr(), { TextIteratorLengthOption::GenerateSpacesForReplacedElements }); - int endIndex = TextIterator::rangeLength(endRange.ptr(), { TextIteratorLengthOption::GenerateSpacesForReplacedElements }); + int startIndex = TextIterator::rangeLength(startRange.ptr(), true); + int endIndex = TextIterator::rangeLength(endRange.ptr(), true); VisiblePosition paragraphStart(startOfParagraph(visibleStart)); VisiblePosition nextParagraphStart(endOfParagraph(paragraphStart).next()); @@ -285,8 +285,8 @@ void ApplyStyleCommand::applyBlockStyle(EditingStyle& style) } { - auto startRange = TextIterator::rangeFromLocationAndLength(scope, startIndex, 0, { TextIteratorLengthOption::GenerateSpacesForReplacedElements }); - auto endRange = TextIterator::rangeFromLocationAndLength(scope, endIndex, 0, { TextIteratorLengthOption::GenerateSpacesForReplacedElements }); + auto startRange = TextIterator::rangeFromLocationAndLength(scope, startIndex, 0, true); + auto endRange = TextIterator::rangeFromLocationAndLength(scope, endIndex, 0, true); if (startRange && endRange) updateStartEnd(startRange->startPosition(), endRange->startPosition()); } diff --git a/Source/WebCore/editing/CompositeEditCommand.cpp b/Source/WebCore/editing/CompositeEditCommand.cpp index ffffff187850..5dab7ba101a0 100644 --- a/Source/WebCore/editing/CompositeEditCommand.cpp +++ b/Source/WebCore/editing/CompositeEditCommand.cpp @@ -1433,13 +1433,13 @@ void CompositeEditCommand::moveParagraphs(const VisiblePosition& startOfParagrap startIndex = 0; if (startInParagraph) { auto startRange = Range::create(document(), startOfParagraphToMove.deepEquivalent().parentAnchoredEquivalent(), visibleStart.deepEquivalent().parentAnchoredEquivalent()); - startIndex = TextIterator::rangeLength(startRange.ptr(), { TextIteratorLengthOption::GenerateSpacesForReplacedElements }); + startIndex = TextIterator::rangeLength(startRange.ptr(), true); } endIndex = 0; if (endInParagraph) { auto endRange = Range::create(document(), startOfParagraphToMove.deepEquivalent().parentAnchoredEquivalent(), visibleEnd.deepEquivalent().parentAnchoredEquivalent()); - endIndex = TextIterator::rangeLength(endRange.ptr(), { TextIteratorLengthOption::GenerateSpacesForReplacedElements }); + endIndex = TextIterator::rangeLength(endRange.ptr(), true); } } } @@ -1510,7 +1510,7 @@ void CompositeEditCommand::moveParagraphs(const VisiblePosition& startOfParagrap editableRoot = &document(); auto startToDestinationRange = Range::create(document(), firstPositionInNode(editableRoot.get()), destination.deepEquivalent().parentAnchoredEquivalent()); - destinationIndex = TextIterator::rangeLength(startToDestinationRange.ptr(), { TextIteratorLengthOption::GenerateSpacesForReplacedElements }); + destinationIndex = TextIterator::rangeLength(startToDestinationRange.ptr(), true); setEndingSelection(VisibleSelection(destination, originalIsDirectional)); ASSERT(endingSelection().isCaretOrRange()); @@ -1532,10 +1532,8 @@ void CompositeEditCommand::moveParagraphs(const VisiblePosition& startOfParagrap // causes spaces to be collapsed during the move operation. This results // in a call to rangeFromLocationAndLength with a location past the end // of the document (which will return null). - RefPtr start = TextIterator::rangeFromLocationAndLength(editableRoot.get(), destinationIndex + startIndex, 0, - { TextIteratorLengthOption::GenerateSpacesForReplacedElements }); - RefPtr end = TextIterator::rangeFromLocationAndLength(editableRoot.get(), destinationIndex + endIndex, 0, - { TextIteratorLengthOption::GenerateSpacesForReplacedElements }); + RefPtr start = TextIterator::rangeFromLocationAndLength(editableRoot.get(), destinationIndex + startIndex, 0, true); + RefPtr end = TextIterator::rangeFromLocationAndLength(editableRoot.get(), destinationIndex + endIndex, 0, true); if (start && end) setEndingSelection(VisibleSelection(start->startPosition(), end->startPosition(), DOWNSTREAM, originalIsDirectional)); } diff --git a/Source/WebCore/editing/Editing.cpp b/Source/WebCore/editing/Editing.cpp index 0c2868d16d3c..fd5e595acb51 100644 --- a/Source/WebCore/editing/Editing.cpp +++ b/Source/WebCore/editing/Editing.cpp @@ -1084,14 +1084,14 @@ int indexForVisiblePosition(const VisiblePosition& visiblePosition, RefPtr options) +int indexForVisiblePosition(Node& node, const VisiblePosition& visiblePosition, bool forSelectionPreservation) { auto range = Range::create(node.document(), firstPositionInNode(&node), visiblePosition.deepEquivalent().parentAnchoredEquivalent()); - return TextIterator::rangeLength(range.ptr(), options); + return TextIterator::rangeLength(range.ptr(), forSelectionPreservation); } VisiblePosition visiblePositionForPositionWithOffset(const VisiblePosition& position, int offset) @@ -1106,7 +1106,7 @@ VisiblePosition visiblePositionForPositionWithOffset(const VisiblePosition& posi VisiblePosition visiblePositionForIndex(int index, ContainerNode* scope) { - auto range = TextIterator::rangeFromLocationAndLength(scope, index, 0, { TextIteratorLengthOption::GenerateSpacesForReplacedElements }); + auto range = TextIterator::rangeFromLocationAndLength(scope, index, 0, true); // Check for an invalid index. Certain editing operations invalidate indices because // of problems with TextIteratorEmitsCharactersBetweenAllVisiblePositions. if (!range) diff --git a/Source/WebCore/editing/Editing.h b/Source/WebCore/editing/Editing.h index 09589f3d9f0f..745b76381ee2 100644 --- a/Source/WebCore/editing/Editing.h +++ b/Source/WebCore/editing/Editing.h @@ -26,10 +26,8 @@ #pragma once #include "Position.h" -#include "TextIteratorBehavior.h" #include #include -#include #include namespace WebCore { @@ -151,7 +149,7 @@ bool lineBreakExistsAtVisiblePosition(const VisiblePosition&); WEBCORE_EXPORT int comparePositions(const VisiblePosition&, const VisiblePosition&); WEBCORE_EXPORT int indexForVisiblePosition(const VisiblePosition&, RefPtr& scope); -int indexForVisiblePosition(Node&, const VisiblePosition&, OptionSet = { }); +int indexForVisiblePosition(Node&, const VisiblePosition&, bool forSelectionPreservation); WEBCORE_EXPORT VisiblePosition visiblePositionForPositionWithOffset(const VisiblePosition&, int offset); WEBCORE_EXPORT VisiblePosition visiblePositionForIndex(int index, ContainerNode* scope); VisiblePosition visiblePositionForIndexUsingCharacterIterator(Node&, int index); // FIXME: Why do we need this version? diff --git a/Source/WebCore/editing/TextIterator.cpp b/Source/WebCore/editing/TextIterator.cpp index a111bdfd9639..53c2d256ed28 100644 --- a/Source/WebCore/editing/TextIterator.cpp +++ b/Source/WebCore/editing/TextIterator.cpp @@ -2396,20 +2396,10 @@ size_t SearchBuffer::length() const // -------- -static TextIteratorBehavior behaviorFromLegnthOptions(OptionSet options) -{ - TextIteratorBehavior behavior = TextIteratorDefaultBehavior; - if (options.contains(TextIteratorLengthOption::GenerateSpacesForReplacedElements)) - behavior |= TextIteratorEmitsCharactersBetweenAllVisiblePositions; - if (options.contains(TextIteratorLengthOption::IgnoreVisibility)) - behavior |= TextIteratorIgnoresStyleVisibility; - return behavior; -} - -int TextIterator::rangeLength(const Range* range, OptionSet options) +int TextIterator::rangeLength(const Range* range, bool forSelectionPreservation) { unsigned length = 0; - for (TextIterator it(range, behaviorFromLegnthOptions(options)); !it.atEnd(); it.advance()) + for (TextIterator it(range, forSelectionPreservation ? TextIteratorEmitsCharactersBetweenAllVisiblePositions : TextIteratorDefaultBehavior); !it.atEnd(); it.advance()) length += it.text().length(); return length; } @@ -2428,7 +2418,7 @@ static inline bool isInsideReplacedElement(TextIterator& iterator) return node && isRendererReplacedElement(node->renderer()); } -RefPtr TextIterator::rangeFromLocationAndLength(ContainerNode* scope, int rangeLocation, int rangeLength, OptionSet options) +RefPtr TextIterator::rangeFromLocationAndLength(ContainerNode* scope, int rangeLocation, int rangeLength, bool forSelectionPreservation) { Ref resultRange = scope->document().createRange(); @@ -2438,7 +2428,7 @@ RefPtr TextIterator::rangeFromLocationAndLength(ContainerNode* scope, int Ref textRunRange = rangeOfContents(*scope); - TextIterator it(textRunRange.ptr(), behaviorFromLegnthOptions(options)); + TextIterator it(textRunRange.ptr(), forSelectionPreservation ? TextIteratorEmitsCharactersBetweenAllVisiblePositions : TextIteratorDefaultBehavior); // FIXME: the atEnd() check shouldn't be necessary, workaround for . if (!rangeLocation && !rangeLength && it.atEnd()) { diff --git a/Source/WebCore/editing/TextIterator.h b/Source/WebCore/editing/TextIterator.h index 92aea7e8ddc4..10304aff878f 100644 --- a/Source/WebCore/editing/TextIterator.h +++ b/Source/WebCore/editing/TextIterator.h @@ -31,7 +31,6 @@ #include "LineLayoutTraversal.h" #include "Range.h" #include "TextIteratorBehavior.h" -#include #include #include @@ -122,8 +121,8 @@ class TextIterator { const TextIteratorCopyableText& copyableText() const { ASSERT(!atEnd()); return m_copyableText; } void appendTextToStringBuilder(StringBuilder& builder) const { copyableText().appendToStringBuilder(builder); } - WEBCORE_EXPORT static int rangeLength(const Range*, OptionSet = { }); - WEBCORE_EXPORT static RefPtr rangeFromLocationAndLength(ContainerNode* scope, int rangeLocation, int rangeLength, OptionSet = { }); + WEBCORE_EXPORT static int rangeLength(const Range*, bool spacesForReplacedElements = false); + WEBCORE_EXPORT static RefPtr rangeFromLocationAndLength(ContainerNode* scope, int rangeLocation, int rangeLength, bool spacesForReplacedElements = false); WEBCORE_EXPORT static bool getLocationAndLengthFromRange(Node* scope, const Range*, size_t& location, size_t& length); WEBCORE_EXPORT static Ref subrange(Range& entireRange, int characterOffset, int characterCount); diff --git a/Source/WebCore/editing/TextIteratorBehavior.h b/Source/WebCore/editing/TextIteratorBehavior.h index a570ec0447c6..c01f97f82d28 100644 --- a/Source/WebCore/editing/TextIteratorBehavior.h +++ b/Source/WebCore/editing/TextIteratorBehavior.h @@ -63,9 +63,4 @@ enum TextIteratorBehaviorFlag { typedef unsigned short TextIteratorBehavior; -enum class TextIteratorLengthOption : uint8_t { - GenerateSpacesForReplacedElements = 1 << 0, - IgnoreVisibility = 1 << 1, -}; - } // namespace WebCore diff --git a/Source/WebCore/editing/ios/DictationCommandIOS.cpp b/Source/WebCore/editing/ios/DictationCommandIOS.cpp index c18edc0bd580..9c1ae888951f 100644 --- a/Source/WebCore/editing/ios/DictationCommandIOS.cpp +++ b/Source/WebCore/editing/ios/DictationCommandIOS.cpp @@ -68,12 +68,11 @@ void DictationCommandIOS::doApply() // FIXME: Add the result marker using a Position cached before results are inserted, instead of relying on TextIterators. auto rangeToEnd = Range::create(document(), createLegacyEditingPosition((Node *)root, 0), afterResults.deepEquivalent()); - int endIndex = TextIterator::rangeLength(rangeToEnd.ptr(), { TextIteratorLengthOption::GenerateSpacesForReplacedElements }); + int endIndex = TextIterator::rangeLength(rangeToEnd.ptr(), true); int startIndex = endIndex - resultLength; if (startIndex >= 0) { - RefPtr resultRange = TextIterator::rangeFromLocationAndLength(document().documentElement(), startIndex, endIndex, - { TextIteratorLengthOption::GenerateSpacesForReplacedElements }); + RefPtr resultRange = TextIterator::rangeFromLocationAndLength(document().documentElement(), startIndex, endIndex, true); ASSERT(resultRange); // FIXME: What guarantees this? document().markers().addDictationResultMarker(*resultRange, m_metadata); } diff --git a/Source/WebCore/html/HTMLTextFormControlElement.cpp b/Source/WebCore/html/HTMLTextFormControlElement.cpp index ff4e9d980ba3..3c9b338fd262 100644 --- a/Source/WebCore/html/HTMLTextFormControlElement.cpp +++ b/Source/WebCore/html/HTMLTextFormControlElement.cpp @@ -655,13 +655,16 @@ unsigned HTMLTextFormControlElement::indexForPosition(const Position& passedPosi unsigned length = innerTextValue().length(); index = std::min(index, length); // FIXME: We shouldn't have to call innerTextValue() just to ignore the last LF. See finishText. +#if 0 + // FIXME: This assertion code was never built, has bit rotted, and needs to be fixed before it can be enabled: + // https://bugs.webkit.org/show_bug.cgi?id=205706. #if ASSERT_ENABLED VisiblePosition visiblePosition = passedPosition; - if (visiblePosition.isNotNull()) { - unsigned indexComputedByVisiblePosition = WebCore::indexForVisiblePosition(*innerText, visiblePosition, - { TextIteratorLengthOption::GenerateSpacesForReplacedElements, TextIteratorLengthOption::IgnoreVisibility }); - ASSERT(index == indexComputedByVisiblePosition); - } + unsigned indexComputedByVisiblePosition = 0; + if (visiblePosition.isNotNull()) + indexComputedByVisiblePosition = WebCore::indexForVisiblePosition(innerText, visiblePosition, false /* forSelectionPreservation */); + ASSERT(index == indexComputedByVisiblePosition); +#endif #endif return index; } diff --git a/Source/WebCore/page/EventHandler.cpp b/Source/WebCore/page/EventHandler.cpp index 523ad3919ef1..fab4acf35095 100644 --- a/Source/WebCore/page/EventHandler.cpp +++ b/Source/WebCore/page/EventHandler.cpp @@ -656,7 +656,7 @@ bool EventHandler::handleMousePressEventTripleClick(const MouseEventWithHitTestR static int textDistance(const Position& start, const Position& end) { auto range = Range::create(start.anchorNode()->document(), start, end); - return TextIterator::rangeLength(range.ptr(), { TextIteratorLengthOption::GenerateSpacesForReplacedElements }); + return TextIterator::rangeLength(range.ptr(), true); } bool EventHandler::handleMousePressEventSingleClick(const MouseEventWithHitTestResults& event) diff --git a/Source/WebKit/ChangeLog b/Source/WebKit/ChangeLog index b2f35b2ee52a..961bc976b346 100644 --- a/Source/WebKit/ChangeLog +++ b/Source/WebKit/ChangeLog @@ -1,3 +1,20 @@ +2020-02-13 Commit Queue + + Unreviewed, rolling out r254557. + https://bugs.webkit.org/show_bug.cgi?id=207725 + + The assert is correct, but unfortunately it will alwasy fail + since there is an existing bug in + HTMLTextFormControlElement::indexForPosition(). See bug + #207724 for more details. (Requested by dydz on #webkit). + + Reverted changeset: + + "Enable the offset assertion in + HTMLTextFormControlElement::indexForPosition" + https://bugs.webkit.org/show_bug.cgi?id=205706 + https://trac.webkit.org/changeset/254557 + 2020-02-13 Said Abou-Hallawa Unreviewed, rolling out r255158, 255405 and r255486 diff --git a/Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm b/Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm index 8517a2fc8a03..7849ab50593d 100644 --- a/Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm +++ b/Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm @@ -1958,7 +1958,7 @@ static IntPoint constrainPoint(const IntPoint& point, const Frame& frame, const static RefPtr rangeNearPositionMatchesText(const VisiblePosition& position, RefPtr originalRange, const String& matchText, RefPtr selectionRange) { auto range = Range::create(selectionRange->ownerDocument(), selectionRange->startPosition(), position.deepEquivalent().parentAnchoredEquivalent()); - unsigned targetOffset = TextIterator::rangeLength(range.ptr(), { TextIteratorLengthOption::GenerateSpacesForReplacedElements }); + unsigned targetOffset = TextIterator::rangeLength(range.ptr(), true); return findClosestPlainText(*selectionRange.get(), matchText, { }, targetOffset); }