Changeset 203495 in webkit
- Timestamp:
- Jul 21, 2016, 12:04:59 AM (10 years ago)
- Location:
- trunk/Source/WebKit2
- Files:
-
- 4 edited
-
ChangeLog (modified) (1 diff)
-
UIProcess/API/gtk/WebKitWebViewBase.cpp (modified) (4 diffs)
-
UIProcess/gtk/RedirectedXCompositeWindow.cpp (modified) (4 diffs)
-
UIProcess/gtk/RedirectedXCompositeWindow.h (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit2/ChangeLog
r203493 r203495 1 2016-07-20 Carlos Garcia Campos <cgarcia@igalia.com> 2 3 [GTK] Avoid the redirected window resize when the view is realized in AC mode 4 https://bugs.webkit.org/show_bug.cgi?id=159463 5 6 Reviewed by Michael Catanzaro. 7 8 We are always creating the redirected window at 1x1 and then resizing it if we are in AC mode. When the view is 9 realized and AC mode is already enabled, which happens for example when AC mode is forced, or when the threaded 10 compositor is enabled, we could just pass the initial size to the redirected window constructor to create the 11 XWindow at the right size. 12 13 * UIProcess/API/gtk/WebKitWebViewBase.cpp: 14 (webkitWebViewBaseResizeRedirectedWindow): We no longer need to pass the device scale factor, since the 15 RedirectedXCompositeWindow already knows it. 16 (webkitWebViewBaseRealize): Pass the WebPageProxy and an initial size to the RedirectedXCompositeWindow 17 constructor instead of the parent GdkWindow. If AC mode is disabled, the initial size will be empty. With the 18 WebPageProxy the redirected window has access to the device scale factor and view widget to get the parent 19 GdkWindow. 20 (deviceScaleFactorChanged): Resize the redirected window when device scale factor changes. 21 * UIProcess/gtk/RedirectedXCompositeWindow.cpp: 22 (WebKit::RedirectedXCompositeWindow::create): 23 (WebKit::RedirectedXCompositeWindow::RedirectedXCompositeWindow): 24 (WebKit::RedirectedXCompositeWindow::resize): 25 (WebKit::RedirectedXCompositeWindow::surface): 26 (WebKit::RedirectedXCompositeWindow::~RedirectedXCompositeWindow): 27 * UIProcess/gtk/RedirectedXCompositeWindow.h: 28 1 29 2016-07-20 Carlos Garcia Campos <cgarcia@igalia.com> 2 30 -
trunk/Source/WebKit2/UIProcess/API/gtk/WebKitWebViewBase.cpp
r203493 r203495 360 360 WebKitWebViewBasePrivate* priv = webView->priv; 361 361 DrawingAreaProxyImpl* drawingArea = static_cast<DrawingAreaProxyImpl*>(priv->pageProxy->drawingArea()); 362 ASSERT(drawingArea);363 priv->redirectedWindow->setDeviceScaleFactor(priv->pageProxy->deviceScaleFactor());362 if (!drawingArea) 363 return; 364 364 priv->redirectedWindow->resize(drawingArea->size()); 365 365 } … … 374 374 if (PlatformDisplay::sharedDisplay().type() == PlatformDisplay::Type::X11) { 375 375 ASSERT(!priv->redirectedWindow); 376 DrawingAreaProxyImpl* drawingArea = static_cast<DrawingAreaProxyImpl*>(priv->pageProxy->drawingArea()); 376 377 priv->redirectedWindow = RedirectedXCompositeWindow::create( 377 gtk_widget_get_parent_window(widget), 378 *priv->pageProxy, 379 drawingArea && drawingArea->isInAcceleratedCompositingMode() ? drawingArea->size() : IntSize(), 378 380 [webView] { 379 381 DrawingAreaProxyImpl* drawingArea = static_cast<DrawingAreaProxyImpl*>(webView->priv->pageProxy->drawingArea()); … … 381 383 gtk_widget_queue_draw(GTK_WIDGET(webView)); 382 384 }); 383 if (priv->redirectedWindow) { 384 if (DrawingAreaProxyImpl* drawingArea = static_cast<DrawingAreaProxyImpl*>(priv->pageProxy->drawingArea())) { 385 drawingArea->setNativeSurfaceHandleForCompositing(priv->redirectedWindow->windowID()); 386 if (drawingArea->isInAcceleratedCompositingMode()) 387 webkitWebViewBaseResizeRedirectedWindow(webView); 388 } 385 if (priv->redirectedWindow && drawingArea) { 386 drawingArea->setNativeSurfaceHandleForCompositing(priv->redirectedWindow->windowID()); 387 if (drawingArea->isInAcceleratedCompositingMode()) 388 webkitWebViewBaseResizeRedirectedWindow(webView); 389 389 } 390 390 } … … 1266 1266 #if USE(REDIRECTED_XCOMPOSITE_WINDOW) 1267 1267 if (webkitWebViewBase->priv->redirectedWindow) 1268 webkitWebViewBase ->priv->redirectedWindow->setDeviceScaleFactor(webkitWebViewBase->priv->pageProxy->deviceScaleFactor());1268 webkitWebViewBaseResizeRedirectedWindow(webkitWebViewBase); 1269 1269 #endif 1270 1270 webkitWebViewBase->priv->pageProxy->setIntrinsicDeviceScaleFactor(gtk_widget_get_scale_factor(GTK_WIDGET(webkitWebViewBase))); -
trunk/Source/WebKit2/UIProcess/gtk/RedirectedXCompositeWindow.cpp
r202273 r203495 30 30 #if USE(REDIRECTED_XCOMPOSITE_WINDOW) 31 31 32 #include "WebPageProxy.h" 32 33 #include <WebCore/CairoUtilities.h> 33 34 #include <WebCore/PlatformDisplayX11.h> … … 131 132 } 132 133 133 std::unique_ptr<RedirectedXCompositeWindow> RedirectedXCompositeWindow::create(GdkWindow* parentWindow, std::function<void()> damageNotify) 134 { 134 std::unique_ptr<RedirectedXCompositeWindow> RedirectedXCompositeWindow::create(WebPageProxy& webPage, const IntSize& initialSize, std::function<void()>&& damageNotify) 135 { 136 GdkWindow* parentWindow = gtk_widget_get_parent_window(webPage.viewWidget()); 135 137 ASSERT(GDK_IS_WINDOW(parentWindow)); 136 return supportsXDamageAndXComposite(parentWindow) ? std::unique_ptr<RedirectedXCompositeWindow>(new RedirectedXCompositeWindow(parentWindow, damageNotify)) : nullptr; 137 } 138 139 RedirectedXCompositeWindow::RedirectedXCompositeWindow(GdkWindow* parentWindow, std::function<void()> damageNotify) 140 : m_display(GDK_DISPLAY_XDISPLAY(gdk_window_get_display(parentWindow))) 141 , m_needsNewPixmapAfterResize(false) 142 , m_deviceScale(1) 143 { 138 if (!supportsXDamageAndXComposite(parentWindow)) 139 return nullptr; 140 return std::unique_ptr<RedirectedXCompositeWindow>(new RedirectedXCompositeWindow(webPage, initialSize, WTFMove(damageNotify))); 141 } 142 143 RedirectedXCompositeWindow::RedirectedXCompositeWindow(WebPageProxy& webPage, const IntSize& initialSize, std::function<void()>&& damageNotify) 144 : m_webPage(webPage) 145 , m_display(GDK_DISPLAY_XDISPLAY(gdk_window_get_display(gtk_widget_get_parent_window(webPage.viewWidget())))) 146 , m_size(initialSize) 147 { 148 m_size.scale(m_webPage.deviceScaleFactor()); 149 144 150 ASSERT(downcast<PlatformDisplayX11>(PlatformDisplay::sharedDisplay()).native() == m_display); 145 151 Screen* screen = DefaultScreenOfDisplay(m_display); 146 152 147 GdkVisual* visual = gdk_window_get_visual( parentWindow);153 GdkVisual* visual = gdk_window_get_visual(gtk_widget_get_parent_window(webPage.viewWidget())); 148 154 XUniqueColormap colormap(XCreateColormap(m_display, RootWindowOfScreen(screen), GDK_VISUAL_XVISUAL(visual), AllocNone)); 149 155 … … 215 221 { 216 222 IntSize scaledSize(size); 217 scaledSize.scale(m_deviceScale); 218 223 scaledSize.scale(m_webPage.deviceScaleFactor()); 219 224 if (scaledSize == m_size) 220 225 return; … … 262 267 263 268 RefPtr<cairo_surface_t> newSurface = adoptRef(cairo_xlib_surface_create(m_display, newPixmap.get(), windowAttributes.visual, m_size.width(), m_size.height())); 264 cairoSurfaceSetDeviceScale(newSurface.get(), m_ deviceScale, m_deviceScale);269 cairoSurfaceSetDeviceScale(newSurface.get(), m_webPage.deviceScaleFactor(), m_webPage.deviceScaleFactor()); 265 270 266 271 RefPtr<cairo_t> cr = adoptRef(cairo_create(newSurface.get())); -
trunk/Source/WebKit2/UIProcess/gtk/RedirectedXCompositeWindow.h
r190344 r203495 41 41 namespace WebKit { 42 42 43 class WebPageProxy; 44 43 45 class RedirectedXCompositeWindow { 46 WTF_MAKE_NONCOPYABLE(RedirectedXCompositeWindow); WTF_MAKE_FAST_ALLOCATED; 44 47 public: 45 static std::unique_ptr<RedirectedXCompositeWindow> create( GdkWindow*, std::function<void()>damageNotify);48 static std::unique_ptr<RedirectedXCompositeWindow> create(WebPageProxy&, const WebCore::IntSize&, std::function<void ()>&& damageNotify); 46 49 ~RedirectedXCompositeWindow(); 47 50 48 51 Window windowID() const { return m_window.get(); } 49 52 void resize(const WebCore::IntSize&); 50 void setDeviceScaleFactor(float scale) { m_deviceScale = scale; }51 53 cairo_surface_t* surface(); 52 54 53 55 private: 54 RedirectedXCompositeWindow( GdkWindow*, std::function<void()>damageNotify);56 RedirectedXCompositeWindow(WebPageProxy&, const WebCore::IntSize&, std::function<void ()>&& damageNotify); 55 57 void cleanupPixmapAndPixmapSurface(); 56 58 57 Display* m_display; 59 WebPageProxy& m_webPage; 60 Display* m_display { nullptr }; 58 61 WebCore::IntSize m_size; 59 62 WebCore::XUniqueWindow m_window; … … 62 65 WebCore::XUniqueDamage m_damage; 63 66 RefPtr<cairo_surface_t> m_surface; 64 bool m_needsNewPixmapAfterResize; 65 float m_deviceScale; 67 bool m_needsNewPixmapAfterResize { false }; 66 68 }; 67 69
Note:
See TracChangeset
for help on using the changeset viewer.