⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 203500 in webkit


Ignore:
Timestamp:
Jul 21, 2016, 12:35:49 AM (10 years ago)
Author:
Carlos Garcia Campos
Message:

[GTK] White page when loaded tab is visited until it's hovered when AC mode is always on
​https://bugs.webkit.org/show_bug.cgi?id=159512

Reviewed by Michael Catanzaro.

The redirected window is always mapped, but offscreen, to ensure that the web process can always render
there. When the web process renders something into the offscreen window, we receive a damage event in the UI
process and queue a redraw of the web view. However, when the web view is not mapped, even if we still receive
the damage events, the web view redraws are ignored until the view is mapped again (gtk_widget_queue_draw()
returns early when the widget is not visible). The redirected window updates its pixmap on demand when the
surface is requested, which happens when the web view draws its contents. So when the web view becames visible,
the redirected window creates a new pixmap and surface (the first time or if the web view was resized), that we
initialize to avoid artifacts when the web process hasn't render anything yet. That initialization is actually
overwriting anything rendered into the redirected window while the view was unmapped. That's why see white pages
the first time, and previous contents after a resize, and we don't see the actual contents until the web process
renders again and we reuse the existing pixmap. The white page didn't happen for tabs with accelerated content,
because in those cases the web process was rendering a new frame every 16ms, but instead there was a flickering
effect due to the current frame being overwritten when the view is mapped until the next frame.
So, instead of lazily create and initialize the redirected window pixmap and surface, we should always create
the new pixmap as soon as the window is created or resized (and not empty) This fixes the issues but also makes
resizing the window a bit smoother when AC mode is enabled.

  • UIProcess/gtk/RedirectedXCompositeWindow.cpp:

(WebKit::RedirectedXCompositeWindow::RedirectedXCompositeWindow): Create the pixmap and surface if the window is
not empty.
(WebKit::RedirectedXCompositeWindow::resize): Ditto.
(WebKit::RedirectedXCompositeWindow::createNewPixampAndPixampSurface): Create the pixmap and surface.
(WebKit::RedirectedXCompositeWindow::surface): Deleted.

  • UIProcess/gtk/RedirectedXCompositeWindow.h:

(WebKit::RedirectedXCompositeWindow::surface):

Location:
trunk/Source/WebKit2
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit2/ChangeLog

    r203497 r203500  
     12016-07-21  Carlos Garcia Campos  <cgarcia@igalia.com>
     2
     3        [GTK] White page when loaded tab is visited until it's hovered when AC mode is always on
     4        https://bugs.webkit.org/show_bug.cgi?id=159512
     5
     6        Reviewed by Michael Catanzaro.
     7
     8        The redirected window is always mapped, but offscreen, to ensure that the web process can always render
     9        there. When the web process renders something into the offscreen window, we receive a damage event in the UI
     10        process and queue a redraw of the web view. However, when the web view is not mapped, even if we still receive
     11        the damage events, the web view redraws are ignored until the view is mapped again (gtk_widget_queue_draw()
     12        returns early when the widget is not visible). The redirected window updates its pixmap on demand when the
     13        surface is requested, which happens when the web view draws its contents. So when the web view becames visible,
     14        the redirected window creates a new pixmap and surface (the first time or if the web view was resized), that we
     15        initialize to avoid artifacts when the web process hasn't render anything yet. That initialization is actually
     16        overwriting anything rendered into the redirected window while the view was unmapped. That's why see white pages
     17        the first time, and previous contents after a resize, and we don't see the actual contents until the web process
     18        renders again and we reuse the existing pixmap. The white page didn't happen for tabs with accelerated content,
     19        because in those cases the web process was rendering a new frame every 16ms, but instead there was a flickering
     20        effect due to the current frame being overwritten when the view is mapped until the next frame.
     21        So, instead of lazily create and initialize the redirected window pixmap and surface, we should always create
     22        the new pixmap as soon as the window is created or resized (and not empty) This fixes the issues but also makes
     23        resizing the window a bit smoother when AC mode is enabled.
     24
     25        * UIProcess/gtk/RedirectedXCompositeWindow.cpp:
     26        (WebKit::RedirectedXCompositeWindow::RedirectedXCompositeWindow): Create the pixmap and surface if the window is
     27        not empty.
     28        (WebKit::RedirectedXCompositeWindow::resize): Ditto.
     29        (WebKit::RedirectedXCompositeWindow::createNewPixampAndPixampSurface): Create the pixmap and surface.
     30        (WebKit::RedirectedXCompositeWindow::surface): Deleted.
     31        * UIProcess/gtk/RedirectedXCompositeWindow.h:
     32        (WebKit::RedirectedXCompositeWindow::surface):
     33
    1342016-07-21  Carlos Garcia Campos  <cgarcia@igalia.com>
    235
  • trunk/Source/WebKit2/UIProcess/gtk/RedirectedXCompositeWindow.cpp

    r203496 r203500  
    205205    XSelectInput(m_display, m_window.get(), NoEventMask);
    206206    XCompositeRedirectWindow(m_display, m_window.get(), CompositeRedirectManual);
     207    if (!m_size.isEmpty())
     208        createNewPixampAndPixampSurface();
    207209    m_damage = XDamageCreate(m_display, m_window.get(), XDamageReportNonEmpty);
    208210}
    … …  
    235237
    236238    m_size = scaledSize;
    237     m_needsNewPixmapAfterResize = true;
    238239    if (m_size.isEmpty())
    239240        cleanupPixmapAndPixmapSurface();
     241    else
     242        createNewPixampAndPixampSurface();
    240243}
    241244
    … …  
    249252}
    250253
    251 cairo_surface_t* RedirectedXCompositeWindow::surface()
     254void RedirectedXCompositeWindow::createNewPixampAndPixampSurface()
    252255{
    253256    // This should never be called with an empty size (not in Accelerated Compositing mode).
    254257    ASSERT(!m_size.isEmpty());
    255 
    256     if (!m_needsNewPixmapAfterResize && m_surface)
    257         return m_surface.get();
    258 
    259     m_needsNewPixmapAfterResize = false;
    260 
    261258    XUniquePixmap newPixmap(XCompositeNameWindowPixmap(m_display, m_window.get()));
    262259    if (!newPixmap) {
    263260        cleanupPixmapAndPixmapSurface();
    264         return nullptr;
     261        return;
    265262    }
    266263
    … …  
    268265    if (!XGetWindowAttributes(m_display, m_window.get(), &windowAttributes)) {
    269266        cleanupPixmapAndPixmapSurface();
    270         return nullptr;
     267        return;
    271268    }
    272269
    … …  
    293290    cleanupPixmapAndPixmapSurface();
    294291    m_pixmap = WTFMove(newPixmap);
    295     m_surface = newSurface;
    296     return m_surface.get();
     292    m_surface = WTFMove(newSurface);
    297293}
    298294
  • trunk/Source/WebKit2/UIProcess/gtk/RedirectedXCompositeWindow.h

    r203495 r203500  
    5151    Window windowID() const { return m_window.get(); }
    5252    void resize(const WebCore::IntSize&);
    53     cairo_surface_t* surface();
     53    cairo_surface_t* surface() const { return m_surface.get(); };
    5454
    5555private:
    5656    RedirectedXCompositeWindow(WebPageProxy&, const WebCore::IntSize&, std::function<void ()>&& damageNotify);
     57    void createNewPixampAndPixampSurface();
    5758    void cleanupPixmapAndPixmapSurface();
    5859
    … …  
    6566    WebCore::XUniqueDamage m_damage;
    6667    RefPtr<cairo_surface_t> m_surface;
    67     bool m_needsNewPixmapAfterResize { false };
    6868};
    6969
Note: See TracChangeset for help on using the changeset viewer.