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

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

Issue 2614093002: Combine LayoutObject::previousPaintOffset and paintOffset in paint properties (Closed)
Patch Set: Resolve conflict Created 3 years, 11 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/dom/DOMNodeIds.h" 7 #include "core/dom/DOMNodeIds.h"
8 #include "core/frame/FrameView.h" 8 #include "core/frame/FrameView.h"
9 #include "core/frame/LocalFrame.h" 9 #include "core/frame/LocalFrame.h"
10 #include "core/frame/Settings.h" 10 #include "core/frame/Settings.h"
(...skipping 559 matching lines...) Expand 10 before | Expand all | Expand 10 after
570 return; 570 return;
571 571
572 // Avoid adding an ObjectPaintProperties for non-boxes to save memory, since 572 // Avoid adding an ObjectPaintProperties for non-boxes to save memory, since
573 // we don't need them at the moment. 573 // we don't need them at the moment.
574 if (!object.isBox() && !object.hasLayer()) { 574 if (!object.isBox() && !object.hasLayer()) {
575 if (auto* properties = object.getMutableForPainting().paintProperties()) 575 if (auto* properties = object.getMutableForPainting().paintProperties())
576 properties->clearLocalBorderBoxProperties(); 576 properties->clearLocalBorderBoxProperties();
577 } else { 577 } else {
578 auto& properties = object.getMutableForPainting().ensurePaintProperties(); 578 auto& properties = object.getMutableForPainting().ensurePaintProperties();
579 properties.updateLocalBorderBoxProperties( 579 properties.updateLocalBorderBoxProperties(
580 context.current.paintOffset, context.current.transform, 580 context.current.transform, context.current.clip, context.currentEffect,
581 context.current.clip, context.currentEffect, context.current.scroll); 581 context.current.scroll);
582 } 582 }
583 } 583 }
584 584
585 // TODO(trchen): Remove this once we bake the paint offset into frameRect. 585 // TODO(trchen): Remove this once we bake the paint offset into frameRect.
586 void PaintPropertyTreeBuilder::updateScrollbarPaintOffset( 586 void PaintPropertyTreeBuilder::updateScrollbarPaintOffset(
587 const LayoutObject& object, 587 const LayoutObject& object,
588 PaintPropertyTreeBuilderContext& context) { 588 PaintPropertyTreeBuilderContext& context) {
589 if (!object.needsPaintPropertyUpdate() && !context.forceSubtreeUpdate) 589 if (!object.needsPaintPropertyUpdate() && !context.forceSubtreeUpdate)
590 return; 590 return;
591 591
(...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after
876 // tree-walk order of "columns" -> spanner placeholder -> spanner -> absolute. 876 // tree-walk order of "columns" -> spanner placeholder -> spanner -> absolute.
877 // Here we rebuild a ContainingBlockContext based on the properties of 877 // Here we rebuild a ContainingBlockContext based on the properties of
878 // "relative" for "absolute". 878 // "relative" for "absolute".
879 static void overrideContainingBlockContextFromRealContainingBlock( 879 static void overrideContainingBlockContextFromRealContainingBlock(
880 const LayoutBlock& containingBlock, 880 const LayoutBlock& containingBlock,
881 PaintPropertyTreeBuilderContext::ContainingBlockContext& context) { 881 PaintPropertyTreeBuilderContext::ContainingBlockContext& context) {
882 const auto* properties = 882 const auto* properties =
883 containingBlock.paintProperties()->localBorderBoxProperties(); 883 containingBlock.paintProperties()->localBorderBoxProperties();
884 DCHECK(properties); 884 DCHECK(properties);
885 885
886 context.transform = properties->propertyTreeState.transform(); 886 context.transform = properties->transform();
887 context.paintOffset = properties->paintOffset; 887 context.paintOffset = containingBlock.paintOffset();
888 context.shouldFlattenInheritedTransform = 888 context.shouldFlattenInheritedTransform =
889 context.transform && context.transform->flattensInheritedTransform(); 889 context.transform && context.transform->flattensInheritedTransform();
890 context.renderingContextId = 890 context.renderingContextId =
891 context.transform ? context.transform->renderingContextId() : 0; 891 context.transform ? context.transform->renderingContextId() : 0;
892 context.clip = properties->propertyTreeState.clip(); 892 context.clip = properties->clip();
893 context.scroll = properties->propertyTreeState.scroll(); 893 context.scroll = properties->scroll();
894 } 894 }
895 895
896 void PaintPropertyTreeBuilder::updateContextForBoxPosition( 896 void PaintPropertyTreeBuilder::updateContextForBoxPosition(
897 const LayoutObject& object, 897 const LayoutObject& object,
898 PaintPropertyTreeBuilderContext& context) { 898 PaintPropertyTreeBuilderContext& context) {
899 if (!object.isBoxModelObject()) 899 if (!object.isBoxModelObject())
900 return; 900 return;
901 901
902 const LayoutBoxModelObject& boxModelObject = toLayoutBoxModelObject(object); 902 const LayoutBoxModelObject& boxModelObject = toLayoutBoxModelObject(object);
903 903
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
973 if (boxModelObject.isTableCell()) { 973 if (boxModelObject.isTableCell()) {
974 LayoutObject* parentRow = boxModelObject.parent(); 974 LayoutObject* parentRow = boxModelObject.parent();
975 DCHECK(parentRow && parentRow->isTableRow()); 975 DCHECK(parentRow && parentRow->isTableRow());
976 context.current.paintOffset.moveBy( 976 context.current.paintOffset.moveBy(
977 -toLayoutBox(parentRow)->physicalLocation()); 977 -toLayoutBox(parentRow)->physicalLocation());
978 } 978 }
979 } 979 }
980 980
981 // Many paint properties depend on paint offset so we force an update of 981 // Many paint properties depend on paint offset so we force an update of
982 // the entire subtree on paint offset changes. 982 // the entire subtree on paint offset changes.
983 if (object.previousPaintOffset() != context.current.paintOffset) 983 if (object.paintOffset() != context.current.paintOffset)
984 context.forceSubtreeUpdate = true; 984 context.forceSubtreeUpdate = true;
985 } 985 }
986 986
987 void PaintPropertyTreeBuilder::updatePropertiesForSelf( 987 void PaintPropertyTreeBuilder::updatePropertiesForSelf(
988 const LayoutObject& object, 988 const LayoutObject& object,
989 PaintPropertyTreeBuilderContext& context) { 989 PaintPropertyTreeBuilderContext& context) {
990 if (!object.isBoxModelObject() && !object.isSVG())
991 return;
992
993 #if DCHECK_IS_ON() 990 #if DCHECK_IS_ON()
994 FindObjectPropertiesNeedingUpdateScope checkNeedsUpdateScope(object, context); 991 FindObjectPropertiesNeedingUpdateScope checkNeedsUpdateScope(object, context);
995 #endif 992 #endif
996 993
997 updatePaintOffsetTranslation(object, context); 994 if (object.isBoxModelObject() || object.isSVG()) {
998 updateTransform(object, context); 995 updatePaintOffsetTranslation(object, context);
999 updateEffect(object, context); 996 updateTransform(object, context);
1000 updateCssClip(object, context); 997 updateEffect(object, context);
1001 updateLocalBorderBoxContext(object, context); 998 updateCssClip(object, context);
1002 updateScrollbarPaintOffset(object, context); 999 updateLocalBorderBoxContext(object, context);
1000 updateScrollbarPaintOffset(object, context);
1001 }
1002
1003 if (object.needsPaintPropertyUpdate() || context.forceSubtreeUpdate)
1004 object.getMutableForPainting().setPaintOffset(context.current.paintOffset);
1003 } 1005 }
1004 1006
1005 void PaintPropertyTreeBuilder::updatePropertiesForChildren( 1007 void PaintPropertyTreeBuilder::updatePropertiesForChildren(
1006 const LayoutObject& object, 1008 const LayoutObject& object,
1007 PaintPropertyTreeBuilderContext& context) { 1009 PaintPropertyTreeBuilderContext& context) {
1008 if (!object.isBoxModelObject() && !object.isSVG())
1009 return;
1010
1011 #if DCHECK_IS_ON() 1010 #if DCHECK_IS_ON()
1012 FindObjectPropertiesNeedingUpdateScope checkNeedsUpdateScope(object, context); 1011 FindObjectPropertiesNeedingUpdateScope checkNeedsUpdateScope(object, context);
1013 #endif 1012 #endif
1014 1013
1014 if (!object.isBoxModelObject() && !object.isSVG())
1015 return;
1016
1015 updateOverflowClip(object, context); 1017 updateOverflowClip(object, context);
1016 updatePerspective(object, context); 1018 updatePerspective(object, context);
1017 updateSvgLocalToBorderBoxTransform(object, context); 1019 updateSvgLocalToBorderBoxTransform(object, context);
1018 updateScrollAndScrollTranslation(object, context); 1020 updateScrollAndScrollTranslation(object, context);
1019 updateOutOfFlowContext(object, context); 1021 updateOutOfFlowContext(object, context);
1020 1022
1021 context.forceSubtreeUpdate |= object.subtreeNeedsPaintPropertyUpdate(); 1023 context.forceSubtreeUpdate |= object.subtreeNeedsPaintPropertyUpdate();
1022 } 1024 }
1023 1025
1024 } // namespace blink 1026 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698