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

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

Issue 2571043002: Set a direct compositing reason for 3D transform & will-change property tree nodes (Closed)
Patch Set: Created 4 years 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"
11 #include "core/layout/LayoutView.h" 11 #include "core/layout/LayoutView.h"
12 #include "core/layout/compositing/CompositingReasonFinder.h"
12 #include "core/layout/svg/LayoutSVGRoot.h" 13 #include "core/layout/svg/LayoutSVGRoot.h"
13 #include "core/paint/FindPropertiesNeedingUpdate.h" 14 #include "core/paint/FindPropertiesNeedingUpdate.h"
14 #include "core/paint/ObjectPaintProperties.h" 15 #include "core/paint/ObjectPaintProperties.h"
15 #include "core/paint/PaintLayer.h" 16 #include "core/paint/PaintLayer.h"
16 #include "core/paint/SVGRootPainter.h" 17 #include "core/paint/SVGRootPainter.h"
17 #include "platform/transforms/TransformationMatrix.h" 18 #include "platform/transforms/TransformationMatrix.h"
18 #include "wtf/PtrUtil.h" 19 #include "wtf/PtrUtil.h"
19 #include <memory> 20 #include <memory>
20 21
21 namespace blink { 22 namespace blink {
(...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after
312 const LayoutObject& object, 313 const LayoutObject& object,
313 PaintPropertyTreeBuilderContext& context) { 314 PaintPropertyTreeBuilderContext& context) {
314 if (object.isSVG() && !object.isSVGRoot()) { 315 if (object.isSVG() && !object.isSVGRoot()) {
315 updateTransformForNonRootSVG(object, context); 316 updateTransformForNonRootSVG(object, context);
316 return; 317 return;
317 } 318 }
318 319
319 if (object.needsPaintPropertyUpdate() || context.forceSubtreeUpdate) { 320 if (object.needsPaintPropertyUpdate() || context.forceSubtreeUpdate) {
320 const ComputedStyle& style = object.styleRef(); 321 const ComputedStyle& style = object.styleRef();
321 if (object.isBox() && (style.hasTransform() || style.preserves3D())) { 322 if (object.isBox() && (style.hasTransform() || style.preserves3D())) {
323 CompositingReasons compositingReasons = CompositingReasonNone;
324 if (CompositingReasonFinder::requiresCompositingForTransform(object))
325 compositingReasons |= CompositingReason3DTransform;
326
322 TransformationMatrix matrix; 327 TransformationMatrix matrix;
323 style.applyTransform( 328 style.applyTransform(
324 matrix, toLayoutBox(object).size(), 329 matrix, toLayoutBox(object).size(),
325 ComputedStyle::ExcludeTransformOrigin, 330 ComputedStyle::ExcludeTransformOrigin,
326 ComputedStyle::IncludeMotionPath, 331 ComputedStyle::IncludeMotionPath,
327 ComputedStyle::IncludeIndependentTransformProperties); 332 ComputedStyle::IncludeIndependentTransformProperties);
328 333
329 // TODO(trchen): transform-style should only be respected if a PaintLayer 334 // TODO(trchen): transform-style should only be respected if a PaintLayer
330 // is created. 335 // is created.
331 // If a node with transform-style: preserve-3d does not exist in an 336 // If a node with transform-style: preserve-3d does not exist in an
332 // existing rendering context, it establishes a new one. 337 // existing rendering context, it establishes a new one.
333 unsigned renderingContextID = context.current.renderingContextID; 338 unsigned renderingContextID = context.current.renderingContextID;
334 if (style.preserves3D() && !renderingContextID) 339 if (style.preserves3D() && !renderingContextID)
335 renderingContextID = PtrHash<const LayoutObject>::hash(&object); 340 renderingContextID = PtrHash<const LayoutObject>::hash(&object);
336 341
337 auto& properties = object.getMutableForPainting().ensurePaintProperties(); 342 auto& properties = object.getMutableForPainting().ensurePaintProperties();
338 context.forceSubtreeUpdate |= properties.updateTransform( 343 context.forceSubtreeUpdate |= properties.updateTransform(
339 context.current.transform, matrix, 344 context.current.transform, matrix,
340 transformOrigin(toLayoutBox(object)), 345 transformOrigin(toLayoutBox(object)),
341 context.current.shouldFlattenInheritedTransform, renderingContextID); 346 context.current.shouldFlattenInheritedTransform, renderingContextID,
347 compositingReasons);
342 } else { 348 } else {
343 if (auto* properties = object.getMutableForPainting().paintProperties()) 349 if (auto* properties = object.getMutableForPainting().paintProperties())
344 context.forceSubtreeUpdate |= properties->clearTransform(); 350 context.forceSubtreeUpdate |= properties->clearTransform();
345 } 351 }
346 } 352 }
347 353
348 const auto* properties = object.paintProperties(); 354 const auto* properties = object.paintProperties();
349 if (properties && properties->transform()) { 355 if (properties && properties->transform()) {
350 context.current.transform = properties->transform(); 356 context.current.transform = properties->transform();
351 if (object.styleRef().preserves3D()) { 357 if (object.styleRef().preserves3D()) {
(...skipping 555 matching lines...) Expand 10 before | Expand all | Expand 10 after
907 #endif 913 #endif
908 914
909 updateOverflowClip(object, context); 915 updateOverflowClip(object, context);
910 updatePerspective(object, context); 916 updatePerspective(object, context);
911 updateSvgLocalToBorderBoxTransform(object, context); 917 updateSvgLocalToBorderBoxTransform(object, context);
912 updateScrollAndScrollTranslation(object, context); 918 updateScrollAndScrollTranslation(object, context);
913 updateOutOfFlowContext(object, context); 919 updateOutOfFlowContext(object, context);
914 } 920 }
915 921
916 } // namespace blink 922 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698