Changeset 83832 in webkit


Ignore:
Timestamp:
Apr 14, 2011 3:46:14 AM (13 years ago)
Author:
aestes@apple.com
Message:

REGRESSION (r75555): Safari RSS sidebar jiggles when scrolling
https://bugs.webkit.org/show_bug.cgi?id=52988

Reviewed by Maciej Stachowiak.

Safari RSS relies on synchronous dispatch of ScrollEvent to update the
position of its sidebar during scrolling without producing a jiggling
effect. Due to r75555, this event is no longer dispatched synchronously
which results in stale repaints before the onscroll handler gets a
chance to update the position of the sidebar.

Since it is impractical to resolve this issue in Safari RSS itself, add
a quirk that restores synchronous ScrollEvent dispatch for Safari RSS.

No tests. This is an app-specific change that doesn't affect web
content.

  • Android.mk: Add platform/RuntimeApplicationChecks.[cpp|h]
  • CMakeLists.txt: Ditto.
  • GNUmakefile.list.am: Ditto.
  • WebCore.gypi: Ditto.
  • WebCore.pro: Ditto.
  • WebCore.vcproj/WebCore.vcproj: Ditto.
  • WebCore.xcodeproj/project.pbxproj: Ditto.
  • dom/EventQueue.cpp:

(WebCore::shouldDispatchScrollEventSynchronously): Send ScrollEvent
synchronously if the embedding application is Safari and the document's
URL scheme is "feed" or "feeds".
(WebCore::EventQueue::enqueueOrDispatchScrollEvent): Dispatch
ScrollEvent synchronously if shouldDispatchScrollEventSynchronously()
returns true.

  • dom/EventQueue.h:
  • page/EventHandler.cpp:

(WebCore::EventHandler::sendScrollEvent): Call enqueueOrDispatchScrollEvent().

  • platform/RuntimeApplicationChecks.cpp: Added.

(WebCore::mainBundleIsEqualTo): Add a helper routine for CF platforms
that checks if the main bundle's identifier is equal to a given string.
This function returns false for non-CF platforms.
(WebCore::applicationIsSafari): Call mainBundleIsEqualTo().
(WebCore::applicationIsAppleMail): Ditto.
(WebCore::applicationIsMicrosoftMessenger): Ditto.
(WebCore::applicationIsAdobeInstaller): Ditto.
(WebCore::applicationIsAOLInstantMessenger): Ditto.
(WebCore::applicationIsMicrosoftMyDay): Ditto.
(WebCore::applicationIsMicrosoftOutlook): Ditto.

  • platform/mac/RuntimeApplicationChecks.mm: Removed. Functions moved to

RuntimeApplicationChecks.cpp.

  • rendering/RenderLayer.cpp:

(WebCore::RenderLayer::scrollTo): Call enqueueOrDispatchScrollEvent().

  • rendering/RenderListBox.cpp:

(WebCore::RenderListBox::scrollTo): Call enqueueOrDispatchScrollEvent().

Location:
trunk/Source/WebCore
Files:
1 added
1 deleted
13 edited
1 moved

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/Android.mk

    r83636 r83832  
    487487        platform/Logging.cpp \
    488488        platform/MIMETypeRegistry.cpp \
     489        platform/RuntimeApplicationChecks.cpp \
    489490        platform/ScrollView.cpp \
    490491        platform/Scrollbar.cpp \
  • trunk/Source/WebCore/CMakeLists.txt

    r83792 r83832  
    10551055    platform/Logging.cpp
    10561056    platform/MIMETypeRegistry.cpp
     1057    platform/RuntimeApplicationChecks.cpp
    10571058    platform/ScrollAnimator.cpp
    10581059    platform/ScrollableArea.cpp
  • trunk/Source/WebCore/ChangeLog

    r83828 r83832  
     12011-04-14  Andy Estes  <aestes@apple.com>
     2
     3        Reviewed by Maciej Stachowiak.
     4
     5        REGRESSION (r75555): Safari RSS sidebar jiggles when scrolling
     6        https://bugs.webkit.org/show_bug.cgi?id=52988
     7       
     8        Safari RSS relies on synchronous dispatch of ScrollEvent to update the
     9        position of its sidebar during scrolling without producing a jiggling
     10        effect. Due to r75555, this event is no longer dispatched synchronously
     11        which results in stale repaints before the onscroll handler gets a
     12        chance to update the position of the sidebar.
     13       
     14        Since it is impractical to resolve this issue in Safari RSS itself, add
     15        a quirk that restores synchronous ScrollEvent dispatch for Safari RSS.
     16       
     17        No tests. This is an app-specific change that doesn't affect web
     18        content.
     19
     20        * Android.mk: Add platform/RuntimeApplicationChecks.[cpp|h]
     21        * CMakeLists.txt: Ditto.
     22        * GNUmakefile.list.am: Ditto.
     23        * WebCore.gypi: Ditto.
     24        * WebCore.pro: Ditto.
     25        * WebCore.vcproj/WebCore.vcproj: Ditto.
     26        * WebCore.xcodeproj/project.pbxproj: Ditto.
     27        * dom/EventQueue.cpp:
     28        (WebCore::shouldDispatchScrollEventSynchronously): Send ScrollEvent
     29        synchronously if the embedding application is Safari and the document's
     30        URL scheme is "feed" or "feeds".
     31        (WebCore::EventQueue::enqueueOrDispatchScrollEvent): Dispatch
     32        ScrollEvent synchronously if shouldDispatchScrollEventSynchronously()
     33        returns true.
     34        * dom/EventQueue.h:
     35        * page/EventHandler.cpp:
     36        (WebCore::EventHandler::sendScrollEvent): Call enqueueOrDispatchScrollEvent().
     37        * platform/RuntimeApplicationChecks.cpp: Added.
     38        (WebCore::mainBundleIsEqualTo): Add a helper routine for CF platforms
     39        that checks if the main bundle's identifier is equal to a given string.
     40        This function returns false for non-CF platforms.
     41        (WebCore::applicationIsSafari): Call mainBundleIsEqualTo().
     42        (WebCore::applicationIsAppleMail): Ditto.
     43        (WebCore::applicationIsMicrosoftMessenger): Ditto.
     44        (WebCore::applicationIsAdobeInstaller): Ditto.
     45        (WebCore::applicationIsAOLInstantMessenger): Ditto.
     46        (WebCore::applicationIsMicrosoftMyDay): Ditto.
     47        (WebCore::applicationIsMicrosoftOutlook): Ditto.
     48        * platform/mac/RuntimeApplicationChecks.mm: Removed. Functions moved to
     49        RuntimeApplicationChecks.cpp.
     50        * rendering/RenderLayer.cpp:
     51        (WebCore::RenderLayer::scrollTo): Call enqueueOrDispatchScrollEvent().
     52        * rendering/RenderListBox.cpp:
     53        (WebCore::RenderListBox::scrollTo): Call enqueueOrDispatchScrollEvent().
     54
    1552011-04-14  John Bates  <jbates@google.com>
    256
  • trunk/Source/WebCore/GNUmakefile.list.am

    r83636 r83832  
    25732573        Source/WebCore/platform/PurgeableBuffer.h \
    25742574        Source/WebCore/platform/PurgePriority.h \
     2575        Source/WebCore/platform/RuntimeApplicationChecks.cpp \
     2576        Source/WebCore/platform/RuntimeApplicationChecks.h \
    25752577        Source/WebCore/platform/SchemeRegistry.cpp \
    25762578        Source/WebCore/platform/SchemeRegistry.h \
  • trunk/Source/WebCore/WebCore.gypi

    r83791 r83832  
    771771            'platform/PopupMenuStyle.h',
    772772            'platform/PurgePriority.h',
     773            'platform/RuntimeApplicationChecks.h',
    773774            'platform/SchemeRegistry.h',
    774775            'platform/ScrollTypes.h',
     
    35573558            'platform/PurgeableBuffer.h',
    35583559            'platform/RunLoopTimer.h',
     3560            'platform/RuntimeApplicationChecks.cpp',
     3561            'platform/RuntimeApplicationChecks.h',
    35593562            'platform/SSLKeyGenerator.h',
    35603563            'platform/SchemeRegistry.cpp',
  • trunk/Source/WebCore/WebCore.pro

    r83729 r83832  
    10321032    platform/network/ResourceResponseBase.cpp \
    10331033    platform/text/RegularExpression.cpp \
     1034    platform/RuntimeApplicationChecks.cpp \
    10341035    platform/SchemeRegistry.cpp \
    10351036    platform/ScrollableArea.cpp \
  • trunk/Source/WebCore/WebCore.vcproj/WebCore.vcproj

    r83786 r83832  
    2617926179                        </File>
    2618026180                        <File
     26181                                RelativePath="..\platform\RuntimeApplicationChecks.cpp"
     26182                                >
     26183                        </File>
     26184                        <File
     26185                                RelativePath="..\platform\RuntimeApplicationChecks.h"
     26186                                >
     26187                        </File>
     26188                        <File
    2618126189                                RelativePath="..\platform\SchemeRegistry.cpp"
    2618226190                                >
  • trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj

    r83786 r83832  
    658658                2542F4DB1166C25A00E89A86 /* UserGestureIndicator.h in Headers */ = {isa = PBXBuildFile; fileRef = 2542F4D91166C25A00E89A86 /* UserGestureIndicator.h */; settings = {ATTRIBUTES = (Private, ); }; };
    659659                26E98A10130A9FCA008EB7B2 /* TextCodecASCIIFastPath.h in Headers */ = {isa = PBXBuildFile; fileRef = 26E98A0F130A9FCA008EB7B2 /* TextCodecASCIIFastPath.h */; };
     660                293EAE1F1356B2FE0067ACF9 /* RuntimeApplicationChecks.h in Headers */ = {isa = PBXBuildFile; fileRef = 293EAE1E1356B2FE0067ACF9 /* RuntimeApplicationChecks.h */; };
     661                293EAE211356B32E0067ACF9 /* RuntimeApplicationChecks.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 293EAE201356B32E0067ACF9 /* RuntimeApplicationChecks.cpp */; };
    660662                29489FC712C00F0300D83F0F /* AccessibilityScrollView.h in Headers */ = {isa = PBXBuildFile; fileRef = 29489FC512C00F0300D83F0F /* AccessibilityScrollView.h */; };
    661663                29A8122B0FBB9C1D00510293 /* AccessibilityTable.h in Headers */ = {isa = PBXBuildFile; fileRef = 29A8120D0FBB9C1D00510293 /* AccessibilityTable.h */; };
     
    10121014                44311CD912E4E257000A8D19 /* DOMDocumentFragmentPrivate.h in Copy Generated Headers */ = {isa = PBXBuildFile; fileRef = 44311CD412E4E22D000A8D19 /* DOMDocumentFragmentPrivate.h */; };
    10131015                44311F8212E4E66C000A8D19 /* DOMDocumentFragmentInternal.h in Headers */ = {isa = PBXBuildFile; fileRef = 85E711450AC5D5340053270F /* DOMDocumentFragmentInternal.h */; };
    1014                 447D69030FA626810015CCB1 /* RuntimeApplicationChecks.h in Headers */ = {isa = PBXBuildFile; fileRef = 447D69010FA626810015CCB1 /* RuntimeApplicationChecks.h */; settings = {ATTRIBUTES = (Private, ); }; };
    1015                 447D69040FA626810015CCB1 /* RuntimeApplicationChecks.mm in Sources */ = {isa = PBXBuildFile; fileRef = 447D69020FA626810015CCB1 /* RuntimeApplicationChecks.mm */; };
    10161016                448A29BF0A46D9CB0030759F /* JSHTMLOptionsCollection.h in Headers */ = {isa = PBXBuildFile; fileRef = 448A29BD0A46D9CB0030759F /* JSHTMLOptionsCollection.h */; };
    10171017                448A29C00A46D9CB0030759F /* JSHTMLOptionsCollection.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 448A29BE0A46D9CB0030759F /* JSHTMLOptionsCollection.cpp */; };
     
    70977097                2542F4D91166C25A00E89A86 /* UserGestureIndicator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UserGestureIndicator.h; sourceTree = "<group>"; };
    70987098                26E98A0F130A9FCA008EB7B2 /* TextCodecASCIIFastPath.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TextCodecASCIIFastPath.h; sourceTree = "<group>"; };
     7099                293EAE1E1356B2FE0067ACF9 /* RuntimeApplicationChecks.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RuntimeApplicationChecks.h; sourceTree = "<group>"; };
     7100                293EAE201356B32E0067ACF9 /* RuntimeApplicationChecks.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RuntimeApplicationChecks.cpp; sourceTree = "<group>"; };
    70997101                29489FC512C00F0300D83F0F /* AccessibilityScrollView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AccessibilityScrollView.h; sourceTree = "<group>"; };
    71007102                2981CA9D131822EC00D12F2A /* AccessibilityARIAGrid.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = AccessibilityARIAGrid.cpp; sourceTree = "<group>"; };
     
    75227524                44311CD412E4E22D000A8D19 /* DOMDocumentFragmentPrivate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DOMDocumentFragmentPrivate.h; sourceTree = "<group>"; };
    75237525                44311CD512E4E22D000A8D19 /* DOMDocumentPrivate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DOMDocumentPrivate.h; sourceTree = "<group>"; };
    7524                 447D69010FA626810015CCB1 /* RuntimeApplicationChecks.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RuntimeApplicationChecks.h; sourceTree = "<group>"; };
    7525                 447D69020FA626810015CCB1 /* RuntimeApplicationChecks.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = RuntimeApplicationChecks.mm; sourceTree = "<group>"; };
    75267526                448A29BD0A46D9CB0030759F /* JSHTMLOptionsCollection.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = JSHTMLOptionsCollection.h; sourceTree = "<group>"; };
    75277527                448A29BE0A46D9CB0030759F /* JSHTMLOptionsCollection.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = JSHTMLOptionsCollection.cpp; sourceTree = "<group>"; };
     
    1419514195                                0668E18E0ADD9640004128E0 /* PopupMenuMac.mm */,
    1419614196                                E4D687760ED7AE3D006EA978 /* PurgeableBufferMac.cpp */,
    14197                                 447D69010FA626810015CCB1 /* RuntimeApplicationChecks.h */,
    14198                                 447D69020FA626810015CCB1 /* RuntimeApplicationChecks.mm */,
    1419914197                                1CE24F960D7CAF0E007E04C2 /* SchedulePairMac.mm */,
    1420014198                                BCAE1FA512939DB7004CB026 /* ScrollAnimatorMac.h */,
     
    1866518663                                7E33CD00127F340D00BE8F17 /* PurgePriority.h */,
    1866618664                                1C63A2460F71646600C09D5A /* RunLoopTimer.h */,
     18665                                293EAE1E1356B2FE0067ACF9 /* RuntimeApplicationChecks.h */,
    1866718666                                5162C7F211F77EFA00612EFE /* SchemeRegistry.cpp */,
    1866818667                                5162C7F311F77EFB00612EFE /* SchemeRegistry.h */,
     
    1870718706                                9380F47209A11AB4001FDB34 /* Widget.h */,
    1870818707                                E1E1BEFF115FF6FB006F52CA /* WindowsKeyboardCodes.h */,
     18708                                293EAE201356B32E0067ACF9 /* RuntimeApplicationChecks.cpp */,
    1870918709                        );
    1871018710                        path = platform;
     
    2226122261                                1A569D230D7E2B82007C3983 /* runtime_object.h in Headers */,
    2226222262                                1A569D250D7E2B82007C3983 /* runtime_root.h in Headers */,
    22263                                 447D69030FA626810015CCB1 /* RuntimeApplicationChecks.h in Headers */,
    2226422263                                8C6EA61A11EF7E0400FD8EE3 /* RuntimeEnabledFeatures.h in Headers */,
    2226522264                                49E911CB0EF86D47009D0CAF /* ScaleTransformOperation.h in Headers */,
     
    2291422913                                22BD9F7F1353625C009BD102 /* ImageBufferData.h in Headers */,
    2291522914                                22BD9F81135364FE009BD102 /* ImageBufferDataCG.h in Headers */,
     22915                                293EAE1F1356B2FE0067ACF9 /* RuntimeApplicationChecks.h in Headers */,
    2291622916                        );
    2291722917                        runOnlyForDeploymentPostprocessing = 0;
     
    2509625096                                1A569D220D7E2B82007C3983 /* runtime_object.cpp in Sources */,
    2509725097                                1A569D240D7E2B82007C3983 /* runtime_root.cpp in Sources */,
    25098                                 447D69040FA626810015CCB1 /* RuntimeApplicationChecks.mm in Sources */,
    2509925098                                8C6EA61911EF7E0400FD8EE3 /* RuntimeEnabledFeatures.cpp in Sources */,
    2510025099                                49E911CA0EF86D47009D0CAF /* ScaleTransformOperation.cpp in Sources */,
     
    2561325612                                977E2E0E12F0FC9C00C13379 /* XSSFilter.cpp in Sources */,
    2561425613                                2292B27C1356669400CF11EF /* ImageBufferDataCG.cpp in Sources */,
     25614                                293EAE211356B32E0067ACF9 /* RuntimeApplicationChecks.cpp in Sources */,
    2561525615                        );
    2561625616                        runOnlyForDeploymentPostprocessing = 0;
  • trunk/Source/WebCore/dom/EventQueue.cpp

    r83128 r83832  
    2929
    3030#include "DOMWindow.h"
     31#include "Document.h"
    3132#include "Event.h"
    3233#include "EventNames.h"
     34#include "RuntimeApplicationChecks.h"
    3335#include "ScriptExecutionContext.h"
    3436#include "SuspendableTimer.h"
    3537
    3638namespace WebCore {
     39   
     40static inline bool shouldDispatchScrollEventSynchronously(Document* document)
     41{
     42    ASSERT_ARG(document, document);
     43    return applicationIsSafari() && (document->url().protocolIs("feed") || document->url().protocolIs("feeds"));
     44}
    3745
    3846class EventQueueTimer : public SuspendableTimer {
     
    7280}
    7381
    74 void EventQueue::enqueueScrollEvent(PassRefPtr<Node> target, ScrollEventTargetType targetType)
     82void EventQueue::enqueueOrDispatchScrollEvent(PassRefPtr<Node> target, ScrollEventTargetType targetType)
    7583{
     84    // Per the W3C CSSOM View Module, scroll events fired at the document should bubble, others should not.
     85    bool canBubble = targetType == ScrollEventDocumentTarget;
     86    RefPtr<Event> scrollEvent = Event::create(eventNames().scrollEvent, canBubble, false /* non cancelleable */);
     87     
     88    if (shouldDispatchScrollEventSynchronously(target->document())) {
     89        target->dispatchEvent(scrollEvent.release());
     90        return;
     91    }
     92
    7693    if (!m_nodesWithQueuedScrollEvents.add(target.get()).second)
    7794        return;
    7895
    79     // Per the W3C CSSOM View Module, scroll events fired at the document should bubble, others should not.
    80     bool canBubble = targetType == ScrollEventDocumentTarget;
    81     RefPtr<Event> scrollEvent = Event::create(eventNames().scrollEvent, canBubble, false /* non cancelleable */);
    8296    scrollEvent->setTarget(target);
    8397    enqueueEvent(scrollEvent.release());
  • trunk/Source/WebCore/dom/EventQueue.h

    r83128 r83832  
    5252
    5353    void enqueueEvent(PassRefPtr<Event>);
    54     void enqueueScrollEvent(PassRefPtr<Node>, ScrollEventTargetType);
     54    void enqueueOrDispatchScrollEvent(PassRefPtr<Node>, ScrollEventTargetType);
    5555    bool cancelEvent(Event*);
    5656    void cancelQueuedEvents();
  • trunk/Source/WebCore/page/EventHandler.cpp

    r83688 r83832  
    29692969    setFrameWasScrolledByUser();
    29702970    if (m_frame->view() && m_frame->document())
    2971         m_frame->document()->eventQueue()->enqueueScrollEvent(m_frame->document(), EventQueue::ScrollEventDocumentTarget);
     2971        m_frame->document()->eventQueue()->enqueueOrDispatchScrollEvent(m_frame->document(), EventQueue::ScrollEventDocumentTarget);
    29722972}
    29732973
  • trunk/Source/WebCore/rendering/RenderLayer.cpp

    r83820 r83832  
    14051405
    14061406    // Schedule the scroll DOM event.
    1407     renderer()->node()->document()->eventQueue()->enqueueScrollEvent(renderer()->node(), EventQueue::ScrollEventElementTarget);
     1407    renderer()->node()->document()->eventQueue()->enqueueOrDispatchScrollEvent(renderer()->node(), EventQueue::ScrollEventElementTarget);
    14081408}
    14091409
  • trunk/Source/WebCore/rendering/RenderListBox.cpp

    r82200 r83832  
    600600    m_indexOffset = newOffset;
    601601    repaint();
    602     node()->document()->eventQueue()->enqueueScrollEvent(node(), EventQueue::ScrollEventElementTarget);
     602    node()->document()->eventQueue()->enqueueOrDispatchScrollEvent(node(), EventQueue::ScrollEventElementTarget);
    603603}
    604604
Note: See TracChangeset for help on using the changeset viewer.