Remove CreationParams::mtChild.

From the previous CL, we can see that it is always the identity
matrix. In turn, remove multiplications by the matrix and simplify.

Change-Id: I9fb1b48285b118d01c0e77f1cac44d4da08355d5
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/79520
Commit-Queue: Tom Sepez <tsepez@chromium.org>
Reviewed-by: Lei Zhang <thestig@chromium.org>
diff --git a/fpdfsdk/pwl/cpwl_wnd.cpp b/fpdfsdk/pwl/cpwl_wnd.cpp
index c290073..0eb4e59 100644
--- a/fpdfsdk/pwl/cpwl_wnd.cpp
+++ b/fpdfsdk/pwl/cpwl_wnd.cpp
@@ -240,13 +240,7 @@
 void CPWL_Wnd::DrawChildAppearance(CFX_RenderDevice* pDevice,
                                    const CFX_Matrix& mtUser2Device) {
   for (const auto& pChild : m_Children) {
-    CFX_Matrix mt = pChild->GetChildMatrix();
-    if (mt.IsIdentity()) {
-      pChild->DrawAppearance(pDevice, mtUser2Device);
-      continue;
-    }
-    mt.Concat(mtUser2Device);
-    pChild->DrawAppearance(pDevice, mt);
+    pChild->DrawAppearance(pDevice, mtUser2Device);
   }
 }
 
@@ -286,28 +280,27 @@
 PWL_IMPLEMENT_KEY_METHOD(OnChar)
 #undef PWL_IMPLEMENT_KEY_METHOD
 
-#define PWL_IMPLEMENT_MOUSE_METHOD(mouse_method_name)                          \
-  bool CPWL_Wnd::mouse_method_name(uint32_t nFlag, const CFX_PointF& point) {  \
-    if (!IsValid() || !IsVisible())                                            \
-      return false;                                                            \
-    if (IsWndCaptureMouse(this)) {                                             \
-      for (const auto& pChild : m_Children) {                                  \
-        if (IsWndCaptureMouse(pChild.get())) {                                 \
-          return pChild->mouse_method_name(nFlag,                              \
-                                           pChild->ParentToChild(point));      \
-        }                                                                      \
-      }                                                                        \
-      SetCursor();                                                             \
-      return false;                                                            \
-    }                                                                          \
-    for (const auto& pChild : m_Children) {                                    \
-      if (pChild->WndHitTest(pChild->ParentToChild(point))) {                  \
-        return pChild->mouse_method_name(nFlag, pChild->ParentToChild(point)); \
-      }                                                                        \
-    }                                                                          \
-    if (WndHitTest(point))                                                     \
-      SetCursor();                                                             \
-    return false;                                                              \
+#define PWL_IMPLEMENT_MOUSE_METHOD(mouse_method_name)                         \
+  bool CPWL_Wnd::mouse_method_name(uint32_t nFlag, const CFX_PointF& point) { \
+    if (!IsValid() || !IsVisible())                                           \
+      return false;                                                           \
+    if (IsWndCaptureMouse(this)) {                                            \
+      for (const auto& pChild : m_Children) {                                 \
+        if (IsWndCaptureMouse(pChild.get())) {                                \
+          return pChild->mouse_method_name(nFlag, point);                     \
+        }                                                                     \
+      }                                                                       \
+      SetCursor();                                                            \
+      return false;                                                           \
+    }                                                                         \
+    for (const auto& pChild : m_Children) {                                   \
+      if (pChild->WndHitTest(point)) {                                        \
+        return pChild->mouse_method_name(nFlag, point);                       \
+      }                                                                       \
+    }                                                                         \
+    if (WndHitTest(point))                                                    \
+      SetCursor();                                                            \
+    return false;                                                             \
   }
 
 PWL_IMPLEMENT_MOUSE_METHOD(OnLButtonDblClk)
@@ -367,7 +360,7 @@
 
   for (const auto& pChild : m_Children) {
     if (IsWndCaptureKeyboard(pChild.get()))
-      return pChild->OnMouseWheel(nFlag, pChild->ParentToChild(point), delta);
+      return pChild->OnMouseWheel(nFlag, point, delta);
   }
   return false;
 }
@@ -688,7 +681,7 @@
 }
 
 CFX_Matrix CPWL_Wnd::GetWindowMatrix() const {
-  CFX_Matrix mt = GetChildToRoot();
+  CFX_Matrix mt;
   if (ProviderIface* pProvider = GetProvider())
     mt.Concat(pProvider->GetWindowMatrix(GetAttachedData()));
   return mt;
@@ -699,45 +692,6 @@
   return mt.TransformRect(rect);
 }
 
-CFX_PointF CPWL_Wnd::ParentToChild(const CFX_PointF& point) const {
-  CFX_Matrix mt = GetChildMatrix();
-  if (mt.IsIdentity())
-    return point;
-
-  CFX_Matrix inverse = mt.GetInverse();
-  if (!inverse.IsIdentity())
-    mt = inverse;
-  return mt.Transform(point);
-}
-
-CFX_FloatRect CPWL_Wnd::ParentToChild(const CFX_FloatRect& rect) const {
-  CFX_Matrix mt = GetChildMatrix();
-  if (mt.IsIdentity())
-    return rect;
-
-  CFX_Matrix inverse = mt.GetInverse();
-  if (!inverse.IsIdentity())
-    mt = inverse;
-
-  return mt.TransformRect(rect);
-}
-
-CFX_Matrix CPWL_Wnd::GetChildToRoot() const {
-  CFX_Matrix mt;
-  if (HasFlag(PWS_CHILD)) {
-    const CPWL_Wnd* pParent = this;
-    while (pParent) {
-      mt.Concat(pParent->GetChildMatrix());
-      pParent = pParent->GetParentWindow();
-    }
-  }
-  return mt;
-}
-
-CFX_Matrix CPWL_Wnd::GetChildMatrix() const {
-  return HasFlag(PWS_CHILD) ? m_CreationParams.mtChild : CFX_Matrix();
-}
-
 const CPWL_Wnd* CPWL_Wnd::GetFocused() const {
   CPWL_MsgControl* pMsgCtrl = GetMsgControl();
   return pMsgCtrl ? pMsgCtrl->GetFocusedWindow() : nullptr;
diff --git a/fpdfsdk/pwl/cpwl_wnd.h b/fpdfsdk/pwl/cpwl_wnd.h
index 5e12231..0029ab5 100644
--- a/fpdfsdk/pwl/cpwl_wnd.h
+++ b/fpdfsdk/pwl/cpwl_wnd.h
@@ -129,7 +129,6 @@
     // Ignore:
     CPWL_MsgControl* pMsgControl = nullptr;
     int32_t eCursorType = FXCT_ARROW;
-    CFX_Matrix mtChild;
   };
 
   static bool IsSHIFTKeyDown(uint32_t nFlag);
@@ -244,8 +243,6 @@
   int32_t GetTransparency();
   void SetTransparency(int32_t nTransparency);
 
-  CFX_Matrix GetChildToRoot() const;
-  CFX_Matrix GetChildMatrix() const;
   CFX_Matrix GetWindowMatrix() const;
 
   virtual void OnSetFocus();
@@ -291,9 +288,6 @@
   }
 
  private:
-  CFX_PointF ParentToChild(const CFX_PointF& point) const;
-  CFX_FloatRect ParentToChild(const CFX_FloatRect& rect) const;
-
   void DrawChildAppearance(CFX_RenderDevice* pDevice,
                            const CFX_Matrix& mtUser2Device);