OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright (C) 2009, 2010, 2011 Apple Inc. All rights reserved. | 2 * Copyright (C) 2009, 2010, 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 557 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
568 | 568 |
569 ASSERT(compositor()->layerSquashingEnabled()); | 569 ASSERT(compositor()->layerSquashingEnabled()); |
570 | 570 |
571 LayoutRect totalSquashBounds; | 571 LayoutRect totalSquashBounds; |
572 for (size_t i = 0; i < m_squashedLayers.size(); ++i) { | 572 for (size_t i = 0; i < m_squashedLayers.size(); ++i) { |
573 LayoutRect squashedBounds = compositor()->calculateCompositedBounds(m_sq uashedLayers[i].renderLayer, m_squashedLayers[i].renderLayer); | 573 LayoutRect squashedBounds = compositor()->calculateCompositedBounds(m_sq uashedLayers[i].renderLayer, m_squashedLayers[i].renderLayer); |
574 | 574 |
575 // Store the local bounds of the RenderLayer subtree before applying the offset. | 575 // Store the local bounds of the RenderLayer subtree before applying the offset. |
576 m_squashedLayers[i].compositedBounds = squashedBounds; | 576 m_squashedLayers[i].compositedBounds = squashedBounds; |
577 | 577 |
578 squashedBounds.move(m_squashedLayers[i].offsetFromSquashingCLM); | 578 squashedBounds.move(roundedIntSize(m_squashedLayers[i].offsetFromSquashi ngCLM + m_subpixelAccumulation)); |
579 totalSquashBounds.unite(squashedBounds); | 579 totalSquashBounds.unite(squashedBounds); |
580 } | 580 } |
581 | 581 |
582 // The totalSquashBounds is positioned with respect to m_owningLayer of this CompositedLayerMapping. | 582 // The totalSquashBounds is positioned with respect to m_owningLayer of this CompositedLayerMapping. |
583 // But the squashingLayer needs to be positioned with respect to the ancesto r CompositedLayerMapping. | 583 // But the squashingLayer needs to be positioned with respect to the ancesto r CompositedLayerMapping. |
584 // The conversion between m_owningLayer and the ancestor CLM is already comp uted in the caller as |delta|. | 584 // The conversion between m_owningLayer and the ancestor CLM is already comp uted above as |delta|. |
ajuma
2014/02/03 21:00:44
What if the compositing ancestor has a clip layer?
| |
585 // FIXME: probably not the right place to round from LayoutPoint to IntPoint ? | 585 IntRect squashLayerBounds = pixelSnappedIntRect(totalSquashBounds); |
586 IntPoint squashLayerPosition = pixelSnappedIntRect(totalSquashBounds).locati on(); | 586 IntPoint squashLayerOrigin = squashLayerBounds.location(); |
587 squashLayerPosition.moveBy(delta); | 587 squashLayerBounds.moveBy(delta); |
588 | 588 |
589 // FIXME: this could be skipped for accelerated overflow scrolling, somehow. | 589 // FIXME: this could be skipped for accelerated overflow scrolling, somehow. |
590 m_squashingLayer->setNeedsDisplay(); | 590 m_squashingLayer->setNeedsDisplay(); |
591 | 591 |
592 m_squashingLayer->setPosition(squashLayerPosition); | 592 m_squashingLayer->setPosition(squashLayerBounds.location()); |
593 m_squashingLayer->setSize(totalSquashBounds.size()); | 593 m_squashingLayer->setSize(squashLayerBounds.size()); |
594 | 594 |
595 // Now that the squashing bounds are known, we can convert the RenderLayer p ainting offsets | 595 // Now that the squashing bounds are known, we can convert the RenderLayer p ainting offsets |
596 // from CLM owning layer space to the squashing layer space. | 596 // from CLM owning layer space to the squashing layer space. |
597 // | 597 // |
598 // The painting offset we want to compute for each squashed RenderLayer is e ssentially the position of | 598 // The painting offset we want to compute for each squashed RenderLayer is e ssentially the position of |
599 // the squashed RenderLayer described w.r.t. m_squashingLayer's origin. For this purpose we already cached | 599 // the squashed RenderLayer described w.r.t. m_squashingLayer's origin. For this purpose we already cached |
600 // offsetFromSquashingCLM before, which describes where the squashed RenderL ayer is located w.r.t. | 600 // offsetFromSquashingCLM before, which describes where the squashed RenderL ayer is located w.r.t. |
601 // m_owningLayer. So we just need to convert that point from m_owningLayer s pace to m_squashingLayer | 601 // m_owningLayer. So we just need to convert that point from m_owningLayer s pace to m_squashingLayer |
602 // space. This is simply done by subtracing totalSquashBounds... but then th e offset overall needs to be | 602 // space. This is simply done by subtracing squashLayerOrigin... but then th e offset overall needs to be |
603 // negated because that's the direction that the painting code expects the o ffset to be. | 603 // negated because that's the direction that the painting code expects the o ffset to be. |
604 for (size_t i = 0; i < m_squashedLayers.size(); ++i) { | 604 for (size_t i = 0; i < m_squashedLayers.size(); ++i) { |
605 m_squashedLayers[i].offsetFromRenderer = IntSize(-m_squashedLayers[i].of fsetFromSquashingCLM.width() + totalSquashBounds.x(), | 605 m_squashedLayers[i].offsetFromRenderer = -roundedIntSize(LayoutSize(m_sq uashedLayers[i].offsetFromSquashingCLM.width() - squashLayerOrigin.x() + m_subpi xelAccumulation.width(), |
606 -m_squashedLayers[i].offsetFromSquashingCLM.height() + totalSquashBo unds.y()); | 606 m_squashedLayers[i].offsetFromSquashingCLM.height() - squashLayerOri gin.y() + m_subpixelAccumulation.height())); |
607 | 607 |
608 // FIXME: find a better design to avoid this redundant value - most like ly it will make | 608 // FIXME: find a better design to avoid this redundant value - most like ly it will make |
609 // sense to move the paint task info into RenderLayer's m_compositingPro perties. | 609 // sense to move the paint task info into RenderLayer's m_compositingPro perties. |
610 m_squashedLayers[i].renderLayer->setOffsetFromSquashingLayerOrigin(m_squ ashedLayers[i].offsetFromRenderer); | 610 m_squashedLayers[i].renderLayer->setOffsetFromSquashingLayerOrigin(m_squ ashedLayers[i].offsetFromRenderer); |
611 } | 611 } |
612 } | 612 } |
613 | 613 |
614 void CompositedLayerMapping::updateGraphicsLayerGeometry() | 614 void CompositedLayerMapping::updateGraphicsLayerGeometry() |
615 { | 615 { |
616 // If we haven't built z-order lists yet, wait until later. | 616 // If we haven't built z-order lists yet, wait until later. |
(...skipping 1440 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2057 LayoutRect CompositedLayerMapping::compositedBounds() const | 2057 LayoutRect CompositedLayerMapping::compositedBounds() const |
2058 { | 2058 { |
2059 return m_compositedBounds; | 2059 return m_compositedBounds; |
2060 } | 2060 } |
2061 | 2061 |
2062 void CompositedLayerMapping::setCompositedBounds(const LayoutRect& bounds) | 2062 void CompositedLayerMapping::setCompositedBounds(const LayoutRect& bounds) |
2063 { | 2063 { |
2064 m_compositedBounds = bounds; | 2064 m_compositedBounds = bounds; |
2065 } | 2065 } |
2066 | 2066 |
2067 void CompositedLayerMapping::addRenderLayerToSquashingGraphicsLayer(RenderLayer* layer, IntSize offsetFromSquashingCLM, size_t nextSquashedLayerIndex) | 2067 void CompositedLayerMapping::addRenderLayerToSquashingGraphicsLayer(RenderLayer* layer, LayoutSize offsetFromSquashingCLM, size_t nextSquashedLayerIndex) |
2068 { | 2068 { |
2069 ASSERT(compositor()->layerSquashingEnabled()); | 2069 ASSERT(compositor()->layerSquashingEnabled()); |
2070 | 2070 |
2071 GraphicsLayerPaintInfo paintInfo; | 2071 GraphicsLayerPaintInfo paintInfo; |
2072 paintInfo.renderLayer = layer; | 2072 paintInfo.renderLayer = layer; |
2073 // NOTE: composited bounds are updated elsewhere | 2073 // NOTE: composited bounds are updated elsewhere |
2074 // NOTE: offsetFromRenderer is updated elsewhere | 2074 // NOTE: offsetFromRenderer is updated elsewhere |
2075 paintInfo.offsetFromSquashingCLM = offsetFromSquashingCLM; | 2075 paintInfo.offsetFromSquashingCLM = offsetFromSquashingCLM; |
2076 paintInfo.paintingPhase = GraphicsLayerPaintAllWithOverflowClip; | 2076 paintInfo.paintingPhase = GraphicsLayerPaintAllWithOverflowClip; |
2077 paintInfo.isBackgroundLayer = false; | 2077 paintInfo.isBackgroundLayer = false; |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2147 } else if (graphicsLayer == m_scrollingContentsLayer.get()) { | 2147 } else if (graphicsLayer == m_scrollingContentsLayer.get()) { |
2148 name = "Scrolling Contents Layer"; | 2148 name = "Scrolling Contents Layer"; |
2149 } else { | 2149 } else { |
2150 ASSERT_NOT_REACHED(); | 2150 ASSERT_NOT_REACHED(); |
2151 } | 2151 } |
2152 | 2152 |
2153 return name; | 2153 return name; |
2154 } | 2154 } |
2155 | 2155 |
2156 } // namespace WebCore | 2156 } // namespace WebCore |
OLD | NEW |