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 2187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2198 return transformState.lastPlanarQuad(); | 2198 return transformState.lastPlanarQuad(); |
2199 } | 2199 } |
2200 | 2200 |
2201 void LayoutObject::mapLocalToAncestor(const LayoutBoxModelObject* ancestor, Tran
sformState& transformState, MapCoordinatesFlags mode, bool* wasFixed, const Pain
tInvalidationState* paintInvalidationState) const | 2201 void LayoutObject::mapLocalToAncestor(const LayoutBoxModelObject* ancestor, Tran
sformState& transformState, MapCoordinatesFlags mode, bool* wasFixed, const Pain
tInvalidationState* paintInvalidationState) const |
2202 { | 2202 { |
2203 if (ancestor == this) | 2203 if (ancestor == this) |
2204 return; | 2204 return; |
2205 | 2205 |
2206 if (paintInvalidationState && paintInvalidationState->canMapToContainer(ance
stor)) { | 2206 if (paintInvalidationState && paintInvalidationState->canMapToContainer(ance
stor)) { |
2207 LayoutSize offset = paintInvalidationState->paintOffset(); | 2207 LayoutSize offset = paintInvalidationState->paintOffset(); |
| 2208 if (const LayoutBox* layoutBox = isBox() ? toLayoutBox(this) : nullptr) |
| 2209 offset += layoutBox->locationOffset(); |
2208 if (const PaintLayer* layer = style()->hasInFlowPosition() && hasLayer()
? toLayoutBoxModelObject(this)->layer() : nullptr) | 2210 if (const PaintLayer* layer = style()->hasInFlowPosition() && hasLayer()
? toLayoutBoxModelObject(this)->layer() : nullptr) |
2209 offset += layer->offsetForInFlowPosition(); | 2211 offset += layer->offsetForInFlowPosition(); |
2210 transformState.move(offset); | 2212 transformState.move(offset); |
2211 return; | 2213 return; |
2212 } | 2214 } |
2213 | 2215 |
| 2216 if (wasFixed) |
| 2217 *wasFixed = mode & IsFixed; |
| 2218 |
2214 bool containerSkipped; | 2219 bool containerSkipped; |
2215 const LayoutObject* o = container(ancestor, &containerSkipped); | 2220 const LayoutObject* o = container(ancestor, &containerSkipped); |
2216 if (!o) | 2221 if (!o) |
2217 return; | 2222 return; |
2218 | 2223 |
2219 if (mode & ApplyContainerFlip && o->isBox()) { | 2224 if (mode & ApplyContainerFlip) { |
2220 if (o->style()->isFlippedBlocksWritingMode()) { | 2225 if (isBox()) { |
2221 IntPoint centerPoint = roundedIntPoint(transformState.mappedPoint())
; | 2226 mode &= ~ApplyContainerFlip; |
2222 transformState.move(toLayoutBox(o)->flipForWritingMode(LayoutPoint(c
enterPoint)) - centerPoint); | 2227 } else if (o->isBox()) { |
| 2228 if (o->style()->isFlippedBlocksWritingMode()) { |
| 2229 IntPoint centerPoint = roundedIntPoint(transformState.mappedPoin
t()); |
| 2230 transformState.move(toLayoutBox(o)->flipForWritingMode(LayoutPoi
nt(centerPoint)) - centerPoint); |
| 2231 } |
| 2232 mode &= ~ApplyContainerFlip; |
2223 } | 2233 } |
2224 mode &= ~ApplyContainerFlip; | |
2225 } | 2234 } |
2226 | 2235 |
2227 LayoutSize containerOffset = offsetFromContainer(o, roundedLayoutPoint(trans
formState.mappedPoint())); | 2236 LayoutSize containerOffset = offsetFromContainer(o, roundedLayoutPoint(trans
formState.mappedPoint())); |
2228 | 2237 |
2229 // Text objects just copy their parent's computed style, so we need to ignor
e them. | 2238 // Text objects just copy their parent's computed style, so we need to ignor
e them. |
2230 bool preserve3D = mode & UseTransforms && ((o->style()->preserves3D() && !o-
>isText()) || (style()->preserves3D() && !isText())); | 2239 bool preserve3D = mode & UseTransforms && ((o->style()->preserves3D() && !o-
>isText()) || (style()->preserves3D() && !isText())); |
2231 if (mode & UseTransforms && shouldUseTransformFromContainer(o)) { | 2240 if (mode & UseTransforms && shouldUseTransformFromContainer(o)) { |
2232 TransformationMatrix t; | 2241 TransformationMatrix t; |
2233 getTransformFromContainer(o, containerOffset, t); | 2242 getTransformFromContainer(o, containerOffset, t); |
2234 transformState.applyTransform(t, preserve3D ? TransformState::Accumulate
Transform : TransformState::FlattenTransform); | 2243 transformState.applyTransform(t, preserve3D ? TransformState::Accumulate
Transform : TransformState::FlattenTransform); |
(...skipping 1404 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3639 const blink::LayoutObject* root = object1; | 3648 const blink::LayoutObject* root = object1; |
3640 while (root->parent()) | 3649 while (root->parent()) |
3641 root = root->parent(); | 3650 root = root->parent(); |
3642 root->showLayoutTreeAndMark(object1, "*", object2, "-", 0); | 3651 root->showLayoutTreeAndMark(object1, "*", object2, "-", 0); |
3643 } else { | 3652 } else { |
3644 fprintf(stderr, "Cannot showLayoutTree. Root is (nil)\n"); | 3653 fprintf(stderr, "Cannot showLayoutTree. Root is (nil)\n"); |
3645 } | 3654 } |
3646 } | 3655 } |
3647 | 3656 |
3648 #endif | 3657 #endif |
OLD | NEW |