Text manipulation: add a new heuristic to decide paragraph boundary
https://bugs.webkit.org/show_bug.cgi?id=213918

Patch by Sihui Liu <sihui_liu@appe.com> on 2020-07-05
Reviewed by Wenson Hsieh.

Source/WebCore:

Modified test: TextManipulation.StartTextManipulationTreatsInlineBlockLinksAndButtonsAndSpansAsParagraphs.

* editing/TextManipulationController.cpp:
(WebCore::isEnclosingItemBoundaryElement):

Tools:

* TestWebKitAPI/Tests/WebKitCocoa/TextManipulation.mm:
(TestWebKitAPI::TEST):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@263958 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/Source/WebCore/editing/TextManipulationController.cpp b/Source/WebCore/editing/TextManipulationController.cpp
index e1f8442..d052855 100644
--- a/Source/WebCore/editing/TextManipulationController.cpp
+++ b/Source/WebCore/editing/TextManipulationController.cpp
@@ -302,8 +302,8 @@
     if (element.hasTagName(HTMLNames::buttonTag) || role(element) == AccessibilityRole::Button)
         return true;
 
+    auto displayType = renderer->style().display();
     if (element.hasTagName(HTMLNames::liTag) || element.hasTagName(HTMLNames::aTag)) {
-        auto displayType = renderer->style().display();
         if (displayType == DisplayType::Block || displayType == DisplayType::InlineBlock)
             return true;
 
@@ -313,6 +313,9 @@
         }
     }
 
+    if (element.hasTagName(HTMLNames::spanTag) && displayType == DisplayType::InlineBlock)
+        return true;
+
     return false;
 }