summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortedchoc@chromium.org <tedchoc@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-02-01 05:47:30 +0000
committertedchoc@chromium.org <tedchoc@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-02-01 05:47:30 +0000
commitc4ce488945d73a7d0ab4668e640421bb3a0367e9 (patch)
tree2296c1736933f5fd2a8f15874721ffb2b762d3ed
parentd2ca75c9c62bf41a3a10811d13df0f72062d98df (diff)
downloadchromium_src-c4ce488945d73a7d0ab4668e640421bb3a0367e9.zip
chromium_src-c4ce488945d73a7d0ab4668e640421bb3a0367e9.tar.gz
chromium_src-c4ce488945d73a7d0ab4668e640421bb3a0367e9.tar.bz2
Convert top controls to use DIP instead of PX.
Previously, scroll offset was based on screen pixels, but now is based on screen density independent pixels. This converts the top controls manager to deal in DIP instead of PX. BUG=161303 Review URL: https://chromiumcodereview.appspot.com/12095071 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@180089 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--cc/layer_tree_host_impl.cc2
-rw-r--r--cc/layer_tree_settings.cc2
-rw-r--r--cc/layer_tree_settings.h2
-rw-r--r--cc/switches.cc2
-rw-r--r--content/browser/renderer_host/compositor_impl_android.cc2
-rw-r--r--content/public/android/java/src/org/chromium/content/browser/ContentViewCore.java7
-rw-r--r--webkit/compositor_bindings/web_layer_tree_view_impl.cc8
7 files changed, 14 insertions, 11 deletions
diff --git a/cc/layer_tree_host_impl.cc b/cc/layer_tree_host_impl.cc
index c588a00..e846f1d 100644
--- a/cc/layer_tree_host_impl.cc
+++ b/cc/layer_tree_host_impl.cc
@@ -162,7 +162,7 @@ LayerTreeHostImpl::LayerTreeHostImpl(const LayerTreeSettings& settings, LayerTre
didVisibilityChange(this, m_visible);
if (settings.calculateTopControlsPosition)
- m_topControlsManager = TopControlsManager::Create(this, settings.topControlsHeightPx);
+ m_topControlsManager = TopControlsManager::Create(this, settings.topControlsHeight);
// LTHI always has an active tree.
m_activeTree = LayerTreeImpl::create(this);
diff --git a/cc/layer_tree_settings.cc b/cc/layer_tree_settings.cc
index 9cda4cb..601836b 100644
--- a/cc/layer_tree_settings.cc
+++ b/cc/layer_tree_settings.cc
@@ -31,10 +31,10 @@ LayerTreeSettings::LayerTreeSettings()
, calculateTopControlsPosition(false)
, minimumContentsScale(0.0625f)
, lowResContentsScaleFactor(0.125f)
+ , topControlsHeight(0.f)
, refreshRate(0)
, maxPartialTextureUpdates(std::numeric_limits<size_t>::max())
, numRasterThreads(1)
- , topControlsHeightPx(0)
, defaultTileSize(gfx::Size(256, 256))
, maxUntiledLayerSize(gfx::Size(512, 512))
, minimumOcclusionTrackingSize(gfx::Size(160, 160))
diff --git a/cc/layer_tree_settings.h b/cc/layer_tree_settings.h
index 28bcdaa..dc086fe 100644
--- a/cc/layer_tree_settings.h
+++ b/cc/layer_tree_settings.h
@@ -34,10 +34,10 @@ class CC_EXPORT LayerTreeSettings {
bool calculateTopControlsPosition;
float minimumContentsScale;
float lowResContentsScaleFactor;
+ float topControlsHeight;
double refreshRate;
size_t maxPartialTextureUpdates;
size_t numRasterThreads;
- int topControlsHeightPx;
gfx::Size defaultTileSize;
gfx::Size maxUntiledLayerSize;
gfx::Size minimumOcclusionTrackingSize;
diff --git a/cc/switches.cc b/cc/switches.cc
index 6cb24d7..c116d7e 100644
--- a/cc/switches.cc
+++ b/cc/switches.cc
@@ -30,7 +30,7 @@ const char kEnableRightAlignedScheduling[] = "enable-right-aligned-scheduling";
const char kEnableTopControlsPositionCalculation[] =
"enable-top-controls-position-calculation";
-// The height of the movable top controls in screen pixels.
+// The height of the movable top controls.
const char kTopControlsHeight[] = "top-controls-height";
// Number of worker threads used to rasterize content.
diff --git a/content/browser/renderer_host/compositor_impl_android.cc b/content/browser/renderer_host/compositor_impl_android.cc
index f48bb5a..f65a861 100644
--- a/content/browser/renderer_host/compositor_impl_android.cc
+++ b/content/browser/renderer_host/compositor_impl_android.cc
@@ -174,7 +174,7 @@ void CompositorImpl::SetVisible(bool visible) {
settings.refreshRate = 60.0;
settings.implSidePainting = false;
settings.calculateTopControlsPosition = false;
- settings.topControlsHeightPx = 0;
+ settings.topControlsHeight = 0.f;
// Do not clear the framebuffer when rendering into external GL contexts
// like Android View System's.
diff --git a/content/public/android/java/src/org/chromium/content/browser/ContentViewCore.java b/content/public/android/java/src/org/chromium/content/browser/ContentViewCore.java
index 375f248..299f1c6 100644
--- a/content/public/android/java/src/org/chromium/content/browser/ContentViewCore.java
+++ b/content/public/android/java/src/org/chromium/content/browser/ContentViewCore.java
@@ -1912,9 +1912,12 @@ public class ContentViewCore implements MotionEventDelegate, NavigationClient {
@SuppressWarnings("unused")
@CalledByNative
- private void updateOffsetsForFullscreen(float controlsOffsetY, float contentOffsetY) {
+ private void updateOffsetsForFullscreen(float controlsOffsetYDp, float contentOffsetYDp) {
if (mContentViewClient == null) return;
- mContentViewClient.onOffsetsForFullscreenChanged(controlsOffsetY, contentOffsetY);
+ float scale = getContext().getResources().getDisplayMetrics().density;
+ float controlsOffsetPx = controlsOffsetYDp * scale;
+ float contentOffsetYPx = contentOffsetYDp * scale;
+ mContentViewClient.onOffsetsForFullscreenChanged(controlsOffsetPx, contentOffsetYPx);
}
@SuppressWarnings("unused")
diff --git a/webkit/compositor_bindings/web_layer_tree_view_impl.cc b/webkit/compositor_bindings/web_layer_tree_view_impl.cc
index 4ff7b0d..2b4d835 100644
--- a/webkit/compositor_bindings/web_layer_tree_view_impl.cc
+++ b/webkit/compositor_bindings/web_layer_tree_view_impl.cc
@@ -58,11 +58,11 @@ bool WebLayerTreeViewImpl::initialize(const WebLayerTreeView::Settings& webSetti
if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kTopControlsHeight)) {
std::string controls_height_str =
CommandLine::ForCurrentProcess()->GetSwitchValueASCII(switches::kTopControlsHeight);
- int controls_height;
- if (base::StringToInt(controls_height_str, &controls_height) && controls_height > 0)
- settings.topControlsHeightPx = controls_height;
+ double controls_height;
+ if (base::StringToDouble(controls_height_str, &controls_height) && controls_height > 0)
+ settings.topControlsHeight = controls_height;
}
- if (settings.calculateTopControlsPosition && (settings.topControlsHeightPx <= 0 || !settings.compositorFrameMessage)) {
+ if (settings.calculateTopControlsPosition && (settings.topControlsHeight <= 0 || !settings.compositorFrameMessage)) {
DCHECK(false) << "Top controls repositioning enabled without valid height or compositorFrameMessage set.";
settings.calculateTopControlsPosition = false;
}