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

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
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 667 matching lines...) Expand 10 before | Expand all | Expand 10 after
678 } 678 }
679 679
680 if (RenderBox* renderer = renderBox()) 680 if (RenderBox* renderer = renderBox())
681 return adjustLayoutUnitForAbsoluteZoom(renderer->pixelSnappedClientHeigh t(), renderer).round(); 681 return adjustLayoutUnitForAbsoluteZoom(renderer->pixelSnappedClientHeigh t(), renderer).round();
682 return 0; 682 return 0;
683 } 683 }
684 684
685 int Element::scrollLeft() 685 int Element::scrollLeft()
686 { 686 {
687 document().updateLayoutIgnorePendingStylesheets(); 687 document().updateLayoutIgnorePendingStylesheets();
688
689 bool inQuirksMode = document().inQuirksMode();
Julien - ping for review 2013/09/30 23:39:57 For consistency, this should be moved inside the b
tonikitoo_ 2013/10/01 14:42:17 Ok
690 if (document().documentElement() == this) {
691 if (inQuirksMode)
692 return 0;
693
694 if (FrameView* view = document().view()) {
695 if (RenderView* renderView = document().renderView())
696 return adjustForAbsoluteZoom(view->scrollX(), renderView);
Julien - ping for review 2013/09/30 23:39:57 It would be nice to have some zoom testing too.
tonikitoo_ 2013/10/01 14:42:17 Do you think the test this patch edits in LayoutTe
Julien - ping for review 2013/10/01 15:19:51 I missed this test which exercise this code, my ba
tonikitoo_ 2013/10/01 16:49:19 In fact, it changes the test fine. The expected re
697 }
698 }
699
688 if (RenderBox* rend = renderBox()) 700 if (RenderBox* rend = renderBox())
689 return adjustForAbsoluteZoom(rend->scrollLeft(), rend); 701 return adjustForAbsoluteZoom(rend->scrollLeft(), rend);
690 return 0; 702 return 0;
691 } 703 }
692 704
693 int Element::scrollTop() 705 int Element::scrollTop()
694 { 706 {
695 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
696 if (RenderBox* rend = renderBox()) 719 if (RenderBox* rend = renderBox())
697 return adjustForAbsoluteZoom(rend->scrollTop(), rend); 720 return adjustForAbsoluteZoom(rend->scrollTop(), rend);
698 return 0; 721 return 0;
699 } 722 }
700 723
701 void Element::setScrollLeft(int newLeft) 724 void Element::setScrollLeft(int newLeft)
702 { 725 {
703 document().updateLayoutIgnorePendingStylesheets(); 726 document().updateLayoutIgnorePendingStylesheets();
704 if (RenderBox* rend = renderBox()) 727 if (RenderBox* rend = renderBox())
705 rend->setScrollLeft(static_cast<int>(newLeft * rend->style()->effectiveZ oom())); 728 rend->setScrollLeft(static_cast<int>(newLeft * rend->style()->effectiveZ oom()));
(...skipping 2936 matching lines...) Expand 10 before | Expand all | Expand 10 after
3642 return 0; 3665 return 0;
3643 } 3666 }
3644 3667
3645 Attribute* UniqueElementData::attributeItem(unsigned index) 3668 Attribute* UniqueElementData::attributeItem(unsigned index)
3646 { 3669 {
3647 ASSERT_WITH_SECURITY_IMPLICATION(index < length()); 3670 ASSERT_WITH_SECURITY_IMPLICATION(index < length());
3648 return &m_attributeVector.at(index); 3671 return &m_attributeVector.at(index);
3649 } 3672 }
3650 3673
3651 } // namespace WebCore 3674 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698