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

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

Issue 1405993008: compositor-worker: plumb element id and mutable properties (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed layout test (and logged bug) Created 5 years, 1 month 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 <utility> 7 #include <utility>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
11 #include "base/lazy_instance.h" 11 #include "base/lazy_instance.h"
12 #include "base/strings/string_util.h" 12 #include "base/strings/string_util.h"
13 #include "base/threading/thread_checker.h" 13 #include "base/threading/thread_checker.h"
14 #include "base/trace_event/trace_event_impl.h" 14 #include "base/trace_event/trace_event_impl.h"
15 #include "cc/animation/animation.h" 15 #include "cc/animation/animation.h"
16 #include "cc/animation/mutable_properties.h"
16 #include "cc/base/region.h" 17 #include "cc/base/region.h"
17 #include "cc/base/switches.h" 18 #include "cc/base/switches.h"
18 #include "cc/blink/web_animation_impl.h" 19 #include "cc/blink/web_animation_impl.h"
19 #include "cc/blink/web_blend_mode.h" 20 #include "cc/blink/web_blend_mode.h"
20 #include "cc/blink/web_filter_operations_impl.h" 21 #include "cc/blink/web_filter_operations_impl.h"
21 #include "cc/blink/web_to_cc_animation_delegate_adapter.h" 22 #include "cc/blink/web_to_cc_animation_delegate_adapter.h"
22 #include "cc/layers/layer.h" 23 #include "cc/layers/layer.h"
23 #include "cc/layers/layer_position_constraint.h" 24 #include "cc/layers/layer_position_constraint.h"
24 #include "cc/trees/layer_tree_host.h" 25 #include "cc/trees/layer_tree_host.h"
25 #include "third_party/WebKit/public/platform/WebFloatPoint.h" 26 #include "third_party/WebKit/public/platform/WebFloatPoint.h"
26 #include "third_party/WebKit/public/platform/WebFloatRect.h" 27 #include "third_party/WebKit/public/platform/WebFloatRect.h"
27 #include "third_party/WebKit/public/platform/WebGraphicsLayerDebugInfo.h" 28 #include "third_party/WebKit/public/platform/WebGraphicsLayerDebugInfo.h"
28 #include "third_party/WebKit/public/platform/WebLayerClient.h" 29 #include "third_party/WebKit/public/platform/WebLayerClient.h"
29 #include "third_party/WebKit/public/platform/WebLayerPositionConstraint.h" 30 #include "third_party/WebKit/public/platform/WebLayerPositionConstraint.h"
30 #include "third_party/WebKit/public/platform/WebLayerScrollClient.h" 31 #include "third_party/WebKit/public/platform/WebLayerScrollClient.h"
32 #include "third_party/WebKit/public/platform/WebMutableProperties.h"
31 #include "third_party/WebKit/public/platform/WebSize.h" 33 #include "third_party/WebKit/public/platform/WebSize.h"
32 #include "third_party/skia/include/utils/SkMatrix44.h" 34 #include "third_party/skia/include/utils/SkMatrix44.h"
33 #include "ui/gfx/geometry/rect_conversions.h" 35 #include "ui/gfx/geometry/rect_conversions.h"
34 #include "ui/gfx/geometry/vector2d_conversions.h" 36 #include "ui/gfx/geometry/vector2d_conversions.h"
35 37
36 using cc::Animation; 38 using cc::Animation;
37 using cc::Layer; 39 using cc::Layer;
38 using blink::WebLayer; 40 using blink::WebLayer;
39 using blink::WebFloatPoint; 41 using blink::WebFloatPoint;
40 using blink::WebVector; 42 using blink::WebVector;
(...skipping 444 matching lines...) Expand 10 before | Expand all | Expand 10 after
485 } 487 }
486 488
487 bool WebLayerImpl::isOrphan() const { 489 bool WebLayerImpl::isOrphan() const {
488 return !layer_->layer_tree_host(); 490 return !layer_->layer_tree_host();
489 } 491 }
490 492
491 void WebLayerImpl::setWebLayerClient(blink::WebLayerClient* client) { 493 void WebLayerImpl::setWebLayerClient(blink::WebLayerClient* client) {
492 web_layer_client_ = client; 494 web_layer_client_ = client;
493 } 495 }
494 496
497 void WebLayerImpl::setElementId(uint64_t id) {
498 layer_->SetElementId(id);
499 }
500
501 uint64_t WebLayerImpl::elementId() const {
502 return layer_->element_id();
503 }
504
505 void WebLayerImpl::setMutableProperties(uint32_t properties) {
506 uint32_t cc_properties = cc::kMutablePropertyNone;
507
508 if (properties & blink::WebMutablePropertyOpacity)
509 cc_properties |= cc::kMutablePropertyOpacity;
510 if (properties & blink::WebMutablePropertyScrollLeft)
511 cc_properties |= cc::kMutablePropertyScrollLeft;
512 if (properties & blink::WebMutablePropertyScrollTop)
513 cc_properties |= cc::kMutablePropertyScrollTop;
514 if (properties & blink::WebMutablePropertyTransform)
515 cc_properties |= cc::kMutablePropertyTransform;
516
517 layer_->SetMutableProperties(cc_properties);
518 }
519
520 uint32_t WebLayerImpl::mutableProperties() const {
521 return layer_->mutable_properties();
522 }
523
495 class TracedDebugInfo : public base::trace_event::ConvertableToTraceFormat { 524 class TracedDebugInfo : public base::trace_event::ConvertableToTraceFormat {
496 public: 525 public:
497 // This object takes ownership of the debug_info object. 526 // This object takes ownership of the debug_info object.
498 explicit TracedDebugInfo(blink::WebGraphicsLayerDebugInfo* debug_info) 527 explicit TracedDebugInfo(blink::WebGraphicsLayerDebugInfo* debug_info)
499 : debug_info_(debug_info) {} 528 : debug_info_(debug_info) {}
500 void AppendAsTraceFormat(std::string* out) const override { 529 void AppendAsTraceFormat(std::string* out) const override {
501 DCHECK(thread_checker_.CalledOnValidThread()); 530 DCHECK(thread_checker_.CalledOnValidThread());
502 blink::WebString web_string; 531 blink::WebString web_string;
503 debug_info_->appendAsTraceFormat(&web_string); 532 debug_info_->appendAsTraceFormat(&web_string);
504 out->append(web_string.utf8()); 533 out->append(web_string.utf8());
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
539 568
540 Layer* WebLayerImpl::layer() const { 569 Layer* WebLayerImpl::layer() const {
541 return layer_.get(); 570 return layer_.get();
542 } 571 }
543 572
544 void WebLayerImpl::SetContentsOpaqueIsFixed(bool fixed) { 573 void WebLayerImpl::SetContentsOpaqueIsFixed(bool fixed) {
545 contents_opaque_is_fixed_ = fixed; 574 contents_opaque_is_fixed_ = fixed;
546 } 575 }
547 576
548 } // namespace cc_blink 577 } // namespace cc_blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698