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 589 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
600 if (callback->nativeScrollBehavior() != WebNativeScrollBehavior::DisableNati veScroll) | 600 if (callback->nativeScrollBehavior() != WebNativeScrollBehavior::DisableNati veScroll) |
601 nativeApplyScroll(scrollState); | 601 nativeApplyScroll(scrollState); |
602 if (callback->nativeScrollBehavior() == WebNativeScrollBehavior::PerformAfte rNativeScroll) | 602 if (callback->nativeScrollBehavior() == WebNativeScrollBehavior::PerformAfte rNativeScroll) |
603 callback->handleEvent(&scrollState); | 603 callback->handleEvent(&scrollState); |
604 }; | 604 }; |
605 | 605 |
606 int Element::offsetLeft() | 606 int Element::offsetLeft() |
607 { | 607 { |
608 document().updateStyleAndLayoutIgnorePendingStylesheetsForNode(this); | 608 document().updateStyleAndLayoutIgnorePendingStylesheetsForNode(this); |
609 if (LayoutBoxModelObject* layoutObject = layoutBoxModelObject()) | 609 if (LayoutBoxModelObject* layoutObject = layoutBoxModelObject()) |
610 return adjustLayoutUnitForAbsoluteZoom(LayoutUnit(layoutObject->pixelSna ppedOffsetLeft()), layoutObject->styleRef()).round(); | 610 return adjustLayoutUnitForAbsoluteZoom(LayoutUnit(layoutObject->pixelSna ppedOffsetLeft(offsetParent())), layoutObject->styleRef()).round(); |
611 return 0; | 611 return 0; |
612 } | 612 } |
613 | 613 |
614 int Element::offsetTop() | 614 int Element::offsetTop() |
615 { | 615 { |
616 document().updateStyleAndLayoutIgnorePendingStylesheetsForNode(this); | 616 document().updateStyleAndLayoutIgnorePendingStylesheetsForNode(this); |
617 if (LayoutBoxModelObject* layoutObject = layoutBoxModelObject()) | 617 if (LayoutBoxModelObject* layoutObject = layoutBoxModelObject()) |
618 return adjustLayoutUnitForAbsoluteZoom(LayoutUnit(layoutObject->pixelSna ppedOffsetTop()), layoutObject->styleRef()).round(); | 618 return adjustLayoutUnitForAbsoluteZoom(LayoutUnit(layoutObject->pixelSna ppedOffsetTop(offsetParent())), layoutObject->styleRef()).round(); |
619 return 0; | 619 return 0; |
620 } | 620 } |
621 | 621 |
622 int Element::offsetWidth() | 622 int Element::offsetWidth() |
623 { | 623 { |
624 document().updateStyleAndLayoutIgnorePendingStylesheetsForNode(this); | 624 document().updateStyleAndLayoutIgnorePendingStylesheetsForNode(this); |
625 if (LayoutBoxModelObject* layoutObject = layoutBoxModelObject()) | 625 if (LayoutBoxModelObject* layoutObject = layoutBoxModelObject()) |
626 return adjustLayoutUnitForAbsoluteZoom(LayoutUnit(layoutObject->pixelSna ppedOffsetWidth()), layoutObject->styleRef()).round(); | 626 return adjustLayoutUnitForAbsoluteZoom(LayoutUnit(layoutObject->pixelSna ppedOffsetWidth(offsetParent())), layoutObject->styleRef()).round(); |
627 return 0; | 627 return 0; |
628 } | 628 } |
629 | 629 |
630 int Element::offsetHeight() | 630 int Element::offsetHeight() |
631 { | 631 { |
632 document().updateStyleAndLayoutIgnorePendingStylesheetsForNode(this); | 632 document().updateStyleAndLayoutIgnorePendingStylesheetsForNode(this); |
633 if (LayoutBoxModelObject* layoutObject = layoutBoxModelObject()) | 633 if (LayoutBoxModelObject* layoutObject = layoutBoxModelObject()) |
634 return adjustLayoutUnitForAbsoluteZoom(LayoutUnit(layoutObject->pixelSna ppedOffsetHeight()), layoutObject->styleRef()).round(); | 634 return adjustLayoutUnitForAbsoluteZoom(LayoutUnit(layoutObject->pixelSna ppedOffsetHeight(offsetParent())), layoutObject->styleRef()).round(); |
635 return 0; | 635 return 0; |
636 } | 636 } |
637 | 637 |
638 Element* Element::offsetParent() | 638 Element* Element::offsetParent() |
hayato
2016/06/10 11:52:27
Element::offsetParent() should not use any unclose
| |
639 { | 639 { |
640 document().updateStyleAndLayoutIgnorePendingStylesheetsForNode(this); | 640 document().updateStyleAndLayoutIgnorePendingStylesheetsForNode(this); |
641 | 641 |
642 LayoutObject* layoutObject = this->layoutObject(); | 642 LayoutObject* layoutObject = this->layoutObject(); |
643 if (!layoutObject) | 643 return layoutObject ? layoutObject->unclosedOffsetParent() : nullptr; |
644 return nullptr; | |
645 | |
646 Element* element = layoutObject->offsetParent(); | |
647 if (!element) | |
648 return nullptr; | |
649 | |
650 if (element->isInShadowTree() && !element->containingShadowRoot()->isOpenOrV 0()) | |
651 return nullptr; | |
652 | |
653 return element; | |
654 } | 644 } |
655 | 645 |
656 int Element::clientLeft() | 646 int Element::clientLeft() |
657 { | 647 { |
658 document().updateStyleAndLayoutIgnorePendingStylesheetsForNode(this); | 648 document().updateStyleAndLayoutIgnorePendingStylesheetsForNode(this); |
659 | 649 |
660 if (LayoutBox* layoutObject = layoutBox()) | 650 if (LayoutBox* layoutObject = layoutBox()) |
661 return adjustLayoutUnitForAbsoluteZoom(layoutObject->clientLeft(), layou tObject->styleRef()).round(); | 651 return adjustLayoutUnitForAbsoluteZoom(layoutObject->clientLeft(), layou tObject->styleRef()).round(); |
662 return 0; | 652 return 0; |
663 } | 653 } |
(...skipping 3053 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3717 | 3707 |
3718 DEFINE_TRACE_WRAPPERS(Element) | 3708 DEFINE_TRACE_WRAPPERS(Element) |
3719 { | 3709 { |
3720 if (hasRareData()) { | 3710 if (hasRareData()) { |
3721 visitor->traceWrappers(elementRareData()); | 3711 visitor->traceWrappers(elementRareData()); |
3722 } | 3712 } |
3723 ContainerNode::traceWrappers(visitor); | 3713 ContainerNode::traceWrappers(visitor); |
3724 } | 3714 } |
3725 | 3715 |
3726 } // namespace blink | 3716 } // namespace blink |
OLD | NEW |