Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(617)

Unified Diff: third_party/WebKit/Source/core/editing/FrameSelectionTest.cpp

Issue 2723913002: Relax text validation in FrameSelection::selectWordAroundPosition (Closed)
Patch Set: update Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/editing/FrameSelectionTest.cpp
diff --git a/third_party/WebKit/Source/core/editing/FrameSelectionTest.cpp b/third_party/WebKit/Source/core/editing/FrameSelectionTest.cpp
index 63aaf27acca6c9f8983ae59bce0187bdb46a8d43..8520376a90306b8e238a691dec0e7a8b06e924e9 100644
--- a/third_party/WebKit/Source/core/editing/FrameSelectionTest.cpp
+++ b/third_party/WebKit/Source/core/editing/FrameSelectionTest.cpp
@@ -8,6 +8,7 @@
#include "bindings/core/v8/ExceptionState.h"
#include "core/dom/Document.h"
#include "core/dom/Element.h"
+#include "core/dom/NodeList.h"
#include "core/dom/Text.h"
#include "core/editing/EditingTestBase.h"
#include "core/editing/FrameCaret.h"
@@ -127,6 +128,19 @@ TEST_F(FrameSelectionTest, SelectWordAroundPosition) {
EXPECT_EQ_SELECTED_TEXT("Baz");
}
+// crbug.com/657996
+TEST_F(FrameSelectionTest, SelectWordAroundPosition2) {
+ setBodyContent(
+ "<p style='width:70px; font-size:14px'>foo bar<em>+</em> baz</p>");
+ // "foo bar
+ // b|az"
+ Node* const baz = document().body()->firstChild()->childNodes()->item(2);
yosin_UTC9 2017/03/01 03:31:03 document().body()->firstChild()->lastChild() is ea
yoichio 2017/03/01 03:42:09 Done.
+ EXPECT_TRUE(selection().selectWordAroundPosition(
+ createVisiblePosition(Position(baz, 2))));
+ // TODO(yoichio): We should select only "baz".
+ EXPECT_EQ_SELECTED_TEXT(" baz");
+}
+
TEST_F(FrameSelectionTest, ModifyExtendWithFlatTree) {
setBodyContent("<span id=host></span>one");
setShadowContent("two<content></content>", "host");

Powered by Google App Engine
This is Rietveld 408576698