OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) |
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) | 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) |
4 * (C) 2000 Simon Hausmann (hausmann@kde.org) | 4 * (C) 2000 Simon Hausmann (hausmann@kde.org) |
5 * (C) 2001 Dirk Mueller (mueller@kde.org) | 5 * (C) 2001 Dirk Mueller (mueller@kde.org) |
6 * Copyright (C) 2004, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserv
ed. | 6 * Copyright (C) 2004, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserv
ed. |
7 * | 7 * |
8 * This library is free software; you can redistribute it and/or | 8 * This library is free software; you can redistribute it and/or |
9 * modify it under the terms of the GNU Library General Public | 9 * modify it under the terms of the GNU Library General Public |
10 * License as published by the Free Software Foundation; either | 10 * License as published by the Free Software Foundation; either |
(...skipping 19 matching lines...) Expand all Loading... |
30 #include "core/css/CSSImageValue.h" | 30 #include "core/css/CSSImageValue.h" |
31 #include "core/css/StylePropertySet.h" | 31 #include "core/css/StylePropertySet.h" |
32 #include "core/css/parser/CSSParser.h" | 32 #include "core/css/parser/CSSParser.h" |
33 #include "core/dom/Attribute.h" | 33 #include "core/dom/Attribute.h" |
34 #include "core/frame/FrameView.h" | 34 #include "core/frame/FrameView.h" |
35 #include "core/frame/LocalFrame.h" | 35 #include "core/frame/LocalFrame.h" |
36 #include "core/frame/ScrollToOptions.h" | 36 #include "core/frame/ScrollToOptions.h" |
37 #include "core/frame/UseCounter.h" | 37 #include "core/frame/UseCounter.h" |
38 #include "core/html/HTMLFrameElementBase.h" | 38 #include "core/html/HTMLFrameElementBase.h" |
39 #include "core/html/parser/HTMLParserIdioms.h" | 39 #include "core/html/parser/HTMLParserIdioms.h" |
40 #include "core/rendering/RenderBox.h" | 40 #include "core/layout/LayoutBox.h" |
41 | 41 |
42 namespace blink { | 42 namespace blink { |
43 | 43 |
44 using namespace HTMLNames; | 44 using namespace HTMLNames; |
45 | 45 |
46 inline HTMLBodyElement::HTMLBodyElement(Document& document) | 46 inline HTMLBodyElement::HTMLBodyElement(Document& document) |
47 : HTMLElement(bodyTag, document) | 47 : HTMLElement(bodyTag, document) |
48 { | 48 { |
49 } | 49 } |
50 | 50 |
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
218 // auto or scroll. | 218 // auto or scroll. |
219 // That said, Blink's {set}scroll{Top,Left} behaviors match Gecko's: even if the
re is a non-overflown | 219 // That said, Blink's {set}scroll{Top,Left} behaviors match Gecko's: even if the
re is a non-overflown |
220 // scrollable area, scrolling should not get propagated to the viewport in neith
er strict | 220 // scrollable area, scrolling should not get propagated to the viewport in neith
er strict |
221 // or quirks modes. | 221 // or quirks modes. |
222 double HTMLBodyElement::scrollLeft() | 222 double HTMLBodyElement::scrollLeft() |
223 { | 223 { |
224 Document& document = this->document(); | 224 Document& document = this->document(); |
225 document.updateLayoutIgnorePendingStylesheets(); | 225 document.updateLayoutIgnorePendingStylesheets(); |
226 | 226 |
227 if (RuntimeEnabledFeatures::scrollTopLeftInteropEnabled()) { | 227 if (RuntimeEnabledFeatures::scrollTopLeftInteropEnabled()) { |
228 RenderBox* render = renderBox(); | 228 LayoutBox* render = layoutBox(); |
229 if (!render) | 229 if (!render) |
230 return 0; | 230 return 0; |
231 if (render->hasOverflowClip()) | 231 if (render->hasOverflowClip()) |
232 return adjustScrollForAbsoluteZoom(render->scrollLeft(), *render); | 232 return adjustScrollForAbsoluteZoom(render->scrollLeft(), *render); |
233 if (!document.inQuirksMode()) | 233 if (!document.inQuirksMode()) |
234 return 0; | 234 return 0; |
235 } | 235 } |
236 | 236 |
237 if (LocalDOMWindow* window = document.domWindow()) | 237 if (LocalDOMWindow* window = document.domWindow()) |
238 return window->scrollX(); | 238 return window->scrollX(); |
239 return 0; | 239 return 0; |
240 } | 240 } |
241 | 241 |
242 void HTMLBodyElement::setScrollLeft(double scrollLeft) | 242 void HTMLBodyElement::setScrollLeft(double scrollLeft) |
243 { | 243 { |
244 Document& document = this->document(); | 244 Document& document = this->document(); |
245 document.updateLayoutIgnorePendingStylesheets(); | 245 document.updateLayoutIgnorePendingStylesheets(); |
246 | 246 |
247 if (std::isnan(scrollLeft)) | 247 if (std::isnan(scrollLeft)) |
248 return; | 248 return; |
249 | 249 |
250 if (RuntimeEnabledFeatures::scrollTopLeftInteropEnabled()) { | 250 if (RuntimeEnabledFeatures::scrollTopLeftInteropEnabled()) { |
251 RenderBox* render = renderBox(); | 251 LayoutBox* render = layoutBox(); |
252 if (!render) | 252 if (!render) |
253 return; | 253 return; |
254 if (render->hasOverflowClip()) { | 254 if (render->hasOverflowClip()) { |
255 // FIXME: Investigate how are other browsers casting to int (roundin
g, ceiling, ...). | 255 // FIXME: Investigate how are other browsers casting to int (roundin
g, ceiling, ...). |
256 render->setScrollLeft(static_cast<int>(scrollLeft * render->style()-
>effectiveZoom())); | 256 render->setScrollLeft(static_cast<int>(scrollLeft * render->style()-
>effectiveZoom())); |
257 return; | 257 return; |
258 } | 258 } |
259 if (!document.inQuirksMode()) | 259 if (!document.inQuirksMode()) |
260 return; | 260 return; |
261 } | 261 } |
262 | 262 |
263 if (LocalDOMWindow* window = document.domWindow()) | 263 if (LocalDOMWindow* window = document.domWindow()) |
264 window->scrollTo(scrollLeft, window->scrollY()); | 264 window->scrollTo(scrollLeft, window->scrollY()); |
265 } | 265 } |
266 | 266 |
267 double HTMLBodyElement::scrollTop() | 267 double HTMLBodyElement::scrollTop() |
268 { | 268 { |
269 Document& document = this->document(); | 269 Document& document = this->document(); |
270 document.updateLayoutIgnorePendingStylesheets(); | 270 document.updateLayoutIgnorePendingStylesheets(); |
271 | 271 |
272 if (RuntimeEnabledFeatures::scrollTopLeftInteropEnabled()) { | 272 if (RuntimeEnabledFeatures::scrollTopLeftInteropEnabled()) { |
273 RenderBox* render = renderBox(); | 273 LayoutBox* render = layoutBox(); |
274 if (!render) | 274 if (!render) |
275 return 0; | 275 return 0; |
276 if (render->hasOverflowClip()) | 276 if (render->hasOverflowClip()) |
277 return adjustLayoutUnitForAbsoluteZoom(render->scrollTop(), *render)
; | 277 return adjustLayoutUnitForAbsoluteZoom(render->scrollTop(), *render)
; |
278 if (!document.inQuirksMode()) | 278 if (!document.inQuirksMode()) |
279 return 0; | 279 return 0; |
280 } | 280 } |
281 | 281 |
282 if (LocalDOMWindow* window = document.domWindow()) | 282 if (LocalDOMWindow* window = document.domWindow()) |
283 return window->scrollY(); | 283 return window->scrollY(); |
284 return 0; | 284 return 0; |
285 } | 285 } |
286 | 286 |
287 void HTMLBodyElement::setScrollTop(double scrollTop) | 287 void HTMLBodyElement::setScrollTop(double scrollTop) |
288 { | 288 { |
289 Document& document = this->document(); | 289 Document& document = this->document(); |
290 document.updateLayoutIgnorePendingStylesheets(); | 290 document.updateLayoutIgnorePendingStylesheets(); |
291 | 291 |
292 if (std::isnan(scrollTop)) | 292 if (std::isnan(scrollTop)) |
293 return; | 293 return; |
294 | 294 |
295 if (RuntimeEnabledFeatures::scrollTopLeftInteropEnabled()) { | 295 if (RuntimeEnabledFeatures::scrollTopLeftInteropEnabled()) { |
296 RenderBox* render = renderBox(); | 296 LayoutBox* render = layoutBox(); |
297 if (!render) | 297 if (!render) |
298 return; | 298 return; |
299 if (render->hasOverflowClip()) { | 299 if (render->hasOverflowClip()) { |
300 // FIXME: Investigate how are other browsers casting to int (roundin
g, ceiling, ...). | 300 // FIXME: Investigate how are other browsers casting to int (roundin
g, ceiling, ...). |
301 render->setScrollTop(static_cast<int>(scrollTop * render->style()->e
ffectiveZoom())); | 301 render->setScrollTop(static_cast<int>(scrollTop * render->style()->e
ffectiveZoom())); |
302 return; | 302 return; |
303 } | 303 } |
304 if (!document.inQuirksMode()) | 304 if (!document.inQuirksMode()) |
305 return; | 305 return; |
306 } | 306 } |
(...skipping 22 matching lines...) Expand all Loading... |
329 | 329 |
330 void HTMLBodyElement::scrollBy(const ScrollToOptions& scrollToOptions) | 330 void HTMLBodyElement::scrollBy(const ScrollToOptions& scrollToOptions) |
331 { | 331 { |
332 Document& document = this->document(); | 332 Document& document = this->document(); |
333 | 333 |
334 // FIXME: This should be removed once scroll updates are processed only afte
r | 334 // FIXME: This should be removed once scroll updates are processed only afte
r |
335 // the compositing update. See http://crbug.com/420741. | 335 // the compositing update. See http://crbug.com/420741. |
336 document.updateLayoutIgnorePendingStylesheets(); | 336 document.updateLayoutIgnorePendingStylesheets(); |
337 | 337 |
338 if (RuntimeEnabledFeatures::scrollTopLeftInteropEnabled()) { | 338 if (RuntimeEnabledFeatures::scrollTopLeftInteropEnabled()) { |
339 RenderBox* render = renderBox(); | 339 LayoutBox* render = layoutBox(); |
340 if (!render) | 340 if (!render) |
341 return; | 341 return; |
342 if (render->hasOverflowClip()) { | 342 if (render->hasOverflowClip()) { |
343 scrollRenderBoxBy(scrollToOptions); | 343 scrollLayoutBoxBy(scrollToOptions); |
344 return; | 344 return; |
345 } | 345 } |
346 if (!document.inQuirksMode()) | 346 if (!document.inQuirksMode()) |
347 return; | 347 return; |
348 } | 348 } |
349 | 349 |
350 scrollFrameBy(scrollToOptions); | 350 scrollFrameBy(scrollToOptions); |
351 } | 351 } |
352 | 352 |
353 void HTMLBodyElement::scrollTo(const ScrollToOptions& scrollToOptions) | 353 void HTMLBodyElement::scrollTo(const ScrollToOptions& scrollToOptions) |
354 { | 354 { |
355 Document& document = this->document(); | 355 Document& document = this->document(); |
356 | 356 |
357 // FIXME: This should be removed once scroll updates are processed only afte
r | 357 // FIXME: This should be removed once scroll updates are processed only afte
r |
358 // the compositing update. See http://crbug.com/420741. | 358 // the compositing update. See http://crbug.com/420741. |
359 document.updateLayoutIgnorePendingStylesheets(); | 359 document.updateLayoutIgnorePendingStylesheets(); |
360 | 360 |
361 if (RuntimeEnabledFeatures::scrollTopLeftInteropEnabled()) { | 361 if (RuntimeEnabledFeatures::scrollTopLeftInteropEnabled()) { |
362 RenderBox* render = renderBox(); | 362 LayoutBox* render = layoutBox(); |
363 if (!render) | 363 if (!render) |
364 return; | 364 return; |
365 if (render->hasOverflowClip()) { | 365 if (render->hasOverflowClip()) { |
366 scrollRenderBoxTo(scrollToOptions); | 366 scrollLayoutBoxTo(scrollToOptions); |
367 return; | 367 return; |
368 } | 368 } |
369 if (!document.inQuirksMode()) | 369 if (!document.inQuirksMode()) |
370 return; | 370 return; |
371 } | 371 } |
372 | 372 |
373 scrollFrameTo(scrollToOptions); | 373 scrollFrameTo(scrollToOptions); |
374 } | 374 } |
375 | 375 |
376 } // namespace blink | 376 } // namespace blink |
OLD | NEW |