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 659 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
670 | 670 |
671 if (RenderBox* renderer = renderBox()) | 671 if (RenderBox* renderer = renderBox()) |
672 return adjustLayoutUnitForAbsoluteZoom(renderer->pixelSnappedClientHeigh
t(), *renderer).round(); | 672 return adjustLayoutUnitForAbsoluteZoom(renderer->pixelSnappedClientHeigh
t(), *renderer).round(); |
673 return 0; | 673 return 0; |
674 } | 674 } |
675 | 675 |
676 int Element::scrollLeft() | 676 int Element::scrollLeft() |
677 { | 677 { |
678 document().updateLayoutIgnorePendingStylesheets(); | 678 document().updateLayoutIgnorePendingStylesheets(); |
679 | 679 |
680 if (document().documentElement() == this) { | 680 if (document().documentElement() != this) { |
| 681 if (RenderBox* rend = renderBox()) |
| 682 return adjustForAbsoluteZoom(rend->scrollLeft(), rend); |
| 683 return 0; |
| 684 } |
| 685 |
| 686 if (RuntimeEnabledFeatures::scrollTopLeftInteropEnabled()) { |
681 if (document().inQuirksMode()) | 687 if (document().inQuirksMode()) |
682 return 0; | 688 return 0; |
683 | 689 |
684 if (FrameView* view = document().view()) { | 690 if (FrameView* view = document().view()) { |
685 if (RenderView* renderView = document().renderView()) | 691 if (RenderView* renderView = document().renderView()) |
686 return adjustForAbsoluteZoom(view->scrollX(), renderView); | 692 return adjustForAbsoluteZoom(view->scrollX(), renderView); |
687 } | 693 } |
688 } | 694 } |
689 | 695 |
690 if (RenderBox* rend = renderBox()) | |
691 return adjustForAbsoluteZoom(rend->scrollLeft(), rend); | |
692 return 0; | 696 return 0; |
693 } | 697 } |
694 | 698 |
695 int Element::scrollTop() | 699 int Element::scrollTop() |
696 { | 700 { |
697 document().updateLayoutIgnorePendingStylesheets(); | 701 document().updateLayoutIgnorePendingStylesheets(); |
698 | 702 |
699 if (document().documentElement() == this) { | 703 if (document().documentElement() != this) { |
| 704 if (RenderBox* rend = renderBox()) |
| 705 return adjustForAbsoluteZoom(rend->scrollTop(), rend); |
| 706 return 0; |
| 707 } |
| 708 |
| 709 if (RuntimeEnabledFeatures::scrollTopLeftInteropEnabled()) { |
700 if (document().inQuirksMode()) | 710 if (document().inQuirksMode()) |
701 return 0; | 711 return 0; |
702 | 712 |
703 if (FrameView* view = document().view()) { | 713 if (FrameView* view = document().view()) { |
704 if (RenderView* renderView = document().renderView()) | 714 if (RenderView* renderView = document().renderView()) |
705 return adjustForAbsoluteZoom(view->scrollY(), renderView); | 715 return adjustForAbsoluteZoom(view->scrollY(), renderView); |
706 } | 716 } |
707 } | 717 } |
708 | 718 |
709 if (RenderBox* rend = renderBox()) | |
710 return adjustForAbsoluteZoom(rend->scrollTop(), rend); | |
711 return 0; | 719 return 0; |
712 } | 720 } |
713 | 721 |
714 void Element::setScrollLeft(int newLeft) | 722 void Element::setScrollLeft(int newLeft) |
715 { | 723 { |
716 document().updateLayoutIgnorePendingStylesheets(); | 724 document().updateLayoutIgnorePendingStylesheets(); |
717 | 725 |
718 if (document().documentElement() == this) { | 726 if (document().documentElement() != this) { |
| 727 if (RenderBox* rend = renderBox()) |
| 728 rend->setScrollLeft(static_cast<int>(newLeft * rend->style()->effect
iveZoom())); |
| 729 return; |
| 730 } |
| 731 |
| 732 if (RuntimeEnabledFeatures::scrollTopLeftInteropEnabled()) { |
719 if (document().inQuirksMode()) | 733 if (document().inQuirksMode()) |
720 return; | 734 return; |
721 | 735 |
722 Frame* frame = document().frame(); | 736 Frame* frame = document().frame(); |
723 if (!frame) | 737 if (!frame) |
724 return; | 738 return; |
725 FrameView* view = frame->view(); | 739 FrameView* view = frame->view(); |
726 if (!view) | 740 if (!view) |
727 return; | 741 return; |
728 | 742 |
729 // WHATWG spec says [1]: "If the element is the root element invoke scro
ll() | |
730 // with x as first argument and zero as second". Blink intentionally mat
ches | |
731 // other engine's behaviors here, instead, where the 'y' scroll position
is | |
732 // preversed. See [2]. | |
733 // [1] http://dev.w3.org/csswg/cssom-view/#dom-element-scrollleft | |
734 // [2] https://www.w3.org/Bugs/Public/show_bug.cgi?id=23448 | |
735 view->setScrollPosition(IntPoint(static_cast<int>(newLeft * frame->pageZ
oomFactor()), view->scrollY())); | 743 view->setScrollPosition(IntPoint(static_cast<int>(newLeft * frame->pageZ
oomFactor()), view->scrollY())); |
736 } | 744 } |
737 | |
738 if (RenderBox* rend = renderBox()) | |
739 rend->setScrollLeft(static_cast<int>(newLeft * rend->style()->effectiveZ
oom())); | |
740 } | 745 } |
741 | 746 |
742 void Element::setScrollTop(int newTop) | 747 void Element::setScrollTop(int newTop) |
743 { | 748 { |
744 document().updateLayoutIgnorePendingStylesheets(); | 749 document().updateLayoutIgnorePendingStylesheets(); |
745 | 750 |
746 if (document().documentElement() == this) { | 751 if (document().documentElement() != this) { |
| 752 if (RenderBox* rend = renderBox()) |
| 753 rend->setScrollTop(static_cast<int>(newTop * rend->style()->effectiv
eZoom())); |
| 754 return; |
| 755 } |
| 756 |
| 757 if (RuntimeEnabledFeatures::scrollTopLeftInteropEnabled()) { |
747 if (document().inQuirksMode()) | 758 if (document().inQuirksMode()) |
748 return; | 759 return; |
749 | 760 |
750 Frame* frame = document().frame(); | 761 Frame* frame = document().frame(); |
751 if (!frame) | 762 if (!frame) |
752 return; | 763 return; |
753 FrameView* view = frame->view(); | 764 FrameView* view = frame->view(); |
754 if (!view) | 765 if (!view) |
755 return; | 766 return; |
756 | 767 |
757 // WHATWG spec says [1]: "If the element is the root element invoke scro
ll() | |
758 // with zero as first argument and y as second". Blink intentionally | |
759 // matches other engine's behaviors here, instead, where the 'x' scroll | |
760 // position is preversed. See [2]. | |
761 // [1] http://dev.w3.org/csswg/cssom-view/#dom-element-scrolltop | |
762 // [2] https://www.w3.org/Bugs/Public/show_bug.cgi?id=23448 | |
763 view->setScrollPosition(IntPoint(view->scrollX(), static_cast<int>(newTo
p * frame->pageZoomFactor()))); | 768 view->setScrollPosition(IntPoint(view->scrollX(), static_cast<int>(newTo
p * frame->pageZoomFactor()))); |
764 } | 769 } |
765 | |
766 if (RenderBox* rend = renderBox()) | |
767 rend->setScrollTop(static_cast<int>(newTop * rend->style()->effectiveZoo
m())); | |
768 } | 770 } |
769 | 771 |
770 int Element::scrollWidth() | 772 int Element::scrollWidth() |
771 { | 773 { |
772 document().updateLayoutIgnorePendingStylesheets(); | 774 document().updateLayoutIgnorePendingStylesheets(); |
773 if (RenderBox* rend = renderBox()) | 775 if (RenderBox* rend = renderBox()) |
774 return adjustForAbsoluteZoom(rend->scrollWidth(), rend); | 776 return adjustForAbsoluteZoom(rend->scrollWidth(), rend); |
775 return 0; | 777 return 0; |
776 } | 778 } |
777 | 779 |
(...skipping 2736 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3514 // Before doing so, we need to resolve issues in HTMLSelectElement::recalcLi
stItems | 3516 // Before doing so, we need to resolve issues in HTMLSelectElement::recalcLi
stItems |
3515 // and RenderMenuList::setText. See also https://bugs.webkit.org/show_bug.cg
i?id=88405 | 3517 // and RenderMenuList::setText. See also https://bugs.webkit.org/show_bug.cg
i?id=88405 |
3516 if (hasTagName(optionTag) || hasTagName(optgroupTag)) | 3518 if (hasTagName(optionTag) || hasTagName(optgroupTag)) |
3517 return false; | 3519 return false; |
3518 if (FullscreenElementStack::isActiveFullScreenElement(this)) | 3520 if (FullscreenElementStack::isActiveFullScreenElement(this)) |
3519 return false; | 3521 return false; |
3520 return true; | 3522 return true; |
3521 } | 3523 } |
3522 | 3524 |
3523 } // namespace WebCore | 3525 } // namespace WebCore |
OLD | NEW |