Changeset 165233 in webkit


Ignore:
Timestamp:
Mar 6, 2014, 5:31:53 PM (12 years ago)
Author:
Simon Fraser
Message:

Minor optimization in ScrollingTreeScrollingNodeMac
https://bugs.webkit.org/show_bug.cgi?id=129848

Reviewed by Dean Jackson.

No need to call scrollOffsetForFixedPosition() again if we don't have header
and footer layers.

  • page/scrolling/mac/ScrollingTreeScrollingNodeMac.mm:

(WebCore::ScrollingTreeScrollingNodeMac::setScrollLayerPosition):

Location:
trunk/Source/WebCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r165229 r165233  
     12014-03-06  Simon Fraser  <simon.fraser@apple.com>
     2
     3        Minor optimization in ScrollingTreeScrollingNodeMac
     4        https://bugs.webkit.org/show_bug.cgi?id=129848
     5
     6        Reviewed by Dean Jackson.
     7
     8        No need to call scrollOffsetForFixedPosition() again if we don't have header
     9        and footer layers.
     10
     11        * page/scrolling/mac/ScrollingTreeScrollingNodeMac.mm:
     12        (WebCore::ScrollingTreeScrollingNodeMac::setScrollLayerPosition):
     13
    1142014-03-06  Mark Lam  <mark.lam@apple.com>
    215
  • trunk/Source/WebCore/page/scrolling/mac/ScrollingTreeScrollingNodeMac.mm

    r165069 r165233  
    349349        m_counterScrollingLayer.get().position = FloatPoint(scrollOffsetForFixedChildren);
    350350
    351     // Generally the banners should have the same horizontal-position computation as a fixed element. However,
    352     // the banners are not affected by the frameScaleFactor(), so if there is currently a non-1 frameScaleFactor()
    353     // then we should recompute scrollOffsetForFixedChildren for the banner with a scale factor of 1.
    354     float horizontalScrollOffsetForBanner = scrollOffsetForFixedChildren.width();
    355     if (frameScaleFactor() != 1)
    356         horizontalScrollOffsetForBanner = FrameView::scrollOffsetForFixedPosition(enclosingIntRect(viewportConstrainedObjectRect()), totalContentsSize(), flooredIntPoint(scrollOffset), scrollOrigin(), 1, false, behaviorForFixed, headerHeight(), footerHeight()).width();
    357 
    358     if (m_headerLayer)
    359         m_headerLayer.get().position = FloatPoint(horizontalScrollOffsetForBanner, 0);
    360 
    361     if (m_footerLayer)
    362         m_footerLayer.get().position = FloatPoint(horizontalScrollOffsetForBanner, totalContentsSize().height() - footerHeight());
     351    if (m_headerLayer || m_footerLayer) {
     352        // Generally the banners should have the same horizontal-position computation as a fixed element. However,
     353        // the banners are not affected by the frameScaleFactor(), so if there is currently a non-1 frameScaleFactor()
     354        // then we should recompute scrollOffsetForFixedChildren for the banner with a scale factor of 1.
     355        float horizontalScrollOffsetForBanner = scrollOffsetForFixedChildren.width();
     356        if (frameScaleFactor() != 1)
     357            horizontalScrollOffsetForBanner = FrameView::scrollOffsetForFixedPosition(enclosingIntRect(viewportConstrainedObjectRect()), totalContentsSize(), flooredIntPoint(scrollOffset), scrollOrigin(), 1, false, behaviorForFixed, headerHeight(), footerHeight()).width();
     358
     359        if (m_headerLayer)
     360            m_headerLayer.get().position = FloatPoint(horizontalScrollOffsetForBanner, 0);
     361
     362        if (m_footerLayer)
     363            m_footerLayer.get().position = FloatPoint(horizontalScrollOffsetForBanner, totalContentsSize().height() - footerHeight());
     364    }
    363365
    364366    FloatRect viewportRect = viewportConstrainedObjectRect();
Note: See TracChangeset for help on using the changeset viewer.