OLD | NEW |
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 707 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
718 } | 718 } |
719 | 719 |
720 if (RenderBox* rend = renderBox()) | 720 if (RenderBox* rend = renderBox()) |
721 return adjustForAbsoluteZoom(rend->scrollTop(), rend); | 721 return adjustForAbsoluteZoom(rend->scrollTop(), rend); |
722 return 0; | 722 return 0; |
723 } | 723 } |
724 | 724 |
725 void Element::setScrollLeft(int newLeft) | 725 void Element::setScrollLeft(int newLeft) |
726 { | 726 { |
727 document().updateLayoutIgnorePendingStylesheets(); | 727 document().updateLayoutIgnorePendingStylesheets(); |
| 728 |
| 729 if (document().documentElement() == this) { |
| 730 if (document().inQuirksMode()) |
| 731 return; |
| 732 |
| 733 Frame* frame = document().frame(); |
| 734 if (!frame) |
| 735 return; |
| 736 FrameView* view = frame->view(); |
| 737 if (!view) |
| 738 return; |
| 739 |
| 740 // WHATWG spec says [1]: "If the element is the root element invoke scro
ll() |
| 741 // with x as first argument and zero as second". Blink intentionally mat
ches |
| 742 // other engine's behaviors here, instead, where the 'y' scroll position
is |
| 743 // preversed. See [2]. |
| 744 // [1] http://dev.w3.org/csswg/cssom-view/#dom-element-scrollleft |
| 745 // [2] https://www.w3.org/Bugs/Public/show_bug.cgi?id=23448 |
| 746 view->setScrollPosition(IntPoint(static_cast<int>(newLeft * frame->pageZ
oomFactor()), view->scrollY())); |
| 747 } |
| 748 |
728 if (RenderBox* rend = renderBox()) | 749 if (RenderBox* rend = renderBox()) |
729 rend->setScrollLeft(static_cast<int>(newLeft * rend->style()->effectiveZ
oom())); | 750 rend->setScrollLeft(static_cast<int>(newLeft * rend->style()->effectiveZ
oom())); |
730 } | 751 } |
731 | 752 |
732 void Element::setScrollTop(int newTop) | 753 void Element::setScrollTop(int newTop) |
733 { | 754 { |
734 document().updateLayoutIgnorePendingStylesheets(); | 755 document().updateLayoutIgnorePendingStylesheets(); |
| 756 |
| 757 if (document().documentElement() == this) { |
| 758 if (document().inQuirksMode()) |
| 759 return; |
| 760 |
| 761 Frame* frame = document().frame(); |
| 762 if (!frame) |
| 763 return; |
| 764 FrameView* view = frame->view(); |
| 765 if (!view) |
| 766 return; |
| 767 |
| 768 // WHATWG spec says [1]: "If the element is the root element invoke scro
ll() |
| 769 // with zero as first argument and y as second". Blink intentionally |
| 770 // matches other engine's behaviors here, instead, where the 'x' scroll |
| 771 // position is preversed. See [2]. |
| 772 // [1] http://dev.w3.org/csswg/cssom-view/#dom-element-scrolltop |
| 773 // [2] https://www.w3.org/Bugs/Public/show_bug.cgi?id=23448 |
| 774 view->setScrollPosition(IntPoint(view->scrollX(), static_cast<int>(newTo
p * frame->pageZoomFactor()))); |
| 775 } |
| 776 |
735 if (RenderBox* rend = renderBox()) | 777 if (RenderBox* rend = renderBox()) |
736 rend->setScrollTop(static_cast<int>(newTop * rend->style()->effectiveZoo
m())); | 778 rend->setScrollTop(static_cast<int>(newTop * rend->style()->effectiveZoo
m())); |
737 } | 779 } |
738 | 780 |
739 int Element::scrollWidth() | 781 int Element::scrollWidth() |
740 { | 782 { |
741 document().updateLayoutIgnorePendingStylesheets(); | 783 document().updateLayoutIgnorePendingStylesheets(); |
742 if (RenderBox* rend = renderBox()) | 784 if (RenderBox* rend = renderBox()) |
743 return adjustForAbsoluteZoom(rend->scrollWidth(), rend); | 785 return adjustForAbsoluteZoom(rend->scrollWidth(), rend); |
744 return 0; | 786 return 0; |
(...skipping 2959 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3704 return 0; | 3746 return 0; |
3705 } | 3747 } |
3706 | 3748 |
3707 Attribute* UniqueElementData::attributeItem(unsigned index) | 3749 Attribute* UniqueElementData::attributeItem(unsigned index) |
3708 { | 3750 { |
3709 ASSERT_WITH_SECURITY_IMPLICATION(index < length()); | 3751 ASSERT_WITH_SECURITY_IMPLICATION(index < length()); |
3710 return &m_attributeVector.at(index); | 3752 return &m_attributeVector.at(index); |
3711 } | 3753 } |
3712 | 3754 |
3713 } // namespace WebCore | 3755 } // namespace WebCore |
OLD | NEW |