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 1694 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1705 { | 1705 { |
1706 ASSERT(a->cursors() != b->cursors()); | 1706 ASSERT(a->cursors() != b->cursors()); |
1707 return a->cursors() && b->cursors() && *a->cursors() == *b->cursors(); | 1707 return a->cursors() && b->cursors() && *a->cursors() == *b->cursors(); |
1708 } | 1708 } |
1709 | 1709 |
1710 static inline bool areCursorsEqual(const ComputedStyle* a, const ComputedStyle*
b) | 1710 static inline bool areCursorsEqual(const ComputedStyle* a, const ComputedStyle*
b) |
1711 { | 1711 { |
1712 return a->cursor() == b->cursor() && (a->cursors() == b->cursors() || areNon
IdenticalCursorListsEqual(a, b)); | 1712 return a->cursor() == b->cursor() && (a->cursors() == b->cursors() || areNon
IdenticalCursorListsEqual(a, b)); |
1713 } | 1713 } |
1714 | 1714 |
| 1715 void LayoutObject::setScrollAnchorDisablingStyleChangedOnAncestor() |
| 1716 { |
| 1717 // Walk up the parent chain and find the first scrolling block to disable |
| 1718 // scroll anchoring on. |
| 1719 LayoutObject* object = parent(); |
| 1720 Element* viewportDefiningElement = document().viewportDefiningElement(); |
| 1721 while (object) { |
| 1722 if (object->isLayoutBlock()) { |
| 1723 LayoutBlock* block = toLayoutBlock(object); |
| 1724 if (block->hasOverflowClip() || block->node() == viewportDefiningEle
ment) { |
| 1725 block->setScrollAnchorDisablingStyleChanged(true); |
| 1726 return; |
| 1727 } |
| 1728 } |
| 1729 object = object->parent(); |
| 1730 } |
| 1731 } |
| 1732 |
1715 void LayoutObject::styleDidChange(StyleDifference diff, const ComputedStyle* old
Style) | 1733 void LayoutObject::styleDidChange(StyleDifference diff, const ComputedStyle* old
Style) |
1716 { | 1734 { |
1717 if (s_affectsParentBlock) | 1735 if (s_affectsParentBlock) |
1718 handleDynamicFloatPositionChange(this); | 1736 handleDynamicFloatPositionChange(this); |
1719 | 1737 |
1720 if (!m_parent) | 1738 if (!m_parent) |
1721 return; | 1739 return; |
1722 | 1740 |
1723 if (diff.needsFullLayout()) { | 1741 if (diff.needsFullLayout()) { |
1724 LayoutCounter::layoutObjectStyleChanged(*this, oldStyle, *m_style); | 1742 LayoutCounter::layoutObjectStyleChanged(*this, oldStyle, *m_style); |
1725 | 1743 |
| 1744 // If the in-flow state of an element is changed, disable scroll |
| 1745 // anchoring on the containing scroller. |
| 1746 if (oldStyle->hasOutOfFlowPosition() != m_style->hasOutOfFlowPosition()) |
| 1747 setScrollAnchorDisablingStyleChangedOnAncestor(); |
| 1748 |
1726 // If the object already needs layout, then setNeedsLayout won't do | 1749 // If the object already needs layout, then setNeedsLayout won't do |
1727 // any work. But if the containing block has changed, then we may need | 1750 // any work. But if the containing block has changed, then we may need |
1728 // to mark the new containing blocks for layout. The change that can | 1751 // to mark the new containing blocks for layout. The change that can |
1729 // directly affect the containing block of this object is a change to | 1752 // directly affect the containing block of this object is a change to |
1730 // the position style. | 1753 // the position style. |
1731 if (needsLayout() && oldStyle->position() != m_style->position()) | 1754 if (needsLayout() && oldStyle->position() != m_style->position()) |
1732 markContainerChainForLayout(); | 1755 markContainerChainForLayout(); |
1733 | 1756 |
1734 // Ditto. | 1757 // Ditto. |
1735 if (needsOverflowRecalcAfterStyleChange() && oldStyle->position() != m_s
tyle->position()) | 1758 if (needsOverflowRecalcAfterStyleChange() && oldStyle->position() != m_s
tyle->position()) |
(...skipping 1497 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3233 const blink::LayoutObject* root = object1; | 3256 const blink::LayoutObject* root = object1; |
3234 while (root->parent()) | 3257 while (root->parent()) |
3235 root = root->parent(); | 3258 root = root->parent(); |
3236 root->showLayoutTreeAndMark(object1, "*", object2, "-", 0); | 3259 root->showLayoutTreeAndMark(object1, "*", object2, "-", 0); |
3237 } else { | 3260 } else { |
3238 WTFLogAlways("%s", "Cannot showLayoutTree. Root is (nil)"); | 3261 WTFLogAlways("%s", "Cannot showLayoutTree. Root is (nil)"); |
3239 } | 3262 } |
3240 } | 3263 } |
3241 | 3264 |
3242 #endif | 3265 #endif |
OLD | NEW |