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

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

Issue 610323003: Editing: Null-check in FrameSelection::updteAppearancea (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Add unit test Created 6 years, 3 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
« no previous file with comments | « Source/core/editing/FrameSelection.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/editing/FrameSelectionTest.cpp
diff --git a/Source/core/editing/FrameSelectionTest.cpp b/Source/core/editing/FrameSelectionTest.cpp
index 39b8957fbe3b9715d048b3f39cba35b0226effe1..1668d4410bdb4f1b0e82610197f9c4f367b4d578 100644
--- a/Source/core/editing/FrameSelectionTest.cpp
+++ b/Source/core/editing/FrameSelectionTest.cpp
@@ -8,10 +8,12 @@
#include "bindings/core/v8/ExceptionStatePlaceholder.h"
#include "core/dom/Document.h"
#include "core/dom/Element.h"
+#include "core/dom/NodeList.h"
#include "core/dom/Text.h"
#include "core/frame/FrameView.h"
#include "core/html/HTMLBodyElement.h"
#include "core/html/HTMLDocument.h"
+#include "core/html/HTMLTextFormControlElement.h"
#include "core/testing/DummyPageHolder.h"
#include "wtf/OwnPtr.h"
#include "wtf/PassRefPtr.h"
@@ -138,4 +140,16 @@ TEST_F(FrameSelectionTest, PaintCaretShouldNotLayout)
EXPECT_EQ(startCount, layoutCount());
}
+TEST_F(FrameSelectionTest, UpdateAppearanceOnTextArea)
+{
+ document().documentElement()->setInnerHTML("<body><textarea id=textarea>text\ntext</textarea></body>", ASSERT_NO_EXCEPTION);
+ document().view()->updateLayoutAndStyleIfNeededRecursive();
+ HTMLTextFormControlElement* textform = toHTMLTextFormControlElement(document().getElementById("textarea"));
+ RefPtrWillBeRawPtr<NodeList> nodeList = textform->innerEditorElement()->childNodes();
+ EXPECT_EQ(3, nodeList->length());
+ Node* node = nodeList->item(2);
+ node->setRenderer(nullptr);
Yuta Kitamura 2014/10/01 08:19:48 I'm almost certain that you shouldn't simply call
Yuta Kitamura 2014/10/01 08:49:32 I have little knowledge around this, but you could
+ textform->setSelectionRange(2, 7);
+}
+
}
« no previous file with comments | « Source/core/editing/FrameSelection.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698