Chromium Code Reviews| 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 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 121 scaledSize.expand(0, m_topControlsAdjustment); | 121 scaledSize.expand(0, m_topControlsAdjustment); |
| 122 scaledSize.scale(1 / m_scale); | 122 scaledSize.scale(1 / m_scale); |
| 123 return FloatRect(m_offset, scaledSize); | 123 return FloatRect(m_offset, scaledSize); |
| 124 } | 124 } |
| 125 | 125 |
| 126 FloatRect PinchViewport::visibleRectInDocument() const | 126 FloatRect PinchViewport::visibleRectInDocument() const |
| 127 { | 127 { |
| 128 if (!mainFrame() || !mainFrame()->view()) | 128 if (!mainFrame() || !mainFrame()->view()) |
| 129 return FloatRect(); | 129 return FloatRect(); |
| 130 | 130 |
| 131 FloatRect viewRect = mainFrame()->view()->visibleContentRect(); | 131 FloatRect viewRect = mainFrame()->view()->scrollableArea()->visibleContentRe ct(); |
| 132 FloatRect pinchRect = visibleRect(); | 132 FloatRect pinchRect = visibleRect(); |
| 133 pinchRect.moveBy(viewRect.location()); | 133 pinchRect.moveBy(viewRect.location()); |
| 134 return pinchRect; | 134 return pinchRect; |
| 135 } | 135 } |
| 136 | 136 |
| 137 FloatRect PinchViewport::mainViewToViewportCSSPixels(const FloatRect& rect) cons t | 137 FloatRect PinchViewport::mainViewToViewportCSSPixels(const FloatRect& rect) cons t |
| 138 { | 138 { |
| 139 // Note, this is in CSS Pixels so we don't apply scale. | 139 // Note, this is in CSS Pixels so we don't apply scale. |
| 140 FloatRect rectInViewport = rect; | 140 FloatRect rectInViewport = rect; |
| 141 rectInViewport.moveBy(-location()); | 141 rectInViewport.moveBy(-location()); |
| (...skipping 10 matching lines...) Expand all Loading... | |
| 152 // Snap the visible rect to layout units to match the input rect. | 152 // Snap the visible rect to layout units to match the input rect. |
| 153 FloatRect visible = LayoutRect(visibleRect()); | 153 FloatRect visible = LayoutRect(visibleRect()); |
| 154 | 154 |
| 155 float centeringOffsetX = (visible.width() - rect.width()) / 2; | 155 float centeringOffsetX = (visible.width() - rect.width()) / 2; |
| 156 float centeringOffsetY = (visible.height() - rect.height()) / 2; | 156 float centeringOffsetY = (visible.height() - rect.height()) / 2; |
| 157 | 157 |
| 158 DoublePoint targetOffset( | 158 DoublePoint targetOffset( |
| 159 rect.x() - centeringOffsetX - visible.x(), | 159 rect.x() - centeringOffsetX - visible.x(), |
| 160 rect.y() - centeringOffsetY - visible.y()); | 160 rect.y() - centeringOffsetY - visible.y()); |
| 161 | 161 |
| 162 view->setScrollPosition(targetOffset); | 162 view->setScrollPosition(targetOffset); |
|
ajuma
2015/01/31 00:53:17
Does this (and the other places in this file where
skobes
2015/01/31 00:59:13
Yes, everything that touches the FrameView's scrol
| |
| 163 | 163 |
| 164 DoublePoint remainder = DoublePoint(targetOffset - view->scrollPositionDoubl e()); | 164 DoublePoint remainder = DoublePoint(targetOffset - view->scrollPositionDoubl e()); |
| 165 move(toFloatPoint(remainder)); | 165 move(toFloatPoint(remainder)); |
| 166 } | 166 } |
| 167 | 167 |
| 168 void PinchViewport::setLocation(const FloatPoint& newLocation) | 168 void PinchViewport::setLocation(const FloatPoint& newLocation) |
| 169 { | 169 { |
| 170 setScaleAndLocation(m_scale, newLocation); | 170 setScaleAndLocation(m_scale, newLocation); |
| 171 } | 171 } |
| 172 | 172 |
| (...skipping 374 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 547 } else if (graphicsLayer == m_rootTransformLayer) { | 547 } else if (graphicsLayer == m_rootTransformLayer) { |
| 548 name = "Root Transform Layer"; | 548 name = "Root Transform Layer"; |
| 549 } else { | 549 } else { |
| 550 ASSERT_NOT_REACHED(); | 550 ASSERT_NOT_REACHED(); |
| 551 } | 551 } |
| 552 | 552 |
| 553 return name; | 553 return name; |
| 554 } | 554 } |
| 555 | 555 |
| 556 } // namespace blink | 556 } // namespace blink |
| OLD | NEW |