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

Side by Side Diff: Source/core/dom/Element.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
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 706 matching lines...) Expand 10 before | Expand all | Expand 10 after
717 } 717 }
718 718
719 if (RenderBox* rend = renderBox()) 719 if (RenderBox* rend = renderBox())
720 return adjustForAbsoluteZoom(rend->scrollTop(), rend); 720 return adjustForAbsoluteZoom(rend->scrollTop(), rend);
721 return 0; 721 return 0;
722 } 722 }
723 723
724 void Element::setScrollLeft(int newLeft) 724 void Element::setScrollLeft(int newLeft)
725 { 725 {
726 document().updateLayoutIgnorePendingStylesheets(); 726 document().updateLayoutIgnorePendingStylesheets();
727
728 if (document().documentElement() == this) {
729 if (document().inQuirksMode())
730 return;
731
732 Frame* frame = document().frame();
733 if (!frame)
734 return;
735 FrameView* view = frame->view();
736 if (!view)
737 return;
738 view->setScrollPosition(IntPoint(static_cast<int>(newLeft * frame->pageZ oomFactor()), view->scrollY()));
Julien - ping for review 2013/10/05 01:05:46 The specification is weird and seem to imply that
739 }
740
727 if (RenderBox* rend = renderBox()) 741 if (RenderBox* rend = renderBox())
728 rend->setScrollLeft(static_cast<int>(newLeft * rend->style()->effectiveZ oom())); 742 rend->setScrollLeft(static_cast<int>(newLeft * rend->style()->effectiveZ oom()));
729 } 743 }
730 744
731 void Element::setScrollTop(int newTop) 745 void Element::setScrollTop(int newTop)
732 { 746 {
733 document().updateLayoutIgnorePendingStylesheets(); 747 document().updateLayoutIgnorePendingStylesheets();
748
749 if (document().documentElement() == this) {
750 if (document().inQuirksMode())
751 return;
752
753 Frame* frame = document().frame();
754 if (!frame)
755 return;
756 FrameView* view = frame->view();
757 if (!view)
758 return;
759 view->setScrollPosition(IntPoint(view->scrollX(), static_cast<int>(newTo p * frame->pageZoomFactor())));
760 }
761
734 if (RenderBox* rend = renderBox()) 762 if (RenderBox* rend = renderBox())
735 rend->setScrollTop(static_cast<int>(newTop * rend->style()->effectiveZoo m())); 763 rend->setScrollTop(static_cast<int>(newTop * rend->style()->effectiveZoo m()));
736 } 764 }
737 765
738 int Element::scrollWidth() 766 int Element::scrollWidth()
739 { 767 {
740 document().updateLayoutIgnorePendingStylesheets(); 768 document().updateLayoutIgnorePendingStylesheets();
741 if (RenderBox* rend = renderBox()) 769 if (RenderBox* rend = renderBox())
742 return adjustForAbsoluteZoom(rend->scrollWidth(), rend); 770 return adjustForAbsoluteZoom(rend->scrollWidth(), rend);
743 return 0; 771 return 0;
(...skipping 2952 matching lines...) Expand 10 before | Expand all | Expand 10 after
3696 return 0; 3724 return 0;
3697 } 3725 }
3698 3726
3699 Attribute* UniqueElementData::attributeItem(unsigned index) 3727 Attribute* UniqueElementData::attributeItem(unsigned index)
3700 { 3728 {
3701 ASSERT_WITH_SECURITY_IMPLICATION(index < length()); 3729 ASSERT_WITH_SECURITY_IMPLICATION(index < length());
3702 return &m_attributeVector.at(index); 3730 return &m_attributeVector.at(index);
3703 } 3731 }
3704 3732
3705 } // namespace WebCore 3733 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698