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

Side by Side Diff: Source/core/dom/Element.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 | « LayoutTests/rubberbanding/momentum-reset.html ('k') | Source/core/html/HTMLBodyElement.cpp » ('j') | 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) 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 668 matching lines...) Expand 10 before | Expand all | Expand 10 after
679 } 679 }
680 680
681 if (RenderBox* renderer = renderBox()) 681 if (RenderBox* renderer = renderBox())
682 return adjustLayoutUnitForAbsoluteZoom(renderer->pixelSnappedClientHeigh t(), renderer).round(); 682 return adjustLayoutUnitForAbsoluteZoom(renderer->pixelSnappedClientHeigh t(), renderer).round();
683 return 0; 683 return 0;
684 } 684 }
685 685
686 int Element::scrollLeft() 686 int Element::scrollLeft()
687 { 687 {
688 document().updateLayoutIgnorePendingStylesheets(); 688 document().updateLayoutIgnorePendingStylesheets();
689
690 if (document().documentElement() == this) {
691 if (document().inQuirksMode())
692 return 0;
693
694 if (FrameView* view = document().view()) {
695 if (RenderView* renderView = document().renderView())
696 return adjustForAbsoluteZoom(view->scrollX(), renderView);
697 }
698 }
699
689 if (RenderBox* rend = renderBox()) 700 if (RenderBox* rend = renderBox())
690 return adjustForAbsoluteZoom(rend->scrollLeft(), rend); 701 return adjustForAbsoluteZoom(rend->scrollLeft(), rend);
691 return 0; 702 return 0;
692 } 703 }
693 704
694 int Element::scrollTop() 705 int Element::scrollTop()
695 { 706 {
696 document().updateLayoutIgnorePendingStylesheets(); 707 document().updateLayoutIgnorePendingStylesheets();
708
709 if (document().documentElement() == this) {
710 if (document().inQuirksMode())
711 return 0;
712
713 if (FrameView* view = document().view()) {
714 if (RenderView* renderView = document().renderView())
715 return adjustForAbsoluteZoom(view->scrollY(), renderView);
716 }
717 }
718
697 if (RenderBox* rend = renderBox()) 719 if (RenderBox* rend = renderBox())
698 return adjustForAbsoluteZoom(rend->scrollTop(), rend); 720 return adjustForAbsoluteZoom(rend->scrollTop(), rend);
699 return 0; 721 return 0;
700 } 722 }
701 723
702 void Element::setScrollLeft(int newLeft) 724 void Element::setScrollLeft(int newLeft)
703 { 725 {
704 document().updateLayoutIgnorePendingStylesheets(); 726 document().updateLayoutIgnorePendingStylesheets();
705 if (RenderBox* rend = renderBox()) 727 if (RenderBox* rend = renderBox())
706 rend->setScrollLeft(static_cast<int>(newLeft * rend->style()->effectiveZ oom())); 728 rend->setScrollLeft(static_cast<int>(newLeft * rend->style()->effectiveZ oom()));
(...skipping 2967 matching lines...) Expand 10 before | Expand all | Expand 10 after
3674 return 0; 3696 return 0;
3675 } 3697 }
3676 3698
3677 Attribute* UniqueElementData::attributeItem(unsigned index) 3699 Attribute* UniqueElementData::attributeItem(unsigned index)
3678 { 3700 {
3679 ASSERT_WITH_SECURITY_IMPLICATION(index < length()); 3701 ASSERT_WITH_SECURITY_IMPLICATION(index < length());
3680 return &m_attributeVector.at(index); 3702 return &m_attributeVector.at(index);
3681 } 3703 }
3682 3704
3683 } // namespace WebCore 3705 } // namespace WebCore
OLDNEW
« no previous file with comments | « LayoutTests/rubberbanding/momentum-reset.html ('k') | Source/core/html/HTMLBodyElement.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698