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

Changeset 181695 in webkit


Ignore:
Timestamp:
Mar 18, 2015, 9:22:04 AM (11 years ago)
Author:
Simon Fraser
Message:

Skip trying to paint overlay scrollbars when there are none or they are clipped out
https://bugs.webkit.org/show_bug.cgi?id=142811
rdar://problem/20200725

Reviewed by Darin Adler.

In some content with lots of layers and overflow:scroll, we could spend 20% of
the time under paintOverflowControlsForFragments() setting up an (empty) clip,
and then trying to draw scrollbars that we don't have.

Avoid calling paintOverflowControlsForFragments() if there are no scrollbars,
and don't both setting up an empty clip just to paint nothing.

  • rendering/RenderLayer.cpp:

(WebCore::RenderLayer::paintLayerContents):
(WebCore::RenderLayer::paintOverflowControlsForFragments):

Location:
trunk/Source/WebCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r181694 r181695  
     12015-03-17  Simon Fraser  <simon.fraser@apple.com>
     2
     3        Skip trying to paint overlay scrollbars when there are none or they are clipped out
     4        https://bugs.webkit.org/show_bug.cgi?id=142811
     5        rdar://problem/20200725
     6
     7        Reviewed by Darin Adler.
     8
     9        In some content with lots of layers and overflow:scroll, we could spend 20% of
     10        the time under paintOverflowControlsForFragments() setting up an (empty) clip,
     11        and then trying to draw scrollbars that we don't have.
     12       
     13        Avoid calling paintOverflowControlsForFragments() if there are no scrollbars,
     14        and don't both setting up an empty clip just to paint nothing.
     15
     16        * rendering/RenderLayer.cpp:
     17        (WebCore::RenderLayer::paintLayerContents):
     18        (WebCore::RenderLayer::paintOverflowControlsForFragments):
     19
    1202015-03-18  Per Arne Vollan  <peavo@outlook.com>
    221
  • trunk/Source/WebCore/rendering/RenderLayer.cpp

    r181654 r181695  
    43204320    }
    43214321
    4322     if (isPaintingOverlayScrollbars)
     4322    if (isPaintingOverlayScrollbars && hasScrollbars())
    43234323        paintOverflowControlsForFragments(layerFragments, context, localPaintingInfo);
    43244324
     
    46164616    RenderObject* subtreePaintRootForRenderer)
    46174617{
    4618     for (size_t i = 0; i < layerFragments.size(); ++i) {
    4619         const LayerFragment& fragment = layerFragments.at(i);
     4618    for (const auto& fragment : layerFragments) {
    46204619        if (!fragment.shouldPaintContent)
    46214620            continue;
     
    46474646    // Begin transparency if we have something to paint.
    46484647    if (haveTransparency) {
    4649         for (size_t i = 0; i < layerFragments.size(); ++i) {
    4650             const LayerFragment& fragment = layerFragments.at(i);
     4648        for (const auto& fragment : layerFragments) {
    46514649            if (fragment.shouldPaintContent && !fragment.foregroundRect.isEmpty()) {
    46524650                beginTransparencyLayers(transparencyLayerContext, localPaintingInfo, transparencyPaintDirtyRect);
     
    47044702    bool shouldClip = localPaintingInfo.clipToDirtyRect && layerFragments.size() > 1;
    47054703
    4706     for (size_t i = 0; i < layerFragments.size(); ++i) {
    4707         const LayerFragment& fragment = layerFragments.at(i);
     4704    for (const auto& fragment : layerFragments) {
    47084705        if (!fragment.shouldPaintContent || fragment.foregroundRect.isEmpty())
    47094706            continue;
     
    47254722    PaintBehavior paintBehavior, RenderObject* subtreePaintRootForRenderer)
    47264723{
    4727     for (size_t i = 0; i < layerFragments.size(); ++i) {
    4728         const LayerFragment& fragment = layerFragments.at(i);
     4724    for (const auto& fragment : layerFragments) {
    47294725        if (fragment.outlineRect.isEmpty())
    47304726            continue;
     
    47414737    RenderObject* subtreePaintRootForRenderer)
    47424738{
    4743     for (size_t i = 0; i < layerFragments.size(); ++i) {
    4744         const LayerFragment& fragment = layerFragments.at(i);
     4739    for (const auto& fragment : layerFragments) {
    47454740        if (!fragment.shouldPaintContent)
    47464741            continue;
     
    47624757    RenderObject* subtreePaintRootForRenderer)
    47634758{
    4764     for (size_t i = 0; i < layerFragments.size(); ++i) {
    4765         const LayerFragment& fragment = layerFragments.at(i);
     4759    for (const auto& fragment : layerFragments) {
    47664760        if (!fragment.shouldPaintContent)
    47674761            continue;
     
    47814775void RenderLayer::paintOverflowControlsForFragments(const LayerFragments& layerFragments, GraphicsContext* context, const LayerPaintingInfo& localPaintingInfo)
    47824776{
    4783     for (size_t i = 0; i < layerFragments.size(); ++i) {
    4784         const LayerFragment& fragment = layerFragments.at(i);
     4777    for (const auto& fragment : layerFragments) {
     4778        if (fragment.backgroundRect.isEmpty())
     4779            continue;
    47854780        clipToRect(localPaintingInfo, context, fragment.backgroundRect);
    47864781        paintOverflowControls(context, roundedIntPoint(toLayoutPoint(fragment.layerBounds.location() - renderBoxLocation() + localPaintingInfo.subpixelAccumulation)),
Note: See TracChangeset for help on using the changeset viewer.