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 401 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
412 continue; | 412 continue; |
413 const RenderLayer* containingLayer = ownerRenderer->enclosingLayer(); | 413 const RenderLayer* containingLayer = ownerRenderer->enclosingLayer(); |
414 LayerFrameMap::iterator iter = map->find(containingLayer); | 414 LayerFrameMap::iterator iter = map->find(containingLayer); |
415 if (iter == map->end()) | 415 if (iter == map->end()) |
416 map->add(containingLayer, Vector<const LocalFrame*>()).storedValue->
value.append(toLocalFrame(child)); | 416 map->add(containingLayer, Vector<const LocalFrame*>()).storedValue->
value.append(toLocalFrame(child)); |
417 else | 417 else |
418 iter->value.append(toLocalFrame(child)); | 418 iter->value.append(toLocalFrame(child)); |
419 } | 419 } |
420 } | 420 } |
421 | 421 |
422 // Return the enclosingCompositedLayerForRepaint for the given RenderLayer | 422 // Return the enclosingCompositedLayerForPaintInvalidation for the given RenderL
ayer |
423 // including crossing frame boundaries. | 423 // including crossing frame boundaries. |
424 static const RenderLayer* enclosingCompositedLayer(const RenderLayer* layer) | 424 static const RenderLayer* enclosingCompositedLayer(const RenderLayer* layer) |
425 { | 425 { |
426 RenderLayer* compositedLayer = 0; | 426 RenderLayer* compositedLayer = 0; |
427 while (!compositedLayer) { | 427 while (!compositedLayer) { |
428 compositedLayer = layer->enclosingCompositingLayerForPaintInvalidation()
; | 428 compositedLayer = layer->enclosingCompositingLayerForPaintInvalidation()
; |
429 if (!compositedLayer) { | 429 if (!compositedLayer) { |
430 RenderObject* owner = layer->renderer()->frame()->ownerRenderer(); | 430 RenderObject* owner = layer->renderer()->frame()->ownerRenderer(); |
431 if (!owner) | 431 if (!owner) |
432 break; | 432 break; |
(...skipping 17 matching lines...) Expand all Loading... |
450 // Project any rects for the current layer | 450 // Project any rects for the current layer |
451 LayerHitTestRects::const_iterator layerIter = layerRects.find(curLayer); | 451 LayerHitTestRects::const_iterator layerIter = layerRects.find(curLayer); |
452 if (layerIter != layerRects.end()) { | 452 if (layerIter != layerRects.end()) { |
453 // Find the enclosing composited layer when it's in another document (fo
r non-composited iframes). | 453 // Find the enclosing composited layer when it's in another document (fo
r non-composited iframes). |
454 const RenderLayer* compositedLayer = enclosingCompositedLayer(layerIter-
>key); | 454 const RenderLayer* compositedLayer = enclosingCompositedLayer(layerIter-
>key); |
455 if (!compositedLayer) | 455 if (!compositedLayer) |
456 return; | 456 return; |
457 | 457 |
458 // Find the appropriate GraphicsLayer for the composited RenderLayer. | 458 // Find the appropriate GraphicsLayer for the composited RenderLayer. |
459 GraphicsLayer* graphicsLayer; | 459 GraphicsLayer* graphicsLayer; |
460 LayoutSize extraOffset; | |
461 if (compositedLayer->compositingState() == PaintsIntoGroupedBacking) { | 460 if (compositedLayer->compositingState() == PaintsIntoGroupedBacking) { |
462 graphicsLayer = compositedLayer->groupedMapping()->squashingLayer(); | 461 graphicsLayer = compositedLayer->groupedMapping()->squashingLayer(); |
463 extraOffset = -compositedLayer->offsetFromSquashingLayerOrigin(); | |
464 } else { | 462 } else { |
465 ASSERT(compositedLayer->hasCompositedLayerMapping()); | 463 ASSERT(compositedLayer->hasCompositedLayerMapping()); |
466 CompositedLayerMappingPtr compositedLayerMapping = compositedLayer->
compositedLayerMapping(); | 464 CompositedLayerMappingPtr compositedLayerMapping = compositedLayer->
compositedLayerMapping(); |
467 // The origin for the graphics layer does not have to be the same | |
468 // as the composited layer (e.g. when a child layer has negative | |
469 // offset and paints into this layer), so when projecting rects to | |
470 // graphics layer space they have to be offset by the origin for | |
471 // the composited layer. | |
472 extraOffset = compositedLayerMapping->contentOffsetInCompositingLaye
r(); | |
473 // If the layer is using composited scrolling, then it's the content
s that these | |
474 // rects apply to. | |
475 graphicsLayer = compositedLayerMapping->scrollingContentsLayer(); | 465 graphicsLayer = compositedLayerMapping->scrollingContentsLayer(); |
476 if (!graphicsLayer) | 466 if (!graphicsLayer) |
477 graphicsLayer = compositedLayerMapping->mainGraphicsLayer(); | 467 graphicsLayer = compositedLayerMapping->mainGraphicsLayer(); |
478 } | 468 } |
479 | 469 |
480 GraphicsLayerHitTestRects::iterator glIter = graphicsRects.find(graphics
Layer); | 470 GraphicsLayerHitTestRects::iterator glIter = graphicsRects.find(graphics
Layer); |
481 Vector<LayoutRect>* glRects; | 471 Vector<LayoutRect>* glRects; |
482 if (glIter == graphicsRects.end()) | 472 if (glIter == graphicsRects.end()) |
483 glRects = &graphicsRects.add(graphicsLayer, Vector<LayoutRect>()).st
oredValue->value; | 473 glRects = &graphicsRects.add(graphicsLayer, Vector<LayoutRect>()).st
oredValue->value; |
484 else | 474 else |
485 glRects = &glIter->value; | 475 glRects = &glIter->value; |
| 476 |
486 // Transform each rect to the co-ordinate space of the graphicsLayer. | 477 // Transform each rect to the co-ordinate space of the graphicsLayer. |
487 for (size_t i = 0; i < layerIter->value.size(); ++i) { | 478 for (size_t i = 0; i < layerIter->value.size(); ++i) { |
488 LayoutRect rect = layerIter->value[i]; | 479 LayoutRect rect = layerIter->value[i]; |
489 if (compositedLayer != curLayer) { | 480 if (compositedLayer != curLayer) { |
490 FloatQuad compositorQuad = geometryMap.mapToContainer(rect, comp
ositedLayer->renderer()); | 481 FloatQuad compositorQuad = geometryMap.mapToContainer(rect, comp
ositedLayer->renderer()); |
491 rect = LayoutRect(compositorQuad.boundingBox()); | 482 rect = LayoutRect(compositorQuad.boundingBox()); |
492 // If the enclosing composited layer itself is scrolled, we have
to undo the subtraction | 483 // If the enclosing composited layer itself is scrolled, we have
to undo the subtraction |
493 // of its scroll offset since we want the offset relative to the
scrolling content, not | 484 // of its scroll offset since we want the offset relative to the
scrolling content, not |
494 // the element itself. | 485 // the element itself. |
495 if (compositedLayer->renderer()->hasOverflowClip()) | 486 if (compositedLayer->renderer()->hasOverflowClip()) |
496 rect.move(compositedLayer->renderBox()->scrolledContentOffse
t()); | 487 rect.move(compositedLayer->renderBox()->scrolledContentOffse
t()); |
497 } | 488 } |
498 rect.move(extraOffset); | 489 RenderLayer::mapRectToPaintBackingCoordinates(compositedLayer->rende
rer(), rect); |
499 glRects->append(rect); | 490 glRects->append(rect); |
500 } | 491 } |
501 } | 492 } |
502 | 493 |
503 // Walk child layers of interest | 494 // Walk child layers of interest |
504 for (const RenderLayer* childLayer = curLayer->firstChild(); childLayer; chi
ldLayer = childLayer->nextSibling()) { | 495 for (const RenderLayer* childLayer = curLayer->firstChild(); childLayer; chi
ldLayer = childLayer->nextSibling()) { |
505 if (layersWithRects.contains(childLayer)) { | 496 if (layersWithRects.contains(childLayer)) { |
506 geometryMap.pushMappingsToAncestor(childLayer, curLayer); | 497 geometryMap.pushMappingsToAncestor(childLayer, curLayer); |
507 projectRectsToGraphicsLayerSpaceRecursive(childLayer, layerRects, gr
aphicsRects, geometryMap, layersWithRects, layerChildFrameMap); | 498 projectRectsToGraphicsLayerSpaceRecursive(childLayer, layerRects, gr
aphicsRects, geometryMap, layersWithRects, layerChildFrameMap); |
508 geometryMap.popMappingsToAncestor(curLayer); | 499 geometryMap.popMappingsToAncestor(curLayer); |
(...skipping 491 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1000 bool frameIsScrollable = frameView && frameView->isScrollable(); | 991 bool frameIsScrollable = frameView && frameView->isScrollable(); |
1001 if (frameIsScrollable != m_wasFrameScrollable) | 992 if (frameIsScrollable != m_wasFrameScrollable) |
1002 return true; | 993 return true; |
1003 | 994 |
1004 if (WebLayer* scrollLayer = frameView ? toWebLayer(frameView->layerForScroll
ing()) : 0) | 995 if (WebLayer* scrollLayer = frameView ? toWebLayer(frameView->layerForScroll
ing()) : 0) |
1005 return blink::WebSize(frameView->contentsSize()) != scrollLayer->bounds(
); | 996 return blink::WebSize(frameView->contentsSize()) != scrollLayer->bounds(
); |
1006 return false; | 997 return false; |
1007 } | 998 } |
1008 | 999 |
1009 } // namespace WebCore | 1000 } // namespace WebCore |
OLD | NEW |