Changeset 85795 in webkit
- Timestamp:
- May 4, 2011 3:32:28 PM (13 years ago)
- Location:
- trunk/Source/WebKit2
- Files:
-
- 13 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit2/ChangeLog
r85794 r85795 1 2011-05-04 Adam Roben <aroben@apple.com> 2 3 Clip and reposition windowed plugins when the UI process paints 4 5 This ensures that their geometry updates in sync with the rest of the page. 6 7 Most of this patch is just plumbing the scheduleWindowedPluginGeometryUpdate and 8 scheduleChildWindowGeometryUpdate calls through from NetscapePlugin all the way over to 9 WebView. I've tried to call out the other parts below. 10 11 Fixes <http://webkit.org/b/60210> <rdar://problem/8483441> REGRESSION (WebKit2): Windowed 12 plugins don't scroll at the same speed as the rest of the page 13 14 Reviewed by Darin Adler and Anders Carlsson. 15 16 * UIProcess/PageClient.h: 17 * UIProcess/WebPageProxy.h: 18 * UIProcess/WebPageProxy.messages.in: 19 * UIProcess/win/WebPageProxyWin.cpp: 20 (WebKit::WebPageProxy::scheduleChildWindowGeometryUpdate): 21 Added plumbing. 22 23 * UIProcess/win/WebView.cpp: 24 (WebKit::WebView::onPaintEvent): Update child windows before painting so that they will stay 25 in sync with the rest of the page. 26 (WebKit::WebView::scheduleChildWindowGeometryUpdate): Add this update information to the 27 set of geometries to update on the next paint. 28 (WebKit::setWindowRegion): Moved this helper function here from NetscapePluginWin.cpp. 29 (WebKit::WebView::updateChildWindowGeometries): Update the size, position, and clip rects of 30 all the child windows with scheduled geometry updates. 31 32 * UIProcess/win/WebView.h: Added new members to track and update child window geometries. 33 34 * WebProcess/Plugins/Netscape/win/NetscapePluginWin.cpp: 35 (WebKit::NetscapePlugin::platformPostInitialize): Don't show the window immediately. Let the 36 UI process take care of it. 37 (WebKit::NetscapePlugin::platformGeometryDidChange): Don't update the window's position or 38 clip rect. Let the UI process take care of it. 39 40 * WebProcess/Plugins/PluginController.h: 41 * WebProcess/Plugins/PluginView.cpp: 42 (WebKit::PluginView::scheduleWindowedPluginGeometryUpdate): 43 * WebProcess/Plugins/PluginView.h: 44 * WebProcess/WebPage/WebPage.h: 45 * WebProcess/WebPage/win/WebPageWin.cpp: 46 (WebKit::WebPage::scheduleChildWindowGeometryUpdate): 47 Added plumbing. 48 1 49 2011-05-04 Anders Carlsson <andersca@apple.com> 2 50 -
trunk/Source/WebKit2/UIProcess/PageClient.h
r85245 r85795 140 140 virtual HWND nativeWindow() = 0; 141 141 virtual void setGestureReachedScrollingLimit(bool) = 0; 142 virtual void scheduleChildWindowGeometryUpdate(HWND, const WebCore::IntRect& rectInParentClientCoordinates, const WebCore::IntRect& clipRectInChildClientCoordinates) = 0; 142 143 #endif 143 144 -
trunk/Source/WebKit2/UIProcess/WebPageProxy.h
r85746 r85795 734 734 void updateBackingStoreDiscardableState(); 735 735 736 #if PLATFORM(WIN) 737 void scheduleChildWindowGeometryUpdate(uint64_t window, const WebCore::IntRect& rectInParentClientCoordinates, const WebCore::IntRect& clipRectInChildClientCoordinates); 738 #endif 739 736 740 PageClient* m_pageClient; 737 741 WebLoaderClient m_loaderClient; -
trunk/Source/WebKit2/UIProcess/WebPageProxy.messages.in
r85502 r85795 242 242 # Windows 7 Gesture Messages 243 243 SetGestureReachedScrollingLimit(bool limitReached) 244 245 # Miscellaneous Windows messages 246 ScheduleChildWindowGeometryUpdate(uint64_t window, WebCore::IntRect rectInParentClientCoordinates, WebCore::IntRect clipRectInChildClientCoordinates) 244 247 #endif 245 248 -
trunk/Source/WebKit2/UIProcess/win/WebPageProxyWin.cpp
r84785 r85795 71 71 } 72 72 73 void WebPageProxy::scheduleChildWindowGeometryUpdate(uint64_t window, const IntRect& rectInParentClientCoordinates, const IntRect& clipRectInChildClientCoordinates) 74 { 75 m_pageClient->scheduleChildWindowGeometryUpdate(reinterpret_cast<HWND>(window), rectInParentClientCoordinates, clipRectInChildClientCoordinates); 76 } 77 73 78 } // namespace WebKit -
trunk/Source/WebKit2/UIProcess/win/WebView.cpp
r85794 r85795 686 686 LRESULT WebView::onPaintEvent(HWND hWnd, UINT message, WPARAM, LPARAM, bool& handled) 687 687 { 688 // Update child windows now so that any areas of our window they reveal will be included in the 689 // invalid region that ::BeginPaint sees. 690 updateChildWindowGeometries(); 691 688 692 PAINTSTRUCT paintStruct; 689 693 HDC hdc = ::BeginPaint(m_window, &paintStruct); … … 1525 1529 } 1526 1530 1531 void WebView::scheduleChildWindowGeometryUpdate(HWND window, const WebCore::IntRect& rectInParentClientCoordinates, const WebCore::IntRect& clipRectInChildClientCoordinates) 1532 { 1533 ChildWindowGeometry geometry; 1534 geometry.rectInParentClientCoordinates = rectInParentClientCoordinates; 1535 geometry.clipRectInChildClientCoordinates = clipRectInChildClientCoordinates; 1536 1537 m_childWindowGeometriesToUpdate.set(window, geometry); 1538 } 1539 1540 static void setWindowRegion(HWND window, PassOwnPtr<HRGN> popRegion) 1541 { 1542 OwnPtr<HRGN> region = popRegion; 1543 1544 if (!::SetWindowRgn(window, region.get(), TRUE)) 1545 return; 1546 1547 // Windows owns the region now. 1548 region.leakPtr(); 1549 } 1550 1551 void WebView::updateChildWindowGeometries() 1552 { 1553 HashMap<HWND, ChildWindowGeometry> geometriesToUpdate; 1554 geometriesToUpdate.swap(m_childWindowGeometriesToUpdate); 1555 1556 HDWP deferWindowPos = ::BeginDeferWindowPos(geometriesToUpdate.size()); 1557 1558 HashMap<HWND, ChildWindowGeometry>::const_iterator end = geometriesToUpdate.end(); 1559 for (HashMap<HWND, ChildWindowGeometry>::const_iterator it = geometriesToUpdate.begin(); it != end; ++it) { 1560 HWND window = it->first; 1561 if (!::IsWindow(window)) 1562 continue; 1563 1564 const ChildWindowGeometry& geometry = it->second; 1565 1566 const IntRect& windowRect = geometry.rectInParentClientCoordinates; 1567 deferWindowPos = ::DeferWindowPos(deferWindowPos, window, 0, windowRect.x(), windowRect.y(), windowRect.width(), windowRect.height(), SWP_SHOWWINDOW | SWP_NOACTIVATE | SWP_NOOWNERZORDER | SWP_NOZORDER); 1568 1569 const IntRect& clipRect = geometry.clipRectInChildClientCoordinates; 1570 setWindowRegion(window, adoptPtr(::CreateRectRgn(clipRect.x(), clipRect.y(), clipRect.maxX(), clipRect.maxY()))); 1571 } 1572 1573 ::EndDeferWindowPos(deferWindowPos); 1574 } 1575 1527 1576 // WebCore::WindowMessageListener 1528 1577 -
trunk/Source/WebKit2/UIProcess/win/WebView.h
r85699 r85795 161 161 HCURSOR cursorToShow() const; 162 162 void updateNativeCursor(); 163 164 void updateChildWindowGeometries(); 163 165 164 166 // PageClient … … 210 212 211 213 virtual HWND nativeWindow(); 214 virtual void scheduleChildWindowGeometryUpdate(HWND, const WebCore::IntRect& rectInParentClientCoordinates, const WebCore::IntRect& clipRectInChildClientCoordinates); 212 215 213 216 virtual void setGestureReachedScrollingLimit(bool limitReached) { m_gestureReachedScrollingLimit = limitReached; } … … 266 269 bool m_gestureReachedScrollingLimit; 267 270 271 struct ChildWindowGeometry { 272 WebCore::IntRect rectInParentClientCoordinates; 273 WebCore::IntRect clipRectInChildClientCoordinates; 274 }; 275 276 HashMap<HWND, ChildWindowGeometry> m_childWindowGeometriesToUpdate; 277 268 278 #if ENABLE(FULLSCREEN_API) 269 279 OwnPtr<WebCore::FullScreenController> m_fullScreenController; -
trunk/Source/WebKit2/WebProcess/Plugins/Netscape/win/NetscapePluginWin.cpp
r85753 r85795 102 102 registerPluginView(); 103 103 104 m_window = ::CreateWindowExW(0, windowClassName, 0, WS_CHILD | WS_VISIBLE, 0, 0, 0, 0, containingWindow(), 0, instanceHandle(), 0); 104 // Start out with the window hidden. The UI process will take care of showing it once it's correctly positioned the window. 105 m_window = ::CreateWindowExW(0, windowClassName, 0, WS_CHILD, 0, 0, 0, 0, containingWindow(), 0, instanceHandle(), 0); 105 106 if (!m_window) 106 107 return false; … … 139 140 } 140 141 141 enum RedrawOrNot { DoNotRedraw, Redraw };142 static void setWindowRegion(HWND window, PassOwnPtr<HRGN> popRegion, RedrawOrNot redrawOrNot)143 {144 OwnPtr<HRGN> region = popRegion;145 146 if (!::SetWindowRgn(window, region.get(), redrawOrNot == Redraw))147 return;148 149 // Windows owns the region now.150 region.leakPtr();151 }152 153 142 void NetscapePlugin::platformGeometryDidChange() 154 143 { … … 159 148 clipRectInPluginWindowCoordinates.move(-m_frameRect.x(), -m_frameRect.y()); 160 149 161 OwnPtr<HRGN> clipRegion = adoptPtr(::CreateRectRgn(clipRectInPluginWindowCoordinates.x(), clipRectInPluginWindowCoordinates.y(), clipRectInPluginWindowCoordinates.maxX(), clipRectInPluginWindowCoordinates.maxY())); 162 setWindowRegion(m_window, clipRegion.release(), Redraw); 163 164 // FIXME: We should only update the size here and let the UI process update our position so 165 // that we can keep our position in sync when scrolling, etc. 166 ::MoveWindow(m_window, m_frameRect.x(), m_frameRect.y(), m_frameRect.width(), m_frameRect.height(), TRUE); 150 // We only update the size here and let the UI process update our position and clip rect so 151 // that we can keep our position in sync when scrolling, etc. See <http://webkit.org/b/60210>. 152 ::SetWindowPos(m_window, 0, 0, 0, m_frameRect.width(), m_frameRect.height(), SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOOWNERZORDER | SWP_NOZORDER); 153 154 m_pluginController->scheduleWindowedPluginGeometryUpdate(m_window, m_frameRect, clipRectInPluginWindowCoordinates); 167 155 } 168 156 -
trunk/Source/WebKit2/WebProcess/Plugins/PluginController.h
r85502 r85795 90 90 // The window to use as the parent of the plugin's window. 91 91 virtual HWND nativeParentWindow() = 0; 92 93 // Tells the controller that the given HWND needs to be positioned and clipped to the given 94 // coordinates sometime soon. The controller will decide exactly when this will happen. 95 virtual void scheduleWindowedPluginGeometryUpdate(HWND, const WebCore::IntRect& rectInParentClientCoordinates, const WebCore::IntRect& clipRectInPluginWindowCoordinates) = 0; 92 96 #endif 93 97 -
trunk/Source/WebKit2/WebProcess/Plugins/PluginView.cpp
r85567 r85795 1004 1004 return m_webPage->nativeWindow(); 1005 1005 } 1006 1007 void PluginView::scheduleWindowedPluginGeometryUpdate(HWND pluginWindow, const IntRect& rectInParentClientCoordinates, const IntRect& clipRectInPluginWindowCoordinates) 1008 { 1009 m_webPage->scheduleChildWindowGeometryUpdate(pluginWindow, rectInParentClientCoordinates, clipRectInPluginWindowCoordinates); 1010 } 1006 1011 #endif 1007 1012 -
trunk/Source/WebKit2/WebProcess/Plugins/PluginView.h
r85502 r85795 133 133 #if PLATFORM(WIN) 134 134 virtual HWND nativeParentWindow(); 135 virtual void scheduleWindowedPluginGeometryUpdate(HWND, const WebCore::IntRect& rectInClientCoordinates, const WebCore::IntRect& clipRectInPluginWindowCoordinates); 135 136 #endif 136 137 #if PLATFORM(MAC) -
trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h
r85783 r85795 259 259 #elif PLATFORM(WIN) 260 260 HWND nativeWindow() const { return m_nativeWindow; } 261 void scheduleChildWindowGeometryUpdate(HWND, const WebCore::IntRect& rectInParentClientCoordinates, const WebCore::IntRect& clipRectInChildClientCoordinates); 261 262 #endif 262 263 -
trunk/Source/WebKit2/WebProcess/WebPage/win/WebPageWin.cpp
r85783 r85795 28 28 29 29 #include "FontSmoothingLevel.h" 30 #include "WebCoreArgumentCoders.h" 30 31 #include "WebEvent.h" 31 32 #include "WebPageProxyMessages.h" 32 33 #include "WebPreferencesStore.h" 34 #include "WebProcess.h" 33 35 #include <WebCore/FocusController.h> 34 36 #include <WebCore/FontRenderingMode.h> … … 458 460 } 459 461 462 void WebPage::scheduleChildWindowGeometryUpdate(HWND window, const IntRect& rectInParentClientCoordinates, const IntRect& clipRectInChildClientCoordinates) 463 { 464 WebProcess::shared().connection()->send(Messages::WebPageProxy::ScheduleChildWindowGeometryUpdate(reinterpret_cast<uint64_t>(window), rectInParentClientCoordinates, clipRectInChildClientCoordinates), m_pageID); 465 } 466 460 467 } // namespace WebKit
Note: See TracChangeset
for help on using the changeset viewer.