Changeset 103245 in webkit


Ignore:
Timestamp:
Dec 19, 2011 10:11:20 AM (12 years ago)
Author:
kling@webkit.org
Message:

Avoid instantiating ScrollAnimators when possible.
<http://webkit.org/b/74830>

Reviewed by Beth Dakin.

Have RenderLayer::scrollToOffset() check if we're scrolling to the already
current offset. In that case, don't call down to scrollToOffsetWithoutAnimation(),
avoiding the instantiation of a ScrollAnimator.

This reduces memory consumption by 400 kB (on 32-bit) when viewing the full HTML5
spec on <http://whatwg.org/c>, since we were creating a ScrollAnimator for every
single RenderLayer.

  • rendering/RenderLayer.cpp:

(WebCore::RenderLayer::scrollToOffset):

Location:
trunk/Source/WebCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r103244 r103245  
     12011-12-19  Andreas Kling  <kling@webkit.org>
     2
     3        Avoid instantiating ScrollAnimators when possible.
     4        <http://webkit.org/b/74830>
     5
     6        Reviewed by Beth Dakin.
     7
     8        Have RenderLayer::scrollToOffset() check if we're scrolling to the already
     9        current offset. In that case, don't call down to scrollToOffsetWithoutAnimation(),
     10        avoiding the instantiation of a ScrollAnimator.
     11
     12        This reduces memory consumption by 400 kB (on 32-bit) when viewing the full HTML5
     13        spec on <http://whatwg.org/c>, since we were creating a ScrollAnimator for every
     14        single RenderLayer.
     15
     16        * rendering/RenderLayer.cpp:
     17        (WebCore::RenderLayer::scrollToOffset):
     18
    1192011-12-19  Chris Guan  <chris.guan@torchmobile.com.cn>
    220
  • trunk/Source/WebCore/rendering/RenderLayer.cpp

    r103243 r103245  
    14131413        y = min(max<LayoutUnit>(y, 0), maxY);
    14141414    }
    1415    
    1416     ScrollableArea::scrollToOffsetWithoutAnimation(LayoutPoint(x, y));
     1415
     1416    LayoutPoint newScrollOffset(x, y);
     1417    if (newScrollOffset != LayoutPoint(scrollXOffset(), scrollYOffset()))
     1418        scrollToOffsetWithoutAnimation(newScrollOffset);
    14171419}
    14181420
Note: See TracChangeset for help on using the changeset viewer.