OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 #include "core/frame/RootFrameViewport.h" | 5 #include "core/frame/RootFrameViewport.h" |
6 | 6 |
7 #include "core/frame/FrameView.h" | 7 #include "core/frame/FrameView.h" |
8 #include "core/layout/ScrollAlignment.h" | 8 #include "core/layout/ScrollAlignment.h" |
9 #include "core/layout/ScrollAnchor.h" | 9 #include "core/layout/ScrollAnchor.h" |
10 #include "platform/geometry/DoubleRect.h" | 10 #include "platform/geometry/DoubleRect.h" |
11 #include "platform/geometry/FloatRect.h" | 11 #include "platform/geometry/FloatRect.h" |
12 #include "platform/geometry/LayoutRect.h" | 12 #include "platform/geometry/LayoutRect.h" |
13 | 13 |
14 namespace blink { | 14 namespace blink { |
15 | 15 |
16 RootFrameViewport::RootFrameViewport(ScrollableArea& visualViewport, | 16 RootFrameViewport::RootFrameViewport(ScrollableArea& visualViewport, |
17 ScrollableArea& layoutViewport) | 17 ScrollableArea& layoutViewport) |
18 : m_visualViewport(visualViewport) { | 18 : m_visualViewport(visualViewport) { |
19 setLayoutViewport(layoutViewport); | 19 setLayoutViewport(layoutViewport); |
20 } | 20 } |
21 | 21 |
22 void RootFrameViewport::setLayoutViewport(ScrollableArea& newLayoutViewport) { | 22 void RootFrameViewport::setLayoutViewport(ScrollableArea& newLayoutViewport) { |
| 23 if (m_layoutViewport.get() == &newLayoutViewport) |
| 24 return; |
| 25 |
23 if (m_layoutViewport && m_layoutViewport->scrollAnchor()) | 26 if (m_layoutViewport && m_layoutViewport->scrollAnchor()) |
24 m_layoutViewport->scrollAnchor()->setScroller(m_layoutViewport.get()); | 27 m_layoutViewport->scrollAnchor()->setScroller(m_layoutViewport.get()); |
25 | 28 |
26 m_layoutViewport = &newLayoutViewport; | 29 m_layoutViewport = &newLayoutViewport; |
27 | 30 |
28 if (m_layoutViewport->scrollAnchor()) | 31 if (m_layoutViewport->scrollAnchor()) |
29 m_layoutViewport->scrollAnchor()->setScroller(this); | 32 m_layoutViewport->scrollAnchor()->setScroller(this); |
30 } | 33 } |
31 | 34 |
32 ScrollableArea& RootFrameViewport::layoutViewport() const { | 35 ScrollableArea& RootFrameViewport::layoutViewport() const { |
(...skipping 391 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
424 visualViewport().clearScrollAnimators(); | 427 visualViewport().clearScrollAnimators(); |
425 } | 428 } |
426 | 429 |
427 DEFINE_TRACE(RootFrameViewport) { | 430 DEFINE_TRACE(RootFrameViewport) { |
428 visitor->trace(m_visualViewport); | 431 visitor->trace(m_visualViewport); |
429 visitor->trace(m_layoutViewport); | 432 visitor->trace(m_layoutViewport); |
430 ScrollableArea::trace(visitor); | 433 ScrollableArea::trace(visitor); |
431 } | 434 } |
432 | 435 |
433 } // namespace blink | 436 } // namespace blink |
OLD | NEW |