OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2010 Google Inc. All rights reserved. | 2 * Copyright (C) 2010 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 352 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
363 while (renderer) { | 363 while (renderer) { |
364 if (renderer->style()) { | 364 if (renderer->style()) { |
365 renderer->style()->setTextAutosizingMultiplier(2); | 365 renderer->style()->setTextAutosizingMultiplier(2); |
366 EXPECT_EQ(2, renderer->style()->textAutosizingMultiplier()); | 366 EXPECT_EQ(2, renderer->style()->textAutosizingMultiplier()); |
367 multiplierSetAtLeastOnce = true; | 367 multiplierSetAtLeastOnce = true; |
368 } | 368 } |
369 renderer = renderer->nextInPreOrder(); | 369 renderer = renderer->nextInPreOrder(); |
370 } | 370 } |
371 EXPECT_TRUE(multiplierSetAtLeastOnce); | 371 EXPECT_TRUE(multiplierSetAtLeastOnce); |
372 | 372 |
373 WebCore::ViewportArguments arguments = document->viewportArguments(); | 373 // Modify layout size to invalidate text autosizing multipliers. |
374 arguments.width += 10; | 374 webViewImpl->addUserStyleSheet("@viewport{width:1000px;}", WebVector<WebStri
ng>(), WebView::UserContentInjectInAllFrames, WebView::UserStyleInjectInExisting
Documents); |
375 webViewImpl->updatePageDefinedPageScaleConstraints(arguments); | 375 webViewImpl->layout(); |
376 | 376 |
377 bool multiplierCheckedAtLeastOnce = false; | 377 bool multiplierCheckedAtLeastOnce = false; |
378 renderer = document->renderer(); | 378 renderer = document->renderer(); |
379 while (renderer) { | 379 while (renderer) { |
380 if (renderer->style()) { | 380 if (renderer->style()) { |
381 EXPECT_EQ(1, renderer->style()->textAutosizingMultiplier()); | 381 EXPECT_EQ(1, renderer->style()->textAutosizingMultiplier()); |
382 multiplierCheckedAtLeastOnce = true; | 382 multiplierCheckedAtLeastOnce = true; |
383 } | 383 } |
384 renderer = renderer->nextInPreOrder(); | 384 renderer = renderer->nextInPreOrder(); |
385 } | 385 } |
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
626 | 626 |
627 TEST_F(WebFrameTest, setInitialPageScaleFactorPermanently) | 627 TEST_F(WebFrameTest, setInitialPageScaleFactorPermanently) |
628 { | 628 { |
629 WebCore::Settings::setMockScrollbarsEnabled(true); | 629 WebCore::Settings::setMockScrollbarsEnabled(true); |
630 WebCore::Settings::setUsesOverlayScrollbars(true); | 630 WebCore::Settings::setUsesOverlayScrollbars(true); |
631 | 631 |
632 registerMockedHttpURLLoad("fixed_layout.html"); | 632 registerMockedHttpURLLoad("fixed_layout.html"); |
633 | 633 |
634 FixedLayoutTestWebViewClient client; | 634 FixedLayoutTestWebViewClient client; |
635 client.m_screenInfo.deviceScaleFactor = 1; | 635 client.m_screenInfo.deviceScaleFactor = 1; |
636 float enforcedPageScaleFactor = 2.0f; | 636 float enforcedPageScaleFactor = 2; |
637 | 637 |
638 m_webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "fixed_layout
.html", true, 0, &client); | 638 m_webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "fixed_layout
.html", true, 0, &client); |
639 m_webView->settings()->setSupportDeprecatedTargetDensityDPI(true); | 639 m_webView->settings()->setSupportDeprecatedTargetDensityDPI(true); |
640 m_webView->settings()->setLoadWithOverviewMode(false); | 640 m_webView->settings()->setLoadWithOverviewMode(false); |
641 m_webView->setInitialPageScaleOverride(enforcedPageScaleFactor); | 641 m_webView->setInitialPageScaleOverride(enforcedPageScaleFactor); |
642 m_webView->enableFixedLayoutMode(true); | 642 m_webView->enableFixedLayoutMode(true); |
643 m_webView->settings()->setViewportEnabled(true); | 643 m_webView->settings()->setViewportEnabled(true); |
644 m_webView->layout(); | 644 m_webView->layout(); |
645 | 645 |
646 EXPECT_EQ(enforcedPageScaleFactor, m_webView->pageScaleFactor()); | 646 EXPECT_EQ(enforcedPageScaleFactor, m_webView->pageScaleFactor()); |
(...skipping 15 matching lines...) Expand all Loading... |
662 registerMockedHttpURLLoad("viewport-auto-initial-scale.html"); | 662 registerMockedHttpURLLoad("viewport-auto-initial-scale.html"); |
663 | 663 |
664 FixedLayoutTestWebViewClient client; | 664 FixedLayoutTestWebViewClient client; |
665 client.m_screenInfo.deviceScaleFactor = 1; | 665 client.m_screenInfo.deviceScaleFactor = 1; |
666 int viewportWidth = 640; | 666 int viewportWidth = 640; |
667 int viewportHeight = 480; | 667 int viewportHeight = 480; |
668 float enforcedPageScalePactor = 0.5f; | 668 float enforcedPageScalePactor = 0.5f; |
669 | 669 |
670 m_webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "viewport-aut
o-initial-scale.html", true, 0, &client); | 670 m_webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "viewport-aut
o-initial-scale.html", true, 0, &client); |
671 m_webView->enableFixedLayoutMode(true); | 671 m_webView->enableFixedLayoutMode(true); |
| 672 m_webView->settings()->setViewportEnabled(true); |
672 m_webView->settings()->setSupportDeprecatedTargetDensityDPI(true); | 673 m_webView->settings()->setSupportDeprecatedTargetDensityDPI(true); |
673 m_webView->settings()->setViewportEnabled(true); | |
674 m_webView->settings()->setLoadWithOverviewMode(false); | 674 m_webView->settings()->setLoadWithOverviewMode(false); |
675 m_webView->setInitialPageScaleOverride(enforcedPageScalePactor); | 675 m_webView->setInitialPageScaleOverride(enforcedPageScalePactor); |
676 m_webView->resize(WebSize(viewportWidth, viewportHeight)); | 676 m_webView->resize(WebSize(viewportWidth, viewportHeight)); |
677 | 677 |
678 EXPECT_EQ(enforcedPageScalePactor, m_webView->pageScaleFactor()); | 678 EXPECT_EQ(enforcedPageScalePactor, m_webView->pageScaleFactor()); |
679 } | 679 } |
680 | 680 |
681 TEST_F(WebFrameTest, PermanentInitialPageScaleFactorOverridesPageViewportInitial
Scale) | 681 TEST_F(WebFrameTest, PermanentInitialPageScaleFactorOverridesPageViewportInitial
Scale) |
682 { | 682 { |
683 registerMockedHttpURLLoad("viewport-wide-2x-initial-scale.html"); | 683 registerMockedHttpURLLoad("viewport-wide-2x-initial-scale.html"); |
(...skipping 2930 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3614 m_webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "push_state.h
tml", true, 0, &client); | 3614 m_webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "push_state.h
tml", true, 0, &client); |
3615 runPendingTasks(); | 3615 runPendingTasks(); |
3616 | 3616 |
3617 EXPECT_EQ(client.startLoadingCount(), 2); | 3617 EXPECT_EQ(client.startLoadingCount(), 2); |
3618 EXPECT_EQ(client.stopLoadingCount(), 2); | 3618 EXPECT_EQ(client.stopLoadingCount(), 2); |
3619 m_webView->close(); | 3619 m_webView->close(); |
3620 m_webView = 0; | 3620 m_webView = 0; |
3621 } | 3621 } |
3622 | 3622 |
3623 } // namespace | 3623 } // namespace |
OLD | NEW |