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. | 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2011 Apple Inc. |
7 * All rights reserved. | 7 * All rights reserved. |
8 * Copyright (C) 2009 Google Inc. All rights reserved. | 8 * Copyright (C) 2009 Google Inc. All rights reserved. |
9 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. | 9 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. |
10 * (http://www.torchmobile.com/) | 10 * (http://www.torchmobile.com/) |
(...skipping 2022 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2033 return transformState.lastPlanarQuad(); | 2033 return transformState.lastPlanarQuad(); |
2034 } | 2034 } |
2035 | 2035 |
2036 void LayoutObject::mapLocalToAncestor(const LayoutBoxModelObject* ancestor, | 2036 void LayoutObject::mapLocalToAncestor(const LayoutBoxModelObject* ancestor, |
2037 TransformState& transformState, | 2037 TransformState& transformState, |
2038 MapCoordinatesFlags mode) const { | 2038 MapCoordinatesFlags mode) const { |
2039 if (ancestor == this) | 2039 if (ancestor == this) |
2040 return; | 2040 return; |
2041 | 2041 |
2042 bool ancestorSkipped; | 2042 bool ancestorSkipped; |
2043 const LayoutObject* o = container(ancestor, &ancestorSkipped); | 2043 const LayoutObject* o = container(ancestor, &ancestorSkipped); |
chrishtr
2016/10/21 22:40:32
Could you take this opportunity to rename to conta
Xianzhu
2016/10/21 22:52:00
I feel using containingBlock is confusing for now
| |
2044 if (!o) | 2044 if (!o) |
2045 return; | 2045 return; |
2046 | 2046 |
2047 if (mode & ApplyContainerFlip) { | 2047 if (mode & ApplyContainerFlip) { |
2048 if (isBox()) { | 2048 if (isBox()) { |
2049 mode &= ~ApplyContainerFlip; | 2049 mode &= ~ApplyContainerFlip; |
2050 } else if (o->isBox()) { | 2050 } else if (o->isBox()) { |
2051 if (o->style()->isFlippedBlocksWritingMode()) { | 2051 if (o->style()->isFlippedBlocksWritingMode()) { |
2052 IntPoint centerPoint = roundedIntPoint(transformState.mappedPoint()); | 2052 IntPoint centerPoint = roundedIntPoint(transformState.mappedPoint()); |
2053 transformState.move( | 2053 transformState.move( |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2086 } | 2086 } |
2087 | 2087 |
2088 if (ancestorSkipped) { | 2088 if (ancestorSkipped) { |
2089 // There can't be a transform between |ancestor| and |o|, because transforms | 2089 // There can't be a transform between |ancestor| and |o|, because transforms |
2090 // create containers, so it should be safe to just subtract the delta | 2090 // create containers, so it should be safe to just subtract the delta |
2091 // between the ancestor and |o|. | 2091 // between the ancestor and |o|. |
2092 LayoutSize containerOffset = ancestor->offsetFromAncestorContainer(o); | 2092 LayoutSize containerOffset = ancestor->offsetFromAncestorContainer(o); |
2093 transformState.move(-containerOffset.width(), -containerOffset.height(), | 2093 transformState.move(-containerOffset.width(), -containerOffset.height(), |
2094 preserve3D ? TransformState::AccumulateTransform | 2094 preserve3D ? TransformState::AccumulateTransform |
2095 : TransformState::FlattenTransform); | 2095 : TransformState::FlattenTransform); |
2096 // If the ancestor is fixed, then the rect is already in its coordinates so | |
2097 // doesn't need viewport-adjusting. | |
2098 if (ancestor->style()->position() != FixedPosition && o->isLayoutView() && | |
2099 styleRef().position() == FixedPosition) { | |
2100 LayoutRect rect; | |
2101 toLayoutView(o)->adjustOffsetForFixedPosition(rect); | |
2102 transformState.move(rect.x(), rect.y()); | |
2103 } | |
2096 return; | 2104 return; |
2097 } | 2105 } |
2098 | 2106 |
2099 o->mapLocalToAncestor(ancestor, transformState, mode); | 2107 o->mapLocalToAncestor(ancestor, transformState, mode); |
2100 } | 2108 } |
2101 | 2109 |
2102 const LayoutObject* LayoutObject::pushMappingToContainer( | 2110 const LayoutObject* LayoutObject::pushMappingToContainer( |
2103 const LayoutBoxModelObject* ancestorToStopAt, | 2111 const LayoutBoxModelObject* ancestorToStopAt, |
2104 LayoutGeometryMap& geometryMap) const { | 2112 LayoutGeometryMap& geometryMap) const { |
2105 ASSERT_NOT_REACHED(); | 2113 ASSERT_NOT_REACHED(); |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2157 if (applyContainerFlip) { | 2165 if (applyContainerFlip) { |
2158 IntPoint centerPoint = roundedIntPoint(transformState.mappedPoint()); | 2166 IntPoint centerPoint = roundedIntPoint(transformState.mappedPoint()); |
2159 transformState.move( | 2167 transformState.move( |
2160 centerPoint - | 2168 centerPoint - |
2161 toLayoutBox(o)->flipForWritingMode(LayoutPoint(centerPoint))); | 2169 toLayoutBox(o)->flipForWritingMode(LayoutPoint(centerPoint))); |
2162 } | 2170 } |
2163 | 2171 |
2164 if (ancestorSkipped) { | 2172 if (ancestorSkipped) { |
2165 containerOffset = ancestor->offsetFromAncestorContainer(o); | 2173 containerOffset = ancestor->offsetFromAncestorContainer(o); |
2166 transformState.move(-containerOffset.width(), -containerOffset.height()); | 2174 transformState.move(-containerOffset.width(), -containerOffset.height()); |
2175 // If the ancestor is fixed, then the rect is already in its coordinates so | |
2176 // doesn't need viewport-adjusting. | |
2177 if (ancestor->style()->position() != FixedPosition && o->isLayoutView() && | |
2178 styleRef().position() == FixedPosition) { | |
2179 LayoutRect rect; | |
2180 toLayoutView(o)->adjustOffsetForFixedPosition(rect); | |
2181 transformState.move(rect.x(), rect.y()); | |
2182 } | |
2167 } | 2183 } |
2168 } | 2184 } |
2169 | 2185 |
2170 bool LayoutObject::shouldUseTransformFromContainer( | 2186 bool LayoutObject::shouldUseTransformFromContainer( |
2171 const LayoutObject* containerObject) const { | 2187 const LayoutObject* containerObject) const { |
2172 // hasTransform() indicates whether the object has transform, transform-style | 2188 // hasTransform() indicates whether the object has transform, transform-style |
2173 // or perspective. We just care about transform, so check the layer's | 2189 // or perspective. We just care about transform, so check the layer's |
2174 // transform directly. | 2190 // transform directly. |
2175 return (hasLayer() && toLayoutBoxModelObject(this)->layer()->transform()) || | 2191 return (hasLayer() && toLayoutBoxModelObject(this)->layer()->transform()) || |
2176 (containerObject && containerObject->style()->hasPerspective()); | 2192 (containerObject && containerObject->style()->hasPerspective()); |
(...skipping 1360 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3537 const blink::LayoutObject* root = object1; | 3553 const blink::LayoutObject* root = object1; |
3538 while (root->parent()) | 3554 while (root->parent()) |
3539 root = root->parent(); | 3555 root = root->parent(); |
3540 root->showLayoutTreeAndMark(object1, "*", object2, "-", 0); | 3556 root->showLayoutTreeAndMark(object1, "*", object2, "-", 0); |
3541 } else { | 3557 } else { |
3542 WTFLogAlways("%s", "Cannot showLayoutTree. Root is (nil)"); | 3558 WTFLogAlways("%s", "Cannot showLayoutTree. Root is (nil)"); |
3543 } | 3559 } |
3544 } | 3560 } |
3545 | 3561 |
3546 #endif | 3562 #endif |
OLD | NEW |