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

Side by Side Diff: ui/compositor/layer.cc

Issue 10407089: Revert 138212 - Implement High Contrast mode for Chrome OS. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 7 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 | Annotate | Revision Log
« no previous file with comments | « ui/compositor/layer.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "ui/compositor/layer.h" 5 #include "ui/compositor/layer.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/debug/trace_event.h" 10 #include "base/debug/trace_event.h"
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 namespace ui { 45 namespace ui {
46 46
47 Layer::Layer() 47 Layer::Layer()
48 : type_(LAYER_TEXTURED), 48 : type_(LAYER_TEXTURED),
49 compositor_(NULL), 49 compositor_(NULL),
50 parent_(NULL), 50 parent_(NULL),
51 visible_(true), 51 visible_(true),
52 fills_bounds_opaquely_(true), 52 fills_bounds_opaquely_(true),
53 layer_updated_externally_(false), 53 layer_updated_externally_(false),
54 opacity_(1.0f), 54 opacity_(1.0f),
55 inverted_(false),
56 delegate_(NULL), 55 delegate_(NULL),
57 scale_canvas_(true), 56 scale_canvas_(true),
58 device_scale_factor_(1.0f) { 57 device_scale_factor_(1.0f) {
59 CreateWebLayer(); 58 CreateWebLayer();
60 } 59 }
61 60
62 Layer::Layer(LayerType type) 61 Layer::Layer(LayerType type)
63 : type_(type), 62 : type_(type),
64 compositor_(NULL), 63 compositor_(NULL),
65 parent_(NULL), 64 parent_(NULL),
66 visible_(true), 65 visible_(true),
67 fills_bounds_opaquely_(true), 66 fills_bounds_opaquely_(true),
68 layer_updated_externally_(false), 67 layer_updated_externally_(false),
69 opacity_(1.0f), 68 opacity_(1.0f),
70 inverted_(false),
71 delegate_(NULL), 69 delegate_(NULL),
72 scale_canvas_(true), 70 scale_canvas_(true),
73 device_scale_factor_(1.0f) { 71 device_scale_factor_(1.0f) {
74 CreateWebLayer(); 72 CreateWebLayer();
75 } 73 }
76 74
77 Layer::~Layer() { 75 Layer::~Layer() {
78 // Destroying the animator may cause observers to use the layer (and 76 // Destroying the animator may cause observers to use the layer (and
79 // indirectly the WebLayer). Destroy the animator first so that the WebLayer 77 // indirectly the WebLayer). Destroy the animator first so that the WebLayer
80 // is still around. 78 // is still around.
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
189 } 187 }
190 188
191 bool Layer::GetMasksToBounds() const { 189 bool Layer::GetMasksToBounds() const {
192 return web_layer_.masksToBounds(); 190 return web_layer_.masksToBounds();
193 } 191 }
194 192
195 void Layer::SetOpacity(float opacity) { 193 void Layer::SetOpacity(float opacity) {
196 GetAnimator()->SetOpacity(opacity); 194 GetAnimator()->SetOpacity(opacity);
197 } 195 }
198 196
199 void Layer::SetBackgroundBlur(int blur_radius) { 197 void Layer::SetBackgroundBlur(int blur_radius)
198 {
200 WebKit::WebFilterOperations filters; 199 WebKit::WebFilterOperations filters;
201 if (blur_radius) { 200 if (blur_radius) {
202 #if WEBKIT_HAS_NEW_WEBFILTEROPERATION_API 201 #if WEBKIT_HAS_NEW_WEBFILTEROPERATION_API
203 filters.append(WebKit::WebFilterOperation::createBlurFilter(blur_radius)); 202 filters.append(WebKit::WebFilterOperation::createBlurFilter(blur_radius));
204 #else 203 #else
205 filters.append(WebKit::WebBlurFilterOperation(blur_radius)); 204 filters.append(WebKit::WebBlurFilterOperation(blur_radius));
206 #endif 205 #endif
207 } 206 }
208 web_layer_.setBackgroundFilters(filters); 207 web_layer_.setBackgroundFilters(filters);
209 208
210 background_blur_radius_ = blur_radius; 209 background_blur_radius_ = blur_radius;
211 } 210 }
212 211
213 void Layer::SetInverted(bool inverted) {
214 WebKit::WebFilterOperations filters;
215 if (inverted) {
216 filters.append(WebKit::WebBasicComponentTransferFilterOperation(
217 WebKit::WebBasicComponentTransferFilterOperation::
218 BasicComponentTransferFilterTypeInvert, 1.0));
219 }
220 web_layer_.setFilters(filters);
221
222 inverted_ = inverted;
223 }
224
225 float Layer::GetTargetOpacity() const { 212 float Layer::GetTargetOpacity() const {
226 if (animator_.get() && animator_->IsAnimatingProperty( 213 if (animator_.get() && animator_->IsAnimatingProperty(
227 LayerAnimationElement::OPACITY)) 214 LayerAnimationElement::OPACITY))
228 return animator_->GetTargetOpacity(); 215 return animator_->GetTargetOpacity();
229 return opacity_; 216 return opacity_;
230 } 217 }
231 218
232 void Layer::SetVisible(bool visible) { 219 void Layer::SetVisible(bool visible) {
233 GetAnimator()->SetVisibility(visible); 220 GetAnimator()->SetVisibility(visible);
234 } 221 }
(...skipping 395 matching lines...) Expand 10 before | Expand all | Expand 10 after
630 return; 617 return;
631 unsigned int color = 0xFF000000; 618 unsigned int color = 0xFF000000;
632 color |= web_layer_is_accelerated_ ? 0x0000FF00 : 0x00FF0000; 619 color |= web_layer_is_accelerated_ ? 0x0000FF00 : 0x00FF0000;
633 bool opaque = fills_bounds_opaquely_ && (GetCombinedOpacity() == 1.f); 620 bool opaque = fills_bounds_opaquely_ && (GetCombinedOpacity() == 1.f);
634 if (!opaque) 621 if (!opaque)
635 color |= 0xFF; 622 color |= 0xFF;
636 web_layer_.setDebugBorderColor(color); 623 web_layer_.setDebugBorderColor(color);
637 } 624 }
638 625
639 } // namespace ui 626 } // namespace ui
OLDNEW
« no previous file with comments | « ui/compositor/layer.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698