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() | |
ojan
2016/09/06 23:36:36
It's not clear to me that this is sufficient for n
skobes
2016/09/07 00:23:06
I think the answer to this is "yes, but that's ok"
ymalik
2016/09/07 00:39:57
Yes, that case is covered, but another question is
skobes
2016/09/07 00:49:31
My gut feeling is we don't gain anything by suppre
ymalik
2016/09/07 18:13:22
Acknowledged.
| |
1716 { | |
1717 // Walk up the parent chain and find the first scrolling block to disable | |
1718 // scroll anchoring on. | |
1719 LayoutObject* object = this; | |
1720 Element* viewportDefiningElement = document().viewportDefiningElement(); | |
1721 do { | |
1722 object = object->parent(); | |
1723 if (LayoutBlock* block = toLayoutBlock(object)) { | |
1724 bool hasScrollableOverflow = block->hasScrollableOverflowX() || bloc k->hasScrollableOverflowY(); | |
skobes
2016/09/07 00:02:11
I don't think we should use this since it depends
ymalik
2016/09/07 00:39:57
I agree that we shouldn't depend on layout during
ymalik
2016/09/07 18:13:22
Done.
| |
1725 if (hasScrollableOverflow || (block->node() == viewportDefiningEleme nt && block->view()->frameView()->isScrollable())) { | |
1726 block->setScrollAnchorDisablingStyleChanged(true); | |
1727 return; | |
1728 } | |
1729 } | |
1730 } while (object); | |
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->position() != m_style->position() | |
1747 && ((oldStyle->position() == StaticPosition || m_style->position() = = StaticPosition) | |
ojan
2016/09/06 23:36:36
Why do you need to check for StaticPosition? That'
ymalik
2016/09/07 00:39:57
For reasons that I don't understand, StaticPositio
ojan
2016/09/07 00:56:44
Hmmm...I guess I'm misremembering how this code wo
ymalik
2016/09/07 18:13:22
You're totally right. This works.
| |
1748 || (oldStyle->hasInFlowPosition() && !m_style->hasInFlowPosition()) | |
1749 || (oldStyle->hasOutOfFlowPosition() && !m_style->hasOutOfFlowPositi on()))) | |
1750 setScrollAnchorDisablingStyleChangedOnAncestor(); | |
1751 | |
1726 // If the object already needs layout, then setNeedsLayout won't do | 1752 // 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 | 1753 // 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 | 1754 // 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 | 1755 // directly affect the containing block of this object is a change to |
1730 // the position style. | 1756 // the position style. |
1731 if (needsLayout() && oldStyle->position() != m_style->position()) | 1757 if (needsLayout() && oldStyle->position() != m_style->position()) |
1732 markContainerChainForLayout(); | 1758 markContainerChainForLayout(); |
1733 | 1759 |
1734 // Ditto. | 1760 // Ditto. |
1735 if (needsOverflowRecalcAfterStyleChange() && oldStyle->position() != m_s tyle->position()) | 1761 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; | 3259 const blink::LayoutObject* root = object1; |
3234 while (root->parent()) | 3260 while (root->parent()) |
3235 root = root->parent(); | 3261 root = root->parent(); |
3236 root->showLayoutTreeAndMark(object1, "*", object2, "-", 0); | 3262 root->showLayoutTreeAndMark(object1, "*", object2, "-", 0); |
3237 } else { | 3263 } else { |
3238 WTFLogAlways("%s", "Cannot showLayoutTree. Root is (nil)"); | 3264 WTFLogAlways("%s", "Cannot showLayoutTree. Root is (nil)"); |
3239 } | 3265 } |
3240 } | 3266 } |
3241 | 3267 |
3242 #endif | 3268 #endif |
OLD | NEW |