Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(485)

Side by Side Diff: third_party/WebKit/Source/core/layout/LayoutBox.cpp

Issue 2194913002: Ensure that we consistently check contains: paint for fixed position containment. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2785
Patch Set: Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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) 2005 Allan Sandfeld Jensen (kde@carewolf.com) 4 * (C) 2005 Allan Sandfeld Jensen (kde@carewolf.com)
5 * (C) 2005, 2006 Samuel Weinig (sam.weinig@gmail.com) 5 * (C) 2005, 2006 Samuel Weinig (sam.weinig@gmail.com)
6 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserv ed. 6 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserv ed.
7 * Copyright (C) 2013 Adobe Systems Incorporated. All rights reserved. 7 * Copyright (C) 2013 Adobe Systems Incorporated. All rights reserved.
8 * 8 *
9 * This library is free software; you can redistribute it and/or 9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Library General Public 10 * modify it under the terms of the GNU Library General Public
(...skipping 1710 matching lines...) Expand 10 before | Expand all | Expand 10 after
1721 return std::min(fillAvailableExtent, fillFallbackExtent); 1721 return std::min(fillAvailableExtent, fillFallbackExtent);
1722 } 1722 }
1723 1723
1724 // Use the content box logical height as specified by the style. 1724 // Use the content box logical height as specified by the style.
1725 return cb->adjustContentBoxLogicalHeightForBoxSizing(LayoutUnit(logicalHeigh tLength.value())); 1725 return cb->adjustContentBoxLogicalHeightForBoxSizing(LayoutUnit(logicalHeigh tLength.value()));
1726 } 1726 }
1727 1727
1728 void LayoutBox::mapLocalToAncestor(const LayoutBoxModelObject* ancestor, Transfo rmState& transformState, MapCoordinatesFlags mode) const 1728 void LayoutBox::mapLocalToAncestor(const LayoutBoxModelObject* ancestor, Transfo rmState& transformState, MapCoordinatesFlags mode) const
1729 { 1729 {
1730 bool isFixedPos = style()->position() == FixedPosition; 1730 bool isFixedPos = style()->position() == FixedPosition;
1731 bool hasTransform = hasLayer() && layer()->transform(); 1731
1732 // If this box has a transform, it acts as a fixed position container for fi xed descendants, 1732 // If this box has a transform or contains paint, it acts as a fixed positio n container for fixed descendants,
1733 // and may itself also be fixed position. So propagate 'fixed' up only if th is box is fixed position. 1733 // and may itself also be fixed position. So propagate 'fixed' up only if th is box is fixed position.
1734 if (hasTransform && !isFixedPos) 1734 if (style()->canContainFixedPositionObjects() && !isFixedPos)
1735 mode &= ~IsFixed; 1735 mode &= ~IsFixed;
1736 else if (isFixedPos) 1736 else if (isFixedPos)
1737 mode |= IsFixed; 1737 mode |= IsFixed;
1738 1738
1739 LayoutBoxModelObject::mapLocalToAncestor(ancestor, transformState, mode); 1739 LayoutBoxModelObject::mapLocalToAncestor(ancestor, transformState, mode);
1740 } 1740 }
1741 1741
1742 void LayoutBox::mapAncestorToLocal(const LayoutBoxModelObject* ancestor, Transfo rmState& transformState, MapCoordinatesFlags mode) const 1742 void LayoutBox::mapAncestorToLocal(const LayoutBoxModelObject* ancestor, Transfo rmState& transformState, MapCoordinatesFlags mode) const
1743 { 1743 {
1744 if (this == ancestor) 1744 if (this == ancestor)
1745 return; 1745 return;
1746 1746
1747 bool isFixedPos = style()->position() == FixedPosition; 1747 bool isFixedPos = style()->position() == FixedPosition;
1748 bool hasTransform = hasLayer() && layer()->transform(); 1748
1749 if (hasTransform && !isFixedPos) { 1749 if (style()->canContainFixedPositionObjects() && !isFixedPos) {
1750 // If this box has a transform, it acts as a fixed position container fo r fixed descendants, 1750 // If this box has a transform or contains paint, it acts as a fixed pos ition container for fixed descendants,
1751 // and may itself also be fixed position. So propagate 'fixed' up only i f this box is fixed position. 1751 // and may itself also be fixed position. So propagate 'fixed' up only i f this box is fixed position.
1752 mode &= ~IsFixed; 1752 mode &= ~IsFixed;
1753 } else if (isFixedPos) { 1753 } else if (isFixedPos) {
1754 mode |= IsFixed; 1754 mode |= IsFixed;
1755 } 1755 }
1756 1756
1757 LayoutBoxModelObject::mapAncestorToLocal(ancestor, transformState, mode); 1757 LayoutBoxModelObject::mapAncestorToLocal(ancestor, transformState, mode);
1758 } 1758 }
1759 1759
1760 LayoutSize LayoutBox::offsetFromContainer(const LayoutObject* o) const 1760 LayoutSize LayoutBox::offsetFromContainer(const LayoutObject* o) const
(...skipping 3174 matching lines...) Expand 10 before | Expand all | Expand 10 after
4935 m_rareData->m_snapAreas->remove(&snapArea); 4935 m_rareData->m_snapAreas->remove(&snapArea);
4936 } 4936 }
4937 } 4937 }
4938 4938
4939 SnapAreaSet* LayoutBox::snapAreas() const 4939 SnapAreaSet* LayoutBox::snapAreas() const
4940 { 4940 {
4941 return m_rareData ? m_rareData->m_snapAreas.get() : nullptr; 4941 return m_rareData ? m_rareData->m_snapAreas.get() : nullptr;
4942 } 4942 }
4943 4943
4944 } // namespace blink 4944 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698