Modified: trunk/Source/WebKit/chromium/ChangeLog (141063 => 141064)
--- trunk/Source/WebKit/chromium/ChangeLog 2013-01-29 07:31:43 UTC (rev 141063)
+++ trunk/Source/WebKit/chromium/ChangeLog 2013-01-29 07:40:28 UTC (rev 141064)
@@ -1,3 +1,13 @@
+2013-01-28 Xianzhu Wang <wangxian...@chromium.org>
+
+ Re-enable WebFrameTest.DivScrollIntoEditableTest
+ https://bugs.webkit.org/show_bug.cgi?id=98558
+
+ Reviewed by Adam Barth.
+
+ * tests/WebFrameTest.cpp: Fixed several issues (onload script, the maximum scale factor, etc.) of WebFrameTest.DivScrollIntoEditableTest and enable it.
+ * tests/data/get_scale_for_zoom_into_editable_test.html: Moved the logic of onload script (which seems not to work) into WebFrameTest.cpp.
+
2013-01-28 Tien-Ren Chen <trc...@chromium.org>
Fix disambiguation popup for new-style page scale
Modified: trunk/Source/WebKit/chromium/tests/WebFrameTest.cpp (141063 => 141064)
--- trunk/Source/WebKit/chromium/tests/WebFrameTest.cpp 2013-01-29 07:31:43 UTC (rev 141063)
+++ trunk/Source/WebKit/chromium/tests/WebFrameTest.cpp 2013-01-29 07:40:28 UTC (rev 141064)
@@ -927,47 +927,45 @@
}
#endif
-// This test depends on code that is compiled conditionally. We likely need to
-// add the proper ifdef when re-enabling it. See
-// https://bugs.webkit.org/show_bug.cgi?id=98558
-TEST_F(WebFrameTest, DISABLED_DivScrollIntoEditableTest)
+TEST_F(WebFrameTest, DivScrollIntoEditableTest)
{
registerMockedHttpURLLoad("get_scale_for_zoom_into_editable_test.html");
int viewportWidth = 640;
int viewportHeight = 480;
- float leftBoxRatio = 0.3f;
int caretPadding = 10;
int minReadableCaretHeight = 18;
WebKit::WebView* webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "get_scale_for_zoom_into_editable_test.html");
webView->enableFixedLayoutMode(true);
webView->resize(WebSize(viewportWidth, viewportHeight));
- webView->setPageScaleFactorLimits(1, 10);
+ webView->setPageScaleFactorLimits(1, 4);
webView->layout();
webView->setDeviceScaleFactor(1.5f);
webView->settings()->setAutoZoomFocusedNodeToLegibleScale(true);
-
WebViewImpl* webViewImpl = static_cast<WebViewImpl*>(webView);
webViewImpl->shouldUseAnimateDoubleTapTimeZeroForTesting(true);
- WebRect editBoxWithText(200, 200, 250, 20);
- WebRect editBoxWithNoText(200, 250, 250, 20);
+ WebRect editBoxWithText(200, 200, 500, 20);
+ WebRect editBoxWithNoText(200, 250, 500, 20);
// Test scrolling the focused node
// The edit box is shorter and narrower than the viewport when legible.
+ webView->advanceFocus(false);
+ // Set the caret to the end of the input box.
+ webView->mainFrame()->document().getElementById("EditBoxWithText").to<WebInputElement>().setSelectionRange(1000, 1000);
setScaleAndScrollAndLayout(webView, WebPoint(0, 0), 1);
WebRect rect, caret;
webViewImpl->selectionBounds(caret, rect);
webView->scrollFocusedNodeIntoRect(rect);
// The edit box should be left aligned with a margin for possible label.
- int hScroll = editBoxWithText.x * webView->pageScaleFactor() - leftBoxRatio * viewportWidth;
+ int hScroll = editBoxWithText.x * webView->pageScaleFactor();
EXPECT_EQ(hScroll, webView->mainFrame()->scrollOffset().width);
int vScroll = editBoxWithText.y * webView->pageScaleFactor() - (viewportHeight - editBoxWithText.height * webView->pageScaleFactor()) / 2;
EXPECT_EQ(vScroll, webView->mainFrame()->scrollOffset().height);
EXPECT_FLOAT_EQ(webView->deviceScaleFactor() * minReadableCaretHeight / caret.height, webView->pageScaleFactor());
// The edit box is wider than the viewport when legible.
- webView->setDeviceScaleFactor(4);
+ webView->setDeviceScaleFactor(2);
setScaleAndScrollAndLayout(webView, WebPoint(0, 0), 1);
webViewImpl->selectionBounds(caret, rect);
webView->scrollFocusedNodeIntoRect(rect);
Modified: trunk/Source/WebKit/chromium/tests/data/get_scale_for_zoom_into_editable_test.html (141063 => 141064)
--- trunk/Source/WebKit/chromium/tests/data/get_scale_for_zoom_into_editable_test.html 2013-01-29 07:31:43 UTC (rev 141063)
+++ trunk/Source/WebKit/chromium/tests/data/get_scale_for_zoom_into_editable_test.html 2013-01-29 07:40:28 UTC (rev 141064)
@@ -1,16 +1,8 @@
<html>
<head>
-<script>
-function getfocus()
-{
-var textfield = document.getElementById('EditBoxWithText');
-textfield.focus();
-textfield.setSelectionRange(textfield.value.length,textfield.value.length);
-}
-</script>
</head>
- <body _onload_="getfocus()">
- <input id="EditBoxWithText" style=" position: absolute; left: 200px; top: 200px; width: 250; height:20" value = "Long text to fill the edit box" type="text">
- <input id="EditBoxWithNoText" style=" position: absolute; left: 200px; top: 250px; width: 250; height:20" type="text">
+ <body>
+ <input id="EditBoxWithText" style=" position: absolute; left: 200px; top: 200px; width: 500px; height:20" value = "Long long long long long long text to fill the edit box" type="text">
+ <input id="EditBoxWithNoText" style=" position: absolute; left: 200px; top: 250px; width: 500px; height:20" type="text">
</body>
</html>