| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All rights
reserved. | 2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All rights
reserved. |
| 3 * | 3 * |
| 4 * Portions are Copyright (C) 1998 Netscape Communications Corporation. | 4 * Portions are Copyright (C) 1998 Netscape Communications Corporation. |
| 5 * | 5 * |
| 6 * Other contributors: | 6 * Other contributors: |
| 7 * Robert O'Callahan <roc+@cs.cmu.edu> | 7 * Robert O'Callahan <roc+@cs.cmu.edu> |
| 8 * David Baron <dbaron@fas.harvard.edu> | 8 * David Baron <dbaron@fas.harvard.edu> |
| 9 * Christian Biesinger <cbiesinger@web.de> | 9 * Christian Biesinger <cbiesinger@web.de> |
| 10 * Randall Jesup <rjesup@wgate.com> | 10 * Randall Jesup <rjesup@wgate.com> |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 65 #include "core/layout/LayoutScrollbarPart.h" | 65 #include "core/layout/LayoutScrollbarPart.h" |
| 66 #include "core/layout/LayoutTreeAsText.h" | 66 #include "core/layout/LayoutTreeAsText.h" |
| 67 #include "core/layout/LayoutView.h" | 67 #include "core/layout/LayoutView.h" |
| 68 #include "core/layout/compositing/CompositedLayerMapping.h" | 68 #include "core/layout/compositing/CompositedLayerMapping.h" |
| 69 #include "core/layout/compositing/PaintLayerCompositor.h" | 69 #include "core/layout/compositing/PaintLayerCompositor.h" |
| 70 #include "core/layout/svg/LayoutSVGResourceClipper.h" | 70 #include "core/layout/svg/LayoutSVGResourceClipper.h" |
| 71 #include "core/layout/svg/LayoutSVGRoot.h" | 71 #include "core/layout/svg/LayoutSVGRoot.h" |
| 72 #include "core/layout/svg/ReferenceFilterBuilder.h" | 72 #include "core/layout/svg/ReferenceFilterBuilder.h" |
| 73 #include "core/page/Page.h" | 73 #include "core/page/Page.h" |
| 74 #include "core/page/scrolling/ScrollingCoordinator.h" | 74 #include "core/page/scrolling/ScrollingCoordinator.h" |
| 75 #include "core/paint/BoxReflectionUtils.h" |
| 75 #include "core/paint/FilterEffectBuilder.h" | 76 #include "core/paint/FilterEffectBuilder.h" |
| 76 #include "core/paint/PaintTiming.h" | 77 #include "core/paint/PaintTiming.h" |
| 77 #include "platform/LengthFunctions.h" | 78 #include "platform/LengthFunctions.h" |
| 78 #include "platform/RuntimeEnabledFeatures.h" | 79 #include "platform/RuntimeEnabledFeatures.h" |
| 79 #include "platform/TraceEvent.h" | 80 #include "platform/TraceEvent.h" |
| 80 #include "platform/geometry/FloatPoint3D.h" | 81 #include "platform/geometry/FloatPoint3D.h" |
| 81 #include "platform/geometry/FloatRect.h" | 82 #include "platform/geometry/FloatRect.h" |
| 82 #include "platform/geometry/TransformState.h" | 83 #include "platform/geometry/TransformState.h" |
| 83 #include "platform/graphics/filters/Filter.h" | 84 #include "platform/graphics/filters/Filter.h" |
| 84 #include "platform/graphics/filters/SourceGraphic.h" | 85 #include "platform/graphics/filters/SourceGraphic.h" |
| (...skipping 2552 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2637 | 2638 |
| 2638 return filters; | 2639 return filters; |
| 2639 } | 2640 } |
| 2640 | 2641 |
| 2641 } // unnamed namespace | 2642 } // unnamed namespace |
| 2642 | 2643 |
| 2643 FilterOperations PaintLayer::computeFilterOperations(const ComputedStyle& style)
const | 2644 FilterOperations PaintLayer::computeFilterOperations(const ComputedStyle& style)
const |
| 2644 { | 2645 { |
| 2645 FilterOperations filterOperations = style.filter(); | 2646 FilterOperations filterOperations = style.filter(); |
| 2646 if (RuntimeEnabledFeatures::cssBoxReflectFilterEnabled() && layoutObject()->
hasReflection() && layoutObject()->isBox()) { | 2647 if (RuntimeEnabledFeatures::cssBoxReflectFilterEnabled() && layoutObject()->
hasReflection() && layoutObject()->isBox()) { |
| 2647 // TODO(jbroman): Incorporate the mask image. | 2648 BoxReflection reflection = boxReflectionForPaintLayer(*this, style); |
| 2648 const auto* reflectStyle = style.boxReflect(); | |
| 2649 FloatRect frameRect(toLayoutBox(layoutObject())->frameRect()); | |
| 2650 BoxReflection::ReflectionDirection direction = BoxReflection::VerticalRe
flection; | |
| 2651 float offset = 0; | |
| 2652 switch (reflectStyle->direction()) { | |
| 2653 case ReflectionAbove: | |
| 2654 direction = BoxReflection::VerticalReflection; | |
| 2655 offset = -floatValueForLength(reflectStyle->offset(), frameRect.heig
ht()); | |
| 2656 break; | |
| 2657 case ReflectionBelow: | |
| 2658 direction = BoxReflection::VerticalReflection; | |
| 2659 offset = 2 * frameRect.height() + floatValueForLength(reflectStyle->
offset(), frameRect.height()); | |
| 2660 break; | |
| 2661 case ReflectionLeft: | |
| 2662 direction = BoxReflection::HorizontalReflection; | |
| 2663 offset = -floatValueForLength(reflectStyle->offset(), frameRect.widt
h()); | |
| 2664 break; | |
| 2665 case ReflectionRight: | |
| 2666 direction = BoxReflection::HorizontalReflection; | |
| 2667 offset = 2 * frameRect.width() + floatValueForLength(reflectStyle->o
ffset(), frameRect.width()); | |
| 2668 break; | |
| 2669 } | |
| 2670 | |
| 2671 // Since the filter origin is the corner of the input bounds, which may | |
| 2672 // include visual overflow (e.g. due to box-shadow), we must adjust the | |
| 2673 // offset to also account for this offset (this is equivalent to using | |
| 2674 // SkLocalMatrixImageFilter, but simpler). | |
| 2675 // The rect used here should match the one used in FilterPainter. | |
| 2676 LayoutRect filterInputBounds = physicalBoundingBoxIncludingReflectionAnd
StackingChildren(LayoutPoint()); | |
| 2677 offset -= 2 * (direction == BoxReflection::VerticalReflection ? filterIn
putBounds.y() : filterInputBounds.x()).toFloat(); | |
| 2678 | |
| 2679 BoxReflection reflection(direction, offset); | |
| 2680 filterOperations.operations().append(BoxReflectFilterOperation::create(r
eflection)); | 2649 filterOperations.operations().append(BoxReflectFilterOperation::create(r
eflection)); |
| 2681 } | 2650 } |
| 2682 return computeFilterOperationsHandleReferenceFilters(filterOperations, style
.effectiveZoom(), enclosingNode()); | 2651 return computeFilterOperationsHandleReferenceFilters(filterOperations, style
.effectiveZoom(), enclosingNode()); |
| 2683 } | 2652 } |
| 2684 | 2653 |
| 2685 FilterOperations PaintLayer::computeBackdropFilterOperations(const ComputedStyle
& style) const | 2654 FilterOperations PaintLayer::computeBackdropFilterOperations(const ComputedStyle
& style) const |
| 2686 { | 2655 { |
| 2687 return computeFilterOperationsHandleReferenceFilters(style.backdropFilter(),
style.effectiveZoom(), enclosingNode()); | 2656 return computeFilterOperationsHandleReferenceFilters(style.backdropFilter(),
style.effectiveZoom(), enclosingNode()); |
| 2688 } | 2657 } |
| 2689 | 2658 |
| (...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2933 | 2902 |
| 2934 void showLayerTree(const blink::LayoutObject* layoutObject) | 2903 void showLayerTree(const blink::LayoutObject* layoutObject) |
| 2935 { | 2904 { |
| 2936 if (!layoutObject) { | 2905 if (!layoutObject) { |
| 2937 fprintf(stderr, "Cannot showLayerTree. Root is (nil)\n"); | 2906 fprintf(stderr, "Cannot showLayerTree. Root is (nil)\n"); |
| 2938 return; | 2907 return; |
| 2939 } | 2908 } |
| 2940 showLayerTree(layoutObject->enclosingLayer()); | 2909 showLayerTree(layoutObject->enclosingLayer()); |
| 2941 } | 2910 } |
| 2942 #endif | 2911 #endif |
| OLD | NEW |