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 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
246 if (zoomFactor == 1) | 246 if (zoomFactor == 1) |
247 return value; | 247 return value; |
248 // Needed because of truncation (rather than rounding) when scaling up. | 248 // Needed because of truncation (rather than rounding) when scaling up. |
249 if (zoomFactor > 1) | 249 if (zoomFactor > 1) |
250 value++; | 250 value++; |
251 return static_cast<int>(value / zoomFactor); | 251 return static_cast<int>(value / zoomFactor); |
252 } | 252 } |
253 | 253 |
254 int HTMLBodyElement::scrollLeft() | 254 int HTMLBodyElement::scrollLeft() |
255 { | 255 { |
256 if (!document().inQuirksMode()) | |
257 return 0; | |
258 | |
256 // Update the document's layout. | 259 // Update the document's layout. |
257 Document& document = this->document(); | 260 Document& document = this->document(); |
258 document.updateLayoutIgnorePendingStylesheets(); | 261 document.updateLayoutIgnorePendingStylesheets(); |
259 FrameView* view = document.view(); | 262 FrameView* view = document.view(); |
260 return view ? adjustForZoom(view->scrollX(), &document) : 0; | 263 return view ? adjustForZoom(view->scrollX(), &document) : 0; |
261 } | 264 } |
262 | 265 |
263 void HTMLBodyElement::setScrollLeft(int scrollLeft) | 266 void HTMLBodyElement::setScrollLeft(int scrollLeft) |
264 { | 267 { |
265 Document& document = this->document(); | 268 Document& document = this->document(); |
266 document.updateLayoutIgnorePendingStylesheets(); | 269 document.updateLayoutIgnorePendingStylesheets(); |
267 Frame* frame = document.frame(); | 270 Frame* frame = document.frame(); |
268 if (!frame) | 271 if (!frame) |
269 return; | 272 return; |
270 FrameView* view = frame->view(); | 273 FrameView* view = frame->view(); |
271 if (!view) | 274 if (!view) |
272 return; | 275 return; |
273 view->setScrollPosition(IntPoint(static_cast<int>(scrollLeft * frame->pageZo omFactor()), view->scrollY())); | 276 view->setScrollPosition(IntPoint(static_cast<int>(scrollLeft * frame->pageZo omFactor()), view->scrollY())); |
274 } | 277 } |
275 | 278 |
276 int HTMLBodyElement::scrollTop() | 279 int HTMLBodyElement::scrollTop() |
277 { | 280 { |
281 if (!document().inQuirksMode()) | |
282 return 0; | |
Julien - ping for review
2013/09/30 23:39:57
Is this totally correct?
Step 4 of scrollTop says
tonikitoo_
2013/10/01 14:42:17
This is a valid observation! I believe the specifi
Julien - ping for review
2013/10/01 15:19:51
Clarifying the specification is definitely the way
| |
283 | |
278 // Update the document's layout. | 284 // Update the document's layout. |
279 Document& document = this->document(); | 285 Document& document = this->document(); |
280 document.updateLayoutIgnorePendingStylesheets(); | 286 document.updateLayoutIgnorePendingStylesheets(); |
281 FrameView* view = document.view(); | 287 FrameView* view = document.view(); |
282 return view ? adjustForZoom(view->scrollY(), &document) : 0; | 288 return view ? adjustForZoom(view->scrollY(), &document) : 0; |
283 } | 289 } |
284 | 290 |
285 void HTMLBodyElement::setScrollTop(int scrollTop) | 291 void HTMLBodyElement::setScrollTop(int scrollTop) |
286 { | 292 { |
287 Document& document = this->document(); | 293 Document& document = this->document(); |
(...skipping 26 matching lines...) Expand all Loading... | |
314 } | 320 } |
315 | 321 |
316 void HTMLBodyElement::addSubresourceAttributeURLs(ListHashSet<KURL>& urls) const | 322 void HTMLBodyElement::addSubresourceAttributeURLs(ListHashSet<KURL>& urls) const |
317 { | 323 { |
318 HTMLElement::addSubresourceAttributeURLs(urls); | 324 HTMLElement::addSubresourceAttributeURLs(urls); |
319 | 325 |
320 addSubresourceURL(urls, document().completeURL(getAttribute(backgroundAttr)) ); | 326 addSubresourceURL(urls, document().completeURL(getAttribute(backgroundAttr)) ); |
321 } | 327 } |
322 | 328 |
323 } // namespace WebCore | 329 } // namespace WebCore |
OLD | NEW |