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 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
251 void ScrollingCoordinator::removeWebScrollbarLayer(ScrollableArea* scrollableAre
a, ScrollbarOrientation orientation) | 251 void ScrollingCoordinator::removeWebScrollbarLayer(ScrollableArea* scrollableAre
a, ScrollbarOrientation orientation) |
252 { | 252 { |
253 ScrollbarMap& scrollbars = orientation == HorizontalScrollbar ? m_horizontal
Scrollbars : m_verticalScrollbars; | 253 ScrollbarMap& scrollbars = orientation == HorizontalScrollbar ? m_horizontal
Scrollbars : m_verticalScrollbars; |
254 if (OwnPtr<WebScrollbarLayer> scrollbarLayer = scrollbars.take(scrollableAre
a)) | 254 if (OwnPtr<WebScrollbarLayer> scrollbarLayer = scrollbars.take(scrollableAre
a)) |
255 GraphicsLayer::unregisterContentsLayer(scrollbarLayer->layer()); | 255 GraphicsLayer::unregisterContentsLayer(scrollbarLayer->layer()); |
256 } | 256 } |
257 | 257 |
258 static PassOwnPtr<WebScrollbarLayer> createScrollbarLayer(Scrollbar* scrollbar) | 258 static PassOwnPtr<WebScrollbarLayer> createScrollbarLayer(Scrollbar* scrollbar) |
259 { | 259 { |
260 ScrollbarTheme* theme = scrollbar->theme(); | 260 ScrollbarTheme* theme = scrollbar->theme(); |
261 blink::WebScrollbarThemePainter painter(theme, scrollbar); | 261 WebScrollbarThemePainter painter(theme, scrollbar); |
262 OwnPtr<blink::WebScrollbarThemeGeometry> geometry(blink::WebScrollbarThemeGe
ometryNative::create(theme)); | 262 OwnPtr<WebScrollbarThemeGeometry> geometry(WebScrollbarThemeGeometryNative::
create(theme)); |
263 | 263 |
264 OwnPtr<WebScrollbarLayer> scrollbarLayer = adoptPtr(blink::Platform::current
()->compositorSupport()->createScrollbarLayer(WebScrollbarImpl::create(scrollbar
), painter, geometry.leakPtr())); | 264 OwnPtr<WebScrollbarLayer> scrollbarLayer = adoptPtr(Platform::current()->com
positorSupport()->createScrollbarLayer(WebScrollbarImpl::create(scrollbar), pain
ter, geometry.leakPtr())); |
265 GraphicsLayer::registerContentsLayer(scrollbarLayer->layer()); | 265 GraphicsLayer::registerContentsLayer(scrollbarLayer->layer()); |
266 return scrollbarLayer.release(); | 266 return scrollbarLayer.release(); |
267 } | 267 } |
268 | 268 |
269 PassOwnPtr<WebScrollbarLayer> ScrollingCoordinator::createSolidColorScrollbarLay
er(ScrollbarOrientation orientation, int thumbThickness, int trackStart, bool is
LeftSideVerticalScrollbar) | 269 PassOwnPtr<WebScrollbarLayer> ScrollingCoordinator::createSolidColorScrollbarLay
er(ScrollbarOrientation orientation, int thumbThickness, int trackStart, bool is
LeftSideVerticalScrollbar) |
270 { | 270 { |
271 blink::WebScrollbar::Orientation webOrientation = (orientation == Horizontal
Scrollbar) ? blink::WebScrollbar::Horizontal : blink::WebScrollbar::Vertical; | 271 WebScrollbar::Orientation webOrientation = (orientation == HorizontalScrollb
ar) ? WebScrollbar::Horizontal : WebScrollbar::Vertical; |
272 OwnPtr<WebScrollbarLayer> scrollbarLayer = adoptPtr(blink::Platform::current
()->compositorSupport()->createSolidColorScrollbarLayer(webOrientation, thumbThi
ckness, trackStart, isLeftSideVerticalScrollbar)); | 272 OwnPtr<WebScrollbarLayer> scrollbarLayer = adoptPtr(Platform::current()->com
positorSupport()->createSolidColorScrollbarLayer(webOrientation, thumbThickness,
trackStart, isLeftSideVerticalScrollbar)); |
273 GraphicsLayer::registerContentsLayer(scrollbarLayer->layer()); | 273 GraphicsLayer::registerContentsLayer(scrollbarLayer->layer()); |
274 return scrollbarLayer.release(); | 274 return scrollbarLayer.release(); |
275 } | 275 } |
276 | 276 |
277 static void detachScrollbarLayer(GraphicsLayer* scrollbarGraphicsLayer) | 277 static void detachScrollbarLayer(GraphicsLayer* scrollbarGraphicsLayer) |
278 { | 278 { |
279 ASSERT(scrollbarGraphicsLayer); | 279 ASSERT(scrollbarGraphicsLayer); |
280 | 280 |
281 scrollbarGraphicsLayer->setContentsToPlatformLayer(nullptr); | 281 scrollbarGraphicsLayer->setContentsToPlatformLayer(nullptr); |
282 scrollbarGraphicsLayer->setDrawsContent(true); | 282 scrollbarGraphicsLayer->setDrawsContent(true); |
283 } | 283 } |
284 | 284 |
285 static void setupScrollbarLayer(GraphicsLayer* scrollbarGraphicsLayer, WebScroll
barLayer* scrollbarLayer, WebLayer* scrollLayer, WebLayer* containerLayer) | 285 static void setupScrollbarLayer(GraphicsLayer* scrollbarGraphicsLayer, WebScroll
barLayer* scrollbarLayer, WebLayer* scrollLayer, WebLayer* containerLayer) |
286 { | 286 { |
287 ASSERT(scrollbarGraphicsLayer); | 287 ASSERT(scrollbarGraphicsLayer); |
288 ASSERT(scrollbarLayer); | 288 ASSERT(scrollbarLayer); |
289 | 289 |
290 if (!scrollLayer) { | 290 if (!scrollLayer) { |
291 detachScrollbarLayer(scrollbarGraphicsLayer); | 291 detachScrollbarLayer(scrollbarGraphicsLayer); |
292 return; | 292 return; |
293 } | 293 } |
294 scrollbarLayer->setScrollLayer(scrollLayer); | 294 scrollbarLayer->setScrollLayer(scrollLayer); |
295 scrollbarLayer->setClipLayer(containerLayer); | 295 scrollbarLayer->setClipLayer(containerLayer); |
296 scrollbarGraphicsLayer->setContentsToPlatformLayer(scrollbarLayer->layer()); | 296 scrollbarGraphicsLayer->setContentsToPlatformLayer(scrollbarLayer->layer()); |
297 scrollbarGraphicsLayer->setDrawsContent(false); | 297 scrollbarGraphicsLayer->setDrawsContent(false); |
298 } | 298 } |
299 | 299 |
300 WebScrollbarLayer* ScrollingCoordinator::addWebScrollbarLayer(ScrollableArea* sc
rollableArea, ScrollbarOrientation orientation, PassOwnPtr<blink::WebScrollbarLa
yer> scrollbarLayer) | 300 WebScrollbarLayer* ScrollingCoordinator::addWebScrollbarLayer(ScrollableArea* sc
rollableArea, ScrollbarOrientation orientation, PassOwnPtr<WebScrollbarLayer> sc
rollbarLayer) |
301 { | 301 { |
302 ScrollbarMap& scrollbars = orientation == HorizontalScrollbar ? m_horizontal
Scrollbars : m_verticalScrollbars; | 302 ScrollbarMap& scrollbars = orientation == HorizontalScrollbar ? m_horizontal
Scrollbars : m_verticalScrollbars; |
303 return scrollbars.add(scrollableArea, scrollbarLayer).storedValue->value.get
(); | 303 return scrollbars.add(scrollableArea, scrollbarLayer).storedValue->value.get
(); |
304 } | 304 } |
305 | 305 |
306 WebScrollbarLayer* ScrollingCoordinator::getWebScrollbarLayer(ScrollableArea* sc
rollableArea, ScrollbarOrientation orientation) | 306 WebScrollbarLayer* ScrollingCoordinator::getWebScrollbarLayer(ScrollableArea* sc
rollableArea, ScrollbarOrientation orientation) |
307 { | 307 { |
308 ScrollbarMap& scrollbars = orientation == HorizontalScrollbar ? m_horizontal
Scrollbars : m_verticalScrollbars; | 308 ScrollbarMap& scrollbars = orientation == HorizontalScrollbar ? m_horizontal
Scrollbars : m_verticalScrollbars; |
309 return scrollbars.get(scrollableArea); | 309 return scrollbars.get(scrollableArea); |
310 } | 310 } |
(...skipping 727 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1038 } | 1038 } |
1039 | 1039 |
1040 bool ScrollingCoordinator::frameViewIsDirty() const | 1040 bool ScrollingCoordinator::frameViewIsDirty() const |
1041 { | 1041 { |
1042 FrameView* frameView = m_page->mainFrame()->isLocalFrame() ? m_page->depreca
tedLocalMainFrame()->view() : nullptr; | 1042 FrameView* frameView = m_page->mainFrame()->isLocalFrame() ? m_page->depreca
tedLocalMainFrame()->view() : nullptr; |
1043 bool frameIsScrollable = frameView && frameView->isScrollable(); | 1043 bool frameIsScrollable = frameView && frameView->isScrollable(); |
1044 if (frameIsScrollable != m_wasFrameScrollable) | 1044 if (frameIsScrollable != m_wasFrameScrollable) |
1045 return true; | 1045 return true; |
1046 | 1046 |
1047 if (WebLayer* scrollLayer = frameView ? toWebLayer(frameView->layerForScroll
ing()) : nullptr) | 1047 if (WebLayer* scrollLayer = frameView ? toWebLayer(frameView->layerForScroll
ing()) : nullptr) |
1048 return blink::WebSize(frameView->contentsSize()) != scrollLayer->bounds(
); | 1048 return WebSize(frameView->contentsSize()) != scrollLayer->bounds(); |
1049 return false; | 1049 return false; |
1050 } | 1050 } |
1051 | 1051 |
1052 } // namespace blink | 1052 } // namespace blink |
OLD | NEW |