OLD | NEW |
1 // Copyright 2010 The Chromium Authors. All rights reserved. | 1 // Copyright 2010 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/layers/layer.h" | 5 #include "cc/layers/layer.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/atomic_sequence_num.h" | 9 #include "base/atomic_sequence_num.h" |
10 #include "base/location.h" | 10 #include "base/location.h" |
(...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
280 return; | 280 return; |
281 | 281 |
282 layer_tree_host_->property_trees()->needs_rebuild = true; | 282 layer_tree_host_->property_trees()->needs_rebuild = true; |
283 } | 283 } |
284 | 284 |
285 void Layer::AddChild(scoped_refptr<Layer> child) { | 285 void Layer::AddChild(scoped_refptr<Layer> child) { |
286 InsertChild(child, children_.size()); | 286 InsertChild(child, children_.size()); |
287 } | 287 } |
288 | 288 |
289 void Layer::InsertChild(scoped_refptr<Layer> child, size_t index) { | 289 void Layer::InsertChild(scoped_refptr<Layer> child, size_t index) { |
290 DCHECK(IsPropertyChangeAllowed()); | 290 CHECK(IsPropertyChangeAllowed()); |
291 child->RemoveFromParent(); | 291 child->RemoveFromParent(); |
292 AddDrawableDescendants(child->NumDescendantsThatDrawContent() + | 292 AddDrawableDescendants(child->NumDescendantsThatDrawContent() + |
293 (child->DrawsContent() ? 1 : 0)); | 293 (child->DrawsContent() ? 1 : 0)); |
294 child->SetParent(this); | 294 child->SetParent(this); |
295 child->stacking_order_changed_ = true; | 295 child->stacking_order_changed_ = true; |
296 | 296 |
297 index = std::min(index, children_.size()); | 297 index = std::min(index, children_.size()); |
298 children_.insert(children_.begin() + index, child); | 298 children_.insert(children_.begin() + index, child); |
299 SetNeedsFullTreeSync(); | 299 SetNeedsFullTreeSync(); |
300 } | 300 } |
301 | 301 |
302 void Layer::RemoveFromParent() { | 302 void Layer::RemoveFromParent() { |
303 DCHECK(IsPropertyChangeAllowed()); | 303 CHECK(IsPropertyChangeAllowed()); |
304 if (parent_) | 304 if (parent_) |
305 parent_->RemoveChildOrDependent(this); | 305 parent_->RemoveChildOrDependent(this); |
306 } | 306 } |
307 | 307 |
308 void Layer::RemoveChildOrDependent(Layer* child) { | 308 void Layer::RemoveChildOrDependent(Layer* child) { |
309 if (mask_layer_.get() == child) { | 309 if (mask_layer_.get() == child) { |
310 mask_layer_->SetParent(nullptr); | 310 mask_layer_->SetParent(nullptr); |
311 mask_layer_ = nullptr; | 311 mask_layer_ = nullptr; |
312 SetNeedsFullTreeSync(); | 312 SetNeedsFullTreeSync(); |
313 return; | 313 return; |
(...skipping 16 matching lines...) Expand all Loading... |
330 (child->DrawsContent() ? 1 : 0)); | 330 (child->DrawsContent() ? 1 : 0)); |
331 children_.erase(iter); | 331 children_.erase(iter); |
332 SetNeedsFullTreeSync(); | 332 SetNeedsFullTreeSync(); |
333 return; | 333 return; |
334 } | 334 } |
335 } | 335 } |
336 | 336 |
337 void Layer::ReplaceChild(Layer* reference, scoped_refptr<Layer> new_layer) { | 337 void Layer::ReplaceChild(Layer* reference, scoped_refptr<Layer> new_layer) { |
338 DCHECK(reference); | 338 DCHECK(reference); |
339 DCHECK_EQ(reference->parent(), this); | 339 DCHECK_EQ(reference->parent(), this); |
340 DCHECK(IsPropertyChangeAllowed()); | 340 CHECK(IsPropertyChangeAllowed()); |
341 | 341 |
342 if (reference == new_layer.get()) | 342 if (reference == new_layer.get()) |
343 return; | 343 return; |
344 | 344 |
345 // Find the index of |reference| in |children_|. | 345 // Find the index of |reference| in |children_|. |
346 auto reference_it = | 346 auto reference_it = |
347 std::find_if(children_.begin(), children_.end(), | 347 std::find_if(children_.begin(), children_.end(), |
348 [reference](const scoped_refptr<Layer>& layer) { | 348 [reference](const scoped_refptr<Layer>& layer) { |
349 return layer.get() == reference; | 349 return layer.get() == reference; |
350 }); | 350 }); |
351 DCHECK(reference_it != children_.end()); | 351 DCHECK(reference_it != children_.end()); |
352 size_t reference_index = reference_it - children_.begin(); | 352 size_t reference_index = reference_it - children_.begin(); |
353 reference->RemoveFromParent(); | 353 reference->RemoveFromParent(); |
354 | 354 |
355 if (new_layer.get()) { | 355 if (new_layer.get()) { |
356 new_layer->RemoveFromParent(); | 356 new_layer->RemoveFromParent(); |
357 InsertChild(new_layer, reference_index); | 357 InsertChild(new_layer, reference_index); |
358 } | 358 } |
359 } | 359 } |
360 | 360 |
361 void Layer::SetBounds(const gfx::Size& size) { | 361 void Layer::SetBounds(const gfx::Size& size) { |
362 DCHECK(IsPropertyChangeAllowed()); | 362 CHECK(IsPropertyChangeAllowed()); |
363 if (bounds() == size) | 363 if (bounds() == size) |
364 return; | 364 return; |
365 bounds_ = size; | 365 bounds_ = size; |
366 | 366 |
367 if (!layer_tree_host_) | 367 if (!layer_tree_host_) |
368 return; | 368 return; |
369 | 369 |
370 if (ClipNode* clip_node = layer_tree_host_->property_trees()->clip_tree.Node( | 370 if (ClipNode* clip_node = layer_tree_host_->property_trees()->clip_tree.Node( |
371 clip_tree_index())) { | 371 clip_tree_index())) { |
372 if (clip_node->owner_id == id()) { | 372 if (clip_node->owner_id == id()) { |
373 clip_node->data.clip.set_size(gfx::SizeF(size)); | 373 clip_node->data.clip.set_size(gfx::SizeF(size)); |
374 layer_tree_host_->property_trees()->clip_tree.set_needs_update(true); | 374 layer_tree_host_->property_trees()->clip_tree.set_needs_update(true); |
375 } | 375 } |
376 } | 376 } |
377 | 377 |
378 SetNeedsCommitNoRebuild(); | 378 SetNeedsCommitNoRebuild(); |
379 } | 379 } |
380 | 380 |
381 Layer* Layer::RootLayer() { | 381 Layer* Layer::RootLayer() { |
382 Layer* layer = this; | 382 Layer* layer = this; |
383 while (layer->parent()) | 383 while (layer->parent()) |
384 layer = layer->parent(); | 384 layer = layer->parent(); |
385 return layer; | 385 return layer; |
386 } | 386 } |
387 | 387 |
388 void Layer::RemoveAllChildren() { | 388 void Layer::RemoveAllChildren() { |
389 DCHECK(IsPropertyChangeAllowed()); | 389 CHECK(IsPropertyChangeAllowed()); |
390 while (children_.size()) { | 390 while (children_.size()) { |
391 Layer* layer = children_[0].get(); | 391 Layer* layer = children_[0].get(); |
392 DCHECK_EQ(this, layer->parent()); | 392 DCHECK_EQ(this, layer->parent()); |
393 layer->RemoveFromParent(); | 393 layer->RemoveFromParent(); |
394 } | 394 } |
395 } | 395 } |
396 | 396 |
397 void Layer::SetChildren(const LayerList& children) { | 397 void Layer::SetChildren(const LayerList& children) { |
398 DCHECK(IsPropertyChangeAllowed()); | 398 CHECK(IsPropertyChangeAllowed()); |
399 if (children == children_) | 399 if (children == children_) |
400 return; | 400 return; |
401 | 401 |
402 RemoveAllChildren(); | 402 RemoveAllChildren(); |
403 for (size_t i = 0; i < children.size(); ++i) | 403 for (size_t i = 0; i < children.size(); ++i) |
404 AddChild(children[i]); | 404 AddChild(children[i]); |
405 } | 405 } |
406 | 406 |
407 bool Layer::HasAncestor(const Layer* ancestor) const { | 407 bool Layer::HasAncestor(const Layer* ancestor) const { |
408 for (const Layer* layer = parent(); layer; layer = layer->parent()) { | 408 for (const Layer* layer = parent(); layer; layer = layer->parent()) { |
409 if (layer == ancestor) | 409 if (layer == ancestor) |
410 return true; | 410 return true; |
411 } | 411 } |
412 return false; | 412 return false; |
413 } | 413 } |
414 | 414 |
415 void Layer::RequestCopyOfOutput( | 415 void Layer::RequestCopyOfOutput( |
416 scoped_ptr<CopyOutputRequest> request) { | 416 scoped_ptr<CopyOutputRequest> request) { |
417 DCHECK(IsPropertyChangeAllowed()); | 417 CHECK(IsPropertyChangeAllowed()); |
418 bool had_no_copy_requests = copy_requests_.empty(); | 418 bool had_no_copy_requests = copy_requests_.empty(); |
419 if (void* source = request->source()) { | 419 if (void* source = request->source()) { |
420 auto it = std::find_if(copy_requests_.begin(), copy_requests_.end(), | 420 auto it = std::find_if(copy_requests_.begin(), copy_requests_.end(), |
421 [source](const scoped_ptr<CopyOutputRequest>& x) { | 421 [source](const scoped_ptr<CopyOutputRequest>& x) { |
422 return x->source() == source; | 422 return x->source() == source; |
423 }); | 423 }); |
424 if (it != copy_requests_.end()) | 424 if (it != copy_requests_.end()) |
425 copy_requests_.erase(it); | 425 copy_requests_.erase(it); |
426 } | 426 } |
427 if (request->IsEmpty()) | 427 if (request->IsEmpty()) |
428 return; | 428 return; |
429 copy_requests_.push_back(std::move(request)); | 429 copy_requests_.push_back(std::move(request)); |
430 if (had_no_copy_requests) { | 430 if (had_no_copy_requests) { |
431 UpdateNumCopyRequestsForSubtree(1); | 431 UpdateNumCopyRequestsForSubtree(1); |
432 } | 432 } |
433 SetNeedsCommit(); | 433 SetNeedsCommit(); |
434 } | 434 } |
435 | 435 |
436 void Layer::UpdateNumCopyRequestsForSubtree(int delta) { | 436 void Layer::UpdateNumCopyRequestsForSubtree(int delta) { |
437 if (!delta) | 437 if (!delta) |
438 return; | 438 return; |
439 for (Layer* layer = this; layer; layer = layer->parent()) { | 439 for (Layer* layer = this; layer; layer = layer->parent()) { |
440 layer->num_layer_or_descendants_with_copy_request_ += delta; | 440 layer->num_layer_or_descendants_with_copy_request_ += delta; |
441 layer->SetNeedsPushProperties(); | 441 layer->SetNeedsPushProperties(); |
442 DCHECK_GE(layer->num_layer_or_descendants_with_copy_request_, 0); | 442 DCHECK_GE(layer->num_layer_or_descendants_with_copy_request_, 0); |
443 } | 443 } |
444 } | 444 } |
445 | 445 |
446 void Layer::SetBackgroundColor(SkColor background_color) { | 446 void Layer::SetBackgroundColor(SkColor background_color) { |
447 DCHECK(IsPropertyChangeAllowed()); | 447 CHECK(IsPropertyChangeAllowed()); |
448 if (background_color_ == background_color) | 448 if (background_color_ == background_color) |
449 return; | 449 return; |
450 background_color_ = background_color; | 450 background_color_ = background_color; |
451 SetNeedsCommit(); | 451 SetNeedsCommit(); |
452 } | 452 } |
453 | 453 |
454 SkColor Layer::SafeOpaqueBackgroundColor() const { | 454 SkColor Layer::SafeOpaqueBackgroundColor() const { |
455 SkColor color = background_color(); | 455 SkColor color = background_color(); |
456 if (SkColorGetA(color) == 255 && !contents_opaque()) { | 456 if (SkColorGetA(color) == 255 && !contents_opaque()) { |
457 color = SK_ColorTRANSPARENT; | 457 color = SK_ColorTRANSPARENT; |
458 } else if (SkColorGetA(color) != 255 && contents_opaque()) { | 458 } else if (SkColorGetA(color) != 255 && contents_opaque()) { |
459 for (const Layer* layer = parent(); layer; | 459 for (const Layer* layer = parent(); layer; |
460 layer = layer->parent()) { | 460 layer = layer->parent()) { |
461 color = layer->background_color(); | 461 color = layer->background_color(); |
462 if (SkColorGetA(color) == 255) | 462 if (SkColorGetA(color) == 255) |
463 break; | 463 break; |
464 } | 464 } |
465 if (SkColorGetA(color) != 255) | 465 if (SkColorGetA(color) != 255) |
466 color = layer_tree_host_->background_color(); | 466 color = layer_tree_host_->background_color(); |
467 if (SkColorGetA(color) != 255) | 467 if (SkColorGetA(color) != 255) |
468 color = SkColorSetA(color, 255); | 468 color = SkColorSetA(color, 255); |
469 } | 469 } |
470 return color; | 470 return color; |
471 } | 471 } |
472 | 472 |
473 void Layer::SetMasksToBounds(bool masks_to_bounds) { | 473 void Layer::SetMasksToBounds(bool masks_to_bounds) { |
474 DCHECK(IsPropertyChangeAllowed()); | 474 CHECK(IsPropertyChangeAllowed()); |
475 if (masks_to_bounds_ == masks_to_bounds) | 475 if (masks_to_bounds_ == masks_to_bounds) |
476 return; | 476 return; |
477 masks_to_bounds_ = masks_to_bounds; | 477 masks_to_bounds_ = masks_to_bounds; |
478 SetNeedsCommit(); | 478 SetNeedsCommit(); |
479 } | 479 } |
480 | 480 |
481 void Layer::SetMaskLayer(Layer* mask_layer) { | 481 void Layer::SetMaskLayer(Layer* mask_layer) { |
482 DCHECK(IsPropertyChangeAllowed()); | 482 CHECK(IsPropertyChangeAllowed()); |
483 if (mask_layer_.get() == mask_layer) | 483 if (mask_layer_.get() == mask_layer) |
484 return; | 484 return; |
485 if (mask_layer_.get()) { | 485 if (mask_layer_.get()) { |
486 DCHECK_EQ(this, mask_layer_->parent()); | 486 DCHECK_EQ(this, mask_layer_->parent()); |
487 mask_layer_->RemoveFromParent(); | 487 mask_layer_->RemoveFromParent(); |
488 } | 488 } |
489 mask_layer_ = mask_layer; | 489 mask_layer_ = mask_layer; |
490 if (mask_layer_.get()) { | 490 if (mask_layer_.get()) { |
491 DCHECK(!mask_layer_->parent()); | 491 DCHECK(!mask_layer_->parent()); |
492 mask_layer_->RemoveFromParent(); | 492 mask_layer_->RemoveFromParent(); |
493 mask_layer_->SetParent(this); | 493 mask_layer_->SetParent(this); |
494 mask_layer_->SetIsMask(true); | 494 mask_layer_->SetIsMask(true); |
495 } | 495 } |
496 SetNeedsFullTreeSync(); | 496 SetNeedsFullTreeSync(); |
497 } | 497 } |
498 | 498 |
499 void Layer::SetReplicaLayer(Layer* layer) { | 499 void Layer::SetReplicaLayer(Layer* layer) { |
500 DCHECK(IsPropertyChangeAllowed()); | 500 CHECK(IsPropertyChangeAllowed()); |
501 if (replica_layer_.get() == layer) | 501 if (replica_layer_.get() == layer) |
502 return; | 502 return; |
503 if (replica_layer_.get()) { | 503 if (replica_layer_.get()) { |
504 DCHECK_EQ(this, replica_layer_->parent()); | 504 DCHECK_EQ(this, replica_layer_->parent()); |
505 replica_layer_->RemoveFromParent(); | 505 replica_layer_->RemoveFromParent(); |
506 } | 506 } |
507 replica_layer_ = layer; | 507 replica_layer_ = layer; |
508 if (replica_layer_.get()) { | 508 if (replica_layer_.get()) { |
509 DCHECK(!replica_layer_->parent()); | 509 DCHECK(!replica_layer_->parent()); |
510 replica_layer_->RemoveFromParent(); | 510 replica_layer_->RemoveFromParent(); |
511 replica_layer_->SetParent(this); | 511 replica_layer_->SetParent(this); |
512 } | 512 } |
513 SetNeedsFullTreeSync(); | 513 SetNeedsFullTreeSync(); |
514 } | 514 } |
515 | 515 |
516 void Layer::SetFilters(const FilterOperations& filters) { | 516 void Layer::SetFilters(const FilterOperations& filters) { |
517 DCHECK(IsPropertyChangeAllowed()); | 517 CHECK(IsPropertyChangeAllowed()); |
518 if (filters_ == filters) | 518 if (filters_ == filters) |
519 return; | 519 return; |
520 filters_ = filters; | 520 filters_ = filters; |
521 SetNeedsCommit(); | 521 SetNeedsCommit(); |
522 } | 522 } |
523 | 523 |
524 bool Layer::FilterIsAnimating() const { | 524 bool Layer::FilterIsAnimating() const { |
525 DCHECK(layer_tree_host_); | 525 DCHECK(layer_tree_host_); |
526 return layer_animation_controller_ | 526 return layer_animation_controller_ |
527 ? layer_animation_controller_->IsCurrentlyAnimatingProperty( | 527 ? layer_animation_controller_->IsCurrentlyAnimatingProperty( |
528 Animation::FILTER, | 528 Animation::FILTER, |
529 LayerAnimationController::ObserverType::ACTIVE) | 529 LayerAnimationController::ObserverType::ACTIVE) |
530 : layer_tree_host_->IsAnimatingFilterProperty(this); | 530 : layer_tree_host_->IsAnimatingFilterProperty(this); |
531 } | 531 } |
532 | 532 |
533 bool Layer::HasPotentiallyRunningFilterAnimation() const { | 533 bool Layer::HasPotentiallyRunningFilterAnimation() const { |
534 if (layer_animation_controller_) { | 534 if (layer_animation_controller_) { |
535 return layer_animation_controller_->IsPotentiallyAnimatingProperty( | 535 return layer_animation_controller_->IsPotentiallyAnimatingProperty( |
536 Animation::FILTER, LayerAnimationController::ObserverType::ACTIVE); | 536 Animation::FILTER, LayerAnimationController::ObserverType::ACTIVE); |
537 } | 537 } |
538 return layer_tree_host_->HasPotentiallyRunningFilterAnimation(this); | 538 return layer_tree_host_->HasPotentiallyRunningFilterAnimation(this); |
539 } | 539 } |
540 | 540 |
541 void Layer::SetBackgroundFilters(const FilterOperations& filters) { | 541 void Layer::SetBackgroundFilters(const FilterOperations& filters) { |
542 DCHECK(IsPropertyChangeAllowed()); | 542 CHECK(IsPropertyChangeAllowed()); |
543 if (background_filters_ == filters) | 543 if (background_filters_ == filters) |
544 return; | 544 return; |
545 background_filters_ = filters; | 545 background_filters_ = filters; |
546 SetNeedsCommit(); | 546 SetNeedsCommit(); |
547 } | 547 } |
548 | 548 |
549 void Layer::SetOpacity(float opacity) { | 549 void Layer::SetOpacity(float opacity) { |
550 DCHECK(IsPropertyChangeAllowed()); | 550 CHECK(IsPropertyChangeAllowed()); |
551 if (opacity_ == opacity) | 551 if (opacity_ == opacity) |
552 return; | 552 return; |
553 opacity_ = opacity; | 553 opacity_ = opacity; |
554 SetNeedsCommit(); | 554 SetNeedsCommit(); |
555 } | 555 } |
556 | 556 |
557 bool Layer::OpacityIsAnimating() const { | 557 bool Layer::OpacityIsAnimating() const { |
558 DCHECK(layer_tree_host_); | 558 DCHECK(layer_tree_host_); |
559 return layer_animation_controller_ | 559 return layer_animation_controller_ |
560 ? layer_animation_controller_->IsCurrentlyAnimatingProperty( | 560 ? layer_animation_controller_->IsCurrentlyAnimatingProperty( |
561 Animation::OPACITY, | 561 Animation::OPACITY, |
562 LayerAnimationController::ObserverType::ACTIVE) | 562 LayerAnimationController::ObserverType::ACTIVE) |
563 : layer_tree_host_->IsAnimatingOpacityProperty(this); | 563 : layer_tree_host_->IsAnimatingOpacityProperty(this); |
564 } | 564 } |
565 | 565 |
566 bool Layer::HasPotentiallyRunningOpacityAnimation() const { | 566 bool Layer::HasPotentiallyRunningOpacityAnimation() const { |
567 if (layer_animation_controller_) { | 567 if (layer_animation_controller_) { |
568 return layer_animation_controller_->IsPotentiallyAnimatingProperty( | 568 return layer_animation_controller_->IsPotentiallyAnimatingProperty( |
569 Animation::OPACITY, LayerAnimationController::ObserverType::ACTIVE); | 569 Animation::OPACITY, LayerAnimationController::ObserverType::ACTIVE); |
570 } | 570 } |
571 return layer_tree_host_->HasPotentiallyRunningOpacityAnimation(this); | 571 return layer_tree_host_->HasPotentiallyRunningOpacityAnimation(this); |
572 } | 572 } |
573 | 573 |
574 bool Layer::OpacityCanAnimateOnImplThread() const { | 574 bool Layer::OpacityCanAnimateOnImplThread() const { |
575 return false; | 575 return false; |
576 } | 576 } |
577 | 577 |
578 void Layer::SetBlendMode(SkXfermode::Mode blend_mode) { | 578 void Layer::SetBlendMode(SkXfermode::Mode blend_mode) { |
579 DCHECK(IsPropertyChangeAllowed()); | 579 CHECK(IsPropertyChangeAllowed()); |
580 if (blend_mode_ == blend_mode) | 580 if (blend_mode_ == blend_mode) |
581 return; | 581 return; |
582 | 582 |
583 // Allowing only blend modes that are defined in the CSS Compositing standard: | 583 // Allowing only blend modes that are defined in the CSS Compositing standard: |
584 // http://dev.w3.org/fxtf/compositing-1/#blending | 584 // http://dev.w3.org/fxtf/compositing-1/#blending |
585 switch (blend_mode) { | 585 switch (blend_mode) { |
586 case SkXfermode::kSrcOver_Mode: | 586 case SkXfermode::kSrcOver_Mode: |
587 case SkXfermode::kScreen_Mode: | 587 case SkXfermode::kScreen_Mode: |
588 case SkXfermode::kOverlay_Mode: | 588 case SkXfermode::kOverlay_Mode: |
589 case SkXfermode::kDarken_Mode: | 589 case SkXfermode::kDarken_Mode: |
(...skipping 28 matching lines...) Expand all Loading... |
618 // http://dev.w3.org/fxtf/compositing-1/#porterduffcompositingoperators | 618 // http://dev.w3.org/fxtf/compositing-1/#porterduffcompositingoperators |
619 NOTREACHED(); | 619 NOTREACHED(); |
620 return; | 620 return; |
621 } | 621 } |
622 | 622 |
623 blend_mode_ = blend_mode; | 623 blend_mode_ = blend_mode; |
624 SetNeedsCommit(); | 624 SetNeedsCommit(); |
625 } | 625 } |
626 | 626 |
627 void Layer::SetIsRootForIsolatedGroup(bool root) { | 627 void Layer::SetIsRootForIsolatedGroup(bool root) { |
628 DCHECK(IsPropertyChangeAllowed()); | 628 CHECK(IsPropertyChangeAllowed()); |
629 if (is_root_for_isolated_group_ == root) | 629 if (is_root_for_isolated_group_ == root) |
630 return; | 630 return; |
631 is_root_for_isolated_group_ = root; | 631 is_root_for_isolated_group_ = root; |
632 SetNeedsCommit(); | 632 SetNeedsCommit(); |
633 } | 633 } |
634 | 634 |
635 void Layer::SetContentsOpaque(bool opaque) { | 635 void Layer::SetContentsOpaque(bool opaque) { |
636 DCHECK(IsPropertyChangeAllowed()); | 636 CHECK(IsPropertyChangeAllowed()); |
637 if (contents_opaque_ == opaque) | 637 if (contents_opaque_ == opaque) |
638 return; | 638 return; |
639 contents_opaque_ = opaque; | 639 contents_opaque_ = opaque; |
640 SetNeedsCommit(); | 640 SetNeedsCommit(); |
641 } | 641 } |
642 | 642 |
643 void Layer::SetPosition(const gfx::PointF& position) { | 643 void Layer::SetPosition(const gfx::PointF& position) { |
644 DCHECK(IsPropertyChangeAllowed()); | 644 CHECK(IsPropertyChangeAllowed()); |
645 if (position_ == position) | 645 if (position_ == position) |
646 return; | 646 return; |
647 position_ = position; | 647 position_ = position; |
648 | 648 |
649 if (!layer_tree_host_) | 649 if (!layer_tree_host_) |
650 return; | 650 return; |
651 | 651 |
652 if (TransformNode* transform_node = | 652 if (TransformNode* transform_node = |
653 layer_tree_host_->property_trees()->transform_tree.Node( | 653 layer_tree_host_->property_trees()->transform_tree.Node( |
654 transform_tree_index())) { | 654 transform_tree_index())) { |
(...skipping 27 matching lines...) Expand all Loading... |
682 } | 682 } |
683 | 683 |
684 gfx::Transform inverse(gfx::Transform::kSkipInitialization); | 684 gfx::Transform inverse(gfx::Transform::kSkipInitialization); |
685 *is_invertible = b.GetInverse(&inverse); | 685 *is_invertible = b.GetInverse(&inverse); |
686 | 686 |
687 inverse *= a; | 687 inverse *= a; |
688 return inverse.Preserves2dAxisAlignment(); | 688 return inverse.Preserves2dAxisAlignment(); |
689 } | 689 } |
690 | 690 |
691 void Layer::SetTransform(const gfx::Transform& transform) { | 691 void Layer::SetTransform(const gfx::Transform& transform) { |
692 DCHECK(IsPropertyChangeAllowed()); | 692 CHECK(IsPropertyChangeAllowed()); |
693 if (transform_ == transform) | 693 if (transform_ == transform) |
694 return; | 694 return; |
695 | 695 |
696 if (layer_tree_host_) { | 696 if (layer_tree_host_) { |
697 if (TransformNode* transform_node = | 697 if (TransformNode* transform_node = |
698 layer_tree_host_->property_trees()->transform_tree.Node( | 698 layer_tree_host_->property_trees()->transform_tree.Node( |
699 transform_tree_index())) { | 699 transform_tree_index())) { |
700 if (transform_node->owner_id == id()) { | 700 if (transform_node->owner_id == id()) { |
701 // We need to trigger a rebuild if we could have affected 2d axis | 701 // We need to trigger a rebuild if we could have affected 2d axis |
702 // alignment. We'll check to see if transform and transform_ are axis | 702 // alignment. We'll check to see if transform and transform_ are axis |
(...skipping 16 matching lines...) Expand all Loading... |
719 } | 719 } |
720 } | 720 } |
721 | 721 |
722 transform_ = transform; | 722 transform_ = transform; |
723 transform_is_invertible_ = transform.IsInvertible(); | 723 transform_is_invertible_ = transform.IsInvertible(); |
724 | 724 |
725 SetNeedsCommit(); | 725 SetNeedsCommit(); |
726 } | 726 } |
727 | 727 |
728 void Layer::SetTransformOrigin(const gfx::Point3F& transform_origin) { | 728 void Layer::SetTransformOrigin(const gfx::Point3F& transform_origin) { |
729 DCHECK(IsPropertyChangeAllowed()); | 729 CHECK(IsPropertyChangeAllowed()); |
730 if (transform_origin_ == transform_origin) | 730 if (transform_origin_ == transform_origin) |
731 return; | 731 return; |
732 transform_origin_ = transform_origin; | 732 transform_origin_ = transform_origin; |
733 | 733 |
734 if (!layer_tree_host_) | 734 if (!layer_tree_host_) |
735 return; | 735 return; |
736 | 736 |
737 if (TransformNode* transform_node = | 737 if (TransformNode* transform_node = |
738 layer_tree_host_->property_trees()->transform_tree.Node( | 738 layer_tree_host_->property_trees()->transform_tree.Node( |
739 transform_tree_index())) { | 739 transform_tree_index())) { |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
809 | 809 |
810 bool Layer::ScrollOffsetAnimationWasInterrupted() const { | 810 bool Layer::ScrollOffsetAnimationWasInterrupted() const { |
811 DCHECK(layer_tree_host_); | 811 DCHECK(layer_tree_host_); |
812 return layer_animation_controller_ | 812 return layer_animation_controller_ |
813 ? layer_animation_controller_ | 813 ? layer_animation_controller_ |
814 ->scroll_offset_animation_was_interrupted() | 814 ->scroll_offset_animation_was_interrupted() |
815 : layer_tree_host_->ScrollOffsetAnimationWasInterrupted(this); | 815 : layer_tree_host_->ScrollOffsetAnimationWasInterrupted(this); |
816 } | 816 } |
817 | 817 |
818 void Layer::SetScrollParent(Layer* parent) { | 818 void Layer::SetScrollParent(Layer* parent) { |
819 DCHECK(IsPropertyChangeAllowed()); | 819 CHECK(IsPropertyChangeAllowed()); |
820 if (scroll_parent_ == parent) | 820 if (scroll_parent_ == parent) |
821 return; | 821 return; |
822 | 822 |
823 if (scroll_parent_) | 823 if (scroll_parent_) |
824 scroll_parent_->RemoveScrollChild(this); | 824 scroll_parent_->RemoveScrollChild(this); |
825 | 825 |
826 scroll_parent_ = parent; | 826 scroll_parent_ = parent; |
827 | 827 |
828 if (scroll_parent_) | 828 if (scroll_parent_) |
829 scroll_parent_->AddScrollChild(this); | 829 scroll_parent_->AddScrollChild(this); |
830 | 830 |
831 SetNeedsCommit(); | 831 SetNeedsCommit(); |
832 } | 832 } |
833 | 833 |
834 void Layer::AddScrollChild(Layer* child) { | 834 void Layer::AddScrollChild(Layer* child) { |
835 if (!scroll_children_) | 835 if (!scroll_children_) |
836 scroll_children_.reset(new std::set<Layer*>); | 836 scroll_children_.reset(new std::set<Layer*>); |
837 scroll_children_->insert(child); | 837 scroll_children_->insert(child); |
838 SetNeedsCommit(); | 838 SetNeedsCommit(); |
839 } | 839 } |
840 | 840 |
841 void Layer::RemoveScrollChild(Layer* child) { | 841 void Layer::RemoveScrollChild(Layer* child) { |
842 scroll_children_->erase(child); | 842 scroll_children_->erase(child); |
843 if (scroll_children_->empty()) | 843 if (scroll_children_->empty()) |
844 scroll_children_ = nullptr; | 844 scroll_children_ = nullptr; |
845 SetNeedsCommit(); | 845 SetNeedsCommit(); |
846 } | 846 } |
847 | 847 |
848 void Layer::SetClipParent(Layer* ancestor) { | 848 void Layer::SetClipParent(Layer* ancestor) { |
849 DCHECK(IsPropertyChangeAllowed()); | 849 CHECK(IsPropertyChangeAllowed()); |
850 if (clip_parent_ == ancestor) | 850 if (clip_parent_ == ancestor) |
851 return; | 851 return; |
852 | 852 |
853 if (clip_parent_) | 853 if (clip_parent_) |
854 clip_parent_->RemoveClipChild(this); | 854 clip_parent_->RemoveClipChild(this); |
855 | 855 |
856 clip_parent_ = ancestor; | 856 clip_parent_ = ancestor; |
857 | 857 |
858 if (clip_parent_) | 858 if (clip_parent_) |
859 clip_parent_->AddClipChild(this); | 859 clip_parent_->AddClipChild(this); |
(...skipping 11 matching lines...) Expand all Loading... |
871 } | 871 } |
872 | 872 |
873 void Layer::RemoveClipChild(Layer* child) { | 873 void Layer::RemoveClipChild(Layer* child) { |
874 clip_children_->erase(child); | 874 clip_children_->erase(child); |
875 if (clip_children_->empty()) | 875 if (clip_children_->empty()) |
876 clip_children_ = nullptr; | 876 clip_children_ = nullptr; |
877 SetNeedsCommit(); | 877 SetNeedsCommit(); |
878 } | 878 } |
879 | 879 |
880 void Layer::SetScrollOffset(const gfx::ScrollOffset& scroll_offset) { | 880 void Layer::SetScrollOffset(const gfx::ScrollOffset& scroll_offset) { |
881 DCHECK(IsPropertyChangeAllowed()); | 881 CHECK(IsPropertyChangeAllowed()); |
882 | 882 |
883 if (scroll_offset_ == scroll_offset) | 883 if (scroll_offset_ == scroll_offset) |
884 return; | 884 return; |
885 scroll_offset_ = scroll_offset; | 885 scroll_offset_ = scroll_offset; |
886 | 886 |
887 if (!layer_tree_host_) | 887 if (!layer_tree_host_) |
888 return; | 888 return; |
889 | 889 |
890 if (TransformNode* transform_node = | 890 if (TransformNode* transform_node = |
891 layer_tree_host_->property_trees()->transform_tree.Node( | 891 layer_tree_host_->property_trees()->transform_tree.Node( |
(...skipping 17 matching lines...) Expand all Loading... |
909 scroll_compensation_adjustment_ = scroll_compensation_adjustment; | 909 scroll_compensation_adjustment_ = scroll_compensation_adjustment; |
910 SetNeedsCommit(); | 910 SetNeedsCommit(); |
911 } | 911 } |
912 | 912 |
913 gfx::Vector2dF Layer::ScrollCompensationAdjustment() const { | 913 gfx::Vector2dF Layer::ScrollCompensationAdjustment() const { |
914 return scroll_compensation_adjustment_; | 914 return scroll_compensation_adjustment_; |
915 } | 915 } |
916 | 916 |
917 void Layer::SetScrollOffsetFromImplSide( | 917 void Layer::SetScrollOffsetFromImplSide( |
918 const gfx::ScrollOffset& scroll_offset) { | 918 const gfx::ScrollOffset& scroll_offset) { |
919 DCHECK(IsPropertyChangeAllowed()); | 919 CHECK(IsPropertyChangeAllowed()); |
920 // This function only gets called during a BeginMainFrame, so there | 920 // This function only gets called during a BeginMainFrame, so there |
921 // is no need to call SetNeedsUpdate here. | 921 // is no need to call SetNeedsUpdate here. |
922 DCHECK(layer_tree_host_ && layer_tree_host_->CommitRequested()); | 922 DCHECK(layer_tree_host_ && layer_tree_host_->CommitRequested()); |
923 if (scroll_offset_ == scroll_offset) | 923 if (scroll_offset_ == scroll_offset) |
924 return; | 924 return; |
925 scroll_offset_ = scroll_offset; | 925 scroll_offset_ = scroll_offset; |
926 SetNeedsPushProperties(); | 926 SetNeedsPushProperties(); |
927 | 927 |
928 bool needs_rebuild = true; | 928 bool needs_rebuild = true; |
929 if (TransformNode* transform_node = | 929 if (TransformNode* transform_node = |
(...skipping 10 matching lines...) Expand all Loading... |
940 if (needs_rebuild) | 940 if (needs_rebuild) |
941 layer_tree_host_->property_trees()->needs_rebuild = true; | 941 layer_tree_host_->property_trees()->needs_rebuild = true; |
942 | 942 |
943 if (!did_scroll_callback_.is_null()) | 943 if (!did_scroll_callback_.is_null()) |
944 did_scroll_callback_.Run(); | 944 did_scroll_callback_.Run(); |
945 // The callback could potentially change the layer structure: | 945 // The callback could potentially change the layer structure: |
946 // "this" may have been destroyed during the process. | 946 // "this" may have been destroyed during the process. |
947 } | 947 } |
948 | 948 |
949 void Layer::SetScrollClipLayerId(int clip_layer_id) { | 949 void Layer::SetScrollClipLayerId(int clip_layer_id) { |
950 DCHECK(IsPropertyChangeAllowed()); | 950 CHECK(IsPropertyChangeAllowed()); |
951 if (scroll_clip_layer_id_ == clip_layer_id) | 951 if (scroll_clip_layer_id_ == clip_layer_id) |
952 return; | 952 return; |
953 scroll_clip_layer_id_ = clip_layer_id; | 953 scroll_clip_layer_id_ = clip_layer_id; |
954 SetNeedsCommit(); | 954 SetNeedsCommit(); |
955 } | 955 } |
956 | 956 |
957 void Layer::SetUserScrollable(bool horizontal, bool vertical) { | 957 void Layer::SetUserScrollable(bool horizontal, bool vertical) { |
958 DCHECK(IsPropertyChangeAllowed()); | 958 CHECK(IsPropertyChangeAllowed()); |
959 if (user_scrollable_horizontal_ == horizontal && | 959 if (user_scrollable_horizontal_ == horizontal && |
960 user_scrollable_vertical_ == vertical) | 960 user_scrollable_vertical_ == vertical) |
961 return; | 961 return; |
962 user_scrollable_horizontal_ = horizontal; | 962 user_scrollable_horizontal_ = horizontal; |
963 user_scrollable_vertical_ = vertical; | 963 user_scrollable_vertical_ = vertical; |
964 SetNeedsCommit(); | 964 SetNeedsCommit(); |
965 } | 965 } |
966 | 966 |
967 void Layer::SetShouldScrollOnMainThread(bool should_scroll_on_main_thread) { | 967 void Layer::SetShouldScrollOnMainThread(bool should_scroll_on_main_thread) { |
968 DCHECK(IsPropertyChangeAllowed()); | 968 CHECK(IsPropertyChangeAllowed()); |
969 if (should_scroll_on_main_thread_ == should_scroll_on_main_thread) | 969 if (should_scroll_on_main_thread_ == should_scroll_on_main_thread) |
970 return; | 970 return; |
971 should_scroll_on_main_thread_ = should_scroll_on_main_thread; | 971 should_scroll_on_main_thread_ = should_scroll_on_main_thread; |
972 SetNeedsCommit(); | 972 SetNeedsCommit(); |
973 } | 973 } |
974 | 974 |
975 void Layer::SetHaveWheelEventHandlers(bool have_wheel_event_handlers) { | 975 void Layer::SetHaveWheelEventHandlers(bool have_wheel_event_handlers) { |
976 DCHECK(IsPropertyChangeAllowed()); | 976 CHECK(IsPropertyChangeAllowed()); |
977 if (have_wheel_event_handlers_ == have_wheel_event_handlers) | 977 if (have_wheel_event_handlers_ == have_wheel_event_handlers) |
978 return; | 978 return; |
979 | 979 |
980 have_wheel_event_handlers_ = have_wheel_event_handlers; | 980 have_wheel_event_handlers_ = have_wheel_event_handlers; |
981 SetNeedsCommit(); | 981 SetNeedsCommit(); |
982 } | 982 } |
983 | 983 |
984 void Layer::SetHaveScrollEventHandlers(bool have_scroll_event_handlers) { | 984 void Layer::SetHaveScrollEventHandlers(bool have_scroll_event_handlers) { |
985 DCHECK(IsPropertyChangeAllowed()); | 985 CHECK(IsPropertyChangeAllowed()); |
986 if (have_scroll_event_handlers_ == have_scroll_event_handlers) | 986 if (have_scroll_event_handlers_ == have_scroll_event_handlers) |
987 return; | 987 return; |
988 have_scroll_event_handlers_ = have_scroll_event_handlers; | 988 have_scroll_event_handlers_ = have_scroll_event_handlers; |
989 SetNeedsCommit(); | 989 SetNeedsCommit(); |
990 } | 990 } |
991 | 991 |
992 void Layer::SetNonFastScrollableRegion(const Region& region) { | 992 void Layer::SetNonFastScrollableRegion(const Region& region) { |
993 DCHECK(IsPropertyChangeAllowed()); | 993 CHECK(IsPropertyChangeAllowed()); |
994 if (non_fast_scrollable_region_ == region) | 994 if (non_fast_scrollable_region_ == region) |
995 return; | 995 return; |
996 non_fast_scrollable_region_ = region; | 996 non_fast_scrollable_region_ = region; |
997 SetNeedsCommit(); | 997 SetNeedsCommit(); |
998 } | 998 } |
999 | 999 |
1000 void Layer::SetTouchEventHandlerRegion(const Region& region) { | 1000 void Layer::SetTouchEventHandlerRegion(const Region& region) { |
1001 DCHECK(IsPropertyChangeAllowed()); | 1001 CHECK(IsPropertyChangeAllowed()); |
1002 if (touch_event_handler_region_ == region) | 1002 if (touch_event_handler_region_ == region) |
1003 return; | 1003 return; |
1004 | 1004 |
1005 touch_event_handler_region_ = region; | 1005 touch_event_handler_region_ = region; |
1006 SetNeedsCommit(); | 1006 SetNeedsCommit(); |
1007 } | 1007 } |
1008 | 1008 |
1009 void Layer::SetScrollBlocksOn(ScrollBlocksOn scroll_blocks_on) { | 1009 void Layer::SetScrollBlocksOn(ScrollBlocksOn scroll_blocks_on) { |
1010 DCHECK(IsPropertyChangeAllowed()); | 1010 CHECK(IsPropertyChangeAllowed()); |
1011 if (scroll_blocks_on_ == scroll_blocks_on) | 1011 if (scroll_blocks_on_ == scroll_blocks_on) |
1012 return; | 1012 return; |
1013 scroll_blocks_on_ = scroll_blocks_on; | 1013 scroll_blocks_on_ = scroll_blocks_on; |
1014 SetNeedsCommit(); | 1014 SetNeedsCommit(); |
1015 } | 1015 } |
1016 | 1016 |
1017 void Layer::SetForceRenderSurface(bool force) { | 1017 void Layer::SetForceRenderSurface(bool force) { |
1018 DCHECK(IsPropertyChangeAllowed()); | 1018 CHECK(IsPropertyChangeAllowed()); |
1019 if (force_render_surface_ == force) | 1019 if (force_render_surface_ == force) |
1020 return; | 1020 return; |
1021 force_render_surface_ = force; | 1021 force_render_surface_ = force; |
1022 SetNeedsCommit(); | 1022 SetNeedsCommit(); |
1023 } | 1023 } |
1024 | 1024 |
1025 void Layer::SetDoubleSided(bool double_sided) { | 1025 void Layer::SetDoubleSided(bool double_sided) { |
1026 DCHECK(IsPropertyChangeAllowed()); | 1026 CHECK(IsPropertyChangeAllowed()); |
1027 if (double_sided_ == double_sided) | 1027 if (double_sided_ == double_sided) |
1028 return; | 1028 return; |
1029 double_sided_ = double_sided; | 1029 double_sided_ = double_sided; |
1030 SetNeedsCommit(); | 1030 SetNeedsCommit(); |
1031 } | 1031 } |
1032 | 1032 |
1033 void Layer::Set3dSortingContextId(int id) { | 1033 void Layer::Set3dSortingContextId(int id) { |
1034 DCHECK(IsPropertyChangeAllowed()); | 1034 CHECK(IsPropertyChangeAllowed()); |
1035 if (id == sorting_context_id_) | 1035 if (id == sorting_context_id_) |
1036 return; | 1036 return; |
1037 sorting_context_id_ = id; | 1037 sorting_context_id_ = id; |
1038 SetNeedsCommit(); | 1038 SetNeedsCommit(); |
1039 } | 1039 } |
1040 | 1040 |
1041 void Layer::SetTransformTreeIndex(int index) { | 1041 void Layer::SetTransformTreeIndex(int index) { |
1042 DCHECK(IsPropertyChangeAllowed()); | 1042 CHECK(IsPropertyChangeAllowed()); |
1043 if (transform_tree_index_ == index) | 1043 if (transform_tree_index_ == index) |
1044 return; | 1044 return; |
1045 transform_tree_index_ = index; | 1045 transform_tree_index_ = index; |
1046 SetNeedsPushProperties(); | 1046 SetNeedsPushProperties(); |
1047 } | 1047 } |
1048 | 1048 |
1049 int Layer::transform_tree_index() const { | 1049 int Layer::transform_tree_index() const { |
1050 if (!layer_tree_host_ || | 1050 if (!layer_tree_host_ || |
1051 layer_tree_host_->property_trees()->sequence_number != | 1051 layer_tree_host_->property_trees()->sequence_number != |
1052 property_tree_sequence_number_) { | 1052 property_tree_sequence_number_) { |
1053 return -1; | 1053 return -1; |
1054 } | 1054 } |
1055 return transform_tree_index_; | 1055 return transform_tree_index_; |
1056 } | 1056 } |
1057 | 1057 |
1058 void Layer::SetClipTreeIndex(int index) { | 1058 void Layer::SetClipTreeIndex(int index) { |
1059 DCHECK(IsPropertyChangeAllowed()); | 1059 CHECK(IsPropertyChangeAllowed()); |
1060 if (clip_tree_index_ == index) | 1060 if (clip_tree_index_ == index) |
1061 return; | 1061 return; |
1062 clip_tree_index_ = index; | 1062 clip_tree_index_ = index; |
1063 SetNeedsPushProperties(); | 1063 SetNeedsPushProperties(); |
1064 } | 1064 } |
1065 | 1065 |
1066 int Layer::clip_tree_index() const { | 1066 int Layer::clip_tree_index() const { |
1067 if (!layer_tree_host_ || | 1067 if (!layer_tree_host_ || |
1068 layer_tree_host_->property_trees()->sequence_number != | 1068 layer_tree_host_->property_trees()->sequence_number != |
1069 property_tree_sequence_number_) { | 1069 property_tree_sequence_number_) { |
1070 return -1; | 1070 return -1; |
1071 } | 1071 } |
1072 return clip_tree_index_; | 1072 return clip_tree_index_; |
1073 } | 1073 } |
1074 | 1074 |
1075 void Layer::SetEffectTreeIndex(int index) { | 1075 void Layer::SetEffectTreeIndex(int index) { |
1076 DCHECK(IsPropertyChangeAllowed()); | 1076 CHECK(IsPropertyChangeAllowed()); |
1077 if (effect_tree_index_ == index) | 1077 if (effect_tree_index_ == index) |
1078 return; | 1078 return; |
1079 effect_tree_index_ = index; | 1079 effect_tree_index_ = index; |
1080 SetNeedsPushProperties(); | 1080 SetNeedsPushProperties(); |
1081 } | 1081 } |
1082 | 1082 |
1083 int Layer::effect_tree_index() const { | 1083 int Layer::effect_tree_index() const { |
1084 if (!layer_tree_host_ || | 1084 if (!layer_tree_host_ || |
1085 layer_tree_host_->property_trees()->sequence_number != | 1085 layer_tree_host_->property_trees()->sequence_number != |
1086 property_tree_sequence_number_) { | 1086 property_tree_sequence_number_) { |
1087 return -1; | 1087 return -1; |
1088 } | 1088 } |
1089 return effect_tree_index_; | 1089 return effect_tree_index_; |
1090 } | 1090 } |
1091 | 1091 |
1092 void Layer::InvalidatePropertyTreesIndices() { | 1092 void Layer::InvalidatePropertyTreesIndices() { |
1093 int invalid_property_tree_index = -1; | 1093 int invalid_property_tree_index = -1; |
1094 SetTransformTreeIndex(invalid_property_tree_index); | 1094 SetTransformTreeIndex(invalid_property_tree_index); |
1095 SetClipTreeIndex(invalid_property_tree_index); | 1095 SetClipTreeIndex(invalid_property_tree_index); |
1096 SetEffectTreeIndex(invalid_property_tree_index); | 1096 SetEffectTreeIndex(invalid_property_tree_index); |
1097 } | 1097 } |
1098 | 1098 |
1099 void Layer::SetShouldFlattenTransform(bool should_flatten) { | 1099 void Layer::SetShouldFlattenTransform(bool should_flatten) { |
1100 DCHECK(IsPropertyChangeAllowed()); | 1100 CHECK(IsPropertyChangeAllowed()); |
1101 if (should_flatten_transform_ == should_flatten) | 1101 if (should_flatten_transform_ == should_flatten) |
1102 return; | 1102 return; |
1103 should_flatten_transform_ = should_flatten; | 1103 should_flatten_transform_ = should_flatten; |
1104 SetNeedsCommit(); | 1104 SetNeedsCommit(); |
1105 } | 1105 } |
1106 | 1106 |
1107 void Layer::SetIsDrawable(bool is_drawable) { | 1107 void Layer::SetIsDrawable(bool is_drawable) { |
1108 DCHECK(IsPropertyChangeAllowed()); | 1108 CHECK(IsPropertyChangeAllowed()); |
1109 if (is_drawable_ == is_drawable) | 1109 if (is_drawable_ == is_drawable) |
1110 return; | 1110 return; |
1111 | 1111 |
1112 is_drawable_ = is_drawable; | 1112 is_drawable_ = is_drawable; |
1113 UpdateDrawsContent(HasDrawableContent()); | 1113 UpdateDrawsContent(HasDrawableContent()); |
1114 } | 1114 } |
1115 | 1115 |
1116 void Layer::SetHideLayerAndSubtree(bool hide) { | 1116 void Layer::SetHideLayerAndSubtree(bool hide) { |
1117 DCHECK(IsPropertyChangeAllowed()); | 1117 CHECK(IsPropertyChangeAllowed()); |
1118 if (hide_layer_and_subtree_ == hide) | 1118 if (hide_layer_and_subtree_ == hide) |
1119 return; | 1119 return; |
1120 | 1120 |
1121 hide_layer_and_subtree_ = hide; | 1121 hide_layer_and_subtree_ = hide; |
1122 SetNeedsCommit(); | 1122 SetNeedsCommit(); |
1123 } | 1123 } |
1124 | 1124 |
1125 void Layer::SetNeedsDisplayRect(const gfx::Rect& dirty_rect) { | 1125 void Layer::SetNeedsDisplayRect(const gfx::Rect& dirty_rect) { |
1126 if (dirty_rect.IsEmpty()) | 1126 if (dirty_rect.IsEmpty()) |
1127 return; | 1127 return; |
(...skipping 21 matching lines...) Expand all Loading... |
1149 | 1149 |
1150 if (layer_tree_host_ && layer_tree_host_->CommitRequested()) | 1150 if (layer_tree_host_ && layer_tree_host_->CommitRequested()) |
1151 return; | 1151 return; |
1152 | 1152 |
1153 // Only request a commit if we have a fixed positioned descendant. | 1153 // Only request a commit if we have a fixed positioned descendant. |
1154 if (DescendantIsFixedToContainerLayer()) | 1154 if (DescendantIsFixedToContainerLayer()) |
1155 SetNeedsCommit(); | 1155 SetNeedsCommit(); |
1156 } | 1156 } |
1157 | 1157 |
1158 void Layer::SetPositionConstraint(const LayerPositionConstraint& constraint) { | 1158 void Layer::SetPositionConstraint(const LayerPositionConstraint& constraint) { |
1159 DCHECK(IsPropertyChangeAllowed()); | 1159 CHECK(IsPropertyChangeAllowed()); |
1160 if (position_constraint_ == constraint) | 1160 if (position_constraint_ == constraint) |
1161 return; | 1161 return; |
1162 position_constraint_ = constraint; | 1162 position_constraint_ = constraint; |
1163 SetNeedsCommit(); | 1163 SetNeedsCommit(); |
1164 } | 1164 } |
1165 | 1165 |
1166 static void RunCopyCallbackOnMainThread(scoped_ptr<CopyOutputRequest> request, | 1166 static void RunCopyCallbackOnMainThread(scoped_ptr<CopyOutputRequest> request, |
1167 scoped_ptr<CopyOutputResult> result) { | 1167 scoped_ptr<CopyOutputResult> result) { |
1168 request->SendResult(std::move(result)); | 1168 request->SendResult(std::move(result)); |
1169 } | 1169 } |
(...skipping 606 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1776 const std::vector<FrameTimingRequest>& requests) { | 1776 const std::vector<FrameTimingRequest>& requests) { |
1777 // TODO(vmpstr): Early out if there are no changes earlier in the call stack. | 1777 // TODO(vmpstr): Early out if there are no changes earlier in the call stack. |
1778 if (requests == frame_timing_requests_) | 1778 if (requests == frame_timing_requests_) |
1779 return; | 1779 return; |
1780 frame_timing_requests_ = requests; | 1780 frame_timing_requests_ = requests; |
1781 frame_timing_requests_dirty_ = true; | 1781 frame_timing_requests_dirty_ = true; |
1782 SetNeedsCommit(); | 1782 SetNeedsCommit(); |
1783 } | 1783 } |
1784 | 1784 |
1785 void Layer::SetElementId(uint64_t id) { | 1785 void Layer::SetElementId(uint64_t id) { |
1786 DCHECK(IsPropertyChangeAllowed()); | 1786 CHECK(IsPropertyChangeAllowed()); |
1787 if (element_id_ == id) | 1787 if (element_id_ == id) |
1788 return; | 1788 return; |
1789 TRACE_EVENT1(TRACE_DISABLED_BY_DEFAULT("compositor-worker"), | 1789 TRACE_EVENT1(TRACE_DISABLED_BY_DEFAULT("compositor-worker"), |
1790 "Layer::SetElementId", "id", id); | 1790 "Layer::SetElementId", "id", id); |
1791 element_id_ = id; | 1791 element_id_ = id; |
1792 SetNeedsCommit(); | 1792 SetNeedsCommit(); |
1793 } | 1793 } |
1794 | 1794 |
1795 void Layer::SetMutableProperties(uint32_t properties) { | 1795 void Layer::SetMutableProperties(uint32_t properties) { |
1796 DCHECK(IsPropertyChangeAllowed()); | 1796 CHECK(IsPropertyChangeAllowed()); |
1797 if (mutable_properties_ == properties) | 1797 if (mutable_properties_ == properties) |
1798 return; | 1798 return; |
1799 TRACE_EVENT1(TRACE_DISABLED_BY_DEFAULT("compositor-worker"), | 1799 TRACE_EVENT1(TRACE_DISABLED_BY_DEFAULT("compositor-worker"), |
1800 "Layer::SetMutableProperties", "properties", properties); | 1800 "Layer::SetMutableProperties", "properties", properties); |
1801 mutable_properties_ = properties; | 1801 mutable_properties_ = properties; |
1802 SetNeedsCommit(); | 1802 SetNeedsCommit(); |
1803 } | 1803 } |
1804 | 1804 |
1805 void Layer::DidBeginTracing() { | 1805 void Layer::DidBeginTracing() { |
1806 // We'll be dumping layer trees as part of trace, so make sure | 1806 // We'll be dumping layer trees as part of trace, so make sure |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1851 this, layer_tree_host_->property_trees()->transform_tree); | 1851 this, layer_tree_host_->property_trees()->transform_tree); |
1852 } | 1852 } |
1853 | 1853 |
1854 gfx::Transform Layer::screen_space_transform() const { | 1854 gfx::Transform Layer::screen_space_transform() const { |
1855 DCHECK_NE(transform_tree_index_, -1); | 1855 DCHECK_NE(transform_tree_index_, -1); |
1856 return ScreenSpaceTransformFromPropertyTrees( | 1856 return ScreenSpaceTransformFromPropertyTrees( |
1857 this, layer_tree_host_->property_trees()->transform_tree); | 1857 this, layer_tree_host_->property_trees()->transform_tree); |
1858 } | 1858 } |
1859 | 1859 |
1860 } // namespace cc | 1860 } // namespace cc |
OLD | NEW |