Chromium Code Reviews| 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/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 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 95 existingScroll->update(std::move(parent), std::move(scrollOffset), clip, | 95 existingScroll->update(std::move(parent), std::move(scrollOffset), clip, |
| 96 bounds, userScrollableHorizontal, | 96 bounds, userScrollableHorizontal, |
| 97 userScrollableVertical); | 97 userScrollableVertical); |
| 98 } else { | 98 } else { |
| 99 frameView.setScroll(ScrollPaintPropertyNode::create( | 99 frameView.setScroll(ScrollPaintPropertyNode::create( |
| 100 std::move(parent), std::move(scrollOffset), clip, bounds, | 100 std::move(parent), std::move(scrollOffset), clip, bounds, |
| 101 userScrollableHorizontal, userScrollableVertical)); | 101 userScrollableHorizontal, userScrollableVertical)); |
| 102 } | 102 } |
| 103 } | 103 } |
| 104 | 104 |
| 105 void PaintPropertyTreeBuilder::updatePropertiesAndContext( | 105 void PaintPropertyTreeBuilder::updateFramePropertiesAndContext( |
| 106 FrameView& frameView, | 106 FrameView& frameView, |
| 107 PaintPropertyTreeBuilderContext& context) { | 107 PaintPropertyTreeBuilderContext& context) { |
| 108 if (RuntimeEnabledFeatures::rootLayerScrollingEnabled()) { | 108 if (RuntimeEnabledFeatures::rootLayerScrollingEnabled()) { |
| 109 LayoutView* layoutView = frameView.layoutView(); | 109 // With RootLayerScrolling, the LayoutView (a LayoutObject) properties are |
| 110 if (!layoutView) | 110 // updated like other objects (see updatePropertiesAndContextForSelf and |
| 111 return; | 111 // updatePropertiesAndContextForChildren) instead of having LayoutView- |
| 112 | 112 // specific property updates here. |
| 113 TransformationMatrix frameTranslate; | |
| 114 frameTranslate.translate(frameView.x() + layoutView->location().x() + | |
| 115 context.current.paintOffset.x(), | |
| 116 frameView.y() + layoutView->location().y() + | |
| 117 context.current.paintOffset.y()); | |
| 118 layoutView->getMutableForPainting() | |
| 119 .ensurePaintProperties() | |
| 120 .updatePaintOffsetTranslation(context.current.transform, frameTranslate, | |
| 121 FloatPoint3D()); | |
| 122 | |
| 123 const auto* properties = layoutView->paintProperties(); | |
| 124 DCHECK(properties && properties->paintOffsetTranslation()); | |
| 125 context.current.transform = properties->paintOffsetTranslation(); | |
| 126 context.current.paintOffset = LayoutPoint(); | |
| 127 context.current.renderingContextID = 0; | 113 context.current.renderingContextID = 0; |
|
trchen
2016/11/01 22:14:00
Alternative idea:
Can we add
context.current.paint
pdr.
2016/11/01 23:28:23
Done.
| |
| 128 context.current.shouldFlattenInheritedTransform = true; | 114 context.current.shouldFlattenInheritedTransform = true; |
| 129 context.absolutePosition = context.current; | 115 context.absolutePosition = context.current; |
| 130 context.containerForAbsolutePosition = | 116 context.containerForAbsolutePosition = nullptr; |
| 131 nullptr; // This will get set in updateOutOfFlowContext(). | |
| 132 context.fixedPosition = context.current; | 117 context.fixedPosition = context.current; |
| 133 return; | 118 return; |
| 134 } | 119 } |
| 135 | 120 |
| 136 TransformationMatrix frameTranslate; | 121 TransformationMatrix frameTranslate; |
| 137 frameTranslate.translate(frameView.x() + context.current.paintOffset.x(), | 122 frameTranslate.translate(frameView.x() + context.current.paintOffset.x(), |
| 138 frameView.y() + context.current.paintOffset.y()); | 123 frameView.y() + context.current.paintOffset.y()); |
| 139 updateFrameViewPreTranslation(frameView, context.current.transform, | 124 updateFrameViewPreTranslation(frameView, context.current.transform, |
| 140 frameTranslate, FloatPoint3D()); | 125 frameTranslate, FloatPoint3D()); |
| 141 | 126 |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 190 context.fixedPosition = context.current; | 175 context.fixedPosition = context.current; |
| 191 context.fixedPosition.transform = fixedTransformNode; | 176 context.fixedPosition.transform = fixedTransformNode; |
| 192 context.fixedPosition.scroll = fixedScrollNode; | 177 context.fixedPosition.scroll = fixedScrollNode; |
| 193 | 178 |
| 194 std::unique_ptr<PropertyTreeState> contentsState( | 179 std::unique_ptr<PropertyTreeState> contentsState( |
| 195 new PropertyTreeState(context.current.transform, context.current.clip, | 180 new PropertyTreeState(context.current.transform, context.current.clip, |
| 196 context.currentEffect, context.current.scroll)); | 181 context.currentEffect, context.current.scroll)); |
| 197 frameView.setTotalPropertyTreeStateForContents(std::move(contentsState)); | 182 frameView.setTotalPropertyTreeStateForContents(std::move(contentsState)); |
| 198 } | 183 } |
| 199 | 184 |
| 185 void PaintPropertyTreeBuilder::updateLayoutViewPaintOffsetTranslation( | |
| 186 const LayoutView& view, | |
| 187 PaintPropertyTreeBuilderContext& context) { | |
|
trchen
2016/11/01 22:14:00
DCHECK(RuntimeEnabledFeatures::rootLayerScrollingE
pdr.
2016/11/01 23:28:23
Done
| |
| 188 const auto* frameView = view.frameView(); | |
| 189 TransformationMatrix translate; | |
| 190 translate.translate( | |
| 191 frameView->x() + view.location().x() + context.current.paintOffset.x(), | |
| 192 frameView->y() + view.location().y() + context.current.paintOffset.y()); | |
|
trchen
2016/11/01 22:14:00
deriveBorderBoxFromContainerContext() should have
pdr.
2016/11/01 23:28:23
Done.
| |
| 193 view.getMutableForPainting() | |
| 194 .ensurePaintProperties() | |
| 195 .updatePaintOffsetTranslation(context.current.transform, translate, | |
| 196 FloatPoint3D()); | |
| 197 | |
| 198 const auto* properties = view.paintProperties(); | |
| 199 DCHECK(properties && properties->paintOffsetTranslation()); | |
| 200 context.current.transform = context.absolutePosition.transform = | |
| 201 context.fixedPosition.transform = properties->paintOffsetTranslation(); | |
| 202 context.current.paintOffset = context.absolutePosition.paintOffset = | |
| 203 context.fixedPosition.paintOffset = LayoutPoint(); | |
| 204 } | |
| 205 | |
| 200 void PaintPropertyTreeBuilder::updatePaintOffsetTranslation( | 206 void PaintPropertyTreeBuilder::updatePaintOffsetTranslation( |
| 201 const LayoutObject& object, | 207 const LayoutObject& object, |
| 202 PaintPropertyTreeBuilderContext& context) { | 208 PaintPropertyTreeBuilderContext& context) { |
| 203 // LayoutView's paint offset is updated in the FrameView property update. | 209 if (RuntimeEnabledFeatures::rootLayerScrollingEnabled() && |
| 204 if (object.isLayoutView()) { | 210 object.isLayoutView()) { |
| 205 DCHECK(context.current.paintOffset == LayoutPoint()); | 211 updateLayoutViewPaintOffsetTranslation(toLayoutView(object), context); |
| 206 return; | 212 return; |
| 207 } | 213 } |
| 208 | 214 |
| 209 bool usesPaintOffsetTranslation = false; | 215 bool usesPaintOffsetTranslation = false; |
|
trchen
2016/11/01 22:13:59
Alternative idea:
if (RuntimeEnabledFeatures::root
| |
| 210 if (object.isBoxModelObject() && | 216 if (object.isBoxModelObject() && |
| 211 context.current.paintOffset != LayoutPoint()) { | 217 context.current.paintOffset != LayoutPoint()) { |
| 212 // TODO(trchen): Eliminate PaintLayer dependency. | 218 // TODO(trchen): Eliminate PaintLayer dependency. |
| 213 PaintLayer* layer = toLayoutBoxModelObject(object).layer(); | 219 PaintLayer* layer = toLayoutBoxModelObject(object).layer(); |
| 214 if (layer && layer->paintsWithTransform(GlobalPaintNormalPhase)) | 220 if (layer && layer->paintsWithTransform(GlobalPaintNormalPhase)) |
| 215 usesPaintOffsetTranslation = true; | 221 usesPaintOffsetTranslation = true; |
| 216 } | 222 } |
| 217 | 223 |
| 218 // We should use the same subpixel paint offset values for snapping | 224 // We should use the same subpixel paint offset values for snapping |
| 219 // regardless of whether a transform is present. If there is a transform | 225 // regardless of whether a transform is present. If there is a transform |
| (...skipping 648 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 868 return; | 874 return; |
| 869 | 875 |
| 870 updateOverflowClip(object, context); | 876 updateOverflowClip(object, context); |
| 871 updatePerspective(object, context); | 877 updatePerspective(object, context); |
| 872 updateSvgLocalToBorderBoxTransform(object, context); | 878 updateSvgLocalToBorderBoxTransform(object, context); |
| 873 updateScrollAndScrollTranslation(object, context); | 879 updateScrollAndScrollTranslation(object, context); |
| 874 updateOutOfFlowContext(object, context); | 880 updateOutOfFlowContext(object, context); |
| 875 } | 881 } |
| 876 | 882 |
| 877 } // namespace blink | 883 } // namespace blink |
| OLD | NEW |