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

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

Issue 25741004: set and get scrollTop/Left through documentElement and body should be symmetric, according to the d… (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: set and get scrollTop/Left through documentElement and body should be symmetric, according to the d… 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 250 matching lines...) Expand 10 before | Expand all | Expand 10 after
261 261
262 // Update the document's layout. 262 // Update the document's layout.
263 Document& document = this->document(); 263 Document& document = this->document();
264 document.updateLayoutIgnorePendingStylesheets(); 264 document.updateLayoutIgnorePendingStylesheets();
265 FrameView* view = document.view(); 265 FrameView* view = document.view();
266 return view ? adjustForZoom(view->scrollX(), &document) : 0; 266 return view ? adjustForZoom(view->scrollX(), &document) : 0;
267 } 267 }
268 268
269 void HTMLBodyElement::setScrollLeft(int scrollLeft) 269 void HTMLBodyElement::setScrollLeft(int scrollLeft)
270 { 270 {
271 if (!document().inQuirksMode())
272 return;
273
271 Document& document = this->document(); 274 Document& document = this->document();
272 document.updateLayoutIgnorePendingStylesheets(); 275 document.updateLayoutIgnorePendingStylesheets();
273 Frame* frame = document.frame(); 276 Frame* frame = document.frame();
274 if (!frame) 277 if (!frame)
275 return; 278 return;
276 FrameView* view = frame->view(); 279 FrameView* view = frame->view();
277 if (!view) 280 if (!view)
278 return; 281 return;
279 view->setScrollPosition(IntPoint(static_cast<int>(scrollLeft * frame->pageZo omFactor()), view->scrollY())); 282 view->setScrollPosition(IntPoint(static_cast<int>(scrollLeft * frame->pageZo omFactor()), view->scrollY()));
280 } 283 }
281 284
282 int HTMLBodyElement::scrollTop() 285 int HTMLBodyElement::scrollTop()
283 { 286 {
284 // FIXME: The specification is not clear about what is the expected behavior here: 287 // FIXME: The specification is not clear about what is the expected behavior here:
285 // http://dev.w3.org/csswg/cssom-view/#dom-element-scrolltop . 288 // 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). 289 // Blink bails out in order to match other engines' behavior (WebKit, IE, Fi refox and Opera12).
287 if (!document().inQuirksMode()) 290 if (!document().inQuirksMode())
288 return 0; 291 return 0;
289 292
290 // Update the document's layout. 293 // Update the document's layout.
291 Document& document = this->document(); 294 Document& document = this->document();
292 document.updateLayoutIgnorePendingStylesheets(); 295 document.updateLayoutIgnorePendingStylesheets();
293 FrameView* view = document.view(); 296 FrameView* view = document.view();
294 return view ? adjustForZoom(view->scrollY(), &document) : 0; 297 return view ? adjustForZoom(view->scrollY(), &document) : 0;
295 } 298 }
296 299
297 void HTMLBodyElement::setScrollTop(int scrollTop) 300 void HTMLBodyElement::setScrollTop(int scrollTop)
298 { 301 {
302 if (!document().inQuirksMode())
303 return;
304
299 Document& document = this->document(); 305 Document& document = this->document();
300 document.updateLayoutIgnorePendingStylesheets(); 306 document.updateLayoutIgnorePendingStylesheets();
301 Frame* frame = document.frame(); 307 Frame* frame = document.frame();
302 if (!frame) 308 if (!frame)
303 return; 309 return;
304 FrameView* view = frame->view(); 310 FrameView* view = frame->view();
305 if (!view) 311 if (!view)
306 return; 312 return;
307 view->setScrollPosition(IntPoint(view->scrollX(), static_cast<int>(scrollTop * frame->pageZoomFactor()))); 313 view->setScrollPosition(IntPoint(view->scrollX(), static_cast<int>(scrollTop * frame->pageZoomFactor())));
308 } 314 }
(...skipping 17 matching lines...) Expand all
326 } 332 }
327 333
328 void HTMLBodyElement::addSubresourceAttributeURLs(ListHashSet<KURL>& urls) const 334 void HTMLBodyElement::addSubresourceAttributeURLs(ListHashSet<KURL>& urls) const
329 { 335 {
330 HTMLElement::addSubresourceAttributeURLs(urls); 336 HTMLElement::addSubresourceAttributeURLs(urls);
331 337
332 addSubresourceURL(urls, document().completeURL(getAttribute(backgroundAttr)) ); 338 addSubresourceURL(urls, document().completeURL(getAttribute(backgroundAttr)) );
333 } 339 }
334 340
335 } // namespace WebCore 341 } // 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