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 double width = adjustScrollForAbsoluteZoom(visibleSize().width(), mainFrame(
)->pageZoomFactor()); | 261 double width = adjustScrollForAbsoluteZoom(visibleSize().width(), mainFrame(
)->pageZoomFactor()); |
262 return width - mainFrame()->view()->verticalScrollbarWidth(); | 262 return width - mainFrame()->view()->verticalScrollbarWidth(); |
263 } | 263 } |
264 | 264 |
265 double VisualViewport::clientHeight() | 265 double VisualViewport::clientHeight() |
266 { | 266 { |
267 if (!mainFrame()) | 267 if (!mainFrame()) |
268 return 0; | 268 return 0; |
269 | 269 |
270 updateLayoutIgnorePendingStylesheets(); | 270 updateStyleAndLayoutIgnorePendingStylesheets(); |
271 | 271 |
272 double height = adjustScrollForAbsoluteZoom(visibleSize().height(), mainFram
e()->pageZoomFactor()); | 272 double height = adjustScrollForAbsoluteZoom(visibleSize().height(), mainFram
e()->pageZoomFactor()); |
273 return height - mainFrame()->view()->horizontalScrollbarHeight(); | 273 return height - mainFrame()->view()->horizontalScrollbarHeight(); |
274 } | 274 } |
275 | 275 |
276 double VisualViewport::pageScale() | 276 double VisualViewport::pageScale() |
277 { | 277 { |
278 updateLayoutIgnorePendingStylesheets(); | 278 updateStyleAndLayoutIgnorePendingStylesheets(); |
279 | 279 |
280 return m_scale; | 280 return m_scale; |
281 } | 281 } |
282 | 282 |
283 void VisualViewport::setScaleAndLocation(float scale, const FloatPoint& location
) | 283 void VisualViewport::setScaleAndLocation(float scale, const FloatPoint& location
) |
284 { | 284 { |
285 if (!mainFrame()) | 285 if (!mainFrame()) |
286 return; | 286 return; |
287 | 287 |
288 bool valuesChanged = false; | 288 bool valuesChanged = false; |
(...skipping 547 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
836 } else if (graphicsLayer == m_rootTransformLayer) { | 836 } else if (graphicsLayer == m_rootTransformLayer) { |
837 name = "Root Transform Layer"; | 837 name = "Root Transform Layer"; |
838 } else { | 838 } else { |
839 ASSERT_NOT_REACHED(); | 839 ASSERT_NOT_REACHED(); |
840 } | 840 } |
841 | 841 |
842 return name; | 842 return name; |
843 } | 843 } |
844 | 844 |
845 } // namespace blink | 845 } // namespace blink |
OLD | NEW |