| OLD | NEW |
| 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 911 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 922 // This is a weird quirk that table cells paint as children of table rows, | 922 // This is a weird quirk that table cells paint as children of table rows, |
| 923 // but their location have the row's location baked-in. | 923 // but their location have the row's location baked-in. |
| 924 // Similar adjustment is done in LayoutTableCell::offsetFromContainer(). | 924 // Similar adjustment is done in LayoutTableCell::offsetFromContainer(). |
| 925 if (boxModelObject.isTableCell()) { | 925 if (boxModelObject.isTableCell()) { |
| 926 LayoutObject* parentRow = boxModelObject.parent(); | 926 LayoutObject* parentRow = boxModelObject.parent(); |
| 927 DCHECK(parentRow && parentRow->isTableRow()); | 927 DCHECK(parentRow && parentRow->isTableRow()); |
| 928 context.current.paintOffset.moveBy( | 928 context.current.paintOffset.moveBy( |
| 929 -toLayoutBox(parentRow)->physicalLocation()); | 929 -toLayoutBox(parentRow)->physicalLocation()); |
| 930 } | 930 } |
| 931 } | 931 } |
| 932 | |
| 933 // Many paint properties depend on paint offset so we force an update of | |
| 934 // the entire subtree on paint offset changes. | |
| 935 if (object.paintOffset() != context.current.paintOffset) | |
| 936 context.forceSubtreeUpdate = true; | |
| 937 } | 932 } |
| 938 | 933 |
| 939 void PaintPropertyTreeBuilder::updatePropertiesForSelf( | 934 void PaintPropertyTreeBuilder::updatePropertiesForSelf( |
| 940 const LayoutObject& object, | 935 const LayoutObject& object, |
| 941 PaintPropertyTreeBuilderContext& context) { | 936 PaintPropertyTreeBuilderContext& context) { |
| 942 #if DCHECK_IS_ON() | 937 #if DCHECK_IS_ON() |
| 943 FindObjectPropertiesNeedingUpdateScope checkNeedsUpdateScope(object, context); | 938 FindObjectPropertiesNeedingUpdateScope checkNeedsUpdateScope(object, context); |
| 944 #endif | 939 #endif |
| 945 | 940 |
| 941 updateContextForBoxPosition(object, context); |
| 942 |
| 946 if (object.isBoxModelObject() || object.isSVG()) { | 943 if (object.isBoxModelObject() || object.isSVG()) { |
| 947 updatePaintOffsetTranslation(object, context); | 944 updatePaintOffsetTranslation(object, context); |
| 948 updateTransform(object, context); | 945 updateTransform(object, context); |
| 949 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) | 946 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) |
| 950 updateEffect(object, context); | 947 updateEffect(object, context); |
| 951 updateCssClip(object, context); | 948 updateCssClip(object, context); |
| 952 updateLocalBorderBoxContext(object, context); | 949 updateLocalBorderBoxContext(object, context); |
| 953 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) | 950 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) |
| 954 updateScrollbarPaintOffset(object, context); | 951 updateScrollbarPaintOffset(object, context); |
| 955 } | 952 } |
| 956 | 953 |
| 957 if (object.needsPaintPropertyUpdate() || context.forceSubtreeUpdate) { | 954 if (object.paintOffset() != context.current.paintOffset) { |
| 958 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled() && | 955 // Many paint properties depend on paint offset so we force an update of |
| 959 object.paintOffset() != context.current.paintOffset) { | 956 // the entire subtree on paint offset changes. |
| 957 context.forceSubtreeUpdate = true; |
| 958 |
| 959 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { |
| 960 object.getMutableForPainting().setShouldDoFullPaintInvalidation( | 960 object.getMutableForPainting().setShouldDoFullPaintInvalidation( |
| 961 PaintInvalidationLocationChange); | 961 PaintInvalidationLocationChange); |
| 962 } | 962 } |
| 963 object.getMutableForPainting().setPaintOffset(context.current.paintOffset); | 963 object.getMutableForPainting().setPaintOffset(context.current.paintOffset); |
| 964 } | 964 } |
| 965 } | 965 } |
| 966 | 966 |
| 967 void PaintPropertyTreeBuilder::updatePropertiesForChildren( | 967 void PaintPropertyTreeBuilder::updatePropertiesForChildren( |
| 968 const LayoutObject& object, | 968 const LayoutObject& object, |
| 969 PaintPropertyTreeBuilderContext& context) { | 969 PaintPropertyTreeBuilderContext& context) { |
| 970 #if DCHECK_IS_ON() | 970 #if DCHECK_IS_ON() |
| 971 FindObjectPropertiesNeedingUpdateScope checkNeedsUpdateScope(object, context); | 971 FindObjectPropertiesNeedingUpdateScope checkNeedsUpdateScope(object, context); |
| 972 #endif | 972 #endif |
| 973 | 973 |
| 974 if (!object.isBoxModelObject() && !object.isSVG()) | 974 if (!object.isBoxModelObject() && !object.isSVG()) |
| 975 return; | 975 return; |
| 976 | 976 |
| 977 updateOverflowClip(object, context); | 977 updateOverflowClip(object, context); |
| 978 updatePerspective(object, context); | 978 updatePerspective(object, context); |
| 979 updateSvgLocalToBorderBoxTransform(object, context); | 979 updateSvgLocalToBorderBoxTransform(object, context); |
| 980 updateScrollAndScrollTranslation(object, context); | 980 updateScrollAndScrollTranslation(object, context); |
| 981 updateOutOfFlowContext(object, context); | 981 updateOutOfFlowContext(object, context); |
| 982 | 982 |
| 983 context.forceSubtreeUpdate |= object.subtreeNeedsPaintPropertyUpdate(); | 983 context.forceSubtreeUpdate |= object.subtreeNeedsPaintPropertyUpdate(); |
| 984 } | 984 } |
| 985 | 985 |
| 986 } // namespace blink | 986 } // namespace blink |
| OLD | NEW |