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

Side by Side 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, 2 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 unified diff | Download patch
« no previous file with comments | « Source/core/editing/FrameSelection.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "config.h" 5 #include "config.h"
6 #include "core/editing/FrameSelection.h" 6 #include "core/editing/FrameSelection.h"
7 7
8 #include "bindings/core/v8/ExceptionStatePlaceholder.h" 8 #include "bindings/core/v8/ExceptionStatePlaceholder.h"
9 #include "core/dom/Document.h" 9 #include "core/dom/Document.h"
10 #include "core/dom/Element.h" 10 #include "core/dom/Element.h"
11 #include "core/dom/NodeList.h"
11 #include "core/dom/Text.h" 12 #include "core/dom/Text.h"
12 #include "core/frame/FrameView.h" 13 #include "core/frame/FrameView.h"
13 #include "core/html/HTMLBodyElement.h" 14 #include "core/html/HTMLBodyElement.h"
14 #include "core/html/HTMLDocument.h" 15 #include "core/html/HTMLDocument.h"
16 #include "core/html/HTMLTextFormControlElement.h"
15 #include "core/testing/DummyPageHolder.h" 17 #include "core/testing/DummyPageHolder.h"
16 #include "wtf/OwnPtr.h" 18 #include "wtf/OwnPtr.h"
17 #include "wtf/PassRefPtr.h" 19 #include "wtf/PassRefPtr.h"
18 #include "wtf/RefPtr.h" 20 #include "wtf/RefPtr.h"
19 #include "wtf/StdLibExtras.h" 21 #include "wtf/StdLibExtras.h"
20 #include "wtf/testing/WTFTestHelpers.h" 22 #include "wtf/testing/WTFTestHelpers.h"
21 #include <gtest/gtest.h> 23 #include <gtest/gtest.h>
22 24
23 using namespace blink; 25 using namespace blink;
24 26
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
131 FrameView& frameView = dummyPageHolder().frameView(); 133 FrameView& frameView = dummyPageHolder().frameView();
132 IntRect frameRect = frameView.frameRect(); 134 IntRect frameRect = frameView.frameRect();
133 frameRect.setWidth(frameRect.width() + 1); 135 frameRect.setWidth(frameRect.width() + 1);
134 frameRect.setHeight(frameRect.height() + 1); 136 frameRect.setHeight(frameRect.height() + 1);
135 dummyPageHolder().frameView().setFrameRect(frameRect); 137 dummyPageHolder().frameView().setFrameRect(frameRect);
136 } 138 }
137 selection().paintCaret(nullptr, LayoutPoint(), LayoutRect()); 139 selection().paintCaret(nullptr, LayoutPoint(), LayoutRect());
138 EXPECT_EQ(startCount, layoutCount()); 140 EXPECT_EQ(startCount, layoutCount());
139 } 141 }
140 142
143 TEST_F(FrameSelectionTest, UpdateAppearanceOnTextArea)
144 {
145 document().documentElement()->setInnerHTML("<body><textarea id=textarea>text \ntext</textarea></body>", ASSERT_NO_EXCEPTION);
146 document().view()->updateLayoutAndStyleIfNeededRecursive();
147 HTMLTextFormControlElement* textform = toHTMLTextFormControlElement(document ().getElementById("textarea"));
148 RefPtrWillBeRawPtr<NodeList> nodeList = textform->innerEditorElement()->chil dNodes();
149 EXPECT_EQ(3, nodeList->length());
150 Node* node = nodeList->item(2);
151 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
152 textform->setSelectionRange(2, 7);
141 } 153 }
154
155 }
OLDNEW
« 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