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

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

Issue 2613733003: Need to clear viewport dependent units switching print mode. (Closed)
Patch Set: Created 3 years, 11 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/core/css/resolver/StyleResolver.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 0840d8c1b77fabff9833895c78e37f803c92c267..5801086b7986c9ec458142638bfec882042a01e8 100644
--- a/third_party/WebKit/Source/web/tests/WebViewTest.cpp
+++ b/third_party/WebKit/Source/web/tests/WebViewTest.cpp
@@ -89,6 +89,7 @@
#include "public/web/WebFrameContentDumper.h"
#include "public/web/WebHitTestResult.h"
#include "public/web/WebInputMethodController.h"
+#include "public/web/WebPrintParams.h"
#include "public/web/WebScriptSource.h"
#include "public/web/WebSettings.h"
#include "public/web/WebTreeScopeType.h"
@@ -4283,4 +4284,33 @@ TEST_P(WebViewTest, ViewportOverrideAdaptsToScaleAndScroll) {
*devToolsEmulator->visibleContentRectForPainting());
}
+TEST_P(WebViewTest, ResizeForPrintingViewportUnits) {
+ WebViewImpl* webView = m_webViewHelper.initialize();
+ webView->resize(WebSize(800, 600));
+
+ WebURL baseURL = URLTestHelpers::toKURL("http://example.com/");
+ FrameTestHelpers::loadHTMLString(webView->mainFrame(),
+ "<style>#vw { width: 100vw }</style>"
+ "<div id=vw></div>",
+ baseURL);
+
+ WebLocalFrameImpl* frame = webView->mainFrameImpl();
+ Document* document = frame->frame()->document();
+ Element* vwElement = document->getElementById("vw");
+
+ EXPECT_EQ(800, vwElement->offsetWidth());
+
+ WebPrintParams printParams;
+ printParams.printContentArea.width = 500;
+ printParams.printContentArea.height = 500;
+
+ frame->printBegin(printParams, WebNode());
+ webView->resize(WebSize(500, 500));
+ EXPECT_EQ(500, vwElement->offsetWidth());
+
+ webView->resize(WebSize(800, 600));
+ frame->printEnd();
+ EXPECT_EQ(800, vwElement->offsetWidth());
+}
+
} // namespace blink
« no previous file with comments | « third_party/WebKit/Source/core/css/resolver/StyleResolver.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698