[Webkit-unassigned] [Bug 33150] Do not render the full frame when there is some elements with fixed positioning

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Tue Feb 2 19:44:45 PST 2010


https://bugs.webkit.org/show_bug.cgi?id=33150





--- Comment #67 from Kenneth Rohde Christiansen <kenneth at webkit.org>  2010-02-02 19:44:40 PST ---
(From update of attachment 47964)

> +void FrameView::scrollContentsFastPath(const IntSize& scrollDelta, const IntRect& rectToScroll, const IntRect& clipRect)
> +{
> +    const size_t fixedObjectNumberThreshold = 5;
> +
> +    ListHashSet<RenderBox*>* positionedObjects = 0;
> +    if (RenderView* root = m_frame->contentRenderer())
> +        positionedObjects = root->positionedObjects();
> +
> +    if (!positionedObjects || positionedObjects->isEmpty())
> +        hostWindow()->scroll(scrollDelta, rectToScroll, clipRect);
> +    else {

Wouldn't a return above be nicer? instead of the else

> +        // Get the rects of the fixed objects visible in the rectToScroll
> +        Vector<IntRect, fixedObjectNumberThreshold> subRectToUpdate;
> +        bool updateInvalidatedSubRect = true;
> +        ListHashSet<RenderBox*>::const_iterator end = positionedObjects->end();
> +        for (ListHashSet<RenderBox*>::const_iterator it = positionedObjects->begin(); it != end; ++it) {

I would prefer "ListHashSet<RenderBox*>::const_iterator it =
positionedObjects->begin()" on its own line,
followed by "for (; it != end; ++it)"

> +            RenderBox* r = *it;

I find box a nicer variable name than r. r reminds me of rectangle!

> +            if (!(r->style()->position() == FixedPosition))

Why not just != ?

> +                continue;
> +            IntRect topLevelRect;
> +            IntRect updateRect = r->paintingRootRect(topLevelRect);
> +            updateRect.move(-scrollX(), -scrollY());
> +            updateRect.intersect(rectToScroll);
> +            if (!updateRect.isEmpty()) {
> +                if (subRectToUpdate.size() >= fixedObjectNumberThreshold) {

number threshold? why not just fixedObjectThreshold. 

> +                    updateInvalidatedSubRect = false;
> +                    break;
> +                }
> +                subRectToUpdate.append(updateRect);
> +            }
> +        }
> +
> +        // Scroll the view
> +        if (updateInvalidatedSubRect) {
> +            // 1) scroll
> +            hostWindow()->scroll(scrollDelta, rectToScroll, clipRect);
> +
> +            // 2) update the area of fixed objets that has been invalidated
> +            size_t fixObjectsCount = subRectToUpdate.size();
> +            for (size_t i = 0; i < fixObjectsCount; ++i) {
> +                IntRect updateRect = subRectToUpdate[i];
> +                IntRect scrolledRect = updateRect;
> +                scrolledRect.move(scrollDelta);
> +                updateRect.unite(scrolledRect);
> +                updateRect.intersect(rectToScroll);
> +                hostWindow()->repaint(updateRect, true, false, true);
> +            }
> +        } else {
> +            // the number of fixed objects exceed the threshold, so we repaint everything.
> +            IntRect updateRect = clipRect;
> +            updateRect.intersect(rectToScroll);
> +            hostWindow()->repaint(updateRect, true, false, true);
> +        }
> +    }
> +}

-- 
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.



More information about the webkit-unassigned mailing list