Title: [179678] branches/safari-600.1.4.15-branch/Source/WebCore

Diff

Modified: branches/safari-600.1.4.15-branch/Source/WebCore/ChangeLog (179677 => 179678)


--- branches/safari-600.1.4.15-branch/Source/WebCore/ChangeLog	2015-02-05 07:04:39 UTC (rev 179677)
+++ branches/safari-600.1.4.15-branch/Source/WebCore/ChangeLog	2015-02-05 07:49:22 UTC (rev 179678)
@@ -1,5 +1,51 @@
 2015-02-04  Lucas Forschler  <[email protected]>
 
+        Merge r178661
+
+    2015-01-19  Brent Fulgham  <[email protected]>
+
+            Layers need to be already updated before we call adjustViewSize
+            https://bugs.webkit.org/show_bug.cgi?id=135514
+
+            Reviewed by Simon Fraser.
+
+            Tested by 'fast/dynamic/layer-no-longer-paginated.html'
+
+            Defer painting operations until we have finished layout. This
+            has a couple of benefits:
+            (1) We do not attempt to modify render layers during layout.
+            (2) In WK1 we do not attempt to paint during layout.
+
+            Add a new virtual predicate to ScrollView indicating when we are in
+            layout so that calls to setContentsSize do not attempt
+            to adjust scrollbars.
+
+            Modify FrameView to set its ScrollView state to block paint
+            operations during layout. Also add a post-layout handler to
+            complete the scrollbar updates after layout is finished.
+
+            * WebCore.exp.in: Move linker symbol to ScrollView (from FrameView).
+            * page/FrameView.cpp:
+            (WebCore::FrameView::layout):
+            (WebCore::FrameView::shouldDeferScrollUpdateAfterContentSizeChange): Added.
+            (WebCore::FrameView::scrollPositionChangedViaPlatformWidget): Removed (Renamed).
+            (WebCore::FrameView::scrollPositionChangedViaPlatformWidgetImpl): Added (Renamed)
+            (WebCore::FrameView::paintContents): Do not paint if we are inside view size adjustment.
+            * page/FrameView.h:
+            * platform/ScrollView.cpp:
+            (WebCore::ScrollView::scrollPositionChangedViaPlatformWidget): Added. Checks whether we need to defer
+            painting, and calls virtual scrollPositionChangedViaPlatformWidgetImpl if we do not.
+            (WebCore::FrameView::scrollPositionChangedViaPlatformWidgetImpl): Added.
+            (WebCore::ScrollView::handleDeferredScrollUpdateAfterContentSizeChange): Added.
+            (WebCore::ScrollView::scrollTo): If we should defer painting, cache the
+            the scroll delta and apply it after the layout is complete.
+            (WebCore::ScrollView::completeUpdatesAfterScrollTo): Split off part of 'scrollTo' into its own method
+            so we can reuse it in handleDeferredScrollUpdateAfterContentSizeChange.
+            * platform/ScrollView.h:
+            (WebCore::ScrollView::shouldDeferScrollUpdateAfterContentSizeChange): Added.
+
+2015-02-04  Lucas Forschler  <[email protected]>
+
         Merge r178363
 
     2015-01-13  Andreas Kling  <[email protected]>

Modified: branches/safari-600.1.4.15-branch/Source/WebCore/WebCore.exp.in (179677 => 179678)


--- branches/safari-600.1.4.15-branch/Source/WebCore/WebCore.exp.in	2015-02-05 07:04:39 UTC (rev 179677)
+++ branches/safari-600.1.4.15-branch/Source/WebCore/WebCore.exp.in	2015-02-05 07:49:22 UTC (rev 179678)
@@ -93,6 +93,7 @@
 __ZN7WebCore10ScrollView23setPaintsEntireContentsEb
 __ZN7WebCore10ScrollView23setScrollbarsSuppressedEbb
 __ZN7WebCore10ScrollView24windowResizerRectChangedEv
+__ZN7WebCore10ScrollView38scrollPositionChangedViaPlatformWidgetERKNS_8IntPointES3_
 __ZN7WebCore10ScrollView4hideEv
 __ZN7WebCore10ScrollView4showEv
 __ZN7WebCore10ScrollView5paintEPNS_15GraphicsContextERKNS_7IntRectE
@@ -1430,7 +1431,6 @@
 __ZN7WebCore9FrameView34setViewportSizeForCSSViewportUnitsENS_7IntSizeE
 __ZN7WebCore9FrameView37setScrollingPerformanceLoggingEnabledEb
 __ZN7WebCore9FrameView37updateLayoutAndStyleIfNeededRecursiveEv
-__ZN7WebCore9FrameView38scrollPositionChangedViaPlatformWidgetERKNS_8IntPointES3_
 __ZN7WebCore9FrameView39flushCompositingStateIncludingSubframesEv
 __ZN7WebCore9FrameView52disableLayerFlushThrottlingTemporarilyForInteractionEv
 __ZN7WebCore9FrameView6createERNS_5FrameE

Modified: branches/safari-600.1.4.15-branch/Source/WebCore/page/FrameView.cpp (179677 => 179678)


--- branches/safari-600.1.4.15-branch/Source/WebCore/page/FrameView.cpp	2015-02-05 07:04:39 UTC (rev 179677)
+++ branches/safari-600.1.4.15-branch/Source/WebCore/page/FrameView.cpp	2015-02-05 07:49:22 UTC (rev 179678)
@@ -1125,7 +1125,7 @@
 
     if (!allowSubtree && m_layoutRoot) {
         m_layoutRoot->markContainingBlocksForLayout(false);
-        m_layoutRoot = 0;
+        m_layoutRoot = nullptr;
     }
 
     ASSERT(frame().view() == this);
@@ -1323,7 +1323,9 @@
     layer->updateLayerPositionsAfterLayout(renderView()->layer(), updateLayerPositionFlags(layer, subtree, m_needsFullRepaint));
 
     updateCompositingLayersAfterLayout();
-    
+
+    m_layoutPhase = InPostLayerPositionsUpdatedAfterLayout;
+
     m_layoutCount++;
 
 #if PLATFORM(COCOA) || PLATFORM(WIN) || PLATFORM(GTK) || PLATFORM(EFL)
@@ -1343,6 +1345,8 @@
 
     updateCanBlitOnScrollRecursively();
 
+    handleDeferredScrollUpdateAfterContentSizeChange();
+
     if (document.hasListenerType(Document::OVERFLOWCHANGED_LISTENER))
         updateOverflowStatus(layoutWidth() < contentsWidth(), layoutHeight() < contentsHeight());
 
@@ -1372,6 +1376,11 @@
     --m_nestedLayoutCount;
 }
 
+bool FrameView::shouldDeferScrollUpdateAfterContentSizeChange()
+{
+    return (m_layoutPhase < InPostLayout) && (m_layoutPhase != OutsideLayout);
+}
+
 RenderBox* FrameView::embeddedContentBox() const
 {
     RenderView* renderView = this->renderView();
@@ -2048,7 +2057,7 @@
         renderer->setNeedsLayout();
 }
 
-void FrameView::scrollPositionChangedViaPlatformWidget(const IntPoint& oldPosition, const IntPoint& newPosition)
+void FrameView::scrollPositionChangedViaPlatformWidgetImpl(const IntPoint& oldPosition, const IntPoint& newPosition)
 {
     updateLayerPositionsAfterScrolling();
     updateCompositingLayersAfterScrolling();
@@ -2132,6 +2141,8 @@
 
 void FrameView::updateCompositingLayersAfterScrolling()
 {
+    ASSERT(m_layoutPhase >= InPostLayout || m_layoutPhase == OutsideLayout);
+
     if (!shouldUpdateCompositingLayersAfterScrolling())
         return;
 
@@ -3675,6 +3686,11 @@
 
 void FrameView::paintContents(GraphicsContext* context, const IntRect& dirtyRect)
 {
+    if (m_layoutPhase == InViewSizeAdjust)
+        return;
+
+    ASSERT(m_layoutPhase == InPostLayerPositionsUpdatedAfterLayout || m_layoutPhase == OutsideLayout);
+
 #ifndef NDEBUG
     bool fillWithRed;
     if (frame().document()->printing())

Modified: branches/safari-600.1.4.15-branch/Source/WebCore/page/FrameView.h (179677 => 179678)


--- branches/safari-600.1.4.15-branch/Source/WebCore/page/FrameView.h	2015-02-05 07:04:39 UTC (rev 179677)
+++ branches/safari-600.1.4.15-branch/Source/WebCore/page/FrameView.h	2015-02-05 07:49:22 UTC (rev 179678)
@@ -235,7 +235,6 @@
     virtual void setFixedVisibleContentRect(const IntRect&) override;
 #endif
     virtual void setScrollPosition(const IntPoint&) override;
-    void scrollPositionChangedViaPlatformWidget(const IntPoint& oldPosition, const IntPoint& newPosition);
     virtual void updateLayerPositionsAfterScrolling() override;
     virtual void updateCompositingLayersAfterScrolling() override;
     virtual bool requestScrollPositionUpdate(const IntPoint&) override;
@@ -521,6 +520,7 @@
         InLayout,
         InViewSizeAdjust,
         InPostLayout,
+        InPostLayerPositionsUpdatedAfterLayout,
     };
     LayoutPhase layoutPhase() const { return m_layoutPhase; }
 
@@ -537,6 +537,10 @@
 
     bool shouldUpdateCompositingLayersAfterScrolling() const;
 
+    virtual bool shouldDeferScrollUpdateAfterContentSizeChange() override;
+
+    virtual void scrollPositionChangedViaPlatformWidgetImpl(const IntPoint& oldPosition, const IntPoint& newPosition) override;
+
     void applyOverflowToViewport(RenderElement*, ScrollbarMode& hMode, ScrollbarMode& vMode);
     void applyPaginationToViewport();
 

Modified: branches/safari-600.1.4.15-branch/Source/WebCore/platform/ScrollView.cpp (179677 => 179678)


--- branches/safari-600.1.4.15-branch/Source/WebCore/platform/ScrollView.cpp	2015-02-05 07:04:39 UTC (rev 179677)
+++ branches/safari-600.1.4.15-branch/Source/WebCore/platform/ScrollView.cpp	2015-02-05 07:49:22 UTC (rev 179678)
@@ -457,10 +457,41 @@
     scrollTo(newOffset);
 }
 
+void ScrollView::scrollPositionChangedViaPlatformWidget(const IntPoint& oldPosition, const IntPoint& newPosition)
+{
+    // We should not attempt to actually modify (paint) platform widgets if the layout phase
+    // is not complete. Instead, defer the scroll event until the layout finishes.
+    if (shouldDeferScrollUpdateAfterContentSizeChange()) {
+        // We only care about the most recent scroll position change request
+        m_deferredScrollPositions = std::make_unique<std::pair<IntPoint, IntPoint>>(std::make_pair(oldPosition, newPosition));
+        return;
+    }
+
+    scrollPositionChangedViaPlatformWidgetImpl(oldPosition, newPosition);
+}
+
+void ScrollView::handleDeferredScrollUpdateAfterContentSizeChange()
+{
+    ASSERT(!shouldDeferScrollUpdateAfterContentSizeChange());
+
+    if (!m_deferredScrollDelta && !m_deferredScrollPositions)
+        return;
+
+    ASSERT(static_cast<bool>(m_deferredScrollDelta) != static_cast<bool>(m_deferredScrollPositions));
+
+    if (m_deferredScrollDelta)
+        completeUpdatesAfterScrollTo(*m_deferredScrollDelta);
+    else if (m_deferredScrollPositions)
+        scrollPositionChangedViaPlatformWidgetImpl(m_deferredScrollPositions->first, m_deferredScrollPositions->second);
+    
+    m_deferredScrollDelta = nullptr;
+    m_deferredScrollPositions = nullptr;
+}
+
 void ScrollView::scrollTo(const IntSize& newOffset)
 {
     IntSize scrollDelta = newOffset - m_scrollOffset;
-    if (scrollDelta == IntSize())
+    if (scrollDelta.isZero())
         return;
     m_scrollOffset = newOffset;
 
@@ -473,6 +504,19 @@
         return;
     }
 #endif
+    // We should not attempt to actually modify layer contents if the layout phase
+    // is not complete. Instead, defer the scroll event until the layout finishes.
+    if (shouldDeferScrollUpdateAfterContentSizeChange()) {
+        ASSERT(!m_deferredScrollDelta);
+        m_deferredScrollDelta = std::make_unique<IntSize>(scrollDelta);
+        return;
+    }
+
+    completeUpdatesAfterScrollTo(scrollDelta);
+}
+
+void ScrollView::completeUpdatesAfterScrollTo(const IntSize& scrollDelta)
+{
     updateLayerPositionsAfterScrolling();
     scrollContents(scrollDelta);
     updateCompositingLayersAfterScrolling();

Modified: branches/safari-600.1.4.15-branch/Source/WebCore/platform/ScrollView.h (179677 => 179678)


--- branches/safari-600.1.4.15-branch/Source/WebCore/platform/ScrollView.h	2015-02-05 07:04:39 UTC (rev 179677)
+++ branches/safari-600.1.4.15-branch/Source/WebCore/platform/ScrollView.h	2015-02-05 07:49:22 UTC (rev 179678)
@@ -373,6 +373,8 @@
 
     virtual bool isScrollView() const override { return true; }
 
+    void scrollPositionChangedViaPlatformWidget(const IntPoint& oldPosition, const IntPoint& newPosition);
+
 protected:
     ScrollView();
 
@@ -408,10 +410,18 @@
     // Called to update the scrollbars to accurately reflect the state of the view.
     void updateScrollbars(const IntSize& desiredOffset);
 
+    virtual void handleDeferredScrollUpdateAfterContentSizeChange();
+
+    virtual bool shouldDeferScrollUpdateAfterContentSizeChange() { return false; }
+
+    virtual void scrollPositionChangedViaPlatformWidgetImpl(const IntPoint&, const IntPoint&) { }
+
 private:
     virtual IntRect visibleContentRectInternal(VisibleContentRectIncludesScrollbars, VisibleContentRectBehavior) const override;
     IntRect unobscuredContentRectInternal(VisibleContentRectIncludesScrollbars = ExcludeScrollbars) const;
 
+    void completeUpdatesAfterScrollTo(const IntSize& scrollDelta);
+
     RefPtr<Scrollbar> m_horizontalScrollbar;
     RefPtr<Scrollbar> m_verticalScrollbar;
     ScrollbarMode m_horizontalScrollbarMode;
@@ -441,6 +451,10 @@
     IntSize m_fixedLayoutSize;
     IntSize m_contentsSize;
 
+    std::unique_ptr<IntSize> m_deferredScrollDelta; // Needed for WebKit scrolling
+    std::unique_ptr<std::pair<IntPoint, IntPoint>> m_deferredScrollPositions; // Needed for platform widget scrolling
+
+
     int m_scrollbarsAvoidingResizer;
     bool m_scrollbarsSuppressed;
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to