| 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 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 247 bool VisualViewport::didSetScaleOrLocation(float scale, | 247 bool VisualViewport::didSetScaleOrLocation(float scale, |
| 248 const FloatPoint& location) { | 248 const FloatPoint& location) { |
| 249 if (!mainFrame()) | 249 if (!mainFrame()) |
| 250 return false; | 250 return false; |
| 251 | 251 |
| 252 bool valuesChanged = false; | 252 bool valuesChanged = false; |
| 253 | 253 |
| 254 if (scale != m_scale) { | 254 if (scale != m_scale) { |
| 255 m_scale = scale; | 255 m_scale = scale; |
| 256 valuesChanged = true; | 256 valuesChanged = true; |
| 257 frameHost().chromeClient().pageScaleFactorChanged(); | 257 frameHost().page().chromeClient().pageScaleFactorChanged(); |
| 258 enqueueResizeEvent(); | 258 enqueueResizeEvent(); |
| 259 } | 259 } |
| 260 | 260 |
| 261 ScrollOffset clampedOffset = clampScrollOffset(toScrollOffset(location)); | 261 ScrollOffset clampedOffset = clampScrollOffset(toScrollOffset(location)); |
| 262 | 262 |
| 263 if (clampedOffset != m_offset) { | 263 if (clampedOffset != m_offset) { |
| 264 m_offset = clampedOffset; | 264 m_offset = clampedOffset; |
| 265 scrollAnimator().setCurrentOffset(m_offset); | 265 scrollAnimator().setCurrentOffset(m_offset); |
| 266 | 266 |
| 267 // SVG runs with accelerated compositing disabled so no | 267 // SVG runs with accelerated compositing disabled so no |
| (...skipping 21 matching lines...) Expand all Loading... |
| 289 | 289 |
| 290 clampToBoundaries(); | 290 clampToBoundaries(); |
| 291 | 291 |
| 292 return true; | 292 return true; |
| 293 } | 293 } |
| 294 | 294 |
| 295 bool VisualViewport::magnifyScaleAroundAnchor(float magnifyDelta, | 295 bool VisualViewport::magnifyScaleAroundAnchor(float magnifyDelta, |
| 296 const FloatPoint& anchor) { | 296 const FloatPoint& anchor) { |
| 297 const float oldPageScale = scale(); | 297 const float oldPageScale = scale(); |
| 298 const float newPageScale = | 298 const float newPageScale = |
| 299 frameHost().chromeClient().clampPageScaleFactorToLimits(magnifyDelta * | 299 frameHost().page().chromeClient().clampPageScaleFactorToLimits( |
| 300 oldPageScale); | 300 magnifyDelta * oldPageScale); |
| 301 if (newPageScale == oldPageScale) | 301 if (newPageScale == oldPageScale) |
| 302 return false; | 302 return false; |
| 303 if (!mainFrame() || !mainFrame()->view()) | 303 if (!mainFrame() || !mainFrame()->view()) |
| 304 return false; | 304 return false; |
| 305 | 305 |
| 306 // Keep the center-of-pinch anchor in a stable position over the course | 306 // Keep the center-of-pinch anchor in a stable position over the course |
| 307 // of the magnify. | 307 // of the magnify. |
| 308 FloatPoint anchorAtOldScale = anchor.scaledBy(1.f / oldPageScale); | 308 FloatPoint anchorAtOldScale = anchor.scaledBy(1.f / oldPageScale); |
| 309 FloatPoint anchorAtNewScale = anchor.scaledBy(1.f / newPageScale); | 309 FloatPoint anchorAtNewScale = anchor.scaledBy(1.f / newPageScale); |
| 310 FloatSize anchorDelta = anchorAtOldScale - anchorAtNewScale; | 310 FloatSize anchorDelta = anchorAtOldScale - anchorAtNewScale; |
| (...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 495 | 495 |
| 496 bool VisualViewport::visualViewportSuppliesScrollbars() const { | 496 bool VisualViewport::visualViewportSuppliesScrollbars() const { |
| 497 return frameHost().page().settings().getViewportEnabled(); | 497 return frameHost().page().settings().getViewportEnabled(); |
| 498 } | 498 } |
| 499 | 499 |
| 500 bool VisualViewport::scrollAnimatorEnabled() const { | 500 bool VisualViewport::scrollAnimatorEnabled() const { |
| 501 return frameHost().page().settings().getScrollAnimatorEnabled(); | 501 return frameHost().page().settings().getScrollAnimatorEnabled(); |
| 502 } | 502 } |
| 503 | 503 |
| 504 HostWindow* VisualViewport::getHostWindow() const { | 504 HostWindow* VisualViewport::getHostWindow() const { |
| 505 return &frameHost().chromeClient(); | 505 return &frameHost().page().chromeClient(); |
| 506 } | 506 } |
| 507 | 507 |
| 508 bool VisualViewport::shouldUseIntegerScrollOffset() const { | 508 bool VisualViewport::shouldUseIntegerScrollOffset() const { |
| 509 LocalFrame* frame = mainFrame(); | 509 LocalFrame* frame = mainFrame(); |
| 510 if (frame && frame->settings() && | 510 if (frame && frame->settings() && |
| 511 !frame->settings()->getPreferCompositingToLCDTextEnabled()) | 511 !frame->settings()->getPreferCompositingToLCDTextEnabled()) |
| 512 return true; | 512 return true; |
| 513 | 513 |
| 514 return ScrollableArea::shouldUseIntegerScrollOffset(); | 514 return ScrollableArea::shouldUseIntegerScrollOffset(); |
| 515 } | 515 } |
| (...skipping 339 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 855 } else if (graphicsLayer == m_rootTransformLayer.get()) { | 855 } else if (graphicsLayer == m_rootTransformLayer.get()) { |
| 856 name = "Root Transform Layer"; | 856 name = "Root Transform Layer"; |
| 857 } else { | 857 } else { |
| 858 ASSERT_NOT_REACHED(); | 858 ASSERT_NOT_REACHED(); |
| 859 } | 859 } |
| 860 | 860 |
| 861 return name; | 861 return name; |
| 862 } | 862 } |
| 863 | 863 |
| 864 } // namespace blink | 864 } // namespace blink |
| OLD | NEW |