Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(66)

Side by Side Diff: third_party/WebKit/Source/core/layout/LayoutObject.cpp

Issue 2808613002: Apply container offset and scroll between transform and container perspective. (Closed)
Patch Set: none Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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(),
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(),
2323 0);
2324 transform = perspective_matrix * transform; 2325 transform = perspective_matrix * transform;
2325 transform.TranslateRight3d(perspective_origin.X(), perspective_origin.Y(),
2326 0);
2327 } 2326 }
2328 } 2327 }
2329 2328
2330 FloatQuad LayoutObject::LocalToAncestorQuad( 2329 FloatQuad LayoutObject::LocalToAncestorQuad(
2331 const FloatQuad& local_quad, 2330 const FloatQuad& local_quad,
2332 const LayoutBoxModelObject* ancestor, 2331 const LayoutBoxModelObject* ancestor,
2333 MapCoordinatesFlags mode) const { 2332 MapCoordinatesFlags mode) const {
2334 return LocalToAncestorQuadInternal(local_quad, ancestor, 2333 return LocalToAncestorQuadInternal(local_quad, ancestor,
2335 mode | kUseTransforms); 2334 mode | kUseTransforms);
2336 } 2335 }
(...skipping 1311 matching lines...) Expand 10 before | Expand all | Expand 10 after
3648 const blink::LayoutObject* root = object1; 3647 const blink::LayoutObject* root = object1;
3649 while (root->Parent()) 3648 while (root->Parent())
3650 root = root->Parent(); 3649 root = root->Parent();
3651 root->ShowLayoutTreeAndMark(object1, "*", object2, "-", 0); 3650 root->ShowLayoutTreeAndMark(object1, "*", object2, "-", 0);
3652 } else { 3651 } else {
3653 WTFLogAlways("%s", "Cannot showLayoutTree. Root is (nil)"); 3652 WTFLogAlways("%s", "Cannot showLayoutTree. Root is (nil)");
3654 } 3653 }
3655 } 3654 }
3656 3655
3657 #endif 3656 #endif
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/layout/LayoutBox.cpp ('k') | third_party/WebKit/Source/core/layout/VisualRectMappingTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698