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

Unified Diff: third_party/WebKit/Source/core/observer/ResizeObservation.cpp

Issue 2188983003: ResizeObserver pt5: size change notification (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: All CR comments addressed Created 4 years, 5 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/observer/ResizeObservation.cpp
diff --git a/third_party/WebKit/Source/core/observer/ResizeObservation.cpp b/third_party/WebKit/Source/core/observer/ResizeObservation.cpp
index a3c0e41e785aaf757a7ec13ce47e9bf280cbaf8c..4fd08d5414b06eb3011cf6aa97d8267d2f94506b 100644
--- a/third_party/WebKit/Source/core/observer/ResizeObservation.cpp
+++ b/third_party/WebKit/Source/core/observer/ResizeObservation.cpp
@@ -15,18 +15,21 @@ ResizeObservation::ResizeObservation(Element* target, ResizeObserver* observer)
: m_target(target)
, m_observer(observer)
, m_observationSize(0, 0)
+ , m_elementSizeChanged(true)
{
DCHECK(m_target);
+ m_observer->elementSizeChanged();
}
void ResizeObservation::setObservationSize(const LayoutSize& size)
{
m_observationSize = size;
+ m_elementSizeChanged = false;
}
bool ResizeObservation::observationSizeOutOfSync() const
{
- return m_observationSize != ResizeObservation::getTargetSize(m_target);
+ return m_elementSizeChanged && m_observationSize != ResizeObservation::getTargetSize(m_target);
}
size_t ResizeObservation::targetDepth()
@@ -51,6 +54,11 @@ LayoutSize ResizeObservation::getTargetSize(Element* target) // static
return LayoutSize();
}
+void ResizeObservation::elementSizeChanged()
+{
+ m_elementSizeChanged = true;
+ m_observer->elementSizeChanged();
+}
DEFINE_TRACE(ResizeObservation)
{
« no previous file with comments | « third_party/WebKit/Source/core/observer/ResizeObservation.h ('k') | third_party/WebKit/Source/core/observer/ResizeObserver.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698