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

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

Issue 236083003: Use document's contentSize when the HTML element is selected. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 8 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/web/WebViewImpl.cpp ('k') | Source/web/tests/data/select_range_basic_broken_height.html » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/web/tests/WebViewTest.cpp
diff --git a/Source/web/tests/WebViewTest.cpp b/Source/web/tests/WebViewTest.cpp
index 58e1e7f04a583bee1c40d810a15f67e9c79d134d..657f90fd4ad235d65cf08a92b501430f6b162905 100644
--- a/Source/web/tests/WebViewTest.cpp
+++ b/Source/web/tests/WebViewTest.cpp
@@ -1662,7 +1662,11 @@ static WebRect ExpectedRootBounds(WebCore::Document* document, float scaleFactor
if (element->hasTagName(WebCore::HTMLNames::iframeTag))
return ExpectedRootBounds(toHTMLIFrameElement(element)->contentDocument(), scaleFactor);
- WebCore::IntRect boundingBox = element->pixelSnappedBoundingBox();
+ WebCore::IntRect boundingBox;
+ if (element->hasTagName(WebCore::HTMLNames::htmlTag))
+ boundingBox = WebCore::IntRect(WebCore::IntPoint(0, 0), document->frame()->view()->contentsSize());
+ else
+ boundingBox = element->pixelSnappedBoundingBox();
boundingBox = document->frame()->view()->contentsToWindow(boundingBox);
boundingBox.scale(scaleFactor);
return boundingBox;
@@ -1742,6 +1746,27 @@ TEST_F(WebViewTest, GetSelectionRootBounds)
testSelectionRootBounds("select_range_basic.html", 2.0f);
}
+TEST_F(WebViewTest, GetSelectionRootBoundsBrokenHeight)
+{
+ WebSize contentSize = WebSize(640, 480);
+
+ registerMockedHttpURLLoad("select_range_basic_broken_height.html");
+
+ WebView* webView = m_webViewHelper.initializeAndLoad(m_baseURL + "select_range_basic_broken_height.html", true);
+ webView->resize(contentSize);
+ webView->setPageScaleFactor(1.0f, WebPoint(0, 0));
+ webView->layout();
+ runPendingTasks();
+
+ WebFrameImpl* frame = toWebFrameImpl(webView->mainFrame());
+ EXPECT_TRUE(frame->frame()->document()->isHTMLDocument());
+
+ WebRect expectedRootBounds = WebRect(0, 0, contentSize.width, contentSize.height);
+ WebRect actualRootBounds;
+ webView->getSelectionRootBounds(actualRootBounds);
+ ASSERT_EQ(expectedRootBounds, actualRootBounds);
+}
+
class NonUserInputTextUpdateWebViewClient : public WebViewClient {
public:
NonUserInputTextUpdateWebViewClient() : m_textIsUpdated(false) { }
« no previous file with comments | « Source/web/WebViewImpl.cpp ('k') | Source/web/tests/data/select_range_basic_broken_height.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698