Add window.internals.mainThreadScrollReasonsAsText for testing slow scrolling
authorwangxianzhu@chromium.org <wangxianzhu@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 12 Dec 2012 00:56:44 +0000 (00:56 +0000)
committerwangxianzhu@chromium.org <wangxianzhu@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 12 Dec 2012 00:56:44 +0000 (00:56 +0000)
https://bugs.webkit.org/show_bug.cgi?id=104714

Reviewed by Eric Seidel.

.:

Export symbol Page::mainThreadScrollingReasonsAsText().

* Source/autotools/symbols.filter:

Source/WebCore:

No new tests. Adds test api for bug 102543 and other bugs.

* WebCore.exp.in:
* page/Page.cpp:
(WebCore::ScrollingCoordinator::mainThreadScrollingReasonsAsText): Extracted from ScrollingStateScrollingNode::dumpProperties for layout tests.
(WebCore):
* page/Page.h:
(Page):
* page/scrolling/ScrollingCoordinator.cpp:
(WebCore::ScrollingCoordinator::mainThreadScrollingReasonsAsText):
(WebCore):
* page/scrolling/ScrollingCoordinator.h:
(ScrollingCoordinator):
* page/scrolling/ScrollingStateScrollingNode.cpp:
(WebCore::ScrollingStateScrollingNode::dumpProperties): Moved code for mainThreadScrollingReasons to ScrollingCoordinator.cpp.
* testing/Internals.cpp:
(WebCore::Internals::mainThreadScrollingReasons):
(WebCore):
* testing/Internals.h:
* testing/Internals.idl:

Source/WebKit2:

Export symbol Page::mainThreadScrollingReasonsAsText().

* win/WebKit2.def.in:

LayoutTests:

* platform/mac/tiled-drawing/scrolling-tree-slow-scrolling-expected.txt: Updated according to the change of mainThreadScrollingReasons about the trailing comma.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@137388 268f45cc-cd09-0410-ab3c-d52691b4dbfc

16 files changed:
ChangeLog
LayoutTests/ChangeLog
LayoutTests/platform/mac/tiled-drawing/scrolling-tree-slow-scrolling-expected.txt
Source/WebCore/ChangeLog
Source/WebCore/WebCore.exp.in
Source/WebCore/page/Page.cpp
Source/WebCore/page/Page.h
Source/WebCore/page/scrolling/ScrollingCoordinator.cpp
Source/WebCore/page/scrolling/ScrollingCoordinator.h
Source/WebCore/page/scrolling/ScrollingStateScrollingNode.cpp
Source/WebCore/testing/Internals.cpp
Source/WebCore/testing/Internals.h
Source/WebCore/testing/Internals.idl
Source/WebKit2/ChangeLog
Source/WebKit2/win/WebKit2.def.in
Source/autotools/symbols.filter

index 62beda4..3d1c15d 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2012-12-11  Xianzhu Wang  <wangxianzhu@chromium.org>
+
+        Add window.internals.mainThreadScrollReasonsAsText for testing slow scrolling
+        https://bugs.webkit.org/show_bug.cgi?id=104714
+
+        Reviewed by Eric Seidel.
+
+        Export symbol Page::mainThreadScrollingReasonsAsText().
+
+        * Source/autotools/symbols.filter:
+
 2012-12-11  Michael Pruett  <michael@68k.org>
 
         [JSC] Add tests for explicit serialization values
index d2fb1b3..06751c9 100644 (file)
@@ -1,3 +1,12 @@
+2012-12-11  Xianzhu Wang  <wangxianzhu@chromium.org>
+
+        Add window.internals.mainThreadScrollReasonsAsText for testing slow scrolling
+        https://bugs.webkit.org/show_bug.cgi?id=104714
+
+        Reviewed by Eric Seidel.
+
+        * platform/mac/tiled-drawing/scrolling-tree-slow-scrolling-expected.txt: Updated according to the change of mainThreadScrollingReasons about the trailing comma.
+
 2012-12-11  Beth Dakin  <bdakin@apple.com>
 
         https://bugs.webkit.org/show_bug.cgi?id=104735
index be4080c..32ef0ce 100644 (file)
@@ -1,6 +1,6 @@
 (Scrolling node
   (viewport rect 0 0 800 600)
   (contents size 800 600)
-  (Scrolling on main thread because: Has slow repaint objects)
+  (Scrolling on main thread because: Has slow repaint objects)
 )
 
index 846c071..0aafb21 100644 (file)
@@ -1,3 +1,31 @@
+2012-12-11  Xianzhu Wang  <wangxianzhu@chromium.org>
+
+        Add window.internals.mainThreadScrollReasonsAsText for testing slow scrolling
+        https://bugs.webkit.org/show_bug.cgi?id=104714
+
+        Reviewed by Eric Seidel.
+
+        No new tests. Adds test api for bug 102543 and other bugs.
+
+        * WebCore.exp.in:
+        * page/Page.cpp:
+        (WebCore::ScrollingCoordinator::mainThreadScrollingReasonsAsText): Extracted from ScrollingStateScrollingNode::dumpProperties for layout tests.
+        (WebCore):
+        * page/Page.h:
+        (Page):
+        * page/scrolling/ScrollingCoordinator.cpp:
+        (WebCore::ScrollingCoordinator::mainThreadScrollingReasonsAsText):
+        (WebCore):
+        * page/scrolling/ScrollingCoordinator.h:
+        (ScrollingCoordinator):
+        * page/scrolling/ScrollingStateScrollingNode.cpp:
+        (WebCore::ScrollingStateScrollingNode::dumpProperties): Moved code for mainThreadScrollingReasons to ScrollingCoordinator.cpp.
+        * testing/Internals.cpp:
+        (WebCore::Internals::mainThreadScrollingReasons):
+        (WebCore):
+        * testing/Internals.h:
+        * testing/Internals.idl:
+
 2012-12-11  Simon Fraser  <simon.fraser@apple.com>
 
         Enhance the TileCache to cache more tiles
index 3536011..e2e423a 100644 (file)
@@ -763,6 +763,7 @@ __ZN7WebCore4Page24scrollingStateTreeAsTextEv
 __ZN7WebCore4Page25suspendScriptedAnimationsEv
 __ZN7WebCore4Page31setCustomHTMLTokenizerChunkSizeEi
 __ZN7WebCore4Page31setCustomHTMLTokenizerTimeDelayEd
+__ZN7WebCore4Page32mainThreadScrollingReasonsAsTextEv
 __ZN7WebCore4Page32setMemoryCacheClientCallsEnabledEb
 __ZN7WebCore4Page35resumeActiveDOMObjectsAndAnimationsEv
 __ZN7WebCore4Page36setShouldSuppressScrollbarAnimationsEb
index 6e06618..b439148 100644 (file)
@@ -258,6 +258,17 @@ String Page::scrollingStateTreeAsText()
     return String();
 }
 
+String Page::mainThreadScrollingReasonsAsText()
+{
+    if (Document* document = m_mainFrame->document())
+        document->updateLayout();
+
+    if (ScrollingCoordinator* scrollingCoordinator = this->scrollingCoordinator())
+        return scrollingCoordinator->mainThreadScrollingReasonsAsText();
+
+    return String();
+}
+
 struct ViewModeInfo {
     const char* name;
     Page::ViewMode type;
index fb3b788..2c0b8b8 100644 (file)
@@ -199,6 +199,7 @@ namespace WebCore {
         ScrollingCoordinator* scrollingCoordinator();
 
         String scrollingStateTreeAsText();
+        String mainThreadScrollingReasonsAsText();
 
         Settings* settings() const { return m_settings.get(); }
         ProgressTracker* progress() const { return m_progress.get(); }
index 656f87e..bfd24df 100644 (file)
@@ -393,4 +393,29 @@ String ScrollingCoordinator::scrollingStateTreeAsText() const
     return String();
 }
 
+String ScrollingCoordinator::mainThreadScrollingReasonsAsText(MainThreadScrollingReasons reasons)
+{
+    StringBuilder stringBuilder;
+
+    if (reasons & ScrollingCoordinator::ForcedOnMainThread)
+        stringBuilder.append("Forced on main thread, ");
+    if (reasons & ScrollingCoordinator::HasSlowRepaintObjects)
+        stringBuilder.append("Has slow repaint objects, ");
+    if (reasons & ScrollingCoordinator::HasViewportConstrainedObjectsWithoutSupportingFixedLayers)
+        stringBuilder.append("Has viewport constrained objects without supporting fixed layers, ");
+    if (reasons & ScrollingCoordinator::HasNonLayerFixedObjects)
+        stringBuilder.append("Has non-layer fixed objects, ");
+    if (reasons & ScrollingCoordinator::IsImageDocument)
+        stringBuilder.append("Is image document, ");
+
+    if (stringBuilder.length())
+        stringBuilder.resize(stringBuilder.length() - 2);
+    return stringBuilder.toString();
+}
+
+String ScrollingCoordinator::mainThreadScrollingReasonsAsText() const
+{
+    return mainThreadScrollingReasonsAsText(mainThreadScrollingReasons());
+}
+
 } // namespace WebCore
index c2f1fa8..f2510cc 100644 (file)
@@ -150,6 +150,9 @@ public:
     virtual void setLayerIsContainerForFixedPositionLayers(GraphicsLayer*, bool) { }
     virtual void setLayerIsFixedToContainerLayer(GraphicsLayer*, bool) { }
 
+    static String mainThreadScrollingReasonsAsText(MainThreadScrollingReasons);
+    String mainThreadScrollingReasonsAsText() const;
+
 protected:
     explicit ScrollingCoordinator(Page*);
 
index 5d37be2..1ad5fa2 100644 (file)
@@ -227,18 +227,7 @@ void ScrollingStateScrollingNode::dumpProperties(TextStream& ts, int indent) con
 
     if (m_shouldUpdateScrollLayerPositionOnMainThread) {
         writeIndent(ts, indent + 1);
-        ts << "(Scrolling on main thread because: ";
-        if (m_shouldUpdateScrollLayerPositionOnMainThread & ScrollingCoordinator::ForcedOnMainThread)
-            ts << "Forced on main thread, ";
-        if (m_shouldUpdateScrollLayerPositionOnMainThread & ScrollingCoordinator::HasSlowRepaintObjects)
-            ts << "Has slow repaint objects, ";
-        if (m_shouldUpdateScrollLayerPositionOnMainThread & ScrollingCoordinator::HasViewportConstrainedObjectsWithoutSupportingFixedLayers)
-            ts << "Has viewport constrained objects without supporting fixed layers, ";
-        if (m_shouldUpdateScrollLayerPositionOnMainThread & ScrollingCoordinator::HasNonLayerFixedObjects)
-            ts << "Has non-layer fixed objects, ";
-        if (m_shouldUpdateScrollLayerPositionOnMainThread & ScrollingCoordinator::IsImageDocument)
-            ts << "Is image document";
-        ts << ")\n";
+        ts << "(Scrolling on main thread because: " << ScrollingCoordinator::mainThreadScrollingReasonsAsText(m_shouldUpdateScrollLayerPositionOnMainThread) << ")\n";
     }
 
     if (m_requestedScrollPosition != IntPoint()) {
index 915f4ed..85d25f5 100644 (file)
@@ -1460,6 +1460,20 @@ String Internals::scrollingStateTreeAsText(Document* document, ExceptionCode& ec
     return page->scrollingStateTreeAsText();
 }
 
+String Internals::mainThreadScrollingReasons(Document* document, ExceptionCode& ec) const
+{
+    if (!document || !document->frame()) {
+        ec = INVALID_ACCESS_ERR;
+        return String();
+    }
+
+    Page* page = document->page();
+    if (!page)
+        return String();
+
+    return page->mainThreadScrollingReasonsAsText();
+}
+
 void Internals::garbageCollectDocumentResources(Document* document, ExceptionCode& ec) const
 {
     if (!document) {
index 5bc2685..b121d9f 100644 (file)
@@ -208,6 +208,8 @@ public:
     String repaintRectsAsText(Document*, ExceptionCode&) const;
     String scrollingStateTreeAsText(Document*, ExceptionCode&) const;
 
+    String mainThreadScrollingReasons(Document*, ExceptionCode&) const;
+
     void garbageCollectDocumentResources(Document*, ExceptionCode&) const;
 
     void allowRoundingHacks() const;
index cdd3e38..163e676 100644 (file)
     DOMString layerTreeAsText(in Document document, in [Optional] unsigned short flags) raises (DOMException);
 
     DOMString scrollingStateTreeAsText(in Document document) raises (DOMException);
+    DOMString mainThreadScrollingReasons(in Document document) raises (DOMException);
 
     DOMString repaintRectsAsText(in Document document) raises (DOMException);
 
index 0370db1..7f8b784 100644 (file)
@@ -1,3 +1,14 @@
+2012-12-11  Xianzhu Wang  <wangxianzhu@chromium.org>
+
+        Add window.internals.mainThreadScrollReasonsAsText for testing slow scrolling
+        https://bugs.webkit.org/show_bug.cgi?id=104714
+
+        Reviewed by Eric Seidel.
+
+        Export symbol Page::mainThreadScrollingReasonsAsText().
+
+        * win/WebKit2.def.in:
+
 2012-12-11  Gwang Yoon Hwang  <ryumiel@company100.net>
 
         Coordinated Graphics: Rename LayerTreeCoordinator to CoordinatedLayerTreeHost
index 8816f90..4e8aade 100644 (file)
@@ -228,6 +228,7 @@ EXPORTS
         ?isPreloaded@CachedResourceLoader@WebCore@@QBE_NABVString@WTF@@@Z
         ?jsArray@WebCore@@YA?AVJSValue@JSC@@PAVExecState@3@PAVJSDOMGlobalObject@1@V?$PassRefPtr@VDOMStringList@WebCore@@@WTF@@@Z
         ?lastChangeWasUserEdit@HTMLTextFormControlElement@WebCore@@QBE_NXZ
+        ?mainThreadScrollingReasonsAsText@Page@WebCore@@QAE?AVString@WTF@@XZ
         ?markersFor@DocumentMarkerController@WebCore@@QAE?AV?$Vector@PAVDocumentMarker@WebCore@@$0A@@WTF@@PAVNode@2@VMarkerTypes@DocumentMarker@2@@Z
         ?nextSibling@ComposedShadowTreeWalker@WebCore@@QAEXXZ
         ?firstChild@ComposedShadowTreeWalker@WebCore@@QAEXXZ
index a8ce7d5..f87f834 100644 (file)
@@ -31,6 +31,7 @@ _ZN7WebCore4Page13setPaginationERKNS_10PaginationE;
 _ZN7WebCore4Page18setPageScaleFactorEfRKNS_8IntPointE;
 _ZN7WebCore4Page20setDeviceScaleFactorEf;
 _ZN7WebCore4Page24scrollingStateTreeAsTextEv;
+_ZN7WebCore4Page32mainThreadScrollingReasonsAsTextEv;
 _ZN7WebCore4Page16setCanStartMediaEb;
 _ZN7WebCore4toJSEPN3JSC9ExecStateEPNS_17JSDOMGlobalObjectEPNS_10ClientRectE;
 _ZN7WebCore4toJSEPN3JSC9ExecStateEPNS_17JSDOMGlobalObjectEPNS_10ShadowRootE;