Title: [287868] trunk/Source/WebCore
Revision
287868
Author
[email protected]
Date
2022-01-10 21:04:15 -0800 (Mon, 10 Jan 2022)

Log Message

Fix Windows build after r287829
https://bugs.webkit.org/show_bug.cgi?id=235054

Reviewed by Sam Weinig.

FTW removal accidentally removed RECT handling in FloatRect while it is not a part of Direct2D.
This patch recovers it. And we also use IntRect in some places since it is proper one.

* PlatformWin.cmake:
* platform/graphics/FloatRect.h:
* platform/graphics/win/FloatRectWin.cpp: Copied from Source/WebCore/platform/graphics/win/IntRectWin.cpp.
(WebCore::FloatRect::FloatRect):
* platform/graphics/win/IntRectWin.cpp:
(WebCore::IntRect::IntRect):
(WebCore::IntRect::operator RECT const):
* platform/win/PopupMenuWin.cpp:
(WebCore::monitorFromHwnd):
(WebCore::PopupMenuWin::calculatePositionAndSize):

Modified Paths

Added Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (287867 => 287868)


--- trunk/Source/WebCore/ChangeLog	2022-01-11 03:21:20 UTC (rev 287867)
+++ trunk/Source/WebCore/ChangeLog	2022-01-11 05:04:15 UTC (rev 287868)
@@ -1,3 +1,24 @@
+2022-01-10  Yusuke Suzuki  <[email protected]>
+
+        Fix Windows build after r287829
+        https://bugs.webkit.org/show_bug.cgi?id=235054
+
+        Reviewed by Sam Weinig.
+
+        FTW removal accidentally removed RECT handling in FloatRect while it is not a part of Direct2D.
+        This patch recovers it. And we also use IntRect in some places since it is proper one.
+
+        * PlatformWin.cmake:
+        * platform/graphics/FloatRect.h:
+        * platform/graphics/win/FloatRectWin.cpp: Copied from Source/WebCore/platform/graphics/win/IntRectWin.cpp.
+        (WebCore::FloatRect::FloatRect):
+        * platform/graphics/win/IntRectWin.cpp:
+        (WebCore::IntRect::IntRect):
+        (WebCore::IntRect::operator RECT const):
+        * platform/win/PopupMenuWin.cpp:
+        (WebCore::monitorFromHwnd):
+        (WebCore::PopupMenuWin::calculatePositionAndSize):
+
 2022-01-10  Alan Bujtas  <[email protected]>
 
         null ptr deref in WebCore::LayoutIntegration::LineLayout::collectOverflow()

Modified: trunk/Source/WebCore/PlatformWin.cmake (287867 => 287868)


--- trunk/Source/WebCore/PlatformWin.cmake	2022-01-11 03:21:20 UTC (rev 287867)
+++ trunk/Source/WebCore/PlatformWin.cmake	2022-01-11 05:04:15 UTC (rev 287868)
@@ -42,6 +42,7 @@
     platform/graphics/win/ComplexTextControllerUniscribe.cpp
     platform/graphics/win/DIBPixelData.cpp
     platform/graphics/win/DisplayRefreshMonitorWin.cpp
+    platform/graphics/win/FloatRectWin.cpp
     platform/graphics/win/FontCacheWin.cpp
     platform/graphics/win/FontDescriptionWin.cpp
     platform/graphics/win/FontPlatformDataWin.cpp

Modified: trunk/Source/WebCore/platform/graphics/FloatRect.h (287867 => 287868)


--- trunk/Source/WebCore/platform/graphics/FloatRect.h	2022-01-11 03:21:20 UTC (rev 287867)
+++ trunk/Source/WebCore/platform/graphics/FloatRect.h	2022-01-11 05:04:15 UTC (rev 287868)
@@ -222,6 +222,10 @@
     operator cairo_rectangle_t() const;
 #endif
 
+#if PLATFORM(WIN)
+    WEBCORE_EXPORT FloatRect(const RECT&);
+#endif
+
     static FloatRect infiniteRect();
     bool isInfinite() const;
 

Copied: trunk/Source/WebCore/platform/graphics/win/FloatRectWin.cpp (from rev 287867, trunk/Source/WebCore/platform/graphics/win/IntRectWin.cpp) (0 => 287868)


--- trunk/Source/WebCore/platform/graphics/win/FloatRectWin.cpp	                        (rev 0)
+++ trunk/Source/WebCore/platform/graphics/win/FloatRectWin.cpp	2022-01-11 05:04:15 UTC (rev 287868)
@@ -0,0 +1,39 @@
+/*
+ * Copyright (C) 2022 Apple Inc.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "FloatRect.h"
+
+#include <windows.h>
+
+namespace WebCore {
+
+FloatRect::FloatRect(const RECT& r)
+    : m_location(r.left, r.top)
+    , m_size(r.right - r.left, r.bottom - r.top)
+{
+}
+
+}

Modified: trunk/Source/WebCore/platform/graphics/win/IntRectWin.cpp (287867 => 287868)


--- trunk/Source/WebCore/platform/graphics/win/IntRectWin.cpp	2022-01-11 03:21:20 UTC (rev 287867)
+++ trunk/Source/WebCore/platform/graphics/win/IntRectWin.cpp	2022-01-11 05:04:15 UTC (rev 287868)
@@ -1,6 +1,6 @@
 
 /*
- * Copyright (C) 2006 Apple Inc.  All rights reserved.
+ * Copyright (C) 2006-2022 Apple Inc.  All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -21,7 +21,7 @@
  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
  * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
 #include "config.h"
@@ -33,14 +33,14 @@
 namespace WebCore {
 
 IntRect::IntRect(const RECT& r)
-    : m_location(IntPoint(r.left, r.top)), m_size(IntSize(r.right - r.left, r.bottom - r.top))
+    : m_location(r.left, r.top)
+    , m_size(r.right - r.left, r.bottom - r.top)
 {
 }
 
 IntRect::operator RECT() const
 {
-    RECT rect = { x(), y(), maxX(), maxY() };
-    return rect;
+    return { x(), y(), maxX(), maxY() };
 }
 
 }

Modified: trunk/Source/WebCore/platform/win/PopupMenuWin.cpp (287867 => 287868)


--- trunk/Source/WebCore/platform/win/PopupMenuWin.cpp	2022-01-11 03:21:20 UTC (rev 287867)
+++ trunk/Source/WebCore/platform/win/PopupMenuWin.cpp	2022-01-11 05:04:15 UTC (rev 287868)
@@ -97,7 +97,7 @@
     lParam = MAKELPARAM(pt.x, pt.y);
 }
 
-static FloatRect monitorFromHwnd(HWND hwnd)
+static IntRect monitorFromHwnd(HWND hwnd)
 {
     HMONITOR monitor = MonitorFromWindow(hwnd, MONITOR_DEFAULTTOPRIMARY);
     MONITORINFOEX monitorInfo;
@@ -305,7 +305,7 @@
     } else
         ::MoveWindow(m_popup, absoluteScreenCoords.x(), absoluteScreenCoords.y(), absoluteScreenCoords.width(), absoluteScreenCoords.height(), false);
 
-    FloatRect screen = monitorFromHwnd(m_popup);
+    IntRect screen = monitorFromHwnd(m_popup);
     
     // Now we determine the actual location and measurements of the popup itself.
     // r is in absolute document coordinates, but we want to be in screen coordinates.
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to