Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(39)

Side by Side Diff: Source/core/html/HTMLBodyElement.cpp

Issue 25039006: document.documentElement.scrollTop/Left is zero (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: document.documentElement.scrollTop/Left is zero Created 7 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « Source/core/dom/Element.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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 // FIXME: The specification is not clear about what is the expected behavior here:
257 // 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).
259 if (!document().inQuirksMode())
260 return 0;
261
256 // Update the document's layout. 262 // Update the document's layout.
257 Document& document = this->document(); 263 Document& document = this->document();
258 document.updateLayoutIgnorePendingStylesheets(); 264 document.updateLayoutIgnorePendingStylesheets();
259 FrameView* view = document.view(); 265 FrameView* view = document.view();
260 return view ? adjustForZoom(view->scrollX(), &document) : 0; 266 return view ? adjustForZoom(view->scrollX(), &document) : 0;
261 } 267 }
262 268
263 void HTMLBodyElement::setScrollLeft(int scrollLeft) 269 void HTMLBodyElement::setScrollLeft(int scrollLeft)
264 { 270 {
265 Document& document = this->document(); 271 Document& document = this->document();
266 document.updateLayoutIgnorePendingStylesheets(); 272 document.updateLayoutIgnorePendingStylesheets();
267 Frame* frame = document.frame(); 273 Frame* frame = document.frame();
268 if (!frame) 274 if (!frame)
269 return; 275 return;
270 FrameView* view = frame->view(); 276 FrameView* view = frame->view();
271 if (!view) 277 if (!view)
272 return; 278 return;
273 view->setScrollPosition(IntPoint(static_cast<int>(scrollLeft * frame->pageZo omFactor()), view->scrollY())); 279 view->setScrollPosition(IntPoint(static_cast<int>(scrollLeft * frame->pageZo omFactor()), view->scrollY()));
274 } 280 }
275 281
276 int HTMLBodyElement::scrollTop() 282 int HTMLBodyElement::scrollTop()
277 { 283 {
284 // FIXME: The specification is not clear about what is the expected behavior here:
285 // http://dev.w3.org/csswg/cssom-view/#dom-element-scrolltop .
286 // Blink bails out in order to match other engines' behavior (WebKit, IE, Fi refox and Opera12).
287 if (!document().inQuirksMode())
288 return 0;
289
278 // Update the document's layout. 290 // Update the document's layout.
279 Document& document = this->document(); 291 Document& document = this->document();
280 document.updateLayoutIgnorePendingStylesheets(); 292 document.updateLayoutIgnorePendingStylesheets();
281 FrameView* view = document.view(); 293 FrameView* view = document.view();
282 return view ? adjustForZoom(view->scrollY(), &document) : 0; 294 return view ? adjustForZoom(view->scrollY(), &document) : 0;
283 } 295 }
284 296
285 void HTMLBodyElement::setScrollTop(int scrollTop) 297 void HTMLBodyElement::setScrollTop(int scrollTop)
286 { 298 {
287 Document& document = this->document(); 299 Document& document = this->document();
(...skipping 26 matching lines...) Expand all
314 } 326 }
315 327
316 void HTMLBodyElement::addSubresourceAttributeURLs(ListHashSet<KURL>& urls) const 328 void HTMLBodyElement::addSubresourceAttributeURLs(ListHashSet<KURL>& urls) const
317 { 329 {
318 HTMLElement::addSubresourceAttributeURLs(urls); 330 HTMLElement::addSubresourceAttributeURLs(urls);
319 331
320 addSubresourceURL(urls, document().completeURL(getAttribute(backgroundAttr)) ); 332 addSubresourceURL(urls, document().completeURL(getAttribute(backgroundAttr)) );
321 } 333 }
322 334
323 } // namespace WebCore 335 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/dom/Element.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698