| 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 15 matching lines...) Expand all Loading... |
| 26 | 26 |
| 27 #include "bindings/core/v8/ScriptEventListener.h" | 27 #include "bindings/core/v8/ScriptEventListener.h" |
| 28 #include "core/CSSValueKeywords.h" | 28 #include "core/CSSValueKeywords.h" |
| 29 #include "core/HTMLNames.h" | 29 #include "core/HTMLNames.h" |
| 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/UseCounter.h" | 37 #include "core/frame/UseCounter.h" |
| 37 #include "core/html/HTMLFrameElementBase.h" | 38 #include "core/html/HTMLFrameElementBase.h" |
| 38 #include "core/html/parser/HTMLParserIdioms.h" | 39 #include "core/html/parser/HTMLParserIdioms.h" |
| 39 #include "core/rendering/RenderBox.h" | 40 #include "core/rendering/RenderBox.h" |
| 40 | 41 |
| 41 namespace blink { | 42 namespace blink { |
| 42 | 43 |
| 43 using namespace HTMLNames; | 44 using namespace HTMLNames; |
| 44 | 45 |
| 45 inline HTMLBodyElement::HTMLBodyElement(Document& document) | 46 inline HTMLBodyElement::HTMLBodyElement(Document& document) |
| (...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 258 if (!document.inQuirksMode()) | 259 if (!document.inQuirksMode()) |
| 259 return; | 260 return; |
| 260 } | 261 } |
| 261 | 262 |
| 262 LocalFrame* frame = document.frame(); | 263 LocalFrame* frame = document.frame(); |
| 263 if (!frame) | 264 if (!frame) |
| 264 return; | 265 return; |
| 265 FrameView* view = frame->view(); | 266 FrameView* view = frame->view(); |
| 266 if (!view) | 267 if (!view) |
| 267 return; | 268 return; |
| 268 view->setScrollPosition(DoublePoint(scrollLeft * frame->pageZoomFactor(), vi
ew->scrollY())); | 269 view->setScrollPosition(DoublePoint(scrollLeft * frame->pageZoomFactor(), vi
ew->scrollY()), ScrollBehaviorAuto); |
| 269 } | 270 } |
| 270 | 271 |
| 271 double HTMLBodyElement::scrollTop() | 272 double HTMLBodyElement::scrollTop() |
| 272 { | 273 { |
| 273 Document& document = this->document(); | 274 Document& document = this->document(); |
| 274 document.updateLayoutIgnorePendingStylesheets(); | 275 document.updateLayoutIgnorePendingStylesheets(); |
| 275 | 276 |
| 276 if (RuntimeEnabledFeatures::scrollTopLeftInteropEnabled()) { | 277 if (RuntimeEnabledFeatures::scrollTopLeftInteropEnabled()) { |
| 277 RenderBox* render = renderBox(); | 278 RenderBox* render = renderBox(); |
| 278 if (!render) | 279 if (!render) |
| (...skipping 29 matching lines...) Expand all Loading... |
| 308 if (!document.inQuirksMode()) | 309 if (!document.inQuirksMode()) |
| 309 return; | 310 return; |
| 310 } | 311 } |
| 311 | 312 |
| 312 LocalFrame* frame = document.frame(); | 313 LocalFrame* frame = document.frame(); |
| 313 if (!frame) | 314 if (!frame) |
| 314 return; | 315 return; |
| 315 FrameView* view = frame->view(); | 316 FrameView* view = frame->view(); |
| 316 if (!view) | 317 if (!view) |
| 317 return; | 318 return; |
| 318 view->setScrollPosition(DoublePoint(view->scrollX(), scrollTop * frame->page
ZoomFactor())); | 319 view->setScrollPosition(DoublePoint(view->scrollX(), scrollTop * frame->page
ZoomFactor()), ScrollBehaviorAuto); |
| 319 } | 320 } |
| 320 | 321 |
| 321 int HTMLBodyElement::scrollHeight() | 322 int HTMLBodyElement::scrollHeight() |
| 322 { | 323 { |
| 323 // Update the document's layout. | 324 // Update the document's layout. |
| 324 Document& document = this->document(); | 325 Document& document = this->document(); |
| 325 document.updateLayoutIgnorePendingStylesheets(); | 326 document.updateLayoutIgnorePendingStylesheets(); |
| 326 FrameView* view = document.view(); | 327 FrameView* view = document.view(); |
| 327 return view ? adjustForZoom(view->contentsHeight(), &document) : 0; | 328 return view ? adjustForZoom(view->contentsHeight(), &document) : 0; |
| 328 } | 329 } |
| 329 | 330 |
| 330 int HTMLBodyElement::scrollWidth() | 331 int HTMLBodyElement::scrollWidth() |
| 331 { | 332 { |
| 332 // Update the document's layout. | 333 // Update the document's layout. |
| 333 Document& document = this->document(); | 334 Document& document = this->document(); |
| 334 document.updateLayoutIgnorePendingStylesheets(); | 335 document.updateLayoutIgnorePendingStylesheets(); |
| 335 FrameView* view = document.view(); | 336 FrameView* view = document.view(); |
| 336 return view ? adjustForZoom(view->contentsWidth(), &document) : 0; | 337 return view ? adjustForZoom(view->contentsWidth(), &document) : 0; |
| 337 } | 338 } |
| 338 | 339 |
| 340 void HTMLBodyElement::scrollBy(const ScrollToOptions& scrollToOptions) |
| 341 { |
| 342 Document& document = this->document(); |
| 343 |
| 344 // FIXME: This should be removed once scroll updates are processed only afte
r |
| 345 // the compositing update. See http://crbug.com/420741. |
| 346 document.updateLayoutIgnorePendingStylesheets(); |
| 347 |
| 348 if (RuntimeEnabledFeatures::scrollTopLeftInteropEnabled()) { |
| 349 RenderBox* render = renderBox(); |
| 350 if (!render) |
| 351 return; |
| 352 if (render->hasOverflowClip()) { |
| 353 scrollRenderBoxBy(scrollToOptions); |
| 354 return; |
| 355 } |
| 356 if (!document.inQuirksMode()) |
| 357 return; |
| 358 } |
| 359 |
| 360 scrollFrameBy(scrollToOptions); |
| 361 } |
| 362 |
| 363 void HTMLBodyElement::scrollTo(const ScrollToOptions& scrollToOptions) |
| 364 { |
| 365 Document& document = this->document(); |
| 366 |
| 367 // FIXME: This should be removed once scroll updates are processed only afte
r |
| 368 // the compositing update. See http://crbug.com/420741. |
| 369 document.updateLayoutIgnorePendingStylesheets(); |
| 370 |
| 371 if (RuntimeEnabledFeatures::scrollTopLeftInteropEnabled()) { |
| 372 RenderBox* render = renderBox(); |
| 373 if (!render) |
| 374 return; |
| 375 if (render->hasOverflowClip()) { |
| 376 scrollRenderBoxTo(scrollToOptions); |
| 377 return; |
| 378 } |
| 379 if (!document.inQuirksMode()) |
| 380 return; |
| 381 } |
| 382 |
| 383 scrollFrameTo(scrollToOptions); |
| 384 } |
| 385 |
| 339 } // namespace blink | 386 } // namespace blink |
| OLD | NEW |