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

Side by Side Diff: cc/blink/web_layer_impl.cc

Issue 2733633002: Handle nested position:sticky elements correctly (compositor) (Closed)
Patch Set: Addressed the easier reviewer comments. Created 3 years, 9 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 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "cc/blink/web_layer_impl.h" 5 #include "cc/blink/web_layer_impl.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <utility> 10 #include <utility>
(...skipping 360 matching lines...) Expand 10 before | Expand all | Expand 10 after
371 web_constraint.leftOffset = constraint.left_offset; 371 web_constraint.leftOffset = constraint.left_offset;
372 web_constraint.rightOffset = constraint.right_offset; 372 web_constraint.rightOffset = constraint.right_offset;
373 web_constraint.topOffset = constraint.top_offset; 373 web_constraint.topOffset = constraint.top_offset;
374 web_constraint.bottomOffset = constraint.bottom_offset; 374 web_constraint.bottomOffset = constraint.bottom_offset;
375 web_constraint.parentRelativeStickyBoxOffset = 375 web_constraint.parentRelativeStickyBoxOffset =
376 constraint.parent_relative_sticky_box_offset; 376 constraint.parent_relative_sticky_box_offset;
377 web_constraint.scrollContainerRelativeStickyBoxRect = 377 web_constraint.scrollContainerRelativeStickyBoxRect =
378 constraint.scroll_container_relative_sticky_box_rect; 378 constraint.scroll_container_relative_sticky_box_rect;
379 web_constraint.scrollContainerRelativeContainingBlockRect = 379 web_constraint.scrollContainerRelativeContainingBlockRect =
380 constraint.scroll_container_relative_containing_block_rect; 380 constraint.scroll_container_relative_containing_block_rect;
381 // TODO(smcgruer): Copy over ancestor pointers, or use layer ids.
382 web_constraint.localStickyOffset =
383 blink::WebFloatSize(constraint.local_sticky_offset);
381 return web_constraint; 384 return web_constraint;
382 } 385 }
383 static cc::LayerStickyPositionConstraint ToStickyPositionConstraint( 386 static cc::LayerStickyPositionConstraint ToStickyPositionConstraint(
384 const blink::WebLayerStickyPositionConstraint& web_constraint) { 387 const blink::WebLayerStickyPositionConstraint& web_constraint) {
385 cc::LayerStickyPositionConstraint constraint; 388 cc::LayerStickyPositionConstraint constraint;
386 constraint.is_sticky = web_constraint.isSticky; 389 constraint.is_sticky = web_constraint.isSticky;
387 constraint.is_anchored_left = web_constraint.isAnchoredLeft; 390 constraint.is_anchored_left = web_constraint.isAnchoredLeft;
388 constraint.is_anchored_right = web_constraint.isAnchoredRight; 391 constraint.is_anchored_right = web_constraint.isAnchoredRight;
389 constraint.is_anchored_top = web_constraint.isAnchoredTop; 392 constraint.is_anchored_top = web_constraint.isAnchoredTop;
390 constraint.is_anchored_bottom = web_constraint.isAnchoredBottom; 393 constraint.is_anchored_bottom = web_constraint.isAnchoredBottom;
391 constraint.left_offset = web_constraint.leftOffset; 394 constraint.left_offset = web_constraint.leftOffset;
392 constraint.right_offset = web_constraint.rightOffset; 395 constraint.right_offset = web_constraint.rightOffset;
393 constraint.top_offset = web_constraint.topOffset; 396 constraint.top_offset = web_constraint.topOffset;
394 constraint.bottom_offset = web_constraint.bottomOffset; 397 constraint.bottom_offset = web_constraint.bottomOffset;
395 constraint.parent_relative_sticky_box_offset = 398 constraint.parent_relative_sticky_box_offset =
396 web_constraint.parentRelativeStickyBoxOffset; 399 web_constraint.parentRelativeStickyBoxOffset;
397 constraint.scroll_container_relative_sticky_box_rect = 400 constraint.scroll_container_relative_sticky_box_rect =
398 web_constraint.scrollContainerRelativeStickyBoxRect; 401 web_constraint.scrollContainerRelativeStickyBoxRect;
399 constraint.scroll_container_relative_containing_block_rect = 402 constraint.scroll_container_relative_containing_block_rect =
400 web_constraint.scrollContainerRelativeContainingBlockRect; 403 web_constraint.scrollContainerRelativeContainingBlockRect;
404 constraint.nearest_layer_shifting_sticky_box =
405 web_constraint.nearestLayerShiftingStickyBox
406 ? web_constraint.nearestLayerShiftingStickyBox->ccLayer()
407 : nullptr;
408 constraint.nearest_layer_shifting_containing_block =
409 web_constraint.nearestLayerShiftingContainingBlock
410 ? web_constraint.nearestLayerShiftingContainingBlock->ccLayer()
411 : nullptr;
412 constraint.local_sticky_offset = web_constraint.localStickyOffset;
401 return constraint; 413 return constraint;
402 } 414 }
403 void WebLayerImpl::setStickyPositionConstraint( 415 void WebLayerImpl::setStickyPositionConstraint(
404 const blink::WebLayerStickyPositionConstraint& constraint) { 416 const blink::WebLayerStickyPositionConstraint& constraint) {
405 layer_->SetStickyPositionConstraint(ToStickyPositionConstraint(constraint)); 417 layer_->SetStickyPositionConstraint(ToStickyPositionConstraint(constraint));
406 } 418 }
407 blink::WebLayerStickyPositionConstraint WebLayerImpl::stickyPositionConstraint() 419 blink::WebLayerStickyPositionConstraint WebLayerImpl::stickyPositionConstraint()
408 const { 420 const {
409 return ToWebLayerStickyPositionConstraint( 421 return ToWebLayerStickyPositionConstraint(
410 layer_->sticky_position_constraint()); 422 layer_->sticky_position_constraint());
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
477 489
478 void WebLayerImpl::setPreferredRasterBounds(const WebSize& bounds) { 490 void WebLayerImpl::setPreferredRasterBounds(const WebSize& bounds) {
479 layer_->SetPreferredRasterBounds(bounds); 491 layer_->SetPreferredRasterBounds(bounds);
480 } 492 }
481 493
482 void WebLayerImpl::clearPreferredRasterBounds() { 494 void WebLayerImpl::clearPreferredRasterBounds() {
483 layer_->ClearPreferredRasterBounds(); 495 layer_->ClearPreferredRasterBounds();
484 } 496 }
485 497
486 } // namespace cc_blink 498 } // namespace cc_blink
OLDNEW
« no previous file with comments | « cc/BUILD.gn ('k') | cc/layers/layer.cc » ('j') | cc/trees/property_tree.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698