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) 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 1678 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1689 return fillFallbackExtent; | 1689 return fillFallbackExtent; |
1690 return std::min(fillAvailableExtent, fillFallbackExtent); | 1690 return std::min(fillAvailableExtent, fillFallbackExtent); |
1691 } | 1691 } |
1692 | 1692 |
1693 // Use the content box logical height as specified by the style. | 1693 // Use the content box logical height as specified by the style. |
1694 return cb->adjustContentBoxLogicalHeightForBoxSizing(LayoutUnit(logicalHeigh
tLength.value())); | 1694 return cb->adjustContentBoxLogicalHeightForBoxSizing(LayoutUnit(logicalHeigh
tLength.value())); |
1695 } | 1695 } |
1696 | 1696 |
1697 void LayoutBox::mapLocalToAncestor(const LayoutBoxModelObject* ancestor, Transfo
rmState& transformState, MapCoordinatesFlags mode, bool* wasFixed, const PaintIn
validationState* paintInvalidationState) const | 1697 void LayoutBox::mapLocalToAncestor(const LayoutBoxModelObject* ancestor, Transfo
rmState& transformState, MapCoordinatesFlags mode, bool* wasFixed, const PaintIn
validationState* paintInvalidationState) const |
1698 { | 1698 { |
1699 if (ancestor == this) | |
1700 return; | |
1701 | |
1702 if (paintInvalidationState && paintInvalidationState->canMapToContainer(ance
stor)) { | |
1703 LayoutSize offset = paintInvalidationState->paintOffset() + locationOffs
et(); | |
1704 if (style()->hasInFlowPosition() && layer()) | |
1705 offset += layer()->offsetForInFlowPosition(); | |
1706 transformState.move(offset); | |
1707 return; | |
1708 } | |
1709 | |
1710 bool ancestorSkipped; | |
1711 LayoutObject* o = container(ancestor, &ancestorSkipped); | |
1712 if (!o) | |
1713 return; | |
1714 | |
1715 bool isFixedPos = style()->position() == FixedPosition; | 1699 bool isFixedPos = style()->position() == FixedPosition; |
1716 bool hasTransform = hasLayer() && layer()->transform(); | 1700 bool hasTransform = hasLayer() && layer()->transform(); |
1717 // If this box has a transform, it acts as a fixed position container for fi
xed descendants, | 1701 // If this box has a transform, it acts as a fixed position container for fi
xed descendants, |
1718 // and may itself also be fixed position. So propagate 'fixed' up only if th
is box is fixed position. | 1702 // and may itself also be fixed position. So propagate 'fixed' up only if th
is box is fixed position. |
1719 if (hasTransform && !isFixedPos) | 1703 if (hasTransform && !isFixedPos) |
1720 mode &= ~IsFixed; | 1704 mode &= ~IsFixed; |
1721 else if (isFixedPos) | 1705 else if (isFixedPos) |
1722 mode |= IsFixed; | 1706 mode |= IsFixed; |
1723 | 1707 |
1724 if (wasFixed) | 1708 LayoutBoxModelObject::mapLocalToAncestor(ancestor, transformState, mode, was
Fixed, paintInvalidationState); |
1725 *wasFixed = mode & IsFixed; | |
1726 | |
1727 LayoutSize containerOffset = offsetFromContainer(o, roundedLayoutPoint(trans
formState.mappedPoint())); | |
1728 | |
1729 bool preserve3D = mode & UseTransforms && (o->style()->preserves3D() || styl
e()->preserves3D()); | |
1730 if (mode & UseTransforms && shouldUseTransformFromContainer(o)) { | |
1731 TransformationMatrix t; | |
1732 getTransformFromContainer(o, containerOffset, t); | |
1733 transformState.applyTransform(t, preserve3D ? TransformState::Accumulate
Transform : TransformState::FlattenTransform); | |
1734 } else { | |
1735 transformState.move(containerOffset.width(), containerOffset.height(), p
reserve3D ? TransformState::AccumulateTransform : TransformState::FlattenTransfo
rm); | |
1736 } | |
1737 | |
1738 if (ancestorSkipped) { | |
1739 // There can't be a transform between paintInvalidationContainer and o,
because transforms create containers, so it should be safe | |
1740 // to just subtract the delta between the paintInvalidationContainer and
o. | |
1741 LayoutSize containerOffset = ancestor->offsetFromAncestorContainer(o); | |
1742 transformState.move(-containerOffset.width(), -containerOffset.height(),
preserve3D ? TransformState::AccumulateTransform : TransformState::FlattenTrans
form); | |
1743 return; | |
1744 } | |
1745 | |
1746 mode &= ~ApplyContainerFlip; | |
1747 | |
1748 o->mapLocalToAncestor(ancestor, transformState, mode, wasFixed); | |
1749 } | 1709 } |
1750 | 1710 |
1751 void LayoutBox::mapAbsoluteToLocalPoint(MapCoordinatesFlags mode, TransformState
& transformState) const | 1711 void LayoutBox::mapAbsoluteToLocalPoint(MapCoordinatesFlags mode, TransformState
& transformState) const |
1752 { | 1712 { |
1753 bool isFixedPos = style()->position() == FixedPosition; | 1713 bool isFixedPos = style()->position() == FixedPosition; |
1754 bool hasTransform = hasLayer() && layer()->transform(); | 1714 bool hasTransform = hasLayer() && layer()->transform(); |
1755 if (hasTransform && !isFixedPos) { | 1715 if (hasTransform && !isFixedPos) { |
1756 // If this box has a transform, it acts as a fixed position container fo
r fixed descendants, | 1716 // If this box has a transform, it acts as a fixed position container fo
r fixed descendants, |
1757 // and may itself also be fixed position. So propagate 'fixed' up only i
f this box is fixed position. | 1717 // and may itself also be fixed position. So propagate 'fixed' up only i
f this box is fixed position. |
1758 mode &= ~IsFixed; | 1718 mode &= ~IsFixed; |
(...skipping 2962 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4721 } | 4681 } |
4722 | 4682 |
4723 void LayoutBox::IntrinsicSizingInfo::transpose() | 4683 void LayoutBox::IntrinsicSizingInfo::transpose() |
4724 { | 4684 { |
4725 size = size.transposedSize(); | 4685 size = size.transposedSize(); |
4726 aspectRatio = aspectRatio.transposedSize(); | 4686 aspectRatio = aspectRatio.transposedSize(); |
4727 std::swap(hasWidth, hasHeight); | 4687 std::swap(hasWidth, hasHeight); |
4728 } | 4688 } |
4729 | 4689 |
4730 } // namespace blink | 4690 } // namespace blink |
OLD | NEW |