| 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 824 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 878 offset.MoveBy(-local_representative_point_for_fragmentation); | 879 offset.MoveBy(-local_representative_point_for_fragmentation); |
| 879 return offset; | 880 return offset; |
| 880 } | 881 } |
| 881 | 882 |
| 882 void CompositedLayerMapping::ComputeBoundsOfOwningLayer( | 883 void CompositedLayerMapping::ComputeBoundsOfOwningLayer( |
| 883 const PaintLayer* composited_ancestor, | 884 const PaintLayer* composited_ancestor, |
| 884 IntRect& local_bounds, | 885 IntRect& local_bounds, |
| 885 IntRect& compositing_bounds_relative_to_composited_ancestor, | 886 IntRect& compositing_bounds_relative_to_composited_ancestor, |
| 886 LayoutPoint& offset_from_composited_ancestor, | 887 LayoutPoint& offset_from_composited_ancestor, |
| 887 IntPoint& snapped_offset_from_composited_ancestor) { | 888 IntPoint& snapped_offset_from_composited_ancestor) { |
| 888 LayoutRect local_raw_compositing_bounds = CompositedBounds(); | 889 // HACK(chrishtr): adjust for position of inlines. |
| 890 LayoutPoint local_representative_point_for_fragmentation; |
| 891 if (owning_layer_.GetLayoutObject().IsLayoutInline()) { |
| 892 local_representative_point_for_fragmentation = |
| 893 ToLayoutInline(owning_layer_.GetLayoutObject()).FirstLineBoxTopLeft(); |
| 894 } |
| 889 offset_from_composited_ancestor = ComputeOffsetFromCompositedAncestor( | 895 offset_from_composited_ancestor = ComputeOffsetFromCompositedAncestor( |
| 890 &owning_layer_, composited_ancestor, | 896 &owning_layer_, composited_ancestor, |
| 891 local_raw_compositing_bounds.Location()); | 897 local_representative_point_for_fragmentation); |
| 892 snapped_offset_from_composited_ancestor = | 898 snapped_offset_from_composited_ancestor = |
| 893 IntPoint(offset_from_composited_ancestor.X().Round(), | 899 IntPoint(offset_from_composited_ancestor.X().Round(), |
| 894 offset_from_composited_ancestor.Y().Round()); | 900 offset_from_composited_ancestor.Y().Round()); |
| 895 | 901 |
| 896 LayoutSize subpixel_accumulation; | 902 LayoutSize subpixel_accumulation; |
| 897 if (!owning_layer_.Transform() || | 903 if (!owning_layer_.Transform() || |
| 898 owning_layer_.Transform()->IsIdentityOrTranslation()) { | 904 owning_layer_.Transform()->IsIdentityOrTranslation()) { |
| 899 subpixel_accumulation = offset_from_composited_ancestor - | 905 subpixel_accumulation = offset_from_composited_ancestor - |
| 900 snapped_offset_from_composited_ancestor; | 906 snapped_offset_from_composited_ancestor; |
| 901 } | 907 } |
| 902 // Otherwise discard the sub-pixel remainder because paint offset can't be | 908 // Otherwise discard the sub-pixel remainder because paint offset can't be |
| 903 // transformed by a non-translation transform. | 909 // transformed by a non-translation transform. |
| 904 owning_layer_.SetSubpixelAccumulation(subpixel_accumulation); | 910 owning_layer_.SetSubpixelAccumulation(subpixel_accumulation); |
| 905 | 911 |
| 906 // Move the bounds by the subpixel accumulation so that it pixel-snaps | 912 // Move the bounds by the subpixel accumulation so that it pixel-snaps |
| 907 // relative to absolute pixels instead of local coordinates. | 913 // relative to absolute pixels instead of local coordinates. |
| 914 LayoutRect local_raw_compositing_bounds = CompositedBounds(); |
| 908 local_raw_compositing_bounds.Move(subpixel_accumulation); | 915 local_raw_compositing_bounds.Move(subpixel_accumulation); |
| 909 local_bounds = PixelSnappedIntRect(local_raw_compositing_bounds); | 916 local_bounds = PixelSnappedIntRect(local_raw_compositing_bounds); |
| 910 | 917 |
| 911 compositing_bounds_relative_to_composited_ancestor = local_bounds; | 918 compositing_bounds_relative_to_composited_ancestor = local_bounds; |
| 912 compositing_bounds_relative_to_composited_ancestor.MoveBy( | 919 compositing_bounds_relative_to_composited_ancestor.MoveBy( |
| 913 snapped_offset_from_composited_ancestor); | 920 snapped_offset_from_composited_ancestor); |
| 914 } | 921 } |
| 915 | 922 |
| 916 void CompositedLayerMapping::UpdateSquashingLayerGeometry( | 923 void CompositedLayerMapping::UpdateSquashingLayerGeometry( |
| 917 const IntPoint& graphics_layer_parent_location, | 924 const IntPoint& graphics_layer_parent_location, |
| (...skipping 2710 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3628 } else if (graphics_layer == decoration_outline_layer_.get()) { | 3635 } else if (graphics_layer == decoration_outline_layer_.get()) { |
| 3629 name = "Decoration Layer"; | 3636 name = "Decoration Layer"; |
| 3630 } else { | 3637 } else { |
| 3631 NOTREACHED(); | 3638 NOTREACHED(); |
| 3632 } | 3639 } |
| 3633 | 3640 |
| 3634 return name; | 3641 return name; |
| 3635 } | 3642 } |
| 3636 | 3643 |
| 3637 } // namespace blink | 3644 } // namespace blink |
| OLD | NEW |