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

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

Issue 2911463002: Unify the calculation of main thread offset of sticky element (Closed)
Patch Set: Bug fix 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
« no previous file with comments | « cc/blink/web_layer_impl.h ('k') | cc/layers/layer.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 357 matching lines...) Expand 10 before | Expand all | Expand 10 after
368 blink::WebLayerStickyPositionConstraint web_constraint; 368 blink::WebLayerStickyPositionConstraint web_constraint;
369 web_constraint.is_sticky = constraint.is_sticky; 369 web_constraint.is_sticky = constraint.is_sticky;
370 web_constraint.is_anchored_left = constraint.is_anchored_left; 370 web_constraint.is_anchored_left = constraint.is_anchored_left;
371 web_constraint.is_anchored_right = constraint.is_anchored_right; 371 web_constraint.is_anchored_right = constraint.is_anchored_right;
372 web_constraint.is_anchored_top = constraint.is_anchored_top; 372 web_constraint.is_anchored_top = constraint.is_anchored_top;
373 web_constraint.is_anchored_bottom = constraint.is_anchored_bottom; 373 web_constraint.is_anchored_bottom = constraint.is_anchored_bottom;
374 web_constraint.left_offset = constraint.left_offset; 374 web_constraint.left_offset = constraint.left_offset;
375 web_constraint.right_offset = constraint.right_offset; 375 web_constraint.right_offset = constraint.right_offset;
376 web_constraint.top_offset = constraint.top_offset; 376 web_constraint.top_offset = constraint.top_offset;
377 web_constraint.bottom_offset = constraint.bottom_offset; 377 web_constraint.bottom_offset = constraint.bottom_offset;
378 web_constraint.parent_relative_sticky_box_offset =
379 constraint.parent_relative_sticky_box_offset;
380 web_constraint.scroll_container_relative_sticky_box_rect = 378 web_constraint.scroll_container_relative_sticky_box_rect =
381 constraint.scroll_container_relative_sticky_box_rect; 379 constraint.scroll_container_relative_sticky_box_rect;
382 web_constraint.scroll_container_relative_containing_block_rect = 380 web_constraint.scroll_container_relative_containing_block_rect =
383 constraint.scroll_container_relative_containing_block_rect; 381 constraint.scroll_container_relative_containing_block_rect;
384 web_constraint.nearest_layer_shifting_sticky_box = 382 web_constraint.nearest_layer_shifting_sticky_box =
385 constraint.nearest_layer_shifting_sticky_box; 383 constraint.nearest_layer_shifting_sticky_box;
386 web_constraint.nearest_layer_shifting_containing_block = 384 web_constraint.nearest_layer_shifting_containing_block =
387 constraint.nearest_layer_shifting_containing_block; 385 constraint.nearest_layer_shifting_containing_block;
388 return web_constraint; 386 return web_constraint;
389 } 387 }
390 static cc::LayerStickyPositionConstraint ToStickyPositionConstraint( 388 static cc::LayerStickyPositionConstraint ToStickyPositionConstraint(
391 const blink::WebLayerStickyPositionConstraint& web_constraint) { 389 const blink::WebLayerStickyPositionConstraint& web_constraint) {
392 cc::LayerStickyPositionConstraint constraint; 390 cc::LayerStickyPositionConstraint constraint;
393 constraint.is_sticky = web_constraint.is_sticky; 391 constraint.is_sticky = web_constraint.is_sticky;
394 constraint.is_anchored_left = web_constraint.is_anchored_left; 392 constraint.is_anchored_left = web_constraint.is_anchored_left;
395 constraint.is_anchored_right = web_constraint.is_anchored_right; 393 constraint.is_anchored_right = web_constraint.is_anchored_right;
396 constraint.is_anchored_top = web_constraint.is_anchored_top; 394 constraint.is_anchored_top = web_constraint.is_anchored_top;
397 constraint.is_anchored_bottom = web_constraint.is_anchored_bottom; 395 constraint.is_anchored_bottom = web_constraint.is_anchored_bottom;
398 constraint.left_offset = web_constraint.left_offset; 396 constraint.left_offset = web_constraint.left_offset;
399 constraint.right_offset = web_constraint.right_offset; 397 constraint.right_offset = web_constraint.right_offset;
400 constraint.top_offset = web_constraint.top_offset; 398 constraint.top_offset = web_constraint.top_offset;
401 constraint.bottom_offset = web_constraint.bottom_offset; 399 constraint.bottom_offset = web_constraint.bottom_offset;
402 constraint.parent_relative_sticky_box_offset =
403 web_constraint.parent_relative_sticky_box_offset;
404 constraint.scroll_container_relative_sticky_box_rect = 400 constraint.scroll_container_relative_sticky_box_rect =
405 web_constraint.scroll_container_relative_sticky_box_rect; 401 web_constraint.scroll_container_relative_sticky_box_rect;
406 constraint.scroll_container_relative_containing_block_rect = 402 constraint.scroll_container_relative_containing_block_rect =
407 web_constraint.scroll_container_relative_containing_block_rect; 403 web_constraint.scroll_container_relative_containing_block_rect;
408 constraint.nearest_layer_shifting_sticky_box = 404 constraint.nearest_layer_shifting_sticky_box =
409 web_constraint.nearest_layer_shifting_sticky_box; 405 web_constraint.nearest_layer_shifting_sticky_box;
410 constraint.nearest_layer_shifting_containing_block = 406 constraint.nearest_layer_shifting_containing_block =
411 web_constraint.nearest_layer_shifting_containing_block; 407 web_constraint.nearest_layer_shifting_containing_block;
412 return constraint; 408 return constraint;
413 } 409 }
414 void WebLayerImpl::SetStickyPositionConstraint( 410 void WebLayerImpl::SetStickyPositionConstraint(
415 const blink::WebLayerStickyPositionConstraint& constraint) { 411 const blink::WebLayerStickyPositionConstraint& constraint) {
416 layer_->SetStickyPositionConstraint(ToStickyPositionConstraint(constraint)); 412 layer_->SetStickyPositionConstraint(ToStickyPositionConstraint(constraint));
417 } 413 }
418 blink::WebLayerStickyPositionConstraint WebLayerImpl::StickyPositionConstraint() 414 blink::WebLayerStickyPositionConstraint WebLayerImpl::StickyPositionConstraint()
419 const { 415 const {
420 return ToWebLayerStickyPositionConstraint( 416 return ToWebLayerStickyPositionConstraint(
421 layer_->sticky_position_constraint()); 417 layer_->sticky_position_constraint());
422 } 418 }
423 419
420 void WebLayerImpl::SetOffsetForStickyPosition(const blink::WebSize& offset) {
421 layer_->SetOffsetForStickyPositionFromMainThread(offset);
422 }
423
424 blink::WebSize WebLayerImpl::OffsetForStickyPosition() const {
425 return layer_->offset_for_sticky_position_from_main_thread();
426 }
427
424 void WebLayerImpl::SetScrollClient(blink::WebLayerScrollClient* scroll_client) { 428 void WebLayerImpl::SetScrollClient(blink::WebLayerScrollClient* scroll_client) {
425 if (scroll_client) { 429 if (scroll_client) {
426 layer_->set_did_scroll_callback( 430 layer_->set_did_scroll_callback(
427 base::Bind(&blink::WebLayerScrollClient::DidScroll, 431 base::Bind(&blink::WebLayerScrollClient::DidScroll,
428 base::Unretained(scroll_client))); 432 base::Unretained(scroll_client)));
429 } else { 433 } else {
430 layer_->set_did_scroll_callback( 434 layer_->set_did_scroll_callback(
431 base::Callback<void(const gfx::ScrollOffset&)>()); 435 base::Callback<void(const gfx::ScrollOffset&)>());
432 } 436 }
433 } 437 }
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
484 488
485 void WebLayerImpl::SetHasWillChangeTransformHint(bool has_will_change) { 489 void WebLayerImpl::SetHasWillChangeTransformHint(bool has_will_change) {
486 layer_->SetHasWillChangeTransformHint(has_will_change); 490 layer_->SetHasWillChangeTransformHint(has_will_change);
487 } 491 }
488 492
489 void WebLayerImpl::ShowScrollbars() { 493 void WebLayerImpl::ShowScrollbars() {
490 layer_->ShowScrollbars(); 494 layer_->ShowScrollbars();
491 } 495 }
492 496
493 } // namespace cc_blink 497 } // namespace cc_blink
OLDNEW
« no previous file with comments | « cc/blink/web_layer_impl.h ('k') | cc/layers/layer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698