- Revision
- 240011
- Author
- [email protected]
- Date
- 2019-01-15 14:57:27 -0800 (Tue, 15 Jan 2019)
Log 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):
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (240010 => 240011)
--- trunk/Source/WebCore/ChangeLog 2019-01-15 22:53:39 UTC (rev 240010)
+++ trunk/Source/WebCore/ChangeLog 2019-01-15 22:57:27 UTC (rev 240011)
@@ -1,3 +1,44 @@
+2019-01-15 Simon Fraser <[email protected]>
+
+ 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):
+
2019-01-15 David Kilzer <[email protected]>
Let Xcode have its way with the WebCore project
Modified: trunk/Source/WebCore/dom/Document.cpp (240010 => 240011)
--- trunk/Source/WebCore/dom/Document.cpp 2019-01-15 22:53:39 UTC (rev 240010)
+++ trunk/Source/WebCore/dom/Document.cpp 2019-01-15 22:57:27 UTC (rev 240011)
@@ -4099,7 +4099,6 @@
}
#if ENABLE(DASHBOARD_SUPPORT)
-
const Vector<AnnotatedRegionValue>& Document::annotatedRegions() const
{
return m_annotatedRegions;
@@ -4111,8 +4110,57 @@
setAnnotatedRegionsDirty(false);
}
+void Document::updateAnnotatedRegions()
+{
+ if (!hasAnnotatedRegions())
+ return;
+
+ Vector<AnnotatedRegionValue> newRegions;
+ renderBox()->collectAnnotatedRegions(newRegions); // FIXME.
+ if (newRegions == annotatedRegions())
+ return;
+
+ setAnnotatedRegions(newRegions);
+
+ if (Page* page = this->page())
+ page->chrome().client().annotatedRegionsChanged();
+}
#endif
+void Document::invalidateRenderingDependentRegions(AnnotationsAction annotationsAction)
+{
+#if ENABLE(DASHBOARD_SUPPORT)
+ // FIXME: we don't have a good invalidation/update policy for Dashboard regions. They get eagerly updated
+ // on forced layouts, and don't need to be.
+ if (annotationsAction == AnnotationsAction::Update)
+ updateAnnotatedRegions();
+ else
+ setAnnotatedRegionsDirty();
+#else
+ UNUSED_PARAM(annotationsAction);
+#endif
+
+#if PLATFORM(IOS_FAMILY) && ENABLE(TOUCH_EVENTS)
+ setTouchEventRegionsNeedUpdate();
+#endif
+}
+
+void Document::invalidateScrollbarDependentRegions()
+{
+#if ENABLE(DASHBOARD_SUPPORT)
+ if (hasAnnotatedRegions())
+ setAnnotatedRegionsDirty();
+#endif
+}
+
+void Document::updateZOrderDependentRegions()
+{
+#if ENABLE(DASHBOARD_SUPPORT)
+ if (annotatedRegionsDirty())
+ updateAnnotatedRegions();
+#endif
+}
+
bool Document::setFocusedElement(Element* element, FocusDirection direction, FocusRemovalEventsMode eventsMode)
{
RefPtr<Element> newFocusedElement = element;
Modified: trunk/Source/WebCore/dom/Document.h (240010 => 240011)
--- trunk/Source/WebCore/dom/Document.h 2019-01-15 22:53:39 UTC (rev 240010)
+++ trunk/Source/WebCore/dom/Document.h 2019-01-15 22:57:27 UTC (rev 240011)
@@ -1137,14 +1137,15 @@
WEBCORE_EXPORT String displayStringModifiedByEncoding(const String&) const;
#if ENABLE(DASHBOARD_SUPPORT)
- void setAnnotatedRegionsDirty(bool f) { m_annotatedRegionsDirty = f; }
- bool annotatedRegionsDirty() const { return m_annotatedRegionsDirty; }
- bool hasAnnotatedRegions () const { return m_hasAnnotatedRegions; }
void setHasAnnotatedRegions(bool f) { m_hasAnnotatedRegions = f; }
WEBCORE_EXPORT const Vector<AnnotatedRegionValue>& annotatedRegions() const;
- void setAnnotatedRegions(const Vector<AnnotatedRegionValue>&);
#endif
+ enum class AnnotationsAction { Invalidate, Update };
+ void invalidateRenderingDependentRegions(AnnotationsAction = AnnotationsAction::Invalidate);
+ void invalidateScrollbarDependentRegions();
+ void updateZOrderDependentRegions();
+
void removeAllEventListeners() final;
WEBCORE_EXPORT const SVGDocumentExtensions* svgExtensions();
@@ -1634,6 +1635,14 @@
void wheelEventHandlersChanged();
+#if ENABLE(DASHBOARD_SUPPORT)
+ void setAnnotatedRegionsDirty(bool f = true) { m_annotatedRegionsDirty = f; }
+ bool annotatedRegionsDirty() const { return m_annotatedRegionsDirty; }
+ bool hasAnnotatedRegions () const { return m_hasAnnotatedRegions; }
+ void setAnnotatedRegions(const Vector<AnnotatedRegionValue>&);
+ void updateAnnotatedRegions();
+#endif
+
HttpEquivPolicy httpEquivPolicy() const;
AXObjectCache* existingAXObjectCacheSlow() const;
Modified: trunk/Source/WebCore/page/FrameView.cpp (240010 => 240011)
--- trunk/Source/WebCore/page/FrameView.cpp 2019-01-15 22:53:39 UTC (rev 240010)
+++ trunk/Source/WebCore/page/FrameView.cpp 2019-01-15 22:57:27 UTC (rev 240011)
@@ -1304,14 +1304,8 @@
cache->postNotification(layoutRoot.get(), AXObjectCache::AXLayoutComplete);
#endif
-#if ENABLE(DASHBOARD_SUPPORT)
- updateAnnotatedRegions();
-#endif
+ frame().document()->invalidateRenderingDependentRegions(Document::AnnotationsAction::Update);
-#if ENABLE(IOS_TOUCH_EVENTS)
- frame().document()->setTouchEventRegionsNeedUpdate();
-#endif
-
updateCanBlitOnScrollRecursively();
handleDeferredScrollUpdateAfterContentSizeChange();
@@ -3882,24 +3876,6 @@
return false;
}
-#if ENABLE(DASHBOARD_SUPPORT)
-void FrameView::updateAnnotatedRegions()
-{
- Document* document = frame().document();
- if (!document->hasAnnotatedRegions())
- return;
- Vector<AnnotatedRegionValue> newRegions;
- document->renderBox()->collectAnnotatedRegions(newRegions);
- if (newRegions == document->annotatedRegions())
- return;
- document->setAnnotatedRegions(newRegions);
- Page* page = frame().page();
- if (!page)
- return;
- page->chrome().client().annotatedRegionsChanged();
-}
-#endif
-
void FrameView::updateScrollCorner()
{
RenderElement* renderer = nullptr;
@@ -4177,10 +4153,7 @@
m_lastPaintTime = MonotonicTime::now();
// Regions may have changed as a result of the visibility/z-index of element changing.
-#if ENABLE(DASHBOARD_SUPPORT)
- if (frame().document()->annotatedRegionsDirty())
- updateAnnotatedRegions();
-#endif
+ frame().document()->updateZOrderDependentRegions();
if (paintingState.isTopLevelPainter)
sCurrentPaintTimeStamp = MonotonicTime();
Modified: trunk/Source/WebCore/page/FrameView.h (240010 => 240011)
--- trunk/Source/WebCore/page/FrameView.h 2019-01-15 22:53:39 UTC (rev 240010)
+++ trunk/Source/WebCore/page/FrameView.h 2019-01-15 22:57:27 UTC (rev 240011)
@@ -333,9 +333,6 @@
bool speculativeTilingEnabled() const { return m_speculativeTilingEnabled; }
void loadProgressingStatusChanged();
-#if ENABLE(DASHBOARD_SUPPORT)
- void updateAnnotatedRegions();
-#endif
WEBCORE_EXPORT void updateControlTints();
WEBCORE_EXPORT bool wasScrolledByUser() const;
Modified: trunk/Source/WebCore/rendering/RenderElement.cpp (240010 => 240011)
--- trunk/Source/WebCore/rendering/RenderElement.cpp 2019-01-15 22:53:39 UTC (rev 240010)
+++ trunk/Source/WebCore/rendering/RenderElement.cpp 2019-01-15 22:57:27 UTC (rev 240011)
@@ -48,6 +48,7 @@
#include "RenderDescendantIterator.h"
#include "RenderFlexibleBox.h"
#include "RenderFragmentedFlow.h"
+#include "RenderGrid.h"
#include "RenderImage.h"
#include "RenderImageResourceStyleImage.h"
#include "RenderInline.h"
@@ -79,8 +80,6 @@
#include <wtf/MathExtras.h>
#include <wtf/StackStats.h>
-#include "RenderGrid.h"
-
namespace WebCore {
WTF_MAKE_ISO_ALLOCATED_IMPL(RenderElement);
@@ -709,14 +708,10 @@
bool visibilityChanged = m_style.visibility() != newStyle.visibility()
|| m_style.zIndex() != newStyle.zIndex()
|| m_style.hasAutoZIndex() != newStyle.hasAutoZIndex();
-#if ENABLE(DASHBOARD_SUPPORT)
+
if (visibilityChanged)
- document().setAnnotatedRegionsDirty(true);
-#endif
-#if PLATFORM(IOS_FAMILY) && ENABLE(TOUCH_EVENTS)
- if (visibilityChanged)
- document().setTouchEventRegionsNeedUpdate();
-#endif
+ document().invalidateRenderingDependentRegions();
+
if (visibilityChanged) {
if (AXObjectCache* cache = document().existingAXObjectCache())
cache->childrenChanged(parent(), this);
@@ -737,6 +732,7 @@
if (m_parent && (newStyle.outlineSize() < m_style.outlineSize() || shouldRepaintForStyleDifference(diff)))
repaint();
+
if (isFloating() && m_style.floating() != newStyle.floating()) {
// For changes in float styles, we need to conceivably remove ourselves
// from the floating objects list.
Modified: trunk/Source/WebCore/rendering/RenderLayer.cpp (240010 => 240011)
--- trunk/Source/WebCore/rendering/RenderLayer.cpp 2019-01-15 22:53:39 UTC (rev 240010)
+++ trunk/Source/WebCore/rendering/RenderLayer.cpp 2019-01-15 22:57:27 UTC (rev 240011)
@@ -2392,10 +2392,7 @@
if (!view.frameView().layoutContext().isInRenderTreeLayout()) {
// If we're in the middle of layout, we'll just update layers once layout has finished.
updateLayerPositionsAfterOverflowScroll();
- // Update regions, scrolling may change the clip of a particular region.
-#if ENABLE(DASHBOARD_SUPPORT)
- view.frameView().updateAnnotatedRegions();
-#endif
+
view.frameView().scheduleUpdateWidgetPositions();
if (!m_updatingMarqueePosition) {
@@ -2411,9 +2408,8 @@
updateCompositingLayersAfterScroll();
}
-#if PLATFORM(IOS_FAMILY) && ENABLE(TOUCH_EVENTS)
- renderer().document().setTouchEventRegionsNeedUpdate();
-#endif
+ // Update regions, scrolling may change the clip of a particular region.
+ renderer().document().invalidateRenderingDependentRegions(Document::AnnotationsAction::Update);
DebugPageOverlays::didLayout(renderer().frame());
}
@@ -3193,11 +3189,7 @@
if (m_vBar)
m_vBar->styleChanged();
- // Force an update since we know the scrollbars have changed things.
-#if ENABLE(DASHBOARD_SUPPORT)
- if (renderer().document().hasAnnotatedRegions())
- renderer().document().setAnnotatedRegionsDirty(true);
-#endif
+ renderer().document().invalidateScrollbarDependentRegions();
}
void RenderLayer::setHasVerticalScrollbar(bool hasScrollbar)
@@ -3224,11 +3216,7 @@
if (m_vBar)
m_vBar->styleChanged();
- // Force an update since we know the scrollbars have changed things.
-#if ENABLE(DASHBOARD_SUPPORT)
- if (renderer().document().hasAnnotatedRegions())
- renderer().document().setAnnotatedRegionsDirty(true);
-#endif
+ renderer().document().invalidateScrollbarDependentRegions();
}
ScrollableArea* RenderLayer::enclosingScrollableArea() const
@@ -3494,12 +3482,7 @@
updateSelfPaintingLayer();
- // Force an update since we know the scrollbars have changed things.
-#if ENABLE(DASHBOARD_SUPPORT)
- if (renderer().document().hasAnnotatedRegions())
- renderer().document().setAnnotatedRegionsDirty(true);
-#endif
-
+ renderer().document().invalidateScrollbarDependentRegions();
renderer().repaint();
if (renderer().style().overflowX() == Overflow::Auto || renderer().style().overflowY() == Overflow::Auto) {
@@ -6379,7 +6362,7 @@
#if PLATFORM(IOS_FAMILY) && ENABLE(TOUCH_EVENTS)
if (diff == StyleDifference::RecompositeLayer || diff >= StyleDifference::LayoutPositionedMovementOnly)
- renderer().document().setTouchEventRegionsNeedUpdate();
+ renderer().document().invalidateRenderingDependentRegions();
#else
UNUSED_PARAM(diff);
#endif
Modified: trunk/Source/WebCore/rendering/RenderListBox.cpp (240010 => 240011)
--- trunk/Source/WebCore/rendering/RenderListBox.cpp 2019-01-15 22:53:39 UTC (rev 240010)
+++ trunk/Source/WebCore/rendering/RenderListBox.cpp 2019-01-15 22:57:27 UTC (rev 240011)
@@ -954,11 +954,7 @@
if (m_vBar)
m_vBar->styleChanged();
- // Force an update since we know the scrollbars have changed things.
-#if ENABLE(DASHBOARD_SUPPORT)
- if (document().hasAnnotatedRegions())
- document().setAnnotatedRegionsDirty(true);
-#endif
+ document().invalidateScrollbarDependentRegions();
}
bool RenderListBox::scrolledToTop() const