Title: [189316] branches/safari-601-branch/Source/WebCore

Diff

Modified: branches/safari-601-branch/Source/WebCore/ChangeLog (189315 => 189316)


--- branches/safari-601-branch/Source/WebCore/ChangeLog	2015-09-03 23:38:01 UTC (rev 189315)
+++ branches/safari-601-branch/Source/WebCore/ChangeLog	2015-09-03 23:39:28 UTC (rev 189316)
@@ -1,5 +1,28 @@
 2015-09-03  Babak Shafiei  <[email protected]>
 
+        Merge r188370.
+
+    2015-08-12  Brent Fulgham  <[email protected]>
+
+            Move RenderBox-specific Scroll Snap code from RenderElement to RenderBox
+            https://bugs.webkit.org/show_bug.cgi?id=147963
+
+            Reviewed by Simon Fraser.
+
+            No new tests: No change in functionality.
+
+            * rendering/RenderBox.cpp:
+            (WebCore::RenderBox::styleWillChange): Remove RenderBox-specific code.
+            (WebCore::RenderBox::willBeRemovedFromTree): Ditto.
+            * rendering/RenderBox.h:
+            * rendering/RenderElement.cpp:
+            (WebCore::RenderElement::styleWillChange): Move code from RenderElement to
+            handle Scroll Snap Points.
+            (WebCore::RenderElement::willBeRemovedFromTree): Added new override to handle
+            scroll-snap point logic.
+
+2015-09-03  Babak Shafiei  <[email protected]>
+
         Merge r188340.
 
     2015-08-12  Brent Fulgham  <[email protected]>

Modified: branches/safari-601-branch/Source/WebCore/rendering/RenderBox.cpp (189315 => 189316)


--- branches/safari-601-branch/Source/WebCore/rendering/RenderBox.cpp	2015-09-03 23:38:01 UTC (rev 189315)
+++ branches/safari-601-branch/Source/WebCore/rendering/RenderBox.cpp	2015-09-03 23:39:28 UTC (rev 189316)
@@ -312,6 +312,15 @@
     } else if (isBody())
         view().repaintRootContents();
 
+#if ENABLE(CSS_SCROLL_SNAP)
+    if (!newStyle.scrollSnapCoordinates().isEmpty() || (oldStyle && !oldStyle->scrollSnapCoordinates().isEmpty())) {
+        if (newStyle.scrollSnapCoordinates().isEmpty())
+            view().unregisterBoxWithScrollSnapCoordinates(*this);
+        else
+            view().registerBoxWithScrollSnapCoordinates(*this);
+    }
+#endif
+
     RenderBoxModelObject::styleWillChange(diff, newStyle);
 }
 
@@ -425,6 +434,17 @@
 #endif
 }
 
+void RenderBox::willBeRemovedFromTree()
+{
+#if ENABLE(CSS_SCROLL_SNAP)
+    if (hasInitializedStyle() && !style().scrollSnapCoordinates().isEmpty())
+        view().unregisterBoxWithScrollSnapCoordinates(*this);
+#endif
+    
+    RenderBoxModelObject::willBeRemovedFromTree();
+}
+    
+
 #if ENABLE(CSS_SHAPES)
 void RenderBox::updateShapeOutsideInfoAfterStyleChange(const RenderStyle& style, const RenderStyle* oldStyle)
 {

Modified: branches/safari-601-branch/Source/WebCore/rendering/RenderBox.h (189315 => 189316)


--- branches/safari-601-branch/Source/WebCore/rendering/RenderBox.h	2015-09-03 23:38:01 UTC (rev 189315)
+++ branches/safari-601-branch/Source/WebCore/rendering/RenderBox.h	2015-09-03 23:39:28 UTC (rev 189316)
@@ -635,6 +635,8 @@
     virtual void styleDidChange(StyleDifference, const RenderStyle* oldStyle) override;
     virtual void updateFromStyle() override;
 
+    void willBeRemovedFromTree() override;
+
     bool createsNewFormattingContext() const;
 
     // Returns false if it could not cheaply compute the extent (e.g. fixed background), in which case the returned rect may be incorrect.

Modified: branches/safari-601-branch/Source/WebCore/rendering/RenderElement.cpp (189315 => 189316)


--- branches/safari-601-branch/Source/WebCore/rendering/RenderElement.cpp	2015-09-03 23:38:01 UTC (rev 189315)
+++ branches/safari-601-branch/Source/WebCore/rendering/RenderElement.cpp	2015-09-03 23:39:28 UTC (rev 189316)
@@ -898,17 +898,6 @@
         }
     }
 
-#if ENABLE(CSS_SCROLL_SNAP)
-    if (!newStyle.scrollSnapCoordinates().isEmpty() || (oldStyle && !oldStyle->scrollSnapCoordinates().isEmpty())) {
-        if (is<RenderBox>(*this)) {
-            if (newStyle.scrollSnapCoordinates().isEmpty())
-                view().unregisterBoxWithScrollSnapCoordinates(downcast<RenderBox>(*this));
-            else
-                view().registerBoxWithScrollSnapCoordinates(downcast<RenderBox>(*this));
-        }
-    }
-#endif
-
     if (isRoot() || isBody())
         view().frameView().updateExtendBackgroundIfNecessary();
 }
@@ -1063,14 +1052,6 @@
     if (auto* containerFlowThread = parent()->renderNamedFlowThreadWrapper())
         containerFlowThread->removeFlowChild(*this);
 
-    
-#if ENABLE(CSS_SCROLL_SNAP)
-    if (!m_style->scrollSnapCoordinates().isEmpty()) {
-        if (is<RenderBox>(*this))
-            view().unregisterBoxWithScrollSnapCoordinates(downcast<RenderBox>(*this));
-    }
-#endif
-
     RenderObject::willBeRemovedFromTree();
 }
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to