OLD | NEW |
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 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
188 setLocation(m_offset + delta); | 188 setLocation(m_offset + delta); |
189 } | 189 } |
190 | 190 |
191 void VisualViewport::setScale(float scale) | 191 void VisualViewport::setScale(float scale) |
192 { | 192 { |
193 setScaleAndLocation(scale, m_offset); | 193 setScaleAndLocation(scale, m_offset); |
194 } | 194 } |
195 | 195 |
196 void VisualViewport::setScaleAndLocation(float scale, const FloatPoint& location
) | 196 void VisualViewport::setScaleAndLocation(float scale, const FloatPoint& location
) |
197 { | 197 { |
| 198 if (!mainFrame()) |
| 199 return; |
| 200 |
198 bool valuesChanged = false; | 201 bool valuesChanged = false; |
199 | 202 |
200 if (scale != m_scale) { | 203 if (scale != m_scale) { |
201 m_scale = scale; | 204 m_scale = scale; |
202 valuesChanged = true; | 205 valuesChanged = true; |
203 frameHost().chromeClient().pageScaleFactorChanged(); | 206 frameHost().chromeClient().pageScaleFactorChanged(); |
204 } | 207 } |
205 | 208 |
206 FloatPoint clampedOffset(clampOffsetToBoundaries(location)); | 209 FloatPoint clampedOffset(clampOffsetToBoundaries(location)); |
207 | 210 |
208 if (clampedOffset != m_offset) { | 211 if (clampedOffset != m_offset) { |
209 m_offset = clampedOffset; | 212 m_offset = clampedOffset; |
210 scrollAnimator()->setCurrentPosition(m_offset); | 213 scrollAnimator()->setCurrentPosition(m_offset); |
211 | 214 |
212 // SVG runs with accelerated compositing disabled so no ScrollingCoordin
ator. | 215 // SVG runs with accelerated compositing disabled so no ScrollingCoordin
ator. |
213 if (ScrollingCoordinator* coordinator = frameHost().page().scrollingCoor
dinator()) | 216 if (ScrollingCoordinator* coordinator = frameHost().page().scrollingCoor
dinator()) |
214 coordinator->scrollableAreaScrollLayerDidChange(this); | 217 coordinator->scrollableAreaScrollLayerDidChange(this); |
215 | 218 |
216 Document* document = mainFrame()->document(); | 219 if (Document* document = mainFrame()->document()) |
217 document->enqueueScrollEventForNode(document); | 220 document->enqueueScrollEventForNode(document); |
218 | 221 |
219 mainFrame()->loader().client()->didChangeScrollOffset(); | 222 mainFrame()->loader().client()->didChangeScrollOffset(); |
220 valuesChanged = true; | 223 valuesChanged = true; |
221 } | 224 } |
222 | 225 |
223 if (!valuesChanged) | 226 if (!valuesChanged) |
224 return; | 227 return; |
225 | 228 |
226 InspectorInstrumentation::didUpdateLayout(mainFrame()); | 229 InspectorInstrumentation::didUpdateLayout(mainFrame()); |
227 mainFrame()->loader().saveScrollState(); | 230 mainFrame()->loader().saveScrollState(); |
(...skipping 508 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
736 } else if (graphicsLayer == m_rootTransformLayer) { | 739 } else if (graphicsLayer == m_rootTransformLayer) { |
737 name = "Root Transform Layer"; | 740 name = "Root Transform Layer"; |
738 } else { | 741 } else { |
739 ASSERT_NOT_REACHED(); | 742 ASSERT_NOT_REACHED(); |
740 } | 743 } |
741 | 744 |
742 return name; | 745 return name; |
743 } | 746 } |
744 | 747 |
745 } // namespace blink | 748 } // namespace blink |
OLD | NEW |