Bug 32081

Summary: repaint events from outside the viewport aren't received
Product: WebKit Reporter: Rafael Antognolli <antognolli+webkit>
Component: Layout and RenderingAssignee: Nobody <webkit-unassigned>
Status: RESOLVED FIXED    
Severity: Normal CC: benjamin, hyatt, kenneth, simon.fraser
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: All   
OS: All   
Attachments:
Description Flags
Patch adding a new paintEntireContents property.
none
Patch adding a new paintEntireContents property.
none
Patch adding a new paintsEntireContents property. simon.fraser: review+, simon.fraser: commit-queue-

Description Rafael Antognolli 2009-12-02 11:56:53 PST
Repaint events are clipped with the viewport area to prevent those that are fully outside the screen of triggering some rendering. This optimization prevents one of implementing backing stores that keeps some content of the page in a cache, because this cache should be marked as dirty when a repaint is called. Since the repaints are being clipped, no dirty area is marked.
Comment 1 Rafael Antognolli 2009-12-02 12:04:04 PST
Created attachment 44171 [details]
Patch adding a new paintEntireContents property.

This new property asks WebCore to request repaints even if they are out
of the screen. This is useful if implementing a backing store which
already has some area of the page rendered, but needs to know that
something has changed and so is now "dirty".
Comment 2 Simon Fraser (smfr) 2009-12-02 12:46:15 PST
Comment on attachment 44171 [details]
Patch adding a new paintEntireContents property.

Is m_paintEntireContents ever going to change for a given platform? In other words, could you just have a virtual method, bool paintsEntireContents() const, that returns false by default, and you override for platforms that need it?

> bool m_paintEntireContents; // should this be m_hasBacking ?

I like m_paintEntireContents.
Comment 3 Kenneth Rohde Christiansen 2009-12-02 13:12:03 PST
(In reply to comment #2)
> (From update of attachment 44171 [details])
> Is m_paintEntireContents ever going to change for a given platform? In other
> words, could you just have a virtual method, bool paintsEntireContents() const,
> that returns false by default, and you override for platforms that need it?
> 
> > bool m_paintEntireContents; // should this be m_hasBacking ?
> 
> I like m_paintEntireContents.

For Qt, we have two views, one canvas based and one widget based. It might make sense only implementing tiling for the canvas based one, or at least make it a configuration.
Comment 4 Rafael Antognolli 2009-12-02 13:22:19 PST
(In reply to comment #3)
> (In reply to comment #2)
> > (From update of attachment 44171 [details] [details])
> > Is m_paintEntireContents ever going to change for a given platform? In other
> > words, could you just have a virtual method, bool paintsEntireContents() const,
> > that returns false by default, and you override for platforms that need it?
> > 
> > > bool m_paintEntireContents; // should this be m_hasBacking ?
> > 
> > I like m_paintEntireContents.
> 
> For Qt, we have two views, one canvas based and one widget based. It might make
> sense only implementing tiling for the canvas based one, or at least make it a
> configuration.

For EFL we also have two views, and one of them uses a tiled backing store, the other one doesn't. So it would be good to have something configurable. But anyway, we can clip the repaint request on the single backing store later, if necessary...
Comment 5 Kenneth Rohde Christiansen 2009-12-02 14:05:39 PST
At least you should remove this comment

// should this be m_hasBacking ?

Can you update the patch?
Comment 6 Rafael Antognolli 2009-12-02 14:12:46 PST
Created attachment 44184 [details]
Patch adding a new paintEntireContents property.

Patch updated!
Comment 7 Kenneth Rohde Christiansen 2009-12-02 14:14:59 PST
Please remove or replace

+        No new tests. (OOPS!)

with

No change in behavior, so no new tests added.
Comment 8 Kenneth Rohde Christiansen 2009-12-02 14:16:51 PST
Another thing, shouldn't it be called paintEntireContent and not paintEntireContents - notice the trailing s.
Comment 9 Simon Fraser (smfr) 2009-12-02 14:24:11 PST
It should be paintsEntireContents. It's descriptive, not imperative.
Comment 10 Rafael Antognolli 2009-12-02 20:57:29 PST
Created attachment 44205 [details]
Patch adding a new paintsEntireContents property.

ok, updating property to paintsEntireContents and fixed the Changelog message of no tests added.
Comment 11 Simon Fraser (smfr) 2009-12-02 21:33:12 PST
Comment on attachment 44205 [details]
Patch adding a new paintsEntireContents property.

> diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog

> +2009-12-02  Rafael Antognolli  <antognolli@profusion.mobi>
> +
> +        Reviewed by NOBODY (OOPS!).
> +
> +        repaint events from outside the viewport aren't received
> +        https://bugs.webkit.org/show_bug.cgi?id=32081
> +

This Changelog entry needs to explain the justification for the change in more detail.
What does it mean for a view to paint its entire contents? Why does it need to be settable?

> diff --git a/WebCore/page/FrameView.cpp b/WebCore/page/FrameView.cpp

> +void ScrollView::setPaintsEntireContents(bool paint)
> +{
> +    m_paintsEntireContents = paint;
> +}

Parameter name could be improved: paintsEntireContents would be fine.

> +    if (!m_paintsEntireContents)

I have a slight preference for calling paintsEntireContents() here (it's inline, so no extra overhead),
so this code matches the code in FrameView.

> diff --git a/WebCore/platform/ScrollView.h b/WebCore/platform/ScrollView.h
> index dbbbff1..e269678 100644
> --- a/WebCore/platform/ScrollView.h
> +++ b/WebCore/platform/ScrollView.h
> @@ -92,6 +92,9 @@ public:
>      virtual void setCanHaveScrollbars(bool);
>      bool canHaveScrollbars() const { return horizontalScrollbarMode() != ScrollbarAlwaysOff || verticalScrollbarMode() != ScrollbarAlwaysOff; }
>  
> +    bool paintsEntireContents() const { return m_paintsEntireContents; }
> +    void setPaintsEntireContents(bool flag);

You can omit the parameter name here in the header. I'd like to see a comment here explaining the purpose of the 'paintsEntireContents' behavior.
Comment 12 Simon Fraser (smfr) 2009-12-02 21:33:39 PST
Comment on attachment 44205 [details]
Patch adding a new paintsEntireContents property.

Patch needs revision before commit, so commit-queue-
Comment 13 Kenneth Rohde Christiansen 2009-12-03 06:27:42 PST
Landed in r51636