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

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

Issue 10201014: Implement High Contrast mode for Chrome OS (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Working implementation 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
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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 namespace ui { 43 namespace ui {
44 44
45 Layer::Layer() 45 Layer::Layer()
46 : type_(LAYER_TEXTURED), 46 : type_(LAYER_TEXTURED),
47 compositor_(NULL), 47 compositor_(NULL),
48 parent_(NULL), 48 parent_(NULL),
49 visible_(true), 49 visible_(true),
50 fills_bounds_opaquely_(true), 50 fills_bounds_opaquely_(true),
51 layer_updated_externally_(false), 51 layer_updated_externally_(false),
52 opacity_(1.0f), 52 opacity_(1.0f),
53 invert_(false),
53 delegate_(NULL) { 54 delegate_(NULL) {
54 CreateWebLayer(); 55 CreateWebLayer();
55 } 56 }
56 57
57 Layer::Layer(LayerType type) 58 Layer::Layer(LayerType type)
58 : type_(type), 59 : type_(type),
59 compositor_(NULL), 60 compositor_(NULL),
60 parent_(NULL), 61 parent_(NULL),
61 visible_(true), 62 visible_(true),
62 fills_bounds_opaquely_(true), 63 fills_bounds_opaquely_(true),
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
188 void Layer::SetBackgroundBlur(int blur_radius) 189 void Layer::SetBackgroundBlur(int blur_radius)
189 { 190 {
190 WebKit::WebFilterOperations filters; 191 WebKit::WebFilterOperations filters;
191 if (blur_radius) 192 if (blur_radius)
192 filters.append(WebKit::WebBlurFilterOperation(blur_radius)); 193 filters.append(WebKit::WebBlurFilterOperation(blur_radius));
193 web_layer_.setBackgroundFilters(filters); 194 web_layer_.setBackgroundFilters(filters);
194 195
195 background_blur_radius_ = blur_radius; 196 background_blur_radius_ = blur_radius;
196 } 197 }
197 198
199 void Layer::SetInvert(bool invert)
200 {
201 WebKit::WebFilterOperations filters;
202 if (invert) {
203 filters.append(WebKit::WebBasicComponentTransferFilterOperation(
204 WebKit::WebBasicComponentTransferFilterOperation::
205 BasicComponentTransferFilterTypeInvert, 1.0));
206 }
207 web_layer_.setFilters(filters);
208
209 invert_ = invert;
210 }
211
198 float Layer::GetTargetOpacity() const { 212 float Layer::GetTargetOpacity() const {
199 if (animator_.get() && animator_->IsAnimatingProperty( 213 if (animator_.get() && animator_->IsAnimatingProperty(
200 LayerAnimationElement::OPACITY)) 214 LayerAnimationElement::OPACITY))
201 return animator_->GetTargetOpacity(); 215 return animator_->GetTargetOpacity();
202 return opacity_; 216 return opacity_;
203 } 217 }
204 218
205 void Layer::SetVisible(bool visible) { 219 void Layer::SetVisible(bool visible) {
206 GetAnimator()->SetVisibility(visible); 220 GetAnimator()->SetVisibility(visible);
207 } 221 }
(...skipping 338 matching lines...) Expand 10 before | Expand all | Expand 10 after
546 return; 560 return;
547 unsigned int color = 0xFF000000; 561 unsigned int color = 0xFF000000;
548 color |= web_layer_is_accelerated_ ? 0x0000FF00 : 0x00FF0000; 562 color |= web_layer_is_accelerated_ ? 0x0000FF00 : 0x00FF0000;
549 bool opaque = fills_bounds_opaquely_ && (GetCombinedOpacity() == 1.f); 563 bool opaque = fills_bounds_opaquely_ && (GetCombinedOpacity() == 1.f);
550 if (!opaque) 564 if (!opaque)
551 color |= 0xFF; 565 color |= 0xFF;
552 web_layer_.setDebugBorderColor(color); 566 web_layer_.setDebugBorderColor(color);
553 } 567 }
554 568
555 } // namespace ui 569 } // namespace ui
OLDNEW
« ash/high_contrast/high_contrast_controller.h ('K') | « ui/compositor/layer.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698