| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2011 Apple Inc. All rights reserved. | 2 * Copyright (C) 2011 Apple 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 | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
| 8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
| 9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
| 10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
| (...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 269 removeWebScrollbarLayer(scrollableArea, VerticalScrollbar); | 269 removeWebScrollbarLayer(scrollableArea, VerticalScrollbar); |
| 270 } | 270 } |
| 271 | 271 |
| 272 void ScrollingCoordinator::removeWebScrollbarLayer(ScrollableArea* scrollableAre
a, ScrollbarOrientation orientation) | 272 void ScrollingCoordinator::removeWebScrollbarLayer(ScrollableArea* scrollableAre
a, ScrollbarOrientation orientation) |
| 273 { | 273 { |
| 274 ScrollbarMap& scrollbars = orientation == HorizontalScrollbar ? m_horizontal
Scrollbars : m_verticalScrollbars; | 274 ScrollbarMap& scrollbars = orientation == HorizontalScrollbar ? m_horizontal
Scrollbars : m_verticalScrollbars; |
| 275 if (OwnPtr<WebScrollbarLayer> scrollbarLayer = scrollbars.take(scrollableAre
a)) | 275 if (OwnPtr<WebScrollbarLayer> scrollbarLayer = scrollbars.take(scrollableAre
a)) |
| 276 GraphicsLayer::unregisterContentsLayer(scrollbarLayer->layer()); | 276 GraphicsLayer::unregisterContentsLayer(scrollbarLayer->layer()); |
| 277 } | 277 } |
| 278 | 278 |
| 279 static PassOwnPtr<WebScrollbarLayer> createScrollbarLayer(Scrollbar* scrollbar,
float deviceScaleFactor) | 279 static PassOwnPtr<WebScrollbarLayer> createScrollbarLayer(Scrollbar& scrollbar,
float deviceScaleFactor) |
| 280 { | 280 { |
| 281 ScrollbarTheme* theme = scrollbar->theme(); | 281 ScrollbarTheme& theme = scrollbar.theme(); |
| 282 WebScrollbarThemePainter painter(theme, scrollbar, deviceScaleFactor); | 282 WebScrollbarThemePainter painter(theme, scrollbar, deviceScaleFactor); |
| 283 OwnPtr<WebScrollbarThemeGeometry> geometry(WebScrollbarThemeGeometryNative::
create(theme)); | 283 OwnPtr<WebScrollbarThemeGeometry> geometry(WebScrollbarThemeGeometryNative::
create(theme)); |
| 284 | 284 |
| 285 OwnPtr<WebScrollbarLayer> scrollbarLayer = adoptPtr(Platform::current()->com
positorSupport()->createScrollbarLayer(WebScrollbarImpl::create(scrollbar), pain
ter, geometry.leakPtr())); | 285 OwnPtr<WebScrollbarLayer> scrollbarLayer = adoptPtr(Platform::current()->com
positorSupport()->createScrollbarLayer(WebScrollbarImpl::create(&scrollbar), pai
nter, geometry.leakPtr())); |
| 286 GraphicsLayer::registerContentsLayer(scrollbarLayer->layer()); | 286 GraphicsLayer::registerContentsLayer(scrollbarLayer->layer()); |
| 287 return scrollbarLayer.release(); | 287 return scrollbarLayer.release(); |
| 288 } | 288 } |
| 289 | 289 |
| 290 PassOwnPtr<WebScrollbarLayer> ScrollingCoordinator::createSolidColorScrollbarLay
er(ScrollbarOrientation orientation, int thumbThickness, int trackStart, bool is
LeftSideVerticalScrollbar) | 290 PassOwnPtr<WebScrollbarLayer> ScrollingCoordinator::createSolidColorScrollbarLay
er(ScrollbarOrientation orientation, int thumbThickness, int trackStart, bool is
LeftSideVerticalScrollbar) |
| 291 { | 291 { |
| 292 WebScrollbar::Orientation webOrientation = (orientation == HorizontalScrollb
ar) ? WebScrollbar::Horizontal : WebScrollbar::Vertical; | 292 WebScrollbar::Orientation webOrientation = (orientation == HorizontalScrollb
ar) ? WebScrollbar::Horizontal : WebScrollbar::Vertical; |
| 293 OwnPtr<WebScrollbarLayer> scrollbarLayer = adoptPtr(Platform::current()->com
positorSupport()->createSolidColorScrollbarLayer(webOrientation, thumbThickness,
trackStart, isLeftSideVerticalScrollbar)); | 293 OwnPtr<WebScrollbarLayer> scrollbarLayer = adoptPtr(Platform::current()->com
positorSupport()->createSolidColorScrollbarLayer(webOrientation, thumbThickness,
trackStart, isLeftSideVerticalScrollbar)); |
| 294 GraphicsLayer::registerContentsLayer(scrollbarLayer->layer()); | 294 GraphicsLayer::registerContentsLayer(scrollbarLayer->layer()); |
| 295 return scrollbarLayer.release(); | 295 return scrollbarLayer.release(); |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 345 | 345 |
| 346 if (!platformSupportsCoordinatedScrollbar) { | 346 if (!platformSupportsCoordinatedScrollbar) { |
| 347 if (scrollbarGraphicsLayer) { | 347 if (scrollbarGraphicsLayer) { |
| 348 WebLayer* scrollbarLayer = toWebLayer(scrollbarGraphicsLayer); | 348 WebLayer* scrollbarLayer = toWebLayer(scrollbarGraphicsLayer); |
| 349 scrollbarLayer->setShouldScrollOnMainThread(true); | 349 scrollbarLayer->setShouldScrollOnMainThread(true); |
| 350 } | 350 } |
| 351 return; | 351 return; |
| 352 } | 352 } |
| 353 | 353 |
| 354 if (scrollbarGraphicsLayer) { | 354 if (scrollbarGraphicsLayer) { |
| 355 Scrollbar* scrollbar = orientation == HorizontalScrollbar ? scrollableAr
ea->horizontalScrollbar() : scrollableArea->verticalScrollbar(); | 355 Scrollbar& scrollbar = orientation == HorizontalScrollbar ? *scrollableA
rea->horizontalScrollbar() : *scrollableArea->verticalScrollbar(); |
| 356 if (scrollbar->isCustomScrollbar()) { | 356 if (scrollbar.isCustomScrollbar()) { |
| 357 detachScrollbarLayer(scrollbarGraphicsLayer); | 357 detachScrollbarLayer(scrollbarGraphicsLayer); |
| 358 return; | 358 return; |
| 359 } | 359 } |
| 360 | 360 |
| 361 WebScrollbarLayer* scrollbarLayer = getWebScrollbarLayer(scrollableArea,
orientation); | 361 WebScrollbarLayer* scrollbarLayer = getWebScrollbarLayer(scrollableArea,
orientation); |
| 362 if (!scrollbarLayer) { | 362 if (!scrollbarLayer) { |
| 363 Settings* settings = m_page->mainFrame()->settings(); | 363 Settings* settings = m_page->mainFrame()->settings(); |
| 364 | 364 |
| 365 OwnPtr<WebScrollbarLayer> webScrollbarLayer; | 365 OwnPtr<WebScrollbarLayer> webScrollbarLayer; |
| 366 if (settings->useSolidColorScrollbars()) { | 366 if (settings->useSolidColorScrollbars()) { |
| 367 ASSERT(RuntimeEnabledFeatures::overlayScrollbarsEnabled()); | 367 ASSERT(RuntimeEnabledFeatures::overlayScrollbarsEnabled()); |
| 368 webScrollbarLayer = createSolidColorScrollbarLayer(orientation,
scrollbar->theme()->thumbThickness(scrollbar), scrollbar->theme()->trackPosition
(scrollbar), scrollableArea->shouldPlaceVerticalScrollbarOnLeft()); | 368 webScrollbarLayer = createSolidColorScrollbarLayer(orientation,
scrollbar.theme().thumbThickness(scrollbar), scrollbar.theme().trackPosition(scr
ollbar), scrollableArea->shouldPlaceVerticalScrollbarOnLeft()); |
| 369 } else { | 369 } else { |
| 370 webScrollbarLayer = createScrollbarLayer(scrollbar, m_page->devi
ceScaleFactor()); | 370 webScrollbarLayer = createScrollbarLayer(scrollbar, m_page->devi
ceScaleFactor()); |
| 371 } | 371 } |
| 372 scrollbarLayer = addWebScrollbarLayer(scrollableArea, orientation, w
ebScrollbarLayer.release()); | 372 scrollbarLayer = addWebScrollbarLayer(scrollableArea, orientation, w
ebScrollbarLayer.release()); |
| 373 } | 373 } |
| 374 | 374 |
| 375 WebLayer* scrollLayer = toWebLayer(scrollableArea->layerForScrolling()); | 375 WebLayer* scrollLayer = toWebLayer(scrollableArea->layerForScrolling()); |
| 376 setupScrollbarLayer(scrollbarGraphicsLayer, scrollbarLayer, scrollLayer)
; | 376 setupScrollbarLayer(scrollbarGraphicsLayer, scrollbarLayer, scrollLayer)
; |
| 377 | 377 |
| 378 // Root layer non-overlay scrollbars should be marked opaque to disable | 378 // Root layer non-overlay scrollbars should be marked opaque to disable |
| 379 // blending. | 379 // blending. |
| 380 bool isOpaqueScrollbar = !scrollbar->isOverlayScrollbar(); | 380 bool isOpaqueScrollbar = !scrollbar.isOverlayScrollbar(); |
| 381 scrollbarGraphicsLayer->setContentsOpaque(isMainFrame && isOpaqueScrollb
ar); | 381 scrollbarGraphicsLayer->setContentsOpaque(isMainFrame && isOpaqueScrollb
ar); |
| 382 } else | 382 } else |
| 383 removeWebScrollbarLayer(scrollableArea, orientation); | 383 removeWebScrollbarLayer(scrollableArea, orientation); |
| 384 } | 384 } |
| 385 | 385 |
| 386 bool ScrollingCoordinator::scrollableAreaScrollLayerDidChange(ScrollableArea* sc
rollableArea) | 386 bool ScrollingCoordinator::scrollableAreaScrollLayerDidChange(ScrollableArea* sc
rollableArea) |
| 387 { | 387 { |
| 388 GraphicsLayer* scrollLayer = scrollableArea->layerForScrolling(); | 388 GraphicsLayer* scrollLayer = scrollableArea->layerForScrolling(); |
| 389 | 389 |
| 390 if (scrollLayer) { | 390 if (scrollLayer) { |
| (...skipping 584 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 975 { | 975 { |
| 976 ASSERT(isMainThread()); | 976 ASSERT(isMainThread()); |
| 977 | 977 |
| 978 if (!m_page) | 978 if (!m_page) |
| 979 return; | 979 return; |
| 980 | 980 |
| 981 FrameView* frameView = m_page->deprecatedLocalMainFrame()->view(); | 981 FrameView* frameView = m_page->deprecatedLocalMainFrame()->view(); |
| 982 if (!frameView) | 982 if (!frameView) |
| 983 return; | 983 return; |
| 984 | 984 |
| 985 frameView->scrollAnimator()->handleWheelEventPhase(phase); | 985 frameView->scrollAnimator().handleWheelEventPhase(phase); |
| 986 } | 986 } |
| 987 #endif | 987 #endif |
| 988 | 988 |
| 989 bool ScrollingCoordinator::hasVisibleSlowRepaintViewportConstrainedObjects(Frame
View* frameView) const | 989 bool ScrollingCoordinator::hasVisibleSlowRepaintViewportConstrainedObjects(Frame
View* frameView) const |
| 990 { | 990 { |
| 991 const FrameView::ViewportConstrainedObjectSet* viewportConstrainedObjects =
frameView->viewportConstrainedObjects(); | 991 const FrameView::ViewportConstrainedObjectSet* viewportConstrainedObjects =
frameView->viewportConstrainedObjects(); |
| 992 if (!viewportConstrainedObjects) | 992 if (!viewportConstrainedObjects) |
| 993 return false; | 993 return false; |
| 994 | 994 |
| 995 for (const LayoutObject* layoutObject : *viewportConstrainedObjects) { | 995 for (const LayoutObject* layoutObject : *viewportConstrainedObjects) { |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1079 bool frameIsScrollable = frameView && frameView->isScrollable(); | 1079 bool frameIsScrollable = frameView && frameView->isScrollable(); |
| 1080 if (frameIsScrollable != m_wasFrameScrollable) | 1080 if (frameIsScrollable != m_wasFrameScrollable) |
| 1081 return true; | 1081 return true; |
| 1082 | 1082 |
| 1083 if (WebLayer* scrollLayer = frameView ? toWebLayer(frameView->layerForScroll
ing()) : nullptr) | 1083 if (WebLayer* scrollLayer = frameView ? toWebLayer(frameView->layerForScroll
ing()) : nullptr) |
| 1084 return WebSize(frameView->contentsSize()) != scrollLayer->bounds(); | 1084 return WebSize(frameView->contentsSize()) != scrollLayer->bounds(); |
| 1085 return false; | 1085 return false; |
| 1086 } | 1086 } |
| 1087 | 1087 |
| 1088 } // namespace blink | 1088 } // namespace blink |
| OLD | NEW |