| 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 267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 278 } | 278 } |
| 279 scrollbarLayer->setScrollLayer(scrollLayer); | 279 scrollbarLayer->setScrollLayer(scrollLayer); |
| 280 scrollbarLayer->setClipLayer(containerLayer); | 280 scrollbarLayer->setClipLayer(containerLayer); |
| 281 scrollbarGraphicsLayer->setContentsToPlatformLayer(scrollbarLayer->layer()); | 281 scrollbarGraphicsLayer->setContentsToPlatformLayer(scrollbarLayer->layer()); |
| 282 scrollbarGraphicsLayer->setDrawsContent(false); | 282 scrollbarGraphicsLayer->setDrawsContent(false); |
| 283 } | 283 } |
| 284 | 284 |
| 285 WebScrollbarLayer* ScrollingCoordinator::addWebScrollbarLayer(ScrollableArea* sc
rollableArea, ScrollbarOrientation orientation, PassOwnPtr<blink::WebScrollbarLa
yer> scrollbarLayer) | 285 WebScrollbarLayer* ScrollingCoordinator::addWebScrollbarLayer(ScrollableArea* sc
rollableArea, ScrollbarOrientation orientation, PassOwnPtr<blink::WebScrollbarLa
yer> scrollbarLayer) |
| 286 { | 286 { |
| 287 ScrollbarMap& scrollbars = orientation == HorizontalScrollbar ? m_horizontal
Scrollbars : m_verticalScrollbars; | 287 ScrollbarMap& scrollbars = orientation == HorizontalScrollbar ? m_horizontal
Scrollbars : m_verticalScrollbars; |
| 288 return scrollbars.add(scrollableArea, scrollbarLayer).iterator->value.get(); | 288 return scrollbars.add(scrollableArea, scrollbarLayer).storedValue->value.get
(); |
| 289 } | 289 } |
| 290 | 290 |
| 291 WebScrollbarLayer* ScrollingCoordinator::getWebScrollbarLayer(ScrollableArea* sc
rollableArea, ScrollbarOrientation orientation) | 291 WebScrollbarLayer* ScrollingCoordinator::getWebScrollbarLayer(ScrollableArea* sc
rollableArea, ScrollbarOrientation orientation) |
| 292 { | 292 { |
| 293 ScrollbarMap& scrollbars = orientation == HorizontalScrollbar ? m_horizontal
Scrollbars : m_verticalScrollbars; | 293 ScrollbarMap& scrollbars = orientation == HorizontalScrollbar ? m_horizontal
Scrollbars : m_verticalScrollbars; |
| 294 return scrollbars.get(scrollableArea); | 294 return scrollbars.get(scrollableArea); |
| 295 } | 295 } |
| 296 | 296 |
| 297 void ScrollingCoordinator::scrollableAreaScrollbarLayerDidChange(ScrollableArea*
scrollableArea, ScrollbarOrientation orientation) | 297 void ScrollingCoordinator::scrollableAreaScrollbarLayerDidChange(ScrollableArea*
scrollableArea, ScrollbarOrientation orientation) |
| 298 { | 298 { |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 388 // Whenever we descend into a new frame, a new map will be created. | 388 // Whenever we descend into a new frame, a new map will be created. |
| 389 typedef HashMap<const RenderLayer*, Vector<const Frame*> > LayerFrameMap; | 389 typedef HashMap<const RenderLayer*, Vector<const Frame*> > LayerFrameMap; |
| 390 static void makeLayerChildFrameMap(const Frame* currentFrame, LayerFrameMap* map
) | 390 static void makeLayerChildFrameMap(const Frame* currentFrame, LayerFrameMap* map
) |
| 391 { | 391 { |
| 392 map->clear(); | 392 map->clear(); |
| 393 const FrameTree& tree = currentFrame->tree(); | 393 const FrameTree& tree = currentFrame->tree(); |
| 394 for (const Frame* child = tree.firstChild(); child; child = child->tree().ne
xtSibling()) { | 394 for (const Frame* child = tree.firstChild(); child; child = child->tree().ne
xtSibling()) { |
| 395 const RenderLayer* containingLayer = child->ownerRenderer()->enclosingLa
yer(); | 395 const RenderLayer* containingLayer = child->ownerRenderer()->enclosingLa
yer(); |
| 396 LayerFrameMap::iterator iter = map->find(containingLayer); | 396 LayerFrameMap::iterator iter = map->find(containingLayer); |
| 397 if (iter == map->end()) | 397 if (iter == map->end()) |
| 398 iter = map->add(containingLayer, Vector<const Frame*>()).iterator; | 398 map->add(containingLayer, Vector<const Frame*>()).storedValue->value
.append(child); |
| 399 iter->value.append(child); | 399 else |
| 400 iter->value.append(child); |
| 400 } | 401 } |
| 401 } | 402 } |
| 402 | 403 |
| 403 static void convertLayerRectsToEnclosingCompositedLayerRecursive( | 404 static void convertLayerRectsToEnclosingCompositedLayerRecursive( |
| 404 const RenderLayer* curLayer, | 405 const RenderLayer* curLayer, |
| 405 const LayerHitTestRects& layerRects, | 406 const LayerHitTestRects& layerRects, |
| 406 LayerHitTestRects& compositorRects, | 407 LayerHitTestRects& compositorRects, |
| 407 RenderGeometryMap& geometryMap, | 408 RenderGeometryMap& geometryMap, |
| 408 HashSet<const RenderLayer*>& layersWithRects, | 409 HashSet<const RenderLayer*>& layersWithRects, |
| 409 LayerFrameMap& layerChildFrameMap) | 410 LayerFrameMap& layerChildFrameMap) |
| (...skipping 13 matching lines...) Expand all Loading... |
| 423 } | 424 } |
| 424 } | 425 } |
| 425 if (!compositedLayer) { | 426 if (!compositedLayer) { |
| 426 // Since this machinery is used only when accelerated compositing is
enabled, we expect | 427 // Since this machinery is used only when accelerated compositing is
enabled, we expect |
| 427 // that every layer should have an enclosing composited layer. | 428 // that every layer should have an enclosing composited layer. |
| 428 ASSERT_NOT_REACHED(); | 429 ASSERT_NOT_REACHED(); |
| 429 return; | 430 return; |
| 430 } | 431 } |
| 431 | 432 |
| 432 LayerHitTestRects::iterator compIter = compositorRects.find(compositedLa
yer); | 433 LayerHitTestRects::iterator compIter = compositorRects.find(compositedLa
yer); |
| 434 Vector<LayoutRect>* compIterValue; |
| 433 if (compIter == compositorRects.end()) | 435 if (compIter == compositorRects.end()) |
| 434 compIter = compositorRects.add(compositedLayer, Vector<LayoutRect>()
).iterator; | 436 compIterValue = &compositorRects.add(compositedLayer, Vector<LayoutR
ect>()).storedValue->value; |
| 437 else |
| 438 compIterValue = &compIter->value; |
| 435 // Transform each rect to the co-ordinate space of it's enclosing compos
ited layer. | 439 // Transform each rect to the co-ordinate space of it's enclosing compos
ited layer. |
| 436 for (size_t i = 0; i < layerIter->value.size(); ++i) { | 440 for (size_t i = 0; i < layerIter->value.size(); ++i) { |
| 437 LayoutRect rect = layerIter->value[i]; | 441 LayoutRect rect = layerIter->value[i]; |
| 438 if (compositedLayer != curLayer) { | 442 if (compositedLayer != curLayer) { |
| 439 FloatQuad compositorQuad = geometryMap.mapToContainer(rect, comp
ositedLayer->renderer()); | 443 FloatQuad compositorQuad = geometryMap.mapToContainer(rect, comp
ositedLayer->renderer()); |
| 440 rect = LayoutRect(compositorQuad.boundingBox()); | 444 rect = LayoutRect(compositorQuad.boundingBox()); |
| 441 // If the enclosing composited layer itself is scrolled, we have
to undo the subtraction | 445 // If the enclosing composited layer itself is scrolled, we have
to undo the subtraction |
| 442 // of its scroll offset since we want the offset relative to the
scrolling content, not | 446 // of its scroll offset since we want the offset relative to the
scrolling content, not |
| 443 // the element itself. | 447 // the element itself. |
| 444 if (compositedLayer->renderer()->hasOverflowClip()) | 448 if (compositedLayer->renderer()->hasOverflowClip()) |
| 445 rect.move(compositedLayer->renderBox()->scrolledContentOffse
t()); | 449 rect.move(compositedLayer->renderBox()->scrolledContentOffse
t()); |
| 446 } | 450 } |
| 447 compIter->value.append(rect); | 451 compIterValue->append(rect); |
| 448 } | 452 } |
| 449 } | 453 } |
| 450 | 454 |
| 451 // Walk child layers of interest | 455 // Walk child layers of interest |
| 452 for (const RenderLayer* childLayer = curLayer->firstChild(); childLayer; chi
ldLayer = childLayer->nextSibling()) { | 456 for (const RenderLayer* childLayer = curLayer->firstChild(); childLayer; chi
ldLayer = childLayer->nextSibling()) { |
| 453 if (layersWithRects.contains(childLayer)) { | 457 if (layersWithRects.contains(childLayer)) { |
| 454 geometryMap.pushMappingsToAncestor(childLayer, curLayer); | 458 geometryMap.pushMappingsToAncestor(childLayer, curLayer); |
| 455 convertLayerRectsToEnclosingCompositedLayerRecursive(childLayer, lay
erRects, compositorRects, geometryMap, layersWithRects, layerChildFrameMap); | 459 convertLayerRectsToEnclosingCompositedLayerRecursive(childLayer, lay
erRects, compositorRects, geometryMap, layersWithRects, layerChildFrameMap); |
| 456 geometryMap.popMappingsToAncestor(curLayer); | 460 geometryMap.popMappingsToAncestor(curLayer); |
| 457 } | 461 } |
| (...skipping 504 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 962 bool frameIsScrollable = frameView && frameView->isScrollable(); | 966 bool frameIsScrollable = frameView && frameView->isScrollable(); |
| 963 if (frameIsScrollable != m_wasFrameScrollable) | 967 if (frameIsScrollable != m_wasFrameScrollable) |
| 964 return true; | 968 return true; |
| 965 | 969 |
| 966 if (WebLayer* scrollLayer = frameView ? scrollingWebLayerForScrollableArea(f
rameView) : 0) | 970 if (WebLayer* scrollLayer = frameView ? scrollingWebLayerForScrollableArea(f
rameView) : 0) |
| 967 return blink::WebSize(frameView->contentsSize()) != scrollLayer->bounds(
); | 971 return blink::WebSize(frameView->contentsSize()) != scrollLayer->bounds(
); |
| 968 return false; | 972 return false; |
| 969 } | 973 } |
| 970 | 974 |
| 971 } // namespace WebCore | 975 } // namespace WebCore |
| OLD | NEW |