| 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 635 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 646 | 646 |
| 647 int Element::clientWidth() | 647 int Element::clientWidth() |
| 648 { | 648 { |
| 649 document().updateLayoutIgnorePendingStylesheets(); | 649 document().updateLayoutIgnorePendingStylesheets(); |
| 650 | 650 |
| 651 // When in strict mode, clientWidth for the document element should return t
he width of the containing frame. | 651 // When in strict mode, clientWidth for the document element should return t
he width of the containing frame. |
| 652 // When in quirks mode, clientWidth for the body element should return the w
idth of the containing frame. | 652 // When in quirks mode, clientWidth for the body element should return the w
idth of the containing frame. |
| 653 bool inQuirksMode = document().inQuirksMode(); | 653 bool inQuirksMode = document().inQuirksMode(); |
| 654 if ((!inQuirksMode && document().documentElement() == this) | 654 if ((!inQuirksMode && document().documentElement() == this) |
| 655 || (inQuirksMode && isHTMLElement() && document().body() == this)) { | 655 || (inQuirksMode && isHTMLElement() && document().body() == this)) { |
| 656 if (FrameView* view = document().view()) { | 656 if (LayoutView* layoutView = document().layoutView()) { |
| 657 if (LayoutView* layoutView = document().layoutView()) { | 657 if (document().page()->settings().forceZeroLayoutHeight()) |
| 658 if (document().page()->settings().forceZeroLayoutHeight()) | 658 return adjustLayoutUnitForAbsoluteZoom(layoutView->overflowClipR
ect(LayoutPoint()).width(), *layoutView); |
| 659 return adjustLayoutUnitForAbsoluteZoom(view->visibleContentS
ize().width(), *layoutView); | 659 return adjustLayoutUnitForAbsoluteZoom(layoutView->layoutSize().widt
h(), *layoutView); |
| 660 return adjustLayoutUnitForAbsoluteZoom(view->layoutSize().width(
), *layoutView); | |
| 661 } | |
| 662 } | 660 } |
| 663 } | 661 } |
| 664 | 662 |
| 665 if (LayoutBox* layoutObject = layoutBox()) | 663 if (LayoutBox* layoutObject = layoutBox()) |
| 666 return adjustLayoutUnitForAbsoluteZoom(layoutObject->pixelSnappedClientW
idth(), *layoutObject).round(); | 664 return adjustLayoutUnitForAbsoluteZoom(layoutObject->pixelSnappedClientW
idth(), *layoutObject).round(); |
| 667 return 0; | 665 return 0; |
| 668 } | 666 } |
| 669 | 667 |
| 670 int Element::clientHeight() | 668 int Element::clientHeight() |
| 671 { | 669 { |
| 672 document().updateLayoutIgnorePendingStylesheets(); | 670 document().updateLayoutIgnorePendingStylesheets(); |
| 673 | 671 |
| 674 // When in strict mode, clientHeight for the document element should return
the height of the containing frame. | 672 // When in strict mode, clientHeight for the document element should return
the height of the containing frame. |
| 675 // When in quirks mode, clientHeight for the body element should return the
height of the containing frame. | 673 // When in quirks mode, clientHeight for the body element should return the
height of the containing frame. |
| 676 bool inQuirksMode = document().inQuirksMode(); | 674 bool inQuirksMode = document().inQuirksMode(); |
| 677 | 675 |
| 678 if ((!inQuirksMode && document().documentElement() == this) | 676 if ((!inQuirksMode && document().documentElement() == this) |
| 679 || (inQuirksMode && isHTMLElement() && document().body() == this)) { | 677 || (inQuirksMode && isHTMLElement() && document().body() == this)) { |
| 680 if (FrameView* view = document().view()) { | 678 if (LayoutView* layoutView = document().layoutView()) { |
| 681 if (LayoutView* layoutView = document().layoutView()) { | 679 if (document().page()->settings().forceZeroLayoutHeight()) |
| 682 if (document().page()->settings().forceZeroLayoutHeight()) | 680 return adjustLayoutUnitForAbsoluteZoom(layoutView->overflowClipR
ect(LayoutPoint()).height(), *layoutView); |
| 683 return adjustLayoutUnitForAbsoluteZoom(view->visibleContentS
ize().height(), *layoutView); | 681 return adjustLayoutUnitForAbsoluteZoom(layoutView->layoutSize().heig
ht(), *layoutView); |
| 684 return adjustLayoutUnitForAbsoluteZoom(view->layoutSize().height
(), *layoutView); | |
| 685 } | |
| 686 } | 682 } |
| 687 } | 683 } |
| 688 | 684 |
| 689 if (LayoutBox* layoutObject = layoutBox()) | 685 if (LayoutBox* layoutObject = layoutBox()) |
| 690 return adjustLayoutUnitForAbsoluteZoom(layoutObject->pixelSnappedClientH
eight(), *layoutObject).round(); | 686 return adjustLayoutUnitForAbsoluteZoom(layoutObject->pixelSnappedClientH
eight(), *layoutObject).round(); |
| 691 return 0; | 687 return 0; |
| 692 } | 688 } |
| 693 | 689 |
| 694 double Element::scrollLeft() | 690 double Element::scrollLeft() |
| 695 { | 691 { |
| (...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 864 void Element::scrollFrameBy(const ScrollToOptions& scrollToOptions) | 860 void Element::scrollFrameBy(const ScrollToOptions& scrollToOptions) |
| 865 { | 861 { |
| 866 double left = scrollToOptions.hasLeft() ? ScrollableArea::normalizeNonFinite
Scroll(scrollToOptions.left()) : 0.0; | 862 double left = scrollToOptions.hasLeft() ? ScrollableArea::normalizeNonFinite
Scroll(scrollToOptions.left()) : 0.0; |
| 867 double top = scrollToOptions.hasTop() ? ScrollableArea::normalizeNonFiniteSc
roll(scrollToOptions.top()) : 0.0; | 863 double top = scrollToOptions.hasTop() ? ScrollableArea::normalizeNonFiniteSc
roll(scrollToOptions.top()) : 0.0; |
| 868 | 864 |
| 869 ScrollBehavior scrollBehavior = ScrollBehaviorAuto; | 865 ScrollBehavior scrollBehavior = ScrollBehaviorAuto; |
| 870 ScrollableArea::scrollBehaviorFromString(scrollToOptions.behavior(), scrollB
ehavior); | 866 ScrollableArea::scrollBehaviorFromString(scrollToOptions.behavior(), scrollB
ehavior); |
| 871 LocalFrame* frame = document().frame(); | 867 LocalFrame* frame = document().frame(); |
| 872 if (!frame) | 868 if (!frame) |
| 873 return; | 869 return; |
| 874 FrameView* view = frame->view(); | 870 ScrollableArea* layoutViewport = frame->view() ? frame->view()->layoutViewpo
rtScrollableArea() : 0; |
| 875 if (!view) | 871 if (!layoutViewport) |
| 876 return; | 872 return; |
| 877 | 873 |
| 878 double newScaledLeft = left * frame->pageZoomFactor() + view->scrollPosition
Double().x(); | 874 double newScaledLeft = left * frame->pageZoomFactor() + layoutViewport->scro
llPositionDouble().x(); |
| 879 double newScaledTop = top * frame->pageZoomFactor() + view->scrollPositionDo
uble().y(); | 875 double newScaledTop = top * frame->pageZoomFactor() + layoutViewport->scroll
PositionDouble().y(); |
| 880 view->setScrollPosition(DoublePoint(newScaledLeft, newScaledTop), Programmat
icScroll, scrollBehavior); | 876 layoutViewport->setScrollPosition(DoublePoint(newScaledLeft, newScaledTop),
ProgrammaticScroll, scrollBehavior); |
| 881 } | 877 } |
| 882 | 878 |
| 883 void Element::scrollFrameTo(const ScrollToOptions& scrollToOptions) | 879 void Element::scrollFrameTo(const ScrollToOptions& scrollToOptions) |
| 884 { | 880 { |
| 885 ScrollBehavior scrollBehavior = ScrollBehaviorAuto; | 881 ScrollBehavior scrollBehavior = ScrollBehaviorAuto; |
| 886 ScrollableArea::scrollBehaviorFromString(scrollToOptions.behavior(), scrollB
ehavior); | 882 ScrollableArea::scrollBehaviorFromString(scrollToOptions.behavior(), scrollB
ehavior); |
| 887 LocalFrame* frame = document().frame(); | 883 LocalFrame* frame = document().frame(); |
| 888 if (!frame) | 884 if (!frame) |
| 889 return; | 885 return; |
| 890 FrameView* view = frame->view(); | 886 ScrollableArea* layoutViewport = frame->view() ? frame->view()->layoutViewpo
rtScrollableArea() : 0; |
| 891 if (!view) | 887 if (!layoutViewport) |
| 892 return; | 888 return; |
| 893 | 889 |
| 894 double scaledLeft = view->scrollPositionDouble().x(); | 890 double scaledLeft = layoutViewport->scrollPositionDouble().x(); |
| 895 double scaledTop = view->scrollPositionDouble().y(); | 891 double scaledTop = layoutViewport->scrollPositionDouble().y(); |
| 896 if (scrollToOptions.hasLeft()) | 892 if (scrollToOptions.hasLeft()) |
| 897 scaledLeft = ScrollableArea::normalizeNonFiniteScroll(scrollToOptions.le
ft()) * frame->pageZoomFactor(); | 893 scaledLeft = ScrollableArea::normalizeNonFiniteScroll(scrollToOptions.le
ft()) * frame->pageZoomFactor(); |
| 898 if (scrollToOptions.hasTop()) | 894 if (scrollToOptions.hasTop()) |
| 899 scaledTop = ScrollableArea::normalizeNonFiniteScroll(scrollToOptions.top
()) * frame->pageZoomFactor(); | 895 scaledTop = ScrollableArea::normalizeNonFiniteScroll(scrollToOptions.top
()) * frame->pageZoomFactor(); |
| 900 view->setScrollPosition(DoublePoint(scaledLeft, scaledTop), ProgrammaticScro
ll, scrollBehavior); | 896 layoutViewport->setScrollPosition(DoublePoint(scaledLeft, scaledTop), Progra
mmaticScroll, scrollBehavior); |
| 901 } | 897 } |
| 902 | 898 |
| 903 void Element::incrementProxyCount() | 899 void Element::incrementProxyCount() |
| 904 { | 900 { |
| 905 if (ensureElementRareData().incrementProxyCount() == 1) | 901 if (ensureElementRareData().incrementProxyCount() == 1) |
| 906 setNeedsStyleRecalc(LocalStyleChange, StyleChangeReasonForTracing::creat
e(StyleChangeReason::CompositorProxy)); | 902 setNeedsStyleRecalc(LocalStyleChange, StyleChangeReasonForTracing::creat
e(StyleChangeReason::CompositorProxy)); |
| 907 } | 903 } |
| 908 | 904 |
| 909 void Element::decrementProxyCount() | 905 void Element::decrementProxyCount() |
| 910 { | 906 { |
| (...skipping 2590 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3501 { | 3497 { |
| 3502 #if ENABLE(OILPAN) | 3498 #if ENABLE(OILPAN) |
| 3503 if (hasRareData()) | 3499 if (hasRareData()) |
| 3504 visitor->trace(elementRareData()); | 3500 visitor->trace(elementRareData()); |
| 3505 visitor->trace(m_elementData); | 3501 visitor->trace(m_elementData); |
| 3506 #endif | 3502 #endif |
| 3507 ContainerNode::trace(visitor); | 3503 ContainerNode::trace(visitor); |
| 3508 } | 3504 } |
| 3509 | 3505 |
| 3510 } // namespace blink | 3506 } // namespace blink |
| OLD | NEW |