Merge autoland to mozilla-central. a=merge
authorMarian-Vasile Laza <mlaza@mozilla.com>
Mon, 15 Aug 2022 12:42:03 +0300
changeset 627130 dd1d7c05b99468938df303f771b87af8f56be301
parent 627120 b8708d0d28e8d8e75cad98af18f41e8675cc5ec6 (current diff)
parent 627129 643c507b9fedf7fde3ad5afd9fd748373bbecbf5 (diff)
child 627145 80153d14228c21c3dbae8e0ac4b16e2a825fd61d
push id40129
push usermlaza@mozilla.com
push dateMon, 15 Aug 2022 09:42:32 +0000
treeherdermozilla-central@dd1d7c05b994 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmerge
milestone105.0a1
first release with
nightly linux32
dd1d7c05b994 / 105.0a1 / 20220815094232 / files
nightly linux64
dd1d7c05b994 / 105.0a1 / 20220815094232 / files
nightly mac
dd1d7c05b994 / 105.0a1 / 20220815094232 / files
nightly win32
dd1d7c05b994 / 105.0a1 / 20220815094232 / files
nightly win64
dd1d7c05b994 / 105.0a1 / 20220815094232 / files
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
releases
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Merge autoland to mozilla-central. a=merge
toolkit/locales/en-US/chrome/global/commonDialog.dtd
toolkit/locales/en-US/chrome/global/dialogOverlay.dtd
--- a/devtools/client/debugger/test/mochitest/browser_dbg-event-breakpoints.js
+++ b/devtools/client/debugger/test/mochitest/browser_dbg-event-breakpoints.js
@@ -65,16 +65,79 @@ add_task(async function() {
   assertPausedAtSourceAndLine(dbg, eventBreakpointsSource.id, 43);
   await resume(dbg);
 
   // wait for focus-out event to fire
   await waitForPaused(dbg);
   assertPausedAtSourceAndLine(dbg, eventBreakpointsSource.id, 48);
   await resume(dbg);
 
+  info("Deselect focus events");
+  // We need to give the input focus to test composition, but we don't want the
+  // focus breakpoints to fire.
+  await toggleEventBreakpoint(dbg, "Control", "event.control.focusin");
+  await toggleEventBreakpoint(dbg, "Control", "event.control.focusout");
+
+  await toggleEventBreakpoint(
+    dbg,
+    "Keyboard",
+    "event.keyboard.compositionstart"
+  );
+  invokeOnElement("#focus-text", "focus");
+
+  info("Type some characters during composition");
+  invokeComposition();
+
+  await waitForPaused(dbg);
+  assertPausedAtSourceAndLine(dbg, eventBreakpointsSource.id, 53);
+  await resume(dbg);
+
+  info("Deselect compositionstart and select compositionupdate");
+  await toggleEventBreakpoint(
+    dbg,
+    "Keyboard",
+    "event.keyboard.compositionstart"
+  );
+  await toggleEventBreakpoint(
+    dbg,
+    "Keyboard",
+    "event.keyboard.compositionupdate"
+  );
+
+  invokeOnElement("#focus-text", "focus");
+
+  info("Type some characters during composition");
+  invokeComposition();
+
+  await waitForPaused(dbg);
+  assertPausedAtSourceAndLine(dbg, eventBreakpointsSource.id, 58);
+  await resume(dbg);
+
+  info("Deselect compositionupdate and select compositionend");
+  await toggleEventBreakpoint(
+    dbg,
+    "Keyboard",
+    "event.keyboard.compositionupdate"
+  );
+  await toggleEventBreakpoint(dbg, "Keyboard", "event.keyboard.compositionend");
+  invokeOnElement("#focus-text", "focus");
+
+  info("Type some characters during composition");
+  invokeComposition();
+
+  info("Commit the composition");
+  EventUtils.synthesizeComposition({
+    type: "compositioncommitasis",
+    key: { key: "KEY_Enter" },
+  });
+
+  await waitForPaused(dbg);
+  assertPausedAtSourceAndLine(dbg, eventBreakpointsSource.id, 63);
+  await resume(dbg);
+
   info("Check that the click event breakpoint is still enabled");
   invokeInTab("clickHandler");
   await waitForPaused(dbg);
   assertPausedAtSourceAndLine(dbg, eventBreakpointsSource.id, 12);
   await resume(dbg);
 
   info("Check that disabling an event breakpoint works");
   await toggleEventBreakpoint(dbg, "Mouse", "event.mouse.click");
@@ -167,8 +230,25 @@ async function invokeOnElement(selector,
   await SpecialPowers.spawn(
     gBrowser.selectedBrowser,
     [selector, action],
     (_selector, _action) => {
       content.document.querySelector(_selector)[_action]();
     }
   );
 }
+
+function invokeComposition() {
+  const string = "ex";
+  EventUtils.synthesizeCompositionChange({
+    composition: {
+      string,
+      clauses: [
+        {
+          length: string.length,
+          attr: Ci.nsITextInputProcessor.ATTR_RAW_CLAUSE,
+        },
+      ],
+    },
+    caret: { start: string.length, length: 0 },
+    key: { key: string[string.length - 1] },
+  });
+}
--- a/devtools/client/debugger/test/mochitest/examples/event-breakpoints.js
+++ b/devtools/client/debugger/test/mochitest/examples/event-breakpoints.js
@@ -11,17 +11,17 @@ document.getElementById("click-target").
 function clickTargetClicked() {
   console.log("clicked");
 }
 
 document.getElementById("xhr-button").onmousedown = xhrHandler;
 function xhrHandler() {
   var xhr = new XMLHttpRequest();
   xhr.open("GET", "doc-event-breakpoints.html", true);
-  xhr.onload = function() {
+  xhr.onload = function () {
     console.log("xhr load");
   };
   xhr.send();
 }
 
 document.getElementById("timer-button").onmousedown = timerHandler;
 function timerHandler() {
   setTimeout(() => {
@@ -42,8 +42,23 @@ document.getElementById("focus-text").ad
 function inputFocused() {
   console.log("focused");
 }
 
 document.getElementById("focus-text").addEventListener("focusout", inputFocusOut);
 function inputFocusOut() {
   console.log("focus lost");
 }
+
+document.getElementById("focus-text").addEventListener("compositionstart", inputCompositionStart);
+function inputCompositionStart() {
+  console.log("composition start");
+}
+
+document.getElementById("focus-text").addEventListener("compositionupdate", inputCompositionUpdate);
+function inputCompositionUpdate() {
+  console.log("composition update");
+}
+
+document.getElementById("focus-text").addEventListener("compositionend", inputCompositionEnd);
+function inputCompositionEnd() {
+  console.log("composition end");
+}
--- a/devtools/server/actors/utils/event-breakpoints.js
+++ b/devtools/server/actors/utils/event-breakpoints.js
@@ -175,16 +175,19 @@ const AVAILABLE_BREAKPOINTS = [
   {
     name: "Keyboard",
     items: [
       generalEvent("keyboard", "beforeinput"),
       generalEvent("keyboard", "input"),
       generalEvent("keyboard", "keydown"),
       generalEvent("keyboard", "keyup"),
       generalEvent("keyboard", "keypress"),
+      generalEvent("keyboard", "compositionstart"),
+      generalEvent("keyboard", "compositionupdate"),
+      generalEvent("keyboard", "compositionend"),
     ].filter(Boolean),
   },
   {
     name: "Load",
     items: [
       globalEvent("load", "load"),
       // TODO: Disabled pending fixes for bug 1569775.
       // globalEvent("load", "beforeunload"),
--- a/dom/ipc/BrowserChild.cpp
+++ b/dom/ipc/BrowserChild.cpp
@@ -3238,37 +3238,38 @@ void BrowserChild::NotifyJankedAnimation
 }
 
 mozilla::ipc::IPCResult BrowserChild::RecvUIResolutionChanged(
     const float& aDpi, const int32_t& aRounding, const double& aScale) {
   ScreenIntSize oldScreenSize = GetInnerSize();
   if (aDpi > 0) {
     mPuppetWidget->UpdateBackingScaleCache(aDpi, aRounding, aScale);
   }
-  nsCOMPtr<Document> document(GetTopLevelDocument());
-  RefPtr<nsPresContext> presContext =
-      document ? document->GetPresContext() : nullptr;
-  if (presContext) {
-    presContext->UIResolutionChangedSync();
-  }
 
   ScreenIntSize screenSize = GetInnerSize();
   if (mHasValidInnerSize && oldScreenSize != screenSize) {
     ScreenIntRect screenRect = GetOuterRect();
 
     // See RecvUpdateDimensions for the order of these operations.
     nsCOMPtr<nsIBaseWindow> baseWin = do_QueryInterface(WebNavigation());
     baseWin->SetPositionAndSize(0, 0, screenSize.width, screenSize.height,
                                 nsIBaseWindow::eRepaint);
 
     mPuppetWidget->Resize(screenRect.x + mClientOffset.x + mChromeOffset.x,
                           screenRect.y + mClientOffset.y + mChromeOffset.y,
                           screenSize.width, screenSize.height, true);
   }
 
+  nsCOMPtr<Document> document(GetTopLevelDocument());
+  RefPtr<nsPresContext> presContext =
+      document ? document->GetPresContext() : nullptr;
+  if (presContext) {
+    presContext->UIResolutionChangedSync();
+  }
+
   return IPC_OK();
 }
 
 mozilla::ipc::IPCResult BrowserChild::RecvSafeAreaInsetsChanged(
     const mozilla::ScreenIntMargin& aSafeAreaInsets) {
   mPuppetWidget->UpdateSafeAreaInsets(aSafeAreaInsets);
 
   nsCOMPtr<nsIScreenManager> screenMgr =
--- a/layout/base/nsDocumentViewer.cpp
+++ b/layout/base/nsDocumentViewer.cpp
@@ -1975,17 +1975,17 @@ nsDocumentViewer::SetBoundsWithFlags(con
     mWindow->Resize(aBounds.x, aBounds.y, aBounds.width, aBounds.height, false);
   } else if (mPresContext && mViewManager) {
     // Ensure presContext's deviceContext is up to date, as we sometimes get
     // here before a resolution-change notification has been fully handled
     // during display configuration changes, especially when there are lots
     // of windows/widgets competing to handle the notifications.
     // (See bug 1154125.)
     if (mPresContext->DeviceContext()->CheckDPIChange()) {
-      mPresContext->UIResolutionChanged();
+      mPresContext->UIResolutionChangedSync();
     }
 
     int32_t p2a = mPresContext->AppUnitsPerDevPixel();
     nscoord width = NSIntPixelsToAppUnits(mBounds.width, p2a);
     nscoord height = NSIntPixelsToAppUnits(mBounds.height, p2a);
     nsView* rootView = mViewManager->GetRootView();
     if (boundsChanged && rootView) {
       nsRect viewDims = rootView->GetDimensions();
--- a/layout/base/nsPresContext.cpp
+++ b/layout/base/nsPresContext.cpp
@@ -1750,18 +1750,22 @@ static void NotifyChildrenUIResolutionCh
 void nsPresContext::UIResolutionChangedInternal() {
   mPendingUIResolutionChanged = false;
 
   mDeviceContext->CheckDPIChange();
   if (mCurAppUnitsPerDevPixel != mDeviceContext->AppUnitsPerDevPixel()) {
     AppUnitsPerDevPixelChanged();
   }
 
-  if (GetPresShell()) {
-    GetPresShell()->RefreshZoomConstraintsForScreenSizeChange();
+  if (mPresShell) {
+    mPresShell->RefreshZoomConstraintsForScreenSizeChange();
+    if (RefPtr<MobileViewportManager> mvm =
+            mPresShell->GetMobileViewportManager()) {
+      mvm->UpdateSizesBeforeReflow();
+    }
   }
 
   // Recursively notify all remote leaf descendants of the change.
   if (nsPIDOMWindowOuter* window = mDocument->GetWindow()) {
     NotifyChildrenUIResolutionChanged(window);
   }
 
   auto recurse = [](dom::Document& aSubDoc) {
--- a/toolkit/xre/glxtest.cpp
+++ b/toolkit/xre/glxtest.cpp
@@ -99,23 +99,25 @@ typedef int EGLint;
 typedef void* EGLNativeDisplayType;
 typedef void* EGLSurface;
 typedef void* (*PFNEGLGETPROCADDRESS)(const char*);
 
 #define EGL_NO_CONTEXT nullptr
 #define EGL_NO_SURFACE nullptr
 #define EGL_FALSE 0
 #define EGL_TRUE 1
+#define EGL_OPENGL_ES2_BIT 0x0004
 #define EGL_BLUE_SIZE 0x3022
 #define EGL_GREEN_SIZE 0x3023
 #define EGL_RED_SIZE 0x3024
 #define EGL_NONE 0x3038
+#define EGL_RENDERABLE_TYPE 0x3040
 #define EGL_VENDOR 0x3053
 #define EGL_EXTENSIONS 0x3055
-#define EGL_CONTEXT_CLIENT_VERSION 0x3098
+#define EGL_CONTEXT_MAJOR_VERSION 0x3098
 #define EGL_OPENGL_ES_API 0x30A0
 #define EGL_OPENGL_API 0x30A2
 #define EGL_DEVICE_EXT 0x322C
 #define EGL_DRM_DEVICE_FILE_EXT 0x3233
 #define EGL_DRM_RENDER_NODE_FILE_EXT 0x3377
 
 // stuff from xf86drm.h
 #define DRM_NODE_RENDER 2
@@ -505,43 +507,58 @@ static bool get_gles_status(EGLDisplay d
     record_warning("libEGL missing methods for GL test");
     return false;
   }
 
   typedef GLubyte* (*PFNGLGETSTRING)(GLenum);
   PFNGLGETSTRING glGetString =
       cast<PFNGLGETSTRING>(eglGetProcAddress("glGetString"));
 
-  EGLint config_attrs[] = {EGL_RED_SIZE,  8, EGL_GREEN_SIZE, 8,
-                           EGL_BLUE_SIZE, 8, EGL_NONE};
+#if defined(__aarch64__)
+  bool useGles = true;
+#else
+  bool useGles = false;
+#endif
+
+  std::vector<EGLint> attribs;
+  attribs.push_back(EGL_RED_SIZE);
+  attribs.push_back(8);
+  attribs.push_back(EGL_GREEN_SIZE);
+  attribs.push_back(8);
+  attribs.push_back(EGL_BLUE_SIZE);
+  attribs.push_back(8);
+  if (useGles) {
+    attribs.push_back(EGL_RENDERABLE_TYPE);
+    attribs.push_back(EGL_OPENGL_ES2_BIT);
+  }
+  attribs.push_back(EGL_NONE);
 
   EGLConfig config;
   EGLint num_config;
-  if (eglChooseConfig(dpy, config_attrs, &config, 1, &num_config) ==
+  if (eglChooseConfig(dpy, attribs.data(), &config, 1, &num_config) ==
       EGL_FALSE) {
     record_warning("eglChooseConfig returned an error");
     return false;
   }
 
-#if defined(MOZ_AARCH64)
-  EGLenum api = EGL_OPENGL_ES_API;
-#else
-  EGLenum api = EGL_OPENGL_API;
-#endif
-
+  EGLenum api = useGles ? EGL_OPENGL_ES_API : EGL_OPENGL_API;
   if (eglBindAPI(api) == EGL_FALSE) {
     record_warning("eglBindAPI returned an error");
     return false;
   }
 
-  EGLint ctx_attrs[] = {EGL_CONTEXT_CLIENT_VERSION, 2, EGL_NONE};
+  EGLint ctx_attrs[] = {EGL_CONTEXT_MAJOR_VERSION, 3, EGL_NONE};
   EGLContext ectx = eglCreateContext(dpy, config, EGL_NO_CONTEXT, ctx_attrs);
   if (!ectx) {
-    record_warning("eglCreateContext returned an error");
-    return false;
+    EGLint ctx_attrs_fallback[] = {EGL_CONTEXT_MAJOR_VERSION, 2, EGL_NONE};
+    ectx = eglCreateContext(dpy, config, EGL_NO_CONTEXT, ctx_attrs_fallback);
+    if (!ectx) {
+      record_warning("eglCreateContext returned an error");
+      return false;
+    }
   }
 
   if (eglMakeCurrent(dpy, EGL_NO_SURFACE, EGL_NO_SURFACE, ectx) == EGL_FALSE) {
     record_warning("eglMakeCurrent returned an error");
     return false;
   }
 
   // Implementations disagree about whether eglGetProcAddress or dlsym