| 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 594 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 605 if (callback->nativeScrollBehavior() != WebNativeScrollBehavior::DisableNati
veScroll) | 605 if (callback->nativeScrollBehavior() != WebNativeScrollBehavior::DisableNati
veScroll) |
| 606 nativeApplyScroll(scrollState); | 606 nativeApplyScroll(scrollState); |
| 607 if (callback->nativeScrollBehavior() == WebNativeScrollBehavior::PerformAfte
rNativeScroll) | 607 if (callback->nativeScrollBehavior() == WebNativeScrollBehavior::PerformAfte
rNativeScroll) |
| 608 callback->handleEvent(&scrollState); | 608 callback->handleEvent(&scrollState); |
| 609 }; | 609 }; |
| 610 | 610 |
| 611 int Element::offsetLeft() | 611 int Element::offsetLeft() |
| 612 { | 612 { |
| 613 document().updateLayoutIgnorePendingStylesheets(); | 613 document().updateLayoutIgnorePendingStylesheets(); |
| 614 if (LayoutBoxModelObject* layoutObject = layoutBoxModelObject()) | 614 if (LayoutBoxModelObject* layoutObject = layoutBoxModelObject()) |
| 615 return adjustLayoutUnitForAbsoluteZoom(layoutObject->pixelSnappedOffsetL
eft(), *layoutObject).round(); | 615 return adjustForAbsoluteZoom(layoutObject->pixelSnappedOffsetLeft(), lay
outObject->style()); |
| 616 return 0; | 616 return 0; |
| 617 } | 617 } |
| 618 | 618 |
| 619 int Element::offsetTop() | 619 int Element::offsetTop() |
| 620 { | 620 { |
| 621 document().updateLayoutIgnorePendingStylesheets(); | 621 document().updateLayoutIgnorePendingStylesheets(); |
| 622 if (LayoutBoxModelObject* layoutObject = layoutBoxModelObject()) | 622 if (LayoutBoxModelObject* layoutObject = layoutBoxModelObject()) |
| 623 return adjustLayoutUnitForAbsoluteZoom(layoutObject->pixelSnappedOffsetT
op(), *layoutObject).round(); | 623 return adjustForAbsoluteZoom(layoutObject->pixelSnappedOffsetTop(), layo
utObject->style()); |
| 624 return 0; | 624 return 0; |
| 625 } | 625 } |
| 626 | 626 |
| 627 int Element::offsetWidth() | 627 int Element::offsetWidth() |
| 628 { | 628 { |
| 629 document().updateLayoutIgnorePendingStylesheets(); | 629 document().updateLayoutIgnorePendingStylesheets(); |
| 630 if (LayoutBoxModelObject* layoutObject = layoutBoxModelObject()) | 630 if (LayoutBoxModelObject* layoutObject = layoutBoxModelObject()) |
| 631 return adjustLayoutUnitForAbsoluteZoom(layoutObject->pixelSnappedOffsetW
idth(), *layoutObject).round(); | 631 return adjustForAbsoluteZoom(layoutObject->pixelSnappedOffsetWidth(), la
youtObject->style()); |
| 632 return 0; | 632 return 0; |
| 633 } | 633 } |
| 634 | 634 |
| 635 int Element::offsetHeight() | 635 int Element::offsetHeight() |
| 636 { | 636 { |
| 637 document().updateLayoutIgnorePendingStylesheets(); | 637 document().updateLayoutIgnorePendingStylesheets(); |
| 638 if (LayoutBoxModelObject* layoutObject = layoutBoxModelObject()) | 638 if (LayoutBoxModelObject* layoutObject = layoutBoxModelObject()) |
| 639 return adjustLayoutUnitForAbsoluteZoom(layoutObject->pixelSnappedOffsetH
eight(), *layoutObject).round(); | 639 return adjustForAbsoluteZoom(layoutObject->pixelSnappedOffsetHeight(), l
ayoutObject->style()); |
| 640 return 0; | 640 return 0; |
| 641 } | 641 } |
| 642 | 642 |
| 643 Element* Element::offsetParent() | 643 Element* Element::offsetParent() |
| 644 { | 644 { |
| 645 document().updateLayoutIgnorePendingStylesheets(); | 645 document().updateLayoutIgnorePendingStylesheets(); |
| 646 | 646 |
| 647 LayoutObject* layoutObject = this->layoutObject(); | 647 LayoutObject* layoutObject = this->layoutObject(); |
| 648 if (!layoutObject) | 648 if (!layoutObject) |
| 649 return nullptr; | 649 return nullptr; |
| 650 | 650 |
| 651 Element* element = layoutObject->offsetParent(); | 651 Element* element = layoutObject->offsetParent(); |
| 652 if (!element) | 652 if (!element) |
| 653 return nullptr; | 653 return nullptr; |
| 654 | 654 |
| 655 if (element->isInShadowTree() && !element->containingShadowRoot()->isOpenOrV
0()) | 655 if (element->isInShadowTree() && !element->containingShadowRoot()->isOpenOrV
0()) |
| 656 return nullptr; | 656 return nullptr; |
| 657 | 657 |
| 658 return element; | 658 return element; |
| 659 } | 659 } |
| 660 | 660 |
| 661 int Element::clientLeft() | 661 int Element::clientLeft() |
| 662 { | 662 { |
| 663 document().updateLayoutIgnorePendingStylesheets(); | 663 document().updateLayoutIgnorePendingStylesheets(); |
| 664 | 664 |
| 665 if (LayoutBox* layoutObject = layoutBox()) | 665 if (LayoutBox* layoutObject = layoutBox()) |
| 666 return adjustLayoutUnitForAbsoluteZoom(roundToInt(layoutObject->clientLe
ft()), *layoutObject); | 666 return adjustForAbsoluteZoom(roundToInt(layoutObject->clientLeft()), lay
outObject->style()); |
| 667 return 0; | 667 return 0; |
| 668 } | 668 } |
| 669 | 669 |
| 670 int Element::clientTop() | 670 int Element::clientTop() |
| 671 { | 671 { |
| 672 document().updateLayoutIgnorePendingStylesheets(); | 672 document().updateLayoutIgnorePendingStylesheets(); |
| 673 | 673 |
| 674 if (LayoutBox* layoutObject = layoutBox()) | 674 if (LayoutBox* layoutObject = layoutBox()) |
| 675 return adjustLayoutUnitForAbsoluteZoom(roundToInt(layoutObject->clientTo
p()), *layoutObject); | 675 return adjustForAbsoluteZoom(roundToInt(layoutObject->clientTop()), layo
utObject->style()); |
| 676 return 0; | 676 return 0; |
| 677 } | 677 } |
| 678 | 678 |
| 679 int Element::clientWidth() | 679 int Element::clientWidth() |
| 680 { | 680 { |
| 681 document().updateLayoutIgnorePendingStylesheets(); | 681 document().updateLayoutIgnorePendingStylesheets(); |
| 682 | 682 |
| 683 // When in strict mode, clientWidth for the document element should return t
he width of the containing frame. | 683 // When in strict mode, clientWidth for the document element should return t
he width of the containing frame. |
| 684 // When in quirks mode, clientWidth for the body element should return the w
idth of the containing frame. | 684 // When in quirks mode, clientWidth for the body element should return the w
idth of the containing frame. |
| 685 bool inQuirksMode = document().inQuirksMode(); | 685 bool inQuirksMode = document().inQuirksMode(); |
| 686 if ((!inQuirksMode && document().documentElement() == this) | 686 if ((!inQuirksMode && document().documentElement() == this) |
| 687 || (inQuirksMode && isHTMLElement() && document().body() == this)) { | 687 || (inQuirksMode && isHTMLElement() && document().body() == this)) { |
| 688 if (LayoutView* layoutView = document().layoutView()) { | 688 if (LayoutView* layoutView = document().layoutView()) { |
| 689 if (document().page()->settings().forceZeroLayoutHeight()) | 689 if (document().page()->settings().forceZeroLayoutHeight()) |
| 690 return adjustLayoutUnitForAbsoluteZoom(layoutView->overflowClipR
ect(LayoutPoint()).width(), *layoutView); | 690 return adjustForAbsoluteZoom(layoutView->overflowClipRect(Layout
Point()).width(), layoutView->style()); |
| 691 return adjustLayoutUnitForAbsoluteZoom(layoutView->layoutSize().widt
h(), *layoutView); | 691 return adjustForAbsoluteZoom(layoutView->layoutSize().width(), layou
tView->style()); |
| 692 } | 692 } |
| 693 } | 693 } |
| 694 | 694 |
| 695 if (LayoutBox* layoutObject = layoutBox()) | 695 if (LayoutBox* layoutObject = layoutBox()) |
| 696 return adjustLayoutUnitForAbsoluteZoom(layoutObject->pixelSnappedClientW
idth(), *layoutObject).round(); | 696 return adjustForAbsoluteZoom(layoutObject->pixelSnappedClientWidth(), la
youtObject->style()); |
| 697 return 0; | 697 return 0; |
| 698 } | 698 } |
| 699 | 699 |
| 700 int Element::clientHeight() | 700 int Element::clientHeight() |
| 701 { | 701 { |
| 702 document().updateLayoutIgnorePendingStylesheets(); | 702 document().updateLayoutIgnorePendingStylesheets(); |
| 703 | 703 |
| 704 // When in strict mode, clientHeight for the document element should return
the height of the containing frame. | 704 // When in strict mode, clientHeight for the document element should return
the height of the containing frame. |
| 705 // When in quirks mode, clientHeight for the body element should return the
height of the containing frame. | 705 // When in quirks mode, clientHeight for the body element should return the
height of the containing frame. |
| 706 bool inQuirksMode = document().inQuirksMode(); | 706 bool inQuirksMode = document().inQuirksMode(); |
| 707 | 707 |
| 708 if ((!inQuirksMode && document().documentElement() == this) | 708 if ((!inQuirksMode && document().documentElement() == this) |
| 709 || (inQuirksMode && isHTMLElement() && document().body() == this)) { | 709 || (inQuirksMode && isHTMLElement() && document().body() == this)) { |
| 710 if (LayoutView* layoutView = document().layoutView()) { | 710 if (LayoutView* layoutView = document().layoutView()) { |
| 711 if (document().page()->settings().forceZeroLayoutHeight()) | 711 if (document().page()->settings().forceZeroLayoutHeight()) |
| 712 return adjustLayoutUnitForAbsoluteZoom(layoutView->overflowClipR
ect(LayoutPoint()).height(), *layoutView); | 712 return adjustForAbsoluteZoom(layoutView->overflowClipRect(Layout
Point()).height(), layoutView->style()); |
| 713 return adjustLayoutUnitForAbsoluteZoom(layoutView->layoutSize().heig
ht(), *layoutView); | 713 return adjustForAbsoluteZoom(layoutView->layoutSize().height(), layo
utView->style()); |
| 714 } | 714 } |
| 715 } | 715 } |
| 716 | 716 |
| 717 if (LayoutBox* layoutObject = layoutBox()) | 717 if (LayoutBox* layoutObject = layoutBox()) |
| 718 return adjustLayoutUnitForAbsoluteZoom(layoutObject->pixelSnappedClientH
eight(), *layoutObject).round(); | 718 return adjustForAbsoluteZoom(layoutObject->pixelSnappedClientHeight(), l
ayoutObject->style()); |
| 719 return 0; | 719 return 0; |
| 720 } | 720 } |
| 721 | 721 |
| 722 double Element::scrollLeft() | 722 double Element::scrollLeft() |
| 723 { | 723 { |
| 724 document().updateLayoutIgnorePendingStylesheets(); | 724 document().updateLayoutIgnorePendingStylesheets(); |
| 725 | 725 |
| 726 if (document().scrollingElement() == this) { | 726 if (document().scrollingElement() == this) { |
| 727 if (document().domWindow()) | 727 if (document().domWindow()) |
| 728 return document().domWindow()->scrollX(); | 728 return document().domWindow()->scrollX(); |
| (...skipping 2886 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3615 { | 3615 { |
| 3616 #if ENABLE(OILPAN) | 3616 #if ENABLE(OILPAN) |
| 3617 if (hasRareData()) | 3617 if (hasRareData()) |
| 3618 visitor->trace(elementRareData()); | 3618 visitor->trace(elementRareData()); |
| 3619 visitor->trace(m_elementData); | 3619 visitor->trace(m_elementData); |
| 3620 #endif | 3620 #endif |
| 3621 ContainerNode::trace(visitor); | 3621 ContainerNode::trace(visitor); |
| 3622 } | 3622 } |
| 3623 | 3623 |
| 3624 } // namespace blink | 3624 } // namespace blink |
| OLD | NEW |