| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef FrameViewAutoSizeInfo_h | 5 #ifndef FrameViewAutoSizeInfo_h |
| 6 #define FrameViewAutoSizeInfo_h | 6 #define FrameViewAutoSizeInfo_h |
| 7 | 7 |
| 8 #include "platform/geometry/IntSize.h" | 8 #include "platform/geometry/IntSize.h" |
| 9 #include "platform/heap/Handle.h" |
| 9 #include "wtf/FastAllocBase.h" | 10 #include "wtf/FastAllocBase.h" |
| 10 #include "wtf/Noncopyable.h" | 11 #include "wtf/Noncopyable.h" |
| 11 #include "wtf/RefPtr.h" | 12 #include "wtf/RefPtr.h" |
| 12 | 13 |
| 13 namespace blink { | 14 namespace blink { |
| 14 | 15 |
| 15 class FrameView; | 16 class FrameView; |
| 16 | 17 |
| 17 class FrameViewAutoSizeInfo { | 18 class FrameViewAutoSizeInfo FINAL : public NoBaseWillBeGarbageCollected<FrameVie
wAutoSizeInfo> { |
| 18 WTF_MAKE_NONCOPYABLE(FrameViewAutoSizeInfo); | 19 WTF_MAKE_NONCOPYABLE(FrameViewAutoSizeInfo); |
| 19 WTF_MAKE_FAST_ALLOCATED; | 20 WTF_MAKE_FAST_ALLOCATED_WILL_BE_REMOVED; |
| 21 DECLARE_EMPTY_DESTRUCTOR_WILL_BE_REMOVED(FrameViewAutoSizeInfo); |
| 22 public: |
| 23 static PassOwnPtrWillBeRawPtr<FrameViewAutoSizeInfo> create(FrameView* frame
View) |
| 24 { |
| 25 return adoptPtrWillBeNoop(new FrameViewAutoSizeInfo(frameView)); |
| 26 } |
| 20 | 27 |
| 21 public: | |
| 22 FrameViewAutoSizeInfo(FrameView*); | |
| 23 ~FrameViewAutoSizeInfo(); | |
| 24 void configureAutoSizeMode(const IntSize& minSize, const IntSize& maxSize); | 28 void configureAutoSizeMode(const IntSize& minSize, const IntSize& maxSize); |
| 25 void autoSizeIfNeeded(); | 29 void autoSizeIfNeeded(); |
| 26 | 30 |
| 31 void trace(Visitor*); |
| 32 |
| 27 private: | 33 private: |
| 28 void removeAutoSizeMode(); | 34 explicit FrameViewAutoSizeInfo(FrameView*); |
| 29 | 35 |
| 30 RefPtr<FrameView> m_frameView; | 36 RefPtrWillBeMember<FrameView> m_frameView; |
| 37 |
| 38 // The lower bound on the size when autosizing. |
| 39 IntSize m_minAutoSize; |
| 40 // The upper bound on the size when autosizing. |
| 41 IntSize m_maxAutoSize; |
| 31 | 42 |
| 32 bool m_inAutoSize; | 43 bool m_inAutoSize; |
| 33 // True if autosize has been run since m_shouldAutoSize was set. | 44 // True if autosize has been run since m_shouldAutoSize was set. |
| 34 bool m_didRunAutosize; | 45 bool m_didRunAutosize; |
| 35 // The lower bound on the size when autosizing. | |
| 36 IntSize m_minAutoSize; | |
| 37 // The upper bound on the size when autosizing. | |
| 38 IntSize m_maxAutoSize; | |
| 39 }; | 46 }; |
| 40 | 47 |
| 41 } // namespace blink | 48 } // namespace blink |
| 42 | 49 |
| 43 #endif // FrameViewAutoSizeInfo_h | 50 #endif // FrameViewAutoSizeInfo_h |
| OLD | NEW |