Changeset 142045 in webkit
- Timestamp:
- Feb 6, 2013 3:47:17 PM (11 years ago)
- Location:
- trunk/Source
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r142043 r142045 1 2013-02-06 Alexandre Elias <aelias@chromium.org> 2 3 Make ScrollView::paint() clip by visibleContentRect 4 https://bugs.webkit.org/show_bug.cgi?id=108888 5 6 Reviewed by Levi Weintraub. 7 8 When applyPageScaleFactorInCompositor or fixedVisibleContentRect 9 are used, frameRect() and visibleContentRect(true).size() are 10 no longer synonyms, and the latter is the one that should be 11 used for clipping paints. 12 13 New WebFrameTest: pageScaleFactorScalesPaintClip. 14 15 * platform/ScrollView.cpp: 16 (WebCore::ScrollView::paint): 17 1 18 2013-02-06 Dima Gorbik <dgorbik@apple.com> 2 19 -
trunk/Source/WebCore/platform/ScrollView.cpp
r141450 r142045 1052 1052 notifyPageThatContentAreaWillPaint(); 1053 1053 1054 IntRect clipRect = frameRect();1055 if (verticalScrollbar() && !verticalScrollbar()->isOverlayScrollbar())1056 clipRect.setWidth(clipRect.width() - verticalScrollbar()->width());1057 if (horizontalScrollbar() && !horizontalScrollbar()->isOverlayScrollbar())1058 clipRect.setHeight(clipRect.height() - horizontalScrollbar()->height());1059 1060 1054 IntRect documentDirtyRect = rect; 1061 documentDirtyRect.intersect(clipRect); 1055 IntRect visibleAreaWithoutScrollbars(location(), visibleContentRect(false).size()); 1056 documentDirtyRect.intersect(visibleAreaWithoutScrollbars); 1062 1057 1063 1058 if (!documentDirtyRect.isEmpty()) { … … 1088 1083 GraphicsContextStateSaver stateSaver(*context); 1089 1084 IntRect scrollViewDirtyRect = rect; 1090 scrollViewDirtyRect.intersect(frameRect()); 1085 IntRect visibleAreaWithScrollbars(location(), visibleContentRect(true).size()); 1086 scrollViewDirtyRect.intersect(visibleAreaWithScrollbars); 1091 1087 context->translate(x(), y()); 1092 1088 scrollViewDirtyRect.moveBy(-location()); -
trunk/Source/WebKit/chromium/ChangeLog
r142031 r142045 1 2013-02-06 Alexandre Elias <aelias@chromium.org> 2 3 Make ScrollView::paint() clip by visibleContentRect 4 https://bugs.webkit.org/show_bug.cgi?id=108888 5 6 Reviewed by Levi Weintraub. 7 8 When applyPageScaleFactorInCompositor or fixedVisibleContentRect 9 are used, frameRect() and visibleContentRect(true).size() are 10 no longer synonyms, and the latter is the one that should be 11 used for clipping paints. 12 13 New WebFrameTest: pageScaleFactorScalesPaintClip. 14 15 * tests/WebFrameTest.cpp: 16 1 17 2013-02-06 Sheriff Bot <webkit.review.bot@gmail.com> 2 18 -
trunk/Source/WebKit/chromium/tests/WebFrameTest.cpp
r141850 r142045 37 37 #include "FrameTestHelpers.h" 38 38 #include "FrameView.h" 39 #include "PlatformContextSkia.h" 39 40 #include "Range.h" 40 41 #include "RenderView.h" 41 42 #include "ResourceError.h" 42 43 #include "Settings.h" 44 #include "SkBitmap.h" 45 #include "SkCanvas.h" 43 46 #include "URLTestHelpers.h" 44 47 #include "WebDataSource.h" … … 71 74 namespace { 72 75 76 #define EXPECT_EQ_RECT(a, b) \ 77 EXPECT_EQ(a.x(), b.x()); \ 78 EXPECT_EQ(a.y(), b.y()); \ 79 EXPECT_EQ(a.width(), b.width()); \ 80 EXPECT_EQ(a.height(), b.height()); 81 73 82 class WebFrameTest : public testing::Test { 74 83 public: … … 449 458 } 450 459 #endif 460 461 TEST_F(WebFrameTest, pageScaleFactorScalesPaintClip) 462 { 463 registerMockedHttpURLLoad("fixed_layout.html"); 464 465 FixedLayoutTestWebViewClient client; 466 client.m_screenInfo.deviceScaleFactor = 1; 467 int viewportWidth = 50; 468 int viewportHeight = 50; 469 470 WebViewImpl* webViewImpl = static_cast<WebViewImpl*>(FrameTestHelpers::createWebViewAndLoad(m_baseURL + "fixed_layout.html", true, 0, &client)); 471 webViewImpl->settings()->setApplyDeviceScaleFactorInCompositor(true); 472 webViewImpl->settings()->setApplyPageScaleFactorInCompositor(true); 473 webViewImpl->enableFixedLayoutMode(true); 474 webViewImpl->settings()->setViewportEnabled(true); 475 webViewImpl->resize(WebSize(viewportWidth, viewportHeight)); 476 webViewImpl->layout(); 477 478 // Set <1 page scale so that the clip rect should be larger than 479 // the viewport size as passed into resize(). 480 webViewImpl->setPageScaleFactor(0.5, WebPoint()); 481 482 SkBitmap bitmap; 483 bitmap.setConfig(SkBitmap::kARGB_8888_Config, 200, 200); 484 bitmap.allocPixels(); 485 bitmap.eraseColor(0); 486 SkCanvas canvas(bitmap); 487 488 WebCore::PlatformContextSkia platformContext(&canvas); 489 platformContext.setTrackOpaqueRegion(true); 490 WebCore::GraphicsContext context(&platformContext); 491 492 EXPECT_EQ_RECT(WebCore::IntRect(0, 0, 0, 0), platformContext.opaqueRegion().asRect()); 493 494 WebCore::FrameView* view = webViewImpl->mainFrameImpl()->frameView(); 495 WebCore::IntRect paintRect(0, 0, 200, 200); 496 view->paint(&context, paintRect); 497 498 int viewportWidthMinusScrollbar = 50 - (view->verticalScrollbar()->isOverlayScrollbar() ? 0 : 15); 499 int viewportHeightMinusScrollbar = 50 - (view->horizontalScrollbar()->isOverlayScrollbar() ? 0 : 15); 500 WebCore::IntRect clippedRect(0, 0, viewportWidthMinusScrollbar * 2, viewportHeightMinusScrollbar * 2); 501 EXPECT_EQ_RECT(clippedRect, platformContext.opaqueRegion().asRect()); 502 } 451 503 452 504 TEST_F(WebFrameTest, CanOverrideMaximumScaleFactor)
Note: See TracChangeset
for help on using the changeset viewer.