| 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 2629 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2640 | 2640 |
| 2641 } // unnamed namespace | 2641 } // unnamed namespace |
| 2642 | 2642 |
| 2643 FilterOperations PaintLayer::computeFilterOperations(const ComputedStyle& style)
const | 2643 FilterOperations PaintLayer::computeFilterOperations(const ComputedStyle& style)
const |
| 2644 { | 2644 { |
| 2645 FilterOperations filterOperations = style.filter(); | 2645 FilterOperations filterOperations = style.filter(); |
| 2646 if (RuntimeEnabledFeatures::cssBoxReflectFilterEnabled() && layoutObject()->
hasReflection() && layoutObject()->isBox()) { | 2646 if (RuntimeEnabledFeatures::cssBoxReflectFilterEnabled() && layoutObject()->
hasReflection() && layoutObject()->isBox()) { |
| 2647 // TODO(jbroman): Incorporate the mask image. | 2647 // TODO(jbroman): Incorporate the mask image. |
| 2648 const auto* reflectStyle = style.boxReflect(); | 2648 const auto* reflectStyle = style.boxReflect(); |
| 2649 FloatRect frameRect(toLayoutBox(layoutObject())->frameRect()); | 2649 FloatRect frameRect(toLayoutBox(layoutObject())->frameRect()); |
| 2650 ReflectionDirection direction = VerticalReflection; | 2650 BoxReflection::ReflectionDirection direction = BoxReflection::VerticalRe
flection; |
| 2651 float offset = 0; | 2651 float offset = 0; |
| 2652 switch (reflectStyle->direction()) { | 2652 switch (reflectStyle->direction()) { |
| 2653 case ReflectionAbove: | 2653 case ReflectionAbove: |
| 2654 direction = VerticalReflection; | 2654 direction = BoxReflection::VerticalReflection; |
| 2655 offset = -floatValueForLength(reflectStyle->offset(), frameRect.heig
ht()); | 2655 offset = -floatValueForLength(reflectStyle->offset(), frameRect.heig
ht()); |
| 2656 break; | 2656 break; |
| 2657 case ReflectionBelow: | 2657 case ReflectionBelow: |
| 2658 direction = VerticalReflection; | 2658 direction = BoxReflection::VerticalReflection; |
| 2659 offset = 2 * frameRect.height() + floatValueForLength(reflectStyle->
offset(), frameRect.height()); | 2659 offset = 2 * frameRect.height() + floatValueForLength(reflectStyle->
offset(), frameRect.height()); |
| 2660 break; | 2660 break; |
| 2661 case ReflectionLeft: | 2661 case ReflectionLeft: |
| 2662 direction = HorizontalReflection; | 2662 direction = BoxReflection::HorizontalReflection; |
| 2663 offset = -floatValueForLength(reflectStyle->offset(), frameRect.widt
h()); | 2663 offset = -floatValueForLength(reflectStyle->offset(), frameRect.widt
h()); |
| 2664 break; | 2664 break; |
| 2665 case ReflectionRight: | 2665 case ReflectionRight: |
| 2666 direction = HorizontalReflection; | 2666 direction = BoxReflection::HorizontalReflection; |
| 2667 offset = 2 * frameRect.width() + floatValueForLength(reflectStyle->o
ffset(), frameRect.width()); | 2667 offset = 2 * frameRect.width() + floatValueForLength(reflectStyle->o
ffset(), frameRect.width()); |
| 2668 break; | 2668 break; |
| 2669 } | 2669 } |
| 2670 | 2670 |
| 2671 // Since the filter origin is the corner of the input bounds, which may | 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 | 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 | 2673 // offset to also account for this offset (this is equivalent to using |
| 2674 // SkLocalMatrixImageFilter, but simpler). | 2674 // SkLocalMatrixImageFilter, but simpler). |
| 2675 // The rect used here should match the one used in FilterPainter. | 2675 // The rect used here should match the one used in FilterPainter. |
| 2676 LayoutRect filterInputBounds = physicalBoundingBoxIncludingReflectionAnd
StackingChildren(LayoutPoint()); | 2676 LayoutRect filterInputBounds = physicalBoundingBoxIncludingReflectionAnd
StackingChildren(LayoutPoint()); |
| 2677 offset -= 2 * (direction == VerticalReflection ? filterInputBounds.y() :
filterInputBounds.x()).toFloat(); | 2677 offset -= 2 * (direction == BoxReflection::VerticalReflection ? filterIn
putBounds.y() : filterInputBounds.x()).toFloat(); |
| 2678 | 2678 |
| 2679 filterOperations.operations().append(BoxReflectFilterOperation::create(d
irection, offset)); | 2679 BoxReflection reflection(direction, offset); |
| 2680 filterOperations.operations().append(BoxReflectFilterOperation::create(r
eflection)); |
| 2680 } | 2681 } |
| 2681 return computeFilterOperationsHandleReferenceFilters(filterOperations, style
.effectiveZoom(), enclosingNode()); | 2682 return computeFilterOperationsHandleReferenceFilters(filterOperations, style
.effectiveZoom(), enclosingNode()); |
| 2682 } | 2683 } |
| 2683 | 2684 |
| 2684 FilterOperations PaintLayer::computeBackdropFilterOperations(const ComputedStyle
& style) const | 2685 FilterOperations PaintLayer::computeBackdropFilterOperations(const ComputedStyle
& style) const |
| 2685 { | 2686 { |
| 2686 return computeFilterOperationsHandleReferenceFilters(style.backdropFilter(),
style.effectiveZoom(), enclosingNode()); | 2687 return computeFilterOperationsHandleReferenceFilters(style.backdropFilter(),
style.effectiveZoom(), enclosingNode()); |
| 2687 } | 2688 } |
| 2688 | 2689 |
| 2689 PaintLayerFilterInfo& PaintLayer::ensureFilterInfo() | 2690 PaintLayerFilterInfo& PaintLayer::ensureFilterInfo() |
| (...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2932 | 2933 |
| 2933 void showLayerTree(const blink::LayoutObject* layoutObject) | 2934 void showLayerTree(const blink::LayoutObject* layoutObject) |
| 2934 { | 2935 { |
| 2935 if (!layoutObject) { | 2936 if (!layoutObject) { |
| 2936 fprintf(stderr, "Cannot showLayerTree. Root is (nil)\n"); | 2937 fprintf(stderr, "Cannot showLayerTree. Root is (nil)\n"); |
| 2937 return; | 2938 return; |
| 2938 } | 2939 } |
| 2939 showLayerTree(layoutObject->enclosingLayer()); | 2940 showLayerTree(layoutObject->enclosingLayer()); |
| 2940 } | 2941 } |
| 2941 #endif | 2942 #endif |
| OLD | NEW |