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" |
11 #include "core/layout/LayoutView.h" | 11 #include "core/layout/LayoutView.h" |
12 #include "core/layout/compositing/CompositingReasonFinder.h" | 12 #include "core/layout/compositing/CompositingReasonFinder.h" |
13 #include "core/layout/svg/LayoutSVGRoot.h" | 13 #include "core/layout/svg/LayoutSVGRoot.h" |
| 14 #include "core/layout/svg/SVGLayoutSupport.h" |
14 #include "core/paint/FindPropertiesNeedingUpdate.h" | 15 #include "core/paint/FindPropertiesNeedingUpdate.h" |
15 #include "core/paint/ObjectPaintProperties.h" | 16 #include "core/paint/ObjectPaintProperties.h" |
16 #include "core/paint/PaintLayer.h" | 17 #include "core/paint/PaintLayer.h" |
17 #include "core/paint/SVGRootPainter.h" | 18 #include "core/paint/SVGRootPainter.h" |
18 #include "platform/transforms/TransformationMatrix.h" | 19 #include "platform/transforms/TransformationMatrix.h" |
19 #include "wtf/PtrUtil.h" | 20 #include "wtf/PtrUtil.h" |
20 #include <memory> | 21 #include <memory> |
21 | 22 |
22 namespace blink { | 23 namespace blink { |
23 | 24 |
(...skipping 365 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
389 context.current.shouldFlattenInheritedTransform = true; | 390 context.current.shouldFlattenInheritedTransform = true; |
390 } | 391 } |
391 } | 392 } |
392 } | 393 } |
393 | 394 |
394 void PaintPropertyTreeBuilder::updateEffect( | 395 void PaintPropertyTreeBuilder::updateEffect( |
395 const LayoutObject& object, | 396 const LayoutObject& object, |
396 PaintPropertyTreeBuilderContext& context) { | 397 PaintPropertyTreeBuilderContext& context) { |
397 const ComputedStyle& style = object.styleRef(); | 398 const ComputedStyle& style = object.styleRef(); |
398 | 399 |
399 // TODO(crbug.com/673500): style.isStackingContext() is only meaningful for | 400 const bool isCSSIsolatedGroup = |
400 // HTML elements. What we really want to ask is whether the element starts | 401 object.isBoxModelObject() && style.isStackingContext(); |
401 // an isolated group, and SVGs use a different rule. | 402 const bool isSVGExceptRoot = object.isSVG() && !object.isSVGRoot(); |
402 if (!style.isStackingContext()) { | 403 if (!isCSSIsolatedGroup && !isSVGExceptRoot) { |
403 if (object.needsPaintPropertyUpdate() || context.forceSubtreeUpdate) { | 404 if (object.needsPaintPropertyUpdate() || context.forceSubtreeUpdate) { |
404 if (auto* properties = object.getMutableForPainting().paintProperties()) | 405 if (auto* properties = object.getMutableForPainting().paintProperties()) |
405 context.forceSubtreeUpdate |= properties->clearEffect(); | 406 context.forceSubtreeUpdate |= properties->clearEffect(); |
406 } | 407 } |
407 return; | 408 return; |
408 } | 409 } |
409 | 410 |
410 // TODO(trchen): Can't omit effect node if we have 3D children. | 411 // TODO(trchen): Can't omit effect node if we have 3D children. |
411 if (object.needsPaintPropertyUpdate() || context.forceSubtreeUpdate) { | 412 if (object.needsPaintPropertyUpdate() || context.forceSubtreeUpdate) { |
412 bool effectNodeNeeded = false; | 413 bool effectNodeNeeded = false; |
413 | 414 |
414 // Can't omit effect node if we have paint children with exotic blending. | 415 // Can't omit effect node if we have paint children with exotic blending. |
415 if (object.isSVG()) { | 416 if (object.isSVG()) { |
416 // Yes, including LayoutSVGRoot, because SVG layout objects don't create | 417 // Yes, including LayoutSVGRoot, because SVG layout objects don't create |
417 // PaintLayer so PaintLayer::hasNonIsolatedDescendantWithBlendMode() | 418 // PaintLayer so PaintLayer::hasNonIsolatedDescendantWithBlendMode() |
418 // doesn't catch SVG descendants. | 419 // doesn't catch SVG descendants. |
419 if (object.hasNonIsolatedBlendingDescendants()) | 420 if (SVGLayoutSupport::isIsolationRequired(&object)) |
420 effectNodeNeeded = true; | 421 effectNodeNeeded = true; |
421 } else if (PaintLayer* layer = toLayoutBoxModelObject(object).layer()) { | 422 } else if (PaintLayer* layer = toLayoutBoxModelObject(object).layer()) { |
422 if (layer->hasNonIsolatedDescendantWithBlendMode()) | 423 if (layer->hasNonIsolatedDescendantWithBlendMode()) |
423 effectNodeNeeded = true; | 424 effectNodeNeeded = true; |
424 } | 425 } |
425 | 426 |
426 SkBlendMode blendMode = | 427 SkBlendMode blendMode = object.isBlendingAllowed() |
427 WebCoreCompositeToSkiaComposite(CompositeSourceOver, style.blendMode()); | 428 ? WebCoreCompositeToSkiaComposite( |
| 429 CompositeSourceOver, style.blendMode()) |
| 430 : SkBlendMode::kSrcOver; |
428 if (blendMode != SkBlendMode::kSrcOver) | 431 if (blendMode != SkBlendMode::kSrcOver) |
429 effectNodeNeeded = true; | 432 effectNodeNeeded = true; |
430 | 433 |
431 float opacity = style.opacity(); | 434 float opacity = style.opacity(); |
432 if (opacity != 1.0f) | 435 if (opacity != 1.0f) |
433 effectNodeNeeded = true; | 436 effectNodeNeeded = true; |
434 | 437 |
435 CompositorFilterOperations filter; | 438 CompositorFilterOperations filter; |
436 if (object.isSVG() && !object.isSVGRoot()) { | 439 if (object.isSVG() && !object.isSVGRoot()) { |
437 // TODO(trchen): SVG caches filters in SVGResources. Implement it. | 440 // TODO(trchen): SVG caches filters in SVGResources. Implement it. |
(...skipping 525 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
963 updateOverflowClip(object, context); | 966 updateOverflowClip(object, context); |
964 updatePerspective(object, context); | 967 updatePerspective(object, context); |
965 updateSvgLocalToBorderBoxTransform(object, context); | 968 updateSvgLocalToBorderBoxTransform(object, context); |
966 updateScrollAndScrollTranslation(object, context); | 969 updateScrollAndScrollTranslation(object, context); |
967 updateOutOfFlowContext(object, context); | 970 updateOutOfFlowContext(object, context); |
968 | 971 |
969 context.forceSubtreeUpdate |= object.subtreeNeedsPaintPropertyUpdate(); | 972 context.forceSubtreeUpdate |= object.subtreeNeedsPaintPropertyUpdate(); |
970 } | 973 } |
971 | 974 |
972 } // namespace blink | 975 } // namespace blink |
OLD | NEW |