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 787 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
798 return layerConfigChanged; | 798 return layerConfigChanged; |
799 } | 799 } |
800 | 800 |
801 static IntRect clipBox(LayoutBox& layoutObject) { | 801 static IntRect clipBox(LayoutBox& layoutObject) { |
802 // TODO(chrishtr): pixel snapping is most likely incorrect here. | 802 // TODO(chrishtr): pixel snapping is most likely incorrect here. |
803 return pixelSnappedIntRect(layoutObject.clippingRect()); | 803 return pixelSnappedIntRect(layoutObject.clippingRect()); |
804 } | 804 } |
805 | 805 |
806 static LayoutPoint computeOffsetFromCompositedAncestor( | 806 static LayoutPoint computeOffsetFromCompositedAncestor( |
807 const PaintLayer* layer, | 807 const PaintLayer* layer, |
808 const PaintLayer* compositedAncestor) { | 808 const PaintLayer* compositedAncestor, |
809 LayoutPoint offset = layer->visualOffsetFromAncestor(compositedAncestor); | 809 const LayoutPoint& localRepresentativePointForFragmentation) { |
| 810 // Add in the offset of the composited bounds from the coordinate space of |
| 811 // the PaintLayer, since visualOffsetFromAncestor() requires the pre-offset |
| 812 // input to be in the space of the PaintLayer. We also need to add in this |
| 813 // offset before computation of visualOffsetFromAncestor(), because it affects |
| 814 // fragmentation offset if compositedAncestor crosses a pagination boundary. |
| 815 // |
| 816 // Currently, visual fragmentation for composited layers is not implemented. |
| 817 // For fragmented contents, we paint in the logical coordinates of the flow |
| 818 // thread, then split the result by fragment boundary and paste each part |
| 819 // into each fragment's physical position. |
| 820 // Since composited layers don't support visual fragmentation, we have to |
| 821 // choose a "representative" fragment to position the painted contents. This |
| 822 // is where localRepresentativePointForFragmentation comes into play. |
| 823 // The fragment that the representative point resides in will be chosen as |
| 824 // the representative fragment for layer position purpose. |
| 825 // For layers that are not fragmented, the point doesn't affect behavior as |
| 826 // there is one and only one fragment. |
| 827 LayoutPoint offset = layer->visualOffsetFromAncestor( |
| 828 compositedAncestor, localRepresentativePointForFragmentation); |
810 if (compositedAncestor) | 829 if (compositedAncestor) |
811 offset.move(compositedAncestor->compositedLayerMapping() | 830 offset.move(compositedAncestor->compositedLayerMapping() |
812 ->owningLayer() | 831 ->owningLayer() |
813 .subpixelAccumulation()); | 832 .subpixelAccumulation()); |
| 833 offset.moveBy(-localRepresentativePointForFragmentation); |
814 return offset; | 834 return offset; |
815 } | 835 } |
816 | 836 |
817 void CompositedLayerMapping::computeBoundsOfOwningLayer( | 837 void CompositedLayerMapping::computeBoundsOfOwningLayer( |
818 const PaintLayer* compositedAncestor, | 838 const PaintLayer* compositedAncestor, |
819 IntRect& localBounds, | 839 IntRect& localBounds, |
820 IntRect& compositingBoundsRelativeToCompositedAncestor, | 840 IntRect& compositingBoundsRelativeToCompositedAncestor, |
821 LayoutPoint& offsetFromCompositedAncestor, | 841 LayoutPoint& offsetFromCompositedAncestor, |
822 IntPoint& snappedOffsetFromCompositedAncestor) { | 842 IntPoint& snappedOffsetFromCompositedAncestor) { |
823 LayoutRect localRawCompositingBounds = compositedBounds(); | 843 LayoutRect localRawCompositingBounds = compositedBounds(); |
824 offsetFromCompositedAncestor = | 844 offsetFromCompositedAncestor = computeOffsetFromCompositedAncestor( |
825 computeOffsetFromCompositedAncestor(&m_owningLayer, compositedAncestor); | 845 &m_owningLayer, compositedAncestor, localRawCompositingBounds.location()); |
826 snappedOffsetFromCompositedAncestor = | 846 snappedOffsetFromCompositedAncestor = |
827 IntPoint(offsetFromCompositedAncestor.x().round(), | 847 IntPoint(offsetFromCompositedAncestor.x().round(), |
828 offsetFromCompositedAncestor.y().round()); | 848 offsetFromCompositedAncestor.y().round()); |
829 | 849 |
830 LayoutSize subpixelAccumulation = | 850 LayoutSize subpixelAccumulation = |
831 offsetFromCompositedAncestor - snappedOffsetFromCompositedAncestor; | 851 offsetFromCompositedAncestor - snappedOffsetFromCompositedAncestor; |
832 m_owningLayer.setSubpixelAccumulation(subpixelAccumulation); | 852 m_owningLayer.setSubpixelAccumulation(subpixelAccumulation); |
833 | 853 |
834 // Move the bounds by the subpixel accumulation so that it pixel-snaps | 854 // Move the bounds by the subpixel accumulation so that it pixel-snaps |
835 // relative to absolute pixels instead of local coordinates. | 855 // relative to absolute pixels instead of local coordinates. |
(...skipping 2652 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3488 } else if (graphicsLayer == m_decorationOutlineLayer.get()) { | 3508 } else if (graphicsLayer == m_decorationOutlineLayer.get()) { |
3489 name = "Decoration Layer"; | 3509 name = "Decoration Layer"; |
3490 } else { | 3510 } else { |
3491 ASSERT_NOT_REACHED(); | 3511 ASSERT_NOT_REACHED(); |
3492 } | 3512 } |
3493 | 3513 |
3494 return name; | 3514 return name; |
3495 } | 3515 } |
3496 | 3516 |
3497 } // namespace blink | 3517 } // namespace blink |
OLD | NEW |