| 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 829 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 840 // Set <1 page scale so that the clip rect should be larger than | 840 // Set <1 page scale so that the clip rect should be larger than |
| 841 // the viewport size as passed into resize(). | 841 // the viewport size as passed into resize(). |
| 842 m_webView->setPageScaleFactor(0.5, WebPoint()); | 842 m_webView->setPageScaleFactor(0.5, WebPoint()); |
| 843 | 843 |
| 844 SkBitmap bitmap; | 844 SkBitmap bitmap; |
| 845 bitmap.setConfig(SkBitmap::kARGB_8888_Config, 200, 200); | 845 bitmap.setConfig(SkBitmap::kARGB_8888_Config, 200, 200); |
| 846 bitmap.allocPixels(); | 846 bitmap.allocPixels(); |
| 847 bitmap.eraseColor(0); | 847 bitmap.eraseColor(0); |
| 848 SkCanvas canvas(bitmap); | 848 SkCanvas canvas(bitmap); |
| 849 | 849 |
| 850 WebCore::PlatformContextSkia platformContext(&canvas); | 850 WebCore::GraphicsContext context(&canvas); |
| 851 platformContext.setTrackOpaqueRegion(true); | 851 WebCore::PlatformContextSkia* platformContext = context.platformContext(); |
| 852 WebCore::GraphicsContext context(&platformContext); | 852 platformContext->setTrackOpaqueRegion(true); |
| 853 | 853 |
| 854 EXPECT_EQ_RECT(WebCore::IntRect(0, 0, 0, 0), platformContext.opaqueRegion().
asRect()); | 854 EXPECT_EQ_RECT(WebCore::IntRect(0, 0, 0, 0), platformContext->opaqueRegion()
.asRect()); |
| 855 | 855 |
| 856 WebCore::FrameView* view = static_cast<WebViewImpl*>(m_webView)->mainFrameIm
pl()->frameView(); | 856 WebCore::FrameView* view = static_cast<WebViewImpl*>(m_webView)->mainFrameIm
pl()->frameView(); |
| 857 WebCore::IntRect paintRect(0, 0, 200, 200); | 857 WebCore::IntRect paintRect(0, 0, 200, 200); |
| 858 view->paint(&context, paintRect); | 858 view->paint(&context, paintRect); |
| 859 | 859 |
| 860 int viewportWidthMinusScrollbar = 50 - (view->verticalScrollbar()->isOverlay
Scrollbar() ? 0 : 15); | 860 int viewportWidthMinusScrollbar = 50 - (view->verticalScrollbar()->isOverlay
Scrollbar() ? 0 : 15); |
| 861 int viewportHeightMinusScrollbar = 50 - (view->horizontalScrollbar()->isOver
layScrollbar() ? 0 : 15); | 861 int viewportHeightMinusScrollbar = 50 - (view->horizontalScrollbar()->isOver
layScrollbar() ? 0 : 15); |
| 862 WebCore::IntRect clippedRect(0, 0, viewportWidthMinusScrollbar * 2, viewport
HeightMinusScrollbar * 2); | 862 WebCore::IntRect clippedRect(0, 0, viewportWidthMinusScrollbar * 2, viewport
HeightMinusScrollbar * 2); |
| 863 EXPECT_EQ_RECT(clippedRect, platformContext.opaqueRegion().asRect()); | 863 EXPECT_EQ_RECT(clippedRect, platformContext->opaqueRegion().asRect()); |
| 864 } | 864 } |
| 865 | 865 |
| 866 TEST_F(WebFrameTest, CanOverrideMaximumScaleFactor) | 866 TEST_F(WebFrameTest, CanOverrideMaximumScaleFactor) |
| 867 { | 867 { |
| 868 registerMockedHttpURLLoad("no_scale_for_you.html"); | 868 registerMockedHttpURLLoad("no_scale_for_you.html"); |
| 869 | 869 |
| 870 FixedLayoutTestWebViewClient client; | 870 FixedLayoutTestWebViewClient client; |
| 871 client.m_screenInfo.deviceScaleFactor = 1; | 871 client.m_screenInfo.deviceScaleFactor = 1; |
| 872 int viewportWidth = 640; | 872 int viewportWidth = 640; |
| 873 int viewportHeight = 480; | 873 int viewportHeight = 480; |
| (...skipping 1979 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2853 EXPECT_FALSE(client.wasProgrammaticScroll()); | 2853 EXPECT_FALSE(client.wasProgrammaticScroll()); |
| 2854 EXPECT_TRUE(client.wasUserScroll()); | 2854 EXPECT_TRUE(client.wasUserScroll()); |
| 2855 client.reset(); | 2855 client.reset(); |
| 2856 | 2856 |
| 2857 m_webView->close(); | 2857 m_webView->close(); |
| 2858 m_webView = 0; | 2858 m_webView = 0; |
| 2859 } | 2859 } |
| 2860 | 2860 |
| 2861 | 2861 |
| 2862 } // namespace | 2862 } // namespace |
| OLD | NEW |