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

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

Issue 2767213003: First Implementation of Snapped Points
Patch Set: Rebase and format Created 3 years, 6 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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 #include "core/layout/LayoutPart.h" 45 #include "core/layout/LayoutPart.h"
46 #include "core/layout/LayoutVideo.h" 46 #include "core/layout/LayoutVideo.h"
47 #include "core/layout/LayoutView.h" 47 #include "core/layout/LayoutView.h"
48 #include "core/layout/api/LayoutAPIShim.h" 48 #include "core/layout/api/LayoutAPIShim.h"
49 #include "core/layout/api/LayoutPartItem.h" 49 #include "core/layout/api/LayoutPartItem.h"
50 #include "core/layout/compositing/PaintLayerCompositor.h" 50 #include "core/layout/compositing/PaintLayerCompositor.h"
51 #include "core/loader/resource/ImageResourceContent.h" 51 #include "core/loader/resource/ImageResourceContent.h"
52 #include "core/page/ChromeClient.h" 52 #include "core/page/ChromeClient.h"
53 #include "core/page/Page.h" 53 #include "core/page/Page.h"
54 #include "core/page/scrolling/ScrollingCoordinator.h" 54 #include "core/page/scrolling/ScrollingCoordinator.h"
55 #include "core/page/scrolling/SnapCoordinator.h"
55 #include "core/page/scrolling/StickyPositionScrollingConstraints.h" 56 #include "core/page/scrolling/StickyPositionScrollingConstraints.h"
56 #include "core/page/scrolling/TopDocumentRootScrollerController.h" 57 #include "core/page/scrolling/TopDocumentRootScrollerController.h"
57 #include "core/paint/FramePaintTiming.h" 58 #include "core/paint/FramePaintTiming.h"
58 #include "core/paint/ObjectPaintInvalidator.h" 59 #include "core/paint/ObjectPaintInvalidator.h"
59 #include "core/paint/PaintInfo.h" 60 #include "core/paint/PaintInfo.h"
60 #include "core/paint/PaintLayerPainter.h" 61 #include "core/paint/PaintLayerPainter.h"
61 #include "core/paint/PaintLayerStackingNodeIterator.h" 62 #include "core/paint/PaintLayerStackingNodeIterator.h"
62 #include "core/paint/ScrollableAreaPainter.h" 63 #include "core/paint/ScrollableAreaPainter.h"
63 #include "core/paint/TransformRecorder.h" 64 #include "core/paint/TransformRecorder.h"
64 #include "core/plugins/PluginView.h" 65 #include "core/plugins/PluginView.h"
(...skipping 1091 matching lines...) Expand 10 before | Expand all | Expand 10 after
1156 UpdateElementIdAndCompositorMutableProperties(); 1157 UpdateElementIdAndCompositorMutableProperties();
1157 UpdateBackgroundPaintsOntoScrollingContentsLayer(); 1158 UpdateBackgroundPaintsOntoScrollingContentsLayer();
1158 UpdateContentsOpaque(); 1159 UpdateContentsOpaque();
1159 UpdateRasterizationPolicy(); 1160 UpdateRasterizationPolicy();
1160 UpdateAfterPartResize(); 1161 UpdateAfterPartResize();
1161 UpdateRenderingContext(); 1162 UpdateRenderingContext();
1162 UpdateShouldFlattenTransform(); 1163 UpdateShouldFlattenTransform();
1163 UpdateChildrenTransform(); 1164 UpdateChildrenTransform();
1164 UpdateScrollParent(ScrollParent()); 1165 UpdateScrollParent(ScrollParent());
1165 RegisterScrollingLayers(); 1166 RegisterScrollingLayers();
1167 UpdateSnapOffsets();
1166 1168
1167 UpdateCompositingReasons(); 1169 UpdateCompositingReasons();
1168 } 1170 }
1169 1171
1172 void CompositedLayerMapping::UpdateSnapOffsets() {
1173 SnapCoordinator* snapCoordinator =
1174 GetLayoutObject().GetDocument().GetSnapCoordinator();
1175 /*Vector<double> horizontal = snapCoordinator->SnapOffsets(
1176 *ToContainerNode(GetLayoutObject().GetNode()), kHorizontalScrollbar);
1177 Vector<double> vertical = snapCoordinator->SnapOffsets(
1178 *ToContainerNode(GetLayoutObject().GetNode()), kVerticalScrollbar);*/
1179 WebSnapPointList offsets = snapCoordinator->SnapOffsets(
1180 *ToContainerNode(GetLayoutObject().GetNode()));
1181 if (scrolling_contents_layer_)
1182 scrolling_contents_layer_->SetSnapOffsets(offsets);
1183 }
1184
1170 void CompositedLayerMapping::UpdateMainGraphicsLayerGeometry( 1185 void CompositedLayerMapping::UpdateMainGraphicsLayerGeometry(
1171 const IntRect& relative_compositing_bounds, 1186 const IntRect& relative_compositing_bounds,
1172 const IntRect& local_compositing_bounds, 1187 const IntRect& local_compositing_bounds,
1173 const IntPoint& graphics_layer_parent_location) { 1188 const IntPoint& graphics_layer_parent_location) {
1174 graphics_layer_->SetPosition(FloatPoint( 1189 graphics_layer_->SetPosition(FloatPoint(
1175 relative_compositing_bounds.Location() - graphics_layer_parent_location)); 1190 relative_compositing_bounds.Location() - graphics_layer_parent_location));
1176 graphics_layer_->SetOffsetFromLayoutObject( 1191 graphics_layer_->SetOffsetFromLayoutObject(
1177 ToIntSize(local_compositing_bounds.Location())); 1192 ToIntSize(local_compositing_bounds.Location()));
1178 1193
1179 FloatSize old_size = graphics_layer_->Size(); 1194 FloatSize old_size = graphics_layer_->Size();
(...skipping 587 matching lines...) Expand 10 before | Expand all | Expand 10 after
1767 if (video_element->IsFullscreen() && 1782 if (video_element->IsFullscreen() &&
1768 video_element->UsesOverlayFullscreenVideo()) 1783 video_element->UsesOverlayFullscreenVideo())
1769 in_overlay_fullscreen_video = true; 1784 in_overlay_fullscreen_video = true;
1770 } 1785 }
1771 bool has_painted_content = 1786 bool has_painted_content =
1772 in_overlay_fullscreen_video ? false : ContainsPaintedContent(); 1787 in_overlay_fullscreen_video ? false : ContainsPaintedContent();
1773 graphics_layer_->SetDrawsContent(has_painted_content); 1788 graphics_layer_->SetDrawsContent(has_painted_content);
1774 1789
1775 if (scrolling_layer_) { 1790 if (scrolling_layer_) {
1776 // m_scrollingLayer never has backing store. 1791 // m_scrollingLayer never has backing store.
1777 // m_scrollingContentsLayer only needs backing store if the scrolled 1792 // scrolling_contents_layer_ only needs backing store if the scrolled
1778 // contents need to paint. 1793 // contents need to paint.
1779 scrolling_contents_are_empty_ = 1794 scrolling_contents_are_empty_ =
1780 !owning_layer_.HasVisibleContent() || 1795 !owning_layer_.HasVisibleContent() ||
1781 !(GetLayoutObject().StyleRef().HasBackground() || 1796 !(GetLayoutObject().StyleRef().HasBackground() ||
1782 GetLayoutObject().HasBackdropFilter() || PaintsChildren()); 1797 GetLayoutObject().HasBackdropFilter() || PaintsChildren());
1783 scrolling_contents_layer_->SetDrawsContent(!scrolling_contents_are_empty_); 1798 scrolling_contents_layer_->SetDrawsContent(!scrolling_contents_are_empty_);
1784 } 1799 }
1785 1800
1786 draws_background_onto_content_layer_ = false; 1801 draws_background_onto_content_layer_ = false;
1787 1802
(...skipping 487 matching lines...) Expand 10 before | Expand all | Expand 10 after
2275 CompositorMutableProperty::kScrollTop) & 2290 CompositorMutableProperty::kScrollTop) &
2276 compositor_mutable_properties; 2291 compositor_mutable_properties;
2277 } else { 2292 } else {
2278 element_id = CompositorElementIdFromPaintLayerId( 2293 element_id = CompositorElementIdFromPaintLayerId(
2279 owning_layer_.UniqueId(), CompositorElementIdNamespace::kPrimary); 2294 owning_layer_.UniqueId(), CompositorElementIdNamespace::kPrimary);
2280 } 2295 }
2281 2296
2282 graphics_layer_->SetElementId(element_id); 2297 graphics_layer_->SetElementId(element_id);
2283 graphics_layer_->SetCompositorMutableProperties(primary_mutable_properties); 2298 graphics_layer_->SetCompositorMutableProperties(primary_mutable_properties);
2284 2299
2285 // We always set the elementId for m_scrollingContentsLayer since it can be 2300 // We always set the elementId for scrolling_contents_layer_ since it can be
2286 // animated for smooth scrolling, so we don't need to set it conditionally 2301 // animated for smooth scrolling, so we don't need to set it conditionally
2287 // here. 2302 // here.
2288 if (scrolling_contents_layer_.get()) 2303 if (scrolling_contents_layer_.get())
2289 scrolling_contents_layer_->SetCompositorMutableProperties( 2304 scrolling_contents_layer_->SetCompositorMutableProperties(
2290 scroll_mutable_properties); 2305 scroll_mutable_properties);
2291 } 2306 }
2292 2307
2293 bool CompositedLayerMapping::UpdateForegroundLayer( 2308 bool CompositedLayerMapping::UpdateForegroundLayer(
2294 bool needs_foreground_layer) { 2309 bool needs_foreground_layer) {
2295 bool layer_changed = false; 2310 bool layer_changed = false;
(...skipping 1367 matching lines...) Expand 10 before | Expand all | Expand 10 after
3663 } else if (graphics_layer == decoration_outline_layer_.get()) { 3678 } else if (graphics_layer == decoration_outline_layer_.get()) {
3664 name = "Decoration Layer"; 3679 name = "Decoration Layer";
3665 } else { 3680 } else {
3666 NOTREACHED(); 3681 NOTREACHED();
3667 } 3682 }
3668 3683
3669 return name; 3684 return name;
3670 } 3685 }
3671 3686
3672 } // namespace blink 3687 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698