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

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

Issue 2420413005: Collect @viewport before constructing RuleSets. (Closed)
Patch Set: Rebased Created 4 years, 2 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
Index: third_party/WebKit/Source/web/tests/WebFrameTest.cpp
diff --git a/third_party/WebKit/Source/web/tests/WebFrameTest.cpp b/third_party/WebKit/Source/web/tests/WebFrameTest.cpp
index 515c9b2a1e4d61e72e8d90727a2a550008b922e5..da892f9cf4fb0e3017ee2170a17456c567be7e4f 100644
--- a/third_party/WebKit/Source/web/tests/WebFrameTest.cpp
+++ b/third_party/WebKit/Source/web/tests/WebFrameTest.cpp
@@ -2696,10 +2696,7 @@ TEST_P(ParameterizedWebFrameTest,
EXPECT_NEAR(5.0f, webViewHelper.webView()->maximumPageScaleFactor(), 0.01f);
}
-// TODO(rune@opera.com): Does not pass until we collect author @viewport rules
-// before constructing the RuleSets. https://crbug.com/332763
-TEST_P(ParameterizedWebFrameTest,
- DISABLED_AtViewportInsideAtMediaInitialViewport) {
+TEST_P(ParameterizedWebFrameTest, AtViewportInsideAtMediaInitialViewport) {
registerMockedHttpURLLoad("viewport-inside-media.html");
FixedLayoutTestWebViewClient client;
@@ -2716,6 +2713,54 @@ TEST_P(ParameterizedWebFrameTest,
.width());
}
+TEST_P(ParameterizedWebFrameTest, AtViewportAffectingAtMediaRecalcCount) {
+ registerMockedHttpURLLoad("viewport-and-media.html");
+
+ FixedLayoutTestWebViewClient client;
+ FrameTestHelpers::WebViewHelper webViewHelper;
+ webViewHelper.initialize(true, nullptr, &client, nullptr,
+ enableViewportSettings);
+ webViewHelper.resize(WebSize(640, 480));
+ FrameTestHelpers::loadFrame(webViewHelper.webView()->mainFrame(),
+ m_baseURL + "viewport-and-media.html");
+
+ Document* document =
+ webViewHelper.webView()->mainFrameImpl()->frame()->document();
+ EXPECT_EQ(2000, webViewHelper.webView()
+ ->mainFrameImpl()
+ ->frameView()
+ ->layoutSize()
+ .width());
+
+ // The styleForElementCount() should match the number of elements for a single
+ // pass of computed styles construction for the document.
+ EXPECT_EQ(10u, document->styleEngine().styleForElementCount());
+ EXPECT_EQ(Color(0, 128, 0),
+ document->body()->computedStyle()->visitedDependentColor(
+ CSSPropertyColor));
+}
+
+TEST_P(ParameterizedWebFrameTest, AtViewportWithViewportLengths) {
+ registerMockedHttpURLLoad("viewport-lengths.html");
+
+ FixedLayoutTestWebViewClient client;
+ FrameTestHelpers::WebViewHelper webViewHelper;
+ webViewHelper.initialize(true, nullptr, &client, nullptr,
+ enableViewportSettings);
+ webViewHelper.resize(WebSize(800, 600));
+ FrameTestHelpers::loadFrame(webViewHelper.webView()->mainFrame(),
+ m_baseURL + "viewport-lengths.html");
+
+ FrameView* view = webViewHelper.webView()->mainFrameImpl()->frameView();
+ EXPECT_EQ(400, view->layoutSize().width());
+ EXPECT_EQ(300, view->layoutSize().height());
+
+ webViewHelper.resize(WebSize(1000, 400));
+
+ EXPECT_EQ(500, view->layoutSize().width());
+ EXPECT_EQ(200, view->layoutSize().height());
+}
+
class WebFrameResizeTest : public ParameterizedWebFrameTest {
protected:
static FloatSize computeRelativeOffset(const IntPoint& absoluteOffset,
« no previous file with comments | « third_party/WebKit/Source/core/page/Page.cpp ('k') | third_party/WebKit/Source/web/tests/data/viewport-and-media.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698