| 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 23 matching lines...) Expand all Loading... |
| 34 #include "core/frame/Settings.h" | 34 #include "core/frame/Settings.h" |
| 35 #include "core/frame/VisualViewport.h" | 35 #include "core/frame/VisualViewport.h" |
| 36 #include "core/html/HTMLCanvasElement.h" | 36 #include "core/html/HTMLCanvasElement.h" |
| 37 #include "core/html/HTMLIFrameElement.h" | 37 #include "core/html/HTMLIFrameElement.h" |
| 38 #include "core/html/HTMLMediaElement.h" | 38 #include "core/html/HTMLMediaElement.h" |
| 39 #include "core/html/HTMLVideoElement.h" | 39 #include "core/html/HTMLVideoElement.h" |
| 40 #include "core/html/canvas/CanvasRenderingContext.h" | 40 #include "core/html/canvas/CanvasRenderingContext.h" |
| 41 #include "core/layout/LayoutEmbeddedObject.h" | 41 #include "core/layout/LayoutEmbeddedObject.h" |
| 42 #include "core/layout/LayoutHTMLCanvas.h" | 42 #include "core/layout/LayoutHTMLCanvas.h" |
| 43 #include "core/layout/LayoutImage.h" | 43 #include "core/layout/LayoutImage.h" |
| 44 #include "core/layout/LayoutInline.h" |
| 44 #include "core/layout/LayoutPart.h" | 45 #include "core/layout/LayoutPart.h" |
| 45 #include "core/layout/LayoutVideo.h" | 46 #include "core/layout/LayoutVideo.h" |
| 46 #include "core/layout/LayoutView.h" | 47 #include "core/layout/LayoutView.h" |
| 47 #include "core/layout/api/LayoutAPIShim.h" | 48 #include "core/layout/api/LayoutAPIShim.h" |
| 48 #include "core/layout/api/LayoutPartItem.h" | 49 #include "core/layout/api/LayoutPartItem.h" |
| 49 #include "core/layout/compositing/PaintLayerCompositor.h" | 50 #include "core/layout/compositing/PaintLayerCompositor.h" |
| 50 #include "core/loader/resource/ImageResourceContent.h" | 51 #include "core/loader/resource/ImageResourceContent.h" |
| 51 #include "core/page/ChromeClient.h" | 52 #include "core/page/ChromeClient.h" |
| 52 #include "core/page/Page.h" | 53 #include "core/page/Page.h" |
| 53 #include "core/page/scrolling/ScrollingCoordinator.h" | 54 #include "core/page/scrolling/ScrollingCoordinator.h" |
| (...skipping 830 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 884 offset.MoveBy(-local_representative_point_for_fragmentation); | 885 offset.MoveBy(-local_representative_point_for_fragmentation); |
| 885 return offset; | 886 return offset; |
| 886 } | 887 } |
| 887 | 888 |
| 888 void CompositedLayerMapping::ComputeBoundsOfOwningLayer( | 889 void CompositedLayerMapping::ComputeBoundsOfOwningLayer( |
| 889 const PaintLayer* composited_ancestor, | 890 const PaintLayer* composited_ancestor, |
| 890 IntRect& local_bounds, | 891 IntRect& local_bounds, |
| 891 IntRect& compositing_bounds_relative_to_composited_ancestor, | 892 IntRect& compositing_bounds_relative_to_composited_ancestor, |
| 892 LayoutPoint& offset_from_composited_ancestor, | 893 LayoutPoint& offset_from_composited_ancestor, |
| 893 IntPoint& snapped_offset_from_composited_ancestor) { | 894 IntPoint& snapped_offset_from_composited_ancestor) { |
| 894 LayoutRect local_raw_compositing_bounds = CompositedBounds(); | 895 // HACK(chrishtr): adjust for position of inlines. |
| 896 LayoutPoint local_representative_point_for_fragmentation; |
| 897 if (owning_layer_.GetLayoutObject().IsLayoutInline()) { |
| 898 local_representative_point_for_fragmentation = |
| 899 ToLayoutInline(owning_layer_.GetLayoutObject()).FirstLineBoxTopLeft(); |
| 900 } |
| 895 offset_from_composited_ancestor = ComputeOffsetFromCompositedAncestor( | 901 offset_from_composited_ancestor = ComputeOffsetFromCompositedAncestor( |
| 896 &owning_layer_, composited_ancestor, | 902 &owning_layer_, composited_ancestor, |
| 897 local_raw_compositing_bounds.Location()); | 903 local_representative_point_for_fragmentation); |
| 898 snapped_offset_from_composited_ancestor = | 904 snapped_offset_from_composited_ancestor = |
| 899 IntPoint(offset_from_composited_ancestor.X().Round(), | 905 IntPoint(offset_from_composited_ancestor.X().Round(), |
| 900 offset_from_composited_ancestor.Y().Round()); | 906 offset_from_composited_ancestor.Y().Round()); |
| 901 | 907 |
| 902 LayoutSize subpixel_accumulation; | 908 LayoutSize subpixel_accumulation; |
| 903 if (!owning_layer_.Transform() || | 909 if (!owning_layer_.Transform() || |
| 904 owning_layer_.Transform()->IsIdentityOrTranslation()) { | 910 owning_layer_.Transform()->IsIdentityOrTranslation()) { |
| 905 subpixel_accumulation = offset_from_composited_ancestor - | 911 subpixel_accumulation = offset_from_composited_ancestor - |
| 906 snapped_offset_from_composited_ancestor; | 912 snapped_offset_from_composited_ancestor; |
| 907 } | 913 } |
| 908 // Otherwise discard the sub-pixel remainder because paint offset can't be | 914 // Otherwise discard the sub-pixel remainder because paint offset can't be |
| 909 // transformed by a non-translation transform. | 915 // transformed by a non-translation transform. |
| 910 owning_layer_.SetSubpixelAccumulation(subpixel_accumulation); | 916 owning_layer_.SetSubpixelAccumulation(subpixel_accumulation); |
| 911 | 917 |
| 912 // Move the bounds by the subpixel accumulation so that it pixel-snaps | 918 // Move the bounds by the subpixel accumulation so that it pixel-snaps |
| 913 // relative to absolute pixels instead of local coordinates. | 919 // relative to absolute pixels instead of local coordinates. |
| 920 LayoutRect local_raw_compositing_bounds = CompositedBounds(); |
| 914 local_raw_compositing_bounds.Move(subpixel_accumulation); | 921 local_raw_compositing_bounds.Move(subpixel_accumulation); |
| 915 local_bounds = PixelSnappedIntRect(local_raw_compositing_bounds); | 922 local_bounds = PixelSnappedIntRect(local_raw_compositing_bounds); |
| 916 | 923 |
| 917 compositing_bounds_relative_to_composited_ancestor = local_bounds; | 924 compositing_bounds_relative_to_composited_ancestor = local_bounds; |
| 918 compositing_bounds_relative_to_composited_ancestor.MoveBy( | 925 compositing_bounds_relative_to_composited_ancestor.MoveBy( |
| 919 snapped_offset_from_composited_ancestor); | 926 snapped_offset_from_composited_ancestor); |
| 920 } | 927 } |
| 921 | 928 |
| 922 void CompositedLayerMapping::UpdateSquashingLayerGeometry( | 929 void CompositedLayerMapping::UpdateSquashingLayerGeometry( |
| 923 const IntPoint& graphics_layer_parent_location, | 930 const IntPoint& graphics_layer_parent_location, |
| (...skipping 2710 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3634 } else if (graphics_layer == decoration_outline_layer_.get()) { | 3641 } else if (graphics_layer == decoration_outline_layer_.get()) { |
| 3635 name = "Decoration Layer"; | 3642 name = "Decoration Layer"; |
| 3636 } else { | 3643 } else { |
| 3637 NOTREACHED(); | 3644 NOTREACHED(); |
| 3638 } | 3645 } |
| 3639 | 3646 |
| 3640 return name; | 3647 return name; |
| 3641 } | 3648 } |
| 3642 | 3649 |
| 3643 } // namespace blink | 3650 } // namespace blink |
| OLD | NEW |