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

Side by Side Diff: content/browser/renderer_host/render_widget_host_view_android.cc

Issue 2122023002: Cross-process frames should be notified of device scale factor changes. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add Mac DSF update. Created 4 years, 4 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 "content/browser/renderer_host/render_widget_host_view_android.h" 5 #include "content/browser/renderer_host/render_widget_host_view_android.h"
6 6
7 #include <android/bitmap.h> 7 #include <android/bitmap.h>
8 8
9 #include <utility> 9 #include <utility>
10 10
(...skipping 1430 matching lines...) Expand 10 before | Expand all | Expand 10 after
1441 if (view_.GetLayer()) 1441 if (view_.GetLayer())
1442 DestroyDelegatedContent(); 1442 DestroyDelegatedContent();
1443 } 1443 }
1444 1444
1445 bool RenderWidgetHostViewAndroid::HasAcceleratedSurface( 1445 bool RenderWidgetHostViewAndroid::HasAcceleratedSurface(
1446 const gfx::Size& desired_size) { 1446 const gfx::Size& desired_size) {
1447 NOTREACHED(); 1447 NOTREACHED();
1448 return false; 1448 return false;
1449 } 1449 }
1450 1450
1451 void RenderWidgetHostViewAndroid::GetScreenInfo(blink::WebScreenInfo* result) {
1452 // ScreenInfo isn't tied to the widget on Android. Always return the default.
1453 RenderWidgetHostViewBase::GetDefaultScreenInfo(result);
1454 }
1455
1456 // TODO(jrg): Find out the implications and answer correctly here, 1451 // TODO(jrg): Find out the implications and answer correctly here,
1457 // as we are returning the WebView and not root window bounds. 1452 // as we are returning the WebView and not root window bounds.
1458 gfx::Rect RenderWidgetHostViewAndroid::GetBoundsInRootWindow() { 1453 gfx::Rect RenderWidgetHostViewAndroid::GetBoundsInRootWindow() {
1459 return GetViewBounds(); 1454 return GetViewBounds();
1460 } 1455 }
1461 1456
1462 void RenderWidgetHostViewAndroid::ProcessAckedTouchEvent( 1457 void RenderWidgetHostViewAndroid::ProcessAckedTouchEvent(
1463 const TouchEventWithLatencyInfo& touch, InputEventAckState ack_result) { 1458 const TouchEventWithLatencyInfo& touch, InputEventAckState ack_result) {
1464 const bool event_consumed = ack_result == INPUT_EVENT_ACK_STATE_CONSUMED; 1459 const bool event_consumed = ack_result == INPUT_EVENT_ACK_STATE_CONSUMED;
1465 gesture_provider_.OnTouchEventAck(touch.event.uniqueTouchEventId, 1460 gesture_provider_.OnTouchEventAck(touch.event.uniqueTouchEventId,
(...skipping 475 matching lines...) Expand 10 before | Expand all | Expand 10 after
1941 float x, 1936 float x,
1942 float y) { 1937 float y) {
1943 // Treat the stylus tap as a long press, activating either a word selection or 1938 // Treat the stylus tap as a long press, activating either a word selection or
1944 // context menu depending on the targetted content. 1939 // context menu depending on the targetted content.
1945 blink::WebGestureEvent long_press = WebGestureEventBuilder::Build( 1940 blink::WebGestureEvent long_press = WebGestureEventBuilder::Build(
1946 blink::WebInputEvent::GestureLongPress, 1941 blink::WebInputEvent::GestureLongPress,
1947 (time - base::TimeTicks()).InSecondsF(), x, y); 1942 (time - base::TimeTicks()).InSecondsF(), x, y);
1948 SendGestureEvent(long_press); 1943 SendGestureEvent(long_press);
1949 } 1944 }
1950 1945
1951 // static
1952 void RenderWidgetHostViewBase::GetDefaultScreenInfo(
1953 blink::WebScreenInfo* results) {
1954 const display::Display& display =
1955 display::Screen::GetScreen()->GetPrimaryDisplay();
1956 results->rect = display.bounds();
1957 // TODO(husky): Remove any system controls from availableRect.
1958 results->availableRect = display.work_area();
1959 results->deviceScaleFactor = display.device_scale_factor();
1960 results->orientationAngle = display.RotationAsDegree();
1961 results->orientationType =
1962 RenderWidgetHostViewBase::GetOrientationTypeForMobile(display);
1963 gfx::DeviceDisplayInfo info;
1964 results->depth = display.color_depth();
1965 results->depthPerComponent = display.depth_per_component();
1966 results->isMonochrome = (results->depthPerComponent == 0);
1967 }
1968
1969 void RenderWidgetHostViewAndroid::ComputeEventLatencyOSTouchHistograms( 1946 void RenderWidgetHostViewAndroid::ComputeEventLatencyOSTouchHistograms(
1970 const ui::MotionEvent& event) { 1947 const ui::MotionEvent& event) {
1971 base::TimeTicks event_time = event.GetEventTime(); 1948 base::TimeTicks event_time = event.GetEventTime();
1972 base::TimeDelta delta = base::TimeTicks::Now() - event_time; 1949 base::TimeDelta delta = base::TimeTicks::Now() - event_time;
1973 switch (event.GetAction()) { 1950 switch (event.GetAction()) {
1974 case ui::MotionEvent::ACTION_DOWN: 1951 case ui::MotionEvent::ACTION_DOWN:
1975 case ui::MotionEvent::ACTION_POINTER_DOWN: 1952 case ui::MotionEvent::ACTION_POINTER_DOWN:
1976 UMA_HISTOGRAM_CUSTOM_COUNTS("Event.Latency.OS.TOUCH_PRESSED", 1953 UMA_HISTOGRAM_CUSTOM_COUNTS("Event.Latency.OS.TOUCH_PRESSED",
1977 delta.InMicroseconds(), 1, 1000000, 50); 1954 delta.InMicroseconds(), 1, 1000000, 50);
1978 return; 1955 return;
1979 case ui::MotionEvent::ACTION_MOVE: 1956 case ui::MotionEvent::ACTION_MOVE:
1980 UMA_HISTOGRAM_CUSTOM_COUNTS("Event.Latency.OS.TOUCH_MOVED", 1957 UMA_HISTOGRAM_CUSTOM_COUNTS("Event.Latency.OS.TOUCH_MOVED",
1981 delta.InMicroseconds(), 1, 1000000, 50); 1958 delta.InMicroseconds(), 1, 1000000, 50);
1982 return; 1959 return;
1983 case ui::MotionEvent::ACTION_UP: 1960 case ui::MotionEvent::ACTION_UP:
1984 case ui::MotionEvent::ACTION_POINTER_UP: 1961 case ui::MotionEvent::ACTION_POINTER_UP:
1985 UMA_HISTOGRAM_CUSTOM_COUNTS("Event.Latency.OS.TOUCH_RELEASED", 1962 UMA_HISTOGRAM_CUSTOM_COUNTS("Event.Latency.OS.TOUCH_RELEASED",
1986 delta.InMicroseconds(), 1, 1000000, 50); 1963 delta.InMicroseconds(), 1, 1000000, 50);
1987 default: 1964 default:
1988 return; 1965 return;
1989 } 1966 }
1990 } 1967 }
1991 1968
1992 } // namespace content 1969 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698