Changeset 240011 in webkit


Ignore:
Timestamp:
Jan 15, 2019 2:57:27 PM (5 years ago)
Author:
Simon Fraser
Message:

Clean up code related to the updating of Dashboard and touch event regions
https://bugs.webkit.org/show_bug.cgi?id=193460

Reviewed by Zalan Bujtas.

In preparation for layout testing that can count the number of event region
updates, move the code related to updating "annotated" (Dashboard) regions, and
touch event regions into bottleneck functions in Document.

Updating these two kinds of regions is generally similar, but there are some code paths
that eagerly update annotated regions.

No behavior change.

  • dom/Document.cpp:

(WebCore::Document::updateAnnotatedRegions): Moved from FrameView.
(WebCore::Document::invalidateRenderingDependentRegions):
(WebCore::Document::invalidateScrollbarDependentRegions):
(WebCore::Document::updateZOrderDependentRegions):

  • dom/Document.h:

(WebCore::Document::setAnnotatedRegionsDirty):
(WebCore::Document::annotatedRegionsDirty const):
(WebCore::Document::hasAnnotatedRegions const):

  • page/FrameView.cpp:

(WebCore::FrameView::didLayout):
(WebCore::FrameView::didPaintContents):
(WebCore::FrameView::updateAnnotatedRegions): Deleted.

  • page/FrameView.h:
  • rendering/RenderElement.cpp: Drive-by header cleanup.

(WebCore::RenderElement::styleWillChange):

  • rendering/RenderLayer.cpp:

(WebCore::RenderLayer::scrollTo):
(WebCore::RenderLayer::setHasHorizontalScrollbar):
(WebCore::RenderLayer::setHasVerticalScrollbar):
(WebCore::RenderLayer::updateScrollbarsAfterLayout):
(WebCore::RenderLayer::calculateClipRects const):

  • rendering/RenderListBox.cpp:

(WebCore::RenderListBox::setHasVerticalScrollbar):

Location:
trunk/Source/WebCore
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r240005 r240011  
     12019-01-15  Simon Fraser  <simon.fraser@apple.com>
     2
     3        Clean up code related to the updating of Dashboard and touch event regions
     4        https://bugs.webkit.org/show_bug.cgi?id=193460
     5
     6        Reviewed by Zalan Bujtas.
     7
     8        In preparation for layout testing that can count the number of event region
     9        updates, move the code related to updating "annotated" (Dashboard) regions, and
     10        touch event regions into bottleneck functions in Document.
     11       
     12        Updating these two kinds of regions is generally similar, but there are some code paths
     13        that eagerly update annotated regions.
     14
     15        No behavior change.
     16
     17        * dom/Document.cpp:
     18        (WebCore::Document::updateAnnotatedRegions): Moved from FrameView.
     19        (WebCore::Document::invalidateRenderingDependentRegions):
     20        (WebCore::Document::invalidateScrollbarDependentRegions):
     21        (WebCore::Document::updateZOrderDependentRegions):
     22        * dom/Document.h:
     23        (WebCore::Document::setAnnotatedRegionsDirty):
     24        (WebCore::Document::annotatedRegionsDirty const):
     25        (WebCore::Document::hasAnnotatedRegions const):
     26        * page/FrameView.cpp:
     27        (WebCore::FrameView::didLayout):
     28        (WebCore::FrameView::didPaintContents):
     29        (WebCore::FrameView::updateAnnotatedRegions): Deleted.
     30        * page/FrameView.h:
     31        * rendering/RenderElement.cpp: Drive-by header cleanup.
     32        (WebCore::RenderElement::styleWillChange):
     33        * rendering/RenderLayer.cpp:
     34        (WebCore::RenderLayer::scrollTo):
     35        (WebCore::RenderLayer::setHasHorizontalScrollbar):
     36        (WebCore::RenderLayer::setHasVerticalScrollbar):
     37        (WebCore::RenderLayer::updateScrollbarsAfterLayout):
     38        (WebCore::RenderLayer::calculateClipRects const):
     39        * rendering/RenderListBox.cpp:
     40        (WebCore::RenderListBox::setHasVerticalScrollbar):
     41
    1422019-01-15  David Kilzer  <ddkilzer@apple.com>
    243
  • trunk/Source/WebCore/dom/Document.cpp

    r239904 r240011  
    41004100
    41014101#if ENABLE(DASHBOARD_SUPPORT)
    4102 
    41034102const Vector<AnnotatedRegionValue>& Document::annotatedRegions() const
    41044103{
     
    41124111}
    41134112
    4114 #endif
     4113void Document::updateAnnotatedRegions()
     4114{
     4115    if (!hasAnnotatedRegions())
     4116        return;
     4117
     4118    Vector<AnnotatedRegionValue> newRegions;
     4119    renderBox()->collectAnnotatedRegions(newRegions); // FIXME.
     4120    if (newRegions == annotatedRegions())
     4121        return;
     4122
     4123    setAnnotatedRegions(newRegions);
     4124   
     4125    if (Page* page = this->page())
     4126        page->chrome().client().annotatedRegionsChanged();
     4127}
     4128#endif
     4129
     4130void Document::invalidateRenderingDependentRegions(AnnotationsAction annotationsAction)
     4131{
     4132#if ENABLE(DASHBOARD_SUPPORT)
     4133    // FIXME: we don't have a good invalidation/update policy for Dashboard regions. They get eagerly updated
     4134    // on forced layouts, and don't need to be.
     4135    if (annotationsAction == AnnotationsAction::Update)
     4136        updateAnnotatedRegions();
     4137    else
     4138        setAnnotatedRegionsDirty();
     4139#else
     4140    UNUSED_PARAM(annotationsAction);
     4141#endif
     4142
     4143#if PLATFORM(IOS_FAMILY) && ENABLE(TOUCH_EVENTS)
     4144    setTouchEventRegionsNeedUpdate();
     4145#endif
     4146}
     4147
     4148void Document::invalidateScrollbarDependentRegions()
     4149{
     4150#if ENABLE(DASHBOARD_SUPPORT)
     4151    if (hasAnnotatedRegions())
     4152        setAnnotatedRegionsDirty();
     4153#endif
     4154}
     4155
     4156void Document::updateZOrderDependentRegions()
     4157{
     4158#if ENABLE(DASHBOARD_SUPPORT)
     4159    if (annotatedRegionsDirty())
     4160        updateAnnotatedRegions();
     4161#endif
     4162}
    41154163
    41164164bool Document::setFocusedElement(Element* element, FocusDirection direction, FocusRemovalEventsMode eventsMode)
  • trunk/Source/WebCore/dom/Document.h

    r239864 r240011  
    11381138
    11391139#if ENABLE(DASHBOARD_SUPPORT)
    1140     void setAnnotatedRegionsDirty(bool f) { m_annotatedRegionsDirty = f; }
    1141     bool annotatedRegionsDirty() const { return m_annotatedRegionsDirty; }
    1142     bool hasAnnotatedRegions () const { return m_hasAnnotatedRegions; }
    11431140    void setHasAnnotatedRegions(bool f) { m_hasAnnotatedRegions = f; }
    11441141    WEBCORE_EXPORT const Vector<AnnotatedRegionValue>& annotatedRegions() const;
    1145     void setAnnotatedRegions(const Vector<AnnotatedRegionValue>&);
    1146 #endif
     1142#endif
     1143
     1144    enum class AnnotationsAction { Invalidate, Update };
     1145    void invalidateRenderingDependentRegions(AnnotationsAction = AnnotationsAction::Invalidate);
     1146    void invalidateScrollbarDependentRegions();
     1147    void updateZOrderDependentRegions();
    11471148
    11481149    void removeAllEventListeners() final;
     
    16351636    void wheelEventHandlersChanged();
    16361637
     1638#if ENABLE(DASHBOARD_SUPPORT)
     1639    void setAnnotatedRegionsDirty(bool f = true) { m_annotatedRegionsDirty = f; }
     1640    bool annotatedRegionsDirty() const { return m_annotatedRegionsDirty; }
     1641    bool hasAnnotatedRegions () const { return m_hasAnnotatedRegions; }
     1642    void setAnnotatedRegions(const Vector<AnnotatedRegionValue>&);
     1643    void updateAnnotatedRegions();
     1644#endif
     1645
    16371646    HttpEquivPolicy httpEquivPolicy() const;
    16381647    AXObjectCache* existingAXObjectCacheSlow() const;
  • trunk/Source/WebCore/page/FrameView.cpp

    r239689 r240011  
    13051305#endif
    13061306
    1307 #if ENABLE(DASHBOARD_SUPPORT)
    1308     updateAnnotatedRegions();
    1309 #endif
    1310 
    1311 #if ENABLE(IOS_TOUCH_EVENTS)
    1312     frame().document()->setTouchEventRegionsNeedUpdate();
    1313 #endif
     1307    frame().document()->invalidateRenderingDependentRegions(Document::AnnotationsAction::Update);
    13141308
    13151309    updateCanBlitOnScrollRecursively();
     
    38823876    return false;
    38833877}
    3884 
    3885 #if ENABLE(DASHBOARD_SUPPORT)
    3886 void FrameView::updateAnnotatedRegions()
    3887 {
    3888     Document* document = frame().document();
    3889     if (!document->hasAnnotatedRegions())
    3890         return;
    3891     Vector<AnnotatedRegionValue> newRegions;
    3892     document->renderBox()->collectAnnotatedRegions(newRegions);
    3893     if (newRegions == document->annotatedRegions())
    3894         return;
    3895     document->setAnnotatedRegions(newRegions);
    3896     Page* page = frame().page();
    3897     if (!page)
    3898         return;
    3899     page->chrome().client().annotatedRegionsChanged();
    3900 }
    3901 #endif
    39023878
    39033879void FrameView::updateScrollCorner()
     
    41784154
    41794155    // Regions may have changed as a result of the visibility/z-index of element changing.
    4180 #if ENABLE(DASHBOARD_SUPPORT)
    4181     if (frame().document()->annotatedRegionsDirty())
    4182         updateAnnotatedRegions();
    4183 #endif
     4156    frame().document()->updateZOrderDependentRegions();
    41844157
    41854158    if (paintingState.isTopLevelPainter)
  • trunk/Source/WebCore/page/FrameView.h

    r239689 r240011  
    334334    void loadProgressingStatusChanged();
    335335
    336 #if ENABLE(DASHBOARD_SUPPORT)
    337     void updateAnnotatedRegions();
    338 #endif
    339336    WEBCORE_EXPORT void updateControlTints();
    340337
  • trunk/Source/WebCore/rendering/RenderElement.cpp

    r239173 r240011  
    4949#include "RenderFlexibleBox.h"
    5050#include "RenderFragmentedFlow.h"
     51#include "RenderGrid.h"
    5152#include "RenderImage.h"
    5253#include "RenderImageResourceStyleImage.h"
     
    7980#include <wtf/MathExtras.h>
    8081#include <wtf/StackStats.h>
    81 
    82 #include "RenderGrid.h"
    8382
    8483namespace WebCore {
     
    710709            || m_style.zIndex() != newStyle.zIndex()
    711710            || m_style.hasAutoZIndex() != newStyle.hasAutoZIndex();
    712 #if ENABLE(DASHBOARD_SUPPORT)
     711
    713712        if (visibilityChanged)
    714             document().setAnnotatedRegionsDirty(true);
    715 #endif
    716 #if PLATFORM(IOS_FAMILY) && ENABLE(TOUCH_EVENTS)
    717         if (visibilityChanged)
    718             document().setTouchEventRegionsNeedUpdate();
    719 #endif
     713            document().invalidateRenderingDependentRegions();
     714
    720715        if (visibilityChanged) {
    721716            if (AXObjectCache* cache = document().existingAXObjectCache())
     
    738733        if (m_parent && (newStyle.outlineSize() < m_style.outlineSize() || shouldRepaintForStyleDifference(diff)))
    739734            repaint();
     735
    740736        if (isFloating() && m_style.floating() != newStyle.floating()) {
    741737            // For changes in float styles, we need to conceivably remove ourselves
  • trunk/Source/WebCore/rendering/RenderLayer.cpp

    r239985 r240011  
    23932393        // If we're in the middle of layout, we'll just update layers once layout has finished.
    23942394        updateLayerPositionsAfterOverflowScroll();
    2395         // Update regions, scrolling may change the clip of a particular region.
    2396 #if ENABLE(DASHBOARD_SUPPORT)
    2397         view.frameView().updateAnnotatedRegions();
    2398 #endif
     2395
    23992396        view.frameView().scheduleUpdateWidgetPositions();
    24002397
     
    24122409        }
    24132410
    2414 #if PLATFORM(IOS_FAMILY) && ENABLE(TOUCH_EVENTS)
    2415         renderer().document().setTouchEventRegionsNeedUpdate();
    2416 #endif
     2411        // Update regions, scrolling may change the clip of a particular region.
     2412        renderer().document().invalidateRenderingDependentRegions(Document::AnnotationsAction::Update);
    24172413        DebugPageOverlays::didLayout(renderer().frame());
    24182414    }
     
    31943190        m_vBar->styleChanged();
    31953191
    3196     // Force an update since we know the scrollbars have changed things.
    3197 #if ENABLE(DASHBOARD_SUPPORT)
    3198     if (renderer().document().hasAnnotatedRegions())
    3199         renderer().document().setAnnotatedRegionsDirty(true);
    3200 #endif
     3192    renderer().document().invalidateScrollbarDependentRegions();
    32013193}
    32023194
     
    32253217        m_vBar->styleChanged();
    32263218
    3227     // Force an update since we know the scrollbars have changed things.
    3228 #if ENABLE(DASHBOARD_SUPPORT)
    3229     if (renderer().document().hasAnnotatedRegions())
    3230         renderer().document().setAnnotatedRegionsDirty(true);
    3231 #endif
     3219    renderer().document().invalidateScrollbarDependentRegions();
    32323220}
    32333221
     
    34953483        updateSelfPaintingLayer();
    34963484
    3497         // Force an update since we know the scrollbars have changed things.
    3498 #if ENABLE(DASHBOARD_SUPPORT)
    3499         if (renderer().document().hasAnnotatedRegions())
    3500             renderer().document().setAnnotatedRegionsDirty(true);
    3501 #endif
    3502 
     3485        renderer().document().invalidateScrollbarDependentRegions();
    35033486        renderer().repaint();
    35043487
     
    63806363#if PLATFORM(IOS_FAMILY) && ENABLE(TOUCH_EVENTS)
    63816364    if (diff == StyleDifference::RecompositeLayer || diff >= StyleDifference::LayoutPositionedMovementOnly)
    6382         renderer().document().setTouchEventRegionsNeedUpdate();
     6365        renderer().document().invalidateRenderingDependentRegions();
    63836366#else
    63846367    UNUSED_PARAM(diff);
  • trunk/Source/WebCore/rendering/RenderListBox.cpp

    r239461 r240011  
    955955        m_vBar->styleChanged();
    956956
    957     // Force an update since we know the scrollbars have changed things.
    958 #if ENABLE(DASHBOARD_SUPPORT)
    959     if (document().hasAnnotatedRegions())
    960         document().setAnnotatedRegionsDirty(true);
    961 #endif
     957    document().invalidateScrollbarDependentRegions();
    962958}
    963959
Note: See TracChangeset for help on using the changeset viewer.