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

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

Issue 2729683002: Handle resize in PaintPropertyTreeBuilder::updateForObjectSizeAndLocation() (Closed)
Patch Set: Fix a typo (ScrollbarWithChange -> ScrollbarWidthChange) Created 3 years, 9 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 <memory> 7 #include <memory>
8 #include "core/dom/DOMNodeIds.h" 8 #include "core/dom/DOMNodeIds.h"
9 #include "core/frame/FrameView.h" 9 #include "core/frame/FrameView.h"
10 #include "core/frame/LocalFrame.h" 10 #include "core/frame/LocalFrame.h"
(...skipping 1025 matching lines...) Expand 10 before | Expand all | Expand 10 after
1036 // Similar adjustment is done in LayoutTableCell::offsetFromContainer(). 1036 // Similar adjustment is done in LayoutTableCell::offsetFromContainer().
1037 if (object.isTableCell()) { 1037 if (object.isTableCell()) {
1038 LayoutObject* parentRow = object.parent(); 1038 LayoutObject* parentRow = object.parent();
1039 DCHECK(parentRow && parentRow->isTableRow()); 1039 DCHECK(parentRow && parentRow->isTableRow());
1040 context.current.paintOffset.moveBy( 1040 context.current.paintOffset.moveBy(
1041 -toLayoutBox(parentRow)->physicalLocation()); 1041 -toLayoutBox(parentRow)->physicalLocation());
1042 } 1042 }
1043 } 1043 }
1044 } 1044 }
1045 1045
1046 void PaintPropertyTreeBuilder::updateForObjectLocation( 1046 void PaintPropertyTreeBuilder::updateForObjectLocationAndSize(
1047 const LayoutObject& object, 1047 const LayoutObject& object,
1048 PaintPropertyTreeBuilderContext& context) { 1048 PaintPropertyTreeBuilderContext& context) {
1049 if (object.isBoxModelObject()) { 1049 if (object.isBoxModelObject()) {
1050 updatePaintOffset(toLayoutBoxModelObject(object), context); 1050 updatePaintOffset(toLayoutBoxModelObject(object), context);
1051 updatePaintOffsetTranslation(toLayoutBoxModelObject(object), context); 1051 updatePaintOffsetTranslation(toLayoutBoxModelObject(object), context);
1052 } 1052 }
1053 1053
1054 if (object.paintOffset() == context.current.paintOffset) 1054 if (object.paintOffset() != context.current.paintOffset) {
1055 // Many paint properties depend on paint offset so we force an update of
1056 // the entire subtree on paint offset changes.
1057 context.forceSubtreeUpdate = true;
1058
1059 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) {
1060 object.getMutableForPainting().setShouldDoFullPaintInvalidation(
1061 PaintInvalidationLocationChange);
1062 }
1063 object.getMutableForPainting().setPaintOffset(context.current.paintOffset);
1064 }
1065
1066 if (!object.isBox())
1067 return;
1068 const LayoutBox& box = toLayoutBox(object);
1069 if (box.size() == box.previousSize())
1055 return; 1070 return;
1056 1071
1057 // Many paint properties depend on paint offset so we force an update of 1072 // The overflow clip paint property depends on the border box rect through
1058 // the entire subtree on paint offset changes. 1073 // overflowClipRect(). The border box rect's size equals the frame rect's
1059 context.forceSubtreeUpdate = true; 1074 // size so we trigger a paint property update when the frame rect changes.
1060 1075 if (box.shouldClipOverflow() ||
1061 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { 1076 // The used value of CSS clip may depend on size of the box, e.g. for
1062 object.getMutableForPainting().setShouldDoFullPaintInvalidation( 1077 // clip: rect(auto auto auto -5px).
1063 PaintInvalidationLocationChange); 1078 box.hasClip() ||
1064 } 1079 // Relative lengths (e.g., percentage values) in transform, perspective,
1065 object.getMutableForPainting().setPaintOffset(context.current.paintOffset); 1080 // transform-origin, and perspective-origin can depend on the size of the
1081 // frame rect, so force a property update if it changes. TODO(pdr): We
1082 // only need to update properties if there are relative lengths.
1083 box.styleRef().hasTransform() || box.styleRef().hasPerspective())
1084 box.getMutableForPainting().setNeedsPaintPropertyUpdate();
1066 } 1085 }
1067 1086
1068 void PaintPropertyTreeBuilder::updatePropertiesForSelf( 1087 void PaintPropertyTreeBuilder::updatePropertiesForSelf(
1069 const LayoutObject& object, 1088 const LayoutObject& object,
1070 PaintPropertyTreeBuilderContext& context) { 1089 PaintPropertyTreeBuilderContext& context) {
1071 // This is not in FindObjectPropertiesNeedingUpdateScope because paint offset 1090 // This is not in FindObjectPropertiesNeedingUpdateScope because paint offset
1072 // can change without needsPaintPropertyUpdate. 1091 // can change without needsPaintPropertyUpdate.
1073 updateForObjectLocation(object, context); 1092 updateForObjectLocationAndSize(object, context);
1074 1093
1075 #if DCHECK_IS_ON() 1094 #if DCHECK_IS_ON()
1076 FindObjectPropertiesNeedingUpdateScope checkNeedsUpdateScope(object, context); 1095 FindObjectPropertiesNeedingUpdateScope checkNeedsUpdateScope(object, context);
1077 #endif 1096 #endif
1078 1097
1079 if (object.isBoxModelObject() || object.isSVG()) { 1098 if (object.isBoxModelObject() || object.isSVG()) {
1080 updateTransform(object, context); 1099 updateTransform(object, context);
1081 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { 1100 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) {
1082 updateEffect(object, context); 1101 updateEffect(object, context);
1083 updateFilter(object, context); 1102 updateFilter(object, context);
(...skipping 18 matching lines...) Expand all
1102 updateOverflowClip(object, context); 1121 updateOverflowClip(object, context);
1103 updatePerspective(object, context); 1122 updatePerspective(object, context);
1104 updateSvgLocalToBorderBoxTransform(object, context); 1123 updateSvgLocalToBorderBoxTransform(object, context);
1105 updateScrollAndScrollTranslation(object, context); 1124 updateScrollAndScrollTranslation(object, context);
1106 updateOutOfFlowContext(object, context); 1125 updateOutOfFlowContext(object, context);
1107 1126
1108 context.forceSubtreeUpdate |= object.subtreeNeedsPaintPropertyUpdate(); 1127 context.forceSubtreeUpdate |= object.subtreeNeedsPaintPropertyUpdate();
1109 } 1128 }
1110 1129
1111 } // namespace blink 1130 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698