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

Side by Side Diff: third_party/WebKit/Source/core/frame/VisualViewport.cpp

Issue 1568383002: Preserve page resize information when main frame is remote (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: dcheng's suggestion Created 4 years, 11 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 } 82 }
83 83
84 DEFINE_TRACE(VisualViewport) 84 DEFINE_TRACE(VisualViewport)
85 { 85 {
86 visitor->trace(m_frameHost); 86 visitor->trace(m_frameHost);
87 ScrollableArea::trace(visitor); 87 ScrollableArea::trace(visitor);
88 } 88 }
89 89
90 void VisualViewport::setSize(const IntSize& size) 90 void VisualViewport::setSize(const IntSize& size)
91 { 91 {
92 // When the main frame is remote, we won't have an associated frame.
93 if (!mainFrame())
94 return;
95
96 if (m_size == size) 92 if (m_size == size)
97 return; 93 return;
98 94
99 bool autosizerNeedsUpdating = 95 bool autosizerNeedsUpdating = (size.width() != m_size.width())
100 (size.width() != m_size.width()) 96 && mainFrame()
101 && mainFrame()->settings() 97 && mainFrame()->settings()
102 && mainFrame()->settings()->textAutosizingEnabled(); 98 && mainFrame()->settings()->textAutosizingEnabled();
103 99
104 TRACE_EVENT2("blink", "VisualViewport::setSize", "width", size.width(), "hei ght", size.height()); 100 TRACE_EVENT2("blink", "VisualViewport::setSize", "width", size.width(), "hei ght", size.height());
105 m_size = size; 101 m_size = size;
106 102
107 if (m_innerViewportContainerLayer) { 103 if (m_innerViewportContainerLayer) {
108 m_innerViewportContainerLayer->setSize(FloatSize(m_size)); 104 m_innerViewportContainerLayer->setSize(FloatSize(m_size));
109 105
110 // Need to re-compute sizes for the overlay scrollbars. 106 // Need to re-compute sizes for the overlay scrollbars.
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
187 setLocation(m_offset + delta); 183 setLocation(m_offset + delta);
188 } 184 }
189 185
190 void VisualViewport::setScale(float scale) 186 void VisualViewport::setScale(float scale)
191 { 187 {
192 setScaleAndLocation(scale, m_offset); 188 setScaleAndLocation(scale, m_offset);
193 } 189 }
194 190
195 void VisualViewport::setScaleAndLocation(float scale, const FloatPoint& location ) 191 void VisualViewport::setScaleAndLocation(float scale, const FloatPoint& location )
196 { 192 {
197 if (!mainFrame())
198 return;
199
200 bool valuesChanged = false; 193 bool valuesChanged = false;
201 194
202 if (scale != m_scale) { 195 if (scale != m_scale) {
203 m_scale = scale; 196 m_scale = scale;
204 valuesChanged = true; 197 valuesChanged = true;
205 frameHost().chromeClient().pageScaleFactorChanged(); 198 frameHost().chromeClient().pageScaleFactorChanged();
206 } 199 }
207 200
201 if (!mainFrame())
202 return;
203
208 FloatPoint clampedOffset(clampOffsetToBoundaries(location)); 204 FloatPoint clampedOffset(clampOffsetToBoundaries(location));
209 205
210 if (clampedOffset != m_offset) { 206 if (clampedOffset != m_offset) {
211 m_offset = clampedOffset; 207 m_offset = clampedOffset;
212 scrollAnimator().setCurrentPosition(m_offset); 208 scrollAnimator().setCurrentPosition(m_offset);
213 209
214 // SVG runs with accelerated compositing disabled so no ScrollingCoordin ator. 210 // SVG runs with accelerated compositing disabled so no ScrollingCoordin ator.
215 if (ScrollingCoordinator* coordinator = frameHost().page().scrollingCoor dinator()) 211 if (ScrollingCoordinator* coordinator = frameHost().page().scrollingCoor dinator())
216 coordinator->scrollableAreaScrollLayerDidChange(this); 212 coordinator->scrollableAreaScrollLayerDidChange(this);
217 213
(...skipping 521 matching lines...) Expand 10 before | Expand all | Expand 10 after
739 } else if (graphicsLayer == m_rootTransformLayer) { 735 } else if (graphicsLayer == m_rootTransformLayer) {
740 name = "Root Transform Layer"; 736 name = "Root Transform Layer";
741 } else { 737 } else {
742 ASSERT_NOT_REACHED(); 738 ASSERT_NOT_REACHED();
743 } 739 }
744 740
745 return name; 741 return name;
746 } 742 }
747 743
748 } // namespace blink 744 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/web/WebViewImpl.cpp » ('j') | third_party/WebKit/Source/web/WebViewImpl.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698