blob: 29ec1a13c4165d7c9ba9da3f4b65467fbc94c525 [file] [log] [blame]
// Copyright 2016 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef ResizeObservation_h
#define ResizeObservation_h
#include "core/observer/ResizeObserverEntry.h"
#include "platform/geometry/LayoutSize.h"
#include "platform/heap/Handle.h"
namespace blink {
class Element;
class ResizeObserver;
// ResizeObservation represents an element that is being observed.
class CORE_EXPORT ResizeObservation final : public GarbageCollected<ResizeObservation> {
public:
ResizeObservation(Element* target, ResizeObserver*);
Element* target() const { return m_target; }
size_t targetDepth();
void setObservationSize(const LayoutSize&);
// True if observationSize differs from target's current size.
bool observationSizeOutOfSync() const;
void elementSizeChanged();
static LayoutSize getTargetSize(Element* target);
DECLARE_TRACE();
private:
WeakMember<Element> m_target;
Member<ResizeObserver> m_observer;
// Target size sent in last observation notification.
LayoutSize m_observationSize;
bool m_elementSizeChanged;
};
} // namespace blink
#endif // ResizeObservation_h