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

Side by Side 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 unified diff | 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 »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2011, 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2011, 2012 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 #include "public/web/WebCache.h" 82 #include "public/web/WebCache.h"
83 #include "public/web/WebDateTimeChooserCompletion.h" 83 #include "public/web/WebDateTimeChooserCompletion.h"
84 #include "public/web/WebDeviceEmulationParams.h" 84 #include "public/web/WebDeviceEmulationParams.h"
85 #include "public/web/WebDocument.h" 85 #include "public/web/WebDocument.h"
86 #include "public/web/WebElement.h" 86 #include "public/web/WebElement.h"
87 #include "public/web/WebFrame.h" 87 #include "public/web/WebFrame.h"
88 #include "public/web/WebFrameClient.h" 88 #include "public/web/WebFrameClient.h"
89 #include "public/web/WebFrameContentDumper.h" 89 #include "public/web/WebFrameContentDumper.h"
90 #include "public/web/WebHitTestResult.h" 90 #include "public/web/WebHitTestResult.h"
91 #include "public/web/WebInputMethodController.h" 91 #include "public/web/WebInputMethodController.h"
92 #include "public/web/WebPrintParams.h"
92 #include "public/web/WebScriptSource.h" 93 #include "public/web/WebScriptSource.h"
93 #include "public/web/WebSettings.h" 94 #include "public/web/WebSettings.h"
94 #include "public/web/WebTreeScopeType.h" 95 #include "public/web/WebTreeScopeType.h"
95 #include "public/web/WebViewClient.h" 96 #include "public/web/WebViewClient.h"
96 #include "public/web/WebWidget.h" 97 #include "public/web/WebWidget.h"
97 #include "public/web/WebWidgetClient.h" 98 #include "public/web/WebWidgetClient.h"
98 #include "testing/gtest/include/gtest/gtest.h" 99 #include "testing/gtest/include/gtest/gtest.h"
99 #include "third_party/skia/include/core/SkBitmap.h" 100 #include "third_party/skia/include/core/SkBitmap.h"
100 #include "third_party/skia/include/core/SkCanvas.h" 101 #include "third_party/skia/include/core/SkCanvas.h"
101 #include "web/DevToolsEmulator.h" 102 #include "web/DevToolsEmulator.h"
(...skipping 4174 matching lines...) Expand 10 before | Expand all | Expand 10 after
4276 .translate(-50, -55) 4277 .translate(-50, -55)
4277 .translate(50, 55) 4278 .translate(50, 55)
4278 .scale(1. / 2.f); 4279 .scale(1. / 2.f);
4279 EXPECT_EQ(expectedMatrix, 4280 EXPECT_EQ(expectedMatrix,
4280 webViewImpl->getDeviceEmulationTransformForTesting()); 4281 webViewImpl->getDeviceEmulationTransformForTesting());
4281 // visibleContentRect doesn't change. 4282 // visibleContentRect doesn't change.
4282 EXPECT_EQ(IntRect(50, 55, 50, 75), 4283 EXPECT_EQ(IntRect(50, 55, 50, 75),
4283 *devToolsEmulator->visibleContentRectForPainting()); 4284 *devToolsEmulator->visibleContentRectForPainting());
4284 } 4285 }
4285 4286
4287 TEST_P(WebViewTest, ResizeForPrintingViewportUnits) {
4288 WebViewImpl* webView = m_webViewHelper.initialize();
4289 webView->resize(WebSize(800, 600));
4290
4291 WebURL baseURL = URLTestHelpers::toKURL("http://example.com/");
4292 FrameTestHelpers::loadHTMLString(webView->mainFrame(),
4293 "<style>#vw { width: 100vw }</style>"
4294 "<div id=vw></div>",
4295 baseURL);
4296
4297 WebLocalFrameImpl* frame = webView->mainFrameImpl();
4298 Document* document = frame->frame()->document();
4299 Element* vwElement = document->getElementById("vw");
4300
4301 EXPECT_EQ(800, vwElement->offsetWidth());
4302
4303 WebPrintParams printParams;
4304 printParams.printContentArea.width = 500;
4305 printParams.printContentArea.height = 500;
4306
4307 frame->printBegin(printParams, WebNode());
4308 webView->resize(WebSize(500, 500));
4309 EXPECT_EQ(500, vwElement->offsetWidth());
4310
4311 webView->resize(WebSize(800, 600));
4312 frame->printEnd();
4313 EXPECT_EQ(800, vwElement->offsetWidth());
4314 }
4315
4286 } // namespace blink 4316 } // namespace blink
OLDNEW
« 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