| 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 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 80 { | 80 { |
| 81 sendUMAMetrics(); | 81 sendUMAMetrics(); |
| 82 } | 82 } |
| 83 | 83 |
| 84 DEFINE_TRACE(VisualViewport) | 84 DEFINE_TRACE(VisualViewport) |
| 85 { | 85 { |
| 86 visitor->trace(m_frameHost); | 86 visitor->trace(m_frameHost); |
| 87 ScrollableArea::trace(visitor); | 87 ScrollableArea::trace(visitor); |
| 88 } | 88 } |
| 89 | 89 |
| 90 void VisualViewport::updateLayoutIgnorePendingStylesheets() | 90 void VisualViewport::updateStyleAndLayoutIgnorePendingStylesheets() |
| 91 { | 91 { |
| 92 if (!mainFrame()) | 92 if (!mainFrame()) |
| 93 return; | 93 return; |
| 94 | 94 |
| 95 if (Document* document = mainFrame()->document()) | 95 if (Document* document = mainFrame()->document()) |
| 96 document->updateLayoutIgnorePendingStylesheets(); | 96 document->updateStyleAndLayoutIgnorePendingStylesheets(); |
| 97 } | 97 } |
| 98 | 98 |
| 99 void VisualViewport::enqueueChangedEvent() | 99 void VisualViewport::enqueueChangedEvent() |
| 100 { | 100 { |
| 101 if (!RuntimeEnabledFeatures::visualViewportAPIEnabled()) | 101 if (!RuntimeEnabledFeatures::visualViewportAPIEnabled()) |
| 102 return; | 102 return; |
| 103 | 103 |
| 104 if (Document* document = mainFrame()->document()) | 104 if (Document* document = mainFrame()->document()) |
| 105 document->enqueueVisualViewportChangedEvent(); | 105 document->enqueueVisualViewportChangedEvent(); |
| 106 } | 106 } |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 209 void VisualViewport::setScale(float scale) | 209 void VisualViewport::setScale(float scale) |
| 210 { | 210 { |
| 211 setScaleAndLocation(scale, m_offset); | 211 setScaleAndLocation(scale, m_offset); |
| 212 } | 212 } |
| 213 | 213 |
| 214 double VisualViewport::scrollLeft() | 214 double VisualViewport::scrollLeft() |
| 215 { | 215 { |
| 216 if (!mainFrame()) | 216 if (!mainFrame()) |
| 217 return 0; | 217 return 0; |
| 218 | 218 |
| 219 updateLayoutIgnorePendingStylesheets(); | 219 updateStyleAndLayoutIgnorePendingStylesheets(); |
| 220 | 220 |
| 221 return adjustScrollForAbsoluteZoom(visibleRect().x(), mainFrame()->pageZoomF
actor()); | 221 return adjustScrollForAbsoluteZoom(visibleRect().x(), mainFrame()->pageZoomF
actor()); |
| 222 } | 222 } |
| 223 | 223 |
| 224 double VisualViewport::scrollTop() | 224 double VisualViewport::scrollTop() |
| 225 { | 225 { |
| 226 if (!mainFrame()) | 226 if (!mainFrame()) |
| 227 return 0; | 227 return 0; |
| 228 | 228 |
| 229 updateLayoutIgnorePendingStylesheets(); | 229 updateStyleAndLayoutIgnorePendingStylesheets(); |
| 230 | 230 |
| 231 return adjustScrollForAbsoluteZoom(visibleRect().y(), mainFrame()->pageZoomF
actor()); | 231 return adjustScrollForAbsoluteZoom(visibleRect().y(), mainFrame()->pageZoomF
actor()); |
| 232 } | 232 } |
| 233 | 233 |
| 234 void VisualViewport::setScrollLeft(double x) | 234 void VisualViewport::setScrollLeft(double x) |
| 235 { | 235 { |
| 236 if (!mainFrame()) | 236 if (!mainFrame()) |
| 237 return; | 237 return; |
| 238 | 238 |
| 239 updateLayoutIgnorePendingStylesheets(); | 239 updateStyleAndLayoutIgnorePendingStylesheets(); |
| 240 | 240 |
| 241 setLocation(FloatPoint(x * mainFrame()->pageZoomFactor(), location().y())); | 241 setLocation(FloatPoint(x * mainFrame()->pageZoomFactor(), location().y())); |
| 242 } | 242 } |
| 243 | 243 |
| 244 void VisualViewport::setScrollTop(double y) | 244 void VisualViewport::setScrollTop(double y) |
| 245 { | 245 { |
| 246 if (!mainFrame()) | 246 if (!mainFrame()) |
| 247 return; | 247 return; |
| 248 | 248 |
| 249 updateLayoutIgnorePendingStylesheets(); | 249 updateStyleAndLayoutIgnorePendingStylesheets(); |
| 250 | 250 |
| 251 setLocation(FloatPoint(location().x(), y * mainFrame()->pageZoomFactor())); | 251 setLocation(FloatPoint(location().x(), y * mainFrame()->pageZoomFactor())); |
| 252 } | 252 } |
| 253 | 253 |
| 254 double VisualViewport::clientWidth() | 254 double VisualViewport::clientWidth() |
| 255 { | 255 { |
| 256 if (!mainFrame()) | 256 if (!mainFrame()) |
| 257 return 0; | 257 return 0; |
| 258 | 258 |
| 259 updateLayoutIgnorePendingStylesheets(); | 259 updateStyleAndLayoutIgnorePendingStylesheets(); |
| 260 | 260 |
| 261 return adjustScrollForAbsoluteZoom(visibleSize().width(), mainFrame()->pageZ
oomFactor()); | 261 return adjustScrollForAbsoluteZoom(visibleSize().width(), mainFrame()->pageZ
oomFactor()); |
| 262 } | 262 } |
| 263 | 263 |
| 264 double VisualViewport::clientHeight() | 264 double VisualViewport::clientHeight() |
| 265 { | 265 { |
| 266 if (!mainFrame()) | 266 if (!mainFrame()) |
| 267 return 0; | 267 return 0; |
| 268 | 268 |
| 269 updateLayoutIgnorePendingStylesheets(); | 269 updateStyleAndLayoutIgnorePendingStylesheets(); |
| 270 | 270 |
| 271 return adjustScrollForAbsoluteZoom(visibleSize().height(), mainFrame()->page
ZoomFactor()); | 271 return adjustScrollForAbsoluteZoom(visibleSize().height(), mainFrame()->page
ZoomFactor()); |
| 272 } | 272 } |
| 273 | 273 |
| 274 double VisualViewport::pageScale() | 274 double VisualViewport::pageScale() |
| 275 { | 275 { |
| 276 updateLayoutIgnorePendingStylesheets(); | 276 updateStyleAndLayoutIgnorePendingStylesheets(); |
| 277 | 277 |
| 278 return m_scale; | 278 return m_scale; |
| 279 } | 279 } |
| 280 | 280 |
| 281 void VisualViewport::setScaleAndLocation(float scale, const FloatPoint& location
) | 281 void VisualViewport::setScaleAndLocation(float scale, const FloatPoint& location
) |
| 282 { | 282 { |
| 283 if (!mainFrame()) | 283 if (!mainFrame()) |
| 284 return; | 284 return; |
| 285 | 285 |
| 286 bool valuesChanged = false; | 286 bool valuesChanged = false; |
| (...skipping 547 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 834 } else if (graphicsLayer == m_rootTransformLayer) { | 834 } else if (graphicsLayer == m_rootTransformLayer) { |
| 835 name = "Root Transform Layer"; | 835 name = "Root Transform Layer"; |
| 836 } else { | 836 } else { |
| 837 ASSERT_NOT_REACHED(); | 837 ASSERT_NOT_REACHED(); |
| 838 } | 838 } |
| 839 | 839 |
| 840 return name; | 840 return name; |
| 841 } | 841 } |
| 842 | 842 |
| 843 } // namespace blink | 843 } // namespace blink |
| OLD | NEW |