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

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

Issue 2173963002: Ensure that we consistently check contains: paint for fixed position containment. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove trailing whitespace 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 1704 matching lines...) Expand 10 before | Expand all | Expand 10 after
1715 return std::min(fillAvailableExtent, fillFallbackExtent); 1715 return std::min(fillAvailableExtent, fillFallbackExtent);
1716 } 1716 }
1717 1717
1718 // Use the content box logical height as specified by the style. 1718 // Use the content box logical height as specified by the style.
1719 return cb->adjustContentBoxLogicalHeightForBoxSizing(LayoutUnit(logicalHeigh tLength.value())); 1719 return cb->adjustContentBoxLogicalHeightForBoxSizing(LayoutUnit(logicalHeigh tLength.value()));
1720 } 1720 }
1721 1721
1722 void LayoutBox::mapLocalToAncestor(const LayoutBoxModelObject* ancestor, Transfo rmState& transformState, MapCoordinatesFlags mode) const 1722 void LayoutBox::mapLocalToAncestor(const LayoutBoxModelObject* ancestor, Transfo rmState& transformState, MapCoordinatesFlags mode) const
1723 { 1723 {
1724 bool isFixedPos = style()->position() == FixedPosition; 1724 bool isFixedPos = style()->position() == FixedPosition;
1725 bool hasTransform = hasLayer() && layer()->transform(); 1725
1726 // If this box has a transform, it acts as a fixed position container for fi xed descendants, 1726 // If this box has a transform or contains paint, it acts as a fixed positio n container for fixed descendants,
1727 // and may itself also be fixed position. So propagate 'fixed' up only if th is box is fixed position. 1727 // and may itself also be fixed position. So propagate 'fixed' up only if th is box is fixed position.
1728 if (hasTransform && !isFixedPos) 1728 if (style()->canContainFixedPositionObjects() && !isFixedPos)
1729 mode &= ~IsFixed; 1729 mode &= ~IsFixed;
1730 else if (isFixedPos) 1730 else if (isFixedPos)
1731 mode |= IsFixed; 1731 mode |= IsFixed;
1732 1732
1733 LayoutBoxModelObject::mapLocalToAncestor(ancestor, transformState, mode); 1733 LayoutBoxModelObject::mapLocalToAncestor(ancestor, transformState, mode);
1734 } 1734 }
1735 1735
1736 void LayoutBox::mapAncestorToLocal(const LayoutBoxModelObject* ancestor, Transfo rmState& transformState, MapCoordinatesFlags mode) const 1736 void LayoutBox::mapAncestorToLocal(const LayoutBoxModelObject* ancestor, Transfo rmState& transformState, MapCoordinatesFlags mode) const
1737 { 1737 {
1738 if (this == ancestor) 1738 if (this == ancestor)
1739 return; 1739 return;
1740 1740
1741 bool isFixedPos = style()->position() == FixedPosition; 1741 bool isFixedPos = style()->position() == FixedPosition;
1742 bool hasTransform = hasLayer() && layer()->transform(); 1742
1743 if (hasTransform && !isFixedPos) { 1743 if (style()->canContainFixedPositionObjects() && !isFixedPos) {
1744 // If this box has a transform, it acts as a fixed position container fo r fixed descendants, 1744 // If this box has a transform or contains paint, it acts as a fixed pos ition container for fixed descendants,
1745 // and may itself also be fixed position. So propagate 'fixed' up only i f this box is fixed position. 1745 // and may itself also be fixed position. So propagate 'fixed' up only i f this box is fixed position.
1746 mode &= ~IsFixed; 1746 mode &= ~IsFixed;
1747 } else if (isFixedPos) { 1747 } else if (isFixedPos) {
1748 mode |= IsFixed; 1748 mode |= IsFixed;
1749 } 1749 }
1750 1750
1751 LayoutBoxModelObject::mapAncestorToLocal(ancestor, transformState, mode); 1751 LayoutBoxModelObject::mapAncestorToLocal(ancestor, transformState, mode);
1752 } 1752 }
1753 1753
1754 LayoutSize LayoutBox::offsetFromContainer(const LayoutObject* o) const 1754 LayoutSize LayoutBox::offsetFromContainer(const LayoutObject* o) const
(...skipping 3171 matching lines...) Expand 10 before | Expand all | Expand 10 after
4926 m_rareData->m_snapAreas->remove(&snapArea); 4926 m_rareData->m_snapAreas->remove(&snapArea);
4927 } 4927 }
4928 } 4928 }
4929 4929
4930 SnapAreaSet* LayoutBox::snapAreas() const 4930 SnapAreaSet* LayoutBox::snapAreas() const
4931 { 4931 {
4932 return m_rareData ? m_rareData->m_snapAreas.get() : nullptr; 4932 return m_rareData ? m_rareData->m_snapAreas.get() : nullptr;
4933 } 4933 }
4934 4934
4935 } // namespace blink 4935 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698