Changeset 199536 in webkit


Ignore:
Timestamp:
Apr 14, 2016 4:09:37 AM (8 years ago)
Author:
commit-queue@webkit.org
Message:

WebGL based canvases composite incorrectly after changing size
https://bugs.webkit.org/show_bug.cgi?id=152556
<rdar://problem/24012678>

Patch by Antoine Quint <Antoine Quint> on 2016-04-14
Reviewed by Dean Jackson.

Source/WebCore:

On iOS, we use the CAEAGLLayer's bounds to set the size of the backing store.
However, that layer's bounds is also used to size the layer during layout. If
the canvas backing store is resized after layout has been performed, the call
to setBounds loses the layout value and the <canvas> element is incorrectly
sized on screen.

To address this, when updating the backing store, we keep track of the previous
layer bounds so we can reset it after we sized the backing store.

Test: webgl/webgl-backing-store-size-update.html

  • platform/graphics/GraphicsContext3D.h:
  • platform/graphics/mac/GraphicsContext3DMac.mm:

(WebCore::GraphicsContext3D::setRenderbufferStorageFromDrawable):

LayoutTests:

Adding a new test that sets the size of the backing store to a different
size than the layout size after the layout size of the <canvas> element
has been applied to ensure that the implementation correctly retains the
layout size as the canvas backing store is resized.

  • webgl/webgl-backing-store-size-update-expected.html: Added.
  • webgl/webgl-backing-store-size-update.html: Added.
Location:
trunk
Files:
2 added
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r199529 r199536  
     12016-04-14  Antoine Quint  <graouts@apple.com>
     2
     3        WebGL based canvases composite incorrectly after changing size
     4        https://bugs.webkit.org/show_bug.cgi?id=152556
     5        <rdar://problem/24012678>
     6
     7        Reviewed by Dean Jackson.
     8
     9        Adding a new test that sets the size of the backing store to a different
     10        size than the layout size after the layout size of the <canvas> element
     11        has been applied to ensure that the implementation correctly retains the
     12        layout size as the canvas backing store is resized.
     13
     14        * webgl/webgl-backing-store-size-update-expected.html: Added.
     15        * webgl/webgl-backing-store-size-update.html: Added.
     16
    1172016-04-13  Joseph Pecoraro  <pecoraro@apple.com>
    218
  • trunk/Source/WebCore/ChangeLog

    r199531 r199536  
     12016-04-14  Antoine Quint  <graouts@apple.com>
     2
     3        WebGL based canvases composite incorrectly after changing size
     4        https://bugs.webkit.org/show_bug.cgi?id=152556
     5        <rdar://problem/24012678>
     6
     7        Reviewed by Dean Jackson.
     8
     9        On iOS, we use the CAEAGLLayer's bounds to set the size of the backing store.
     10        However, that layer's bounds is also used to size the layer during layout. If
     11        the canvas backing store is resized after layout has been performed, the call
     12        to setBounds loses the layout value and the <canvas> element is incorrectly
     13        sized on screen.
     14
     15        To address this, when updating the backing store, we keep track of the previous
     16        layer bounds so we can reset it after we sized the backing store.
     17
     18        Test: webgl/webgl-backing-store-size-update.html
     19
     20        * platform/graphics/GraphicsContext3D.h:
     21        * platform/graphics/mac/GraphicsContext3DMac.mm:
     22        (WebCore::GraphicsContext3D::setRenderbufferStorageFromDrawable):
     23
    1242016-04-13  Carlos Garcia Campos  <cgarcia@igalia.com>
    225
  • trunk/Source/WebCore/platform/graphics/GraphicsContext3D.h

    r199314 r199536  
    12921292
    12931293#if PLATFORM(IOS)
    1294     bool setRenderbufferStorageFromDrawable(GC3Dsizei width, GC3Dsizei height);
     1294    void setRenderbufferStorageFromDrawable(GC3Dsizei width, GC3Dsizei height);
    12951295#endif
    12961296
  • trunk/Source/WebCore/platform/graphics/mac/GraphicsContext3DMac.mm

    r199314 r199536  
    341341
    342342#if PLATFORM(IOS)
    343 bool GraphicsContext3D::setRenderbufferStorageFromDrawable(GC3Dsizei width, GC3Dsizei height)
    344 {
     343void GraphicsContext3D::setRenderbufferStorageFromDrawable(GC3Dsizei width, GC3Dsizei height)
     344{
     345    // We need to make a call to setBounds below to update the backing store size but we also
     346    // do not want to clobber the bounds set during layout.
     347    CGRect previousBounds = [m_webGLLayer.get() bounds];
     348
    345349    [m_webGLLayer setBounds:CGRectMake(0, 0, width, height)];
    346350    [m_webGLLayer setOpaque:(m_internalColorFormat != GL_RGBA8)];
    347351
    348     return [m_contextObj renderbufferStorage:GL_RENDERBUFFER fromDrawable:static_cast<id<EAGLDrawable>>(m_webGLLayer.get())];
     352    [m_contextObj renderbufferStorage:GL_RENDERBUFFER fromDrawable:static_cast<id<EAGLDrawable>>(m_webGLLayer.get())];
     353
     354    [m_webGLLayer setBounds:previousBounds];
    349355}
    350356#endif
Note: See TracChangeset for help on using the changeset viewer.