| 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 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 123 return FloatRect(); | 123 return FloatRect(); |
| 124 | 124 |
| 125 FloatRect viewRect = mainFrame()->view()->visibleContentRect(); | 125 FloatRect viewRect = mainFrame()->view()->visibleContentRect(); |
| 126 FloatRect pinchRect = visibleRect(); | 126 FloatRect pinchRect = visibleRect(); |
| 127 pinchRect.moveBy(viewRect.location()); | 127 pinchRect.moveBy(viewRect.location()); |
| 128 return pinchRect; | 128 return pinchRect; |
| 129 } | 129 } |
| 130 | 130 |
| 131 void PinchViewport::scrollIntoView(const FloatRect& rect) | 131 void PinchViewport::scrollIntoView(const FloatRect& rect) |
| 132 { | 132 { |
| 133 if (!mainFrame() || !mainFrame()->view()) | 133 // FIXME(sky): Delete this whole file. |
| 134 return; | |
| 135 | |
| 136 FrameView* view = mainFrame()->view(); | |
| 137 | |
| 138 float centeringOffsetX = (visibleRect().width() - rect.width()) / 2; | |
| 139 float centeringOffsetY = (visibleRect().height() - rect.height()) / 2; | |
| 140 | |
| 141 FloatPoint targetOffset( | |
| 142 rect.x() - centeringOffsetX - visibleRect().x(), | |
| 143 rect.y() - centeringOffsetY - visibleRect().y()); | |
| 144 | |
| 145 view->setScrollPosition(flooredIntPoint(targetOffset)); | |
| 146 | |
| 147 FloatPoint remainder = FloatPoint(targetOffset - view->scrollPosition()); | |
| 148 move(remainder); | |
| 149 } | 134 } |
| 150 | 135 |
| 151 void PinchViewport::setLocation(const FloatPoint& newLocation) | 136 void PinchViewport::setLocation(const FloatPoint& newLocation) |
| 152 { | 137 { |
| 153 FloatPoint clampedOffset(clampOffsetToBoundaries(newLocation)); | 138 FloatPoint clampedOffset(clampOffsetToBoundaries(newLocation)); |
| 154 | 139 |
| 155 if (clampedOffset == m_offset) | 140 if (clampedOffset == m_offset) |
| 156 return; | 141 return; |
| 157 | 142 |
| 158 m_offset = clampedOffset; | 143 m_offset = clampedOffset; |
| (...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 438 } else if (graphicsLayer == m_overlayScrollbarVertical.get()) { | 423 } else if (graphicsLayer == m_overlayScrollbarVertical.get()) { |
| 439 name = "Overlay Scrollbar Vertical Layer"; | 424 name = "Overlay Scrollbar Vertical Layer"; |
| 440 } else { | 425 } else { |
| 441 ASSERT_NOT_REACHED(); | 426 ASSERT_NOT_REACHED(); |
| 442 } | 427 } |
| 443 | 428 |
| 444 return name; | 429 return name; |
| 445 } | 430 } |
| 446 | 431 |
| 447 } // namespace blink | 432 } // namespace blink |
| OLD | NEW |