Regression(r176212): Carousel on mbusa.com is choppy
authorcdumez@apple.com <cdumez@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 6 Jan 2015 17:57:52 +0000 (17:57 +0000)
committercdumez@apple.com <cdumez@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 6 Jan 2015 17:57:52 +0000 (17:57 +0000)
commit85cab2fe19e2e3994120ba2523aa584ffeb4b33a
tree8f5e4b16a1105d3b97abab0a5b01a28f7816a027
parent3bf504f55657e02e38ea09547512625a845ef625
Regression(r176212): Carousel on mbusa.com is choppy
https://bugs.webkit.org/show_bug.cgi?id=139543
<rdar://problem/19209406>

Reviewed by Antti Koivisto.

Source/WebCore:

A repeating DOM timer changing the style of an element that has
overflowing content that is visible would get throttled in the
case where the overflowing content has its own layer. This is
because the repaint rect returned by
RenderObject::absoluteClippedOverflowRect() does not take into
consideration descendants with their own self-painting layer when
accounting for the overflow.

Until I can find a relatively cheap way of computing the overflow
in this case, this patch takes the conservative approach and
assumes we may repaint inside the viewport if the element does not
have a layer or if any of its descendants has its own layer.

This patch also renames isInsideViewport() function to
mayCauseRepaintInsideViewport() for clarity.

Tests: fast/dom/repeating-timer-element-overflow-hidden-throttling.html
       fast/dom/repeating-timer-element-overflowing-child-own-layer-throttling.html

* dom/Element.cpp:
(WebCore::Element::mayCauseRepaintInsideViewport):
(WebCore::Element::isInsideViewport): Deleted.
* dom/Element.h:
* page/DOMTimer.cpp:
(WebCore::DOMTimer::scriptDidCauseElementRepaint):
(WebCore::DOMTimer::updateThrottlingStateAfterViewportChange):
* rendering/RenderElement.cpp:
(WebCore::RenderElement::mayCauseRepaintInsideViewport):
(WebCore::RenderElement::isInsideViewport): Deleted.
* rendering/RenderElement.h:

LayoutTests:

Add a layout test to cover the case where a repeating DOM timer is
changing the style of an element which has overflowing content that
is visible and has its own layer. In such case, the DOM timer should
not be throttled. Also add a layout test to make sure we still throttle
if the element clips its overflow.

* fast/dom/repeating-timer-element-overflow-hidden-throttling-expected.txt: Added.
* fast/dom/repeating-timer-element-overflow-hidden-throttling.html: Added.
* fast/dom/repeating-timer-element-overflowing-child-own-layer-throttling-expected.txt: Added.
* fast/dom/repeating-timer-element-overflowing-child-own-layer-throttling.html: Added.
New tests.

* fast/dom/timer-unthrottle-on-layout-expected.txt:
* fast/dom/timer-unthrottle-on-layout.html:
* fast/dom/timer-unthrottle-on-scroll-expected.txt:
* fast/dom/timer-unthrottle-on-scroll.html:
Stop using <input> test elements as it appears one of the descendants
in its shadow tree has its own layer.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@177964 268f45cc-cd09-0410-ab3c-d52691b4dbfc
15 files changed:
LayoutTests/ChangeLog
LayoutTests/fast/dom/repeating-timer-element-overflow-hidden-throttling-expected.txt [new file with mode: 0644]
LayoutTests/fast/dom/repeating-timer-element-overflow-hidden-throttling.html [new file with mode: 0644]
LayoutTests/fast/dom/repeating-timer-element-overflowing-child-own-layer-throttling-expected.txt [new file with mode: 0644]
LayoutTests/fast/dom/repeating-timer-element-overflowing-child-own-layer-throttling.html [new file with mode: 0644]
LayoutTests/fast/dom/timer-unthrottle-on-layout-expected.txt
LayoutTests/fast/dom/timer-unthrottle-on-layout.html
LayoutTests/fast/dom/timer-unthrottle-on-scroll-expected.txt
LayoutTests/fast/dom/timer-unthrottle-on-scroll.html
Source/WebCore/ChangeLog
Source/WebCore/dom/Element.cpp
Source/WebCore/dom/Element.h
Source/WebCore/page/DOMTimer.cpp
Source/WebCore/rendering/RenderElement.cpp
Source/WebCore/rendering/RenderElement.h