| 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 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 63 context.current.scroll = context.absolutePosition.scroll = | 63 context.current.scroll = context.absolutePosition.scroll = |
| 64 context.fixedPosition.scroll = rootScrollNode(); | 64 context.fixedPosition.scroll = rootScrollNode(); |
| 65 | 65 |
| 66 // Ensure scroll tree properties are reset. They will be rebuilt during the | 66 // Ensure scroll tree properties are reset. They will be rebuilt during the |
| 67 // tree walk. | 67 // tree walk. |
| 68 rootScrollNode()->clearMainThreadScrollingReasons(); | 68 rootScrollNode()->clearMainThreadScrollingReasons(); |
| 69 | 69 |
| 70 return context; | 70 return context; |
| 71 } | 71 } |
| 72 | 72 |
| 73 const TransformPaintPropertyNode* createOrUpdateFrameViewPreTranslation( | 73 const TransformPaintPropertyNode* updateFrameViewPreTranslation( |
| 74 FrameView& frameView, | 74 FrameView& frameView, |
| 75 PassRefPtr<const TransformPaintPropertyNode> parent, | 75 PassRefPtr<const TransformPaintPropertyNode> parent, |
| 76 const TransformationMatrix& matrix, | 76 const TransformationMatrix& matrix, |
| 77 const FloatPoint3D& origin) { | 77 const FloatPoint3D& origin) { |
| 78 DCHECK(!RuntimeEnabledFeatures::rootLayerScrollingEnabled()); | 78 DCHECK(!RuntimeEnabledFeatures::rootLayerScrollingEnabled()); |
| 79 if (TransformPaintPropertyNode* existingPreTranslation = | 79 if (TransformPaintPropertyNode* existingPreTranslation = |
| 80 frameView.preTranslation()) | 80 frameView.preTranslation()) |
| 81 existingPreTranslation->update(std::move(parent), matrix, origin); | 81 existingPreTranslation->update(std::move(parent), matrix, origin); |
| 82 else | 82 else |
| 83 frameView.setPreTranslation( | 83 frameView.setPreTranslation( |
| 84 TransformPaintPropertyNode::create(std::move(parent), matrix, origin)); | 84 TransformPaintPropertyNode::create(std::move(parent), matrix, origin)); |
| 85 return frameView.preTranslation(); | 85 return frameView.preTranslation(); |
| 86 } | 86 } |
| 87 | 87 |
| 88 const ClipPaintPropertyNode* createOrUpdateFrameViewContentClip( | 88 const ClipPaintPropertyNode* updateFrameViewContentClip( |
| 89 FrameView& frameView, | 89 FrameView& frameView, |
| 90 PassRefPtr<const ClipPaintPropertyNode> parent, | 90 PassRefPtr<const ClipPaintPropertyNode> parent, |
| 91 PassRefPtr<const TransformPaintPropertyNode> localTransformSpace, | 91 PassRefPtr<const TransformPaintPropertyNode> localTransformSpace, |
| 92 const FloatRoundedRect& clipRect) { | 92 const FloatRoundedRect& clipRect) { |
| 93 DCHECK(!RuntimeEnabledFeatures::rootLayerScrollingEnabled()); | 93 DCHECK(!RuntimeEnabledFeatures::rootLayerScrollingEnabled()); |
| 94 if (ClipPaintPropertyNode* existingContentClip = frameView.contentClip()) | 94 if (ClipPaintPropertyNode* existingContentClip = frameView.contentClip()) |
| 95 existingContentClip->update(std::move(parent), | 95 existingContentClip->update(std::move(parent), |
| 96 std::move(localTransformSpace), clipRect); | 96 std::move(localTransformSpace), clipRect); |
| 97 else | 97 else |
| 98 frameView.setContentClip(ClipPaintPropertyNode::create( | 98 frameView.setContentClip(ClipPaintPropertyNode::create( |
| 99 std::move(parent), std::move(localTransformSpace), clipRect)); | 99 std::move(parent), std::move(localTransformSpace), clipRect)); |
| 100 return frameView.contentClip(); | 100 return frameView.contentClip(); |
| 101 } | 101 } |
| 102 | 102 |
| 103 const TransformPaintPropertyNode* createOrUpdateFrameViewScrollTranslation( | 103 const TransformPaintPropertyNode* updateFrameViewScrollTranslation( |
| 104 FrameView& frameView, | 104 FrameView& frameView, |
| 105 PassRefPtr<const TransformPaintPropertyNode> parent, | 105 PassRefPtr<const TransformPaintPropertyNode> parent, |
| 106 const TransformationMatrix& matrix, | 106 const TransformationMatrix& matrix, |
| 107 const FloatPoint3D& origin) { | 107 const FloatPoint3D& origin) { |
| 108 DCHECK(!RuntimeEnabledFeatures::rootLayerScrollingEnabled()); | 108 DCHECK(!RuntimeEnabledFeatures::rootLayerScrollingEnabled()); |
| 109 if (TransformPaintPropertyNode* existingScrollTranslation = | 109 if (TransformPaintPropertyNode* existingScrollTranslation = |
| 110 frameView.scrollTranslation()) | 110 frameView.scrollTranslation()) |
| 111 existingScrollTranslation->update(std::move(parent), matrix, origin); | 111 existingScrollTranslation->update(std::move(parent), matrix, origin); |
| 112 else | 112 else |
| 113 frameView.setScrollTranslation( | 113 frameView.setScrollTranslation( |
| 114 TransformPaintPropertyNode::create(std::move(parent), matrix, origin)); | 114 TransformPaintPropertyNode::create(std::move(parent), matrix, origin)); |
| 115 return frameView.scrollTranslation(); | 115 return frameView.scrollTranslation(); |
| 116 } | 116 } |
| 117 | 117 |
| 118 ScrollPaintPropertyNode* createOrUpdateFrameViewScroll( | 118 ScrollPaintPropertyNode* updateFrameViewScroll( |
| 119 FrameView& frameView, | 119 FrameView& frameView, |
| 120 PassRefPtr<ScrollPaintPropertyNode> parent, | 120 PassRefPtr<ScrollPaintPropertyNode> parent, |
| 121 PassRefPtr<const TransformPaintPropertyNode> scrollOffset, | 121 PassRefPtr<const TransformPaintPropertyNode> scrollOffset, |
| 122 const IntSize& clip, | 122 const IntSize& clip, |
| 123 const IntSize& bounds, | 123 const IntSize& bounds, |
| 124 bool userScrollableHorizontal, | 124 bool userScrollableHorizontal, |
| 125 bool userScrollableVertical) { | 125 bool userScrollableVertical) { |
| 126 DCHECK(!RuntimeEnabledFeatures::rootLayerScrollingEnabled()); | 126 DCHECK(!RuntimeEnabledFeatures::rootLayerScrollingEnabled()); |
| 127 if (ScrollPaintPropertyNode* existingScroll = frameView.scroll()) | 127 if (ScrollPaintPropertyNode* existingScroll = frameView.scroll()) |
| 128 existingScroll->update(std::move(parent), std::move(scrollOffset), clip, | 128 existingScroll->update(std::move(parent), std::move(scrollOffset), clip, |
| (...skipping 14 matching lines...) Expand all Loading... |
| 143 if (!layoutView) | 143 if (!layoutView) |
| 144 return; | 144 return; |
| 145 | 145 |
| 146 TransformationMatrix frameTranslate; | 146 TransformationMatrix frameTranslate; |
| 147 frameTranslate.translate(frameView.x() + layoutView->location().x() + | 147 frameTranslate.translate(frameView.x() + layoutView->location().x() + |
| 148 context.current.paintOffset.x(), | 148 context.current.paintOffset.x(), |
| 149 frameView.y() + layoutView->location().y() + | 149 frameView.y() + layoutView->location().y() + |
| 150 context.current.paintOffset.y()); | 150 context.current.paintOffset.y()); |
| 151 context.current.transform = | 151 context.current.transform = |
| 152 layoutView->getMutableForPainting() | 152 layoutView->getMutableForPainting() |
| 153 .ensureObjectPaintProperties() | 153 .ensurePaintProperties() |
| 154 .createOrUpdatePaintOffsetTranslation( | 154 .updatePaintOffsetTranslation(context.current.transform, |
| 155 context.current.transform, frameTranslate, FloatPoint3D()); | 155 frameTranslate, FloatPoint3D()); |
| 156 context.current.paintOffset = LayoutPoint(); | 156 context.current.paintOffset = LayoutPoint(); |
| 157 context.current.renderingContextID = 0; | 157 context.current.renderingContextID = 0; |
| 158 context.current.shouldFlattenInheritedTransform = true; | 158 context.current.shouldFlattenInheritedTransform = true; |
| 159 context.absolutePosition = context.current; | 159 context.absolutePosition = context.current; |
| 160 context.containerForAbsolutePosition = | 160 context.containerForAbsolutePosition = |
| 161 nullptr; // This will get set in updateOutOfFlowContext(). | 161 nullptr; // This will get set in updateOutOfFlowContext(). |
| 162 context.fixedPosition = context.current; | 162 context.fixedPosition = context.current; |
| 163 return; | 163 return; |
| 164 } | 164 } |
| 165 | 165 |
| 166 TransformationMatrix frameTranslate; | 166 TransformationMatrix frameTranslate; |
| 167 frameTranslate.translate(frameView.x() + context.current.paintOffset.x(), | 167 frameTranslate.translate(frameView.x() + context.current.paintOffset.x(), |
| 168 frameView.y() + context.current.paintOffset.y()); | 168 frameView.y() + context.current.paintOffset.y()); |
| 169 context.current.transform = createOrUpdateFrameViewPreTranslation( | 169 context.current.transform = updateFrameViewPreTranslation( |
| 170 frameView, context.current.transform, frameTranslate, FloatPoint3D()); | 170 frameView, context.current.transform, frameTranslate, FloatPoint3D()); |
| 171 | 171 |
| 172 FloatRoundedRect contentClip( | 172 FloatRoundedRect contentClip( |
| 173 IntRect(IntPoint(), frameView.visibleContentSize())); | 173 IntRect(IntPoint(), frameView.visibleContentSize())); |
| 174 context.current.clip = createOrUpdateFrameViewContentClip( | 174 context.current.clip = updateFrameViewContentClip( |
| 175 frameView, context.current.clip, frameView.preTranslation(), contentClip); | 175 frameView, context.current.clip, frameView.preTranslation(), contentClip); |
| 176 | 176 |
| 177 // Record the fixed properties before any scrolling occurs. | 177 // Record the fixed properties before any scrolling occurs. |
| 178 const auto* fixedTransformNode = context.current.transform; | 178 const auto* fixedTransformNode = context.current.transform; |
| 179 auto* fixedScrollNode = context.current.scroll; | 179 auto* fixedScrollNode = context.current.scroll; |
| 180 | 180 |
| 181 ScrollOffset scrollOffset = frameView.scrollOffset(); | 181 ScrollOffset scrollOffset = frameView.scrollOffset(); |
| 182 if (frameView.isScrollable() || !scrollOffset.isZero()) { | 182 if (frameView.isScrollable() || !scrollOffset.isZero()) { |
| 183 TransformationMatrix frameScroll; | 183 TransformationMatrix frameScroll; |
| 184 frameScroll.translate(-scrollOffset.width(), -scrollOffset.height()); | 184 frameScroll.translate(-scrollOffset.width(), -scrollOffset.height()); |
| 185 context.current.transform = createOrUpdateFrameViewScrollTranslation( | 185 context.current.transform = updateFrameViewScrollTranslation( |
| 186 frameView, frameView.preTranslation(), frameScroll, FloatPoint3D()); | 186 frameView, frameView.preTranslation(), frameScroll, FloatPoint3D()); |
| 187 | 187 |
| 188 IntSize scrollClip = frameView.visibleContentSize(); | 188 IntSize scrollClip = frameView.visibleContentSize(); |
| 189 IntSize scrollBounds = frameView.contentsSize(); | 189 IntSize scrollBounds = frameView.contentsSize(); |
| 190 bool userScrollableHorizontal = | 190 bool userScrollableHorizontal = |
| 191 frameView.userInputScrollable(HorizontalScrollbar); | 191 frameView.userInputScrollable(HorizontalScrollbar); |
| 192 bool userScrollableVertical = | 192 bool userScrollableVertical = |
| 193 frameView.userInputScrollable(VerticalScrollbar); | 193 frameView.userInputScrollable(VerticalScrollbar); |
| 194 context.current.scroll = createOrUpdateFrameViewScroll( | 194 context.current.scroll = updateFrameViewScroll( |
| 195 frameView, context.current.scroll, frameView.scrollTranslation(), | 195 frameView, context.current.scroll, frameView.scrollTranslation(), |
| 196 scrollClip, scrollBounds, userScrollableHorizontal, | 196 scrollClip, scrollBounds, userScrollableHorizontal, |
| 197 userScrollableVertical); | 197 userScrollableVertical); |
| 198 } else { | 198 } else { |
| 199 // Ensure pre-existing properties are cleared when there is no scrolling. | 199 // Ensure pre-existing properties are cleared when there is no scrolling. |
| 200 frameView.setScrollTranslation(nullptr); | 200 frameView.setScrollTranslation(nullptr); |
| 201 frameView.setScroll(nullptr); | 201 frameView.setScroll(nullptr); |
| 202 } | 202 } |
| 203 | 203 |
| 204 // Initialize the context for current, absolute and fixed position cases. | 204 // Initialize the context for current, absolute and fixed position cases. |
| (...skipping 29 matching lines...) Expand all Loading... |
| 234 // called "subpixel accumulation". For more information, see | 234 // called "subpixel accumulation". For more information, see |
| 235 // PaintLayer::subpixelAccumulation() and | 235 // PaintLayer::subpixelAccumulation() and |
| 236 // PaintLayerPainter::paintFragmentByApplyingTransform. | 236 // PaintLayerPainter::paintFragmentByApplyingTransform. |
| 237 IntPoint roundedPaintOffset = | 237 IntPoint roundedPaintOffset = |
| 238 roundedIntPoint(context.current.paintOffset); | 238 roundedIntPoint(context.current.paintOffset); |
| 239 LayoutPoint fractionalPaintOffset = | 239 LayoutPoint fractionalPaintOffset = |
| 240 LayoutPoint(context.current.paintOffset - roundedPaintOffset); | 240 LayoutPoint(context.current.paintOffset - roundedPaintOffset); |
| 241 | 241 |
| 242 context.current.transform = | 242 context.current.transform = |
| 243 object.getMutableForPainting() | 243 object.getMutableForPainting() |
| 244 .ensureObjectPaintProperties() | 244 .ensurePaintProperties() |
| 245 .createOrUpdatePaintOffsetTranslation( | 245 .updatePaintOffsetTranslation( |
| 246 context.current.transform, | 246 context.current.transform, |
| 247 TransformationMatrix().translate(roundedPaintOffset.x(), | 247 TransformationMatrix().translate(roundedPaintOffset.x(), |
| 248 roundedPaintOffset.y()), | 248 roundedPaintOffset.y()), |
| 249 FloatPoint3D(), | 249 FloatPoint3D(), |
| 250 context.current.shouldFlattenInheritedTransform, | 250 context.current.shouldFlattenInheritedTransform, |
| 251 context.current.renderingContextID); | 251 context.current.renderingContextID); |
| 252 context.current.paintOffset = fractionalPaintOffset; | 252 context.current.paintOffset = fractionalPaintOffset; |
| 253 return; | 253 return; |
| 254 } | 254 } |
| 255 } | 255 } |
| 256 | 256 |
| 257 if (object.isLayoutView()) | 257 if (object.isLayoutView()) |
| 258 return; | 258 return; |
| 259 | 259 |
| 260 if (ObjectPaintProperties* properties = | 260 if (auto* properties = object.getMutableForPainting().paintProperties()) |
| 261 object.getMutableForPainting().objectPaintProperties()) | |
| 262 properties->clearPaintOffsetTranslation(); | 261 properties->clearPaintOffsetTranslation(); |
| 263 } | 262 } |
| 264 | 263 |
| 265 static FloatPoint3D transformOrigin(const LayoutBox& box) { | 264 static FloatPoint3D transformOrigin(const LayoutBox& box) { |
| 266 const ComputedStyle& style = box.styleRef(); | 265 const ComputedStyle& style = box.styleRef(); |
| 267 FloatSize borderBoxSize(box.size()); | 266 FloatSize borderBoxSize(box.size()); |
| 268 return FloatPoint3D( | 267 return FloatPoint3D( |
| 269 floatValueForLength(style.transformOriginX(), borderBoxSize.width()), | 268 floatValueForLength(style.transformOriginX(), borderBoxSize.width()), |
| 270 floatValueForLength(style.transformOriginY(), borderBoxSize.height()), | 269 floatValueForLength(style.transformOriginY(), borderBoxSize.height()), |
| 271 style.transformOriginZ()); | 270 style.transformOriginZ()); |
| (...skipping 13 matching lines...) Expand all Loading... |
| 285 // matrix. | 284 // matrix. |
| 286 // FIXME(pdr): Refactor this so all non-root SVG objects use the same | 285 // FIXME(pdr): Refactor this so all non-root SVG objects use the same |
| 287 // transform function. | 286 // transform function. |
| 288 const AffineTransform& transform = object.isSVGForeignObject() | 287 const AffineTransform& transform = object.isSVGForeignObject() |
| 289 ? object.localSVGTransform() | 288 ? object.localSVGTransform() |
| 290 : object.localToSVGParentTransform(); | 289 : object.localToSVGParentTransform(); |
| 291 if (!transform.isIdentity()) { | 290 if (!transform.isIdentity()) { |
| 292 // The origin is included in the local transform, so leave origin empty. | 291 // The origin is included in the local transform, so leave origin empty. |
| 293 context.current.transform = | 292 context.current.transform = |
| 294 object.getMutableForPainting() | 293 object.getMutableForPainting() |
| 295 .ensureObjectPaintProperties() | 294 .ensurePaintProperties() |
| 296 .createOrUpdateTransform(context.current.transform, | 295 .updateTransform(context.current.transform, |
| 297 TransformationMatrix(transform), | 296 TransformationMatrix(transform), FloatPoint3D()); |
| 298 FloatPoint3D()); | |
| 299 context.current.renderingContextID = 0; | 297 context.current.renderingContextID = 0; |
| 300 context.current.shouldFlattenInheritedTransform = false; | 298 context.current.shouldFlattenInheritedTransform = false; |
| 301 return; | 299 return; |
| 302 } | 300 } |
| 303 } else { | 301 } else { |
| 304 const ComputedStyle& style = object.styleRef(); | 302 const ComputedStyle& style = object.styleRef(); |
| 305 if (object.isBox() && (style.hasTransform() || style.preserves3D())) { | 303 if (object.isBox() && (style.hasTransform() || style.preserves3D())) { |
| 306 TransformationMatrix matrix; | 304 TransformationMatrix matrix; |
| 307 style.applyTransform( | 305 style.applyTransform( |
| 308 matrix, toLayoutBox(object).size(), | 306 matrix, toLayoutBox(object).size(), |
| (...skipping 14 matching lines...) Expand all Loading... |
| 323 // If a node with transform-style: preserve-3d does not exist in an | 321 // If a node with transform-style: preserve-3d does not exist in an |
| 324 // existing rendering context, it establishes a new one. | 322 // existing rendering context, it establishes a new one. |
| 325 if (!renderingContextID) | 323 if (!renderingContextID) |
| 326 renderingContextID = PtrHash<const LayoutObject>::hash(&object); | 324 renderingContextID = PtrHash<const LayoutObject>::hash(&object); |
| 327 renderingContextIDForChildren = renderingContextID; | 325 renderingContextIDForChildren = renderingContextID; |
| 328 childrenFlattenInheritedTransform = false; | 326 childrenFlattenInheritedTransform = false; |
| 329 } | 327 } |
| 330 | 328 |
| 331 context.current.transform = | 329 context.current.transform = |
| 332 object.getMutableForPainting() | 330 object.getMutableForPainting() |
| 333 .ensureObjectPaintProperties() | 331 .ensurePaintProperties() |
| 334 .createOrUpdateTransform(context.current.transform, matrix, | 332 .updateTransform(context.current.transform, matrix, origin, |
| 335 origin, flattensInheritedTransform, | 333 flattensInheritedTransform, renderingContextID); |
| 336 renderingContextID); | |
| 337 context.current.renderingContextID = renderingContextIDForChildren; | 334 context.current.renderingContextID = renderingContextIDForChildren; |
| 338 context.current.shouldFlattenInheritedTransform = | 335 context.current.shouldFlattenInheritedTransform = |
| 339 childrenFlattenInheritedTransform; | 336 childrenFlattenInheritedTransform; |
| 340 return; | 337 return; |
| 341 } | 338 } |
| 342 } | 339 } |
| 343 | 340 |
| 344 if (ObjectPaintProperties* properties = | 341 if (auto* properties = object.getMutableForPainting().paintProperties()) |
| 345 object.getMutableForPainting().objectPaintProperties()) | |
| 346 properties->clearTransform(); | 342 properties->clearTransform(); |
| 347 } | 343 } |
| 348 | 344 |
| 349 void PaintPropertyTreeBuilder::updateEffect( | 345 void PaintPropertyTreeBuilder::updateEffect( |
| 350 const LayoutObject& object, | 346 const LayoutObject& object, |
| 351 PaintPropertyTreeBuilderContext& context) { | 347 PaintPropertyTreeBuilderContext& context) { |
| 352 if (!object.styleRef().hasOpacity()) { | 348 if (!object.styleRef().hasOpacity()) { |
| 353 if (ObjectPaintProperties* properties = | 349 if (auto* properties = object.getMutableForPainting().paintProperties()) |
| 354 object.getMutableForPainting().objectPaintProperties()) | |
| 355 properties->clearEffect(); | 350 properties->clearEffect(); |
| 356 return; | 351 return; |
| 357 } | 352 } |
| 358 | 353 |
| 359 context.currentEffect = | 354 context.currentEffect = |
| 360 object.getMutableForPainting() | 355 object.getMutableForPainting().ensurePaintProperties().updateEffect( |
| 361 .ensureObjectPaintProperties() | 356 context.currentEffect, object.styleRef().opacity()); |
| 362 .createOrUpdateEffect(context.currentEffect, | |
| 363 object.styleRef().opacity()); | |
| 364 } | 357 } |
| 365 | 358 |
| 366 void PaintPropertyTreeBuilder::updateCssClip( | 359 void PaintPropertyTreeBuilder::updateCssClip( |
| 367 const LayoutObject& object, | 360 const LayoutObject& object, |
| 368 PaintPropertyTreeBuilderContext& context) { | 361 PaintPropertyTreeBuilderContext& context) { |
| 369 if (object.hasClip()) { | 362 if (object.hasClip()) { |
| 370 // Create clip node for descendants that are not fixed position. | 363 // Create clip node for descendants that are not fixed position. |
| 371 // We don't have to setup context.absolutePosition.clip here because this | 364 // We don't have to setup context.absolutePosition.clip here because this |
| 372 // object must be a container for absolute position descendants, and will | 365 // object must be a container for absolute position descendants, and will |
| 373 // copy from in-flow context later at updateOutOfFlowContext() step. | 366 // copy from in-flow context later at updateOutOfFlowContext() step. |
| 374 DCHECK(object.canContainAbsolutePositionObjects()); | 367 DCHECK(object.canContainAbsolutePositionObjects()); |
| 375 LayoutRect clipRect = | 368 LayoutRect clipRect = |
| 376 toLayoutBox(object).clipRect(context.current.paintOffset); | 369 toLayoutBox(object).clipRect(context.current.paintOffset); |
| 377 context.current.clip = | 370 context.current.clip = |
| 378 object.getMutableForPainting() | 371 object.getMutableForPainting().ensurePaintProperties().updateCssClip( |
| 379 .ensureObjectPaintProperties() | 372 context.current.clip, context.current.transform, |
| 380 .createOrUpdateCssClip(context.current.clip, | 373 FloatRoundedRect(FloatRect(clipRect))); |
| 381 context.current.transform, | |
| 382 FloatRoundedRect(FloatRect(clipRect))); | |
| 383 return; | 374 return; |
| 384 } | 375 } |
| 385 | 376 |
| 386 if (ObjectPaintProperties* properties = | 377 if (auto* properties = object.getMutableForPainting().paintProperties()) |
| 387 object.getMutableForPainting().objectPaintProperties()) | |
| 388 properties->clearCssClip(); | 378 properties->clearCssClip(); |
| 389 } | 379 } |
| 390 | 380 |
| 391 void PaintPropertyTreeBuilder::updateLocalBorderBoxContext( | 381 void PaintPropertyTreeBuilder::updateLocalBorderBoxContext( |
| 392 const LayoutObject& object, | 382 const LayoutObject& object, |
| 393 PaintPropertyTreeBuilderContext& context) { | 383 PaintPropertyTreeBuilderContext& context) { |
| 394 // Avoid adding an ObjectPaintProperties for non-boxes to save memory, since | 384 // Avoid adding an ObjectPaintProperties for non-boxes to save memory, since |
| 395 // we don't need them at the moment. | 385 // we don't need them at the moment. |
| 396 if (!object.isBox() && !object.hasLayer()) | 386 if (!object.isBox() && !object.hasLayer()) |
| 397 return; | 387 return; |
| 398 | 388 |
| 399 std::unique_ptr<ObjectPaintProperties::PropertyTreeStateWithOffset> | 389 std::unique_ptr<ObjectPaintProperties::PropertyTreeStateWithOffset> |
| 400 borderBoxContext = | 390 borderBoxContext = |
| 401 wrapUnique(new ObjectPaintProperties::PropertyTreeStateWithOffset( | 391 wrapUnique(new ObjectPaintProperties::PropertyTreeStateWithOffset( |
| 402 context.current.paintOffset, | 392 context.current.paintOffset, |
| 403 PropertyTreeState(context.current.transform, context.current.clip, | 393 PropertyTreeState(context.current.transform, context.current.clip, |
| 404 context.currentEffect, | 394 context.currentEffect, |
| 405 context.current.scroll))); | 395 context.current.scroll))); |
| 406 object.getMutableForPainting() | 396 object.getMutableForPainting() |
| 407 .ensureObjectPaintProperties() | 397 .ensurePaintProperties() |
| 408 .setLocalBorderBoxProperties(std::move(borderBoxContext)); | 398 .setLocalBorderBoxProperties(std::move(borderBoxContext)); |
| 409 } | 399 } |
| 410 | 400 |
| 411 // TODO(trchen): Remove this once we bake the paint offset into frameRect. | 401 // TODO(trchen): Remove this once we bake the paint offset into frameRect. |
| 412 void PaintPropertyTreeBuilder::updateScrollbarPaintOffset( | 402 void PaintPropertyTreeBuilder::updateScrollbarPaintOffset( |
| 413 const LayoutObject& object, | 403 const LayoutObject& object, |
| 414 const PaintPropertyTreeBuilderContext& context) { | 404 const PaintPropertyTreeBuilderContext& context) { |
| 415 IntPoint roundedPaintOffset = roundedIntPoint(context.current.paintOffset); | 405 IntPoint roundedPaintOffset = roundedIntPoint(context.current.paintOffset); |
| 416 if (roundedPaintOffset != IntPoint() && object.isBoxModelObject()) { | 406 if (roundedPaintOffset != IntPoint() && object.isBoxModelObject()) { |
| 417 if (PaintLayerScrollableArea* scrollableArea = | 407 if (PaintLayerScrollableArea* scrollableArea = |
| 418 toLayoutBoxModelObject(object).getScrollableArea()) { | 408 toLayoutBoxModelObject(object).getScrollableArea()) { |
| 419 if (scrollableArea->horizontalScrollbar() || | 409 if (scrollableArea->horizontalScrollbar() || |
| 420 scrollableArea->verticalScrollbar()) { | 410 scrollableArea->verticalScrollbar()) { |
| 421 auto paintOffset = TransformationMatrix().translate( | 411 auto paintOffset = TransformationMatrix().translate( |
| 422 roundedPaintOffset.x(), roundedPaintOffset.y()); | 412 roundedPaintOffset.x(), roundedPaintOffset.y()); |
| 423 object.getMutableForPainting() | 413 object.getMutableForPainting() |
| 424 .ensureObjectPaintProperties() | 414 .ensurePaintProperties() |
| 425 .createOrUpdateScrollbarPaintOffset(context.current.transform, | 415 .updateScrollbarPaintOffset(context.current.transform, paintOffset, |
| 426 paintOffset, FloatPoint3D()); | 416 FloatPoint3D()); |
| 427 return; | 417 return; |
| 428 } | 418 } |
| 429 } | 419 } |
| 430 } | 420 } |
| 431 | 421 |
| 432 if (ObjectPaintProperties* properties = | 422 if (auto* properties = object.getMutableForPainting().paintProperties()) |
| 433 object.getMutableForPainting().objectPaintProperties()) | |
| 434 properties->clearScrollbarPaintOffset(); | 423 properties->clearScrollbarPaintOffset(); |
| 435 } | 424 } |
| 436 | 425 |
| 437 void PaintPropertyTreeBuilder::updateMainThreadScrollingReasons( | 426 void PaintPropertyTreeBuilder::updateMainThreadScrollingReasons( |
| 438 const LayoutObject& object, | 427 const LayoutObject& object, |
| 439 PaintPropertyTreeBuilderContext& context) { | 428 PaintPropertyTreeBuilderContext& context) { |
| 440 if (context.current.scroll && | 429 if (context.current.scroll && |
| 441 !object.document().settings()->threadedScrollingEnabled()) | 430 !object.document().settings()->threadedScrollingEnabled()) |
| 442 context.current.scroll->addMainThreadScrollingReasons( | 431 context.current.scroll->addMainThreadScrollingReasons( |
| 443 MainThreadScrollingReason::kThreadedScrollingDisabled); | 432 MainThreadScrollingReason::kThreadedScrollingDisabled); |
| (...skipping 24 matching lines...) Expand all Loading... |
| 468 // This is called control clip and we technically treat them like overflow | 457 // This is called control clip and we technically treat them like overflow |
| 469 // clip. | 458 // clip. |
| 470 LayoutRect clipRect; | 459 LayoutRect clipRect; |
| 471 if (box.hasControlClip()) { | 460 if (box.hasControlClip()) { |
| 472 clipRect = box.controlClipRect(context.current.paintOffset); | 461 clipRect = box.controlClipRect(context.current.paintOffset); |
| 473 } else if (box.hasOverflowClip() || box.styleRef().containsPaint() || | 462 } else if (box.hasOverflowClip() || box.styleRef().containsPaint() || |
| 474 (box.isSVGRoot() && | 463 (box.isSVGRoot() && |
| 475 toLayoutSVGRoot(box).shouldApplyViewportClip())) { | 464 toLayoutSVGRoot(box).shouldApplyViewportClip())) { |
| 476 clipRect = box.overflowClipRect(context.current.paintOffset); | 465 clipRect = box.overflowClipRect(context.current.paintOffset); |
| 477 } else { | 466 } else { |
| 478 if (ObjectPaintProperties* properties = | 467 if (auto* properties = object.getMutableForPainting().paintProperties()) { |
| 479 object.getMutableForPainting().objectPaintProperties()) { | |
| 480 properties->clearInnerBorderRadiusClip(); | 468 properties->clearInnerBorderRadiusClip(); |
| 481 properties->clearOverflowClip(); | 469 properties->clearOverflowClip(); |
| 482 } | 470 } |
| 483 return; | 471 return; |
| 484 } | 472 } |
| 485 | 473 |
| 486 if (box.styleRef().hasBorderRadius()) { | 474 if (box.styleRef().hasBorderRadius()) { |
| 487 auto innerBorder = box.styleRef().getRoundedInnerBorderFor( | 475 auto innerBorder = box.styleRef().getRoundedInnerBorderFor( |
| 488 LayoutRect(context.current.paintOffset, box.size())); | 476 LayoutRect(context.current.paintOffset, box.size())); |
| 489 context.current.clip = | 477 context.current.clip = |
| 490 object.getMutableForPainting() | 478 object.getMutableForPainting() |
| 491 .ensureObjectPaintProperties() | 479 .ensurePaintProperties() |
| 492 .createOrUpdateInnerBorderRadiusClip( | 480 .updateInnerBorderRadiusClip( |
| 493 context.current.clip, context.current.transform, innerBorder); | 481 context.current.clip, context.current.transform, innerBorder); |
| 494 } else if (ObjectPaintProperties* properties = | 482 } else if (auto* properties = |
| 495 object.getMutableForPainting().objectPaintProperties()) { | 483 object.getMutableForPainting().paintProperties()) { |
| 496 properties->clearInnerBorderRadiusClip(); | 484 properties->clearInnerBorderRadiusClip(); |
| 497 } | 485 } |
| 498 | 486 |
| 499 context.current.clip = | 487 context.current.clip = |
| 500 object.getMutableForPainting() | 488 object.getMutableForPainting().ensurePaintProperties().updateOverflowClip( |
| 501 .ensureObjectPaintProperties() | 489 context.current.clip, context.current.transform, |
| 502 .createOrUpdateOverflowClip(context.current.clip, | 490 FloatRoundedRect(FloatRect(clipRect))); |
| 503 context.current.transform, | |
| 504 FloatRoundedRect(FloatRect(clipRect))); | |
| 505 } | 491 } |
| 506 | 492 |
| 507 static FloatPoint perspectiveOrigin(const LayoutBox& box) { | 493 static FloatPoint perspectiveOrigin(const LayoutBox& box) { |
| 508 const ComputedStyle& style = box.styleRef(); | 494 const ComputedStyle& style = box.styleRef(); |
| 509 FloatSize borderBoxSize(box.size()); | 495 FloatSize borderBoxSize(box.size()); |
| 510 return FloatPoint( | 496 return FloatPoint( |
| 511 floatValueForLength(style.perspectiveOriginX(), borderBoxSize.width()), | 497 floatValueForLength(style.perspectiveOriginX(), borderBoxSize.width()), |
| 512 floatValueForLength(style.perspectiveOriginY(), borderBoxSize.height())); | 498 floatValueForLength(style.perspectiveOriginY(), borderBoxSize.height())); |
| 513 } | 499 } |
| 514 | 500 |
| 515 void PaintPropertyTreeBuilder::updatePerspective( | 501 void PaintPropertyTreeBuilder::updatePerspective( |
| 516 const LayoutObject& object, | 502 const LayoutObject& object, |
| 517 PaintPropertyTreeBuilderContext& context) { | 503 PaintPropertyTreeBuilderContext& context) { |
| 518 const ComputedStyle& style = object.styleRef(); | 504 const ComputedStyle& style = object.styleRef(); |
| 519 if (!object.isBox() || !style.hasPerspective()) { | 505 if (!object.isBox() || !style.hasPerspective()) { |
| 520 if (ObjectPaintProperties* properties = | 506 if (auto* properties = object.getMutableForPainting().paintProperties()) |
| 521 object.getMutableForPainting().objectPaintProperties()) | |
| 522 properties->clearPerspective(); | 507 properties->clearPerspective(); |
| 523 return; | 508 return; |
| 524 } | 509 } |
| 525 | 510 |
| 526 // The perspective node must not flatten (else nothing will get | 511 // The perspective node must not flatten (else nothing will get |
| 527 // perspective), but it should still extend the rendering context as most | 512 // perspective), but it should still extend the rendering context as most |
| 528 // transform nodes do. | 513 // transform nodes do. |
| 529 TransformationMatrix matrix = | 514 TransformationMatrix matrix = |
| 530 TransformationMatrix().applyPerspective(style.perspective()); | 515 TransformationMatrix().applyPerspective(style.perspective()); |
| 531 FloatPoint3D origin = perspectiveOrigin(toLayoutBox(object)) + | 516 FloatPoint3D origin = perspectiveOrigin(toLayoutBox(object)) + |
| 532 toLayoutSize(context.current.paintOffset); | 517 toLayoutSize(context.current.paintOffset); |
| 533 context.current.transform = | 518 context.current.transform = |
| 534 object.getMutableForPainting() | 519 object.getMutableForPainting().ensurePaintProperties().updatePerspective( |
| 535 .ensureObjectPaintProperties() | 520 context.current.transform, matrix, origin, |
| 536 .createOrUpdatePerspective( | 521 context.current.shouldFlattenInheritedTransform, |
| 537 context.current.transform, matrix, origin, | 522 context.current.renderingContextID); |
| 538 context.current.shouldFlattenInheritedTransform, | |
| 539 context.current.renderingContextID); | |
| 540 context.current.shouldFlattenInheritedTransform = false; | 523 context.current.shouldFlattenInheritedTransform = false; |
| 541 } | 524 } |
| 542 | 525 |
| 543 void PaintPropertyTreeBuilder::updateSvgLocalToBorderBoxTransform( | 526 void PaintPropertyTreeBuilder::updateSvgLocalToBorderBoxTransform( |
| 544 const LayoutObject& object, | 527 const LayoutObject& object, |
| 545 PaintPropertyTreeBuilderContext& context) { | 528 PaintPropertyTreeBuilderContext& context) { |
| 546 if (!object.isSVGRoot()) | 529 if (!object.isSVGRoot()) |
| 547 return; | 530 return; |
| 548 | 531 |
| 549 AffineTransform transformToBorderBox = | 532 AffineTransform transformToBorderBox = |
| 550 SVGRootPainter(toLayoutSVGRoot(object)) | 533 SVGRootPainter(toLayoutSVGRoot(object)) |
| 551 .transformToPixelSnappedBorderBox(context.current.paintOffset); | 534 .transformToPixelSnappedBorderBox(context.current.paintOffset); |
| 552 | 535 |
| 553 // The paint offset is included in |transformToBorderBox| so SVG does not need | 536 // The paint offset is included in |transformToBorderBox| so SVG does not need |
| 554 // to handle paint offset internally. | 537 // to handle paint offset internally. |
| 555 context.current.paintOffset = LayoutPoint(); | 538 context.current.paintOffset = LayoutPoint(); |
| 556 | 539 |
| 557 if (transformToBorderBox.isIdentity()) { | 540 if (transformToBorderBox.isIdentity()) { |
| 558 if (ObjectPaintProperties* properties = | 541 if (auto* properties = object.getMutableForPainting().paintProperties()) |
| 559 object.getMutableForPainting().objectPaintProperties()) | |
| 560 properties->clearSvgLocalToBorderBoxTransform(); | 542 properties->clearSvgLocalToBorderBoxTransform(); |
| 561 return; | 543 return; |
| 562 } | 544 } |
| 563 | 545 |
| 564 context.current.transform = | 546 context.current.transform = |
| 565 object.getMutableForPainting() | 547 object.getMutableForPainting() |
| 566 .ensureObjectPaintProperties() | 548 .ensurePaintProperties() |
| 567 .createOrUpdateSvgLocalToBorderBoxTransform( | 549 .updateSvgLocalToBorderBoxTransform( |
| 568 context.current.transform, transformToBorderBox, FloatPoint3D()); | 550 context.current.transform, transformToBorderBox, FloatPoint3D()); |
| 569 context.current.shouldFlattenInheritedTransform = false; | 551 context.current.shouldFlattenInheritedTransform = false; |
| 570 context.current.renderingContextID = 0; | 552 context.current.renderingContextID = 0; |
| 571 } | 553 } |
| 572 | 554 |
| 573 void PaintPropertyTreeBuilder::updateScrollAndScrollTranslation( | 555 void PaintPropertyTreeBuilder::updateScrollAndScrollTranslation( |
| 574 const LayoutObject& object, | 556 const LayoutObject& object, |
| 575 PaintPropertyTreeBuilderContext& context) { | 557 PaintPropertyTreeBuilderContext& context) { |
| 576 if (object.hasOverflowClip()) { | 558 if (object.hasOverflowClip()) { |
| 577 const LayoutBox& box = toLayoutBox(object); | 559 const LayoutBox& box = toLayoutBox(object); |
| 578 const PaintLayerScrollableArea* scrollableArea = box.getScrollableArea(); | 560 const PaintLayerScrollableArea* scrollableArea = box.getScrollableArea(); |
| 579 IntSize scrollOffset = box.scrolledContentOffset(); | 561 IntSize scrollOffset = box.scrolledContentOffset(); |
| 580 if (!scrollOffset.isZero() || scrollableArea->scrollsOverflow()) { | 562 if (!scrollOffset.isZero() || scrollableArea->scrollsOverflow()) { |
| 581 TransformationMatrix matrix = TransformationMatrix().translate( | 563 TransformationMatrix matrix = TransformationMatrix().translate( |
| 582 -scrollOffset.width(), -scrollOffset.height()); | 564 -scrollOffset.width(), -scrollOffset.height()); |
| 583 context.current.transform = | 565 context.current.transform = |
| 584 object.getMutableForPainting() | 566 object.getMutableForPainting() |
| 585 .ensureObjectPaintProperties() | 567 .ensurePaintProperties() |
| 586 .createOrUpdateScrollTranslation( | 568 .updateScrollTranslation( |
| 587 context.current.transform, matrix, FloatPoint3D(), | 569 context.current.transform, matrix, FloatPoint3D(), |
| 588 context.current.shouldFlattenInheritedTransform, | 570 context.current.shouldFlattenInheritedTransform, |
| 589 context.current.renderingContextID); | 571 context.current.renderingContextID); |
| 590 | 572 |
| 591 IntSize scrollClip = scrollableArea->visibleContentRect().size(); | 573 IntSize scrollClip = scrollableArea->visibleContentRect().size(); |
| 592 IntSize scrollBounds = scrollableArea->contentsSize(); | 574 IntSize scrollBounds = scrollableArea->contentsSize(); |
| 593 bool userScrollableHorizontal = | 575 bool userScrollableHorizontal = |
| 594 scrollableArea->userInputScrollable(HorizontalScrollbar); | 576 scrollableArea->userInputScrollable(HorizontalScrollbar); |
| 595 bool userScrollableVertical = | 577 bool userScrollableVertical = |
| 596 scrollableArea->userInputScrollable(VerticalScrollbar); | 578 scrollableArea->userInputScrollable(VerticalScrollbar); |
| 597 context.current.scroll = | 579 context.current.scroll = |
| 598 object.getMutableForPainting() | 580 object.getMutableForPainting().ensurePaintProperties().updateScroll( |
| 599 .ensureObjectPaintProperties() | 581 context.current.scroll, context.current.transform, scrollClip, |
| 600 .createOrUpdateScroll(context.current.scroll, | 582 scrollBounds, userScrollableHorizontal, userScrollableVertical); |
| 601 context.current.transform, scrollClip, | |
| 602 scrollBounds, userScrollableHorizontal, | |
| 603 userScrollableVertical); | |
| 604 | 583 |
| 605 context.current.shouldFlattenInheritedTransform = false; | 584 context.current.shouldFlattenInheritedTransform = false; |
| 606 return; | 585 return; |
| 607 } | 586 } |
| 608 } | 587 } |
| 609 | 588 |
| 610 if (ObjectPaintProperties* properties = | 589 if (auto* properties = object.getMutableForPainting().paintProperties()) { |
| 611 object.getMutableForPainting().objectPaintProperties()) { | |
| 612 properties->clearScrollTranslation(); | 590 properties->clearScrollTranslation(); |
| 613 properties->clearScroll(); | 591 properties->clearScroll(); |
| 614 } | 592 } |
| 615 } | 593 } |
| 616 | 594 |
| 617 void PaintPropertyTreeBuilder::updateOutOfFlowContext( | 595 void PaintPropertyTreeBuilder::updateOutOfFlowContext( |
| 618 const LayoutObject& object, | 596 const LayoutObject& object, |
| 619 PaintPropertyTreeBuilderContext& context) { | 597 PaintPropertyTreeBuilderContext& context) { |
| 620 if (object.canContainAbsolutePositionObjects()) { | 598 if (object.canContainAbsolutePositionObjects()) { |
| 621 context.absolutePosition = context.current; | 599 context.absolutePosition = context.current; |
| 622 context.containerForAbsolutePosition = &object; | 600 context.containerForAbsolutePosition = &object; |
| 623 } | 601 } |
| 624 | 602 |
| 625 if (object.isLayoutView()) { | 603 if (object.isLayoutView()) { |
| 626 if (RuntimeEnabledFeatures::rootLayerScrollingEnabled()) { | 604 if (RuntimeEnabledFeatures::rootLayerScrollingEnabled()) { |
| 627 const auto* initialFixedTransform = context.fixedPosition.transform; | 605 const auto* initialFixedTransform = context.fixedPosition.transform; |
| 628 auto* initialFixedScroll = context.fixedPosition.scroll; | 606 auto* initialFixedScroll = context.fixedPosition.scroll; |
| 629 | 607 |
| 630 context.fixedPosition = context.current; | 608 context.fixedPosition = context.current; |
| 631 | 609 |
| 632 // Fixed position transform and scroll nodes should not be affected. | 610 // Fixed position transform and scroll nodes should not be affected. |
| 633 context.fixedPosition.transform = initialFixedTransform; | 611 context.fixedPosition.transform = initialFixedTransform; |
| 634 context.fixedPosition.scroll = initialFixedScroll; | 612 context.fixedPosition.scroll = initialFixedScroll; |
| 635 } | 613 } |
| 636 } else if (object.canContainFixedPositionObjects()) { | 614 } else if (object.canContainFixedPositionObjects()) { |
| 637 context.fixedPosition = context.current; | 615 context.fixedPosition = context.current; |
| 638 } else if (object.getMutableForPainting().objectPaintProperties() && | 616 } else if (object.getMutableForPainting().paintProperties() && |
| 639 object.objectPaintProperties()->cssClip()) { | 617 object.paintProperties()->cssClip()) { |
| 640 // CSS clip applies to all descendants, even if this object is not a | 618 // CSS clip applies to all descendants, even if this object is not a |
| 641 // containing block ancestor of the descendant. It is okay for | 619 // containing block ancestor of the descendant. It is okay for |
| 642 // absolute-position descendants because having CSS clip implies being | 620 // absolute-position descendants because having CSS clip implies being |
| 643 // absolute position container. However for fixed-position descendants we | 621 // absolute position container. However for fixed-position descendants we |
| 644 // need to insert the clip here if we are not a containing block ancestor of | 622 // need to insert the clip here if we are not a containing block ancestor of |
| 645 // them. | 623 // them. |
| 646 auto* cssClip = | 624 auto* cssClip = object.getMutableForPainting().paintProperties()->cssClip(); |
| 647 object.getMutableForPainting().objectPaintProperties()->cssClip(); | |
| 648 | 625 |
| 649 // Before we actually create anything, check whether in-flow context and | 626 // Before we actually create anything, check whether in-flow context and |
| 650 // fixed-position context has exactly the same clip. Reuse if possible. | 627 // fixed-position context has exactly the same clip. Reuse if possible. |
| 651 if (context.fixedPosition.clip == cssClip->parent()) { | 628 if (context.fixedPosition.clip == cssClip->parent()) { |
| 652 context.fixedPosition.clip = cssClip; | 629 context.fixedPosition.clip = cssClip; |
| 653 } else { | 630 } else { |
| 654 context.fixedPosition.clip = | 631 context.fixedPosition.clip = |
| 655 object.getMutableForPainting() | 632 object.getMutableForPainting() |
| 656 .ensureObjectPaintProperties() | 633 .ensurePaintProperties() |
| 657 .createOrUpdateCssClipFixedPosition( | 634 .updateCssClipFixedPosition( |
| 658 context.fixedPosition.clip, | 635 context.fixedPosition.clip, |
| 659 const_cast<TransformPaintPropertyNode*>( | 636 const_cast<TransformPaintPropertyNode*>( |
| 660 cssClip->localTransformSpace()), | 637 cssClip->localTransformSpace()), |
| 661 cssClip->clipRect()); | 638 cssClip->clipRect()); |
| 662 return; | 639 return; |
| 663 } | 640 } |
| 664 } | 641 } |
| 665 | 642 |
| 666 if (ObjectPaintProperties* properties = | 643 if (auto* properties = object.getMutableForPainting().paintProperties()) |
| 667 object.getMutableForPainting().objectPaintProperties()) | |
| 668 properties->clearCssClipFixedPosition(); | 644 properties->clearCssClipFixedPosition(); |
| 669 } | 645 } |
| 670 | 646 |
| 671 // Override ContainingBlockContext based on the properties of a containing block | 647 // Override ContainingBlockContext based on the properties of a containing block |
| 672 // that was previously walked in a subtree other than the current subtree being | 648 // that was previously walked in a subtree other than the current subtree being |
| 673 // walked. Used for out-of-flow positioned descendants of multi-column spanner | 649 // walked. Used for out-of-flow positioned descendants of multi-column spanner |
| 674 // when the containing block is not in the normal tree walk order. | 650 // when the containing block is not in the normal tree walk order. |
| 675 // For example: | 651 // For example: |
| 676 // <div id="columns" style="columns: 2"> | 652 // <div id="columns" style="columns: 2"> |
| 677 // <div id="relative" style="position: relative"> | 653 // <div id="relative" style="position: relative"> |
| 678 // <div id="spanner" style="column-span: all"> | 654 // <div id="spanner" style="column-span: all"> |
| 679 // <div id="absolute" style="position: absolute"></div> | 655 // <div id="absolute" style="position: absolute"></div> |
| 680 // </div> | 656 // </div> |
| 681 // </div> | 657 // </div> |
| 682 // <div> | 658 // <div> |
| 683 // The real containing block of "absolute" is "relative" which is not in the | 659 // The real containing block of "absolute" is "relative" which is not in the |
| 684 // tree-walk order of "columns" -> spanner placeholder -> spanner -> absolute. | 660 // tree-walk order of "columns" -> spanner placeholder -> spanner -> absolute. |
| 685 // Here we rebuild a ContainingBlockContext based on the properties of | 661 // Here we rebuild a ContainingBlockContext based on the properties of |
| 686 // "relative" for "absolute". | 662 // "relative" for "absolute". |
| 687 static void overrideContaineringBlockContextFromRealContainingBlock( | 663 static void overrideContaineringBlockContextFromRealContainingBlock( |
| 688 const LayoutBlock& containingBlock, | 664 const LayoutBlock& containingBlock, |
| 689 PaintPropertyTreeBuilderContext::ContainingBlockContext& context) { | 665 PaintPropertyTreeBuilderContext::ContainingBlockContext& context) { |
| 690 const auto* properties = | 666 const auto* properties = |
| 691 containingBlock.objectPaintProperties()->localBorderBoxProperties(); | 667 containingBlock.paintProperties()->localBorderBoxProperties(); |
| 692 DCHECK(properties); | 668 DCHECK(properties); |
| 693 | 669 |
| 694 context.transform = properties->propertyTreeState.transform(); | 670 context.transform = properties->propertyTreeState.transform(); |
| 695 context.paintOffset = properties->paintOffset; | 671 context.paintOffset = properties->paintOffset; |
| 696 context.shouldFlattenInheritedTransform = | 672 context.shouldFlattenInheritedTransform = |
| 697 context.transform && context.transform->flattensInheritedTransform(); | 673 context.transform && context.transform->flattensInheritedTransform(); |
| 698 context.renderingContextID = | 674 context.renderingContextID = |
| 699 context.transform ? context.transform->renderingContextID() : 0; | 675 context.transform ? context.transform->renderingContextID() : 0; |
| 700 context.clip = properties->propertyTreeState.clip(); | 676 context.clip = properties->propertyTreeState.clip(); |
| 701 context.scroll = const_cast<ScrollPaintPropertyNode*>( | 677 context.scroll = const_cast<ScrollPaintPropertyNode*>( |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 814 return; | 790 return; |
| 815 | 791 |
| 816 updateOverflowClip(object, context); | 792 updateOverflowClip(object, context); |
| 817 updatePerspective(object, context); | 793 updatePerspective(object, context); |
| 818 updateSvgLocalToBorderBoxTransform(object, context); | 794 updateSvgLocalToBorderBoxTransform(object, context); |
| 819 updateScrollAndScrollTranslation(object, context); | 795 updateScrollAndScrollTranslation(object, context); |
| 820 updateOutOfFlowContext(object, context); | 796 updateOutOfFlowContext(object, context); |
| 821 } | 797 } |
| 822 | 798 |
| 823 } // namespace blink | 799 } // namespace blink |
| OLD | NEW |