fix desktop mode in android

This commit is contained in:
Carmelo Messina
2022-12-21 15:25:06 +01:00
parent fd38a5ab78
commit 0062d6702b
+9 -13
View File
@@ -23,15 +23,15 @@ The feature is controlled by a feature flag (default enabled)
.../core/frame/screen_metrics_emulator.h | 14 ++++
.../core/frame/web_frame_widget_impl.cc | 8 ++
.../core/frame/web_remote_frame_impl.cc | 3 +-
.../blink/renderer/core/input/touch.cc | 17 +++-
third_party/blink/renderer/core/page/page.cc | 80 +++++++++++++++++++
.../blink/renderer/core/input/touch.cc | 17 ++++-
third_party/blink/renderer/core/page/page.cc | 76 +++++++++++++++++++
third_party/blink/renderer/core/page/page.h | 7 ++
20 files changed, 245 insertions(+), 17 deletions(-)
20 files changed, 241 insertions(+), 17 deletions(-)
diff --git a/chrome/browser/about_flags.cc b/chrome/browser/about_flags.cc
--- a/chrome/browser/about_flags.cc
+++ b/chrome/browser/about_flags.cc
@@ -7631,6 +7631,11 @@ const FeatureEntry kFeatureEntries[] = {
@@ -7627,6 +7627,11 @@ const FeatureEntry kFeatureEntries[] = {
"PaintPreviewShowOnStartup")},
#endif // BUILDFLAG(ENABLE_PAINT_PREVIEW) && BUILDFLAG(IS_ANDROID)
@@ -46,7 +46,7 @@ diff --git a/chrome/browser/about_flags.cc b/chrome/browser/about_flags.cc
diff --git a/chrome/browser/flag_descriptions.cc b/chrome/browser/flag_descriptions.cc
--- a/chrome/browser/flag_descriptions.cc
+++ b/chrome/browser/flag_descriptions.cc
@@ -6851,6 +6851,12 @@ const char kPaintPreviewStartupDescription[] =
@@ -6847,6 +6847,12 @@ const char kPaintPreviewStartupDescription[] =
"instead.";
#endif // ENABLE_PAINT_PREVIEW && BUILDFLAG(IS_ANDROID)
@@ -62,7 +62,7 @@ diff --git a/chrome/browser/flag_descriptions.cc b/chrome/browser/flag_descripti
diff --git a/chrome/browser/flag_descriptions.h b/chrome/browser/flag_descriptions.h
--- a/chrome/browser/flag_descriptions.h
+++ b/chrome/browser/flag_descriptions.h
@@ -3950,6 +3950,9 @@ extern const char kPaintPreviewStartupName[];
@@ -3948,6 +3948,9 @@ extern const char kPaintPreviewStartupName[];
extern const char kPaintPreviewStartupDescription[];
#endif // ENABLE_PAINT_PREVIEW && BUILDFLAG(IS_ANDROID)
@@ -75,7 +75,7 @@ diff --git a/chrome/browser/flag_descriptions.h b/chrome/browser/flag_descriptio
diff --git a/third_party/blink/common/features.cc b/third_party/blink/common/features.cc
--- a/third_party/blink/common/features.cc
+++ b/third_party/blink/common/features.cc
@@ -1638,6 +1638,10 @@ BASE_FEATURE(kDocumentEventNodePathCaching,
@@ -1637,6 +1637,10 @@ BASE_FEATURE(kDocumentEventNodePathCaching,
"DocumentEventNodePathCaching",
base::FEATURE_DISABLED_BY_DEFAULT);
@@ -89,7 +89,7 @@ diff --git a/third_party/blink/common/features.cc b/third_party/blink/common/fea
diff --git a/third_party/blink/public/common/features.h b/third_party/blink/public/common/features.h
--- a/third_party/blink/public/common/features.h
+++ b/third_party/blink/public/common/features.h
@@ -868,6 +868,9 @@ BLINK_COMMON_EXPORT BASE_DECLARE_FEATURE(kThreadedBodyLoader);
@@ -867,6 +867,9 @@ BLINK_COMMON_EXPORT BASE_DECLARE_FEATURE(kThreadedBodyLoader);
// If enabled, will cache for each node's EventPath::NodePath in document.
BLINK_COMMON_EXPORT BASE_DECLARE_FEATURE(kDocumentEventNodePathCaching);
@@ -531,7 +531,7 @@ diff --git a/third_party/blink/renderer/core/page/page.cc b/third_party/blink/re
namespace blink {
@@ -881,7 +885,83 @@ void Page::UpdateAcceleratedCompositingSettings() {
@@ -881,7 +885,79 @@ void Page::UpdateAcceleratedCompositingSettings() {
}
}
@@ -570,11 +570,7 @@ diff --git a/third_party/blink/renderer/core/page/page.cc b/third_party/blink/re
+ DeviceEmulationParams params;
+ // the screen size is changed to match the widget size with force_mobile_calc
+ params.force_mobile_calc = true;
+#if BUILDFLAG(IS_ANDROID)
+ params.screen_type = mojom::EmulatedScreenType::kMobile;
+#else
+ params.screen_type = mojom::EmulatedScreenType::kDesktop;
+#endif
+ // scale the widget size (and the screen size) by half_random scale factor
+ params.scale = 1 / (1.0 + half_random);
+