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 2186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2197 mapAbsoluteToLocalPoint(mode, transformState); | 2197 mapAbsoluteToLocalPoint(mode, transformState); |
2198 transformState.flatten(); | 2198 transformState.flatten(); |
2199 return transformState.lastPlanarQuad(); | 2199 return transformState.lastPlanarQuad(); |
2200 } | 2200 } |
2201 | 2201 |
2202 void LayoutObject::mapLocalToAncestor(const LayoutBoxModelObject* ancestor, Tran sformState& transformState, MapCoordinatesFlags mode, bool* wasFixed, const Pain tInvalidationState* paintInvalidationState) const | 2202 void LayoutObject::mapLocalToAncestor(const LayoutBoxModelObject* ancestor, Tran sformState& transformState, MapCoordinatesFlags mode, bool* wasFixed, const Pain tInvalidationState* paintInvalidationState) const |
2203 { | 2203 { |
2204 if (ancestor == this) | 2204 if (ancestor == this) |
2205 return; | 2205 return; |
2206 | 2206 |
2207 LayoutObject* o = parent(); | 2207 if (paintInvalidationState && paintInvalidationState->canMapToContainer(ance stor)) { |
2208 LayoutSize offset = paintInvalidationState->paintOffset(); | |
2209 if (PaintLayer* layer = style()->hasInFlowPosition() && hasLayer() ? toL ayoutBoxModelObject(this)->layer() : nullptr) | |
eae
2016/02/12 17:31:55
Can we make this "const PaintLayer*"?
(PaintLayer
mstensho (USE GERRIT)
2016/02/12 20:12:49
Done.
| |
2210 offset += layer->offsetForInFlowPosition(); | |
2211 transformState.move(offset); | |
2212 return; | |
2213 } | |
2214 | |
2215 bool containerSkipped; | |
2216 LayoutObject* o = container(ancestor, &containerSkipped); | |
2208 if (!o) | 2217 if (!o) |
2209 return; | 2218 return; |
2210 | 2219 |
2211 // FIXME: this should call offsetFromContainer to share code, but I'm not su re it's ever called. | |
2212 LayoutPoint centerPoint = roundedLayoutPoint(transformState.mappedPoint()); | |
2213 if (mode & ApplyContainerFlip && o->isBox()) { | 2220 if (mode & ApplyContainerFlip && o->isBox()) { |
2214 if (o->style()->isFlippedBlocksWritingMode()) | 2221 if (o->style()->isFlippedBlocksWritingMode()) { |
2215 transformState.move(toLayoutBox(o)->flipForWritingMode(roundedLayout Point(transformState.mappedPoint())) - centerPoint); | 2222 IntPoint centerPoint = roundedIntPoint(transformState.mappedPoint()) ; |
2223 transformState.move(toLayoutBox(o)->flipForWritingMode(LayoutPoint(c enterPoint)) - centerPoint); | |
2224 } | |
2216 mode &= ~ApplyContainerFlip; | 2225 mode &= ~ApplyContainerFlip; |
2217 } | 2226 } |
2218 | 2227 |
2219 transformState.move(o->columnOffset(roundedLayoutPoint(transformState.mapped Point()))); | 2228 LayoutSize containerOffset = offsetFromContainer(o, roundedLayoutPoint(trans formState.mappedPoint())); |
2220 | 2229 |
2221 if (o->hasOverflowClip()) | 2230 // Text objects just copy their parent's computed style, so we need to ignor e them. |
2222 transformState.move(-toLayoutBox(o)->scrolledContentOffset()); | 2231 bool preserve3D = mode & UseTransforms && ((o->style()->preserves3D() && !o- >isText()) || (style()->preserves3D() && !isText())); |
2232 if (mode & UseTransforms && shouldUseTransformFromContainer(o)) { | |
2233 TransformationMatrix t; | |
2234 getTransformFromContainer(o, containerOffset, t); | |
2235 transformState.applyTransform(t, preserve3D ? TransformState::Accumulate Transform : TransformState::FlattenTransform); | |
2236 } else { | |
2237 transformState.move(containerOffset.width(), containerOffset.height(), p reserve3D ? TransformState::AccumulateTransform : TransformState::FlattenTransfo rm); | |
2238 } | |
2239 | |
2240 if (containerSkipped) { | |
2241 // There can't be a transform between |ancestor| and |o|, because transf orms create | |
2242 // containers, so it should be safe to just subtract the delta between t he ancestor and |o|. | |
2243 LayoutSize containerOffset = ancestor->offsetFromAncestorContainer(o); | |
2244 transformState.move(-containerOffset.width(), -containerOffset.height(), preserve3D ? TransformState::AccumulateTransform : TransformState::FlattenTrans form); | |
2245 return; | |
2246 } | |
2223 | 2247 |
2224 o->mapLocalToAncestor(ancestor, transformState, mode, wasFixed, paintInvalid ationState); | 2248 o->mapLocalToAncestor(ancestor, transformState, mode, wasFixed, paintInvalid ationState); |
2225 } | 2249 } |
2226 | 2250 |
2227 const LayoutObject* LayoutObject::pushMappingToContainer(const LayoutBoxModelObj ect* ancestorToStopAt, LayoutGeometryMap& geometryMap) const | 2251 const LayoutObject* LayoutObject::pushMappingToContainer(const LayoutBoxModelObj ect* ancestorToStopAt, LayoutGeometryMap& geometryMap) const |
2228 { | 2252 { |
2229 ASSERT_NOT_REACHED(); | 2253 ASSERT_NOT_REACHED(); |
2230 return nullptr; | 2254 return nullptr; |
2231 } | 2255 } |
2232 | 2256 |
(...skipping 1383 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3616 const blink::LayoutObject* root = object1; | 3640 const blink::LayoutObject* root = object1; |
3617 while (root->parent()) | 3641 while (root->parent()) |
3618 root = root->parent(); | 3642 root = root->parent(); |
3619 root->showLayoutTreeAndMark(object1, "*", object2, "-", 0); | 3643 root->showLayoutTreeAndMark(object1, "*", object2, "-", 0); |
3620 } else { | 3644 } else { |
3621 fprintf(stderr, "Cannot showLayoutTree. Root is (nil)\n"); | 3645 fprintf(stderr, "Cannot showLayoutTree. Root is (nil)\n"); |
3622 } | 3646 } |
3623 } | 3647 } |
3624 | 3648 |
3625 #endif | 3649 #endif |
OLD | NEW |