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

Side by Side Diff: cc/layer_tree_settings.cc

Issue 11552009: Add support for calculating the position of the top controls in the cc layer. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 7 years, 11 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
OLDNEW
1 // Copyright 2011 The Chromium Authors. All rights reserved. 1 // Copyright 2011 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/layer_tree_settings.h" 5 #include "cc/layer_tree_settings.h"
6 6
7 #include <limits> 7 #include <limits>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
11 #include "base/string_number_conversions.h" 11 #include "base/string_number_conversions.h"
12 #include "cc/switches.h" 12 #include "cc/switches.h"
13 13
14 namespace cc { 14 namespace cc {
15 15
16 LayerTreeSettings::LayerTreeSettings() 16 LayerTreeSettings::LayerTreeSettings()
17 : acceleratePainting(false) 17 : acceleratePainting(false)
18 , compositorFrameMessage(false) 18 , compositorFrameMessage(false)
19 , implSidePainting(false) 19 , implSidePainting(false)
20 , renderVSyncEnabled(true) 20 , renderVSyncEnabled(true)
21 , perTilePaintingEnabled(false) 21 , perTilePaintingEnabled(false)
22 , partialSwapEnabled(false) 22 , partialSwapEnabled(false)
23 , acceleratedAnimationEnabled(true) 23 , acceleratedAnimationEnabled(true)
24 , pageScalePinchZoomEnabled(false) 24 , pageScalePinchZoomEnabled(false)
25 , backgroundColorInsteadOfCheckerboard(false) 25 , backgroundColorInsteadOfCheckerboard(false)
26 , showOverdrawInTracing(false) 26 , showOverdrawInTracing(false)
27 , canUseLCDText(true) 27 , canUseLCDText(true)
28 , shouldClearRootRenderPass(true) 28 , shouldClearRootRenderPass(true)
29 , useLinearFadeScrollbarAnimator(false) 29 , useLinearFadeScrollbarAnimator(false)
30 , calculateTopControlsPosition(false)
30 , refreshRate(0) 31 , refreshRate(0)
31 , maxPartialTextureUpdates(std::numeric_limits<size_t>::max()) 32 , maxPartialTextureUpdates(std::numeric_limits<size_t>::max())
32 , numRasterThreads(1) 33 , numRasterThreads(1)
34 , topControlsHeightPx(0)
33 , defaultTileSize(gfx::Size(256, 256)) 35 , defaultTileSize(gfx::Size(256, 256))
34 , maxUntiledLayerSize(gfx::Size(512, 512)) 36 , maxUntiledLayerSize(gfx::Size(512, 512))
35 , minimumOcclusionTrackingSize(gfx::Size(160, 160)) 37 , minimumOcclusionTrackingSize(gfx::Size(160, 160))
36 { 38 {
37 // TODO(danakj): Move this to chromium when we don't go through the WebKit A PI anymore. 39 // TODO(danakj): Move this to chromium when we don't go through the WebKit A PI anymore.
38 compositorFrameMessage = CommandLine::ForCurrentProcess()->HasSwitch(cc::swi tches::kEnableCompositorFrameMessage); 40 compositorFrameMessage = CommandLine::ForCurrentProcess()->HasSwitch(cc::swi tches::kEnableCompositorFrameMessage);
39 implSidePainting = CommandLine::ForCurrentProcess()->HasSwitch(cc::switches: :kEnableImplSidePainting); 41 implSidePainting = CommandLine::ForCurrentProcess()->HasSwitch(cc::switches: :kEnableImplSidePainting);
40 partialSwapEnabled = CommandLine::ForCurrentProcess()->HasSwitch(switches::k EnablePartialSwap); 42 partialSwapEnabled = CommandLine::ForCurrentProcess()->HasSwitch(switches::k EnablePartialSwap);
41 backgroundColorInsteadOfCheckerboard = CommandLine::ForCurrentProcess()->Has Switch(switches::kBackgroundColorInsteadOfCheckerboard); 43 backgroundColorInsteadOfCheckerboard = CommandLine::ForCurrentProcess()->Has Switch(switches::kBackgroundColorInsteadOfCheckerboard);
42 showOverdrawInTracing = CommandLine::ForCurrentProcess()->HasSwitch(switches ::kTraceOverdraw); 44 showOverdrawInTracing = CommandLine::ForCurrentProcess()->HasSwitch(switches ::kTraceOverdraw);
43 45
46 calculateTopControlsPosition = CommandLine::ForCurrentProcess()->HasSwitch(s witches::kEnableTopControlsPositionCalculation);
jamesr 2013/01/08 02:26:48 I don't understand how this could work for both th
Ted C 2013/01/08 18:17:33 Hmm...so move this check to web_layer_tree_view_im
Ted C 2013/01/09 23:36:01 I just uploaded a patch where I moved it to web_la
47 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kTopControlsHeight )) {
48 std::string controls_height_str =
49 CommandLine::ForCurrentProcess()->GetSwitchValueASCII(switches::kTop ControlsHeight);
50 int controls_height;
51 if (base::StringToInt(controls_height_str, &controls_height) && controls _height > 0)
52 topControlsHeightPx = controls_height;
53 }
54 if (calculateTopControlsPosition && (topControlsHeightPx <= 0 || !compositor FrameMessage)) {
55 DCHECK(false) << "Top controls repositioning enabled without valid heigh t or compositorFrameMessage set.";
56 calculateTopControlsPosition = false;
57 }
58
44 // TODO(alokp): Remove this hard-coded setting. 59 // TODO(alokp): Remove this hard-coded setting.
45 // Platforms that need to disable LCD text must explicitly set this value. 60 // Platforms that need to disable LCD text must explicitly set this value.
46 #if defined(OS_ANDROID) 61 #if defined(OS_ANDROID)
47 canUseLCDText = false; 62 canUseLCDText = false;
48 #endif 63 #endif
49 64
50 #if defined(OS_ANDROID) 65 #if defined(OS_ANDROID)
51 // TODO(danakj): Move this out to the android code. 66 // TODO(danakj): Move this out to the android code.
52 maxPartialTextureUpdates = 0; 67 maxPartialTextureUpdates = 0;
53 #endif 68 #endif
(...skipping 25 matching lines...) Expand all
79 num_raster_threads; 94 num_raster_threads;
80 } 95 }
81 } 96 }
82 } 97 }
83 98
84 LayerTreeSettings::~LayerTreeSettings() 99 LayerTreeSettings::~LayerTreeSettings()
85 { 100 {
86 } 101 }
87 102
88 } // namespace cc 103 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698