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 Document& document = this->document(); | |
257 | |
256 // FIXME: The specification is not clear about what is the expected behavior here: | 258 // FIXME: The specification is not clear about what is the expected behavior here: |
Julien - ping for review
2013/10/08 18:07:14
The specification is clear now no?
Maybe we shoul
| |
257 // http://dev.w3.org/csswg/cssom-view/#dom-element-scrollleft | 259 // http://dev.w3.org/csswg/cssom-view/#dom-element-scrollleft |
258 // Blink bails out in order to match other engines' behavior (WebKit, IE, Fi refox and Opera12). | 260 if (!document.inQuirksMode()) |
259 if (!document().inQuirksMode()) | 261 UseCounter::countDeprecation(&document, UseCounter::ScrollLeftBody); |
260 return 0; | 262 else |
263 UseCounter::count(&document, UseCounter::ScrollLeftBody); | |
261 | 264 |
262 // Update the document's layout. | |
263 Document& document = this->document(); | |
264 document.updateLayoutIgnorePendingStylesheets(); | 265 document.updateLayoutIgnorePendingStylesheets(); |
265 FrameView* view = document.view(); | 266 FrameView* view = document.view(); |
266 return view ? adjustForZoom(view->scrollX(), &document) : 0; | 267 return view ? adjustForZoom(view->scrollX(), &document) : 0; |
267 } | 268 } |
268 | 269 |
269 void HTMLBodyElement::setScrollLeft(int scrollLeft) | 270 void HTMLBodyElement::setScrollLeft(int scrollLeft) |
270 { | 271 { |
271 if (!document().inQuirksMode()) | 272 Document& document = this->document(); |
272 return; | |
273 | 273 |
274 Document& document = this->document(); | 274 if (!document.inQuirksMode()) |
275 UseCounter::countDeprecation(&document, UseCounter::ScrollLeftBody); | |
276 else | |
277 UseCounter::count(&document, UseCounter::ScrollLeftBody); | |
278 | |
275 document.updateLayoutIgnorePendingStylesheets(); | 279 document.updateLayoutIgnorePendingStylesheets(); |
276 Frame* frame = document.frame(); | 280 Frame* frame = document.frame(); |
277 if (!frame) | 281 if (!frame) |
278 return; | 282 return; |
279 FrameView* view = frame->view(); | 283 FrameView* view = frame->view(); |
280 if (!view) | 284 if (!view) |
281 return; | 285 return; |
282 view->setScrollPosition(IntPoint(static_cast<int>(scrollLeft * frame->pageZo omFactor()), view->scrollY())); | 286 view->setScrollPosition(IntPoint(static_cast<int>(scrollLeft * frame->pageZo omFactor()), view->scrollY())); |
283 } | 287 } |
284 | 288 |
285 int HTMLBodyElement::scrollTop() | 289 int HTMLBodyElement::scrollTop() |
286 { | 290 { |
291 Document& document = this->document(); | |
292 | |
287 // FIXME: The specification is not clear about what is the expected behavior here: | 293 // FIXME: The specification is not clear about what is the expected behavior here: |
288 // http://dev.w3.org/csswg/cssom-view/#dom-element-scrolltop . | 294 // http://dev.w3.org/csswg/cssom-view/#dom-element-scrolltop . |
289 // Blink bails out in order to match other engines' behavior (WebKit, IE, Fi refox and Opera12). | 295 if (!document.inQuirksMode()) |
290 if (!document().inQuirksMode()) | 296 UseCounter::countDeprecation(&document, UseCounter::ScrollTopBody); |
291 return 0; | 297 else |
298 UseCounter::count(&document, UseCounter::ScrollTopBody); | |
292 | 299 |
293 // Update the document's layout. | |
294 Document& document = this->document(); | |
295 document.updateLayoutIgnorePendingStylesheets(); | 300 document.updateLayoutIgnorePendingStylesheets(); |
296 FrameView* view = document.view(); | 301 FrameView* view = document.view(); |
297 return view ? adjustForZoom(view->scrollY(), &document) : 0; | 302 return view ? adjustForZoom(view->scrollY(), &document) : 0; |
298 } | 303 } |
299 | 304 |
300 void HTMLBodyElement::setScrollTop(int scrollTop) | 305 void HTMLBodyElement::setScrollTop(int scrollTop) |
301 { | 306 { |
302 if (!document().inQuirksMode()) | 307 Document& document = this->document(); |
303 return; | |
304 | 308 |
305 Document& document = this->document(); | 309 if (!document.inQuirksMode()) |
310 UseCounter::countDeprecation(&document, UseCounter::ScrollTopBody); | |
311 else | |
312 UseCounter::count(&document, UseCounter::ScrollTopBody); | |
313 | |
306 document.updateLayoutIgnorePendingStylesheets(); | 314 document.updateLayoutIgnorePendingStylesheets(); |
307 Frame* frame = document.frame(); | 315 Frame* frame = document.frame(); |
308 if (!frame) | 316 if (!frame) |
309 return; | 317 return; |
310 FrameView* view = frame->view(); | 318 FrameView* view = frame->view(); |
311 if (!view) | 319 if (!view) |
312 return; | 320 return; |
313 view->setScrollPosition(IntPoint(view->scrollX(), static_cast<int>(scrollTop * frame->pageZoomFactor()))); | 321 view->setScrollPosition(IntPoint(view->scrollX(), static_cast<int>(scrollTop * frame->pageZoomFactor()))); |
314 } | 322 } |
315 | 323 |
(...skipping 16 matching lines...) Expand all Loading... | |
332 } | 340 } |
333 | 341 |
334 void HTMLBodyElement::addSubresourceAttributeURLs(ListHashSet<KURL>& urls) const | 342 void HTMLBodyElement::addSubresourceAttributeURLs(ListHashSet<KURL>& urls) const |
335 { | 343 { |
336 HTMLElement::addSubresourceAttributeURLs(urls); | 344 HTMLElement::addSubresourceAttributeURLs(urls); |
337 | 345 |
338 addSubresourceURL(urls, document().completeURL(getAttribute(backgroundAttr)) ); | 346 addSubresourceURL(urls, document().completeURL(getAttribute(backgroundAttr)) ); |
339 } | 347 } |
340 | 348 |
341 } // namespace WebCore | 349 } // namespace WebCore |
OLD | NEW |