Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(123)

Side by Side Diff: third_party/WebKit/Source/core/layout/compositing/CompositedLayerMapping.cpp

Issue 2883083004: Only adjust composited pagination position to account for lines offset of inlines. (Closed)
Patch Set: none Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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 823 matching lines...) Expand 10 before | Expand all | Expand 10 after
877 offset.MoveBy(-local_representative_point_for_fragmentation); 878 offset.MoveBy(-local_representative_point_for_fragmentation);
878 return offset; 879 return offset;
879 } 880 }
880 881
881 void CompositedLayerMapping::ComputeBoundsOfOwningLayer( 882 void CompositedLayerMapping::ComputeBoundsOfOwningLayer(
882 const PaintLayer* composited_ancestor, 883 const PaintLayer* composited_ancestor,
883 IntRect& local_bounds, 884 IntRect& local_bounds,
884 IntRect& compositing_bounds_relative_to_composited_ancestor, 885 IntRect& compositing_bounds_relative_to_composited_ancestor,
885 LayoutPoint& offset_from_composited_ancestor, 886 LayoutPoint& offset_from_composited_ancestor,
886 IntPoint& snapped_offset_from_composited_ancestor) { 887 IntPoint& snapped_offset_from_composited_ancestor) {
887 LayoutRect local_raw_compositing_bounds = CompositedBounds(); 888 // HACK(chrishtr): adjust for position of inlines.
889 LayoutPoint local_representative_point_for_fragmentation;
890 if (owning_layer_.GetLayoutObject().IsLayoutInline()) {
891 local_representative_point_for_fragmentation =
892 ToLayoutInline(owning_layer_.GetLayoutObject())
893 .LinesVisualOverflowBoundingBox()
trchen 2017/05/16 23:26:47 LinesVisualOverflowBoundingBox can be expensive (h
chrishtr 2017/05/17 02:00:14 Done, good idea.
894 .Location();
895 }
888 offset_from_composited_ancestor = ComputeOffsetFromCompositedAncestor( 896 offset_from_composited_ancestor = ComputeOffsetFromCompositedAncestor(
889 &owning_layer_, composited_ancestor, 897 &owning_layer_, composited_ancestor,
890 local_raw_compositing_bounds.Location()); 898 local_representative_point_for_fragmentation);
891 snapped_offset_from_composited_ancestor = 899 snapped_offset_from_composited_ancestor =
892 IntPoint(offset_from_composited_ancestor.X().Round(), 900 IntPoint(offset_from_composited_ancestor.X().Round(),
893 offset_from_composited_ancestor.Y().Round()); 901 offset_from_composited_ancestor.Y().Round());
894 902
895 LayoutSize subpixel_accumulation; 903 LayoutSize subpixel_accumulation;
896 if (!owning_layer_.Transform() || 904 if (!owning_layer_.Transform() ||
897 owning_layer_.Transform()->IsIdentityOrTranslation()) { 905 owning_layer_.Transform()->IsIdentityOrTranslation()) {
898 subpixel_accumulation = offset_from_composited_ancestor - 906 subpixel_accumulation = offset_from_composited_ancestor -
899 snapped_offset_from_composited_ancestor; 907 snapped_offset_from_composited_ancestor;
900 } 908 }
901 // Otherwise discard the sub-pixel remainder because paint offset can't be 909 // Otherwise discard the sub-pixel remainder because paint offset can't be
902 // transformed by a non-translation transform. 910 // transformed by a non-translation transform.
903 owning_layer_.SetSubpixelAccumulation(subpixel_accumulation); 911 owning_layer_.SetSubpixelAccumulation(subpixel_accumulation);
904 912
905 // Move the bounds by the subpixel accumulation so that it pixel-snaps 913 // Move the bounds by the subpixel accumulation so that it pixel-snaps
906 // relative to absolute pixels instead of local coordinates. 914 // relative to absolute pixels instead of local coordinates.
915 LayoutRect local_raw_compositing_bounds = CompositedBounds();
907 local_raw_compositing_bounds.Move(subpixel_accumulation); 916 local_raw_compositing_bounds.Move(subpixel_accumulation);
908 local_bounds = PixelSnappedIntRect(local_raw_compositing_bounds); 917 local_bounds = PixelSnappedIntRect(local_raw_compositing_bounds);
909 918
910 compositing_bounds_relative_to_composited_ancestor = local_bounds; 919 compositing_bounds_relative_to_composited_ancestor = local_bounds;
911 compositing_bounds_relative_to_composited_ancestor.MoveBy( 920 compositing_bounds_relative_to_composited_ancestor.MoveBy(
912 snapped_offset_from_composited_ancestor); 921 snapped_offset_from_composited_ancestor);
913 } 922 }
914 923
915 void CompositedLayerMapping::UpdateSquashingLayerGeometry( 924 void CompositedLayerMapping::UpdateSquashingLayerGeometry(
916 const IntPoint& graphics_layer_parent_location, 925 const IntPoint& graphics_layer_parent_location,
(...skipping 2708 matching lines...) Expand 10 before | Expand all | Expand 10 after
3625 } else if (graphics_layer == decoration_outline_layer_.get()) { 3634 } else if (graphics_layer == decoration_outline_layer_.get()) {
3626 name = "Decoration Layer"; 3635 name = "Decoration Layer";
3627 } else { 3636 } else {
3628 NOTREACHED(); 3637 NOTREACHED();
3629 } 3638 }
3630 3639
3631 return name; 3640 return name;
3632 } 3641 }
3633 3642
3634 } // namespace blink 3643 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698