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

Side by Side Diff: Source/core/dom/Element.cpp

Issue 51553002: Fix body.scrollTop/Left for scrollable <body> tags (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 7 years, 1 month 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
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) 2001 Peter Kelly (pmk@post.com) 4 * (C) 2001 Peter Kelly (pmk@post.com)
5 * (C) 2001 Dirk Mueller (mueller@kde.org) 5 * (C) 2001 Dirk Mueller (mueller@kde.org)
6 * (C) 2007 David Smith (catfish.man@gmail.com) 6 * (C) 2007 David Smith (catfish.man@gmail.com)
7 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2012, 2013 Apple Inc. All rights reserved. 7 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2012, 2013 Apple Inc. All rights reserved.
8 * (C) 2007 Eric Seidel (eric@webkit.org) 8 * (C) 2007 Eric Seidel (eric@webkit.org)
9 * 9 *
10 * This library is free software; you can redistribute it and/or 10 * This library is free software; you can redistribute it and/or
(...skipping 712 matching lines...) Expand 10 before | Expand all | Expand 10 after
723 if (document().inQuirksMode()) 723 if (document().inQuirksMode())
724 return; 724 return;
725 725
726 Frame* frame = document().frame(); 726 Frame* frame = document().frame();
727 if (!frame) 727 if (!frame)
728 return; 728 return;
729 FrameView* view = frame->view(); 729 FrameView* view = frame->view();
730 if (!view) 730 if (!view)
731 return; 731 return;
732 732
733 // WHATWG spec says [1]: "If the element is the root element invoke scro ll()
734 // with x as first argument and zero as second". Blink intentionally mat ches
735 // other engine's behaviors here, instead, where the 'y' scroll position is
736 // preversed. See [2].
737 // [1] http://dev.w3.org/csswg/cssom-view/#dom-element-scrollleft
738 // [2] https://www.w3.org/Bugs/Public/show_bug.cgi?id=23448
739 view->setScrollPosition(IntPoint(static_cast<int>(newLeft * frame->pageZ oomFactor()), view->scrollY())); 733 view->setScrollPosition(IntPoint(static_cast<int>(newLeft * frame->pageZ oomFactor()), view->scrollY()));
740 } 734 }
741 735
742 if (RenderBox* rend = renderBox()) 736 if (RenderBox* rend = renderBox())
743 rend->setScrollLeft(static_cast<int>(newLeft * rend->style()->effectiveZ oom())); 737 rend->setScrollLeft(static_cast<int>(newLeft * rend->style()->effectiveZ oom()));
744 } 738 }
745 739
746 void Element::setScrollTop(int newTop) 740 void Element::setScrollTop(int newTop)
747 { 741 {
748 document().updateLayoutIgnorePendingStylesheets(); 742 document().updateLayoutIgnorePendingStylesheets();
749 743
750 if (document().documentElement() == this) { 744 if (document().documentElement() == this) {
751 if (document().inQuirksMode()) 745 if (document().inQuirksMode())
752 return; 746 return;
753 747
754 Frame* frame = document().frame(); 748 Frame* frame = document().frame();
755 if (!frame) 749 if (!frame)
756 return; 750 return;
757 FrameView* view = frame->view(); 751 FrameView* view = frame->view();
758 if (!view) 752 if (!view)
759 return; 753 return;
760 754
761 // WHATWG spec says [1]: "If the element is the root element invoke scro ll()
762 // with zero as first argument and y as second". Blink intentionally
763 // matches other engine's behaviors here, instead, where the 'x' scroll
764 // position is preversed. See [2].
765 // [1] http://dev.w3.org/csswg/cssom-view/#dom-element-scrolltop
766 // [2] https://www.w3.org/Bugs/Public/show_bug.cgi?id=23448
767 view->setScrollPosition(IntPoint(view->scrollX(), static_cast<int>(newTo p * frame->pageZoomFactor()))); 755 view->setScrollPosition(IntPoint(view->scrollX(), static_cast<int>(newTo p * frame->pageZoomFactor())));
768 } 756 }
769 757
770 if (RenderBox* rend = renderBox()) 758 if (RenderBox* rend = renderBox())
771 rend->setScrollTop(static_cast<int>(newTop * rend->style()->effectiveZoo m())); 759 rend->setScrollTop(static_cast<int>(newTop * rend->style()->effectiveZoo m()));
772 } 760 }
773 761
774 int Element::scrollWidth() 762 int Element::scrollWidth()
775 { 763 {
776 document().updateLayoutIgnorePendingStylesheets(); 764 document().updateLayoutIgnorePendingStylesheets();
(...skipping 2650 matching lines...) Expand 10 before | Expand all | Expand 10 after
3427 // Before doing so, we need to resolve issues in HTMLSelectElement::recalcLi stItems 3415 // Before doing so, we need to resolve issues in HTMLSelectElement::recalcLi stItems
3428 // and RenderMenuList::setText. See also https://bugs.webkit.org/show_bug.cg i?id=88405 3416 // and RenderMenuList::setText. See also https://bugs.webkit.org/show_bug.cg i?id=88405
3429 if (hasTagName(optionTag) || hasTagName(optgroupTag)) 3417 if (hasTagName(optionTag) || hasTagName(optgroupTag))
3430 return false; 3418 return false;
3431 if (FullscreenElementStack::isActiveFullScreenElement(this)) 3419 if (FullscreenElementStack::isActiveFullScreenElement(this))
3432 return false; 3420 return false;
3433 return true; 3421 return true;
3434 } 3422 }
3435 3423
3436 } // namespace WebCore 3424 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698