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 offsetFromPaintLayer) { |
trchen
2017/03/09 23:41:16
const LayoutPoint localRepresentativePointForFragm
chrishtr
2017/03/10 01:50:04
Done.
| |
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. | |
trchen
2017/03/09 23:41:16
// Currently visual fragmentation for composited l
chrishtr
2017/03/10 01:50:04
Done.
| |
815 LayoutPoint offset = | |
816 layer->visualOffsetFromAncestor(compositedAncestor, offsetFromPaintLayer); | |
810 if (compositedAncestor) | 817 if (compositedAncestor) |
811 offset.move(compositedAncestor->compositedLayerMapping() | 818 offset.move(compositedAncestor->compositedLayerMapping() |
812 ->owningLayer() | 819 ->owningLayer() |
813 .subpixelAccumulation()); | 820 .subpixelAccumulation()); |
821 offset.moveBy(-offsetFromPaintLayer); | |
814 return offset; | 822 return offset; |
815 } | 823 } |
816 | 824 |
817 void CompositedLayerMapping::computeBoundsOfOwningLayer( | 825 void CompositedLayerMapping::computeBoundsOfOwningLayer( |
818 const PaintLayer* compositedAncestor, | 826 const PaintLayer* compositedAncestor, |
819 IntRect& localBounds, | 827 IntRect& localBounds, |
820 IntRect& compositingBoundsRelativeToCompositedAncestor, | 828 IntRect& compositingBoundsRelativeToCompositedAncestor, |
821 LayoutPoint& offsetFromCompositedAncestor, | 829 LayoutPoint& offsetFromCompositedAncestor, |
822 IntPoint& snappedOffsetFromCompositedAncestor) { | 830 IntPoint& snappedOffsetFromCompositedAncestor) { |
823 LayoutRect localRawCompositingBounds = compositedBounds(); | 831 LayoutRect localRawCompositingBounds = compositedBounds(); |
824 offsetFromCompositedAncestor = | 832 offsetFromCompositedAncestor = computeOffsetFromCompositedAncestor( |
825 computeOffsetFromCompositedAncestor(&m_owningLayer, compositedAncestor); | 833 &m_owningLayer, compositedAncestor, localRawCompositingBounds.location()); |
826 snappedOffsetFromCompositedAncestor = | 834 snappedOffsetFromCompositedAncestor = |
827 IntPoint(offsetFromCompositedAncestor.x().round(), | 835 IntPoint(offsetFromCompositedAncestor.x().round(), |
828 offsetFromCompositedAncestor.y().round()); | 836 offsetFromCompositedAncestor.y().round()); |
829 | 837 |
830 LayoutSize subpixelAccumulation = | 838 LayoutSize subpixelAccumulation = |
831 offsetFromCompositedAncestor - snappedOffsetFromCompositedAncestor; | 839 offsetFromCompositedAncestor - snappedOffsetFromCompositedAncestor; |
832 m_owningLayer.setSubpixelAccumulation(subpixelAccumulation); | 840 m_owningLayer.setSubpixelAccumulation(subpixelAccumulation); |
833 | 841 |
834 // Move the bounds by the subpixel accumulation so that it pixel-snaps | 842 // Move the bounds by the subpixel accumulation so that it pixel-snaps |
835 // relative to absolute pixels instead of local coordinates. | 843 // 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()) { | 3496 } else if (graphicsLayer == m_decorationOutlineLayer.get()) { |
3489 name = "Decoration Layer"; | 3497 name = "Decoration Layer"; |
3490 } else { | 3498 } else { |
3491 ASSERT_NOT_REACHED(); | 3499 ASSERT_NOT_REACHED(); |
3492 } | 3500 } |
3493 | 3501 |
3494 return name; | 3502 return name; |
3495 } | 3503 } |
3496 | 3504 |
3497 } // namespace blink | 3505 } // namespace blink |
OLD | NEW |