Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(344)

Unified Diff: third_party/WebKit/Source/core/layout/LayoutBox.cpp

Issue 1949843004: Revert of Compute snap offsets (both repeat and element based) (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: manual revert Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/layout/LayoutBox.cpp
diff --git a/third_party/WebKit/Source/core/layout/LayoutBox.cpp b/third_party/WebKit/Source/core/layout/LayoutBox.cpp
index 3d59dbba898111d07260a41c2ad8b80666a781fc..1c72db18a5e3d889ed463b69574fc7d61d53be61 100644
--- a/third_party/WebKit/Source/core/layout/LayoutBox.cpp
+++ b/third_party/WebKit/Source/core/layout/LayoutBox.cpp
@@ -56,7 +56,6 @@
#include "core/layout/shapes/ShapeOutsideInfo.h"
#include "core/page/AutoscrollController.h"
#include "core/page/Page.h"
-#include "core/page/scrolling/SnapCoordinator.h"
#include "core/paint/BackgroundImageGeometry.h"
#include "core/paint/BoxPainter.h"
#include "core/paint/PaintLayer.h"
@@ -146,7 +145,6 @@ void LayoutBox::willBeDestroyed()
void LayoutBox::insertedIntoTree()
{
LayoutBoxModelObject::insertedIntoTree();
- addScrollSnapMapping();
if (isOrthogonalWritingModeRoot())
markOrthogonalWritingModeRoot();
@@ -157,7 +155,6 @@ void LayoutBox::willBeRemovedFromTree()
if (!documentBeingDestroyed() && isOrthogonalWritingModeRoot())
unmarkOrthogonalWritingModeRoot();
- clearScrollSnapMapping();
LayoutBoxModelObject::willBeRemovedFromTree();
}
@@ -304,8 +301,6 @@ void LayoutBox::styleDidChange(StyleDifference diff, const ComputedStyle* oldSty
LayoutFlowThread* flowThread = flowThreadContainingBlock();
if (flowThread && flowThread != this)
flowThread->flowThreadDescendantStyleDidChange(this, diff, *oldStyle);
-
- updateScrollSnapMappingAfterStyleChange(&newStyle, oldStyle);
}
ASSERT(!isInline() || isAtomicInlineLevel()); // Non-atomic inlines should be LayoutInline or LayoutText, not LayoutBox.
@@ -378,38 +373,6 @@ void LayoutBox::updateGridPositionAfterStyleChange(const ComputedStyle* oldStyle
toLayoutGrid(parent())->dirtyGrid();
}
-void LayoutBox::updateScrollSnapMappingAfterStyleChange(const ComputedStyle* newStyle, const ComputedStyle* oldStyle)
-{
- SnapCoordinator* snapCoordinator = document().snapCoordinator();
- if (!snapCoordinator)
- return;
-
- // Scroll snap type has no effect on the viewport defining element instead
- // they are handled by the LayoutView.
- bool allowsSnapContainer = node() != document().viewportDefiningElement();
-
- ScrollSnapType oldSnapType = oldStyle ? oldStyle->getScrollSnapType() : ScrollSnapTypeNone;
- ScrollSnapType newSnapType = newStyle && allowsSnapContainer ? newStyle->getScrollSnapType() : ScrollSnapTypeNone;
- if (oldSnapType != newSnapType)
- snapCoordinator->snapContainerDidChange(*this, newSnapType);
-
- Vector<LengthPoint> emptyVector;
- const Vector<LengthPoint>& oldSnapCoordinate = oldStyle ? oldStyle->scrollSnapCoordinate() : emptyVector;
- const Vector<LengthPoint>& newSnapCoordinate = newStyle ? newStyle->scrollSnapCoordinate() : emptyVector;
- if (oldSnapCoordinate != newSnapCoordinate)
- snapCoordinator->snapAreaDidChange(*this, newSnapCoordinate);
-}
-
-void LayoutBox::addScrollSnapMapping()
-{
- updateScrollSnapMappingAfterStyleChange(style(), nullptr);
-}
-
-void LayoutBox::clearScrollSnapMapping()
-{
- updateScrollSnapMappingAfterStyleChange(nullptr, style());
-}
-
void LayoutBox::updateFromStyle()
{
LayoutBoxModelObject::updateFromStyle();
@@ -4815,50 +4778,4 @@ void LayoutBox::clearPercentHeightDescendants()
}
}
-LayoutBox* LayoutBox::snapContainer() const
-{
- return m_rareData ? m_rareData->m_snapContainer : nullptr;
-}
-
-void LayoutBox::setSnapContainer(LayoutBox* newContainer)
-{
- LayoutBox* oldContainer = snapContainer();
- if (oldContainer == newContainer)
- return;
-
- if (oldContainer)
- oldContainer->removeSnapArea(*this);
-
- ensureRareData().m_snapContainer = newContainer;
-
- if (newContainer)
- newContainer->addSnapArea(*this);
-}
-
-void LayoutBox::clearSnapAreas()
-{
- if (SnapAreaSet* areas = snapAreas()) {
- for (auto& snapArea : *areas)
- snapArea->m_rareData->m_snapContainer = nullptr;
- areas->clear();
- }
-}
-
-void LayoutBox::addSnapArea(const LayoutBox& snapArea)
-{
- ensureRareData().ensureSnapAreas().add(&snapArea);
-}
-
-void LayoutBox::removeSnapArea(const LayoutBox& snapArea)
-{
- if (m_rareData && m_rareData->m_snapAreas) {
- m_rareData->m_snapAreas->remove(&snapArea);
- }
-}
-
-SnapAreaSet* LayoutBox::snapAreas() const
-{
- return m_rareData ? m_rareData->m_snapAreas.get() : nullptr;
-}
-
} // namespace blink
« no previous file with comments | « third_party/WebKit/Source/core/layout/LayoutBox.h ('k') | third_party/WebKit/Source/core/page/scrolling/SnapCoordinator.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698