Diff
Modified: trunk/Source/WebKit2/ChangeLog (87804 => 87805)
--- trunk/Source/WebKit2/ChangeLog 2011-06-01 14:51:08 UTC (rev 87804)
+++ trunk/Source/WebKit2/ChangeLog 2011-06-01 15:12:16 UTC (rev 87805)
@@ -1,5 +1,35 @@
2011-06-01 Adam Roben <[email protected]>
+ Move WebView's window geometry updating code to a new class
+
+ This will allow us to share this code with LayerTreeHostCAWin.
+
+ Prep work for <http://webkit.org/b/58054> <rdar://problem/9249839> REGRESSION (WebKit2):
+ Accelerated CSS animations have a lower framerate than in WebKit1
+
+ Reviewed by Anders Carlsson.
+
+ * Shared/win/CoalescedWindowGeometriesUpdater.cpp: Added.
+ (WebKit::CoalescedWindowGeometriesUpdater::CoalescedWindowGeometriesUpdater):
+ (WebKit::CoalescedWindowGeometriesUpdater::~CoalescedWindowGeometriesUpdater):
+ Simple constructor/destructor.
+
+ (WebKit::CoalescedWindowGeometriesUpdater::addPendingUpdate):
+ (WebKit::setWindowRegion):
+ (WebKit::CoalescedWindowGeometriesUpdater::updateGeometries):
+ * Shared/win/CoalescedWindowGeometriesUpdater.h: Added.
+ Moved code here...
+
+ * UIProcess/win/WebView.cpp:
+ (WebKit::WebView::scheduleChildWindowGeometryUpdate):
+ (WebKit::WebView::updateChildWindowGeometries):
+ * UIProcess/win/WebView.h:
+ ...from here.
+
+ * win/WebKit2.vcproj: Added new files.
+
+2011-06-01 Adam Roben <[email protected]>
+
Windows build fix after r87755
* WebProcess/WebPage/ca/win/LayerTreeHostCAWin.cpp:
Added: trunk/Source/WebKit2/Shared/win/CoalescedWindowGeometriesUpdater.cpp (0 => 87805)
--- trunk/Source/WebKit2/Shared/win/CoalescedWindowGeometriesUpdater.cpp (rev 0)
+++ trunk/Source/WebKit2/Shared/win/CoalescedWindowGeometriesUpdater.cpp 2011-06-01 15:12:16 UTC (rev 87805)
@@ -0,0 +1,85 @@
+/*
+ * Copyright (C) 2011 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. AND ITS CONTRIBUTORS ``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 ITS 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 "CoalescedWindowGeometriesUpdater.h"
+
+#include "WindowGeometry.h"
+#include <wtf/PassOwnPtr.h>
+
+namespace WebKit {
+
+CoalescedWindowGeometriesUpdater::CoalescedWindowGeometriesUpdater()
+{
+}
+
+CoalescedWindowGeometriesUpdater::~CoalescedWindowGeometriesUpdater()
+{
+}
+
+void CoalescedWindowGeometriesUpdater::addPendingUpdate(const WindowGeometry& geometry)
+{
+ m_geometries.set(geometry.window, geometry);
+}
+
+static void setWindowRegion(HWND window, PassOwnPtr<HRGN> popRegion)
+{
+ OwnPtr<HRGN> region = popRegion;
+
+ if (!::SetWindowRgn(window, region.get(), TRUE))
+ return;
+
+ // Windows owns the region now.
+ region.leakPtr();
+}
+
+void CoalescedWindowGeometriesUpdater::updateGeometries()
+{
+ HashMap<HWND, WindowGeometry> geometries;
+ geometries.swap(m_geometries);
+
+ HDWP deferWindowPos = ::BeginDeferWindowPos(geometries.size());
+
+ for (HashMap<HWND, WindowGeometry>::const_iterator::Values it = geometries.begin().values(), end = geometries.end().values(); it != end; ++it) {
+ const WindowGeometry& geometry = *it;
+
+ if (!::IsWindow(geometry.window))
+ continue;
+
+ UINT flags = SWP_NOACTIVATE | SWP_NOOWNERZORDER | SWP_NOZORDER;
+ if (geometry.visible)
+ flags |= SWP_SHOWWINDOW;
+ else
+ flags |= SWP_HIDEWINDOW;
+
+ deferWindowPos = ::DeferWindowPos(deferWindowPos, geometry.window, 0, geometry.frame.x(), geometry.frame.y(), geometry.frame.width(), geometry.frame.height(), flags);
+
+ setWindowRegion(geometry.window, adoptPtr(::CreateRectRgn(geometry.clipRect.x(), geometry.clipRect.y(), geometry.clipRect.maxX(), geometry.clipRect.maxY())));
+ }
+
+ ::EndDeferWindowPos(deferWindowPos);
+}
+
+} // namespace WebKit
Property changes on: trunk/Source/WebKit2/Shared/win/CoalescedWindowGeometriesUpdater.cpp
___________________________________________________________________
Added: svn:eol-style
Added: trunk/Source/WebKit2/Shared/win/CoalescedWindowGeometriesUpdater.h (0 => 87805)
--- trunk/Source/WebKit2/Shared/win/CoalescedWindowGeometriesUpdater.h (rev 0)
+++ trunk/Source/WebKit2/Shared/win/CoalescedWindowGeometriesUpdater.h 2011-06-01 15:12:16 UTC (rev 87805)
@@ -0,0 +1,51 @@
+/*
+ * Copyright (C) 2011 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. AND ITS CONTRIBUTORS ``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 ITS 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.
+ */
+
+#ifndef CoalescedWindowGeometriesUpdater_h
+#define CoalescedWindowGeometriesUpdater_h
+
+#include <wtf/HashMap.h>
+#include <wtf/Noncopyable.h>
+
+namespace WebKit {
+
+struct WindowGeometry;
+
+class CoalescedWindowGeometriesUpdater {
+ WTF_MAKE_NONCOPYABLE(CoalescedWindowGeometriesUpdater);
+public:
+ CoalescedWindowGeometriesUpdater();
+ ~CoalescedWindowGeometriesUpdater();
+
+ void addPendingUpdate(const WindowGeometry&);
+ void updateGeometries();
+
+private:
+ HashMap<HWND, WindowGeometry> m_geometries;
+};
+
+} // namespace WebKit
+
+#endif // CoalescedWindowGeometriesUpdater_h
Property changes on: trunk/Source/WebKit2/Shared/win/CoalescedWindowGeometriesUpdater.h
___________________________________________________________________
Added: svn:keywords
Added: svn:eol-style
Modified: trunk/Source/WebKit2/UIProcess/win/WebView.cpp (87804 => 87805)
--- trunk/Source/WebKit2/UIProcess/win/WebView.cpp 2011-06-01 14:51:08 UTC (rev 87804)
+++ trunk/Source/WebKit2/UIProcess/win/WebView.cpp 2011-06-01 15:12:16 UTC (rev 87805)
@@ -41,7 +41,6 @@
#include "WebEventFactory.h"
#include "WebPageProxy.h"
#include "WebPopupMenuProxyWin.h"
-#include "WindowGeometry.h"
#include <Commctrl.h>
#include <WebCore/BitmapInfo.h>
#include <WebCore/Cursor.h>
@@ -1531,45 +1530,12 @@
void WebView::scheduleChildWindowGeometryUpdate(const WindowGeometry& geometry)
{
- m_childWindowGeometriesToUpdate.set(geometry.window, geometry);
+ m_geometriesUpdater.addPendingUpdate(geometry);
}
-static void setWindowRegion(HWND window, PassOwnPtr<HRGN> popRegion)
-{
- OwnPtr<HRGN> region = popRegion;
-
- if (!::SetWindowRgn(window, region.get(), TRUE))
- return;
-
- // Windows owns the region now.
- region.leakPtr();
-}
-
void WebView::updateChildWindowGeometries()
{
- HashMap<HWND, WindowGeometry> geometriesToUpdate;
- geometriesToUpdate.swap(m_childWindowGeometriesToUpdate);
-
- HDWP deferWindowPos = ::BeginDeferWindowPos(geometriesToUpdate.size());
-
- for (HashMap<HWND, WindowGeometry>::const_iterator::Values it = geometriesToUpdate.begin().values(), end = geometriesToUpdate.end().values(); it != end; ++it) {
- const WindowGeometry& geometry = *it;
-
- if (!::IsWindow(geometry.window))
- continue;
-
- UINT flags = SWP_NOACTIVATE | SWP_NOOWNERZORDER | SWP_NOZORDER;
- if (geometry.visible)
- flags |= SWP_SHOWWINDOW;
- else
- flags |= SWP_HIDEWINDOW;
-
- deferWindowPos = ::DeferWindowPos(deferWindowPos, geometry.window, 0, geometry.frame.x(), geometry.frame.y(), geometry.frame.width(), geometry.frame.height(), flags);
-
- setWindowRegion(geometry.window, adoptPtr(::CreateRectRgn(geometry.clipRect.x(), geometry.clipRect.y(), geometry.clipRect.maxX(), geometry.clipRect.maxY())));
- }
-
- ::EndDeferWindowPos(deferWindowPos);
+ m_geometriesUpdater.updateGeometries();
}
// WebCore::WindowMessageListener
Modified: trunk/Source/WebKit2/UIProcess/win/WebView.h (87804 => 87805)
--- trunk/Source/WebKit2/UIProcess/win/WebView.h 2011-06-01 14:51:08 UTC (rev 87804)
+++ trunk/Source/WebKit2/UIProcess/win/WebView.h 2011-06-01 15:12:16 UTC (rev 87805)
@@ -27,6 +27,7 @@
#define WebView_h
#include "APIObject.h"
+#include "CoalescedWindowGeometriesUpdater.h"
#include "PageClient.h"
#include "WKView.h"
#include "WebPageProxy.h"
@@ -274,7 +275,7 @@
bool m_gestureReachedScrollingLimit;
- HashMap<HWND, WindowGeometry> m_childWindowGeometriesToUpdate;
+ CoalescedWindowGeometriesUpdater m_geometriesUpdater;
#if ENABLE(FULLSCREEN_API)
OwnPtr<WebCore::FullScreenController> m_fullScreenController;
Modified: trunk/Source/WebKit2/win/WebKit2.vcproj (87804 => 87805)
--- trunk/Source/WebKit2/win/WebKit2.vcproj 2011-06-01 14:51:08 UTC (rev 87804)
+++ trunk/Source/WebKit2/win/WebKit2.vcproj 2011-06-01 15:12:16 UTC (rev 87805)
@@ -1170,6 +1170,14 @@
Name="win"
>
<File
+ RelativePath="..\Shared\win\CoalescedWindowGeometriesUpdater.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\Shared\win\CoalescedWindowGeometriesUpdater.h"
+ >
+ </File>
+ <File
RelativePath="..\Shared\win\CommandLineWin.cpp"
>
</File>