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