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

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: bokan review comments addressed 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())
dcheng 2016/01/11 21:45:30 Move the original mainFrame() check down to line 1
kenrb 2016/01/11 22:01:23 Done.
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
208 FloatPoint clampedOffset(clampOffsetToBoundaries(location)); 201 FloatPoint clampedOffset(clampOffsetToBoundaries(location));
209 202
(...skipping 529 matching lines...) Expand 10 before | Expand all | Expand 10 after
739 } else if (graphicsLayer == m_rootTransformLayer) { 732 } else if (graphicsLayer == m_rootTransformLayer) {
740 name = "Root Transform Layer"; 733 name = "Root Transform Layer";
741 } else { 734 } else {
742 ASSERT_NOT_REACHED(); 735 ASSERT_NOT_REACHED();
743 } 736 }
744 737
745 return name; 738 return name;
746 } 739 }
747 740
748 } // namespace blink 741 } // 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