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 2284 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2295 // transform directly. | 2295 // transform directly. |
2296 return (HasLayer() && ToLayoutBoxModelObject(this)->Layer()->Transform()) || | 2296 return (HasLayer() && ToLayoutBoxModelObject(this)->Layer()->Transform()) || |
2297 (container_object && container_object->Style()->HasPerspective()); | 2297 (container_object && container_object->Style()->HasPerspective()); |
2298 } | 2298 } |
2299 | 2299 |
2300 void LayoutObject::GetTransformFromContainer( | 2300 void LayoutObject::GetTransformFromContainer( |
2301 const LayoutObject* container_object, | 2301 const LayoutObject* container_object, |
2302 const LayoutSize& offset_in_container, | 2302 const LayoutSize& offset_in_container, |
2303 TransformationMatrix& transform) const { | 2303 TransformationMatrix& transform) const { |
2304 transform.MakeIdentity(); | 2304 transform.MakeIdentity(); |
2305 transform.Translate(offset_in_container.Width().ToFloat(), | |
2306 offset_in_container.Height().ToFloat()); | |
2307 PaintLayer* layer = HasLayer() ? ToLayoutBoxModelObject(this)->Layer() : 0; | 2305 PaintLayer* layer = HasLayer() ? ToLayoutBoxModelObject(this)->Layer() : 0; |
2308 if (layer && layer->Transform()) | 2306 if (layer && layer->Transform()) |
2309 transform.Multiply(layer->CurrentTransform()); | 2307 transform.Multiply(layer->CurrentTransform()); |
2310 | 2308 |
2309 transform.TranslateRight(offset_in_container.Width().ToFloat(), | |
chrishtr
2017/04/10 19:37:35
I can't come up with a case where the change here
trchen
2017/04/10 21:15:18
The code here is equivalent. See explanation above
chrishtr
2017/04/10 21:38:28
Ok.
| |
2310 offset_in_container.Height().ToFloat()); | |
2311 | |
2311 if (container_object && container_object->HasLayer() && | 2312 if (container_object && container_object->HasLayer() && |
2312 container_object->Style()->HasPerspective()) { | 2313 container_object->Style()->HasPerspective()) { |
2313 // Perpsective on the container affects us, so we have to factor it in here. | 2314 // Perspective on the container affects us, so we have to factor it in here. |
2314 DCHECK(container_object->HasLayer()); | 2315 DCHECK(container_object->HasLayer()); |
2315 FloatPoint perspective_origin = | 2316 FloatPoint perspective_origin = |
2316 ToLayoutBoxModelObject(container_object)->Layer()->PerspectiveOrigin(); | 2317 ToLayoutBoxModelObject(container_object)->Layer()->PerspectiveOrigin(); |
2317 | 2318 |
2318 TransformationMatrix perspective_matrix; | 2319 TransformationMatrix perspective_matrix; |
2319 perspective_matrix.ApplyPerspective( | 2320 perspective_matrix.ApplyPerspective( |
2320 container_object->Style()->Perspective()); | 2321 container_object->Style()->Perspective()); |
2322 perspective_matrix.ApplyTransformOrigin(perspective_origin.X(), | |
2323 perspective_origin.Y(), 0); | |
2321 | 2324 |
2322 transform.TranslateRight3d(-perspective_origin.X(), -perspective_origin.Y(), | 2325 // TODO(chrishtr): This applies perspective before the transform. Why? |
trchen
2017/04/10 21:15:19
This lgtm. It's TransformationMatrix.h lbtm. :/
chrishtr
2017/04/10 21:38:28
Removed the comment.
| |
2323 0); | |
2324 transform = perspective_matrix * transform; | 2326 transform = perspective_matrix * transform; |
2325 transform.TranslateRight3d(perspective_origin.X(), perspective_origin.Y(), | |
2326 0); | |
2327 } | 2327 } |
2328 } | 2328 } |
2329 | 2329 |
2330 FloatQuad LayoutObject::LocalToAncestorQuad( | 2330 FloatQuad LayoutObject::LocalToAncestorQuad( |
2331 const FloatQuad& local_quad, | 2331 const FloatQuad& local_quad, |
2332 const LayoutBoxModelObject* ancestor, | 2332 const LayoutBoxModelObject* ancestor, |
2333 MapCoordinatesFlags mode) const { | 2333 MapCoordinatesFlags mode) const { |
2334 return LocalToAncestorQuadInternal(local_quad, ancestor, | 2334 return LocalToAncestorQuadInternal(local_quad, ancestor, |
2335 mode | kUseTransforms); | 2335 mode | kUseTransforms); |
2336 } | 2336 } |
(...skipping 1311 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3648 const blink::LayoutObject* root = object1; | 3648 const blink::LayoutObject* root = object1; |
3649 while (root->Parent()) | 3649 while (root->Parent()) |
3650 root = root->Parent(); | 3650 root = root->Parent(); |
3651 root->ShowLayoutTreeAndMark(object1, "*", object2, "-", 0); | 3651 root->ShowLayoutTreeAndMark(object1, "*", object2, "-", 0); |
3652 } else { | 3652 } else { |
3653 WTFLogAlways("%s", "Cannot showLayoutTree. Root is (nil)"); | 3653 WTFLogAlways("%s", "Cannot showLayoutTree. Root is (nil)"); |
3654 } | 3654 } |
3655 } | 3655 } |
3656 | 3656 |
3657 #endif | 3657 #endif |
OLD | NEW |