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 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
243 notifyRootFrameViewport(); | 243 notifyRootFrameViewport(); |
244 } | 244 } |
245 | 245 |
246 bool VisualViewport::didSetScaleOrLocation(float scale, | 246 bool VisualViewport::didSetScaleOrLocation(float scale, |
247 const FloatPoint& location) { | 247 const FloatPoint& location) { |
248 if (!mainFrame()) | 248 if (!mainFrame()) |
249 return false; | 249 return false; |
250 | 250 |
251 bool valuesChanged = false; | 251 bool valuesChanged = false; |
252 | 252 |
| 253 CHECK(!std::isnan(scale)); |
| 254 CHECK(std::isfinite(scale)); |
253 if (scale != m_scale) { | 255 if (scale != m_scale) { |
254 m_scale = scale; | 256 m_scale = scale; |
255 valuesChanged = true; | 257 valuesChanged = true; |
256 page().chromeClient().pageScaleFactorChanged(); | 258 page().chromeClient().pageScaleFactorChanged(); |
257 enqueueResizeEvent(); | 259 enqueueResizeEvent(); |
258 } | 260 } |
259 | 261 |
260 ScrollOffset clampedOffset = clampScrollOffset(toScrollOffset(location)); | 262 ScrollOffset clampedOffset = clampScrollOffset(toScrollOffset(location)); |
261 | 263 |
| 264 CHECK(!std::isnan(clampedOffset.width()) && |
| 265 !std::isnan(clampedOffset.height())); |
| 266 CHECK(std::isfinite(clampedOffset.width()) && |
| 267 std::isfinite(clampedOffset.height())); |
262 if (clampedOffset != m_offset) { | 268 if (clampedOffset != m_offset) { |
263 m_offset = clampedOffset; | 269 m_offset = clampedOffset; |
264 scrollAnimator().setCurrentOffset(m_offset); | 270 scrollAnimator().setCurrentOffset(m_offset); |
265 | 271 |
266 // SVG runs with accelerated compositing disabled so no | 272 // SVG runs with accelerated compositing disabled so no |
267 // ScrollingCoordinator. | 273 // ScrollingCoordinator. |
268 if (ScrollingCoordinator* coordinator = page().scrollingCoordinator()) | 274 if (ScrollingCoordinator* coordinator = page().scrollingCoordinator()) |
269 coordinator->scrollableAreaScrollLayerDidChange(this); | 275 coordinator->scrollableAreaScrollLayerDidChange(this); |
270 | 276 |
271 if (!page().settings().getInertVisualViewport()) { | 277 if (!page().settings().getInertVisualViewport()) { |
(...skipping 559 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
831 } else if (graphicsLayer == m_rootTransformLayer.get()) { | 837 } else if (graphicsLayer == m_rootTransformLayer.get()) { |
832 name = "Root Transform Layer"; | 838 name = "Root Transform Layer"; |
833 } else { | 839 } else { |
834 ASSERT_NOT_REACHED(); | 840 ASSERT_NOT_REACHED(); |
835 } | 841 } |
836 | 842 |
837 return name; | 843 return name; |
838 } | 844 } |
839 | 845 |
840 } // namespace blink | 846 } // namespace blink |
OLD | NEW |