OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2004, 2005, 2007, 2009 Apple Inc. All rights reserved. | 2 * Copyright (C) 2004, 2005, 2007, 2009 Apple Inc. All rights reserved. |
3 * (C) 2005 Rob Buis <buis@kde.org> | 3 * (C) 2005 Rob Buis <buis@kde.org> |
4 * (C) 2006 Alexander Kellett <lypanov@kde.org> | 4 * (C) 2006 Alexander Kellett <lypanov@kde.org> |
5 * Copyright (C) Research In Motion Limited 2010. All rights reserved. | 5 * Copyright (C) Research In Motion Limited 2010. All rights reserved. |
6 * | 6 * |
7 * Redistribution and use in source and binary forms, with or without | 7 * Redistribution and use in source and binary forms, with or without |
8 * modification, are permitted provided that the following conditions | 8 * modification, are permitted provided that the following conditions |
9 * are met: | 9 * are met: |
10 * 1. Redistributions of source code must retain the above copyright | 10 * 1. Redistributions of source code must retain the above copyright |
(...skipping 690 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
701 ASSERT(stopElement); | 701 ASSERT(stopElement); |
702 ASSERT(stop.style()); | 702 ASSERT(stop.style()); |
703 | 703 |
704 ts << " [offset=" << stopElement->offset()->currentValue()->value() | 704 ts << " [offset=" << stopElement->offset()->currentValue()->value() |
705 << "] [color=" << stopElement->stopColorIncludingOpacity() << "]\n"; | 705 << "] [color=" << stopElement->stopColorIncludingOpacity() << "]\n"; |
706 } | 706 } |
707 | 707 |
708 void writeResources(TextStream& ts, const LayoutObject& object, int indent) { | 708 void writeResources(TextStream& ts, const LayoutObject& object, int indent) { |
709 const ComputedStyle& style = object.styleRef(); | 709 const ComputedStyle& style = object.styleRef(); |
710 const SVGComputedStyle& svgStyle = style.svgStyle(); | 710 const SVGComputedStyle& svgStyle = style.svgStyle(); |
| 711 TreeScope& treeScope = object.document(); |
| 712 SVGTreeScopeResources& treeScopeResources = |
| 713 treeScope.ensureSVGTreeScopedResources(); |
711 | 714 |
712 // FIXME: We want to use SVGResourcesCache to determine which resources are | 715 // FIXME: We want to use SVGResourcesCache to determine which resources are |
713 // present, instead of quering the resource <-> id cache. | 716 // present, instead of quering the resource <-> id cache. |
714 // For now leave the DRT output as is, but later on we should change this so | 717 // For now leave the DRT output as is, but later on we should change this so |
715 // cycles are properly ignored in the DRT output. | 718 // cycles are properly ignored in the DRT output. |
716 if (!svgStyle.maskerResource().isEmpty()) { | 719 if (!svgStyle.maskerResource().isEmpty()) { |
717 if (LayoutSVGResourceMasker* masker = | 720 if (LayoutSVGResourceMasker* masker = |
718 getLayoutSVGResourceById<LayoutSVGResourceMasker>( | 721 getLayoutSVGResourceById<LayoutSVGResourceMasker>( |
719 object.document(), svgStyle.maskerResource())) { | 722 treeScopeResources, svgStyle.maskerResource())) { |
720 writeIndent(ts, indent); | 723 writeIndent(ts, indent); |
721 ts << " "; | 724 ts << " "; |
722 writeNameAndQuotedValue(ts, "masker", svgStyle.maskerResource()); | 725 writeNameAndQuotedValue(ts, "masker", svgStyle.maskerResource()); |
723 ts << " "; | 726 ts << " "; |
724 writeStandardPrefix(ts, *masker, 0); | 727 writeStandardPrefix(ts, *masker, 0); |
725 ts << " " << masker->resourceBoundingBox(&object) << "\n"; | 728 ts << " " << masker->resourceBoundingBox(&object) << "\n"; |
726 } | 729 } |
727 } | 730 } |
728 if (ClipPathOperation* clipPathOperation = style.clipPath()) { | 731 if (ClipPathOperation* clipPathOperation = style.clipPath()) { |
729 if (clipPathOperation->type() == ClipPathOperation::REFERENCE) { | 732 if (clipPathOperation->type() == ClipPathOperation::REFERENCE) { |
730 const ReferenceClipPathOperation& clipPathReference = | 733 const ReferenceClipPathOperation& clipPathReference = |
731 toReferenceClipPathOperation(*clipPathOperation); | 734 toReferenceClipPathOperation(*clipPathOperation); |
732 AtomicString id = SVGURIReference::fragmentIdentifierFromIRIString( | 735 AtomicString id = SVGURIReference::fragmentIdentifierFromIRIString( |
733 clipPathReference.url(), object.document()); | 736 clipPathReference.url(), treeScope); |
734 if (LayoutSVGResourceClipper* clipper = | 737 if (LayoutSVGResourceClipper* clipper = |
735 getLayoutSVGResourceById<LayoutSVGResourceClipper>( | 738 getLayoutSVGResourceById<LayoutSVGResourceClipper>( |
736 object.document(), id)) { | 739 treeScopeResources, id)) { |
737 writeIndent(ts, indent); | 740 writeIndent(ts, indent); |
738 ts << " "; | 741 ts << " "; |
739 writeNameAndQuotedValue(ts, "clipPath", id); | 742 writeNameAndQuotedValue(ts, "clipPath", id); |
740 ts << " "; | 743 ts << " "; |
741 writeStandardPrefix(ts, *clipper, 0); | 744 writeStandardPrefix(ts, *clipper, 0); |
742 ts << " " << clipper->resourceBoundingBox(object.objectBoundingBox()) | 745 ts << " " << clipper->resourceBoundingBox(object.objectBoundingBox()) |
743 << "\n"; | 746 << "\n"; |
744 } | 747 } |
745 } | 748 } |
746 } | 749 } |
747 if (style.hasFilter()) { | 750 if (style.hasFilter()) { |
748 const FilterOperations& filterOperations = style.filter(); | 751 const FilterOperations& filterOperations = style.filter(); |
749 if (filterOperations.size() == 1) { | 752 if (filterOperations.size() == 1) { |
750 const FilterOperation& filterOperation = *filterOperations.at(0); | 753 const FilterOperation& filterOperation = *filterOperations.at(0); |
751 if (filterOperation.type() == FilterOperation::REFERENCE) { | 754 if (filterOperation.type() == FilterOperation::REFERENCE) { |
752 const auto& referenceFilterOperation = | 755 const auto& referenceFilterOperation = |
753 toReferenceFilterOperation(filterOperation); | 756 toReferenceFilterOperation(filterOperation); |
754 AtomicString id = SVGURIReference::fragmentIdentifierFromIRIString( | 757 AtomicString id = SVGURIReference::fragmentIdentifierFromIRIString( |
755 referenceFilterOperation.url(), object.document()); | 758 referenceFilterOperation.url(), treeScope); |
756 if (LayoutSVGResourceFilter* filter = | 759 if (LayoutSVGResourceFilter* filter = |
757 getLayoutSVGResourceById<LayoutSVGResourceFilter>( | 760 getLayoutSVGResourceById<LayoutSVGResourceFilter>( |
758 object.document(), id)) { | 761 treeScopeResources, id)) { |
759 writeIndent(ts, indent); | 762 writeIndent(ts, indent); |
760 ts << " "; | 763 ts << " "; |
761 writeNameAndQuotedValue(ts, "filter", id); | 764 writeNameAndQuotedValue(ts, "filter", id); |
762 ts << " "; | 765 ts << " "; |
763 writeStandardPrefix(ts, *filter, 0); | 766 writeStandardPrefix(ts, *filter, 0); |
764 ts << " " << filter->resourceBoundingBox(&object) << "\n"; | 767 ts << " " << filter->resourceBoundingBox(&object) << "\n"; |
765 } | 768 } |
766 } | 769 } |
767 } | 770 } |
768 } | 771 } |
769 } | 772 } |
770 | 773 |
771 } // namespace blink | 774 } // namespace blink |
OLD | NEW |