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 361 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
385 context.current.shouldFlattenInheritedTransform = true; | 386 context.current.shouldFlattenInheritedTransform = true; |
386 } | 387 } |
387 } | 388 } |
388 } | 389 } |
389 | 390 |
390 void PaintPropertyTreeBuilder::updateEffect( | 391 void PaintPropertyTreeBuilder::updateEffect( |
391 const LayoutObject& object, | 392 const LayoutObject& object, |
392 PaintPropertyTreeBuilderContext& context) { | 393 PaintPropertyTreeBuilderContext& context) { |
393 const ComputedStyle& style = object.styleRef(); | 394 const ComputedStyle& style = object.styleRef(); |
394 | 395 |
395 // TODO(crbug.com/673500): style.isStackingContext() is only meaningful for | 396 const bool isCSSIsolatedGroup = |
396 // HTML elements. What we really want to ask is whether the element starts | 397 object.isBoxModelObject() && style.isStackingContext(); |
397 // an isolated group, and SVGs use a different rule. | 398 const bool isSVGExceptRoot = object.isSVG() && !object.isSVGRoot(); |
398 if (!style.isStackingContext()) { | 399 if (!isCSSIsolatedGroup && !isSVGExceptRoot) { |
399 if (object.needsPaintPropertyUpdate() || context.forceSubtreeUpdate) { | 400 if (object.needsPaintPropertyUpdate() || context.forceSubtreeUpdate) { |
400 if (auto* properties = object.getMutableForPainting().paintProperties()) | 401 if (auto* properties = object.getMutableForPainting().paintProperties()) |
401 context.forceSubtreeUpdate |= properties->clearEffect(); | 402 context.forceSubtreeUpdate |= properties->clearEffect(); |
402 } | 403 } |
403 return; | 404 return; |
404 } | 405 } |
405 | 406 |
406 // TODO(trchen): Can't omit effect node if we have 3D children. | 407 // TODO(trchen): Can't omit effect node if we have 3D children. |
407 if (object.needsPaintPropertyUpdate() || context.forceSubtreeUpdate) { | 408 if (object.needsPaintPropertyUpdate() || context.forceSubtreeUpdate) { |
408 bool effectNodeNeeded = false; | 409 bool effectNodeNeeded = false; |
409 | 410 |
410 // Can't omit effect node if we have paint children with exotic blending. | 411 // Can't omit effect node if we have paint children with exotic blending. |
411 if (object.isSVG()) { | 412 if (object.isSVG()) { |
412 // Yes, including LayoutSVGRoot, because SVG layout objects don't create | 413 // Yes, including LayoutSVGRoot, because SVG layout objects don't create |
413 // PaintLayer so PaintLayer::hasNonIsolatedDescendantWithBlendMode() | 414 // PaintLayer so PaintLayer::hasNonIsolatedDescendantWithBlendMode() |
414 // doesn't catch SVG descendants. | 415 // doesn't catch SVG descendants. |
415 if (object.hasNonIsolatedBlendingDescendants()) | 416 if (SVGLayoutSupport::isIsolationRequired(&object)) |
416 effectNodeNeeded = true; | 417 effectNodeNeeded = true; |
417 } else if (PaintLayer* layer = toLayoutBoxModelObject(object).layer()) { | 418 } else if (PaintLayer* layer = toLayoutBoxModelObject(object).layer()) { |
418 if (layer->hasNonIsolatedDescendantWithBlendMode()) | 419 if (layer->hasNonIsolatedDescendantWithBlendMode()) |
419 effectNodeNeeded = true; | 420 effectNodeNeeded = true; |
420 } | 421 } |
421 | 422 |
422 SkBlendMode blendMode = | 423 SkBlendMode blendMode = object.isBlendingAllowed() |
423 WebCoreCompositeToSkiaComposite(CompositeSourceOver, style.blendMode()); | 424 ? WebCoreCompositeToSkiaComposite( |
| 425 CompositeSourceOver, style.blendMode()) |
| 426 : SkBlendMode::kSrcOver; |
424 if (blendMode != SkBlendMode::kSrcOver) | 427 if (blendMode != SkBlendMode::kSrcOver) |
425 effectNodeNeeded = true; | 428 effectNodeNeeded = true; |
426 | 429 |
427 float opacity = style.opacity(); | 430 float opacity = style.opacity(); |
428 if (opacity != 1.0f) | 431 if (opacity != 1.0f) |
429 effectNodeNeeded = true; | 432 effectNodeNeeded = true; |
430 | 433 |
431 CompositorFilterOperations filter; | 434 CompositorFilterOperations filter; |
432 if (object.isSVG() && !object.isSVGRoot()) { | 435 if (object.isSVG() && !object.isSVGRoot()) { |
433 // TODO(trchen): SVG caches filters in SVGResources. Implement it. | 436 // TODO(trchen): SVG caches filters in SVGResources. Implement it. |
(...skipping 518 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
952 #endif | 955 #endif |
953 | 956 |
954 updateOverflowClip(object, context); | 957 updateOverflowClip(object, context); |
955 updatePerspective(object, context); | 958 updatePerspective(object, context); |
956 updateSvgLocalToBorderBoxTransform(object, context); | 959 updateSvgLocalToBorderBoxTransform(object, context); |
957 updateScrollAndScrollTranslation(object, context); | 960 updateScrollAndScrollTranslation(object, context); |
958 updateOutOfFlowContext(object, context); | 961 updateOutOfFlowContext(object, context); |
959 } | 962 } |
960 | 963 |
961 } // namespace blink | 964 } // namespace blink |
OLD | NEW |