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) { } |