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

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

Issue 25767003: Revert "document.documentElement.scrollTop/Left is zero" (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: 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 | Annotate | Revision Log
« 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
262 // Update the document's layout. 256 // Update the document's layout.
263 Document& document = this->document(); 257 Document& document = this->document();
264 document.updateLayoutIgnorePendingStylesheets(); 258 document.updateLayoutIgnorePendingStylesheets();
265 FrameView* view = document.view(); 259 FrameView* view = document.view();
266 return view ? adjustForZoom(view->scrollX(), &document) : 0; 260 return view ? adjustForZoom(view->scrollX(), &document) : 0;
267 } 261 }
268 262
269 void HTMLBodyElement::setScrollLeft(int scrollLeft) 263 void HTMLBodyElement::setScrollLeft(int scrollLeft)
270 { 264 {
271 Document& document = this->document(); 265 Document& document = this->document();
272 document.updateLayoutIgnorePendingStylesheets(); 266 document.updateLayoutIgnorePendingStylesheets();
273 Frame* frame = document.frame(); 267 Frame* frame = document.frame();
274 if (!frame) 268 if (!frame)
275 return; 269 return;
276 FrameView* view = frame->view(); 270 FrameView* view = frame->view();
277 if (!view) 271 if (!view)
278 return; 272 return;
279 view->setScrollPosition(IntPoint(static_cast<int>(scrollLeft * frame->pageZo omFactor()), view->scrollY())); 273 view->setScrollPosition(IntPoint(static_cast<int>(scrollLeft * frame->pageZo omFactor()), view->scrollY()));
280 } 274 }
281 275
282 int HTMLBodyElement::scrollTop() 276 int HTMLBodyElement::scrollTop()
283 { 277 {
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
290 // Update the document's layout. 278 // Update the document's layout.
291 Document& document = this->document(); 279 Document& document = this->document();
292 document.updateLayoutIgnorePendingStylesheets(); 280 document.updateLayoutIgnorePendingStylesheets();
293 FrameView* view = document.view(); 281 FrameView* view = document.view();
294 return view ? adjustForZoom(view->scrollY(), &document) : 0; 282 return view ? adjustForZoom(view->scrollY(), &document) : 0;
295 } 283 }
296 284
297 void HTMLBodyElement::setScrollTop(int scrollTop) 285 void HTMLBodyElement::setScrollTop(int scrollTop)
298 { 286 {
299 Document& document = this->document(); 287 Document& document = this->document();
(...skipping 26 matching lines...) Expand all
326 } 314 }
327 315
328 void HTMLBodyElement::addSubresourceAttributeURLs(ListHashSet<KURL>& urls) const 316 void HTMLBodyElement::addSubresourceAttributeURLs(ListHashSet<KURL>& urls) const
329 { 317 {
330 HTMLElement::addSubresourceAttributeURLs(urls); 318 HTMLElement::addSubresourceAttributeURLs(urls);
331 319
332 addSubresourceURL(urls, document().completeURL(getAttribute(backgroundAttr)) ); 320 addSubresourceURL(urls, document().completeURL(getAttribute(backgroundAttr)) );
333 } 321 }
334 322
335 } // namespace WebCore 323 } // 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