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

Side by Side Diff: third_party/WebKit/Source/core/paint/PaintPropertyTreeBuilder.cpp

Issue 2225743002: Use same layout logic in animations for deciding whether an element can transform (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 4 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 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "core/paint/PaintPropertyTreeBuilder.h" 5 #include "core/paint/PaintPropertyTreeBuilder.h"
6 6
7 #include "core/frame/FrameView.h" 7 #include "core/frame/FrameView.h"
8 #include "core/frame/LocalFrame.h" 8 #include "core/frame/LocalFrame.h"
9 #include "core/frame/Settings.h" 9 #include "core/frame/Settings.h"
10 #include "core/layout/LayoutInline.h" 10 #include "core/layout/LayoutInline.h"
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
126 if (!transform.isIdentity()) { 126 if (!transform.isIdentity()) {
127 // The origin is included in the local transform, so leave origin em pty. 127 // The origin is included in the local transform, so leave origin em pty.
128 context.current.transform = object.getMutableForPainting().ensureObj ectPaintProperties().createOrUpdateTransform( 128 context.current.transform = object.getMutableForPainting().ensureObj ectPaintProperties().createOrUpdateTransform(
129 context.current.transform, TransformationMatrix(transform), Floa tPoint3D()); 129 context.current.transform, TransformationMatrix(transform), Floa tPoint3D());
130 context.current.renderingContextID = 0; 130 context.current.renderingContextID = 0;
131 context.current.shouldFlattenInheritedTransform = false; 131 context.current.shouldFlattenInheritedTransform = false;
132 return; 132 return;
133 } 133 }
134 } else { 134 } else {
135 const ComputedStyle& style = object.styleRef(); 135 const ComputedStyle& style = object.styleRef();
136 if (object.isBox() && (style.hasTransform() || style.preserves3D())) { 136 if (object.canTransform() && (style.hasTransform() || style.preserves3D( ))) {
137 TransformationMatrix matrix; 137 TransformationMatrix matrix;
138 style.applyTransform(matrix, toLayoutBox(object).size(), ComputedSty le::ExcludeTransformOrigin, 138 style.applyTransform(matrix, toLayoutBox(object).size(), ComputedSty le::ExcludeTransformOrigin,
139 ComputedStyle::IncludeMotionPath, ComputedStyle::IncludeIndepend entTransformProperties); 139 ComputedStyle::IncludeMotionPath, ComputedStyle::IncludeIndepend entTransformProperties);
140 FloatPoint3D origin = transformOrigin(toLayoutBox(object)); 140 FloatPoint3D origin = transformOrigin(toLayoutBox(object));
141 141
142 unsigned renderingContextID = context.current.renderingContextID; 142 unsigned renderingContextID = context.current.renderingContextID;
143 unsigned renderingContextIDForChildren = 0; 143 unsigned renderingContextIDForChildren = 0;
144 bool flattensInheritedTransform = context.current.shouldFlattenInher itedTransform; 144 bool flattensInheritedTransform = context.current.shouldFlattenInher itedTransform;
145 bool childrenFlattenInheritedTransform = true; 145 bool childrenFlattenInheritedTransform = true;
146 146
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
268 const ComputedStyle& style = box.styleRef(); 268 const ComputedStyle& style = box.styleRef();
269 FloatSize borderBoxSize(box.size()); 269 FloatSize borderBoxSize(box.size());
270 return FloatPoint( 270 return FloatPoint(
271 floatValueForLength(style.perspectiveOriginX(), borderBoxSize.width()), 271 floatValueForLength(style.perspectiveOriginX(), borderBoxSize.width()),
272 floatValueForLength(style.perspectiveOriginY(), borderBoxSize.height())) ; 272 floatValueForLength(style.perspectiveOriginY(), borderBoxSize.height())) ;
273 } 273 }
274 274
275 void PaintPropertyTreeBuilder::updatePerspective(const LayoutObject& object, Pai ntPropertyTreeBuilderContext& context) 275 void PaintPropertyTreeBuilder::updatePerspective(const LayoutObject& object, Pai ntPropertyTreeBuilderContext& context)
276 { 276 {
277 const ComputedStyle& style = object.styleRef(); 277 const ComputedStyle& style = object.styleRef();
278 if (!object.isBox() || !style.hasPerspective()) { 278 if (!object.isBox() || !style.hasPerspective()) {
trchen 2016/08/09 01:22:02 object.canTransform() here too.
alancutter (OOO until 2018) 2016/08/09 02:07:21 Done.
279 if (ObjectPaintProperties* properties = object.getMutableForPainting().o bjectPaintProperties()) 279 if (ObjectPaintProperties* properties = object.getMutableForPainting().o bjectPaintProperties())
280 properties->clearPerspective(); 280 properties->clearPerspective();
281 return; 281 return;
282 } 282 }
283 283
284 // The perspective node must not flatten (else nothing will get 284 // The perspective node must not flatten (else nothing will get
285 // perspective), but it should still extend the rendering context as most 285 // perspective), but it should still extend the rendering context as most
286 // transform nodes do. 286 // transform nodes do.
287 TransformationMatrix matrix = TransformationMatrix().applyPerspective(style. perspective()); 287 TransformationMatrix matrix = TransformationMatrix().applyPerspective(style. perspective());
288 FloatPoint3D origin = perspectiveOrigin(toLayoutBox(object)) + toLayoutSize( context.current.paintOffset); 288 FloatPoint3D origin = perspectiveOrigin(toLayoutBox(object)) + toLayoutSize( context.current.paintOffset);
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
431 updateLocalBorderBoxContext(object, context); 431 updateLocalBorderBoxContext(object, context);
432 updateScrollbarPaintOffset(object, context); 432 updateScrollbarPaintOffset(object, context);
433 updateOverflowClip(object, context); 433 updateOverflowClip(object, context);
434 updatePerspective(object, context); 434 updatePerspective(object, context);
435 updateSvgLocalToBorderBoxTransform(object, context); 435 updateSvgLocalToBorderBoxTransform(object, context);
436 updateScrollTranslation(object, context); 436 updateScrollTranslation(object, context);
437 updateOutOfFlowContext(object, context); 437 updateOutOfFlowContext(object, context);
438 } 438 }
439 439
440 } // namespace blink 440 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698