Changeset 80292 in webkit


Ignore:
Timestamp:
Mar 3, 2011 3:33:58 PM (13 years ago)
Author:
Adam Roben
Message:

Don't try to paint outside the page's bounds

When the page is resized smaller, we would allocate a ShareableBitmap at the old, larger
size, even though we only needed to paint at the new, smaller size.

The assertion added in this patch will fire during the WebKit2/ResizeViewWhileHidden API
test if this fix gets broken in the future.

Fixes <http://webkit.org/b/55715> DrawingAreaImpl allocates more memory than necessary when
the page is resized smaller

Reviewed by Anders Carlsson.

  • WebProcess/WebPage/DrawingAreaImpl.cpp:

(WebKit::DrawingAreaImpl::updateBackingStoreState): Update our dirty region even if painting
is suspended (but still refrain from updating it when in accelerated compositing mode).
Rather than unite our existing dirty region with the page's new bounds, overwrite our dirty
region with the page's new bounds. This prevents us from accumulating a dirty region that is
larger than the page in the case where the page is being resized smaller.
(WebKit::DrawingAreaImpl::display): Added an assertion that we're not trying to paint
outside of the page's bounds.

Location:
trunk/Source/WebKit2
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit2/ChangeLog

    r80281 r80292  
     12011-03-03  Adam Roben  <aroben@apple.com>
     2
     3        Don't try to paint outside the page's bounds
     4
     5        When the page is resized smaller, we would allocate a ShareableBitmap at the old, larger
     6        size, even though we only needed to paint at the new, smaller size.
     7
     8        The assertion added in this patch will fire during the WebKit2/ResizeViewWhileHidden API
     9        test if this fix gets broken in the future.
     10
     11        Fixes <http://webkit.org/b/55715> DrawingAreaImpl allocates more memory than necessary when
     12        the page is resized smaller
     13
     14        Reviewed by Anders Carlsson.
     15
     16        * WebProcess/WebPage/DrawingAreaImpl.cpp:
     17        (WebKit::DrawingAreaImpl::updateBackingStoreState): Update our dirty region even if painting
     18        is suspended (but still refrain from updating it when in accelerated compositing mode).
     19        Rather than unite our existing dirty region with the page's new bounds, overwrite our dirty
     20        region with the page's new bounds. This prevents us from accumulating a dirty region that is
     21        larger than the page in the case where the page is being resized smaller.
     22        (WebKit::DrawingAreaImpl::display): Added an assertion that we're not trying to paint
     23        outside of the page's bounds.
     24
    1252011-03-03  Maciej Stachowiak  <mjs@apple.com>
    226
  • trunk/Source/WebKit2/WebProcess/WebPage/DrawingAreaImpl.cpp

    r79868 r80292  
    265265        // will be sent back in the DidUpdateBackingStoreState message.
    266266        m_layerTreeHost->setShouldNotifyAfterNextScheduledLayerFlush(false);
    267     }
     267    } else
     268        m_dirtyRegion = m_webPage->bounds();
    268269
    269270    if (m_isPaintingSuspended || m_layerTreeHost)
    270271        updateInfo.viewSize = m_webPage->size();
    271272    else {
    272         m_dirtyRegion.unite(m_webPage->bounds());
    273 
    274273        // The display here should not cause layout to happen, so we can't enter accelerated compositing mode here.
    275274        display(updateInfo);
     
    450449
    451450    IntRect bounds = m_dirtyRegion.bounds();
     451    ASSERT(m_webPage->bounds().contains(bounds));
    452452
    453453    RefPtr<ShareableBitmap> bitmap = ShareableBitmap::createShareable(bounds.size());
Note: See TracChangeset for help on using the changeset viewer.