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) 2000 Dirk Mueller (mueller@kde.org) | 4 * (C) 2000 Dirk Mueller (mueller@kde.org) |
5 * (C) 2004 Allan Sandfeld Jensen (kde@carewolf.com) | 5 * (C) 2004 Allan Sandfeld Jensen (kde@carewolf.com) |
6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2011 Apple Inc. All rights reserv
ed. | 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2011 Apple Inc. All rights reserv
ed. |
7 * Copyright (C) 2009 Google Inc. All rights reserved. | 7 * Copyright (C) 2009 Google Inc. All rights reserved. |
8 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmo
bile.com/) | 8 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmo
bile.com/) |
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 863 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
874 o->m_bitfields.setPreferredLogicalWidthsDirty(true); | 874 o->m_bitfields.setPreferredLogicalWidthsDirty(true); |
875 if (o->style()->hasOutOfFlowPosition()) { | 875 if (o->style()->hasOutOfFlowPosition()) { |
876 // A positioned object has no effect on the min/max width of its con
taining block ever. | 876 // A positioned object has no effect on the min/max width of its con
taining block ever. |
877 // We can optimize this case and not go up any further. | 877 // We can optimize this case and not go up any further. |
878 break; | 878 break; |
879 } | 879 } |
880 o = container; | 880 o = container; |
881 } | 881 } |
882 } | 882 } |
883 | 883 |
884 LayoutObject* LayoutObject::containerForAbsolutePosition(const LayoutBoxModelObj
ect* paintInvalidationContainer, bool* paintInvalidationContainerSkipped) const | 884 LayoutObject* LayoutObject::containerForAbsolutePosition(const LayoutBoxModelObj
ect* ancestor, bool* ancestorSkipped) const |
885 { | 885 { |
886 // We technically just want our containing block, but | 886 // We technically just want our containing block, but |
887 // we may not have one if we're part of an uninstalled | 887 // we may not have one if we're part of an uninstalled |
888 // subtree. We'll climb as high as we can though. | 888 // subtree. We'll climb as high as we can though. |
889 for (LayoutObject* object = parent(); object; object = object->parent()) { | 889 for (LayoutObject* object = parent(); object; object = object->parent()) { |
890 if (object->canContainAbsolutePositionObjects()) | 890 if (object->canContainAbsolutePositionObjects()) |
891 return object; | 891 return object; |
892 | 892 |
893 if (paintInvalidationContainerSkipped && object == paintInvalidationCont
ainer) | 893 if (ancestorSkipped && object == ancestor) |
894 *paintInvalidationContainerSkipped = true; | 894 *ancestorSkipped = true; |
895 } | 895 } |
896 return nullptr; | 896 return nullptr; |
897 } | 897 } |
898 | 898 |
899 LayoutBlock* LayoutObject::containerForFixedPosition(const LayoutBoxModelObject*
paintInvalidationContainer, bool* paintInvalidationContainerSkipped) const | 899 LayoutBlock* LayoutObject::containerForFixedPosition(const LayoutBoxModelObject*
ancestor, bool* ancestorSkipped) const |
900 { | 900 { |
901 ASSERT(!paintInvalidationContainerSkipped || !*paintInvalidationContainerSki
pped); | 901 ASSERT(!ancestorSkipped || !*ancestorSkipped); |
902 ASSERT(!isText()); | 902 ASSERT(!isText()); |
903 | 903 |
904 LayoutObject* ancestor = parent(); | 904 LayoutObject* object = parent(); |
905 for (; ancestor && !ancestor->canContainFixedPositionObjects(); ancestor = a
ncestor->parent()) { | 905 for (; object && !object->canContainFixedPositionObjects(); object = object-
>parent()) { |
906 if (paintInvalidationContainerSkipped && ancestor == paintInvalidationCo
ntainer) | 906 if (ancestorSkipped && object == ancestor) |
907 *paintInvalidationContainerSkipped = true; | 907 *ancestorSkipped = true; |
908 } | 908 } |
909 | 909 |
910 ASSERT(!ancestor || !ancestor->isAnonymousBlock()); | 910 ASSERT(!object || !object->isAnonymousBlock()); |
911 return toLayoutBlock(ancestor); | 911 return toLayoutBlock(object); |
912 } | 912 } |
913 | 913 |
914 LayoutBlock* LayoutObject::containingBlockForAbsolutePosition() const | 914 LayoutBlock* LayoutObject::containingBlockForAbsolutePosition() const |
915 { | 915 { |
916 LayoutObject* o = containerForAbsolutePosition(); | 916 LayoutObject* o = containerForAbsolutePosition(); |
917 | 917 |
918 // For relpositioned inlines, we return the nearest non-anonymous enclosing
block. We don't try | 918 // For relpositioned inlines, we return the nearest non-anonymous enclosing
block. We don't try |
919 // to return the inline itself. This allows us to avoid having a positioned
objects | 919 // to return the inline itself. This allows us to avoid having a positioned
objects |
920 // list in all LayoutInlines and lets us return a strongly-typed LayoutBlock
* result | 920 // list in all LayoutInlines and lets us return a strongly-typed LayoutBlock
* result |
921 // from this method. The container() method can actually be used to obtain
the | 921 // from this method. The container() method can actually be used to obtain
the |
(...skipping 712 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1634 | 1634 |
1635 LayoutRect LayoutObject::localOverflowRectForPaintInvalidation() const | 1635 LayoutRect LayoutObject::localOverflowRectForPaintInvalidation() const |
1636 { | 1636 { |
1637 ASSERT_NOT_REACHED(); | 1637 ASSERT_NOT_REACHED(); |
1638 return LayoutRect(); | 1638 return LayoutRect(); |
1639 } | 1639 } |
1640 | 1640 |
1641 bool LayoutObject::mapToVisibleRectInAncestorSpace(const LayoutBoxModelObject* a
ncestor, LayoutRect& rect, VisibleRectFlags visibleRectFlags) const | 1641 bool LayoutObject::mapToVisibleRectInAncestorSpace(const LayoutBoxModelObject* a
ncestor, LayoutRect& rect, VisibleRectFlags visibleRectFlags) const |
1642 { | 1642 { |
1643 // For any layout object that doesn't override this method (the main example
is LayoutText), | 1643 // For any layout object that doesn't override this method (the main example
is LayoutText), |
1644 // the rect is assumed to be in the coordinate space of the object's parent. | 1644 // the rect is assumed to be in the contents coordinate space of the object'
s parent. |
1645 | 1645 |
1646 if (ancestor == this) | 1646 if (ancestor == this) |
1647 return true; | 1647 return true; |
1648 | 1648 |
1649 if (LayoutObject* parent = this->parent()) { | 1649 if (LayoutObject* parent = this->parent()) { |
1650 if (parent->hasOverflowClip()) { | 1650 if (parent->isBox()) { |
1651 LayoutBox* parentBox = toLayoutBox(parent); | 1651 LayoutBox* parentBox = toLayoutBox(parent); |
1652 parentBox->mapScrollingContentsRectToBoxSpace(rect); | 1652 if (!parentBox->mapContentsRectToVisibleRectInBorderBoxSpace(rect, v
isibleRectFlags)) |
1653 if (parent != ancestor && !parentBox->applyOverflowClip(rect, visibl
eRectFlags)) | |
1654 return false; | 1653 return false; |
| 1654 |
| 1655 if (parentBox == ancestor || parentBox->isWritingModeRoot()) |
| 1656 parentBox->flipForWritingMode(rect); |
1655 } | 1657 } |
1656 | 1658 |
1657 return parent->mapToVisibleRectInAncestorSpace(ancestor, rect, visibleRe
ctFlags); | 1659 return parent->mapToVisibleRectInAncestorSpace(ancestor, rect, visibleRe
ctFlags); |
1658 } | 1660 } |
1659 return true; | 1661 return true; |
1660 } | 1662 } |
1661 | 1663 |
1662 void LayoutObject::dirtyLinesFromChangedChild(LayoutObject*) | 1664 void LayoutObject::dirtyLinesFromChangedChild(LayoutObject*) |
1663 { | 1665 { |
1664 } | 1666 } |
(...skipping 916 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2581 | 2583 |
2582 if (layoutObject->document().settings() && layoutObject->document().settings
()->shouldRespectImageOrientation()) | 2584 if (layoutObject->document().settings() && layoutObject->document().settings
()->shouldRespectImageOrientation()) |
2583 return RespectImageOrientation; | 2585 return RespectImageOrientation; |
2584 | 2586 |
2585 if (layoutObject->style() && layoutObject->style()->respectImageOrientation(
) == RespectImageOrientation) | 2587 if (layoutObject->style() && layoutObject->style()->respectImageOrientation(
) == RespectImageOrientation) |
2586 return RespectImageOrientation; | 2588 return RespectImageOrientation; |
2587 | 2589 |
2588 return DoNotRespectImageOrientation; | 2590 return DoNotRespectImageOrientation; |
2589 } | 2591 } |
2590 | 2592 |
2591 LayoutObject* LayoutObject::container(const LayoutBoxModelObject* paintInvalidat
ionContainer, bool* paintInvalidationContainerSkipped) const | 2593 LayoutObject* LayoutObject::container(const LayoutBoxModelObject* ancestor, bool
* ancestorSkipped) const |
2592 { | 2594 { |
2593 if (paintInvalidationContainerSkipped) | 2595 if (ancestorSkipped) |
2594 *paintInvalidationContainerSkipped = false; | 2596 *ancestorSkipped = false; |
2595 | 2597 |
2596 LayoutObject* o = parent(); | 2598 LayoutObject* o = parent(); |
2597 | 2599 |
2598 if (isTextOrSVGChild()) | 2600 if (isTextOrSVGChild()) |
2599 return o; | 2601 return o; |
2600 | 2602 |
2601 EPosition pos = m_style->position(); | 2603 EPosition pos = m_style->position(); |
2602 if (pos == FixedPosition) | 2604 if (pos == FixedPosition) |
2603 return containerForFixedPosition(paintInvalidationContainer, paintInvali
dationContainerSkipped); | 2605 return containerForFixedPosition(ancestor, ancestorSkipped); |
2604 | 2606 |
2605 if (pos == AbsolutePosition) | 2607 if (pos == AbsolutePosition) |
2606 return containerForAbsolutePosition(paintInvalidationContainer, paintInv
alidationContainerSkipped); | 2608 return containerForAbsolutePosition(ancestor, ancestorSkipped); |
2607 | 2609 |
2608 if (isColumnSpanAll()) { | 2610 if (isColumnSpanAll()) { |
2609 LayoutObject* multicolContainer = spannerPlaceholder()->container(); | 2611 LayoutObject* multicolContainer = spannerPlaceholder()->container(); |
2610 if (paintInvalidationContainerSkipped && paintInvalidationContainer) { | 2612 if (ancestorSkipped && ancestor) { |
2611 // We jumped directly from the spanner to the multicol container. Ne
ed to check if | 2613 // We jumped directly from the spanner to the multicol container. Ne
ed to check if |
2612 // we skipped |paintInvalidationContainer| on the way. | 2614 // we skipped |paintInvalidationContainer| on the way. |
2613 for (LayoutObject* walker = parent(); walker && walker != multicolCo
ntainer; walker = walker->parent()) { | 2615 for (LayoutObject* walker = parent(); walker && walker != multicolCo
ntainer; walker = walker->parent()) { |
2614 if (walker == paintInvalidationContainer) { | 2616 if (walker == ancestor) { |
2615 *paintInvalidationContainerSkipped = true; | 2617 *ancestorSkipped = true; |
2616 break; | 2618 break; |
2617 } | 2619 } |
2618 } | 2620 } |
2619 } | 2621 } |
2620 return multicolContainer; | 2622 return multicolContainer; |
2621 } | 2623 } |
2622 | 2624 |
2623 return o; | 2625 return o; |
2624 } | 2626 } |
2625 | 2627 |
(...skipping 1088 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3714 const blink::LayoutObject* root = object1; | 3716 const blink::LayoutObject* root = object1; |
3715 while (root->parent()) | 3717 while (root->parent()) |
3716 root = root->parent(); | 3718 root = root->parent(); |
3717 root->showLayoutTreeAndMark(object1, "*", object2, "-", 0); | 3719 root->showLayoutTreeAndMark(object1, "*", object2, "-", 0); |
3718 } else { | 3720 } else { |
3719 fprintf(stderr, "Cannot showLayoutTree. Root is (nil)\n"); | 3721 fprintf(stderr, "Cannot showLayoutTree. Root is (nil)\n"); |
3720 } | 3722 } |
3721 } | 3723 } |
3722 | 3724 |
3723 #endif | 3725 #endif |
OLD | NEW |