| 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 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 215 | 215 |
| 216 std::unique_ptr<PropertyTreeState> contentsState( | 216 std::unique_ptr<PropertyTreeState> contentsState( |
| 217 new PropertyTreeState(context.current.transform, context.current.clip, | 217 new PropertyTreeState(context.current.transform, context.current.clip, |
| 218 context.currentEffect, context.current.scroll)); | 218 context.currentEffect, context.current.scroll)); |
| 219 frameView.setTotalPropertyTreeStateForContents(std::move(contentsState)); | 219 frameView.setTotalPropertyTreeStateForContents(std::move(contentsState)); |
| 220 } | 220 } |
| 221 | 221 |
| 222 void PaintPropertyTreeBuilder::updatePaintOffsetTranslation( | 222 void PaintPropertyTreeBuilder::updatePaintOffsetTranslation( |
| 223 const LayoutObject& object, | 223 const LayoutObject& object, |
| 224 PaintPropertyTreeBuilderContext& context) { | 224 PaintPropertyTreeBuilderContext& context) { |
| 225 // LayoutView's paint offset is updated in the FrameView property update. |
| 226 if (object.isLayoutView()) { |
| 227 DCHECK(context.current.paintOffset == LayoutPoint()); |
| 228 return; |
| 229 } |
| 230 |
| 225 if (object.isBoxModelObject() && | 231 if (object.isBoxModelObject() && |
| 226 context.current.paintOffset != LayoutPoint()) { | 232 context.current.paintOffset != LayoutPoint()) { |
| 227 // TODO(trchen): Eliminate PaintLayer dependency. | 233 // TODO(trchen): Eliminate PaintLayer dependency. |
| 228 PaintLayer* layer = toLayoutBoxModelObject(object).layer(); | 234 PaintLayer* layer = toLayoutBoxModelObject(object).layer(); |
| 229 if (layer && layer->paintsWithTransform(GlobalPaintNormalPhase)) { | 235 if (layer && layer->paintsWithTransform(GlobalPaintNormalPhase)) { |
| 230 // We should use the same subpixel paint offset values for snapping | 236 // We should use the same subpixel paint offset values for snapping |
| 231 // regardless of whether a transform is present. If there is a transform | 237 // regardless of whether a transform is present. If there is a transform |
| 232 // we round the paint offset but keep around the residual fractional | 238 // we round the paint offset but keep around the residual fractional |
| 233 // component for the transformed content to paint with. In spv1 this was | 239 // component for the transformed content to paint with. In spv1 this was |
| 234 // called "subpixel accumulation". For more information, see | 240 // called "subpixel accumulation". For more information, see |
| (...skipping 12 matching lines...) Expand all Loading... |
| 247 TransformationMatrix().translate(roundedPaintOffset.x(), | 253 TransformationMatrix().translate(roundedPaintOffset.x(), |
| 248 roundedPaintOffset.y()), | 254 roundedPaintOffset.y()), |
| 249 FloatPoint3D(), | 255 FloatPoint3D(), |
| 250 context.current.shouldFlattenInheritedTransform, | 256 context.current.shouldFlattenInheritedTransform, |
| 251 context.current.renderingContextID); | 257 context.current.renderingContextID); |
| 252 context.current.paintOffset = fractionalPaintOffset; | 258 context.current.paintOffset = fractionalPaintOffset; |
| 253 return; | 259 return; |
| 254 } | 260 } |
| 255 } | 261 } |
| 256 | 262 |
| 257 if (object.isLayoutView()) | |
| 258 return; | |
| 259 | |
| 260 if (auto* properties = object.getMutableForPainting().paintProperties()) | 263 if (auto* properties = object.getMutableForPainting().paintProperties()) |
| 261 properties->clearPaintOffsetTranslation(); | 264 properties->clearPaintOffsetTranslation(); |
| 262 } | 265 } |
| 263 | 266 |
| 264 static FloatPoint3D transformOrigin(const LayoutBox& box) { | 267 static FloatPoint3D transformOrigin(const LayoutBox& box) { |
| 265 const ComputedStyle& style = box.styleRef(); | 268 const ComputedStyle& style = box.styleRef(); |
| 266 FloatSize borderBoxSize(box.size()); | 269 FloatSize borderBoxSize(box.size()); |
| 267 return FloatPoint3D( | 270 return FloatPoint3D( |
| 268 floatValueForLength(style.transformOriginX(), borderBoxSize.width()), | 271 floatValueForLength(style.transformOriginX(), borderBoxSize.width()), |
| 269 floatValueForLength(style.transformOriginY(), borderBoxSize.height()), | 272 floatValueForLength(style.transformOriginY(), borderBoxSize.height()), |
| (...skipping 520 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 790 return; | 793 return; |
| 791 | 794 |
| 792 updateOverflowClip(object, context); | 795 updateOverflowClip(object, context); |
| 793 updatePerspective(object, context); | 796 updatePerspective(object, context); |
| 794 updateSvgLocalToBorderBoxTransform(object, context); | 797 updateSvgLocalToBorderBoxTransform(object, context); |
| 795 updateScrollAndScrollTranslation(object, context); | 798 updateScrollAndScrollTranslation(object, context); |
| 796 updateOutOfFlowContext(object, context); | 799 updateOutOfFlowContext(object, context); |
| 797 } | 800 } |
| 798 | 801 |
| 799 } // namespace blink | 802 } // namespace blink |
| OLD | NEW |