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 378 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
389 // Whenever we descend into a new frame, a new map will be created. | 389 // Whenever we descend into a new frame, a new map will be created. |
390 typedef HashMap<const RenderLayer*, Vector<const Frame*> > LayerFrameMap; | 390 typedef HashMap<const RenderLayer*, Vector<const Frame*> > LayerFrameMap; |
391 static void makeLayerChildFrameMap(const Frame* currentFrame, LayerFrameMap* map
) | 391 static void makeLayerChildFrameMap(const Frame* currentFrame, LayerFrameMap* map
) |
392 { | 392 { |
393 map->clear(); | 393 map->clear(); |
394 const FrameTree& tree = currentFrame->tree(); | 394 const FrameTree& tree = currentFrame->tree(); |
395 for (const Frame* child = tree.firstChild(); child; child = child->tree().ne
xtSibling()) { | 395 for (const Frame* child = tree.firstChild(); child; child = child->tree().ne
xtSibling()) { |
396 const RenderLayer* containingLayer = child->ownerRenderer()->enclosingLa
yer(); | 396 const RenderLayer* containingLayer = child->ownerRenderer()->enclosingLa
yer(); |
397 LayerFrameMap::iterator iter = map->find(containingLayer); | 397 LayerFrameMap::iterator iter = map->find(containingLayer); |
398 if (iter == map->end()) | 398 if (iter == map->end()) |
399 iter = map->add(containingLayer, Vector<const Frame*>()).iterator; | 399 map->add(containingLayer, Vector<const Frame*>()).iterator->value.ap
pend(child); |
400 iter->value.append(child); | 400 else |
| 401 iter->value.append(child); |
401 } | 402 } |
402 } | 403 } |
403 | 404 |
404 static void convertLayerRectsToEnclosingCompositedLayerRecursive( | 405 static void convertLayerRectsToEnclosingCompositedLayerRecursive( |
405 const RenderLayer* curLayer, | 406 const RenderLayer* curLayer, |
406 const LayerHitTestRects& layerRects, | 407 const LayerHitTestRects& layerRects, |
407 LayerHitTestRects& compositorRects, | 408 LayerHitTestRects& compositorRects, |
408 RenderGeometryMap& geometryMap, | 409 RenderGeometryMap& geometryMap, |
409 HashSet<const RenderLayer*>& layersWithRects, | 410 HashSet<const RenderLayer*>& layersWithRects, |
410 LayerFrameMap& layerChildFrameMap) | 411 LayerFrameMap& layerChildFrameMap) |
(...skipping 13 matching lines...) Expand all Loading... |
424 } | 425 } |
425 } | 426 } |
426 if (!compositedLayer) { | 427 if (!compositedLayer) { |
427 // Since this machinery is used only when accelerated compositing is
enabled, we expect | 428 // Since this machinery is used only when accelerated compositing is
enabled, we expect |
428 // that every layer should have an enclosing composited layer. | 429 // that every layer should have an enclosing composited layer. |
429 ASSERT_NOT_REACHED(); | 430 ASSERT_NOT_REACHED(); |
430 return; | 431 return; |
431 } | 432 } |
432 | 433 |
433 LayerHitTestRects::iterator compIter = compositorRects.find(compositedLa
yer); | 434 LayerHitTestRects::iterator compIter = compositorRects.find(compositedLa
yer); |
| 435 Vector<LayoutRect>* compIterValue; |
434 if (compIter == compositorRects.end()) | 436 if (compIter == compositorRects.end()) |
435 compIter = compositorRects.add(compositedLayer, Vector<LayoutRect>()
).iterator; | 437 compIterValue = &compositorRects.add(compositedLayer, Vector<LayoutR
ect>()).iterator->value; |
| 438 else |
| 439 compIterValue = &compIter->value; |
436 // Transform each rect to the co-ordinate space of it's enclosing compos
ited layer. | 440 // Transform each rect to the co-ordinate space of it's enclosing compos
ited layer. |
437 for (size_t i = 0; i < layerIter->value.size(); ++i) { | 441 for (size_t i = 0; i < layerIter->value.size(); ++i) { |
438 LayoutRect rect = layerIter->value[i]; | 442 LayoutRect rect = layerIter->value[i]; |
439 if (compositedLayer != curLayer) { | 443 if (compositedLayer != curLayer) { |
440 FloatQuad compositorQuad = geometryMap.mapToContainer(rect, comp
ositedLayer->renderer()); | 444 FloatQuad compositorQuad = geometryMap.mapToContainer(rect, comp
ositedLayer->renderer()); |
441 rect = LayoutRect(compositorQuad.boundingBox()); | 445 rect = LayoutRect(compositorQuad.boundingBox()); |
442 // If the enclosing composited layer itself is scrolled, we have
to undo the subtraction | 446 // If the enclosing composited layer itself is scrolled, we have
to undo the subtraction |
443 // of its scroll offset since we want the offset relative to the
scrolling content, not | 447 // of its scroll offset since we want the offset relative to the
scrolling content, not |
444 // the element itself. | 448 // the element itself. |
445 if (compositedLayer->renderer()->hasOverflowClip()) | 449 if (compositedLayer->renderer()->hasOverflowClip()) |
446 rect.move(compositedLayer->renderBox()->scrolledContentOffse
t()); | 450 rect.move(compositedLayer->renderBox()->scrolledContentOffse
t()); |
447 } | 451 } |
448 compIter->value.append(rect); | 452 compIterValue->append(rect); |
449 } | 453 } |
450 } | 454 } |
451 | 455 |
452 // Walk child layers of interest | 456 // Walk child layers of interest |
453 for (const RenderLayer* childLayer = curLayer->firstChild(); childLayer; chi
ldLayer = childLayer->nextSibling()) { | 457 for (const RenderLayer* childLayer = curLayer->firstChild(); childLayer; chi
ldLayer = childLayer->nextSibling()) { |
454 if (layersWithRects.contains(childLayer)) { | 458 if (layersWithRects.contains(childLayer)) { |
455 geometryMap.pushMappingsToAncestor(childLayer, curLayer); | 459 geometryMap.pushMappingsToAncestor(childLayer, curLayer); |
456 convertLayerRectsToEnclosingCompositedLayerRecursive(childLayer, lay
erRects, compositorRects, geometryMap, layersWithRects, layerChildFrameMap); | 460 convertLayerRectsToEnclosingCompositedLayerRecursive(childLayer, lay
erRects, compositorRects, geometryMap, layersWithRects, layerChildFrameMap); |
457 geometryMap.popMappingsToAncestor(curLayer); | 461 geometryMap.popMappingsToAncestor(curLayer); |
458 } | 462 } |
(...skipping 491 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
950 bool frameIsScrollable = frameView && frameView->isScrollable(); | 954 bool frameIsScrollable = frameView && frameView->isScrollable(); |
951 if (frameIsScrollable != m_wasFrameScrollable) | 955 if (frameIsScrollable != m_wasFrameScrollable) |
952 return true; | 956 return true; |
953 | 957 |
954 if (WebLayer* scrollLayer = frameView ? scrollingWebLayerForScrollableArea(f
rameView) : 0) | 958 if (WebLayer* scrollLayer = frameView ? scrollingWebLayerForScrollableArea(f
rameView) : 0) |
955 return blink::WebSize(frameView->contentsSize()) != scrollLayer->bounds(
); | 959 return blink::WebSize(frameView->contentsSize()) != scrollLayer->bounds(
); |
956 return false; | 960 return false; |
957 } | 961 } |
958 | 962 |
959 } // namespace WebCore | 963 } // namespace WebCore |
OLD | NEW |