| 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 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 245 | 245 |
| 246 // Keep the center-of-pinch anchor in a stable position over the course | 246 // Keep the center-of-pinch anchor in a stable position over the course |
| 247 // of the magnify. | 247 // of the magnify. |
| 248 FloatPoint anchorAtOldScale = anchor.scaledBy(1.f / oldPageScale); | 248 FloatPoint anchorAtOldScale = anchor.scaledBy(1.f / oldPageScale); |
| 249 FloatPoint anchorAtNewScale = anchor.scaledBy(1.f / newPageScale); | 249 FloatPoint anchorAtNewScale = anchor.scaledBy(1.f / newPageScale); |
| 250 FloatSize anchorDelta = anchorAtOldScale - anchorAtNewScale; | 250 FloatSize anchorDelta = anchorAtOldScale - anchorAtNewScale; |
| 251 | 251 |
| 252 // First try to use the anchor's delta to scroll the FrameView. | 252 // First try to use the anchor's delta to scroll the FrameView. |
| 253 FloatSize anchorDeltaUnusedByScroll = anchorDelta; | 253 FloatSize anchorDeltaUnusedByScroll = anchorDelta; |
| 254 | 254 |
| 255 if (!frameHost().settings().invertViewportScrollOrder()) { | |
| 256 FrameView* view = mainFrame()->view(); | |
| 257 DoublePoint oldPosition = view->scrollPositionDouble(); | |
| 258 view->scrollBy(DoubleSize(anchorDelta.width(), anchorDelta.height()), Us
erScroll); | |
| 259 DoublePoint newPosition = view->scrollPositionDouble(); | |
| 260 anchorDeltaUnusedByScroll -= toFloatSize(newPosition - oldPosition); | |
| 261 } | |
| 262 | |
| 263 // Manually bubble any remaining anchor delta up to the visual viewport. | 255 // Manually bubble any remaining anchor delta up to the visual viewport. |
| 264 FloatPoint newLocation(location() + anchorDeltaUnusedByScroll); | 256 FloatPoint newLocation(location() + anchorDeltaUnusedByScroll); |
| 265 setScaleAndLocation(newPageScale, newLocation); | 257 setScaleAndLocation(newPageScale, newLocation); |
| 266 return true; | 258 return true; |
| 267 } | 259 } |
| 268 | 260 |
| 269 // Modifies the top of the graphics layer tree to add layers needed to support | 261 // Modifies the top of the graphics layer tree to add layers needed to support |
| 270 // the inner/outer viewport fixed-position model for pinch zoom. When finished, | 262 // the inner/outer viewport fixed-position model for pinch zoom. When finished, |
| 271 // the tree will look like this (with * denoting added layers): | 263 // the tree will look like this (with * denoting added layers): |
| 272 // | 264 // |
| (...skipping 474 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 747 } else if (graphicsLayer == m_rootTransformLayer) { | 739 } else if (graphicsLayer == m_rootTransformLayer) { |
| 748 name = "Root Transform Layer"; | 740 name = "Root Transform Layer"; |
| 749 } else { | 741 } else { |
| 750 ASSERT_NOT_REACHED(); | 742 ASSERT_NOT_REACHED(); |
| 751 } | 743 } |
| 752 | 744 |
| 753 return name; | 745 return name; |
| 754 } | 746 } |
| 755 | 747 |
| 756 } // namespace blink | 748 } // namespace blink |
| OLD | NEW |