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

Unified Diff: third_party/WebKit/Source/web/tests/WebViewTest.cpp

Issue 2272793002: Make WebViewImpl::textInputInfo update layout before working on ranges. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Actually working test added. Created 4 years, 4 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 | « third_party/WebKit/Source/web/WebViewImpl.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/web/tests/WebViewTest.cpp
diff --git a/third_party/WebKit/Source/web/tests/WebViewTest.cpp b/third_party/WebKit/Source/web/tests/WebViewTest.cpp
index c542443721ecc9ea3c9f7e82fa981a181ebd2ffb..2b2b45ea3e00914784f39d40366c2aa56b472661 100644
--- a/third_party/WebKit/Source/web/tests/WebViewTest.cpp
+++ b/third_party/WebKit/Source/web/tests/WebViewTest.cpp
@@ -731,6 +731,35 @@ TEST_F(WebViewTest, TextInputType)
testTextInputType(WebTextInputTypeURL, "input_field_url.html");
}
+TEST_F(WebViewTest, TextInputInfoUpdateStyleAndLayout)
+{
+ FrameTestHelpers::TestWebViewClient client;
+ FrameTestHelpers::WebViewHelper m_webViewHelper;
+ WebViewImpl* webViewImpl = m_webViewHelper.initialize(true, 0, &client);
esprehn 2016/08/26 05:23:03 I suspect this would be a pretty simple SimTest wi
+
+ WebURL baseURL = URLTestHelpers::toKURL("http://example.com/");
+ // Here, we need to construct a document that has a special property:
+ // Adding id="foo" to the <path> element will trigger creation of an SVG instance tree
+ // for the use <use> element.
+ // This is significant, because SVG instance trees are actually created lazily
+ // during Document::updateStyleAndLayout code, thus incrementing the DOM tree version
+ // and freaking out the EphemeralRange (invalidating it).
+ FrameTestHelpers::loadHTMLString(webViewImpl->mainFrame(),
+ "<svg height=\"100%\" version=\"1.1\" viewBox=\"0 0 14 14\" width=\"100%\">"
esprehn 2016/08/26 05:23:03 if you use single quotes you can avoid the escapes
+ "<use xmlns:xlink=\"http://www.w3.org/1999/xlink\" xlink:href=\"#foo\"></use>"
+ "<path d=\"M 100 100 L 300 100 L 200 300 z\" fill=\"#000\"></path>"
+ "</svg>"
+ "<input>", baseURL);
+ webViewImpl->setInitialFocus(false);
+
+ // Add id="foo" to <path>, thus triggering the condition described above.
+ LocalFrame* mainFrameLocal = toLocalFrame(webViewImpl->page()->mainFrame());
+ mainFrameLocal->document()->body()->querySelector("path", IGNORE_EXCEPTION)->setIdAttribute("foo");
esprehn 2016/08/26 05:23:02 don't ignore the exception, ASSERT_NO_EXCEPTION, w
+
+ // This should not DCHECK.
+ EXPECT_EQ(WebTextInputTypeText, webViewImpl->textInputInfo().type);
+}
+
void WebViewTest::testInputMode(const WebString& expectedInputMode, const std::string& htmlFile)
{
URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c_str()), WebString::fromUTF8(htmlFile.c_str()));
« no previous file with comments | « third_party/WebKit/Source/web/WebViewImpl.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698