| 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 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 204 setLocation(m_offset + delta); | 204 setLocation(m_offset + delta); |
| 205 } | 205 } |
| 206 | 206 |
| 207 void VisualViewport::setScale(float scale) | 207 void VisualViewport::setScale(float scale) |
| 208 { | 208 { |
| 209 setScaleAndLocation(scale, m_offset); | 209 setScaleAndLocation(scale, m_offset); |
| 210 } | 210 } |
| 211 | 211 |
| 212 double VisualViewport::scrollLeft() | 212 double VisualViewport::scrollLeft() |
| 213 { | 213 { |
| 214 if (!mainFrame()) |
| 215 return 0; |
| 216 |
| 214 updateLayoutIgnorePendingStylesheets(); | 217 updateLayoutIgnorePendingStylesheets(); |
| 215 | 218 |
| 216 return visibleRect().x(); | 219 return adjustScrollForAbsoluteZoom(visibleRect().x(), mainFrame()->pageZoomF
actor()); |
| 217 } | 220 } |
| 218 | 221 |
| 219 double VisualViewport::scrollTop() | 222 double VisualViewport::scrollTop() |
| 220 { | 223 { |
| 224 if (!mainFrame()) |
| 225 return 0; |
| 226 |
| 221 updateLayoutIgnorePendingStylesheets(); | 227 updateLayoutIgnorePendingStylesheets(); |
| 222 | 228 |
| 223 return visibleRect().y(); | 229 return adjustScrollForAbsoluteZoom(visibleRect().y(), mainFrame()->pageZoomF
actor()); |
| 224 } | 230 } |
| 225 | 231 |
| 226 void VisualViewport::setScrollLeft(double x) | 232 void VisualViewport::setScrollLeft(double x) |
| 227 { | 233 { |
| 234 if (!mainFrame()) |
| 235 return; |
| 236 |
| 228 updateLayoutIgnorePendingStylesheets(); | 237 updateLayoutIgnorePendingStylesheets(); |
| 229 | 238 |
| 230 setLocation(FloatPoint(x, visibleRect().y())); | 239 setLocation(FloatPoint(x * mainFrame()->pageZoomFactor(), location().y())); |
| 231 } | 240 } |
| 232 | 241 |
| 233 void VisualViewport::setScrollTop(double y) | 242 void VisualViewport::setScrollTop(double y) |
| 234 { | 243 { |
| 244 if (!mainFrame()) |
| 245 return; |
| 246 |
| 235 updateLayoutIgnorePendingStylesheets(); | 247 updateLayoutIgnorePendingStylesheets(); |
| 236 | 248 |
| 237 setLocation(FloatPoint(visibleRect().x(), y)); | 249 setLocation(FloatPoint(location().x(), y * mainFrame()->pageZoomFactor())); |
| 238 } | 250 } |
| 239 | 251 |
| 240 double VisualViewport::clientWidth() | 252 double VisualViewport::clientWidth() |
| 241 { | 253 { |
| 254 if (!mainFrame()) |
| 255 return 0; |
| 256 |
| 242 updateLayoutIgnorePendingStylesheets(); | 257 updateLayoutIgnorePendingStylesheets(); |
| 243 | 258 |
| 244 return visibleRect().width(); | 259 return adjustScrollForAbsoluteZoom(visibleSize().width(), mainFrame()->pageZ
oomFactor()); |
| 245 } | 260 } |
| 246 | 261 |
| 247 double VisualViewport::clientHeight() | 262 double VisualViewport::clientHeight() |
| 248 { | 263 { |
| 264 if (!mainFrame()) |
| 265 return 0; |
| 266 |
| 249 updateLayoutIgnorePendingStylesheets(); | 267 updateLayoutIgnorePendingStylesheets(); |
| 250 | 268 |
| 251 return visibleRect().height(); | 269 return adjustScrollForAbsoluteZoom(visibleSize().height(), mainFrame()->page
ZoomFactor()); |
| 252 } | 270 } |
| 253 | 271 |
| 254 double VisualViewport::pageScale() | 272 double VisualViewport::pageScale() |
| 255 { | 273 { |
| 256 updateLayoutIgnorePendingStylesheets(); | 274 updateLayoutIgnorePendingStylesheets(); |
| 257 | 275 |
| 258 return m_scale; | 276 return m_scale; |
| 259 } | 277 } |
| 260 | 278 |
| 261 void VisualViewport::setScaleAndLocation(float scale, const FloatPoint& location
) | 279 void VisualViewport::setScaleAndLocation(float scale, const FloatPoint& location
) |
| (...skipping 552 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 814 } else if (graphicsLayer == m_rootTransformLayer) { | 832 } else if (graphicsLayer == m_rootTransformLayer) { |
| 815 name = "Root Transform Layer"; | 833 name = "Root Transform Layer"; |
| 816 } else { | 834 } else { |
| 817 ASSERT_NOT_REACHED(); | 835 ASSERT_NOT_REACHED(); |
| 818 } | 836 } |
| 819 | 837 |
| 820 return name; | 838 return name; |
| 821 } | 839 } |
| 822 | 840 |
| 823 } // namespace blink | 841 } // namespace blink |
| OLD | NEW |